1 # ===========================================================================
2 # http://autoconf-archive.cryp.to/ac_cxx_compile_stdcxx_0x.html
3 # ===========================================================================
7 # AC_CXX_COMPILE_STDCXX_0X
11 # Check for baseline language coverage in the compiler for the C++0x
20 # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
22 # Copying and distribution of this file, with or without modification, are
23 # permitted in any medium without royalty provided the copyright notice
24 # and this notice are preserved.
26 AC_DEFUN([AC_CXX_COMPILE_STDCXX_0X], [
27 AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
28 ac_cv_cxx_compile_cxx0x_native,
35 static_assert(sizeof(int) <= sizeof(T), "not big enough");
38 typedef check<check<bool>> right_angle_brackets;
43 typedef check<int> check_type;
45 check_type&& cr = static_cast<check_type&&>(c);],,
46 ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
50 AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
51 ac_cv_cxx_compile_cxx0x_cxx,
54 ac_save_CXXFLAGS="$CXXFLAGS"
55 CXXFLAGS="$CXXFLAGS -std=c++0x"
60 static_assert(sizeof(int) <= sizeof(T), "not big enough");
63 typedef check<check<bool>> right_angle_brackets;
68 typedef check<int> check_type;
70 check_type&& cr = static_cast<check_type&&>(c);],,
71 ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
72 CXXFLAGS="$ac_save_CXXFLAGS"
76 AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
77 ac_cv_cxx_compile_cxx0x_gxx,
80 ac_save_CXXFLAGS="$CXXFLAGS"
81 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
86 static_assert(sizeof(int) <= sizeof(T), "not big enough");
89 typedef check<check<bool>> right_angle_brackets;
94 typedef check<int> check_type;
96 check_type&& cr = static_cast<check_type&&>(c);],,
97 ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
98 CXXFLAGS="$ac_save_CXXFLAGS"
102 if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
103 test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
104 test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
105 AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
107 AC_MSG_ERROR([Could not find cxx0x support in g++])