]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4446: undefined reference to 'libecap::Name::Name'
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Jun 2016 04:53:56 +0000 (16:53 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 10 Jun 2016 04:53:56 +0000 (16:53 +1200)
Add autoconf link check for -lecap if it is going to be used.

Also, cleanup adaptation dependency situation. Automake *_DEPENDENCIES should
no longer be used and there is no need for both AC_SUBST component lists and
ENABLE_FOO conditionals to be defined. This allows simpler configure.ac logic
for both eCAP and ICAP.

configure.ac
src/adaptation/Makefile.am

index 286dbff85411915ffb2cc98d56054fad9b0cd352..35cacf1874feef8f7635b8d468b633879f8b234d 100644 (file)
@@ -966,13 +966,8 @@ AC_ARG_ENABLE(icap-client,
   SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
 ])
 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
-ICAP_LIBS=""
-if test "x$enable_icap_client" != "xno" ; then
-  ICAP_LIBS="icap/libicap.la"
-  squid_opt_use_adaptation=yes
-fi
+AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
 AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
-AC_SUBST(ICAP_LIBS)
 
 squid_opt_use_ecap=1
 AC_MSG_CHECKING(whether to support eCAP)
@@ -1010,16 +1005,32 @@ then
   else
     AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
   fi
-fi
 
-ECAP_LIBS=""
-if test "x$squid_opt_use_ecap" = "xyes"; then
-    ECAP_LIBS="ecap/libecapsquid.la"
+  SQUID_STATE_SAVE(squid_ecap_state)
+  AC_MSG_CHECKING([whether -lecap will link])
+  LDFLAGS="$LIBADD $EXT_LIBECAP_LIBS"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
+    const libecap::Name test("test", libecap::Name::NextId());
+  ]])],[
+    AC_MSG_RESULT(yes)
     squid_opt_use_adaptation=yes
+  ],[
+    AC_MSG_RESULT(no)
+    AS_IF(
+      test "x$squid_opt_use_ecap" = "xyes", AC_MSG_ERROR([eCAP library will not link.
+                  You may need to rebuild libecap using the same version of GCC as Squid.
+                  There have been breaking ABI changes in the libstdc++ STL with GCC 5.]),
+
+    [AC_MSG_NOTICE([eCAP library will not link.
+                  You may need to rebuild libecap using the same version of GCC as Squid.
+                  There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
+      squid_opt_use_ecap="no"
+    ])
+  ])
+  SQUID_STATE_ROLLBACK(squid_ecap_state)
 fi
 SQUID_DEFINE_BOOL(USE_ECAP,${squid_opt_use_ecap:=no},[Whether to use eCAP support])
 AM_CONDITIONAL(ENABLE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
-AC_SUBST(ECAP_LIBS)
 
 dnl enable adaptation if requested by specific adaptation mechanisms
 ADAPTATION_LIBS=""
index 0277e0470a2f2c864a43312a27a2e7c9cf0aec60..ac709bcb042e04c067c34537ab9e9300ba6b5934 100644 (file)
@@ -8,20 +8,11 @@
 include $(top_srcdir)/src/Common.am
 include $(top_srcdir)/src/TestHeaders.am
 
-## make a list of directories for configured adaptation schemes
+DIST_SUBDIRS= ecap icap
 SUBDIRS =
 
-if ENABLE_ICAP_CLIENT
-SUBDIRS += icap
-endif
-
-if ENABLE_ECAP
-SUBDIRS += ecap
-endif
-
 noinst_LTLIBRARIES = libadaptation.la
 
-## start with the code shared among all adaptation schemes
 libadaptation_la_SOURCES = \
        AccessCheck.cc \
        AccessCheck.h \
@@ -55,7 +46,15 @@ libadaptation_la_SOURCES = \
        History.cc \
        History.h
 
-# add libraries for specific adaptation schemes
-libadaptation_la_LIBADD = $(ECAP_LIBS) $(ICAP_LIBS)
+libadaptation_la_LIBADD =
+
+if ENABLE_ECAP
+SUBDIRS += ecap
+libadaptation_la_LIBADD += ecap/libecapsquid.la
+endif
+
+if ENABLE_ICAP_CLIENT
+SUBDIRS += icap
+libadaptation_la_LIBADD += icap/libicap.la
+endif
 
-libadaptation_la_DEPENDENCIES = $(ECAP_LIBS) $(ICAP_LIBS)