~drizzle-trunk/drizzle/development

1377.3.4 by Monty Taylor
Wow. Actually check this in. :)
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++)
1643.1.12 by Monty Taylor
Updated pandora-build files to version 0.136
22
    AC_LIB_HAVE_LINKFLAGS(c,,
23
      [#include <boost/pool/pool.hpp>],
24
      [boost::pool<> test_pool(1);],
25
      [system])
1377.3.4 by Monty Taylor
Wow. Actually check this in. :)
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
  ])
1992.6.4 by Monty Taylor
Added support for GCC Profile Mode (new in 4.5)
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
    ])
1992.6.5 by Monty Taylor
We need to inject a BOOST define for boost headers to do the right thing.
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
    ])
1992.6.4 by Monty Taylor
Added support for GCC Profile Mode (new in 4.5)
78
  ])
1377.3.4 by Monty Taylor
Wow. Actually check this in. :)
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],
2221.1.8 by Monty Taylor
Adds ability to just build libdrizzle without needing all of the rest of the
91
      PANDORA_MSG_ERROR([boost is required for ${PACKAGE}]))
1377.3.4 by Monty Taylor
Wow. Actually check this in. :)
92
])
93