1 # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*-
3 # This implementation is taken from GNU Autoconf lib/autoconf/c.m4
4 # commit 5ad3567c3cbd90b4faa6539c35bc4a8c6500f535
5 # dated 2015-10-08 10:12:41 2015 +0200.
6 # This implementation will be obsolete once we can assume Autoconf 2.70
7 # or later is installed everywhere a Gnulib program might be developed.
10 # Copyright (C) 2001-2016 Free Software Foundation, Inc.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 # Written by David MacKenzie, with help from
26 # Akim Demaille, Paul Eggert,
27 # François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
28 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
31 # AC_PROG_CC([COMPILER ...])
32 # --------------------------
33 # COMPILER ... is a space separated list of C compilers to search for.
34 # This just gives the user an opportunity to specify an alternative
35 # search list for the C compiler.
36 AC_DEFUN_ONCE([AC_PROG_CC],
38 AC_ARG_VAR([CC], [C compiler command])dnl
39 AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
40 _AC_ARG_VAR_LDFLAGS()dnl
42 _AC_ARG_VAR_CPPFLAGS()dnl
44 [AC_CHECK_TOOLS(CC, [$1])],
45 [AC_CHECK_TOOL(CC, gcc)
46 if test -z "$CC"; then
48 dnl AC_CHECK_TOOL(CC, cc)
49 dnl but without the check for a tool without the prefix.
50 dnl Until the check is removed from there, copy the code:
51 if test -n "$ac_tool_prefix"; then
52 AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
55 if test -z "$CC"; then
56 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
58 if test -z "$CC"; then
59 AC_CHECK_TOOLS(CC, cl.exe)
63 test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
65 # Provide some information about the compiler.
66 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
69 for ac_option in --version -v -V -qversion -version; do
70 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
73 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
74 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
76 if test $ac_compiler_gnu = yes; then
83 dnl Set ac_prog_cc_stdc to the supported C version.
84 dnl Also set the documented variable ac_cv_prog_cc_stdc;
85 dnl its name was chosen when it was cached, but it is no longer cached.
86 _AC_PROG_CC_C11([ac_prog_cc_stdc=c11
87 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11],
88 [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99
89 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
90 [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89
91 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
93 ac_cv_prog_cc_stdc=no])])])
100 # AC_PROG_CXX([LIST-OF-COMPILERS])
101 # --------------------------------
102 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
103 # for (if not specified, a default list is used). This just gives the
104 # user an opportunity to specify an alternative search list for the C++
106 # aCC HP-UX C++ compiler much better than `CC', so test before.
107 # FCC Fujitsu C++ compiler
108 # KCC KAI C++ compiler
110 # xlC_r AIX C Set++ (with support for reentrant code)
112 AC_DEFUN([AC_PROG_CXX],
113 [AC_LANG_PUSH(C++)dnl
114 AC_ARG_VAR([CXX], [C++ compiler command])dnl
115 AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
116 _AC_ARG_VAR_LDFLAGS()dnl
117 _AC_ARG_VAR_LIBS()dnl
118 _AC_ARG_VAR_CPPFLAGS()dnl
119 _AC_ARG_VAR_PRECIOUS([CCC])dnl
120 if test -z "$CXX"; then
121 if test -n "$CCC"; then
126 [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])],
130 # Provide some information about the compiler.
131 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
134 for ac_option in --version -v -V -qversion; do
135 _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
138 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
139 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
140 _AC_LANG_COMPILER_GNU
141 if test $ac_compiler_gnu = yes; then
147 _AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11
148 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11
149 ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11],
150 [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98
151 ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98],
152 [ac_prog_cxx_stdcxx=no
153 ac_cv_prog_cxx_stdcxx=no])])
158 # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
159 # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
160 # --------------------------------------------------------------
161 # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
162 # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
163 # try again with each compiler option in the space-separated OPTION-LIST; if one
164 # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
165 # else ACTION-IF-UNAVAILABLE.
166 AC_DEFUN([_AC_C_STD_TRY],
167 [AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features])
168 AC_CACHE_VAL(ac_cv_prog_cc_$1,
171 AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
174 CC="$ac_save_CC $ac_arg"
175 _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
176 test "x$ac_cv_prog_cc_$1" != "xno" && break
178 rm -f conftest.$ac_ext
181 ac_prog_cc_stdc_options=
182 case "x$ac_cv_prog_cc_$1" in
184 AC_MSG_RESULT([none needed]) ;;
186 AC_MSG_RESULT([unsupported]) ;;
188 ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1"
189 CC=$CC$ac_prog_cc_stdc_options
190 AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
192 AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
195 # _AC_C_C99_TEST_HEADER
196 # ---------------------
197 # A C header suitable for testing for C99.
198 AC_DEFUN([_AC_C_C99_TEST_HEADER],
199 [[#include <stdarg.h>
205 // Check varargs macros. These examples are taken from C99 6.10.3.5.
206 #define debug(...) fprintf (stderr, __VA_ARGS__)
207 #define showlist(...) puts (#__VA_ARGS__)
208 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
210 test_varargs_macros (void)
215 debug ("X = %d\n", x);
216 showlist (The first, second, and third items.);
217 report (x>y, "x is %d but y is %d", x, y);
220 // Check long long types.
221 #define BIG64 18446744073709551615ull
222 #define BIG32 4294967295ul
223 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
225 your preprocessor is broken;
229 your preprocessor is broken;
231 static long long int bignum = -9223372036854775807LL;
232 static unsigned long long int ubignum = BIG64;
234 struct incomplete_array
246 typedef const char *ccp;
249 test_restrict (ccp restrict text)
251 // See if C++-style comments work.
252 // Iterate through items via the restricted pointer.
253 // Also check for declarations in for loops.
254 for (unsigned int i = 0; *(text+i) != '\0'; ++i)
259 // Check varargs and va_copy.
261 test_varargs (const char *format, ...)
264 va_start (args, format);
266 va_copy (args_copy, args);
268 const char *str = "";
277 str = va_arg (args_copy, const char *);
280 number = va_arg (args_copy, int);
283 fnumber = va_arg (args_copy, double);
292 return *str && number && fnumber;
293 }]])# _AC_C_C99_TEST_HEADER
295 # _AC_C_C99_TEST_BODY
296 # -------------------
297 # A C body suitable for testing for C99, assuming the corresponding header.
298 AC_DEFUN([_AC_C_C99_TEST_BODY],
301 _Bool success = false;
304 if (test_restrict ("String literal") == 0)
306 char *restrict newvar = "Another string";
309 success &= test_varargs ("s, d' f .", "string", 65, 34.234);
310 test_varargs_macros ();
312 // Check flexible array members.
313 struct incomplete_array *ia =
314 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
316 for (int i = 0; i < ia->datasize; ++i)
317 ia->data[i] = i * 1.234;
319 // Check named initializers.
320 struct named_init ni = {
322 .name = L"Test wide string",
323 .average = 543.34343,
328 int dynamic_array[ni.number];
329 dynamic_array[ni.number - 1] = 543;
331 // work around unused variable warnings
332 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
333 || dynamic_array[ni.number - 1] != 543);
336 # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
337 # ----------------------------------------------------------------
338 # If the C compiler is not in ISO C99 mode by default, try to add an
339 # option to output variable CC to make it so. This macro tries
340 # various options that select ISO C99 on some system or another. It
341 # considers the compiler to be in ISO C99 mode if it handles _Bool,
342 # // comments, flexible array members, inline, long long int, mixed
343 # code and declarations, named initialization of structs, restrict,
344 # va_copy, varargs macros, variable declarations in for loops and
345 # variable length arrays.
346 AC_DEFUN([_AC_PROG_CC_C99],
347 [_AC_C_STD_TRY([c99],
348 [_AC_C_C99_TEST_HEADER],
349 [_AC_C_C99_TEST_BODY],
351 dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
352 dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test)
353 dnl IBM XL C -qlanglvl=extc99
354 dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99)
356 dnl Intel ICC -std=c99, -c99 (deprecated)
358 dnl Solaris -D_STDC_C99=
359 dnl cc's -xc99 option uses linker magic to define the external
360 dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
361 dnl behavior for C library functions. This is not wanted here,
362 dnl because it means that a single module compiled with -xc99
363 dnl alters C runtime behavior for the entire program, not for
364 dnl just the module. Instead, define the (private) symbol
365 dnl _STDC_C99, which suppresses a bogus failure in <stdbool.h>.
366 dnl The resulting compiler passes the test case here, and that's
367 dnl good enough. For more, please see the thread starting at:
368 dnl http://lists.gnu.org/archive/html/autoconf/2010-12/msg00059.html
370 dnl with extended modes being tried first.
371 [[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl
375 # _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
376 # ----------------------------------------------------------------
377 # If the C compiler is not in ISO C11 mode by default, try to add an
378 # option to output variable CC to make it so. This macro tries
379 # various options that select ISO C11 on some system or another. It
380 # considers the compiler to be in ISO C11 mode if it handles _Alignas,
381 # _Alignof, _Noreturn, _Static_assert, UTF-8 string literals,
382 # duplicate typedefs, and anonymous structures and unions.
383 AC_DEFUN([_AC_PROG_CC_C11],
384 [_AC_C_STD_TRY([c11],
385 [_AC_C_C99_TEST_HEADER[
387 char _Alignas (double) aligned_as_double;
388 char _Alignas (0) no_special_alignment;
389 extern char aligned_as_int;
390 char _Alignas (0) _Alignas (int) aligned_as_int;
395 int_alignment = _Alignof (int),
396 int_array_alignment = _Alignof (int[100]),
397 char_alignment = _Alignof (char)
399 _Static_assert (0 < -_Alignof (int), "_Alignof is signed");
402 int _Noreturn does_not_return (void) { for (;;) continue; }
404 // Check _Static_assert.
405 struct test_static_assert
408 _Static_assert (sizeof (int) <= sizeof (long int),
409 "_Static_assert does not work in struct");
413 // Check UTF-8 literals.
414 #define u8 syntax error!
415 char const utf8_literal[] = u8"happens to be ASCII" "another string";
417 // Check duplicate typedefs.
418 typedef long *long_ptr;
419 typedef long int *long_ptr;
420 typedef long_ptr long_ptr;
422 // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
426 struct { int i; int j; };
427 struct { int k; long int l; } w;
432 [_AC_C_C99_TEST_BODY[
435 _Static_assert (&v1.i == &v1.w.k, "Anonymous union alignment botch");
438 dnl GCC -std=gnu11 (unused restrictive mode: -std=c11)
439 dnl with extended modes being tried first.
441 dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as
442 dnl of September 2012) does not pass the C11 test. For now, try extc1x when
443 dnl compiling the C99 test instead, since it enables _Static_assert and
444 dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes
445 dnl the C11 test in some future version of IBM XL C, we'll add it here,
446 dnl preferably extc11.
447 [[-std=gnu11]], [$1], [$2])[]dnl
453 # Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC,
454 # as that'd be incompatible with how Automake redefines AC_PROG_CC. See
455 # <http://lists.gnu.org/archive/html/autoconf/2012-10/msg00048.html>.
456 AU_DEFUN([AC_PROG_CC_C89],
457 [AC_REQUIRE([AC_PROG_CC])],
458 [$0 is obsolete; use AC_PROG_CC]
463 AU_DEFUN([AC_PROG_CC_C99],
464 [AC_REQUIRE([AC_PROG_CC])],
465 [$0 is obsolete; use AC_PROG_CC]
470 AU_DEFUN([AC_PROG_CC_STDC],
471 [AC_REQUIRE([AC_PROG_CC])],
472 [$0 is obsolete; use AC_PROG_CC]
478 # Check if the C compiler supports prototypes, included if it needs
480 AC_DEFUN([AC_C_PROTOTYPES],
481 [AC_REQUIRE([AC_PROG_CC])dnl
482 if test "$ac_prog_cc_stdc" != no; then
483 AC_DEFINE(PROTOTYPES, 1,
484 [Define to 1 if the C compiler supports function prototypes.])
485 AC_DEFINE(__PROTOTYPES, 1,
486 [Define like PROTOTYPES; this can be used by system headers.])
491 # _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
492 # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
493 # ----------------------------------------------------------------
494 # Check whether the C++ compiler accepts features of STANDARD (e.g
495 # `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE
496 # and TEST-BODY. If this fails, try again with each compiler option
497 # in the space-separated OPTION-LIST; if one helps, append it to CXX.
498 # If eventually successful, run ACTION-IF-AVAILABLE, else
499 # ACTION-IF-UNAVAILABLE.
500 AC_DEFUN([_AC_CXX_STD_TRY],
501 [AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features])
503 AC_CACHE_VAL(ac_cv_prog_cxx_$1,
504 [ac_cv_prog_cxx_$1=no
506 AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
509 CXX="$ac_save_CXX $ac_arg"
510 _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg])
511 test "x$ac_cv_prog_cxx_$1" != "xno" && break
513 rm -f conftest.$ac_ext
516 ac_prog_cxx_stdcxx_options=
517 case "x$ac_cv_prog_cxx_$1" in
519 AC_MSG_RESULT([none needed]) ;;
521 AC_MSG_RESULT([unsupported]) ;;
523 ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1"
524 CXX=$CXX$ac_prog_cxx_stdcxx_options
525 AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;;
528 AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6])
531 # _AC_CXX_CXX98_TEST_HEADER
532 # -------------------------
533 # A C++ header suitable for testing for CXX98.
534 AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER],
551 typedef std::vector<std::string> string_vec;
552 typedef std::pair<int,bool> map_value;
553 typedef std::map<std::string,map_value> map_type;
554 typedef std::set<int> set_type;
559 printer(std::ostringstream& os): os(os) {}
560 void operator() (T elem) { os << elem << std::endl; }
562 std::ostringstream& os;
565 ]])# _AC_CXX_CXX98_TEST_HEADER
567 # _AC_CXX_CXX98_TEST_BODY
568 # -----------------------
569 # A C++ body suitable for testing for CXX98, assuming the corresponding header.
570 AC_DEFUN([_AC_CXX_CXX98_TEST_BODY],
575 std::string teststr("ASCII text");
576 teststr += " string";
579 test::string_vec testvec;
580 testvec.push_back(teststr);
581 testvec.push_back("foo");
582 testvec.push_back("bar");
583 if (testvec.size() != 3) {
584 throw std::runtime_error("vector size is not 1");
587 // Dump vector into stringstream and obtain string.
588 std::ostringstream os;
589 for (test::string_vec::const_iterator i = testvec.begin();
590 i != testvec.end(); ++i) {
591 if (i + 1 != testvec.end()) {
592 os << teststr << '\n';
595 // Check algorithms work.
596 std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os));
597 std::string os_out = os.str();
599 // Test pair and map.
600 test::map_type testmap;
601 testmap.insert(std::make_pair(std::string("key"),
602 std::make_pair(53,false)));
605 int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
606 test::set_type testset(values, values + sizeof(values)/sizeof(values[0]));
607 std::list<int> testlist(testset.begin(), testset.end());
608 std::copy(testset.begin(), testset.end(), std::back_inserter(testlist));
609 } catch (const std::exception& e) {
610 std::cerr << "Caught exception: " << e.what() << std::endl;
613 std::ofstream of("test.txt");
614 of << "Test ASCII text\n" << std::flush;
615 of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl;
621 # _AC_CXX_CXX11_TEST_HEADER
622 # -------------------------
623 # A C++ header suitable for testing for CXX11.
624 AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER],
627 #include <functional>
636 typedef std::shared_ptr<std::string> sptr;
637 typedef std::weak_ptr<std::string> wptr;
639 typedef std::tuple<std::string,int,double> tp;
640 typedef std::array<int, 20> int_array;
642 constexpr int get_val() { return 20; }
652 delegate(int n) : n(n) {}
653 delegate(): delegate(2354) {}
655 virtual int getval() { return this->n; };
660 class overridden : public delegate {
662 overridden(int n): delegate(n) {}
663 virtual int getval() override final { return this->n * 2; }
668 nocopy(int i): i(i) {}
670 nocopy(const nocopy&) = delete;
671 nocopy & operator=(const nocopy&) = delete;
676 ]])# _AC_CXX_CXX11_TEST_HEADER
678 # _AC_CXX_CXX11_TEST_BODY
679 # -----------------------
680 # A C++ body suitable for testing for CXX11, assuming the corresponding header.
681 AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
684 // Test auto and decltype
691 for (auto i = d.begin(); i != d.end(); ++i) { total += *i; }
694 auto a2 = 48573953.4;
695 auto a3 = "String literal";
697 decltype(a2) a4 = 34895.034;
701 short sa[cxx11test::get_val()] = { 0 };
704 // Test initialiser lists
705 cxx11test::testinit il = { 4323, 435234.23544 };
708 // Test range-based for and lambda
709 cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
710 for (int &x : array) { x += 23; }
711 std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; });
714 using cxx11test::sptr;
715 using cxx11test::wptr;
717 sptr sp(new std::string("ASCII string"));
722 cxx11test::tp tuple("test", 54, 45.53434);
723 double d = std::get<2>(tuple);
726 std::tie(s,i,d) = tuple;
729 static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$");
730 std::string testmatch("Test if this string matches");
731 bool match = std::regex_search(testmatch, filename_regex);
734 cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
735 cxx11test::int_array::size_type size = array.size();
738 // Test constructor delegation
739 cxx11test::delegate d1;
740 cxx11test::delegate d2();
741 cxx11test::delegate d3(45);
744 // Test override and final
745 cxx11test::overridden o1(55464);
752 // Test template brackets
753 std::vector<std::pair<int,char*>> v1;
757 char *utf8 = u8"UTF-8 string \u2500";
758 char16_t *utf16 = u"UTF-8 string \u2500";
759 char32_t *utf32 = U"UTF-32 string \u2500";
763 # _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
764 # -------------------------------------------------------------------
766 # If the C++ compiler is not in ISO C++98 mode by default, try to add
767 # an option to output variable CXX to make it so. This macro tries
768 # various options that select ISO C++98 on some system or another. It
769 # considers the compiler to be in ISO C++98 mode if it handles basic
770 # features of the std namespace including: string, containers (list,
771 # map, set, vector), streams (fstreams, iostreams, stringstreams,
772 # iomanip), pair, exceptions and algorithms.
775 AC_DEFUN([_AC_PROG_CXX_CXX98],
776 [_AC_CXX_STD_TRY([cxx98],
777 [_AC_CXX_CXX98_TEST_HEADER],
778 [_AC_CXX_CXX98_TEST_BODY],
780 dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98)
781 dnl IBM XL C -qlanglvl=extended
783 dnl Intel ICC -std=gnu++98
784 dnl Solaris N/A (default)
785 dnl Tru64 N/A (default, but -std gnu could be used)
786 dnl with extended modes being tried first.
787 [[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl
788 ])# _AC_PROG_CXX_CXX98
790 # _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
791 # -------------------------------------------------------------------
792 # If the C++ compiler is not in ISO CXX11 mode by default, try to add
793 # an option to output variable CXX to make it so. This macro tries
794 # various options that select ISO C++11 on some system or another. It
795 # considers the compiler to be in ISO C++11 mode if it handles all the
796 # tests from the C++98 checks, plus the following: Language features
797 # (auto, constexpr, decltype, default/deleted constructors, delegate
798 # constructors, final, initialiser lists, lambda functions, nullptr,
799 # override, range-based for loops, template brackets without spaces,
800 # unicode literals) and library features (array, memory (shared_ptr,
801 # weak_ptr), regex and tuple types).
802 AC_DEFUN([_AC_PROG_CXX_CXX11],
803 [_AC_CXX_STD_TRY([cxx11],
804 [_AC_CXX_CXX11_TEST_HEADER
805 _AC_CXX_CXX98_TEST_HEADER],
806 [_AC_CXX_CXX11_TEST_BODY
807 _AC_CXX_CXX98_TEST_BODY],
809 dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants]
810 dnl IBM XL C -qlanglvl=extended0x
811 dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11)
813 dnl Intel ICC -std=c++11 -std=c++0x
814 dnl Solaris N/A (no support)
815 dnl Tru64 N/A (no support)
816 dnl with extended modes being tried first.
817 [[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl
818 ])# _AC_PROG_CXX_CXX11