Blame m4/std-gnu11.m4

Packit 8f70b4
# Prefer GNU C11 and C++11 to earlier versions.  -*- coding: utf-8 -*-
Packit 8f70b4
Packit 8f70b4
# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
Packit 8f70b4
# commit 017d5ddd82854911f0119691d91ea8a1438824d6
Packit 8f70b4
# dated Sun Apr 3 13:57:17 2016 -0700
Packit 8f70b4
# This implementation will be obsolete once we can assume Autoconf 2.70
Packit 8f70b4
# or later is installed everywhere a Gnulib program might be developed.
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
Packit 8f70b4
Packit 8f70b4
# This program is free software; you can redistribute it and/or modify
Packit 8f70b4
# it under the terms of the GNU General Public License as published by
Packit 8f70b4
# the Free Software Foundation, either version 3 of the License, or
Packit 8f70b4
# (at your option) any later version.
Packit 8f70b4
#
Packit 8f70b4
# This program is distributed in the hope that it will be useful,
Packit 8f70b4
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 8f70b4
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 8f70b4
# GNU General Public License for more details.
Packit 8f70b4
#
Packit 8f70b4
# You should have received a copy of the GNU General Public License
Packit 8f70b4
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
Packit 8f70b4
Packit 8f70b4
# Written by David MacKenzie, with help from
Packit 8f70b4
# Akim Demaille, Paul Eggert,
Packit 8f70b4
# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
Packit 8f70b4
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# AC_PROG_CC([COMPILER ...])
Packit 8f70b4
# --------------------------
Packit 8f70b4
# COMPILER ... is a space separated list of C compilers to search for.
Packit 8f70b4
# This just gives the user an opportunity to specify an alternative
Packit 8f70b4
# search list for the C compiler.
Packit 8f70b4
AC_DEFUN_ONCE([AC_PROG_CC],
Packit 8f70b4
[AC_LANG_PUSH(C)dnl
Packit 8f70b4
AC_ARG_VAR([CC],     [C compiler command])dnl
Packit 8f70b4
AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
Packit 8f70b4
_AC_ARG_VAR_LDFLAGS()dnl
Packit 8f70b4
_AC_ARG_VAR_LIBS()dnl
Packit 8f70b4
_AC_ARG_VAR_CPPFLAGS()dnl
Packit 8f70b4
m4_ifval([$1],
Packit 8f70b4
      [AC_CHECK_TOOLS(CC, [$1])],
Packit 8f70b4
[AC_CHECK_TOOL(CC, gcc)
Packit 8f70b4
if test -z "$CC"; then
Packit 8f70b4
  dnl Here we want:
Packit 8f70b4
  dnl	AC_CHECK_TOOL(CC, cc)
Packit 8f70b4
  dnl but without the check for a tool without the prefix.
Packit 8f70b4
  dnl Until the check is removed from there, copy the code:
Packit 8f70b4
  if test -n "$ac_tool_prefix"; then
Packit 8f70b4
    AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
Packit 8f70b4
  fi
Packit 8f70b4
fi
Packit 8f70b4
if test -z "$CC"; then
Packit 8f70b4
  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
Packit 8f70b4
fi
Packit 8f70b4
if test -z "$CC"; then
Packit 8f70b4
  AC_CHECK_TOOLS(CC, cl.exe)
Packit 8f70b4
fi
Packit 8f70b4
if test -z "$CC"; then
Packit 8f70b4
  AC_CHECK_TOOL(CC, clang)
Packit 8f70b4
fi
Packit 8f70b4
])
Packit 8f70b4
Packit 8f70b4
test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
Packit 8f70b4
Packit 8f70b4
# Provide some information about the compiler.
Packit 8f70b4
_AS_ECHO_LOG([checking for _AC_LANG compiler version])
Packit 8f70b4
set X $ac_compile
Packit 8f70b4
ac_compiler=$[2]
Packit 8f70b4
for ac_option in --version -v -V -qversion -version; do
Packit 8f70b4
  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
Packit 8f70b4
done
Packit 8f70b4
Packit 8f70b4
m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
Packit 8f70b4
m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
Packit 8f70b4
_AC_LANG_COMPILER_GNU
Packit 8f70b4
if test $ac_compiler_gnu = yes; then
Packit 8f70b4
  GCC=yes
Packit 8f70b4
else
Packit 8f70b4
  GCC=
Packit 8f70b4
fi
Packit 8f70b4
_AC_PROG_CC_G
Packit 8f70b4
dnl
Packit 8f70b4
dnl Set ac_prog_cc_stdc to the supported C version.
Packit 8f70b4
dnl Also set the documented variable ac_cv_prog_cc_stdc;
Packit 8f70b4
dnl its name was chosen when it was cached, but it is no longer cached.
Packit 8f70b4
_AC_PROG_CC_C11([ac_prog_cc_stdc=c11
Packit 8f70b4
		 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11],
Packit 8f70b4
  [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99
Packit 8f70b4
		    ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
Packit 8f70b4
     [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89
Packit 8f70b4
		       ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
Packit 8f70b4
		      [ac_prog_cc_stdc=no
Packit 8f70b4
		       ac_cv_prog_cc_stdc=no])])])
Packit 8f70b4
dnl
Packit 8f70b4
AC_LANG_POP(C)dnl
Packit 8f70b4
])# AC_PROG_CC
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# AC_PROG_CXX([LIST-OF-COMPILERS])
Packit 8f70b4
# --------------------------------
Packit 8f70b4
# LIST-OF-COMPILERS is a space separated list of C++ compilers to search
Packit 8f70b4
# for (if not specified, a default list is used).  This just gives the
Packit 8f70b4
# user an opportunity to specify an alternative search list for the C++
Packit 8f70b4
# compiler.
Packit 8f70b4
# aCC	HP-UX C++ compiler much better than `CC', so test before.
Packit 8f70b4
# FCC   Fujitsu C++ compiler
Packit 8f70b4
# KCC	KAI C++ compiler
Packit 8f70b4
# RCC	Rational C++
Packit 8f70b4
# xlC_r	AIX C Set++ (with support for reentrant code)
Packit 8f70b4
# xlC	AIX C Set++
Packit 8f70b4
AC_DEFUN([AC_PROG_CXX],
Packit 8f70b4
[AC_LANG_PUSH(C++)dnl
Packit 8f70b4
AC_ARG_VAR([CXX],      [C++ compiler command])dnl
Packit 8f70b4
AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
Packit 8f70b4
_AC_ARG_VAR_LDFLAGS()dnl
Packit 8f70b4
_AC_ARG_VAR_LIBS()dnl
Packit 8f70b4
_AC_ARG_VAR_CPPFLAGS()dnl
Packit 8f70b4
_AC_ARG_VAR_PRECIOUS([CCC])dnl
Packit 8f70b4
if test -z "$CXX"; then
Packit 8f70b4
  if test -n "$CCC"; then
Packit 8f70b4
    CXX=$CCC
Packit 8f70b4
  else
Packit 8f70b4
    AC_CHECK_TOOLS(CXX,
Packit 8f70b4
		   [m4_default([$1],
Packit 8f70b4
			       [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])],
Packit 8f70b4
		   g++)
Packit 8f70b4
  fi
Packit 8f70b4
fi
Packit 8f70b4
# Provide some information about the compiler.
Packit 8f70b4
_AS_ECHO_LOG([checking for _AC_LANG compiler version])
Packit 8f70b4
set X $ac_compile
Packit 8f70b4
ac_compiler=$[2]
Packit 8f70b4
for ac_option in --version -v -V -qversion; do
Packit 8f70b4
  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
Packit 8f70b4
done
Packit 8f70b4
Packit 8f70b4
m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
Packit 8f70b4
m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
Packit 8f70b4
_AC_LANG_COMPILER_GNU
Packit 8f70b4
if test $ac_compiler_gnu = yes; then
Packit 8f70b4
  GXX=yes
Packit 8f70b4
else
Packit 8f70b4
  GXX=
Packit 8f70b4
fi
Packit 8f70b4
_AC_PROG_CXX_G
Packit 8f70b4
_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11
Packit 8f70b4
		    ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11
Packit 8f70b4
		    ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11],
Packit 8f70b4
   [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98
Packit 8f70b4
		        ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98],
Packit 8f70b4
		       [ac_prog_cxx_stdcxx=no
Packit 8f70b4
		        ac_cv_prog_cxx_stdcxx=no])])
Packit 8f70b4
AC_LANG_POP(C++)dnl
Packit 8f70b4
])# AC_PROG_CXX
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
Packit 8f70b4
#		ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
Packit 8f70b4
# --------------------------------------------------------------
Packit 8f70b4
# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
Packit 8f70b4
# by trying to compile a program of TEST-PROLOGUE and TEST-BODY.  If this fails,
Packit 8f70b4
# try again with each compiler option in the space-separated OPTION-LIST; if one
Packit 8f70b4
# helps, append it to CC.  If eventually successful, run ACTION-IF-AVAILABLE,
Packit 8f70b4
# else ACTION-IF-UNAVAILABLE.
Packit 8f70b4
AC_DEFUN([_AC_C_STD_TRY],
Packit 8f70b4
[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features])
Packit 8f70b4
AC_CACHE_VAL(ac_cv_prog_cc_$1,
Packit 8f70b4
[ac_cv_prog_cc_$1=no
Packit 8f70b4
ac_save_CC=$CC
Packit 8f70b4
AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
Packit 8f70b4
for ac_arg in '' $4
Packit 8f70b4
do
Packit 8f70b4
  CC="$ac_save_CC $ac_arg"
Packit 8f70b4
  _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
Packit 8f70b4
  test "x$ac_cv_prog_cc_$1" != "xno" && break
Packit 8f70b4
done
Packit 8f70b4
rm -f conftest.$ac_ext
Packit 8f70b4
CC=$ac_save_CC
Packit 8f70b4
])# AC_CACHE_VAL
Packit 8f70b4
ac_prog_cc_stdc_options=
Packit 8f70b4
case "x$ac_cv_prog_cc_$1" in
Packit 8f70b4
  x)
Packit 8f70b4
    AC_MSG_RESULT([none needed]) ;;
Packit 8f70b4
  xno)
Packit 8f70b4
    AC_MSG_RESULT([unsupported]) ;;
Packit 8f70b4
  *)
Packit 8f70b4
    ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1"
Packit 8f70b4
    CC=$CC$ac_prog_cc_stdc_options
Packit 8f70b4
    AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
Packit 8f70b4
esac
Packit 8f70b4
AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
Packit 8f70b4
])# _AC_C_STD_TRY
Packit 8f70b4
Packit 8f70b4
# _AC_C_C99_TEST_HEADER
Packit 8f70b4
# ---------------------
Packit 8f70b4
# A C header suitable for testing for C99.
Packit 8f70b4
AC_DEFUN([_AC_C_C99_TEST_HEADER],
Packit 8f70b4
[[#include <stdarg.h>
Packit 8f70b4
#include <stdbool.h>
Packit 8f70b4
#include <stddef.h>
Packit 8f70b4
#include <stdlib.h>
Packit 8f70b4
#include <wchar.h>
Packit 8f70b4
#include <stdio.h>
Packit 8f70b4
Packit 8f70b4
// Check varargs macros.  These examples are taken from C99 6.10.3.5.
Packit 8f70b4
#define debug(...) fprintf (stderr, __VA_ARGS__)
Packit 8f70b4
#define showlist(...) puts (#__VA_ARGS__)
Packit 8f70b4
#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
Packit 8f70b4
static void
Packit 8f70b4
test_varargs_macros (void)
Packit 8f70b4
{
Packit 8f70b4
  int x = 1234;
Packit 8f70b4
  int y = 5678;
Packit 8f70b4
  debug ("Flag");
Packit 8f70b4
  debug ("X = %d\n", x);
Packit 8f70b4
  showlist (The first, second, and third items.);
Packit 8f70b4
  report (x>y, "x is %d but y is %d", x, y);
Packit 8f70b4
}
Packit 8f70b4
Packit 8f70b4
// Check long long types.
Packit 8f70b4
#define BIG64 18446744073709551615ull
Packit 8f70b4
#define BIG32 4294967295ul
Packit 8f70b4
#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
Packit 8f70b4
#if !BIG_OK
Packit 8f70b4
  your preprocessor is broken;
Packit 8f70b4
#endif
Packit 8f70b4
#if BIG_OK
Packit 8f70b4
#else
Packit 8f70b4
  your preprocessor is broken;
Packit 8f70b4
#endif
Packit 8f70b4
static long long int bignum = -9223372036854775807LL;
Packit 8f70b4
static unsigned long long int ubignum = BIG64;
Packit 8f70b4
Packit 8f70b4
struct incomplete_array
Packit 8f70b4
{
Packit 8f70b4
  int datasize;
Packit 8f70b4
  double data[];
Packit 8f70b4
};
Packit 8f70b4
Packit 8f70b4
struct named_init {
Packit 8f70b4
  int number;
Packit 8f70b4
  const wchar_t *name;
Packit 8f70b4
  double average;
Packit 8f70b4
};
Packit 8f70b4
Packit 8f70b4
typedef const char *ccp;
Packit 8f70b4
Packit 8f70b4
static inline int
Packit 8f70b4
test_restrict (ccp restrict text)
Packit 8f70b4
{
Packit 8f70b4
  // See if C++-style comments work.
Packit 8f70b4
  // Iterate through items via the restricted pointer.
Packit 8f70b4
  // Also check for declarations in for loops.
Packit 8f70b4
  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
Packit 8f70b4
    continue;
Packit 8f70b4
  return 0;
Packit 8f70b4
}
Packit 8f70b4
Packit 8f70b4
// Check varargs and va_copy.
Packit 8f70b4
static bool
Packit 8f70b4
test_varargs (const char *format, ...)
Packit 8f70b4
{
Packit 8f70b4
  va_list args;
Packit 8f70b4
  va_start (args, format);
Packit 8f70b4
  va_list args_copy;
Packit 8f70b4
  va_copy (args_copy, args);
Packit 8f70b4
Packit 8f70b4
  const char *str = "";
Packit 8f70b4
  int number = 0;
Packit 8f70b4
  float fnumber = 0;
Packit 8f70b4
Packit 8f70b4
  while (*format)
Packit 8f70b4
    {
Packit 8f70b4
      switch (*format++)
Packit 8f70b4
	{
Packit 8f70b4
	case 's': // string
Packit 8f70b4
	  str = va_arg (args_copy, const char *);
Packit 8f70b4
	  break;
Packit 8f70b4
	case 'd': // int
Packit 8f70b4
	  number = va_arg (args_copy, int);
Packit 8f70b4
	  break;
Packit 8f70b4
	case 'f': // float
Packit 8f70b4
	  fnumber = va_arg (args_copy, double);
Packit 8f70b4
	  break;
Packit 8f70b4
	default:
Packit 8f70b4
	  break;
Packit 8f70b4
	}
Packit 8f70b4
    }
Packit 8f70b4
  va_end (args_copy);
Packit 8f70b4
  va_end (args);
Packit 8f70b4
Packit 8f70b4
  return *str && number && fnumber;
Packit 8f70b4
}]])# _AC_C_C99_TEST_HEADER
Packit 8f70b4
Packit 8f70b4
# _AC_C_C99_TEST_BODY
Packit 8f70b4
# -------------------
Packit 8f70b4
# A C body suitable for testing for C99, assuming the corresponding header.
Packit 8f70b4
AC_DEFUN([_AC_C_C99_TEST_BODY],
Packit 8f70b4
[[
Packit 8f70b4
  // Check bool.
Packit 8f70b4
  _Bool success = false;
Packit 8f70b4
Packit 8f70b4
  // Check restrict.
Packit 8f70b4
  if (test_restrict ("String literal") == 0)
Packit 8f70b4
    success = true;
Packit 8f70b4
  char *restrict newvar = "Another string";
Packit 8f70b4
Packit 8f70b4
  // Check varargs.
Packit 8f70b4
  success &= test_varargs ("s, d' f .", "string", 65, 34.234);
Packit 8f70b4
  test_varargs_macros ();
Packit 8f70b4
Packit 8f70b4
  // Check flexible array members.
Packit 8f70b4
  struct incomplete_array *ia =
Packit 8f70b4
    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
Packit 8f70b4
  ia->datasize = 10;
Packit 8f70b4
  for (int i = 0; i < ia->datasize; ++i)
Packit 8f70b4
    ia->data[i] = i * 1.234;
Packit 8f70b4
Packit 8f70b4
  // Check named initializers.
Packit 8f70b4
  struct named_init ni = {
Packit 8f70b4
    .number = 34,
Packit 8f70b4
    .name = L"Test wide string",
Packit 8f70b4
    .average = 543.34343,
Packit 8f70b4
  };
Packit 8f70b4
Packit 8f70b4
  ni.number = 58;
Packit 8f70b4
Packit 8f70b4
  int dynamic_array[ni.number];
Packit 8f70b4
  dynamic_array[ni.number - 1] = 543;
Packit 8f70b4
Packit 8f70b4
  // work around unused variable warnings
Packit 8f70b4
  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
Packit 8f70b4
	  || dynamic_array[ni.number - 1] != 543);
Packit 8f70b4
]])
Packit 8f70b4
Packit 8f70b4
# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
Packit 8f70b4
# ----------------------------------------------------------------
Packit 8f70b4
# If the C compiler is not in ISO C99 mode by default, try to add an
Packit 8f70b4
# option to output variable CC to make it so.  This macro tries
Packit 8f70b4
# various options that select ISO C99 on some system or another.  It
Packit 8f70b4
# considers the compiler to be in ISO C99 mode if it handles _Bool,
Packit 8f70b4
# // comments, flexible array members, inline, long long int, mixed
Packit 8f70b4
# code and declarations, named initialization of structs, restrict,
Packit 8f70b4
# va_copy, varargs macros, variable declarations in for loops and
Packit 8f70b4
# variable length arrays.
Packit 8f70b4
AC_DEFUN([_AC_PROG_CC_C99],
Packit 8f70b4
[_AC_C_STD_TRY([c99],
Packit 8f70b4
[_AC_C_C99_TEST_HEADER],
Packit 8f70b4
[_AC_C_C99_TEST_BODY],
Packit 8f70b4
dnl Try
Packit 8f70b4
dnl GCC		-std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
Packit 8f70b4
dnl IBM XL C	-qlanglvl=extc1x (V12.1; does not pass C11 test)
Packit 8f70b4
dnl IBM XL C	-qlanglvl=extc99
Packit 8f70b4
dnl		(pre-V12.1; unused restrictive mode: -qlanglvl=stdc99)
Packit 8f70b4
dnl HP cc	-AC99
Packit 8f70b4
dnl Intel ICC	-std=c99, -c99 (deprecated)
Packit 8f70b4
dnl IRIX	-c99
Packit 8f70b4
dnl Solaris	-D_STDC_C99=
Packit 8f70b4
dnl		cc's -xc99 option uses linker magic to define the external
Packit 8f70b4
dnl		symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99
Packit 8f70b4
dnl		behavior for C library functions.  This is not wanted here,
Packit 8f70b4
dnl		because it means that a single module compiled with -xc99
Packit 8f70b4
dnl		alters C runtime behavior for the entire program, not for
Packit 8f70b4
dnl		just the module.  Instead, define the (private) symbol
Packit 8f70b4
dnl		_STDC_C99, which suppresses a bogus failure in <stdbool.h>.
Packit 8f70b4
dnl		The resulting compiler passes the test case here, and that's
Packit 8f70b4
dnl		good enough.  For more, please see the thread starting at:
Packit 8f70b4
dnl            https://lists.gnu.org/r/autoconf/2010-12/msg00059.html
Packit 8f70b4
dnl Tru64	-c99
Packit 8f70b4
dnl with extended modes being tried first.
Packit 8f70b4
[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl
Packit 8f70b4
])# _AC_PROG_CC_C99
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
Packit 8f70b4
# ----------------------------------------------------------------
Packit 8f70b4
# If the C compiler is not in ISO C11 mode by default, try to add an
Packit 8f70b4
# option to output variable CC to make it so.  This macro tries
Packit 8f70b4
# various options that select ISO C11 on some system or another.  It
Packit 8f70b4
# considers the compiler to be in ISO C11 mode if it handles _Alignas,
Packit 8f70b4
# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals,
Packit 8f70b4
# duplicate typedefs, and anonymous structures and unions.
Packit 8f70b4
AC_DEFUN([_AC_PROG_CC_C11],
Packit 8f70b4
[_AC_C_STD_TRY([c11],
Packit 8f70b4
[_AC_C_C99_TEST_HEADER[
Packit 8f70b4
// Check _Alignas.
Packit 8f70b4
char _Alignas (double) aligned_as_double;
Packit 8f70b4
char _Alignas (0) no_special_alignment;
Packit 8f70b4
extern char aligned_as_int;
Packit 8f70b4
char _Alignas (0) _Alignas (int) aligned_as_int;
Packit 8f70b4
Packit 8f70b4
// Check _Alignof.
Packit 8f70b4
enum
Packit 8f70b4
{
Packit 8f70b4
  int_alignment = _Alignof (int),
Packit 8f70b4
  int_array_alignment = _Alignof (int[100]),
Packit 8f70b4
  char_alignment = _Alignof (char)
Packit 8f70b4
};
Packit 8f70b4
_Static_assert (0 < -_Alignof (int), "_Alignof is signed");
Packit 8f70b4
Packit 8f70b4
// Check _Noreturn.
Packit 8f70b4
int _Noreturn does_not_return (void) { for (;;) continue; }
Packit 8f70b4
Packit 8f70b4
// Check _Static_assert.
Packit 8f70b4
struct test_static_assert
Packit 8f70b4
{
Packit 8f70b4
  int x;
Packit 8f70b4
  _Static_assert (sizeof (int) <= sizeof (long int),
Packit 8f70b4
                  "_Static_assert does not work in struct");
Packit 8f70b4
  long int y;
Packit 8f70b4
};
Packit 8f70b4
Packit 8f70b4
// Check UTF-8 literals.
Packit 8f70b4
#define u8 syntax error!
Packit 8f70b4
char const utf8_literal[] = u8"happens to be ASCII" "another string";
Packit 8f70b4
Packit 8f70b4
// Check duplicate typedefs.
Packit 8f70b4
typedef long *long_ptr;
Packit 8f70b4
typedef long int *long_ptr;
Packit 8f70b4
typedef long_ptr long_ptr;
Packit 8f70b4
Packit 8f70b4
// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
Packit 8f70b4
struct anonymous
Packit 8f70b4
{
Packit 8f70b4
  union {
Packit 8f70b4
    struct { int i; int j; };
Packit 8f70b4
    struct { int k; long int l; } w;
Packit 8f70b4
  };
Packit 8f70b4
  int m;
Packit 8f70b4
} v1;
Packit 8f70b4
]],
Packit 8f70b4
[_AC_C_C99_TEST_BODY[
Packit 8f70b4
  v1.i = 2;
Packit 8f70b4
  v1.w.k = 5;
Packit 8f70b4
  _Static_assert ((offsetof (struct anonymous, i)
Packit 8f70b4
		   == offsetof (struct anonymous, w.k)),
Packit 8f70b4
		  "Anonymous union alignment botch");
Packit 8f70b4
]],
Packit 8f70b4
dnl Try
Packit 8f70b4
dnl GCC		-std=gnu11 (unused restrictive mode: -std=c11)
Packit 8f70b4
dnl with extended modes being tried first.
Packit 8f70b4
dnl
Packit 8f70b4
dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as
Packit 8f70b4
dnl of September 2012) does not pass the C11 test.  For now, try extc1x when
Packit 8f70b4
dnl compiling the C99 test instead, since it enables _Static_assert and
Packit 8f70b4
dnl _Noreturn, which is a win.  If -qlanglvl=extc11 or -qlanglvl=extc1x passes
Packit 8f70b4
dnl the C11 test in some future version of IBM XL C, we'll add it here,
Packit 8f70b4
dnl preferably extc11.
Packit 8f70b4
[[-std=gnu11]], [$1], [$2])[]dnl
Packit 8f70b4
])# _AC_PROG_CC_C11
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# AC_PROG_CC_C89
Packit 8f70b4
# --------------
Packit 8f70b4
# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC,
Packit 8f70b4
# as that'd be incompatible with how Automake redefines AC_PROG_CC.  See
Packit 8f70b4
# <https://lists.gnu.org/r/autoconf/2012-10/msg00048.html>.
Packit 8f70b4
AU_DEFUN([AC_PROG_CC_C89],
Packit 8f70b4
  [AC_REQUIRE([AC_PROG_CC])],
Packit 8f70b4
  [$0 is obsolete; use AC_PROG_CC]
Packit 8f70b4
)
Packit 8f70b4
Packit 8f70b4
# AC_PROG_CC_C99
Packit 8f70b4
# --------------
Packit 8f70b4
AU_DEFUN([AC_PROG_CC_C99],
Packit 8f70b4
  [AC_REQUIRE([AC_PROG_CC])],
Packit 8f70b4
  [$0 is obsolete; use AC_PROG_CC]
Packit 8f70b4
)
Packit 8f70b4
Packit 8f70b4
# AC_PROG_CC_STDC
Packit 8f70b4
# ---------------
Packit 8f70b4
AU_DEFUN([AC_PROG_CC_STDC],
Packit 8f70b4
  [AC_REQUIRE([AC_PROG_CC])],
Packit 8f70b4
  [$0 is obsolete; use AC_PROG_CC]
Packit 8f70b4
)
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# AC_C_PROTOTYPES
Packit 8f70b4
# ---------------
Packit 8f70b4
# Check if the C compiler supports prototypes, included if it needs
Packit 8f70b4
# options.
Packit 8f70b4
AC_DEFUN([AC_C_PROTOTYPES],
Packit 8f70b4
[AC_REQUIRE([AC_PROG_CC])dnl
Packit 8f70b4
if test "$ac_prog_cc_stdc" != no; then
Packit 8f70b4
  AC_DEFINE(PROTOTYPES, 1,
Packit 8f70b4
	    [Define to 1 if the C compiler supports function prototypes.])
Packit 8f70b4
  AC_DEFINE(__PROTOTYPES, 1,
Packit 8f70b4
	    [Define like PROTOTYPES; this can be used by system headers.])
Packit 8f70b4
fi
Packit 8f70b4
])# AC_C_PROTOTYPES
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
Packit 8f70b4
#		  ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
Packit 8f70b4
# ----------------------------------------------------------------
Packit 8f70b4
# Check whether the C++ compiler accepts features of STANDARD (e.g
Packit 8f70b4
# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE
Packit 8f70b4
# and TEST-BODY.  If this fails, try again with each compiler option
Packit 8f70b4
# in the space-separated OPTION-LIST; if one helps, append it to CXX.
Packit 8f70b4
# If eventually successful, run ACTION-IF-AVAILABLE, else
Packit 8f70b4
# ACTION-IF-UNAVAILABLE.
Packit 8f70b4
AC_DEFUN([_AC_CXX_STD_TRY],
Packit 8f70b4
[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features])
Packit 8f70b4
AC_LANG_PUSH(C++)dnl
Packit 8f70b4
AC_CACHE_VAL(ac_cv_prog_cxx_$1,
Packit 8f70b4
[ac_cv_prog_cxx_$1=no
Packit 8f70b4
ac_save_CXX=$CXX
Packit 8f70b4
AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
Packit 8f70b4
for ac_arg in '' $4
Packit 8f70b4
do
Packit 8f70b4
  CXX="$ac_save_CXX $ac_arg"
Packit 8f70b4
  _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg])
Packit 8f70b4
  test "x$ac_cv_prog_cxx_$1" != "xno" && break
Packit 8f70b4
done
Packit 8f70b4
rm -f conftest.$ac_ext
Packit 8f70b4
CXX=$ac_save_CXX
Packit 8f70b4
])# AC_CACHE_VAL
Packit 8f70b4
ac_prog_cxx_stdcxx_options=
Packit 8f70b4
case "x$ac_cv_prog_cxx_$1" in
Packit 8f70b4
  x)
Packit 8f70b4
    AC_MSG_RESULT([none needed]) ;;
Packit 8f70b4
  xno)
Packit 8f70b4
    AC_MSG_RESULT([unsupported]) ;;
Packit 8f70b4
  *)
Packit 8f70b4
    ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1"
Packit 8f70b4
    CXX=$CXX$ac_prog_cxx_stdcxx_options
Packit 8f70b4
    AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;;
Packit 8f70b4
esac
Packit 8f70b4
AC_LANG_POP(C++)dnl
Packit 8f70b4
AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6])
Packit 8f70b4
])# _AC_CXX_STD_TRY
Packit 8f70b4
Packit 8f70b4
# _AC_CXX_CXX98_TEST_HEADER
Packit 8f70b4
# -------------------------
Packit 8f70b4
# A C++ header suitable for testing for CXX98.
Packit 8f70b4
AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER],
Packit 8f70b4
[[
Packit 8f70b4
#include <algorithm>
Packit 8f70b4
#include <cstdlib>
Packit 8f70b4
#include <fstream>
Packit 8f70b4
#include <iomanip>
Packit 8f70b4
#include <iostream>
Packit 8f70b4
#include <list>
Packit 8f70b4
#include <map>
Packit 8f70b4
#include <set>
Packit 8f70b4
#include <sstream>
Packit 8f70b4
#include <stdexcept>
Packit 8f70b4
#include <string>
Packit 8f70b4
#include <utility>
Packit 8f70b4
#include <vector>
Packit 8f70b4
Packit 8f70b4
namespace test {
Packit 8f70b4
  typedef std::vector<std::string> string_vec;
Packit 8f70b4
  typedef std::pair<int,bool> map_value;
Packit 8f70b4
  typedef std::map<std::string,map_value> map_type;
Packit 8f70b4
  typedef std::set<int> set_type;
Packit 8f70b4
Packit 8f70b4
  template<typename T>
Packit 8f70b4
  class printer {
Packit 8f70b4
  public:
Packit 8f70b4
    printer(std::ostringstream& os): os(os) {}
Packit 8f70b4
    void operator() (T elem) { os << elem << std::endl; }
Packit 8f70b4
  private:
Packit 8f70b4
    std::ostringstream& os;
Packit 8f70b4
  };
Packit 8f70b4
}
Packit 8f70b4
]])# _AC_CXX_CXX98_TEST_HEADER
Packit 8f70b4
Packit 8f70b4
# _AC_CXX_CXX98_TEST_BODY
Packit 8f70b4
# -----------------------
Packit 8f70b4
# A C++ body suitable for testing for CXX98, assuming the corresponding header.
Packit 8f70b4
AC_DEFUN([_AC_CXX_CXX98_TEST_BODY],
Packit 8f70b4
[[
Packit 8f70b4
Packit 8f70b4
try {
Packit 8f70b4
  // Basic string.
Packit 8f70b4
  std::string teststr("ASCII text");
Packit 8f70b4
  teststr += " string";
Packit 8f70b4
Packit 8f70b4
  // Simple vector.
Packit 8f70b4
  test::string_vec testvec;
Packit 8f70b4
  testvec.push_back(teststr);
Packit 8f70b4
  testvec.push_back("foo");
Packit 8f70b4
  testvec.push_back("bar");
Packit 8f70b4
  if (testvec.size() != 3) {
Packit 8f70b4
    throw std::runtime_error("vector size is not 1");
Packit 8f70b4
  }
Packit 8f70b4
Packit 8f70b4
  // Dump vector into stringstream and obtain string.
Packit 8f70b4
  std::ostringstream os;
Packit 8f70b4
  for (test::string_vec::const_iterator i = testvec.begin();
Packit 8f70b4
       i != testvec.end(); ++i) {
Packit 8f70b4
    if (i + 1 != testvec.end()) {
Packit 8f70b4
      os << teststr << '\n';
Packit 8f70b4
    }
Packit 8f70b4
  }
Packit 8f70b4
  // Check algorithms work.
Packit 8f70b4
  std::for_each(testvec.begin(), testvec.end(), test::printer<std::string>(os));
Packit 8f70b4
  std::string os_out = os.str();
Packit 8f70b4
Packit 8f70b4
  // Test pair and map.
Packit 8f70b4
  test::map_type testmap;
Packit 8f70b4
  testmap.insert(std::make_pair(std::string("key"),
Packit 8f70b4
                                std::make_pair(53,false)));
Packit 8f70b4
Packit 8f70b4
  // Test set.
Packit 8f70b4
  int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
Packit 8f70b4
  test::set_type testset(values, values + sizeof(values)/sizeof(values[0]));
Packit 8f70b4
  std::list<int> testlist(testset.begin(), testset.end());
Packit 8f70b4
  std::copy(testset.begin(), testset.end(), std::back_inserter(testlist));
Packit 8f70b4
} catch (const std::exception& e) {
Packit 8f70b4
  std::cerr << "Caught exception: " << e.what() << std::endl;
Packit 8f70b4
Packit 8f70b4
  // Test fstream
Packit 8f70b4
  std::ofstream of("test.txt");
Packit 8f70b4
  of << "Test ASCII text\n" << std::flush;
Packit 8f70b4
  of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl;
Packit 8f70b4
  of.close();
Packit 8f70b4
}
Packit 8f70b4
std::exit(0);
Packit 8f70b4
]])
Packit 8f70b4
Packit 8f70b4
# _AC_CXX_CXX11_TEST_HEADER
Packit 8f70b4
# -------------------------
Packit 8f70b4
# A C++ header suitable for testing for CXX11.
Packit 8f70b4
AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER],
Packit 8f70b4
[[
Packit 8f70b4
#include <deque>
Packit 8f70b4
#include <functional>
Packit 8f70b4
#include <memory>
Packit 8f70b4
#include <tuple>
Packit 8f70b4
#include <array>
Packit 8f70b4
#include <regex>
Packit 8f70b4
#include <iostream>
Packit 8f70b4
Packit 8f70b4
namespace cxx11test
Packit 8f70b4
{
Packit 8f70b4
  typedef std::shared_ptr<std::string> sptr;
Packit 8f70b4
  typedef std::weak_ptr<std::string> wptr;
Packit 8f70b4
Packit 8f70b4
  typedef std::tuple<std::string,int,double> tp;
Packit 8f70b4
  typedef std::array<int, 20> int_array;
Packit 8f70b4
Packit 8f70b4
  constexpr int get_val() { return 20; }
Packit 8f70b4
Packit 8f70b4
  struct testinit
Packit 8f70b4
  {
Packit 8f70b4
    int i;
Packit 8f70b4
    double d;
Packit 8f70b4
  };
Packit 8f70b4
Packit 8f70b4
  class delegate  {
Packit 8f70b4
  public:
Packit 8f70b4
    delegate(int n) : n(n) {}
Packit 8f70b4
    delegate(): delegate(2354) {}
Packit 8f70b4
Packit 8f70b4
    virtual int getval() { return this->n; };
Packit 8f70b4
  protected:
Packit 8f70b4
    int n;
Packit 8f70b4
  };
Packit 8f70b4
Packit 8f70b4
  class overridden : public delegate {
Packit 8f70b4
  public:
Packit 8f70b4
    overridden(int n): delegate(n) {}
Packit 8f70b4
    virtual int getval() override final { return this->n * 2; }
Packit 8f70b4
  };
Packit 8f70b4
Packit 8f70b4
  class nocopy {
Packit 8f70b4
  public:
Packit 8f70b4
    nocopy(int i): i(i) {}
Packit 8f70b4
    nocopy() = default;
Packit 8f70b4
    nocopy(const nocopy&) = delete;
Packit 8f70b4
    nocopy & operator=(const nocopy&) = delete;
Packit 8f70b4
  private:
Packit 8f70b4
    int i;
Packit 8f70b4
  };
Packit 8f70b4
}
Packit 8f70b4
]])# _AC_CXX_CXX11_TEST_HEADER
Packit 8f70b4
Packit 8f70b4
# _AC_CXX_CXX11_TEST_BODY
Packit 8f70b4
# -----------------------
Packit 8f70b4
# A C++ body suitable for testing for CXX11, assuming the corresponding header.
Packit 8f70b4
AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
Packit 8f70b4
[[
Packit 8f70b4
{
Packit 8f70b4
  // Test auto and decltype
Packit 8f70b4
  std::deque<int> d;
Packit 8f70b4
  d.push_front(43);
Packit 8f70b4
  d.push_front(484);
Packit 8f70b4
  d.push_front(3);
Packit 8f70b4
  d.push_front(844);
Packit 8f70b4
  int total = 0;
Packit 8f70b4
  for (auto i = d.begin(); i != d.end(); ++i) { total += *i; }
Packit 8f70b4
Packit 8f70b4
  auto a1 = 6538;
Packit 8f70b4
  auto a2 = 48573953.4;
Packit 8f70b4
  auto a3 = "String literal";
Packit 8f70b4
Packit 8f70b4
  decltype(a2) a4 = 34895.034;
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test constexpr
Packit 8f70b4
  short sa[cxx11test::get_val()] = { 0 };
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test initializer lists
Packit 8f70b4
  cxx11test::testinit il = { 4323, 435234.23544 };
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test range-based for and lambda
Packit 8f70b4
  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
Packit 8f70b4
  for (int &x : array) { x += 23; }
Packit 8f70b4
  std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; });
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  using cxx11test::sptr;
Packit 8f70b4
  using cxx11test::wptr;
Packit 8f70b4
Packit 8f70b4
  sptr sp(new std::string("ASCII string"));
Packit 8f70b4
  wptr wp(sp);
Packit 8f70b4
  sptr sp2(wp);
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  cxx11test::tp tuple("test", 54, 45.53434);
Packit 8f70b4
  double d = std::get<2>(tuple);
Packit 8f70b4
  std::string s;
Packit 8f70b4
  int i;
Packit 8f70b4
  std::tie(s,i,d) = tuple;
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$");
Packit 8f70b4
  std::string testmatch("Test if this string matches");
Packit 8f70b4
  bool match = std::regex_search(testmatch, filename_regex);
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1};
Packit 8f70b4
  cxx11test::int_array::size_type size = array.size();
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test constructor delegation
Packit 8f70b4
  cxx11test::delegate d1;
Packit 8f70b4
  cxx11test::delegate d2();
Packit 8f70b4
  cxx11test::delegate d3(45);
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test override and final
Packit 8f70b4
  cxx11test::overridden o1(55464);
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test nullptr
Packit 8f70b4
  char *c = nullptr;
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Test template brackets
Packit 8f70b4
  std::vector<std::pair<int,char*>> v1;
Packit 8f70b4
}
Packit 8f70b4
{
Packit 8f70b4
  // Unicode literals
Packit 8f70b4
  char const *utf8 = u8"UTF-8 string \u2500";
Packit 8f70b4
  char16_t const *utf16 = u"UTF-8 string \u2500";
Packit 8f70b4
  char32_t const *utf32 = U"UTF-32 string \u2500";
Packit 8f70b4
}
Packit 8f70b4
]])
Packit 8f70b4
Packit 8f70b4
# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
Packit 8f70b4
# -------------------------------------------------------------------
Packit 8f70b4
Packit 8f70b4
# If the C++ compiler is not in ISO C++98 mode by default, try to add
Packit 8f70b4
# an option to output variable CXX to make it so.  This macro tries
Packit 8f70b4
# various options that select ISO C++98 on some system or another.  It
Packit 8f70b4
# considers the compiler to be in ISO C++98 mode if it handles basic
Packit 8f70b4
# features of the std namespace including: string, containers (list,
Packit 8f70b4
# map, set, vector), streams (fstreams, iostreams, stringstreams,
Packit 8f70b4
# iomanip), pair, exceptions and algorithms.
Packit 8f70b4
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([_AC_PROG_CXX_CXX98],
Packit 8f70b4
[_AC_CXX_STD_TRY([cxx98],
Packit 8f70b4
[_AC_CXX_CXX98_TEST_HEADER],
Packit 8f70b4
[_AC_CXX_CXX98_TEST_BODY],
Packit 8f70b4
dnl Try
Packit 8f70b4
dnl GCC		-std=gnu++98 (unused restrictive mode: -std=c++98)
Packit 8f70b4
dnl IBM XL C	-qlanglvl=extended
Packit 8f70b4
dnl HP aC++	-AA
Packit 8f70b4
dnl Intel ICC	-std=gnu++98
Packit 8f70b4
dnl Solaris	N/A (default)
Packit 8f70b4
dnl Tru64	N/A (default, but -std gnu could be used)
Packit 8f70b4
dnl with extended modes being tried first.
Packit 8f70b4
[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl
Packit 8f70b4
])# _AC_PROG_CXX_CXX98
Packit 8f70b4
Packit 8f70b4
# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
Packit 8f70b4
# -------------------------------------------------------------------
Packit 8f70b4
# If the C++ compiler is not in ISO CXX11 mode by default, try to add
Packit 8f70b4
# an option to output variable CXX to make it so.  This macro tries
Packit 8f70b4
# various options that select ISO C++11 on some system or another.  It
Packit 8f70b4
# considers the compiler to be in ISO C++11 mode if it handles all the
Packit 8f70b4
# tests from the C++98 checks, plus the following: Language features
Packit 8f70b4
# (auto, constexpr, decltype, default/deleted constructors, delegate
Packit 8f70b4
# constructors, final, initializer lists, lambda functions, nullptr,
Packit 8f70b4
# override, range-based for loops, template brackets without spaces,
Packit 8f70b4
# unicode literals) and library features (array, memory (shared_ptr,
Packit 8f70b4
# weak_ptr), regex and tuple types).
Packit 8f70b4
AC_DEFUN([_AC_PROG_CXX_CXX11],
Packit 8f70b4
[_AC_CXX_STD_TRY([cxx11],
Packit 8f70b4
[_AC_CXX_CXX11_TEST_HEADER
Packit 8f70b4
_AC_CXX_CXX98_TEST_HEADER],
Packit 8f70b4
[_AC_CXX_CXX11_TEST_BODY
Packit 8f70b4
_AC_CXX_CXX98_TEST_BODY],
Packit 8f70b4
dnl Try
Packit 8f70b4
dnl GCC		-std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants]
Packit 8f70b4
dnl IBM XL C	-qlanglvl=extended0x
Packit 8f70b4
dnl		(pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11)
Packit 8f70b4
dnl HP aC++	-AA
Packit 8f70b4
dnl Intel ICC	-std=c++11 -std=c++0x
Packit 8f70b4
dnl Solaris	N/A (no support)
Packit 8f70b4
dnl Tru64	N/A (no support)
Packit 8f70b4
dnl with extended modes being tried first.
Packit 8f70b4
[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl
Packit 8f70b4
])# _AC_PROG_CXX_CXX11