]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use pkg-config's PKG_CHECK_MODULES to check for and link with libecap.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 16 Feb 2011 17:57:09 +0000 (10:57 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 16 Feb 2011 17:57:09 +0000 (10:57 -0700)
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.

configure.ac
src/adaptation/Makefile.am
src/adaptation/ecap/Makefile.am

index ac9a32f3f4778469b48bfdec13e7e8abc58f5729..9c65346ab4b35b6d070f10ae54b5709eea46efcd 100644 (file)
@@ -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
index 5ecd433aec03fc96ec6361aaee7ed44f379ecd9b..b9466de778053c95a6d6b4c3412941ae7cd46f3e 100644 (file)
@@ -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)
index 3e80f80ac9ed0a1a6bebdf0733ce7d9bb2812067..5d54ee48466a1de5a26207283435433d66d49281 100644 (file)
@@ -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)