summaryrefslogtreecommitdiff
path: root/m4/efl_stdcxx_11.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/efl_stdcxx_11.m4')
-rw-r--r--m4/efl_stdcxx_11.m4136
1 files changed, 0 insertions, 136 deletions
diff --git a/m4/efl_stdcxx_11.m4 b/m4/efl_stdcxx_11.m4
deleted file mode 100644
index f606bc0..0000000
--- a/m4/efl_stdcxx_11.m4
+++ /dev/null
@@ -1,136 +0,0 @@
1# ============================================================================
2# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
3# ============================================================================
4#
5# SYNOPSIS
6#
7# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
8#
9# DESCRIPTION
10#
11# Check for baseline language coverage in the compiler for the C++11
12# standard; if necessary, add switches to CXXFLAGS to enable support.
13#
14# The first argument, if specified, indicates whether you insist on an
15# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
16# -std=c++11). If neither is specified, you get whatever works, with
17# preference for an extended mode.
18#
19# The second argument, if specified 'mandatory' or if left unspecified,
20# indicates that baseline C++11 support is required and that the macro
21# should error out if no mode with that support is found. If specified
22# 'optional', then configuration proceeds regardless, after defining
23# HAVE_CXX11 if and only if a supporting mode is found.
24#
25# LICENSE
26#
27# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
28# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
29# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
30#
31# Copying and distribution of this file, with or without modification, are
32# permitted in any medium without royalty provided the copyright notice
33# and this notice are preserved. This file is offered as-is, without any
34# warranty.
35
36#serial 3
37
38m4_define([_EFL_CXX_COMPILE_STDCXX_11_testbody], [
39 template <typename T>
40 struct check
41 {
42 static_assert(sizeof(int) <= sizeof(T), "not big enough");
43 };
44
45 typedef check<check<bool>> right_angle_brackets;
46
47 int a;
48 decltype(a) b;
49
50 typedef check<int> check_type;
51 check_type c;
52 check_type&& cr = static_cast<check_type&&>(c);
53
54 struct A { A(int); };
55 struct B : A { using A::A; }; // inheriting constructors
56
57 auto d = a;
58])
59
60AC_DEFUN([EFL_CXX_COMPILE_STDCXX_11], [dnl
61 m4_if([$1], [], [],
62 [$1], [ext], [],
63 [$1], [noext], [],
64 [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
65 m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
66 [$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
67 [$2], [optional], [ax_cxx_compile_cxx11_required=false],
68 [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])dnl
69 AC_LANG_PUSH([C++])dnl
70 ac_success=no
71 AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
72 ax_cv_cxx_compile_cxx11,
73 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_EFL_CXX_COMPILE_STDCXX_11_testbody])],
74 [ax_cv_cxx_compile_cxx11=yes],
75 [ax_cv_cxx_compile_cxx11=no])])
76 if test x$ax_cv_cxx_compile_cxx11 = xyes; then
77 ac_success=yes
78 fi
79
80 m4_if([$1], [noext], [], [dnl
81 if test x$ac_success = xno; then
82 for switch in -std=gnu++11; do
83 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
84 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
85 $cachevar,
86 [ac_save_CXXFLAGS="$CXXFLAGS"
87 CXXFLAGS="$CXXFLAGS $switch"
88 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_EFL_CXX_COMPILE_STDCXX_11_testbody])],
89 [eval $cachevar=yes],
90 [eval $cachevar=no])
91 CXXFLAGS="$ac_save_CXXFLAGS"])
92 if eval test x\$$cachevar = xyes; then
93 CXXFLAGS="$CXXFLAGS $switch"
94 ac_success=yes
95 break
96 fi
97 done
98 fi])
99
100 m4_if([$1], [ext], [], [dnl
101 if test x$ac_success = xno; then
102 for switch in -std=c++11; do
103 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
104 AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
105 $cachevar,
106 [ac_save_CXXFLAGS="$CXXFLAGS"
107 CXXFLAGS="$CXXFLAGS $switch"
108 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_EFL_CXX_COMPILE_STDCXX_11_testbody])],
109 [eval $cachevar=yes],
110 [eval $cachevar=no])
111 CXXFLAGS="$ac_save_CXXFLAGS"])
112 if eval test x\$$cachevar = xyes; then
113 CXXFLAGS="$CXXFLAGS $switch"
114 ac_success=yes
115 break
116 fi
117 done
118 fi])
119 AC_LANG_POP([C++])
120 if test x$ax_cxx_compile_cxx11_required = xtrue; then
121 if test x$ac_success = xno; then
122 AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
123 fi
124 else
125 if test x$ac_success = xno; then
126 HAVE_CXX11=0
127 AC_MSG_NOTICE([No compiler with C++11 support was found])
128 else
129 HAVE_CXX11=1
130 AC_DEFINE(HAVE_CXX11,1,
131 [define if the compiler supports basic C++11 syntax])
132 fi
133
134 AC_SUBST(HAVE_CXX11)
135 fi
136])