Next pass in removing gettext (solve warnings on lion, we don't use GETTEXT anyways).
[m6w6/libmemcached] / m4 / pandora_have_boost.m4
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.
5
6 AC_DEFUN([_PANDORA_SEARCH_BOOST],[
7 AC_REQUIRE([AC_LIB_PREFIX])
8
9 dnl --------------------------------------------------------------------
10 dnl Check for boost
11 dnl --------------------------------------------------------------------
12
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"])
18
19 AS_IF([test "x$ac_enable_boost" = "xyes"],[
20 dnl link against libc because we're just looking for headers here
21 AC_LANG_PUSH(C++)
22 AC_LIB_HAVE_LINKFLAGS(c,,
23 [#include <boost/pool/pool.hpp>],
24 [boost::pool<> test_pool(1);],
25 [system])
26 AC_LANG_POP()
27 ],[
28 ac_cv_boost="no"
29 ])
30
31
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
38 ],[
39 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
40 #include <boost/version.hpp>
41
42 #if BOOST_VERSION < ${pandora_need_boost_version}
43 # error boost too old!
44 #endif
45 ]],[[]])
46 ],[
47 pandora_cv_recent_boost=yes
48 ],[
49 pandora_cv_recent_boost=no
50 ])
51 ])
52 ])
53 AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[
54 ac_cv_boost=no
55 ])
56 ])
57
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>
64
65 #if BOOST_VERSION < ${pandora_need_boost_version}
66 # error boost too old!
67 #endif
68 ]],[[]])
69 ],[
70 pandora_cv_boost_profile=yes
71 ],[
72 pandora_cv_boost_profile=no
73 ])
74 ])
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])
77 ])
78 ])
79
80 AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"])
81
82 ])
83
84 AC_DEFUN([PANDORA_HAVE_BOOST],[
85 _PANDORA_SEARCH_BOOST($1)
86 ])
87
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}]))
92 ])
93