diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-12-10 12:58:46 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-12-10 12:58:46 +0200 |
commit | 5b214e3d72f9e261a37cf31deb41e7f8a61a1811 (patch) | |
tree | 7cbd83619a7675ea83ff5a8360a065475655e425 | |
parent | 5f6dce2f7dd35a154333bb42d134a018b981f812 (diff) | |
download | acvmod-5b214e3d72f9e261a37cf31deb41e7f8a61a1811.tar.gz acvmod-5b214e3d72f9e261a37cf31deb41e7f8a61a1811.tar.bz2 |
Fix version comparison in AM_VARNISHAPI. Improve diagnostics.
-rw-r--r-- | varnishapi.m4 | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/varnishapi.m4 b/varnishapi.m4 index 8a00c8f..147230c 100644 --- a/varnishapi.m4 +++ b/varnishapi.m4 @@ -24,36 +24,33 @@ ## the Varnish API version stored in environment variables VARNISHAPI_MAJOR, ## VARNISHAPI_MINOR, and VARNISHAPI_PATCH. Depending on the comparison, ## the code sets variable varnishapi_version_diff to one of: "older", "newer", ## or "same". ## m4_define([VAPI_CHECK_VER],[ m4_if([$1],,,[if test $VARNISHAPI_MAJOR -lt $1; then varnishapi_version_diff=older elif test $VARNISHAPI_MAJOR -gt $1; then varnishapi_version_diff=newer m4_if([$2],,,[elif test $VARNISHAPI_MINOR -lt $2; then varnishapi_version_diff=older - elif test $VARNISHAPI_MINOR -gt $2; then + ])elif test $VARNISHAPI_MINOR -gt m4_if([$2],,0,[$2]); then varnishapi_version_diff=newer - ])m4_if([$3],,,[elif test $VARNISHAPI_PATCH -lt $3; then + m4_if([$3],,,[elif test $VARNISHAPI_PATCH -lt $3; then varnishapi_version_diff=older - elif test $VARNISHAPI_PATCH -gt $3; then + ])elif test $VARNISHAPI_PATCH -gt m4_if([$3],,0,[$3]); then varnishapi_version_diff=newer - ])else + else varnishapi_version_diff=same fi - if test $varnishapi_version_diff = older; then - AC_MSG_ERROR([unsupported varnishapi version $VARNISHAPI_MAJOR.$VARNISHAPI_MINOR.$VARNISHAPI_PATCH]) - fi ])]) ## AM_VARNISHAPI([MIN-VERSION],[MAX-VERSION]) ## Tests if the programs and libraries needed for compiling a varnish ## 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, @@ -96,24 +93,27 @@ AC_DEFUN([AM_VARNISHAPI], v=$($PKG_CONFIG --modversion varnishapi) if test -n "$v"; then save_IFS=$IFS IFS='.' varnishapi_version $v IFS=$save_IFS 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]),\.))) + if test $varnishapi_version_diff = older; then + AC_MSG_ERROR([varnishapi version too old: $VARNISHAPI_MAJOR.$VARNISHAPI_MINOR.$VARNISHAPI_PATCH; required at least $1]) + fi 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 # vmod installation dir @@ -153,25 +153,25 @@ AC_DEFUN([AM_VARNISHAPI], VARNISHAPI_PKGDATADIR=$($PKG_CONFIG --variable=pkgdatadir varnishapi) AC_ARG_VAR([VARNISHAPI_VMODTOOL],[full pathname of the vmodtool.py script]) VARNISHAPI_VMODTOOL='$(VARNISHAPI_PKGDATADIR)/vmodtool.py' AC_CONFIG_COMMANDS([status],[ delim="---------------------------------------------------------------------------" echo "" echo $delim echo "Building for Varnish version $version" if test "$varnishapi_version_diff" = newer; then fmt <<EOT WARNING: This version is newer than the latest version for which -$PACKAGE_STRING was tested. If it doesn't compile, please send a mail to +$PACKAGE_STRING was tested ($2). If it doesn't compile, please report it to <$PACKAGE_BUGREPORT>. EOT fi echo $delim echo "" ], [version="$VARNISHAPI_MAJOR.$VARNISHAPI_MINOR" if test -n "$VARNISHAPI_PATCH"; then version="\$version.$VARNISHAPI_PATCH" fi varnishapi_version_diff=$varnishapi_version_diff PACKAGE_STRING="$PACKAGE_STRING" |