source: branches/FACT++_lidctrl_usb/.macro_dir/ax_cxx_compile_stdcxx_0x.m4@ 19875

Last change on this file since 19875 was 12767, checked in by tbretz, 13 years ago
Taken the latest version from teh archive to get it working with gcc 4.5
File size: 2.9 KB
Line 
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# 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. This file is offered as-is, without any
21# warranty.
22
23#serial 7
24
25AU_ALIAS([AC_CXX_COMPILE_STDCXX_0X], [AX_CXX_COMPILE_STDCXX_0X])
26AC_DEFUN([AX_CXX_COMPILE_STDCXX_0X], [
27 AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
28 ax_cv_cxx_compile_cxx0x_native,
29 [AC_LANG_SAVE
30 AC_LANG_CPLUSPLUS
31 AC_TRY_COMPILE([
32 template <typename T>
33 struct check
34 {
35 static_assert(sizeof(int) <= sizeof(T), "not big enough");
36 };
37
38 typedef check<check<bool>> right_angle_brackets;
39
40 int a;
41 decltype(a) b;
42
43 typedef check<int> check_type;
44 check_type c;
45 check_type&& cr = static_cast<check_type&&>(c);],,
46 ax_cv_cxx_compile_cxx0x_native=yes, ax_cv_cxx_compile_cxx0x_native=no)
47 AC_LANG_RESTORE
48 ])
49
50 AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
51 ax_cv_cxx_compile_cxx0x_cxx,
52 [AC_LANG_SAVE
53 AC_LANG_CPLUSPLUS
54 ac_save_CXXFLAGS="$CXXFLAGS"
55 CXXFLAGS="$CXXFLAGS -std=c++0x"
56 AC_TRY_COMPILE([
57 template <typename T>
58 struct check
59 {
60 static_assert(sizeof(int) <= sizeof(T), "not big enough");
61 };
62
63 typedef check<check<bool>> right_angle_brackets;
64
65 int a;
66 decltype(a) b;
67
68 typedef check<int> check_type;
69 check_type c;
70 check_type&& cr = static_cast<check_type&&>(c);],,
71 ax_cv_cxx_compile_cxx0x_cxx=yes, ax_cv_cxx_compile_cxx0x_cxx=no)
72 CXXFLAGS="$ac_save_CXXFLAGS"
73 AC_LANG_RESTORE
74 ])
75
76 AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
77 ax_cv_cxx_compile_cxx0x_gxx,
78 [AC_LANG_SAVE
79 AC_LANG_CPLUSPLUS
80 ac_save_CXXFLAGS="$CXXFLAGS"
81 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
82 AC_TRY_COMPILE([
83 template <typename T>
84 struct check
85 {
86 static_assert(sizeof(int) <= sizeof(T), "not big enough");
87 };
88
89 typedef check<check<bool>> right_angle_brackets;
90
91 int a;
92 decltype(a) b;
93
94 typedef check<int> check_type;
95 check_type c;
96 check_type&& cr = static_cast<check_type&&>(c);],,
97 ax_cv_cxx_compile_cxx0x_gxx=yes, ax_cv_cxx_compile_cxx0x_gxx=no)
98 CXXFLAGS="$ac_save_CXXFLAGS"
99 AC_LANG_RESTORE
100 ])
101
102 if test "$ax_cv_cxx_compile_cxx0x_native" = yes ||
103 test "$ax_cv_cxx_compile_cxx0x_cxx" = yes ||
104 test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then
105 AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
106 fi
107])
Note: See TracBrowser for help on using the repository browser.