1 dnl Copyright (C) 2010 Monty Taylor
2 dnl This file is free software; Monty Taylor
3 dnl gives unlimited permission to copy and/or distribute it,
4 dnl with or without modifications, as long as this notice is preserved.
6 AC_DEFUN([_PANDORA_SEARCH_BOOST],[
7 AC_REQUIRE([AC_LIB_PREFIX])
9 dnl --------------------------------------------------------------------
11 dnl --------------------------------------------------------------------
13 AC_ARG_ENABLE([boost],
14 [AS_HELP_STRING([--disable-boost],
15 [Build with boost support @<:@default=on@:>@])],
16 [ac_enable_boost="$enableval"],
17 [ac_enable_boost="yes"])
19 AS_IF([test "x$ac_enable_boost" = "xyes"],[
20 dnl link against libc because we're just looking for headers here
22 AC_LIB_HAVE_LINKFLAGS(c,,
23 [#include <boost/pool/pool.hpp>],
24 [boost::pool<> test_pool(1);],
32 AS_IF([test "x$1" != "x"],[
33 AC_CACHE_CHECK([if boost is recent enough],
34 [pandora_cv_recent_boost],[
35 pandora_need_boost_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d00", $[]1, $[]2 ;'`
36 AS_IF([test "x${pandora_need_boost_version}" = "x000000"],[
37 pandora_cv_recent_boost=yes
39 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
40 #include <boost/version.hpp>
42 #if BOOST_VERSION < ${pandora_need_boost_version}
43 # error boost too old!
47 pandora_cv_recent_boost=yes
49 pandora_cv_recent_boost=no
53 AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[
58 AS_IF([test "x${ac_gcc_profile_mode}" = "xyes"],[
59 AC_CACHE_CHECK([if boost is recent enough for GCC Profile Mode],
60 [pandora_cv_boost_profile],[
61 pandora_need_boost_version=104300
62 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
63 #include <boost/version.hpp>
65 #if BOOST_VERSION < ${pandora_need_boost_version}
66 # error boost too old!
70 pandora_cv_boost_profile=yes
72 pandora_cv_boost_profile=no
75 AS_IF([test "x${pandora_cv_boost_profile}" = "xyes"],[
76 AC_DEFINE([BOOST_DETAIL_NO_CONTAINER_FWD],[1],[Disable forward decl of stl in boost])
80 AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"])
84 AC_DEFUN([PANDORA_HAVE_BOOST],[
85 _PANDORA_SEARCH_BOOST($1)
88 AC_DEFUN([PANDORA_REQUIRE_BOOST],[
89 PANDORA_HAVE_BOOST($1)
90 AS_IF([test x$ac_cv_boost = xno],
91 AC_MSG_ERROR([boost is required for ${PACKAGE}]))