~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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/pool.hpp>],
      [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 <boost/version.hpp>

#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 <boost/version.hpp>

#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],
      PANDORA_MSG_ERROR([boost is required for ${PACKAGE}]))
])