Blame m4/std-gnu11.m4

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