~drizzle-trunk/drizzle/development

1085.1.4 by Monty Taylor
pandora-build v1
1
dnl  Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
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
dnl We check two things: where is the memory include file, and in what
7
dnl namespace does shared_ptr reside.
8
dnl We include AC_COMPILE_IFELSE for all the combinations we've seen in the
9
dnl wild:
10
dnl 
11
dnl  GCC 4.3: namespace: std::  #include <memory>
12
dnl  GCC 4.2: namespace: tr1::  #include <tr1/memory>
13
dnl  GCC 4.2: namespace: boost::  #include <boost/shared_ptr.hpp>
14
dnl
15
dnl We define one of HAVE_HAVE_TR1_SHARED_PTR or HAVE_BOOST_SHARED_PTR
16
dnl depending on location, and SHARED_PTR_NAMESPACE to be the namespace in
17
dnl which shared_ptr is defined.
18
dnl 
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
19
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
20
AC_DEFUN([PANDORA_SHARED_PTR],[
21
  AC_REQUIRE([PANDORA_CHECK_CXX_STANDARD])
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
22
  AC_LANG_PUSH(C++)
1241.11.1 by Monty Taylor
pandora-build v0.85 - Fixed C++ standard setting.
23
  save_CXXFLAGS="${CXXFLAGS}"
24
  CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
25
  AC_CHECK_HEADERS(memory tr1/memory boost/shared_ptr.hpp)
26
  AC_CACHE_CHECK([the location of shared_ptr header file],
27
    [ac_cv_shared_ptr_h],[
919.2.20 by Monty Taylor
Actually add the -std=gnu++0x flag
28
      for namespace in std tr1 std::tr1 boost
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
29
      do
30
        AC_COMPILE_IFELSE(
31
          [AC_LANG_PROGRAM([[
919.2.21 by Monty Taylor
Fixes for c++0x and shared_ptr support for Solaris.
32
#if defined(HAVE_MEMORY)
33
# include <memory>
34
#endif
35
#if defined(HAVE_TR1_MEMORY)
36
# include <tr1/memory>
37
#endif
38
#if defined(HAVE_BOOST_SHARED_PTR_HPP)
39
# include <boost/shared_ptr.hpp>
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
40
#endif
41
#include <string>
42
43
using $namespace::shared_ptr;
44
using namespace std;
45
            ]],[[
46
shared_ptr<string> test_ptr(new string("test string"));
47
            ]])],
48
            [
49
              ac_cv_shared_ptr_namespace="${namespace}"
50
              break
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
51
            ],[ac_cv_shared_ptr_namespace=missing])
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
52
       done
53
  ])
54
  AC_DEFINE_UNQUOTED([SHARED_PTR_NAMESPACE],
55
                     ${ac_cv_shared_ptr_namespace},
56
                     [The namespace in which SHARED_PTR can be found])
1241.11.1 by Monty Taylor
pandora-build v0.85 - Fixed C++ standard setting.
57
  CXXFLAGS="${save_CXXFLAGS}"
919.2.19 by Monty Taylor
Added check for shared_ptr in advance of actually thinking about using it. I think this should cover all platforms we care about... but let's doublecheck.
58
  AC_LANG_POP()
59
])