From: Francis Dupont Date: Mon, 7 Sep 2015 11:52:25 +0000 (+0200) Subject: [4009] Added --with-boost-libs for Fedora 22 where it can be required X-Git-Tag: trac4060_base~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a6f76109d3618745914dab4467dc75df147e8b7f;p=thirdparty%2Fkea.git [4009] Added --with-boost-libs for Fedora 22 where it can be required --- diff --git a/Makefile.am b/Makefile.am index fc418f5d48..5b5de378f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,6 +8,7 @@ LCOV=@LCOV@ GENHTML=@GENHTML@ DISTCHECK_GTEST_CONFIGURE_FLAG=@DISTCHECK_GTEST_CONFIGURE_FLAG@ DISTCHECK_CRYPTO_CONFIGURE_FLAG=@DISTCHECK_CRYPTO_CONFIGURE_FLAG@ +DISTCHECK_BOOST_CONFIGURE_FLAG=@DISTCHECK_BOOST_CONFIGURE_FLAG@ DISTCLEANFILES = config.report @@ -20,6 +21,9 @@ DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_GTEST_CONFIGURE_FLAG) # Keep the crypto backend config DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_CRYPTO_CONFIGURE_FLAG) +# Keep the Boost configuration which becomes sensible +DISTCHECK_CONFIGURE_FLAGS += $(DISTCHECK_BOOST_CONFIGURE_FLAG) + dist_doc_DATA = AUTHORS COPYING ChangeLog README .PHONY: check-valgrind check-valgrind-suppress diff --git a/m4macros/ax_boost_for_kea.m4 b/m4macros/ax_boost_for_kea.m4 index aa7979e926..ce6b3bad2c 100644 --- a/m4macros/ax_boost_for_kea.m4 +++ b/m4macros/ax_boost_for_kea.m4 @@ -14,12 +14,16 @@ dnl sets corresponding variables so the caller can react to (or ignore, dnl depending on other configuration) specific issues appropriately. dnl dnl Boost.Asio depends on Boost.System which can be header only with -dnl versions >= 1.56. On older versions libboost_system is required. +dnl versions >= 1.56. On older and perhaps some recent versions +dnl libboost_system is required. +dnl --with-boost-libs can help giving extra arguments or forcing link +dnl with a Boost library dnl dnl This macro calls: dnl dnl AC_SUBST(BOOST_INCLUDES) dnl AC_SUBST(BOOST_LIBS) +dnl AC_SUBST(DISTCHECK_BOOST_CONFIGURE_FLAG) dnl dnl And possibly sets: dnl CPPFLAGS_BOOST_THREADCONF should be added to CPPFLAGS by caller @@ -34,6 +38,8 @@ AC_DEFUN([AX_BOOST_FOR_KEA], [ AC_LANG_SAVE AC_LANG([C++]) +DISTCHECK_BOOST_CONFIGURE_FLAG= + # No library by default (and as goal) BOOST_LIBS= @@ -55,6 +61,8 @@ if test -z "$with_boost_include"; then break fi done +else + DISTCHECK_BOOST_CONFIGURE_FLAG="--with-boost-include=${boost_include_path}" fi # Check the path with some specific headers. @@ -132,34 +140,52 @@ void testfn(void) { BOOST_STATIC_ASSERT(true); } [AC_MSG_RESULT(no) BOOST_STATIC_ASSERT_WOULDFAIL=yes]) +# Get libs when explicitly configured +AC_ARG_WITH([boost-libs], + AC_HELP_STRING([--with-boost-libs=SPEC], + [specify Boost libraries to link with]), + [BOOST_LIBS="$withval" + DISTCHECK_BOOST_CONFIGURE_FLAG="$DISTCHECK_BOOST_CONFIGURE_FLAG --with-boost-libs=$withval"]) + # BOOST_ERROR_CODE_HEADER_ONLY in versions below Boost 1.56.0 can fail # to find the error_code.cpp file. -AC_MSG_CHECKING([BOOST_ERROR_CODE_HEADER_ONLY works]) -CXXFLAGS_SAVED2="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS -DBOOST_ERROR_CODE_HEADER_ONLY" -CPPFLAGS="$CPPFLAGS -DBOOST_SYSTEM_NO_DEPRECATED" -AC_TRY_COMPILE([ -#include -],, -[AC_MSG_RESULT(yes)], -[AC_MSG_RESULT(no) - AC_MSG_WARN([The Boost system library is required.]) - BOOST_LIBS="-lboost_system" - LIBS_SAVED="$LIBS" - LIBS="$BOOST_LIBS $LIBS" - CPPFLAGS="$CXXFLAGS_SAVED2" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([#include ], - [boost::system::error_code ec;])], - [AC_MSG_RESULT([checking for Boost system library... yes])], - [AC_MSG_RESULT([checking for Boost system library... no]) - AC_MSG_ERROR([Linking with ${BOOST_LIBS} is not enough: please make sure libboost_system is installed])]) - LIBS="$LIBS_SAVED"]) +if test "x${BOOST_LIBS}" = "x"; then + AC_MSG_CHECKING([BOOST_ERROR_CODE_HEADER_ONLY works]) + CXXFLAGS_SAVED2="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -DBOOST_ERROR_CODE_HEADER_ONLY" + CPPFLAGS="$CPPFLAGS -DBOOST_SYSTEM_NO_DEPRECATED" + + AC_TRY_COMPILE([ + #include + ],, + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_MSG_WARN([The Boost system library is required.]) + BOOST_LIBS="-lboost_system"]) + + CPPFLAGS="$CXXFLAGS_SAVED2" +fi + +# A Boost library is used. +if test "x${BOOST_LIBS}" != "x"; then + LIBS_SAVED="$LIBS" + LIBS="$BOOST_LIBS $LIBS" + + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ], + [boost::system::error_code ec;])], + [AC_MSG_RESULT([checking for Boost system library... yes])], + [AC_MSG_RESULT([checking for Boost system library... no]) + AC_MSG_ERROR([Linking with ${BOOST_LIBS} is not enough: please make sure libboost_system is installed])]) + + LIBS="$LIBS_SAVED" +fi CXXFLAGS="$CXXFLAGS_SAVED" AC_SUBST(BOOST_INCLUDES) AC_SUBST(BOOST_LIBS) +AC_SUBST(DISTCHECK_BOOST_CONFIGURE_FLAG) dnl Determine the Boost version, used mainly for config.report. AC_MSG_CHECKING([Boost version])