Commit 8175031f authored by Francis Dupont's avatar Francis Dupont

[4009] Fixed the libboost_system dependency for Boost < 1.56

parent d053d1fd
......@@ -1244,17 +1244,19 @@ AC_SUBST(GTEST_SOURCE)
# Use our 'coroutine' header from ext
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
#
# Disable threads: Currently we don't use them.
CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_THREADS=1"
#
# Don't want boost system library
CPPFLAGS="$CPPFLAGS -DBOOST_ERROR_CODE_HEADER_ONLY"
#
# Avoid boost::system::throws multiple defines
CPPFLAGS="$CPPFLAGS -DBOOST_SYSTEM_NO_DEPRECATED"
#
# Doesn't seem to be required?
CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_HEADER_ONLY"
#
# Disable threads: Currently we don't use them.
CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_THREADS=1"
# We tried to stay header only
if test "x${BOOST_LIBS}" = "x"; then
# Don't want boost system library
CPPFLAGS="$CPPFLAGS -DBOOST_ERROR_CODE_HEADER_ONLY"
# Avoid boost::system::throws multiple defines
CPPFLAGS="$CPPFLAGS -DBOOST_SYSTEM_NO_DEPRECATED"
fi
# Check for functions that are not available on all platforms
AC_CHECK_FUNCS([pselect])
......@@ -1573,6 +1575,7 @@ cat >> config.report << END
Boost:
BOOST_VERSION: ${BOOST_VERSION}
BOOST_INCLUDES: ${BOOST_INCLUDES}
BOOST_LIBS: ${BOOST_LIBS}
${CRYPTO_NAME}:
CRYPTO_VERSION: ${CRYPTO_VERSION}
......
......@@ -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])
......
......@@ -35,7 +35,8 @@ libkea_asiolink_la_SOURCES += udp_socket.h
# KEA_CXXFLAGS)
libkea_asiolink_la_CXXFLAGS = $(AM_CXXFLAGS)
libkea_asiolink_la_CPPFLAGS = $(AM_CPPFLAGS)
libkea_asiolink_la_LIBADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_asiolink_la_LIBADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_asiolink_la_LIBADD += $(BOOST_LIBS)
# IOAddress is sometimes used in user-library code
libkea_asiolink_includedir = $(pkgincludedir)/asiolink
......
......@@ -9,6 +9,7 @@ libkea_cc_la_SOURCES = data.cc data.h
libkea_cc_la_SOURCES += command_interpreter.cc command_interpreter.h
libkea_cc_la_LIBADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libkea_cc_la_LIBADD += $(BOOST_LIBS)
libkea_cc_la_LDFLAGS = -no-undefined -version-info 1:0:0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment