Permalink
Browse files

Use pkg-config to discover vmoddir

  • Loading branch information...
1 parent 3ca063c commit 811f06804e93c35bd317a3f0fbf04a25bae4093c @mbgrydeland mbgrydeland committed Feb 10, 2011
Showing with 12 additions and 4 deletions.
  1. +4 −2 README
  2. +8 −2 configure.ac
View
6 README
@@ -8,5 +8,7 @@ compile your vmod. Both the VARNISHSRCDIR and VARNISHSRCDIR/include
will be added to the include search paths for your module.
Optionally you can also set the vmod install dir by adding VMODDIR=DIR
-(defaults to LIBDIR/varnish/vmods, which would become
-/usr/local/lib/varnish/vmods on most platforms).
+(defaults to the pkg-config discovered directory from your Varnish
+installation).
+
+
View
@@ -1,6 +1,6 @@
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2011 Varnish Software AS])
-AC_INIT([libvmod_example], [0.1])
+AC_INIT([libvmod-example], [0.1])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR(src/vmod.vcc)
AM_CONFIG_HEADER(config.h)
@@ -22,6 +22,9 @@ AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
+# Check for pkg-config
+PKG_PROG_PKG_CONFIG
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/stdlib.h])
@@ -43,7 +46,10 @@ AC_CHECK_FILE([$VARNISHSRC/include/varnishapi.h],
# vmod installation dir
AC_ARG_VAR([VMODDIR], [vmod installation directory @<:@LIBDIR/varnish/vmods@:>@])
if test "x$VMODDIR" = x; then
- VMODDIR=$libdir/varnish/vmods
+ VMODDIR=`pkg-config --variable=vmoddir varnishapi`
+ if test "x$VMODDIR" = x; then
+ AC_MSG_FAILURE([Can't determine vmod installation directory])
+ fi
fi
AC_CONFIG_FILES([

0 comments on commit 811f068

Please sign in to comment.