• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ============================================================================
2#  http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_0x.html
3# ============================================================================
4#
5# SYNOPSIS
6#
7#   AX_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#   This macro is deprecated and has been superseded by the
15#   AX_CXX_COMPILE_STDCXX_11 macro which should be used instead.
16#
17# LICENSE
18#
19#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
20#
21#   Copying and distribution of this file, with or without modification, are
22#   permitted in any medium without royalty provided the copyright notice
23#   and this notice are preserved. This file is offered as-is, without any
24#   warranty.
25
26#serial 10
27
28AU_ALIAS([AC_CXX_COMPILE_STDCXX_0X], [AX_CXX_COMPILE_STDCXX_0X])
29AC_DEFUN([AX_CXX_COMPILE_STDCXX_0X], [
30  AC_OBSOLETE([$0], [; use AX_CXX_COMPILE_STDCXX_11 instead])
31  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
32  ax_cv_cxx_compile_cxx0x_native,
33  [AC_LANG_SAVE
34  AC_LANG_CPLUSPLUS
35  AC_TRY_COMPILE([
36  template <typename T>
37    struct check
38    {
39      static_assert(sizeof(int) <= sizeof(T), "not big enough");
40    };
41
42    typedef check<check<bool>> right_angle_brackets;
43
44    int a;
45    decltype(a) b;
46
47    typedef check<int> check_type;
48    check_type c;
49    check_type&& cr = static_cast<check_type&&>(c);],,
50  ax_cv_cxx_compile_cxx0x_native=yes, ax_cv_cxx_compile_cxx0x_native=no)
51  AC_LANG_RESTORE
52  ])
53
54  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
55  ax_cv_cxx_compile_cxx0x_cxx,
56  [AC_LANG_SAVE
57  AC_LANG_CPLUSPLUS
58  ac_save_CXX="$CXX"
59  CXX="$CXX -std=c++0x"
60  AC_TRY_COMPILE([
61  template <typename T>
62    struct check
63    {
64      static_assert(sizeof(int) <= sizeof(T), "not big enough");
65    };
66
67    typedef check<check<bool>> right_angle_brackets;
68
69    int a;
70    decltype(a) b;
71
72    typedef check<int> check_type;
73    check_type c;
74    check_type&& cr = static_cast<check_type&&>(c);],,
75  ax_cv_cxx_compile_cxx0x_cxx=yes, ax_cv_cxx_compile_cxx0x_cxx=no)
76  CXX="$ac_save_CXX"
77  AC_LANG_RESTORE
78  ])
79
80  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
81  ax_cv_cxx_compile_cxx0x_gxx,
82  [AC_LANG_SAVE
83  AC_LANG_CPLUSPLUS
84  ac_save_CXX="$CXX"
85  CXX="$CXX -std=gnu++0x"
86  AC_TRY_COMPILE([
87  template <typename T>
88    struct check
89    {
90      static_assert(sizeof(int) <= sizeof(T), "not big enough");
91    };
92
93    typedef check<check<bool>> right_angle_brackets;
94
95    int a;
96    decltype(a) b;
97
98    typedef check<int> check_type;
99    check_type c;
100    check_type&& cr = static_cast<check_type&&>(c);],,
101  ax_cv_cxx_compile_cxx0x_gxx=yes, ax_cv_cxx_compile_cxx0x_gxx=no)
102  CXX="$ac_save_CXX"
103  AC_LANG_RESTORE
104  ])
105
106  if test "$ax_cv_cxx_compile_cxx0x_native" = yes ||
107     test "$ax_cv_cxx_compile_cxx0x_cxx" = yes ||
108     test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then
109    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
110  fi
111])
112