dnl Copyright (C) 2010 Monty Taylor dnl This file is free software; Monty Taylor dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([_PANDORA_SEARCH_BOOST],[ AC_REQUIRE([AC_LIB_PREFIX]) dnl -------------------------------------------------------------------- dnl Check for boost dnl -------------------------------------------------------------------- AC_ARG_ENABLE([boost], [AS_HELP_STRING([--disable-boost], [Build with boost support @<:@default=on@:>@])], [ac_enable_boost="$enableval"], [ac_enable_boost="yes"]) AS_IF([test "x$ac_enable_boost" = "xyes"],[ dnl link against libc because we're just looking for headers here AC_LANG_PUSH(C++) AC_LIB_HAVE_LINKFLAGS(c,, [#include ], [boost::pool<> test_pool(1);], [system]) AC_LANG_POP() ],[ ac_cv_boost="no" ]) AS_IF([test "x$1" != "x"],[ AC_CACHE_CHECK([if boost is recent enough], [pandora_cv_recent_boost],[ pandora_need_boost_version=`echo "$1" | perl -nle '/(\d+)\.(\d+)/; printf "%d%0.3d00", $[]1, $[]2 ;'` AS_IF([test "x${pandora_need_boost_version}" = "x000000"],[ pandora_cv_recent_boost=yes ],[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #if BOOST_VERSION < ${pandora_need_boost_version} # error boost too old! #endif ]],[[]]) ],[ pandora_cv_recent_boost=yes ],[ pandora_cv_recent_boost=no ]) ]) ]) AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[ ac_cv_boost=no ]) ]) AS_IF([test "x${ac_gcc_profile_mode}" = "xyes"],[ AC_CACHE_CHECK([if boost is recent enough for GCC Profile Mode], [pandora_cv_boost_profile],[ pandora_need_boost_version=104300 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #if BOOST_VERSION < ${pandora_need_boost_version} # error boost too old! #endif ]],[[]]) ],[ pandora_cv_boost_profile=yes ],[ pandora_cv_boost_profile=no ]) ]) AS_IF([test "x${pandora_cv_boost_profile}" = "xyes"],[ AC_DEFINE([BOOST_DETAIL_NO_CONTAINER_FWD],[1],[Disable forward decl of stl in boost]) ]) ]) AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"]) ]) AC_DEFUN([PANDORA_HAVE_BOOST],[ _PANDORA_SEARCH_BOOST($1) ]) AC_DEFUN([PANDORA_REQUIRE_BOOST],[ PANDORA_HAVE_BOOST($1) AS_IF([test x$ac_cv_boost = xno], AC_MSG_ERROR([boost is required for ${PACKAGE}])) ])