summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e73f418)
raw | patch | inline | side by side (parent: e73f418)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 7 Jun 2010 14:31:08 +0000 (16:31 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 7 Jun 2010 14:31:08 +0000 (16:31 +0200) |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history |
diff --git a/configure.in b/configure.in
index 79dd6f8abaee472b4afc70e9041199341f5e3d66..9cc96de84106126e7f129e07843fcceafc2f193a 100644 (file)
--- a/configure.in
+++ b/configure.in
# --with-libvarnish {{{
with_libvarnish_cppflags=""
-with_libvarnish_ldflags=""
-with_libvarnish_cflags="-lvarnish -lvarnishcompat -lvarnishapi"
+with_libvarnish_cflags=""
+with_libvarnish_libs=""
AC_ARG_WITH(libvarnish, [AS_HELP_STRING([--with-libvarnish@<:@=PREFIX@:>@], [Path to libvarnish.])],
[
- if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ if test "x$withval" = "xno"
+ then
+ with_libvarnish="no"
+ else if test "x$withval" = "xyes"
+ then
+ with_libvarnish="use_pkgconfig"
+ else if test -d "$with_libvarnish/lib"
then
- with_libvarnish_cppflags="-I$withval/include"
- with_libvarnish_ldflags="-L$withval/lib"
+ AC_MSG_NOTICE([Not checking for libvarnish: Manually configured])
+ with_libvarnish_cflags="-I$withval/include"
+ with_libvarnish_libs="-L$withval/lib -lvarnish -lvarnishcompat -lvarnishapi"
with_libvarnish="yes"
- else
- with_libvarnish="$withval"
- fi
+ fi; fi; fi
],
-[
+[with_libvarnish="use_pkgconfig"])
+
+# configure using pkg-config
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ if test "x$PKG_CONFIG" = "x"
+ then
+ with_libvarnish="no (Don't have pkg-config)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ AC_MSG_NOTICE([Checking for varnishapi using $PKG_CONFIG])
+ $PKG_CONFIG --exists 'varnishapi' 2>/dev/null
+ if test $? -ne 0
+ then
+ with_libvarnish="no (pkg-config doesn't know library)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
+ with_libvarnish_cflags="`$PKG_CONFIG --cflags 'varnishapi'`"
+ if test $? -ne 0
+ then
+ with_libvarnish="no ($PKG_CONFIG failed)"
+ fi
+ with_libvarnish_libs="`$PKG_CONFIG --libs 'varnishapi'`"
+ if test $? -ne 0
+ then
+ with_libvarnish="no ($PKG_CONFIG failed)"
+ fi
+fi
+if test "x$with_libvarnish" = "xuse_pkgconfig"
+then
with_libvarnish="yes"
-])
+fi
+
+# with_libvarnish_cflags and with_libvarnish_libs are set up now, let's do
+# the actual checks.
if test "x$with_libvarnish" = "xyes"
then
SAVE_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $with_libvarnish_cppflags"
-
- AC_CHECK_HEADERS(varnish/varnishapi.h, [with_libvarnish="yes"], [with_libvarnish="no (varnish/varnishapi.h not found)"])
+ CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
+ AC_CHECK_HEADERS(varnish/varnishapi.h, [], [with_libvarnish="no (varnish/varnishapi.h not found)"])
CPPFLAGS="$SAVE_CPPFLAGS"
fi
if test "x$with_libvarnish" = "xyes"
then
SAVE_CPPFLAGS="$CPPFLAGS"
- SAVE_LDFLAGS="$LDFLAGS"
- SAVE_CFLAGS="$CFLAGS"
- CPPFLAGS="$CPPFLAGS $with_libvarnish_cppflags"
- LDFLAGS="$LDFLAGS $with_libvarnish_ldflags"
- CFLAGS="$CFLAGS $with_libvarnish_cflags"
+ #SAVE_LDFLAGS="$LDFLAGS"
+
+ CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags"
+ #LDFLAGS="$LDFLAGS $with_libvarnish_libs"
- AC_CHECK_LIB(varnishapi, VSL_OpenStats, [with_libvarnish="yes"], [with_libvarnish="no (Symbol 'VSL_OpenStats' not found)"])
+ AC_CHECK_LIB(varnishapi, VSL_OpenStats,
+ [with_libvarnish="yes"],
+ [with_libvarnish="no (symbol VSL_OpenStats not found)"],
+ [$with_libvarnish_libs])
CPPFLAGS="$SAVE_CPPFLAGS"
- LDFLAGS="$SAVE_LDFLAGS"
- CFLAGS="$SAVE_CFLAGS"
+ #LDFLAGS="$SAVE_LDFLAGS"
fi
if test "x$with_libvarnish" = "xyes"
then
- BUILD_WITH_LIBVARNISH_CPPFLAGS="$with_libvarnish_cppflags"
- BUILD_WITH_LIBVARNISH_LDFLAGS="$with_libvarnish_ldflags"
- BUILD_WITH_LIBVARNISH_LIBS="-lvarnishcompat -lvarnish -lvarnishapi"
- AC_SUBST(BUILD_WITH_LIBVARNISH_CPPFLAGS)
- AC_SUBST(BUILD_WITH_LIBVARNISH_LDFLAGS)
+ BUILD_WITH_LIBVARNISH_CFLAGS="$with_libvarnish_cflags"
+ BUILD_WITH_LIBVARNISH_LIBS="$with_libvarnish_libs"
+ AC_SUBST(BUILD_WITH_LIBVARNISH_CFLAGS)
AC_SUBST(BUILD_WITH_LIBVARNISH_LIBS)
- AC_DEFINE(HAVE_LIBVARNISH, 1, [Define if libvarnish is present and usable.])
fi
-AM_CONDITIONAL(BUILD_WITH_LIBVARNISH, test "x$with_libvarnish" = "xyes")
# }}}
# pkg-config --exists 'libxml-2.0'; pkg-config --exists libvirt {{{
diff --git a/src/Makefile.am b/src/Makefile.am
index a343679ce82422c9e05649054ead7c83b5e55dde..00d0e20e0a9f9eec5eb51954627e529a4fb8913a 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
pkglib_LTLIBRARIES += varnish.la
varnish_la_SOURCES = varnish.c
varnish_la_LDFLAGS = -module -avoid-version
-varnish_la_CFLAGS = $(AM_CFLAGS)
-varnish_la_LIBADD =
+varnish_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBVARNISH_CFLAGS)
+varnish_la_LIBADD = $(BUILD_WITH_LIBVARNISH_LIBS)
collectd_LDADD += "-dlopen" varnish.la
-if BUILD_WITH_LIBVARNISH
-varnish_la_CFLAGS += $(BUILD_WITH_LIBVARNISH_CFLAGS)
-varnish_la_LIBADD += $(BUILD_WITH_LIBVARNISH_LIBS)
-endif
collectd_DEPENDENCIES += varnish.la
endif