1 # configure for Boost libs
3 # ID_BOOST([components],[libs])
5 # Sets the following variables:
9 # If components include "thread":
11 # If components include "test":
16 AC_SUBST([BOOST_CPPFLAGS])
19 AC_MSG_CHECKING([for Boost])
21 oldCPPFLAGS="$CPPFLAGS"
23 BOOST_REQ_VERSION=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 100 + [$]3;}'`
24 CPPFLAGS="$CPPFLAGS -DBOOST_REQ_VERSION=${BOOST_REQ_VERSION}"
26 AC_ARG_WITH([boost],[ --with-boost=DIR use Boost in prefix DIR])
27 if test "$with_boost" = "yes" -o -z "$with_boost"; then
31 BOOST_LIB="-L${with_boost}/lib"
32 BOOST_CPPFLAGS="-I${with_boost}/include"
33 if test ! -f "${with_boost}/include/version.hpp"; then
34 for b in ${with_boost}/include/boost-*; do
39 AC_ARG_WITH([boost-toolset],[ --with-boost-toolset=x use Boost toolset (eg gcc43)])
40 if test "$with_boost_toolset" = "yes" -o -z "$with_boost_toolset"; then
43 BOOST_TOOLSET="-${with_boost_toolset}"
45 if test "${with_boost}" = "no"; then
46 AC_MSG_RESULT([disabled])
48 CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
49 LIBS="${LIBS} ${BOOST_LIB}"
52 #include <boost/version.hpp>
53 version_is:BOOST_VERSION
55 BOOST_GOT_VERSION=`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | $EGREP version_is 2>/dev/null | cut -d ":" -f2`
56 if test "$BOOST_GOT_VERSION" = "BOOST_VERSION"; then
58 AC_MSG_ERROR([Boost development libraries required])
60 AC_MSG_RESULT([yes ($BOOST_GOT_VERSION)])
61 if test "$BOOST_GOT_VERSION" -lt $BOOST_REQ_VERSION; then
62 AC_MSG_ERROR([Boost version $BOOST_REQ_VERSION required])
67 AC_MSG_CHECKING([Boost threads])
68 AC_SUBST([BOOST_THREAD_LIB])
71 for l in boost_thread${BOOST_TOOLSET}-mt boost_thread${BOOST_TOOLSET}; do
72 LIBS="${saveLIBS} -l${l}"
73 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
74 #include <boost/version.hpp>
75 #include <boost/thread/thread.hpp>
77 int x = BOOST_VERSION;
79 BOOST_THREAD_LIB="-l${l}"
82 if test "${BOOST_THREAD_LIB}"; then
89 AC_MSG_CHECKING([Boost unit test framework])
91 AC_SUBST([BOOST_TEST_LIB])
93 for l in boost_unit_test_framework${BOOST_TOOLSET}-mt boost_unit_test_framework${BOOST_TOOLSET}; do
94 LIBS="${saveLIBS} -l${l}"
95 AC_LINK_IFELSE([AC_LANG_SOURCE([[
96 #define BOOST_TEST_DYN_LINK
97 #define BOOST_AUTO_TEST_MAIN
98 #include <boost/test/auto_unit_test.hpp>
99 BOOST_AUTO_TEST_CASE( t )
104 BOOST_TEST_LIB="-l${l}"
108 if test "${BOOST_TEST_LIB}"; then
118 CPPFLAGS="$oldCPPFLAGS"
124 dnl mode:shell-script
125 dnl sh-indentation: 2
126 dnl sh-basic-offset: 4