diff options
author | Francis Dupont <fdupont@isc.org> | 2015-09-04 10:42:21 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2015-09-04 10:42:21 +0200 |
commit | 8175031f4b9e11edef8cf7cd8d5c1bb6eea69d93 (patch) | |
tree | ba3c8ea09524a77a52c2c8e1c5f8816f0fbc39c8 /m4macros | |
parent | [4009] Added BOOST_ASIO_HEADER_ONLY define (diff) | |
download | kea-8175031f4b9e11edef8cf7cd8d5c1bb6eea69d93.tar.xz kea-8175031f4b9e11edef8cf7cd8d5c1bb6eea69d93.zip |
[4009] Fixed the libboost_system dependency for Boost < 1.56
Diffstat (limited to 'm4macros')
-rw-r--r-- | m4macros/ax_boost_for_kea.m4 | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/m4macros/ax_boost_for_kea.m4 b/m4macros/ax_boost_for_kea.m4 index eae4139e12..aa7979e926 100644 --- a/m4macros/ax_boost_for_kea.m4 +++ b/m4macros/ax_boost_for_kea.m4 @@ -13,9 +13,13 @@ dnl This macro also tries to identify some known portability issues, and 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 dnl This macro calls: dnl dnl AC_SUBST(BOOST_INCLUDES) +dnl AC_SUBST(BOOST_LIBS) dnl dnl And possibly sets: dnl CPPFLAGS_BOOST_THREADCONF should be added to CPPFLAGS by caller @@ -30,6 +34,9 @@ AC_DEFUN([AX_BOOST_FOR_KEA], [ AC_LANG_SAVE AC_LANG([C++]) +# No library by default (and as goal) +BOOST_LIBS= + # # Configure Boost header path # @@ -56,7 +63,7 @@ if test "${boost_include_path}" ; then BOOST_INCLUDES="-I${boost_include_path}" CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES" fi -AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp boost/asio.hpp boost/asio/ip/address.hpp],, +AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync/interprocess_upgradable_mutex.hpp boost/date_time/posix_time/posix_time_types.hpp boost/bind.hpp boost/function.hpp boost/asio.hpp boost/asio/ip/address.hpp boost/system/error_code.hpp],, AC_MSG_ERROR([Missing required header files.])) # clang can cause false positives with -Werror without -Qunused-arguments. @@ -125,9 +132,34 @@ void testfn(void) { BOOST_STATIC_ASSERT(true); } [AC_MSG_RESULT(no) BOOST_STATIC_ASSERT_WOULDFAIL=yes]) +# 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 <boost/system/error_code.hpp> +],, +[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.hpp>], + [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"]) + CXXFLAGS="$CXXFLAGS_SAVED" AC_SUBST(BOOST_INCLUDES) +AC_SUBST(BOOST_LIBS) dnl Determine the Boost version, used mainly for config.report. AC_MSG_CHECKING([Boost version]) |