New boost ID_BOOST which might be a replacement for AX_BOOST.
authorAdam Dickmeiss <adam@indexdata.dk>
Sun, 13 Apr 2008 15:26:16 +0000 (17:26 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Sun, 13 Apr 2008 15:26:16 +0000 (17:26 +0200)
boost.m4 [new file with mode: 0644]

diff --git a/boost.m4 b/boost.m4
new file mode 100644 (file)
index 0000000..0ecf99d
--- /dev/null
+++ b/boost.m4
@@ -0,0 +1,51 @@
+# configure for Boost libs
+#
+# ID_BOOST([components],[libs])
+AC_DEFUN([ID_BOOST],
+    [
+       AC_MSG_CHECKING([for Boost])
+       AC_LANG_PUSH([C++])
+       oldCPPFLAGS="$CPPFLAGS"
+       oldLIBS="$LIBS"
+       BOOST_REQ_VERSION=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 100 + [$]3;}'`
+       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
+           BOOST_CPPFLAGS=""
+           BOOST_LIBS=""
+       else
+           BOOST_CPPFLAGS="-I${with_boost}/include"
+           BOOST_LIBS=" -L${with_boost}/lib"
+       fi
+       if test "${with_boost}" = "no"; then
+           AC_MSG_RESULT([disabled])
+       else
+           CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
+           LIBS="${LIBS} ${BOOST_LIBS}"
+            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/version.hpp>
+]],[[ 
+int x = BOOST_VERSION;
+]])],[AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
+
+
+            AC_MSG_CHECKING([Boost version])
+           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <boost/version.hpp>
+]],[[
+#if BOOST_VERSION < BOOST_REQ_VERSION
+#error Version too old
+#endif
+]])],[
+           AC_MSG_RESULT([ok])
+],[
+           AC_MSG_RESULT([version too old])
+       ])
+       fi
+       CPPFLAGS="$oldCPPFLAGS"
+       LIBS="$oldLIBS"
+       AC_LANG_POP([C++])
+    ])
+