From bb872c5fab73fb5d9bc82be681e4882e2af10c09 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Wed, 10 Sep 2008 20:21:04 +0200 Subject: [PATCH] Handle Boost.System and adjust the code to handle the binary dependencies. Boost.Filesystem (and the libraries depending on it) now requires Boost.System at link time. Boost.System was introduced in Boost 1.35 so we must only try to find it if the version at hand is >= 1.35. Bug reported by Daniel Herring with some code contributions of Daniel Herring and Paul Balomiri. Signed-off-by: Benoit Sigoure --- ChangeLog | 20 ++++++++++++++++++ README | 4 ++++ THANKS | 1 + build-aux/boost.m4 | 61 +++++++++++++++++++++++++++++++++++++++++++++++------- tests/testsuite.at | 1 + 5 files changed, 80 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7dfb89..308ea56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2008-09-10 Benoit Sigoure + Handle Boost.System and adjust the code to handle the binary + dependencies. + + Boost.Filesystem (and the libraries depending on it) now requires + Boost.System at link time. Boost.System was introduced in Boost 1.35 + so we must only try to find it if the version at hand is >= 1.35. + * README: Add the new library and mention that BOOST_THREADS must be + invoked if Wave/Spirit is intended to be used with thread support. + * build-aux/boost.m4 (BOOST_REQUIRE): Define $boost_major_version. + (BOOST_FILESYSTEM): Also check for Boost.System if + $boost_major_version indicates we have Boost >= 1.35 at hand. + (BOOST_SYSTEM): New. + (BOOST_WAVE): Require Boost.Filesystem and Boost.DateTime. + * tests/testsuite.at: Add a test for BOOST_SYSTEM. + * THANKS: Update. + Bug reported by Daniel Herring with some code contributions of + Daniel Herring and Paul Balomiri. + +2008-09-10 Benoit Sigoure + Properly find the debug variant and adjust the library search order. * build-aux/boost.m4 (BOOST_REQUIRE): In order to get the proper debug variant of a library, the `d' must be properly inserted in the runtime diff --git a/README b/README index 69a2f3e..a4a726a 100644 --- a/README +++ b/README @@ -133,6 +133,7 @@ The following libraries are supported: - Regex - Serialization - Signals + - System - Test (aka Unit Test Framework) - Threads - Wave @@ -157,6 +158,9 @@ Small pitfall: BOOST_TEST generates BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS and BOOST_UNIT_TEST_FRAMEWORK_LIBS, not BOOST_TEST_LFDLAGS and BOOST_TEST_LIBS. Sorry for the inconsistency. +NOTE: If you intend to use Wave/Spirit with thread support, make sure you +call BOOST_THREADS first. + Writing your own checks / supporting more Boost libraries ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All the pre-existing library checks are written with help of diff --git a/THANKS b/THANKS index 3aded48..434417f 100644 --- a/THANKS +++ b/THANKS @@ -8,4 +8,5 @@ Alexandre Rostovtsev Daniel Herring Jens Seidel Hubert Figuière +Paul Balomiri Staffan Gimåker diff --git a/build-aux/boost.m4 b/build-aux/boost.m4 index 5223b36..ff27d08 100644 --- a/build-aux/boost.m4 +++ b/build-aux/boost.m4 @@ -21,7 +21,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# serial 7 +# serial 8 # Original sources can be found at http://repo.or.cz/w/boost.m4.git # You can fetch the latest version of the script by doing: # wget 'http://repo.or.cz/w/boost.m4.git?a=blob_plain;f=build-aux/boost.m4;hb=HEAD' -O boost.m4 @@ -159,6 +159,13 @@ AC_SUBST([BOOST_CPPFLAGS])dnl test -e "$boost_version_hpp" \ && boost_cv_lib_version=`sed "$boost_sed_version" "$boost_version_hpp"` ]) + # e.g. "134" for 1_34_1 or "135" for 1_35 + boost_major_version=`echo "$boost_cv_lib_version" | sed 's/_//;s/_.*//'` + case $boost_major_version in + '' | *[[^0-9]]*) + AC_MSG_ERROR([Invalid value: boost_major_version=$boost_major_version]) + ;; + esac m4_popdef([BOOST_VERSION_REQ])dnl ])# BOOST_REQUIRE @@ -383,12 +390,26 @@ AC_DEFUN([BOOST_DATE_TIME], # BOOST_FILESYSTEM([PREFERRED-RT-OPT]) # ------------------------------------ -# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see the -# documentation of BOOST_FIND_LIB above. -# Do not check for boost/filesystem.hpp because this file was introduced in 1.34. +# Look for Boost.Filesystem. For the documentation of PREFERRED-RT-OPT, see +# the documentation of BOOST_FIND_LIB above. +# Do not check for boost/filesystem.hpp because this file was introduced in +# 1.34. AC_DEFUN([BOOST_FILESYSTEM], -[BOOST_FIND_LIB([filesystem], [$1], +[# Do we have to check for Boost.System? This link-time dependency was +# added as of 1.35.0. If we have a version <1.35, we must not attempt to +# find Boost.System as it didn't exist by then. +if test $boost_major_version -ge 135; then +BOOST_SYSTEM([$1]) +fi # end of the Boost.System check. +boost_filesystem_save_LIBS=$LIBS +boost_filesystem_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS" +BOOST_FIND_LIB([filesystem], [$1], [boost/filesystem/path.hpp], [boost::filesystem::path p;]) +LIBS=$boost_filesystem_save_LIBS +LDFLAGS=$boost_filesystem_save_LDFLAGS ])# BOOST_FILESYSTEM @@ -528,6 +549,18 @@ AC_DEFUN([BOOST_STRING_ALGO], ]) +# BOOST_SYSTEM([PREFERRED-RT-OPT]) +# -------------------------------- +# Look for Boost.System. For the documentation of PREFERRED-RT-OPT, see the +# documentation of BOOST_FIND_LIB above. This library was introduced in Boost +# 1.35.0. +AC_DEFUN([BOOST_SYSTEM], +[BOOST_FIND_LIB([system], [$1], + [boost/system/error_code.hpp], + [boost::system::error_code e; e.clear();]) +])# BOOST_SYSTEM + + # BOOST_TEST([PREFERRED-RT-OPT]) # ------------------------------ # Look for Boost.Test. For the documentation of PREFERRED-RT-OPT, see the @@ -611,12 +644,26 @@ BOOST_FIND_HEADER([boost/variant.hpp])]) # BOOST_WAVE([PREFERRED-RT-OPT]) # ------------------------------ +# NOTE: If you intend to use Wave/Spirit with thread support, make sure you +# call BOOST_THREADS first. # Look for Boost.Wave. For the documentation of PREFERRED-RT-OPT, see the # documentation of BOOST_FIND_LIB above. AC_DEFUN([BOOST_WAVE], -[BOOST_FIND_LIB([wave], [$1], +[AC_REQUIRE([BOOST_FILESYSTEM])dnl +AC_REQUIRE([BOOST_DATE_TIME])dnl +boost_wave_save_LIBS=$LIBS +boost_wave_save_LDFLAGS=$LDFLAGS +m4_pattern_allow([^BOOST_((FILE)?SYSTEM|DATE_TIME|THREAD)_(LIBS|LDFLAGS)$])dnl +LIBS="$LIBS $BOOST_SYSTEM_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_DATE_TIME_LIBS\ +$BOOST_THREAD_LIBS" +LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS\ +$BOOST_DATE_TIME_LDFLAGS $BOOST_THREAD_LDFLAGS" +BOOST_FIND_LIB([wave], [$1], [boost/wave.hpp], - [boost::wave::token_id id; get_token_name(id);])]) + [boost::wave::token_id id; get_token_name(id);]) +LIBS=$boost_wave_save_LIBS +LDFLAGS=$boost_wave_save_LDFLAGS +])# BOOST_WAVE # ----------------- # diff --git a/tests/testsuite.at b/tests/testsuite.at index 11b7cd0..af8a5c2 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -268,6 +268,7 @@ AT_CHECK_MACRO([BOOST_IOSTREAMS (static)], [lib], [BOOST_IOSTREAMS([s])]) AT_CHECK_MACRO([BOOST_PROGRAM_OPTIONS], [lib]) AT_CHECK_MACRO([BOOST_SERIALIZATION], [lib]) AT_CHECK_MACRO([BOOST_SIGNALS], [lib]) +AT_CHECK_MACRO([BOOST_SYSTEM], [lib]) AT_CHECK_MACRO([BOOST_REGEX], [lib]) AT_CHECK_MACRO([BOOST_TEST], [lib]) AT_CHECK_MACRO([BOOST_TEST (static)], [lib], [BOOST_TEST([s])]) -- 2.11.4.GIT