aboutsummaryrefslogtreecommitdiff
path: root/varnishapi.m4
diff options
context:
space:
mode:
Diffstat (limited to 'varnishapi.m4')
-rw-r--r--varnishapi.m466
1 files changed, 39 insertions, 27 deletions
diff --git a/varnishapi.m4 b/varnishapi.m4
index b3ef75d..0e176c9 100644
--- a/varnishapi.m4
+++ b/varnishapi.m4
@@ -1,5 +1,5 @@
## Autoconf macros for writing Varnish modules
-## Copyright (C) 2016 Sergey Poznyakoff
+## Copyright (C) 2016,2017 Sergey Poznyakoff
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -14,7 +14,7 @@
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
-## serial 1
+## serial 2
## VAPI_CHECK_VER([MAJOR], [MINOR], [PATCH]) - Check version
##
@@ -48,18 +48,24 @@ m4_define([VAPI_CHECK_VER],[
])])
## AM_VARNISHAPI([VERSION])
-## Test if the programs and libraries needed for compiling a varnish
-## module are present. If VERSION argument is supplied, check if varnish API
+## 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, check if varnish
-## API version is at least N.N.N. If API is older, emit error message and
-## abort. If it is newer, emit a warning message at the end of configure.
+## 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.
##
-## Set configuration variable VMODDIR to the path of the varnish module
-## directory.
-## Set VARNISHSRC to the pathname of the varnish source directory.
-## Set variables VARNISH_MAJOR, VARNISH_MINOR, and VARNISH_PATCH to the
-## corresponding numbers of the varnish API version.
+## Sets the following configuration variables:
+##
+## VMODDIR the path of the varnish module directory.
+## VARNISH_MAJOR, VARNISH_MINOR, and VARNISH_PATCH
+## the corresponding numbers of the varnish API version.
+## VARNISHD full pathname of the varnishd binary
+## VARNISHTEST full pathname of the varnishtest binary
+## VARNISHAPI_PKGDATADIR
+## varnish API package data directory
+## VARNISHAPI_VMODTOOL
+## full pathname of the vmodtool.py script
##
AC_DEFUN([AM_VARNISHAPI],
[ # Check for pkg-config
@@ -68,26 +74,23 @@ AC_DEFUN([AM_VARNISHAPI],
# Check for python
AC_CHECK_PROGS(PYTHON, [python], [AC_MSG_ERROR([python is not found.])])
- # Varnish source tree
+ # Varnish source tree (deprecated)
AC_ARG_VAR([VARNISHSRC], [path to Varnish source tree])
AC_ARG_WITH([varnish-source],
AC_HELP_STRING([--with-varnish-source=DIR],
[Varnish sources are located in DIR]),
[VARNISHSRC=$withval])
- if test -z "$VARNISHSRC"; then
- AC_MSG_ERROR([no Varnish source tree specified])
+ if test -n "$VARNISHSRC"; then
+ case "$VARNISHSRC" in
+ /*) ;;
+ *) AC_MSG_ERROR([varnish source path must be absolute pathname])
+ esac
fi
- case "$VARNISHSRC" in
- /*) ;;
- *) AC_MSG_ERROR([varnish source path must be absolute pathname])
- esac
-
- VARNISHSRC=$(cd $VARNISHSRC && pwd)
# pkg-config
PKG_PROG_PKG_CONFIG
- PKG_CHECK_MODULES([libvarnishapi], [varnishapi])
+ PKG_CHECK_MODULES([VARNISHAPI], [varnishapi])
varnishapi_version() {
VARNISHAPI_MAJOR=$[]1
@@ -111,11 +114,6 @@ m4_popdef([ver])],
AC_MSG_ERROR([unknown varnishapi version])
fi
- # Check that varnishtest is built in the varnish source directory
- AC_CHECK_FILE([$VARNISHSRC/bin/varnishtest/varnishtest],
- [],
- [AC_MSG_FAILURE([cannot find "$VARNISHSRC/bin/varnishtest/varnishtest". Please build your varnish source directory])])
-
# vmod installation dir
AC_ARG_VAR([VMODDIR], [vmod installation directory])
AC_ARG_WITH([vmoddir],
@@ -134,6 +132,20 @@ m4_popdef([ver])],
VMODDIR='$(libdir)/varnish/mods'
fi
+ AC_ARG_VAR([VARNISHD],[full pathname of the varnishd binary])
+ AC_PATH_PROG([VARNISHD],
+ [varnishd],[\$(abs_top_srcdir)/build-aux/missing varnishd],
+ [$($PKG_CONFIG --variable=sbindir varnishapi):$PATH])
+ AC_ARG_VAR([VARNISHTEST],[full pathname of the varnishtest binary])
+ AC_PATH_PROG([VARNISHTEST],
+ [varnishtest],[\$(abs_top_srcdir)/build-aux/missing varnishtest],
+ [$($PKG_CONFIG --variable=bindir varnishapi):$PATH])
+
+ AC_ARG_VAR([VARNISHAPI_PKGDATADIR],[full pathname of the varnish lib directory])
+ 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 ""

Return to:

Send suggestions and report system problems to the System administrator.