~drizzle-trunk/drizzle/development

1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
1
# ===========================================================================
2
#        http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html
3
# ===========================================================================
4
#
5
# SYNOPSIS
6
#
7
#   AC_CXX_COMPILE_STDCXX_0X
8
#
9
# DESCRIPTION
10
#
11
#   Check for baseline language coverage in the compiler for the C++0x
12
#   standard.
13
#
14
# LICENSE
15
#
16
#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
17
#
18
#   Copying and distribution of this file, with or without modification, are
19
#   permitted in any medium without royalty provided the copyright notice
20
#   and this notice are preserved.
21
22
AC_DEFUN([AC_CXX_COMPILE_STDCXX_0X], [
23
  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
24
  ac_cv_cxx_compile_cxx0x_native,
25
  [AC_LANG_SAVE
26
  AC_LANG_CPLUSPLUS
27
  AC_TRY_COMPILE([
28
  template <typename T>
29
    struct check
30
    {
31
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
32
    };
33
34
    typedef check<check<bool>> right_angle_brackets;
35
36
    int a;
37
    decltype(a) b;
38
39
    typedef check<int> check_type;
40
    check_type c;
41
    check_type&& cr = c;],,
42
  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
43
  AC_LANG_RESTORE
44
  ])
45
46
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
47
  ac_cv_cxx_compile_cxx0x_cxx,
48
  [AC_LANG_SAVE
49
  AC_LANG_CPLUSPLUS
50
  ac_save_CXXFLAGS="$CXXFLAGS"
51
  CXXFLAGS="$CXXFLAGS -std=c++0x"
52
  AC_TRY_COMPILE([
53
  template <typename T>
54
    struct check
55
    {
56
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
57
    };
58
59
    typedef check<check<bool>> right_angle_brackets;
60
61
    int a;
62
    decltype(a) b;
63
64
    typedef check<int> check_type;
65
    check_type c;
66
    check_type&& cr = c;],,
67
  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
68
  CXXFLAGS="$ac_save_CXXFLAGS"
69
  AC_LANG_RESTORE
70
  ])
71
72
  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
73
  ac_cv_cxx_compile_cxx0x_gxx,
74
  [AC_LANG_SAVE
75
  AC_LANG_CPLUSPLUS
76
  ac_save_CXXFLAGS="$CXXFLAGS"
77
  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
78
  AC_TRY_COMPILE([
79
  template <typename T>
80
    struct check
81
    {
82
      static_assert(sizeof(int) <= sizeof(T), "not big enough");
83
    };
84
85
    typedef check<check<bool>> right_angle_brackets;
86
87
    int a;
88
    decltype(a) b;
89
90
    typedef check<int> check_type;
91
    check_type c;
92
    check_type&& cr = c;],,
93
  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
94
  CXXFLAGS="$ac_save_CXXFLAGS"
95
  AC_LANG_RESTORE
96
  ])
97
98
  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
99
     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
100
     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
101
    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
102
  fi
103
])