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>
25 boost::pool<> test_pool(1);
33 AS_IF([test "x$1" != "x"],[
34 AC_CACHE_CHECK([if boost is recent enough],
35 [pandora_cv_recent_boost],[
36 pandora_need_boost_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d00", $[]1, $[]2 ;'`
37 AS_IF([test "x${pandora_need_boost_version}" = "x000000"],[
38 pandora_cv_recent_boost=yes
40 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
41 #include <boost/version.hpp>
43 #if BOOST_VERSION < ${pandora_need_boost_version}
44 # error boost too old!
48 pandora_cv_recent_boost=yes
50 pandora_cv_recent_boost=no
54 AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[
60 AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"])
64 AC_DEFUN([PANDORA_HAVE_BOOST],[
65 _PANDORA_SEARCH_BOOST($1)
68 AC_DEFUN([PANDORA_REQUIRE_BOOST],[
69 PANDORA_HAVE_BOOST($1)
70 AS_IF([test x$ac_cv_boost = xno],
71 AC_MSG_ERROR([boost is required for ${PACKAGE}]))