summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2023-12-14 17:39:15 +0200
committerGitHub <noreply@github.com>2023-12-14 17:39:15 +0200
commitb097f98f550a4e24d3647477df7ce0993e3db70e (patch)
treeed68fb38783362b2c52e60dddd24718ce78ba7f4 /build
parent65c3de12690f78f8c28197e09332beea32fbf7dc (diff)
Remove build/ (#16600)
Diffstat (limited to 'build')
-rw-r--r--build/m4/ax_c__generic.m428
-rw-r--r--build/m4/ax_c_lto.m421
-rw-r--r--build/m4/ax_c_mallinfo.m424
-rw-r--r--build/m4/ax_c_mallopt.m420
-rw-r--r--build/m4/ax_c_statement_expressions.m423
-rw-r--r--build/m4/ax_check_compile_flag.m450
-rw-r--r--build/m4/ax_check_enable_debug.m4122
-rw-r--r--build/m4/ax_compiler_vendor.m4119
-rw-r--r--build/m4/ax_cxx_compile_stdcxx.m41018
-rw-r--r--build/m4/ax_gcc_func_attribute.m4223
-rw-r--r--build/m4/ax_pthread.m4522
-rw-r--r--build/m4/jemalloc.m475
-rw-r--r--build/m4/tcmalloc.m445
-rw-r--r--build/subst.inc22
14 files changed, 0 insertions, 2312 deletions
diff --git a/build/m4/ax_c__generic.m4 b/build/m4/ax_c__generic.m4
deleted file mode 100644
index 0c4dd52c6a..0000000000
--- a/build/m4/ax_c__generic.m4
+++ /dev/null
@@ -1,28 +0,0 @@
-# https://lists.gnu.org/archive/html/autoconf-commit/2012-12/msg00004.html
-# AC_C__GENERIC
-# -------------
-# Define HAVE_C__GENERIC if _Generic works, a la C11.
-AN_IDENTIFIER([_Generic], [AC_C__GENERIC])
-AC_DEFUN([AC_C__GENERIC],
-[AC_CACHE_CHECK([for _Generic], ac_cv_c__Generic,
-[AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [[int
- main (int argc, char **argv)
- {
- int a = _Generic (argc, int: argc = 1);
- int *b = &_Generic (argc, default: argc);
- char ***c = _Generic (argv, int: argc, default: argv ? &argv : 0);
- _Generic (1 ? 0 : b, int: a, default: b) = &argc;
- _Generic (a = 1, default: a) = 3;
- return a + !b + !c;
- }
- ]])],
- [ac_cv_c__Generic=yes],
- [ac_cv_c__Generic=no])])
-if test $ac_cv_c__Generic = yes; then
- AC_DEFINE([HAVE_C__GENERIC], 1,
- [Define to 1 if C11-style _Generic works.])
-fi
-])# AC_C__GENERIC
-
diff --git a/build/m4/ax_c_lto.m4 b/build/m4/ax_c_lto.m4
deleted file mode 100644
index 7e6bc0119f..0000000000
--- a/build/m4/ax_c_lto.m4
+++ /dev/null
@@ -1,21 +0,0 @@
-# AC_C_LTO
-# -------------
-# Define HAVE_LTO if -flto works.
-AN_IDENTIFIER([lto], [AC_C_LTO])
-AC_DEFUN([AC_C_LTO],
-[AC_CACHE_CHECK([if -flto builds executables], ac_cv_c_lto,
-[AC_RUN_IFELSE(
- [AC_LANG_SOURCE(
- [[#include <stdio.h>
- int main(int argc, char **argv) {
- return 0;
- }
- ]])],
- [ac_cv_c_lto=yes],
- [ac_cv_c_lto=no],
- [ac_cv_c_lto=${ac_cv_c_lto_cross_compile}])])
-if test "${ac_cv_c_lto}" = "yes"; then
- AC_DEFINE([HAVE_LTO], 1,
- [Define to 1 if -flto works.])
-fi
-])# AC_C_LTO
diff --git a/build/m4/ax_c_mallinfo.m4 b/build/m4/ax_c_mallinfo.m4
deleted file mode 100644
index af8d0481e5..0000000000
--- a/build/m4/ax_c_mallinfo.m4
+++ /dev/null
@@ -1,24 +0,0 @@
-# AC_C_MALLINFO
-# -------------
-# Define HAVE_C_MALLINFO if mallinfo() works.
-AN_IDENTIFIER([mallinfo], [AC_C_MALLINFO])
-AC_DEFUN([AC_C_MALLINFO],
-[AC_CACHE_CHECK([for mallinfo], ac_cv_c_mallinfo,
-[AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <malloc.h>]],
- [[
- struct mallinfo mi = mallinfo();
- /* make sure that fields exists */
- mi.uordblks = 0;
- mi.hblkhd = 0;
- mi.arena = 0;
- ]]
- )],
- [ac_cv_c_mallinfo=yes],
- [ac_cv_c_mallinfo=no])])
-if test $ac_cv_c_mallinfo = yes; then
- AC_DEFINE([HAVE_C_MALLINFO], 1,
- [Define to 1 if glibc mallinfo exists.])
-fi
-])# AC_C_MALLINFO
diff --git a/build/m4/ax_c_mallopt.m4 b/build/m4/ax_c_mallopt.m4
deleted file mode 100644
index 31c4fdc36a..0000000000
--- a/build/m4/ax_c_mallopt.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-# AC_C_MALLOPT
-# -------------
-# Define HAVE_C_MALLOPT if mallopt() works.
-AN_IDENTIFIER([mallopt], [AC_C_MALLOPT])
-AC_DEFUN([AC_C_MALLOPT],
-[AC_CACHE_CHECK([for mallopt], ac_cv_c_mallopt,
-[AC_LINK_IFELSE(
- [AC_LANG_SOURCE(
- [[#include <malloc.h>
- int main(int argc, char **argv) {
- mallopt(M_ARENA_MAX, 1);
- }
- ]])],
- [ac_cv_c_mallopt=yes],
- [ac_cv_c_mallopt=no])])
-if test $ac_cv_c_mallopt = yes; then
- AC_DEFINE([HAVE_C_MALLOPT], 1,
- [Define to 1 if glibc mallopt exists.])
-fi
-])# AC_C_MALLOPT
diff --git a/build/m4/ax_c_statement_expressions.m4 b/build/m4/ax_c_statement_expressions.m4
deleted file mode 100644
index fb259e7275..0000000000
--- a/build/m4/ax_c_statement_expressions.m4
+++ /dev/null
@@ -1,23 +0,0 @@
-# AC_C_STMT_EXPR
-# -------------
-# Define HAVE_STMT_EXPR if compiler has statement expressions.
-AN_IDENTIFIER([_Generic], [AC_C_STMT_EXPR])
-AC_DEFUN([AC_C_STMT_EXPR],
-[AC_CACHE_CHECK([for statement expressions], ac_cv_c_stmt_expr,
-[AC_COMPILE_IFELSE(
- [AC_LANG_SOURCE(
- [[int
- main (int argc, char **argv)
- {
- int x = ({ int y = 1; y; });
- return x;
- }
- ]])],
- [ac_cv_c_stmt_expr=yes],
- [ac_cv_c_stmt_expr=no])])
-if test $ac_cv_c_stmt_expr = yes; then
- AC_DEFINE([HAVE_STMT_EXPR], 1,
- [Define to 1 if compiler supports statement expressions.])
-fi
-])# AC_C_STMT_EXPR
-
diff --git a/build/m4/ax_check_compile_flag.m4 b/build/m4/ax_check_compile_flag.m4
deleted file mode 100644
index c515602f00..0000000000
--- a/build/m4/ax_check_compile_flag.m4
+++ /dev/null
@@ -1,50 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
-#
-# DESCRIPTION
-#
-# Check whether the given FLAG works with the current language's compiler
-# or gives an error. (Warnings, however, are ignored)
-#
-# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
-# success/failure.
-#
-# If EXTRA-FLAGS is defined, it is added to the current language's default
-# flags (e.g. CFLAGS) when the check is done. The check is thus made with
-# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
-# force the compiler to issue an error when a bad flag is given.
-#
-# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
-#
-# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
-# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
-# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
-#
-# SPDX-License-Identifier: GPL-3.0
-
-#serial 3
-
-AC_DEFUN([AX_CHECK_COMPILE_FLAG],
-[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
-AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
-AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
- ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
- _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
- AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
- [AS_VAR_SET(CACHEVAR,[yes])],
- [AS_VAR_SET(CACHEVAR,[no])])
- _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
-AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
- [m4_default([$2], :)],
- [m4_default([$3], :)])
-AS_VAR_POPDEF([CACHEVAR])dnl
-])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/build/m4/ax_check_enable_debug.m4 b/build/m4/ax_check_enable_debug.m4
deleted file mode 100644
index db5bab2f40..0000000000
--- a/build/m4/ax_check_enable_debug.m4
+++ /dev/null
@@ -1,122 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
-#
-# DESCRIPTION
-#
-# Check for the presence of an --enable-debug option to configure, with
-# the specified default value used when the option is not present. Return
-# the value in the variable $ax_enable_debug.
-#
-# Specifying 'yes' adds '-g -O0' to the compilation flags for all
-# languages. Specifying 'info' adds '-g' to the compilation flags.
-# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
-# the linking flags. Otherwise, nothing is added.
-#
-# Define the variables listed in the second argument if debug is enabled,
-# defaulting to no variables. Defines the variables listed in the third
-# argument if debug is disabled, defaulting to NDEBUG. All lists of
-# variables should be space-separated.
-#
-# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
-# Should be invoked prior to any AC_PROG_* compiler checks.
-#
-# IS-RELEASE can be used to change the default to 'no' when making a
-# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
-# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
-# macro, there is no need to pass this parameter.
-#
-# AX_IS_RELEASE([git-directory])
-# AX_CHECK_ENABLE_DEBUG()
-#
-# LICENSE
-#
-# Copyright (c) 2011 Rhys Ulerich <rhys.ulerich@gmail.com>
-# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
-#
-# SPDX-License-Identifier: FSFAP
-
-#serial 5
-
-AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
- AC_BEFORE([$0],[AC_PROG_CC])dnl
- AC_BEFORE([$0],[AC_PROG_CXX])dnl
- AC_BEFORE([$0],[AC_PROG_F77])dnl
- AC_BEFORE([$0],[AC_PROG_FC])dnl
-
- AC_MSG_CHECKING(whether to enable debugging)
-
- ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
- ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
- [$ax_is_release],
- [$4])))
-
- # If this is a release, override the default.
- AS_IF([test "$ax_enable_debug_is_release" = "yes"],
- [ax_enable_debug_default="no"])
-
- m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
- m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
-
- AC_ARG_ENABLE(debug,
- [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
- [],enable_debug=$ax_enable_debug_default)
-
- # empty mean debug yes
- AS_IF([test "x$enable_debug" = "x"],
- [enable_debug="yes"])
-
- # case of debug
- AS_CASE([$enable_debug],
- [yes],[
- AC_MSG_RESULT(yes)
- CFLAGS="${CFLAGS} -g -O0"
- CXXFLAGS="${CXXFLAGS} -g -O0"
- FFLAGS="${FFLAGS} -g -O0"
- FCFLAGS="${FCFLAGS} -g -O0"
- OBJCFLAGS="${OBJCFLAGS} -g -O0"
- ],
- [info],[
- AC_MSG_RESULT(info)
- CFLAGS="${CFLAGS} -g"
- CXXFLAGS="${CXXFLAGS} -g"
- FFLAGS="${FFLAGS} -g"
- FCFLAGS="${FCFLAGS} -g"
- OBJCFLAGS="${OBJCFLAGS} -g"
- ],
- [profile],[
- AC_MSG_RESULT(profile)
- CFLAGS="${CFLAGS} -g -pg"
- CXXFLAGS="${CXXFLAGS} -g -pg"
- FFLAGS="${FFLAGS} -g -pg"
- FCFLAGS="${FCFLAGS} -g -pg"
- OBJCFLAGS="${OBJCFLAGS} -g -pg"
- LDFLAGS="${LDFLAGS} -pg"
- ],
- [
- AC_MSG_RESULT(no)
- dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
- dnl by setting any unset environment flag variables
- AS_IF([test "x${CFLAGS+set}" != "xset"],
- [CFLAGS=""])
- AS_IF([test "x${CXXFLAGS+set}" != "xset"],
- [CXXFLAGS=""])
- AS_IF([test "x${FFLAGS+set}" != "xset"],
- [FFLAGS=""])
- AS_IF([test "x${FCFLAGS+set}" != "xset"],
- [FCFLAGS=""])
- AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
- [OBJCFLAGS=""])
- ])
-
- dnl Define various variables if debugging is disabled.
- dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
- AS_IF([test "x$enable_debug" = "xyes"],
- [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
- [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
- ax_enable_debug=$enable_debug
-])
diff --git a/build/m4/ax_compiler_vendor.m4 b/build/m4/ax_compiler_vendor.m4
deleted file mode 100644
index 039f99d2bd..0000000000
--- a/build/m4/ax_compiler_vendor.m4
+++ /dev/null
@@ -1,119 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_COMPILER_VENDOR
-#
-# DESCRIPTION
-#
-# Determine the vendor of the C, C++ or Fortran compiler. The vendor is
-# returned in the cache variable $ax_cv_c_compiler_vendor for C,
-# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
-# (modern) Fortran. The value is one of "intel", "ibm", "pathscale",
-# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC
-# Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer
-# Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi",
-# "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if
-# the compiler cannot be determined).
-#
-# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
-# with an appropriate preprocessor-enabled extension. For example:
-#
-# AC_LANG_PUSH([Fortran])
-# AC_PROG_FC
-# AC_FC_PP_SRCEXT([F])
-# AX_COMPILER_VENDOR
-# AC_LANG_POP([Fortran])
-#
-# LICENSE
-#
-# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
-# Copyright (c) 2008 Matteo Frigo
-# Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
-#
-# This program is free software: you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation, either version 3 of the License, or (at your
-# option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-# Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-# As a special exception, the respective Autoconf Macro's copyright owner
-# gives unlimited permission to copy, distribute and modify the configure
-# scripts that are the output of Autoconf when processing the Macro. You
-# need not follow the terms of the GNU General Public License when using
-# or distributing such scripts, even though portions of the text of the
-# Macro appear in them. The GNU General Public License (GPL) does govern
-# all other use of the material that constitutes the Autoconf Macro.
-#
-# This special exception to the GPL applies to versions of the Autoconf
-# Macro released by the Autoconf Archive. When you make and distribute a
-# modified version of the Autoconf Macro, you may extend this special
-# exception to the GPL to apply to your modified version as well.
-
-#serial 32
-
-AC_DEFUN([AX_COMPILER_VENDOR], [dnl
- AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
- dnl If you modify this list of vendors, please add similar support
- dnl to ax_compiler_version.m4 if at all possible.
- dnl
- dnl Note: Do NOT check for GCC first since some other compilers
- dnl define __GNUC__ to remain compatible with it. Compilers that
- dnl are very slow to start (such as Intel) are listed first.
-
- vendors="
- intel: __ICC,__ECC,__INTEL_COMPILER
- ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
- pathscale: __PATHCC__,__PATHSCALE__
- clang: __clang__
- cray: _CRAYC
- fujitsu: __FUJITSU
- sdcc: SDCC,__SDCC
- sx: _SX
- nvhpc: __NVCOMPILER
- portland: __PGI
- gnu: __GNUC__
- sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
- hp: __HP_cc,__HP_aCC
- dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
- borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
- comeau: __COMO__
- kai: __KCC
- lcc: __LCC__
- sgi: __sgi,sgi
- microsoft: _MSC_VER
- metrowerks: __MWERKS__
- watcom: __WATCOMC__
- tcc: __TINYC__
- unknown: UNKNOWN
- "
- for ventest in $vendors; do
- case $ventest in
- *:)
- vendor=$ventest
- continue
- ;;
- *)
- vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
- ;;
- esac
-
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
-#if !($vencpp)
- thisisanerror;
-#endif
- ]])], [break])
- done
-
- ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
- ])
-])dnl
diff --git a/build/m4/ax_cxx_compile_stdcxx.m4 b/build/m4/ax_cxx_compile_stdcxx.m4
deleted file mode 100644
index 8edf5152ec..0000000000
--- a/build/m4/ax_cxx_compile_stdcxx.m4
+++ /dev/null
@@ -1,1018 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the specified
-# version of the C++ standard. If necessary, add switches to CXX and
-# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
-# the respective C++ standard version.
-#
-# The second argument, if specified, indicates whether you insist on an
-# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
-# -std=c++11). If neither is specified, you get whatever works, with
-# preference for no added switch, and then for an extended mode.
-#
-# The third argument, if specified 'mandatory' or if left unspecified,
-# indicates that baseline support for the specified C++ standard is
-# required and that the macro should error out if no mode with that
-# support is found. If specified 'optional', then configuration proceeds
-# regardless, after defining HAVE_CXX${VERSION} if and only if a
-# supporting mode is found.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
-# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
-# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
-# Copyright (c) 2015 Paul Norman <penorman@mac.com>
-# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
-# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
-# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
-# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
-# Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 18
-
-dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
-dnl (serial version number 13).
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
- m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
- [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
- [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
- [$1], [20], [ax_cxx_compile_alternatives="20"],
- [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
- m4_if([$2], [], [],
- [$2], [ext], [],
- [$2], [noext], [],
- [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
- m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
- [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
- [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
- [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
- AC_LANG_PUSH([C++])dnl
- ac_success=no
-
- m4_if([$2], [], [dnl
- AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
- ax_cv_cxx_compile_cxx$1,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [ax_cv_cxx_compile_cxx$1=yes],
- [ax_cv_cxx_compile_cxx$1=no])])
- if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
- ac_success=yes
- fi])
-
- m4_if([$2], [noext], [], [dnl
- if test x$ac_success = xno; then
- for alternative in ${ax_cxx_compile_alternatives}; do
- switch="-std=gnu++${alternative}"
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
- $cachevar,
- [ac_save_CXX="$CXX"
- CXX="$CXX $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXX="$ac_save_CXX"])
- if eval test x\$$cachevar = xyes; then
- CXX="$CXX $switch"
- if test -n "$CXXCPP" ; then
- CXXCPP="$CXXCPP $switch"
- fi
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$2], [ext], [], [dnl
- if test x$ac_success = xno; then
- dnl HP's aCC needs +std=c++11 according to:
- dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
- dnl Cray's crayCC needs "-h std=c++11"
- dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
- for alternative in ${ax_cxx_compile_alternatives}; do
- for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
- if test x"$switch" = xMSVC; then
- dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
- dnl with -std=c++17. We suffix the cache variable name with _MSVC to
- dnl avoid this.
- switch=-std:c++${alternative}
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
- else
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
- fi
- AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
- $cachevar,
- [ac_save_CXX="$CXX"
- CXX="$CXX $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXX="$ac_save_CXX"])
- if eval test x\$$cachevar = xyes; then
- CXX="$CXX $switch"
- if test -n "$CXXCPP" ; then
- CXXCPP="$CXXCPP $switch"
- fi
- ac_success=yes
- break
- fi
- done
- if test x$ac_success = xyes; then
- break
- fi
- done
- fi])
- AC_LANG_POP([C++])
- if test x$ax_cxx_compile_cxx$1_required = xtrue; then
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
- fi
- fi
- if test x$ac_success = xno; then
- HAVE_CXX$1=0
- AC_MSG_NOTICE([No compiler with C++$1 support was found])
- else
- HAVE_CXX$1=1
- AC_DEFINE(HAVE_CXX$1,1,
- [define if the compiler supports basic C++$1 syntax])
- fi
- AC_SUBST(HAVE_CXX$1)
-])
-
-
-dnl Test body for checking C++11 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
-)
-
-dnl Test body for checking C++14 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
-)
-
-dnl Test body for checking C++17 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
-)
-
-dnl Test body for checking C++20 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
-)
-
-
-dnl Tests for new features in C++11
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
-
-// If the compiler admits that it is not ready for C++11, why torture it?
-// Hopefully, this will speed up the test.
-
-#ifndef __cplusplus
-
-#error "This is not a C++ compiler"
-
-// MSVC always sets __cplusplus to 199711L in older versions; newer versions
-// only set it correctly if /Zc:__cplusplus is specified as well as a
-// /std:c++NN switch:
-// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
-#elif __cplusplus < 201103L && !defined _MSC_VER
-
-#error "This is not a C++11 compiler"
-
-#else
-
-namespace cxx11
-{
-
- namespace test_static_assert
- {
-
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- }
-
- namespace test_final_override
- {
-
- struct Base
- {
- virtual ~Base() {}
- virtual void f() {}
- };
-
- struct Derived : public Base
- {
- virtual ~Derived() override {}
- virtual void f() override {}
- };
-
- }
-
- namespace test_double_right_angle_brackets
- {
-
- template < typename T >
- struct check {};
-
- typedef check<void> single_type;
- typedef check<check<void>> double_type;
- typedef check<check<check<void>>> triple_type;
- typedef check<check<check<check<void>>>> quadruple_type;
-
- }
-
- namespace test_decltype
- {
-
- int
- f()
- {
- int a = 1;
- decltype(a) b = 2;
- return a + b;
- }
-
- }
-
- namespace test_type_deduction
- {
-
- template < typename T1, typename T2 >
- struct is_same
- {
- static const bool value = false;
- };
-
- template < typename T >
- struct is_same<T, T>
- {
- static const bool value = true;
- };
-
- template < typename T1, typename T2 >
- auto
- add(T1 a1, T2 a2) -> decltype(a1 + a2)
- {
- return a1 + a2;
- }
-
- int
- test(const int c, volatile int v)
- {
- static_assert(is_same<int, decltype(0)>::value == true, "");
- static_assert(is_same<int, decltype(c)>::value == false, "");
- static_assert(is_same<int, decltype(v)>::value == false, "");
- auto ac = c;
- auto av = v;
- auto sumi = ac + av + 'x';
- auto sumf = ac + av + 1.0;
- static_assert(is_same<int, decltype(ac)>::value == true, "");
- static_assert(is_same<int, decltype(av)>::value == true, "");
- static_assert(is_same<int, decltype(sumi)>::value == true, "");
- static_assert(is_same<int, decltype(sumf)>::value == false, "");
- static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
- return (sumf > 0.0) ? sumi : add(c, v);
- }
-
- }
-
- namespace test_noexcept
- {
-
- int f() { return 0; }
- int g() noexcept { return 0; }
-
- static_assert(noexcept(f()) == false, "");
- static_assert(noexcept(g()) == true, "");
-
- }
-
- namespace test_constexpr
- {
-
- template < typename CharT >
- unsigned long constexpr
- strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
- {
- return *s ? strlen_c_r(s + 1, acc + 1) : acc;
- }
-
- template < typename CharT >
- unsigned long constexpr
- strlen_c(const CharT *const s) noexcept
- {
- return strlen_c_r(s, 0UL);
- }
-
- static_assert(strlen_c("") == 0UL, "");
- static_assert(strlen_c("1") == 1UL, "");
- static_assert(strlen_c("example") == 7UL, "");
- static_assert(strlen_c("another\0example") == 7UL, "");
-
- }
-
- namespace test_rvalue_references
- {
-
- template < int N >
- struct answer
- {
- static constexpr int value = N;
- };
-
- answer<1> f(int&) { return answer<1>(); }
- answer<2> f(const int&) { return answer<2>(); }
- answer<3> f(int&&) { return answer<3>(); }
-
- void
- test()
- {
- int i = 0;
- const int c = 0;
- static_assert(decltype(f(i))::value == 1, "");
- static_assert(decltype(f(c))::value == 2, "");
- static_assert(decltype(f(0))::value == 3, "");
- }
-
- }
-
- namespace test_uniform_initialization
- {
-
- struct test
- {
- static const int zero {};
- static const int one {1};
- };
-
- static_assert(test::zero == 0, "");
- static_assert(test::one == 1, "");
-
- }
-
- namespace test_lambdas
- {
-
- void
- test1()
- {
- auto lambda1 = [](){};
- auto lambda2 = lambda1;
- lambda1();
- lambda2();
- }
-
- int
- test2()
- {
- auto a = [](int i, int j){ return i + j; }(1, 2);
- auto b = []() -> int { return '0'; }();
- auto c = [=](){ return a + b; }();
- auto d = [&](){ return c; }();
- auto e = [a, &b](int x) mutable {
- const auto identity = [](int y){ return y; };
- for (auto i = 0; i < a; ++i)
- a += b--;
- return x + identity(a + b);
- }(0);
- return a + b + c + d + e;
- }
-
- int
- test3()
- {
- const auto nullary = [](){ return 0; };
- const auto unary = [](int x){ return x; };
- using nullary_t = decltype(nullary);
- using unary_t = decltype(unary);
- const auto higher1st = [](nullary_t f){ return f(); };
- const auto higher2nd = [unary](nullary_t f1){
- return [unary, f1](unary_t f2){ return f2(unary(f1())); };
- };
- return higher1st(nullary) + higher2nd(nullary)(unary);
- }
-
- }
-
- namespace test_variadic_templates
- {
-
- template <int...>
- struct sum;
-
- template <int N0, int... N1toN>
- struct sum<N0, N1toN...>
- {
- static constexpr auto value = N0 + sum<N1toN...>::value;
- };
-
- template <>
- struct sum<>
- {
- static constexpr auto value = 0;
- };
-
- static_assert(sum<>::value == 0, "");
- static_assert(sum<1>::value == 1, "");
- static_assert(sum<23>::value == 23, "");
- static_assert(sum<1, 2>::value == 3, "");
- static_assert(sum<5, 5, 11>::value == 21, "");
- static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
-
- }
-
- // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
- // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
- // because of this.
- namespace test_template_alias_sfinae
- {
-
- struct foo {};
-
- template<typename T>
- using member = typename T::member_type;
-
- template<typename T>