| 1 |
# ============================================================================= |
| 2 |
# https://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 <[email protected]> |
| 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 12 |
| 27 |
|
| 28 |
AU_ALIAS([AC_CXX_COMPILE_STDCXX_0X], [AX_CXX_COMPILE_STDCXX_0X]) |
| 29 |
AC_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_PUSH([C++]) |
| 34 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 35 |
template <typename T> |
| 36 |
struct check |
| 37 |
{ |
| 38 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
| 39 |
}; |
| 40 |
|
| 41 |
typedef check<check<bool>> right_angle_brackets; |
| 42 |
|
| 43 |
int a; |
| 44 |
decltype(a) b; |
| 45 |
|
| 46 |
typedef check<int> check_type; |
| 47 |
check_type c; |
| 48 |
check_type&& cr = static_cast<check_type&&>(c);]], [])], |
| 49 |
[ax_cv_cxx_compile_cxx0x_native=yes], [ax_cv_cxx_compile_cxx0x_native=no]) |
| 50 |
AC_LANG_POP([C++]) |
| 51 |
]) |
| 52 |
|
| 53 |
AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x, |
| 54 |
ax_cv_cxx_compile_cxx0x_cxx, |
| 55 |
[AC_LANG_PUSH([C++]) |
| 56 |
ac_save_CXX="$CXX" |
| 57 |
CXX="$CXX -std=c++0x" |
| 58 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 59 |
template <typename T> |
| 60 |
struct check |
| 61 |
{ |
| 62 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
| 63 |
}; |
| 64 |
|
| 65 |
typedef check<check<bool>> right_angle_brackets; |
| 66 |
|
| 67 |
int a; |
| 68 |
decltype(a) b; |
| 69 |
|
| 70 |
typedef check<int> check_type; |
| 71 |
check_type c; |
| 72 |
check_type&& cr = static_cast<check_type&&>(c);]], [])], |
| 73 |
[ax_cv_cxx_compile_cxx0x_cxx=yes], [ax_cv_cxx_compile_cxx0x_cxx=no]) |
| 74 |
CXX="$ac_save_CXX" |
| 75 |
AC_LANG_POP([C++]) |
| 76 |
]) |
| 77 |
|
| 78 |
AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x, |
| 79 |
ax_cv_cxx_compile_cxx0x_gxx, |
| 80 |
[AC_LANG_PUSH([C++]) |
| 81 |
ac_save_CXX="$CXX" |
| 82 |
CXX="$CXX -std=gnu++0x" |
| 83 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 84 |
template <typename T> |
| 85 |
struct check |
| 86 |
{ |
| 87 |
static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
| 88 |
}; |
| 89 |
|
| 90 |
typedef check<check<bool>> right_angle_brackets; |
| 91 |
|
| 92 |
int a; |
| 93 |
decltype(a) b; |
| 94 |
|
| 95 |
typedef check<int> check_type; |
| 96 |
check_type c; |
| 97 |
check_type&& cr = static_cast<check_type&&>(c);]], [])], |
| 98 |
[ax_cv_cxx_compile_cxx0x_gxx=yes], [ax_cv_cxx_compile_cxx0x_gxx=no]) |
| 99 |
CXX="$ac_save_CXX" |
| 100 |
AC_LANG_POP([C++]) |
| 101 |
]) |
| 102 |
|
| 103 |
if test "$ax_cv_cxx_compile_cxx0x_native" = yes || |
| 104 |
test "$ax_cv_cxx_compile_cxx0x_cxx" = yes || |
| 105 |
test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then |
| 106 |
AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ]) |
| 107 |
fi |
| 108 |
]) |