# ID_BOOST([components],[libs])
AC_DEFUN([ID_BOOST],
[
+ AC_SUBST(BOOST_CPPFLAGS)
+ AC_SUBST(BOOST_LIB)
+
AC_MSG_CHECKING([for Boost])
AC_LANG_PUSH([C++])
oldCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -DBOOST_REQ_VERSION=${BOOST_REQ_VERSION}"
AC_ARG_WITH([boost],[[ --with-boost=DIR use Boost in prefix DIR]])
- if test "$with_boost" = "yes"; then
+ if test "$with_boost" = "yes" -o -z "$with_boost"; then
BOOST_CPPFLAGS=""
- BOOST_LIBS=""
+ BOOST_LIB=""
else
BOOST_CPPFLAGS="-I${with_boost}/include"
- BOOST_LIBS=" -L${with_boost}/lib"
+ BOOST_LIB="-L${with_boost}/lib"
fi
if test "${with_boost}" = "no"; then
AC_MSG_RESULT([disabled])
else
CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
- LIBS="${LIBS} ${BOOST_LIBS}"
+ LIBS="${LIBS} ${BOOST_LIB}"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <boost/version.hpp>
]],[[
int x = BOOST_VERSION;
-]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
+]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Boost development libraries required])
+])
AC_MSG_CHECKING([Boost version])
AC_MSG_RESULT([ok])
],[
AC_MSG_RESULT([version too old])
+ AC_MSG_ERROR([A newer version of Boost is required])
])
fi
+ for c in $1; do
+ case $c in
+ thread)
+ AC_SUBST(BOOST_THREAD_LIB)
+ BOOST_THREAD_LIB="-lboost_thread"
+ AC_MSG_CHECKING([Boost threads])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/version.hpp>
+#include <boost/thread/thread.hpp>
+]],[[
+int x = BOOST_VERSION;
+]])],[AC_MSG_RESULT([yes])],[
+AC_MSG_RESULT([no])
+AC_MSG_ERROR([Boost thread libraries required])
+])
+ ;;
+ test)
+ AC_SUBST(BOOST_TEST_LIB)
+ BOOST_TEST_LIB="-lboost_unit_test_framework"
+ AC_MSG_CHECKING([Boost unit test framework])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/auto_unit_test.hpp>
+BOOST_AUTO_TEST_CASE( t )
+{
+ BOOST_CHECK(1);
+}
+]],[[
+]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])
+AC_MSG_ERROR([Boost unit test framework libraries required])])
+ ;;
+ esac
+ done
CPPFLAGS="$oldCPPFLAGS"
LIBS="$oldLIBS"
AC_LANG_POP([C++])