summaryrefslogtreecommitdiffabout
path: root/varnishapi.m4
Side-by-side diff
Diffstat (limited to 'varnishapi.m4') (more/less context) (ignore whitespace changes)
-rw-r--r--varnishapi.m433
1 files changed, 22 insertions, 11 deletions
diff --git a/varnishapi.m4 b/varnishapi.m4
index 895b922..bc8e2e4 100644
--- a/varnishapi.m4
+++ b/varnishapi.m4
@@ -47,13 +47,18 @@ m4_define([VAPI_CHECK_VER],[
fi
])])
-## AM_VARNISHAPI([VERSION])
+## AM_VARNISHAPI([MIN-VERSION],[MAX-VERSION])
## Tests if the programs and libraries needed for compiling a varnish
-## module are present. If VERSION argument is supplied, checks if varnish API
-## version is the same or newer than that. Otherwise, if package version
-## string ends in -N.N.N, where N stands for a decimal digit, checks if varnish
-## API version is at least N.N.N. If API is older, emits error message and
-## aborts. If it is newer, emits a warning message at the end of configure.
+## module are present. If MIN-VERSION argument is supplied, checks if
+## varnish API version is the same or newer than that. If it is older,
+## emits error message and aborts. Otherwise, if MAX-VERSION is specified
+## checks varnish API version against that. If the version is newer than
+## both MAX-VERSION, a warning message to that effect will be emitted at
+## the end of configure.
+##
+## If no arguments are given, and the package version string ends in -N.N.N,
+## (where N stands for a decimal digit), the macro behaves as if it were
+## called as AM_VARNISHAPI([N.N.N]).
##
## Sets the following configuration variables:
##
@@ -96,11 +101,17 @@ AC_DEFUN([AM_VARNISHAPI],
IFS='.'
varnishapi_version $v
IFS=$save_IFS
- VAPI_CHECK_VER(m4_if([$1],,
- [m4_pushdef([ver],[m4_bpatsubst(AC_PACKAGE_VERSION,[.*-\([0-9]\)\.\([0-9]\)\.\([0-9]\)$],[m4_quote(\1,\2,\3)])])dnl
-m4_if(ver,AC_PACKAGE_VERSION,,[m4_unquote(ver)])dnl
-m4_popdef([ver])],
- [m4_unquote(m4_split([$1],\.))]))
+
+ m4_pushdef([ver],[m4_bpatsubst(AC_PACKAGE_VERSION,[.*-\([0-9]\.[0-9]\.[0-9]\)$],[\1])])
+
+ VAPI_CHECK_VER(m4_unquote(m4_split(m4_if([ver],AC_PACKAGE_VERSION,[$1],[$1],,[ver],[$1]),\.)))
+
+ m4_if([$2],,[m4_if(ver,[AC_PACKAGE_VERSION],[# Suppress the warning message
+ varnishapi_version_diff=same])],dnl
+ [if test "$varnishapi_version_diff" = newer; then
+ VAPI_CHECK_VER(m4_unquote(m4_split([$2],\.)))
+ fi])
+ m4_popdef([ver])
else
AC_MSG_ERROR([unknown varnishapi version])
fi

Return to:

Send suggestions and report system problems to the System administrator.