From: Amos Jeffries Date: Fri, 10 Jun 2016 04:53:56 +0000 (+1200) Subject: Bug 4446: undefined reference to 'libecap::Name::Name' X-Git-Tag: SQUID_4_0_12~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebf76e07ea8e1faae4932ccd032645c3b6e41fda;p=thirdparty%2Fsquid.git Bug 4446: undefined reference to 'libecap::Name::Name' 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. --- diff --git a/configure.ac b/configure.ac index 286dbff854..35cacf1874 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]],[[ + 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="" diff --git a/src/adaptation/Makefile.am b/src/adaptation/Makefile.am index 0277e0470a..ac709bcb04 100644 --- a/src/adaptation/Makefile.am +++ b/src/adaptation/Makefile.am @@ -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)