From: Alex Rousskov Date: Wed, 16 Feb 2011 17:57:09 +0000 (-0700) Subject: Use pkg-config's PKG_CHECK_MODULES to check for and link with libecap. X-Git-Tag: take03~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80ab04bb3148ee8dcce40704e4b382d24fb4c50a;p=thirdparty%2Fsquid.git Use pkg-config's PKG_CHECK_MODULES to check for and link with libecap. Side-effect: We can and do check whether Squid supports the installed libecap package version. This check avoids accidently building Squid with the wrong libecap release. TODO: Check whether the loaded eCAP adapter was build with a supported libecap version as well. --- diff --git a/configure.ac b/configure.ac index ac9a32f3f4..9c65346ab4 100644 --- a/configure.ac +++ b/configure.ac @@ -897,6 +897,9 @@ AC_MSG_RESULT([$squid_opt_use_ecap, explicitly]) ] ) +dnl Necessary if the first PKG_CHECK_MODULES call is conditional +PKG_PROG_PKG_CONFIG + dnl Perform configuration consistency checks for eCAP ECAPLIB="" if test "x$squid_opt_use_ecap" = "xyes"; @@ -908,17 +911,17 @@ then fi dnl eCAP support requires libecap - AC_CHECK_LIB([ecap], [main], - [ECAPLIB="-lecap"], - [AC_MSG_FAILURE([eCAP support requires libecap library, but no usable library was found])] - ) + dnl This Squid supports libecap v0.2.x + dnl Use EXT prefix or libtool will get confused with two libecaps: + dnl one "external" (that we check for here) and one our own convenience lib + PKG_CHECK_MODULES(EXTLIBECAP, [libecap > 0.2 libecap < 0.3]) fi AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes") if test "x$squid_opt_use_ecap" = "xyes"; then AC_DEFINE(USE_ECAP,1,[Enable eCAP support]) - ECAP_LIBS="ecap/libecap.la $ECAP_LIBS" + ECAP_LIBS="ecap/libecap.la" squid_opt_use_adaptation=yes else AC_DEFINE(USE_ECAP,0,[Disable eCAP support]) @@ -926,8 +929,6 @@ else fi dnl convenience library AC_SUBST(ECAP_LIBS) -dnl -lecap if needed -AC_SUBST(ECAPLIB) dnl enable adaptation if requested by specific adaptation mechanisms diff --git a/src/adaptation/Makefile.am b/src/adaptation/Makefile.am index 5ecd433aec..b9466de778 100644 --- a/src/adaptation/Makefile.am +++ b/src/adaptation/Makefile.am @@ -45,6 +45,6 @@ libadaptation_la_SOURCES = \ History.h # add libraries for specific adaptation schemes -libadaptation_la_LIBADD = $(ECAP_LIBS) $(ECAPLIB) $(ICAP_LIBS) +libadaptation_la_LIBADD = $(ECAP_LIBS) $(ICAP_LIBS) libadaptation_la_DEPENDENCIES = $(ECAP_LIBS) $(ICAP_LIBS) diff --git a/src/adaptation/ecap/Makefile.am b/src/adaptation/ecap/Makefile.am index 3e80f80ac9..5d54ee4846 100644 --- a/src/adaptation/ecap/Makefile.am +++ b/src/adaptation/ecap/Makefile.am @@ -16,3 +16,7 @@ libecap_la_SOURCES = \ XactionRep.cc \ \ Registry.h + +# add libecap using its pkg-config-produced configuration variables +libecap_la_LDFLAGS = $(EXTLIBECAP_LIBS) +libecap_la_CPPFLAGS = $(EXTLIBECAP_CFLAGS)