~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to m4/pandora_have_boost.m4

  • Committer: Padraig O'Sullivan
  • Date: 2010-04-17 01:38:47 UTC
  • mfrom: (1237.9.238 bad-staging)
  • Revision ID: osullivan.padraig@gmail.com-20100417013847-ibjioqsfbmf5yg4g
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
    ],[
 
25
      boost::pool<> test_pool(1);
 
26
    ])
 
27
    AC_LANG_POP()
 
28
  ],[
 
29
    ac_cv_boost="no"
 
30
  ])
 
31
  
 
32
 
 
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
 
39
      ],[
 
40
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 
41
#include <boost/version.hpp>
 
42
 
 
43
#if BOOST_VERSION < ${pandora_need_boost_version}
 
44
# error boost too old!
 
45
#endif
 
46
          ]],[[]])
 
47
        ],[
 
48
          pandora_cv_recent_boost=yes
 
49
        ],[
 
50
          pandora_cv_recent_boost=no
 
51
        ])
 
52
      ])
 
53
    ])
 
54
    AS_IF([test "x${pandora_cv_recent_boost}" = "xno"],[
 
55
      ac_cv_boost=no
 
56
    ])
 
57
  ])
 
58
      
 
59
 
 
60
  AM_CONDITIONAL(HAVE_BOOST, [test "x${ac_cv_boost}" = "xyes"])
 
61
  
 
62
])
 
63
 
 
64
AC_DEFUN([PANDORA_HAVE_BOOST],[
 
65
  _PANDORA_SEARCH_BOOST($1)
 
66
])
 
67
 
 
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}]))
 
72
])
 
73