diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-10 14:28:49 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-08-10 14:28:49 +0300 |
commit | c8c62ae17d8bec6ee69ce63204d38112d6924e0c (patch) | |
tree | 39c5557c7d9a051c464add1de2670d40e2b843cd | |
parent | 43ef3ce139aa5ddb9aa0437c356a86290536900e (diff) | |
download | acvmod-c8c62ae17d8bec6ee69ce63204d38112d6924e0c.tar.gz acvmod-c8c62ae17d8bec6ee69ce63204d38112d6924e0c.tar.bz2 |
Change syntax of AM_VARNISHAPI macro call.
The macro takes up to two arguments: oldest supported and newest
tested Varnish versions.
-rw-r--r-- | README | 26 | ||||
-rw-r--r-- | varnishapi.m4 | 33 |
2 files changed, 39 insertions, 20 deletions
@@ -162,19 +162,27 @@ The following command was used to create initial set up of the | |||
162 | 162 | ||
163 | The =AM_VARNISHAPI= macro is used in =configure.ac= to check whether | 163 | The =AM_VARNISHAPI= macro is used in =configure.ac= to check whether |
164 | the varnish API components (header files and libraries) are installed | 164 | the varnish API components (header files and libraries) are installed |
165 | and are of sufficiently modern version. The macro is invoked with one | 165 | and are of sufficiently modern version. The macro is invoked with at |
166 | optional argument - the oldest required version of the API: | 166 | most two arguments, both of which are optional: |
167 | 167 | ||
168 | #+BEGIN_SRC autoconf | 168 | #+BEGIN_SRC autoconf |
169 | AM_VARNISHAPI([VERSION]) | 169 | AM_VARNISHAPI([MIN-VERSION],[MAX-VERSION]) |
170 | #+END_SRC | 170 | #+END_SRC |
171 | 171 | ||
172 | If =VERSION= argument is supplied, the macro checks if varnish API | 172 | The =MIN-VERSION= argument specifies the oldest supported version of |
173 | version is the same or newer than that version number. Otherwise, if | 173 | Varnish API. If the API is older than that, an error message will |
174 | package version string ends in -N.N.N, where N stands for a decimal | 174 | be emitted and configuration will be aborted. |
175 | digit, it checks if varnish API version is at least N.N.N. | 175 | |
176 | If API is older, it emits error message and aborts. If the version is | 176 | The =MAX-VERSION= argument specifies the newest version of Varnish API |
177 | newer, a warning message is emitted at the end of configure. | 177 | for which the package was tested. If the API is newer than that, a |
178 | warning message will be emitted at the end of the run to inform the | ||
179 | user about the fact. If MAX-VERSION is omitted, no such test is made. | ||
180 | |||
181 | If the macro is called without arguments, its behavior depends on | ||
182 | the package version (as specified in the AC_INIT macro call). If | ||
183 | the version ends in -N.N.N (where _N_ stands for a decimal | ||
184 | digit), the macro behaves as if it were invoked as | ||
185 | ~AM_VARNISHAPI(N.N.N)~. Otherwise, no version checking is performed. | ||
178 | 186 | ||
179 | The ~AM_VARNISHAPI~ macro sets the following configuration variables: | 187 | The ~AM_VARNISHAPI~ macro sets the following configuration variables: |
180 | 188 | ||
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],[ | |||
47 | fi | 47 | fi |
48 | ])]) | 48 | ])]) |
49 | 49 | ||
50 | ## AM_VARNISHAPI([VERSION]) | 50 | ## AM_VARNISHAPI([MIN-VERSION],[MAX-VERSION]) |
51 | ## Tests if the programs and libraries needed for compiling a varnish | 51 | ## Tests if the programs and libraries needed for compiling a varnish |
52 | ## module are present. If VERSION argument is supplied, checks if varnish API | 52 | ## module are present. If MIN-VERSION argument is supplied, checks if |
53 | ## version is the same or newer than that. Otherwise, if package version | 53 | ## varnish API version is the same or newer than that. If it is older, |
54 | ## string ends in -N.N.N, where N stands for a decimal digit, checks if varnish | 54 | ## emits error message and aborts. Otherwise, if MAX-VERSION is specified |
55 | ## API version is at least N.N.N. If API is older, emits error message and | 55 | ## checks varnish API version against that. If the version is newer than |
56 | ## aborts. If it is newer, emits a warning message at the end of configure. | 56 | ## both MAX-VERSION, a warning message to that effect will be emitted at |
57 | ## the end of configure. | ||
58 | ## | ||
59 | ## If no arguments are given, and the package version string ends in -N.N.N, | ||
60 | ## (where N stands for a decimal digit), the macro behaves as if it were | ||
61 | ## called as AM_VARNISHAPI([N.N.N]). | ||
57 | ## | 62 | ## |
58 | ## Sets the following configuration variables: | 63 | ## Sets the following configuration variables: |
59 | ## | 64 | ## |
@@ -96,11 +101,17 @@ AC_DEFUN([AM_VARNISHAPI], | |||
96 | IFS='.' | 101 | IFS='.' |
97 | varnishapi_version $v | 102 | varnishapi_version $v |
98 | IFS=$save_IFS | 103 | IFS=$save_IFS |
99 | VAPI_CHECK_VER(m4_if([$1],, | 104 | |
100 | [m4_pushdef([ver],[m4_bpatsubst(AC_PACKAGE_VERSION,[.*-\([0-9]\)\.\([0-9]\)\.\([0-9]\)$],[m4_quote(\1,\2,\3)])])dnl | 105 | m4_pushdef([ver],[m4_bpatsubst(AC_PACKAGE_VERSION,[.*-\([0-9]\.[0-9]\.[0-9]\)$],[\1])]) |
101 | m4_if(ver,AC_PACKAGE_VERSION,,[m4_unquote(ver)])dnl | 106 | |
102 | m4_popdef([ver])], | 107 | VAPI_CHECK_VER(m4_unquote(m4_split(m4_if([ver],AC_PACKAGE_VERSION,[$1],[$1],,[ver],[$1]),\.))) |
103 | [m4_unquote(m4_split([$1],\.))])) | 108 | |
109 | m4_if([$2],,[m4_if(ver,[AC_PACKAGE_VERSION],[# Suppress the warning message | ||
110 | varnishapi_version_diff=same])],dnl | ||
111 | [if test "$varnishapi_version_diff" = newer; then | ||
112 | VAPI_CHECK_VER(m4_unquote(m4_split([$2],\.))) | ||
113 | fi]) | ||
114 | m4_popdef([ver]) | ||
104 | else | 115 | else |
105 | AC_MSG_ERROR([unknown varnishapi version]) | 116 | AC_MSG_ERROR([unknown varnishapi version]) |
106 | fi | 117 | fi |