@cryptotaxi247 / netdata-1 / commits / b097f98f5

Remove build/ (#16600)

vkalintiris committed Dec 14, 2023 at 17:39 UTC b097f98f550a4e24d3647477df7ce0993e3db70e
14 files changed -2312
build/m4/ax_c__generic.m4 deleted
-28
@@ -1,28 +0,0 @@
1 -# https://lists.gnu.org/archive/html/autoconf-commit/2012-12/msg00004.html
2 -# AC_C__GENERIC
3 -# -------------
4 -# Define HAVE_C__GENERIC if _Generic works, a la C11.
5 -AN_IDENTIFIER([_Generic], [AC_C__GENERIC])
6 -AC_DEFUN([AC_C__GENERIC],
7 -[AC_CACHE_CHECK([for _Generic], ac_cv_c__Generic,
8 -[AC_COMPILE_IFELSE(
9 - [AC_LANG_SOURCE(
10 - [[int
11 - main (int argc, char **argv)
12 - {
13 - int a = _Generic (argc, int: argc = 1);
14 - int *b = &_Generic (argc, default: argc);
15 - char ***c = _Generic (argv, int: argc, default: argv ? &argv : 0);
16 - _Generic (1 ? 0 : b, int: a, default: b) = &argc;
17 - _Generic (a = 1, default: a) = 3;
18 - return a + !b + !c;
19 - }
20 - ]])],
21 - [ac_cv_c__Generic=yes],
22 - [ac_cv_c__Generic=no])])
23 -if test $ac_cv_c__Generic = yes; then
24 - AC_DEFINE([HAVE_C__GENERIC], 1,
25 - [Define to 1 if C11-style _Generic works.])
26 -fi
27 -])# AC_C__GENERIC
28 -
build/m4/ax_c_lto.m4 deleted
-21
@@ -1,21 +0,0 @@
1 -# AC_C_LTO
2 -# -------------
3 -# Define HAVE_LTO if -flto works.
4 -AN_IDENTIFIER([lto], [AC_C_LTO])
5 -AC_DEFUN([AC_C_LTO],
6 -[AC_CACHE_CHECK([if -flto builds executables], ac_cv_c_lto,
7 -[AC_RUN_IFELSE(
8 - [AC_LANG_SOURCE(
9 - [[#include <stdio.h>
10 - int main(int argc, char **argv) {
11 - return 0;
12 - }
13 - ]])],
14 - [ac_cv_c_lto=yes],
15 - [ac_cv_c_lto=no],
16 - [ac_cv_c_lto=${ac_cv_c_lto_cross_compile}])])
17 -if test "${ac_cv_c_lto}" = "yes"; then
18 - AC_DEFINE([HAVE_LTO], 1,
19 - [Define to 1 if -flto works.])
20 -fi
21 -])# AC_C_LTO
build/m4/ax_c_mallinfo.m4 deleted
-24
@@ -1,24 +0,0 @@
1 -# AC_C_MALLINFO
2 -# -------------
3 -# Define HAVE_C_MALLINFO if mallinfo() works.
4 -AN_IDENTIFIER([mallinfo], [AC_C_MALLINFO])
5 -AC_DEFUN([AC_C_MALLINFO],
6 -[AC_CACHE_CHECK([for mallinfo], ac_cv_c_mallinfo,
7 -[AC_LINK_IFELSE(
8 - [AC_LANG_PROGRAM(
9 - [[#include <malloc.h>]],
10 - [[
11 - struct mallinfo mi = mallinfo();
12 - /* make sure that fields exists */
13 - mi.uordblks = 0;
14 - mi.hblkhd = 0;
15 - mi.arena = 0;
16 - ]]
17 - )],
18 - [ac_cv_c_mallinfo=yes],
19 - [ac_cv_c_mallinfo=no])])
20 -if test $ac_cv_c_mallinfo = yes; then
21 - AC_DEFINE([HAVE_C_MALLINFO], 1,
22 - [Define to 1 if glibc mallinfo exists.])
23 -fi
24 -])# AC_C_MALLINFO
build/m4/ax_c_mallopt.m4 deleted
-20
@@ -1,20 +0,0 @@
1 -# AC_C_MALLOPT
2 -# -------------
3 -# Define HAVE_C_MALLOPT if mallopt() works.
4 -AN_IDENTIFIER([mallopt], [AC_C_MALLOPT])
5 -AC_DEFUN([AC_C_MALLOPT],
6 -[AC_CACHE_CHECK([for mallopt], ac_cv_c_mallopt,
7 -[AC_LINK_IFELSE(
8 - [AC_LANG_SOURCE(
9 - [[#include <malloc.h>
10 - int main(int argc, char **argv) {
11 - mallopt(M_ARENA_MAX, 1);
12 - }
13 - ]])],
14 - [ac_cv_c_mallopt=yes],
15 - [ac_cv_c_mallopt=no])])
16 -if test $ac_cv_c_mallopt = yes; then
17 - AC_DEFINE([HAVE_C_MALLOPT], 1,
18 - [Define to 1 if glibc mallopt exists.])
19 -fi
20 -])# AC_C_MALLOPT
build/m4/ax_c_statement_expressions.m4 deleted
-23
@@ -1,23 +0,0 @@
1 -# AC_C_STMT_EXPR
2 -# -------------
3 -# Define HAVE_STMT_EXPR if compiler has statement expressions.
4 -AN_IDENTIFIER([_Generic], [AC_C_STMT_EXPR])
5 -AC_DEFUN([AC_C_STMT_EXPR],
6 -[AC_CACHE_CHECK([for statement expressions], ac_cv_c_stmt_expr,
7 -[AC_COMPILE_IFELSE(
8 - [AC_LANG_SOURCE(
9 - [[int
10 - main (int argc, char **argv)
11 - {
12 - int x = ({ int y = 1; y; });
13 - return x;
14 - }
15 - ]])],
16 - [ac_cv_c_stmt_expr=yes],
17 - [ac_cv_c_stmt_expr=no])])
18 -if test $ac_cv_c_stmt_expr = yes; then
19 - AC_DEFINE([HAVE_STMT_EXPR], 1,
20 - [Define to 1 if compiler supports statement expressions.])
21 -fi
22 -])# AC_C_STMT_EXPR
23 -
build/m4/ax_check_compile_flag.m4 deleted
-50
@@ -1,50 +0,0 @@
1 -# ===========================================================================
2 -# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
8 -#
9 -# DESCRIPTION
10 -#
11 -# Check whether the given FLAG works with the current language's compiler
12 -# or gives an error. (Warnings, however, are ignored)
13 -#
14 -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15 -# success/failure.
16 -#
17 -# If EXTRA-FLAGS is defined, it is added to the current language's default
18 -# flags (e.g. CFLAGS) when the check is done. The check is thus made with
19 -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
20 -# force the compiler to issue an error when a bad flag is given.
21 -#
22 -# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
23 -#
24 -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
25 -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
26 -#
27 -# LICENSE
28 -#
29 -# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
30 -# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
31 -#
32 -# SPDX-License-Identifier: GPL-3.0
33 -
34 -#serial 3
35 -
36 -AC_DEFUN([AX_CHECK_COMPILE_FLAG],
37 -[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
38 -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
39 -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
40 - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
41 - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
42 - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
43 - [AS_VAR_SET(CACHEVAR,[yes])],
44 - [AS_VAR_SET(CACHEVAR,[no])])
45 - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
46 -AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
47 - [m4_default([$2], :)],
48 - [m4_default([$3], :)])
49 -AS_VAR_POPDEF([CACHEVAR])dnl
50 -])dnl AX_CHECK_COMPILE_FLAGS
build/m4/ax_check_enable_debug.m4 deleted
-122
@@ -1,122 +0,0 @@
1 -# ===========================================================================
2 -# http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
8 -#
9 -# DESCRIPTION
10 -#
11 -# Check for the presence of an --enable-debug option to configure, with
12 -# the specified default value used when the option is not present. Return
13 -# the value in the variable $ax_enable_debug.
14 -#
15 -# Specifying 'yes' adds '-g -O0' to the compilation flags for all
16 -# languages. Specifying 'info' adds '-g' to the compilation flags.
17 -# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
18 -# the linking flags. Otherwise, nothing is added.
19 -#
20 -# Define the variables listed in the second argument if debug is enabled,
21 -# defaulting to no variables. Defines the variables listed in the third
22 -# argument if debug is disabled, defaulting to NDEBUG. All lists of
23 -# variables should be space-separated.
24 -#
25 -# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
26 -# Should be invoked prior to any AC_PROG_* compiler checks.
27 -#
28 -# IS-RELEASE can be used to change the default to 'no' when making a
29 -# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
30 -# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
31 -# macro, there is no need to pass this parameter.
32 -#
33 -# AX_IS_RELEASE([git-directory])
34 -# AX_CHECK_ENABLE_DEBUG()
35 -#
36 -# LICENSE
37 -#
38 -# Copyright (c) 2011 Rhys Ulerich <rhys.ulerich@gmail.com>
39 -# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
40 -#
41 -# SPDX-License-Identifier: FSFAP
42 -
43 -#serial 5
44 -
45 -AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
46 - AC_BEFORE([$0],[AC_PROG_CC])dnl
47 - AC_BEFORE([$0],[AC_PROG_CXX])dnl
48 - AC_BEFORE([$0],[AC_PROG_F77])dnl
49 - AC_BEFORE([$0],[AC_PROG_FC])dnl
50 -
51 - AC_MSG_CHECKING(whether to enable debugging)
52 -
53 - ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
54 - ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
55 - [$ax_is_release],
56 - [$4])))
57 -
58 - # If this is a release, override the default.
59 - AS_IF([test "$ax_enable_debug_is_release" = "yes"],
60 - [ax_enable_debug_default="no"])
61 -
62 - m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
63 - m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
64 -
65 - AC_ARG_ENABLE(debug,
66 - [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
67 - [],enable_debug=$ax_enable_debug_default)
68 -
69 - # empty mean debug yes
70 - AS_IF([test "x$enable_debug" = "x"],
71 - [enable_debug="yes"])
72 -
73 - # case of debug
74 - AS_CASE([$enable_debug],
75 - [yes],[
76 - AC_MSG_RESULT(yes)
77 - CFLAGS="${CFLAGS} -g -O0"
78 - CXXFLAGS="${CXXFLAGS} -g -O0"
79 - FFLAGS="${FFLAGS} -g -O0"
80 - FCFLAGS="${FCFLAGS} -g -O0"
81 - OBJCFLAGS="${OBJCFLAGS} -g -O0"
82 - ],
83 - [info],[
84 - AC_MSG_RESULT(info)
85 - CFLAGS="${CFLAGS} -g"
86 - CXXFLAGS="${CXXFLAGS} -g"
87 - FFLAGS="${FFLAGS} -g"
88 - FCFLAGS="${FCFLAGS} -g"
89 - OBJCFLAGS="${OBJCFLAGS} -g"
90 - ],
91 - [profile],[
92 - AC_MSG_RESULT(profile)
93 - CFLAGS="${CFLAGS} -g -pg"
94 - CXXFLAGS="${CXXFLAGS} -g -pg"
95 - FFLAGS="${FFLAGS} -g -pg"
96 - FCFLAGS="${FCFLAGS} -g -pg"
97 - OBJCFLAGS="${OBJCFLAGS} -g -pg"
98 - LDFLAGS="${LDFLAGS} -pg"
99 - ],
100 - [
101 - AC_MSG_RESULT(no)
102 - dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
103 - dnl by setting any unset environment flag variables
104 - AS_IF([test "x${CFLAGS+set}" != "xset"],
105 - [CFLAGS=""])
106 - AS_IF([test "x${CXXFLAGS+set}" != "xset"],
107 - [CXXFLAGS=""])
108 - AS_IF([test "x${FFLAGS+set}" != "xset"],
109 - [FFLAGS=""])
110 - AS_IF([test "x${FCFLAGS+set}" != "xset"],
111 - [FCFLAGS=""])
112 - AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
113 - [OBJCFLAGS=""])
114 - ])
115 -
116 - dnl Define various variables if debugging is disabled.
117 - dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
118 - AS_IF([test "x$enable_debug" = "xyes"],
119 - [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
120 - [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
121 - ax_enable_debug=$enable_debug
122 -])
build/m4/ax_compiler_vendor.m4 deleted
-119
@@ -1,119 +0,0 @@
1 -# ===========================================================================
2 -# https://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_COMPILER_VENDOR
8 -#
9 -# DESCRIPTION
10 -#
11 -# Determine the vendor of the C, C++ or Fortran compiler. The vendor is
12 -# returned in the cache variable $ax_cv_c_compiler_vendor for C,
13 -# $ax_cv_cxx_compiler_vendor for C++ or $ax_cv_fc_compiler_vendor for
14 -# (modern) Fortran. The value is one of "intel", "ibm", "pathscale",
15 -# "clang" (LLVM), "cray", "fujitsu", "sdcc", "sx", "nvhpc" (NVIDIA HPC
16 -# Compiler), "portland" (PGI), "gnu" (GCC), "sun" (Oracle Developer
17 -# Studio), "hp", "dec", "borland", "comeau", "kai", "lcc", "sgi",
18 -# "microsoft", "metrowerks", "watcom", "tcc" (Tiny CC) or "unknown" (if
19 -# the compiler cannot be determined).
20 -#
21 -# To check for a Fortran compiler, you must first call AC_FC_PP_SRCEXT
22 -# with an appropriate preprocessor-enabled extension. For example:
23 -#
24 -# AC_LANG_PUSH([Fortran])
25 -# AC_PROG_FC
26 -# AC_FC_PP_SRCEXT([F])
27 -# AX_COMPILER_VENDOR
28 -# AC_LANG_POP([Fortran])
29 -#
30 -# LICENSE
31 -#
32 -# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
33 -# Copyright (c) 2008 Matteo Frigo
34 -# Copyright (c) 2018-19 John Zaitseff <J.Zaitseff@zap.org.au>
35 -#
36 -# This program is free software: you can redistribute it and/or modify it
37 -# under the terms of the GNU General Public License as published by the
38 -# Free Software Foundation, either version 3 of the License, or (at your
39 -# option) any later version.
40 -#
41 -# This program is distributed in the hope that it will be useful, but
42 -# WITHOUT ANY WARRANTY; without even the implied warranty of
43 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
44 -# Public License for more details.
45 -#
46 -# You should have received a copy of the GNU General Public License along
47 -# with this program. If not, see <https://www.gnu.org/licenses/>.
48 -#
49 -# As a special exception, the respective Autoconf Macro's copyright owner
50 -# gives unlimited permission to copy, distribute and modify the configure
51 -# scripts that are the output of Autoconf when processing the Macro. You
52 -# need not follow the terms of the GNU General Public License when using
53 -# or distributing such scripts, even though portions of the text of the
54 -# Macro appear in them. The GNU General Public License (GPL) does govern
55 -# all other use of the material that constitutes the Autoconf Macro.
56 -#
57 -# This special exception to the GPL applies to versions of the Autoconf
58 -# Macro released by the Autoconf Archive. When you make and distribute a
59 -# modified version of the Autoconf Macro, you may extend this special
60 -# exception to the GPL to apply to your modified version as well.
61 -
62 -#serial 32
63 -
64 -AC_DEFUN([AX_COMPILER_VENDOR], [dnl
65 - AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, [dnl
66 - dnl If you modify this list of vendors, please add similar support
67 - dnl to ax_compiler_version.m4 if at all possible.
68 - dnl
69 - dnl Note: Do NOT check for GCC first since some other compilers
70 - dnl define __GNUC__ to remain compatible with it. Compilers that
71 - dnl are very slow to start (such as Intel) are listed first.
72 -
73 - vendors="
74 - intel: __ICC,__ECC,__INTEL_COMPILER
75 - ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__,__ibmxl__
76 - pathscale: __PATHCC__,__PATHSCALE__
77 - clang: __clang__
78 - cray: _CRAYC
79 - fujitsu: __FUJITSU
80 - sdcc: SDCC,__SDCC
81 - sx: _SX
82 - nvhpc: __NVCOMPILER
83 - portland: __PGI
84 - gnu: __GNUC__
85 - sun: __SUNPRO_C,__SUNPRO_CC,__SUNPRO_F90,__SUNPRO_F95
86 - hp: __HP_cc,__HP_aCC
87 - dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER
88 - borland: __BORLANDC__,__CODEGEARC__,__TURBOC__
89 - comeau: __COMO__
90 - kai: __KCC
91 - lcc: __LCC__
92 - sgi: __sgi,sgi
93 - microsoft: _MSC_VER
94 - metrowerks: __MWERKS__
95 - watcom: __WATCOMC__
96 - tcc: __TINYC__
97 - unknown: UNKNOWN
98 - "
99 - for ventest in $vendors; do
100 - case $ventest in
101 - *:)
102 - vendor=$ventest
103 - continue
104 - ;;
105 - *)
106 - vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")"
107 - ;;
108 - esac
109 -
110 - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
111 -#if !($vencpp)
112 - thisisanerror;
113 -#endif
114 - ]])], [break])
115 - done
116 -
117 - ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1`
118 - ])
119 -])dnl
build/m4/ax_cxx_compile_stdcxx.m4 deleted
-1018
@@ -1,1018 +0,0 @@
1 -# ===========================================================================
2 -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
8 -#
9 -# DESCRIPTION
10 -#
11 -# Check for baseline language coverage in the compiler for the specified
12 -# version of the C++ standard. If necessary, add switches to CXX and
13 -# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
14 -# the respective C++ standard version.
15 -#
16 -# The second argument, if specified, indicates whether you insist on an
17 -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
18 -# -std=c++11). If neither is specified, you get whatever works, with
19 -# preference for no added switch, and then for an extended mode.
20 -#
21 -# The third argument, if specified 'mandatory' or if left unspecified,
22 -# indicates that baseline support for the specified C++ standard is
23 -# required and that the macro should error out if no mode with that
24 -# support is found. If specified 'optional', then configuration proceeds
25 -# regardless, after defining HAVE_CXX${VERSION} if and only if a
26 -# supporting mode is found.
27 -#
28 -# LICENSE
29 -#
30 -# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
31 -# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
32 -# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
33 -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
34 -# Copyright (c) 2015 Paul Norman <penorman@mac.com>
35 -# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
36 -# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
37 -# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
38 -# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
39 -# Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
40 -#
41 -# Copying and distribution of this file, with or without modification, are
42 -# permitted in any medium without royalty provided the copyright notice
43 -# and this notice are preserved. This file is offered as-is, without any
44 -# warranty.
45 -
46 -#serial 18
47 -
48 -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
49 -dnl (serial version number 13).
50 -
51 -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
52 - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
53 - [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
54 - [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
55 - [$1], [20], [ax_cxx_compile_alternatives="20"],
56 - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
57 - m4_if([$2], [], [],
58 - [$2], [ext], [],
59 - [$2], [noext], [],
60 - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
61 - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
62 - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
63 - [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
64 - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
65 - AC_LANG_PUSH([C++])dnl
66 - ac_success=no
67 -
68 - m4_if([$2], [], [dnl
69 - AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
70 - ax_cv_cxx_compile_cxx$1,
71 - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
72 - [ax_cv_cxx_compile_cxx$1=yes],
73 - [ax_cv_cxx_compile_cxx$1=no])])
74 - if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
75 - ac_success=yes
76 - fi])
77 -
78 - m4_if([$2], [noext], [], [dnl
79 - if test x$ac_success = xno; then
80 - for alternative in ${ax_cxx_compile_alternatives}; do
81 - switch="-std=gnu++${alternative}"
82 - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
83 - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
84 - $cachevar,
85 - [ac_save_CXX="$CXX"
86 - CXX="$CXX $switch"
87 - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
88 - [eval $cachevar=yes],
89 - [eval $cachevar=no])
90 - CXX="$ac_save_CXX"])
91 - if eval test x\$$cachevar = xyes; then
92 - CXX="$CXX $switch"
93 - if test -n "$CXXCPP" ; then
94 - CXXCPP="$CXXCPP $switch"
95 - fi
96 - ac_success=yes
97 - break
98 - fi
99 - done
100 - fi])
101 -
102 - m4_if([$2], [ext], [], [dnl
103 - if test x$ac_success = xno; then
104 - dnl HP's aCC needs +std=c++11 according to:
105 - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
106 - dnl Cray's crayCC needs "-h std=c++11"
107 - dnl MSVC needs -std:c++NN for C++17 and later (default is C++14)
108 - for alternative in ${ax_cxx_compile_alternatives}; do
109 - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}" MSVC; do
110 - if test x"$switch" = xMSVC; then
111 - dnl AS_TR_SH maps both `:` and `=` to `_` so -std:c++17 would collide
112 - dnl with -std=c++17. We suffix the cache variable name with _MSVC to
113 - dnl avoid this.
114 - switch=-std:c++${alternative}
115 - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_${switch}_MSVC])
116 - else
117 - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
118 - fi
119 - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
120 - $cachevar,
121 - [ac_save_CXX="$CXX"
122 - CXX="$CXX $switch"
123 - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
124 - [eval $cachevar=yes],
125 - [eval $cachevar=no])
126 - CXX="$ac_save_CXX"])
127 - if eval test x\$$cachevar = xyes; then
128 - CXX="$CXX $switch"
129 - if test -n "$CXXCPP" ; then
130 - CXXCPP="$CXXCPP $switch"
131 - fi
132 - ac_success=yes
133 - break
134 - fi
135 - done
136 - if test x$ac_success = xyes; then
137 - break
138 - fi
139 - done
140 - fi])
141 - AC_LANG_POP([C++])
142 - if test x$ax_cxx_compile_cxx$1_required = xtrue; then
143 - if test x$ac_success = xno; then
144 - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
145 - fi
146 - fi
147 - if test x$ac_success = xno; then
148 - HAVE_CXX$1=0
149 - AC_MSG_NOTICE([No compiler with C++$1 support was found])
150 - else
151 - HAVE_CXX$1=1
152 - AC_DEFINE(HAVE_CXX$1,1,
153 - [define if the compiler supports basic C++$1 syntax])
154 - fi
155 - AC_SUBST(HAVE_CXX$1)
156 -])
157 -
158 -
159 -dnl Test body for checking C++11 support
160 -
161 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
162 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
163 -)
164 -
165 -dnl Test body for checking C++14 support
166 -
167 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
168 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
169 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
170 -)
171 -
172 -dnl Test body for checking C++17 support
173 -
174 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
175 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
176 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
177 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
178 -)
179 -
180 -dnl Test body for checking C++20 support
181 -
182 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
183 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
184 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
185 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
186 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
187 -)
188 -
189 -
190 -dnl Tests for new features in C++11
191 -
192 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
193 -
194 -// If the compiler admits that it is not ready for C++11, why torture it?
195 -// Hopefully, this will speed up the test.
196 -
197 -#ifndef __cplusplus
198 -
199 -#error "This is not a C++ compiler"
200 -
201 -// MSVC always sets __cplusplus to 199711L in older versions; newer versions
202 -// only set it correctly if /Zc:__cplusplus is specified as well as a
203 -// /std:c++NN switch:
204 -// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
205 -#elif __cplusplus < 201103L && !defined _MSC_VER
206 -
207 -#error "This is not a C++11 compiler"
208 -
209 -#else
210 -
211 -namespace cxx11
212 -{
213 -
214 - namespace test_static_assert
215 - {
216 -
217 - template <typename T>
218 - struct check
219 - {
220 - static_assert(sizeof(int) <= sizeof(T), "not big enough");
221 - };
222 -
223 - }
224 -
225 - namespace test_final_override
226 - {
227 -
228 - struct Base
229 - {
230 - virtual ~Base() {}
231 - virtual void f() {}
232 - };
233 -
234 - struct Derived : public Base
235 - {
236 - virtual ~Derived() override {}
237 - virtual void f() override {}
238 - };
239 -
240 - }
241 -
242 - namespace test_double_right_angle_brackets
243 - {
244 -
245 - template < typename T >
246 - struct check {};
247 -
248 - typedef check<void> single_type;
249 - typedef check<check<void>> double_type;
250 - typedef check<check<check<void>>> triple_type;
251 - typedef check<check<check<check<void>>>> quadruple_type;
252 -
253 - }
254 -
255 - namespace test_decltype
256 - {
257 -
258 - int
259 - f()
260 - {
261 - int a = 1;
262 - decltype(a) b = 2;
263 - return a + b;
264 - }
265 -
266 - }
267 -
268 - namespace test_type_deduction
269 - {
270 -
271 - template < typename T1, typename T2 >
272 - struct is_same
273 - {
274 - static const bool value = false;
275 - };
276 -
277 - template < typename T >
278 - struct is_same<T, T>
279 - {
280 - static const bool value = true;
281 - };
282 -
283 - template < typename T1, typename T2 >
284 - auto
285 - add(T1 a1, T2 a2) -> decltype(a1 + a2)
286 - {
287 - return a1 + a2;
288 - }
289 -
290 - int
291 - test(const int c, volatile int v)
292 - {
293 - static_assert(is_same<int, decltype(0)>::value == true, "");
294 - static_assert(is_same<int, decltype(c)>::value == false, "");
295 - static_assert(is_same<int, decltype(v)>::value == false, "");
296 - auto ac = c;
297 - auto av = v;
298 - auto sumi = ac + av + 'x';
299 - auto sumf = ac + av + 1.0;
300 - static_assert(is_same<int, decltype(ac)>::value == true, "");
301 - static_assert(is_same<int, decltype(av)>::value == true, "");
302 - static_assert(is_same<int, decltype(sumi)>::value == true, "");
303 - static_assert(is_same<int, decltype(sumf)>::value == false, "");
304 - static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
305 - return (sumf > 0.0) ? sumi : add(c, v);
306 - }
307 -
308 - }
309 -
310 - namespace test_noexcept
311 - {
312 -
313 - int f() { return 0; }
314 - int g() noexcept { return 0; }
315 -
316 - static_assert(noexcept(f()) == false, "");
317 - static_assert(noexcept(g()) == true, "");
318 -
319 - }
320 -
321 - namespace test_constexpr
322 - {
323 -
324 - template < typename CharT >
325 - unsigned long constexpr
326 - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
327 - {
328 - return *s ? strlen_c_r(s + 1, acc + 1) : acc;
329 - }
330 -
331 - template < typename CharT >
332 - unsigned long constexpr
333 - strlen_c(const CharT *const s) noexcept
334 - {
335 - return strlen_c_r(s, 0UL);
336 - }
337 -
338 - static_assert(strlen_c("") == 0UL, "");
339 - static_assert(strlen_c("1") == 1UL, "");
340 - static_assert(strlen_c("example") == 7UL, "");
341 - static_assert(strlen_c("another\0example") == 7UL, "");
342 -
343 - }
344 -
345 - namespace test_rvalue_references
346 - {
347 -
348 - template < int N >
349 - struct answer
350 - {
351 - static constexpr int value = N;
352 - };
353 -
354 - answer<1> f(int&) { return answer<1>(); }
355 - answer<2> f(const int&) { return answer<2>(); }
356 - answer<3> f(int&&) { return answer<3>(); }
357 -
358 - void
359 - test()
360 - {
361 - int i = 0;
362 - const int c = 0;
363 - static_assert(decltype(f(i))::value == 1, "");
364 - static_assert(decltype(f(c))::value == 2, "");
365 - static_assert(decltype(f(0))::value == 3, "");
366 - }
367 -
368 - }
369 -
370 - namespace test_uniform_initialization
371 - {
372 -
373 - struct test
374 - {
375 - static const int zero {};
376 - static const int one {1};
377 - };
378 -
379 - static_assert(test::zero == 0, "");
380 - static_assert(test::one == 1, "");
381 -
382 - }
383 -
384 - namespace test_lambdas
385 - {
386 -
387 - void
388 - test1()
389 - {
390 - auto lambda1 = [](){};
391 - auto lambda2 = lambda1;
392 - lambda1();
393 - lambda2();
394 - }
395 -
396 - int
397 - test2()
398 - {
399 - auto a = [](int i, int j){ return i + j; }(1, 2);
400 - auto b = []() -> int { return '0'; }();
401 - auto c = [=](){ return a + b; }();
402 - auto d = [&](){ return c; }();
403 - auto e = [a, &b](int x) mutable {
404 - const auto identity = [](int y){ return y; };
405 - for (auto i = 0; i < a; ++i)
406 - a += b--;
407 - return x + identity(a + b);
408 - }(0);
409 - return a + b + c + d + e;
410 - }
411 -
412 - int
413 - test3()
414 - {
415 - const auto nullary = [](){ return 0; };
416 - const auto unary = [](int x){ return x; };
417 - using nullary_t = decltype(nullary);
418 - using unary_t = decltype(unary);
419 - const auto higher1st = [](nullary_t f){ return f(); };
420 - const auto higher2nd = [unary](nullary_t f1){
421 - return [unary, f1](unary_t f2){ return f2(unary(f1())); };
422 - };
423 - return higher1st(nullary) + higher2nd(nullary)(unary);
424 - }
425 -
426 - }
427 -
428 - namespace test_variadic_templates
429 - {
430 -
431 - template <int...>
432 - struct sum;
433 -
434 - template <int N0, int... N1toN>
435 - struct sum<N0, N1toN...>
436 - {
437 - static constexpr auto value = N0 + sum<N1toN...>::value;
438 - };
439 -
440 - template <>
441 - struct sum<>
442 - {
443 - static constexpr auto value = 0;
444 - };
445 -
446 - static_assert(sum<>::value == 0, "");
447 - static_assert(sum<1>::value == 1, "");
448 - static_assert(sum<23>::value == 23, "");
449 - static_assert(sum<1, 2>::value == 3, "");
450 - static_assert(sum<5, 5, 11>::value == 21, "");
451 - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
452 -
453 - }
454 -
455 - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
456 - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
457 - // because of this.
458 - namespace test_template_alias_sfinae
459 - {
460 -
461 - struct foo {};
462 -
463 - template<typename T>
464 - using member = typename T::member_type;
465 -
466 - template<typename T>
467 - void func(...) {}
468 -
469 - template<typename T>
470 - void func(member<T>*) {}
471 -
472 - void test();
473 -
474 - void test() { func<foo>(0); }
475 -
476 - }
477 -
478 -} // namespace cxx11
479 -
480 -#endif // __cplusplus >= 201103L
481 -
482 -]])
483 -
484 -
485 -dnl Tests for new features in C++14
486 -
487 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
488 -
489 -// If the compiler admits that it is not ready for C++14, why torture it?
490 -// Hopefully, this will speed up the test.
491 -
492 -#ifndef __cplusplus
493 -
494 -#error "This is not a C++ compiler"
495 -
496 -#elif __cplusplus < 201402L && !defined _MSC_VER
497 -
498 -#error "This is not a C++14 compiler"
499 -
500 -#else
501 -
502 -namespace cxx14
503 -{
504 -
505 - namespace test_polymorphic_lambdas
506 - {
507 -
508 - int
509 - test()
510 - {
511 - const auto lambda = [](auto&&... args){
512 - const auto istiny = [](auto x){
513 - return (sizeof(x) == 1UL) ? 1 : 0;
514 - };
515 - const int aretiny[] = { istiny(args)... };
516 - return aretiny[0];
517 - };
518 - return lambda(1, 1L, 1.0f, '1');
519 - }
520 -
521 - }
522 -
523 - namespace test_binary_literals
524 - {
525 -
526 - constexpr auto ivii = 0b0000000000101010;
527 - static_assert(ivii == 42, "wrong value");
528 -
529 - }
530 -
531 - namespace test_generalized_constexpr
532 - {
533 -
534 - template < typename CharT >
535 - constexpr unsigned long
536 - strlen_c(const CharT *const s) noexcept
537 - {
538 - auto length = 0UL;
539 - for (auto p = s; *p; ++p)
540 - ++length;
541 - return length;
542 - }
543 -
544 - static_assert(strlen_c("") == 0UL, "");
545 - static_assert(strlen_c("x") == 1UL, "");
546 - static_assert(strlen_c("test") == 4UL, "");
547 - static_assert(strlen_c("another\0test") == 7UL, "");
548 -
549 - }
550 -
551 - namespace test_lambda_init_capture
552 - {
553 -
554 - int
555 - test()
556 - {
557 - auto x = 0;
558 - const auto lambda1 = [a = x](int b){ return a + b; };
559 - const auto lambda2 = [a = lambda1(x)](){ return a; };
560 - return lambda2();
561 - }
562 -
563 - }
564 -
565 - namespace test_digit_separators
566 - {
567 -
568 - constexpr auto ten_million = 100'000'000;
569 - static_assert(ten_million == 100000000, "");
570 -
571 - }
572 -
573 - namespace test_return_type_deduction
574 - {
575 -
576 - auto f(int& x) { return x; }
577 - decltype(auto) g(int& x) { return x; }
578 -
579 - template < typename T1, typename T2 >
580 - struct is_same
581 - {
582 - static constexpr auto value = false;
583 - };
584 -
585 - template < typename T >
586 - struct is_same<T, T>
587 - {
588 - static constexpr auto value = true;
589 - };
590 -
591 - int
592 - test()
593 - {
594 - auto x = 0;
595 - static_assert(is_same<int, decltype(f(x))>::value, "");
596 - static_assert(is_same<int&, decltype(g(x))>::value, "");
597 - return x;
598 - }
599 -
600 - }
601 -
602 -} // namespace cxx14
603 -
604 -#endif // __cplusplus >= 201402L
605 -
606 -]])
607 -
608 -
609 -dnl Tests for new features in C++17
610 -
611 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
612 -
613 -// If the compiler admits that it is not ready for C++17, why torture it?
614 -// Hopefully, this will speed up the test.
615 -
616 -#ifndef __cplusplus
617 -
618 -#error "This is not a C++ compiler"
619 -
620 -#elif __cplusplus < 201703L && !defined _MSC_VER
621 -
622 -#error "This is not a C++17 compiler"
623 -
624 -#else
625 -
626 -#include <initializer_list>
627 -#include <utility>
628 -#include <type_traits>
629 -
630 -namespace cxx17
631 -{
632 -
633 - namespace test_constexpr_lambdas
634 - {
635 -
636 - constexpr int foo = [](){return 42;}();
637 -
638 - }
639 -
640 - namespace test::nested_namespace::definitions
641 - {
642 -
643 - }
644 -
645 - namespace test_fold_expression
646 - {
647 -
648 - template<typename... Args>
649 - int multiply(Args... args)
650 - {
651 - return (args * ... * 1);
652 - }
653 -
654 - template<typename... Args>
655 - bool all(Args... args)
656 - {
657 - return (args && ...);
658 - }
659 -
660 - }
661 -
662 - namespace test_extended_static_assert
663 - {
664 -
665 - static_assert (true);
666 -
667 - }
668 -
669 - namespace test_auto_brace_init_list
670 - {
671 -
672 - auto foo = {5};
673 - auto bar {5};
674 -
675 - static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
676 - static_assert(std::is_same<int, decltype(bar)>::value);
677 - }
678 -
679 - namespace test_typename_in_template_template_parameter
680 - {
681 -
682 - template<template<typename> typename X> struct D;
683 -
684 - }
685 -
686 - namespace test_fallthrough_nodiscard_maybe_unused_attributes
687 - {
688 -
689 - int f1()
690 - {
691 - return 42;
692 - }
693 -
694 - [[nodiscard]] int f2()
695 - {
696 - [[maybe_unused]] auto unused = f1();
697 -
698 - switch (f1())
699 - {
700 - case 17:
701 - f1();
702 - [[fallthrough]];
703 - case 42:
704 - f1();
705 - }
706 - return f1();
707 - }
708 -
709 - }
710 -
711 - namespace test_extended_aggregate_initialization
712 - {
713 -
714 - struct base1
715 - {
716 - int b1, b2 = 42;
717 - };
718 -
719 - struct base2
720 - {
721 - base2() {
722 - b3 = 42;
723 - }
724 - int b3;
725 - };
726 -
727 - struct derived : base1, base2
728 - {
729 - int d;
730 - };
731 -
732 - derived d1 {{1, 2}, {}, 4}; // full initialization
733 - derived d2 {{}, {}, 4}; // value-initialized bases
734 -
735 - }
736 -
737 - namespace test_general_range_based_for_loop
738 - {
739 -
740 - struct iter
741 - {
742 - int i;
743 -
744 - int& operator* ()
745 - {
746 - return i;
747 - }
748 -
749 - const int& operator* () const
750 - {
751 - return i;
752 - }
753 -
754 - iter& operator++()
755 - {
756 - ++i;
757 - return *this;
758 - }
759 - };
760 -
761 - struct sentinel
762 - {
763 - int i;
764 - };
765 -
766 - bool operator== (const iter& i, const sentinel& s)
767 - {
768 - return i.i == s.i;
769 - }
770 -
771 - bool operator!= (const iter& i, const sentinel& s)
772 - {
773 - return !(i == s);
774 - }
775 -
776 - struct range
777 - {
778 - iter begin() const
779 - {
780 - return {0};
781 - }
782 -
783 - sentinel end() const
784 - {
785 - return {5};
786 - }
787 - };
788 -
789 - void f()
790 - {
791 - range r {};
792 -
793 - for (auto i : r)
794 - {
795 - [[maybe_unused]] auto v = i;
796 - }
797 - }
798 -
799 - }
800 -
801 - namespace test_lambda_capture_asterisk_this_by_value
802 - {
803 -
804 - struct t
805 - {
806 - int i;
807 - int foo()
808 - {
809 - return [*this]()
810 - {
811 - return i;
812 - }();
813 - }
814 - };
815 -
816 - }
817 -
818 - namespace test_enum_class_construction
819 - {
820 -
821 - enum class byte : unsigned char
822 - {};
823 -
824 - byte foo {42};
825 -
826 - }
827 -
828 - namespace test_constexpr_if
829 - {
830 -
831 - template <bool cond>
832 - int f ()
833 - {
834 - if constexpr(cond)
835 - {
836 - return 13;
837 - }
838 - else
839 - {
840 - return 42;
841 - }
842 - }
843 -
844 - }
845 -
846 - namespace test_selection_statement_with_initializer
847 - {
848 -
849 - int f()
850 - {
851 - return 13;
852 - }
853 -
854 - int f2()
855 - {
856 - if (auto i = f(); i > 0)
857 - {
858 - return 3;
859 - }
860 -
861 - switch (auto i = f(); i + 4)
862 - {
863 - case 17:
864 - return 2;
865 -
866 - default:
867 - return 1;
868 - }
869 - }
870 -
871 - }
872 -
873 - namespace test_template_argument_deduction_for_class_templates
874 - {
875 -
876 - template <typename T1, typename T2>
877 - struct pair
878 - {
879 - pair (T1 p1, T2 p2)
880 - : m1 {p1},
881 - m2 {p2}
882 - {}
883 -
884 - T1 m1;
885 - T2 m2;
886 - };
887 -
888 - void f()
889 - {
890 - [[maybe_unused]] auto p = pair{13, 42u};
891 - }
892 -
893 - }
894 -
895 - namespace test_non_type_auto_template_parameters
896 - {
897 -
898 - template <auto n>
899 - struct B
900 - {};
901 -
902 - B<5> b1;
903 - B<'a'> b2;
904 -
905 - }
906 -
907 - namespace test_structured_bindings
908 - {
909 -
910 - int arr[2] = { 1, 2 };
911 - std::pair<int, int> pr = { 1, 2 };
912 -
913 - auto f1() -> int(&)[2]
914 - {
915 - return arr;
916 - }
917 -
918 - auto f2() -> std::pair<int, int>&
919 - {
920 - return pr;
921 - }
922 -
923 - struct S
924 - {
925 - int x1 : 2;
926 - volatile double y1;
927 - };
928 -
929 - S f3()
930 - {
931 - return {};
932 - }
933 -
934 - auto [ x1, y1 ] = f1();
935 - auto& [ xr1, yr1 ] = f1();
936 - auto [ x2, y2 ] = f2();
937 - auto& [ xr2, yr2 ] = f2();
938 - const auto [ x3, y3 ] = f3();
939 -
940 - }
941 -
942 - namespace test_exception_spec_type_system
943 - {
944 -
945 - struct Good {};
946 - struct Bad {};
947 -
948 - void g1() noexcept;
949 - void g2();
950 -
951 - template<typename T>
952 - Bad
953 - f(T*, T*);
954 -
955 - template<typename T1, typename T2>
956 - Good
957 - f(T1*, T2*);
958 -
959 - static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
960 -
961 - }
962 -
963 - namespace test_inline_variables
964 - {
965 -
966 - template<class T> void f(T)
967 - {}
968 -
969 - template<class T> inline T g(T)
970 - {
971 - return T{};
972 - }
973 -
974 - template<> inline void f<>(int)
975 - {}
976 -
977 - template<> int g<>(int)
978 - {
979 - return 5;
980 - }
981 -
982 - }
983 -
984 -} // namespace cxx17
985 -
986 -#endif // __cplusplus < 201703L && !defined _MSC_VER
987 -
988 -]])
989 -
990 -
991 -dnl Tests for new features in C++20
992 -
993 -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[
994 -
995 -#ifndef __cplusplus
996 -
997 -#error "This is not a C++ compiler"
998 -
999 -#elif __cplusplus < 202002L && !defined _MSC_VER
1000 -
1001 -#error "This is not a C++20 compiler"
1002 -
1003 -#else
1004 -
1005 -#include <version>
1006 -
1007 -namespace cxx20
1008 -{
1009 -
1010 -// As C++20 supports feature test macros in the standard, there is no
1011 -// immediate need to actually test for feature availability on the
1012 -// Autoconf side.
1013 -
1014 -} // namespace cxx20
1015 -
1016 -#endif // __cplusplus < 202002L && !defined _MSC_VER
1017 -
1018 -]])
build/m4/ax_gcc_func_attribute.m4 deleted
-223
@@ -1,223 +0,0 @@
1 -# ===========================================================================
2 -# http://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
8 -#
9 -# DESCRIPTION
10 -#
11 -# This macro checks if the compiler supports one of GCC's function
12 -# attributes; many other compilers also provide function attributes with
13 -# the same syntax. Compiler warnings are used to detect supported
14 -# attributes as unsupported ones are ignored by default so quieting
15 -# warnings when using this macro will yield false positives.
16 -#
17 -# The ATTRIBUTE parameter holds the name of the attribute to be checked.
18 -#
19 -# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
20 -#
21 -# The macro caches its result in the ax_cv_have_func_attribute_<attribute>
22 -# variable.
23 -#
24 -# The macro currently supports the following function attributes:
25 -#
26 -# alias
27 -# aligned
28 -# alloc_size
29 -# always_inline
30 -# artificial
31 -# cold
32 -# const
33 -# constructor
34 -# constructor_priority for constructor attribute with priority
35 -# deprecated
36 -# destructor
37 -# dllexport
38 -# dllimport
39 -# error
40 -# externally_visible
41 -# flatten
42 -# format
43 -# format_arg
44 -# gnu_inline
45 -# hot
46 -# ifunc
47 -# leaf
48 -# malloc
49 -# noclone
50 -# noinline
51 -# nonnull
52 -# noreturn
53 -# nothrow
54 -# optimize
55 -# pure
56 -# unused
57 -# used
58 -# visibility
59 -# warning
60 -# warn_unused_result
61 -# weak
62 -# weakref
63 -#
64 -# Unsupported function attributes will be tested with a prototype returning
65 -# an int and not accepting any arguments and the result of the check might
66 -# be wrong or meaningless so use with care.
67 -#
68 -# LICENSE
69 -#
70 -# Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
71 -#
72 -# SPDX-License-Identifier: FSFAP
73 -
74 -#serial 4
75 -
76 -AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
77 - AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
78 -
79 - AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
80 - AC_LINK_IFELSE([AC_LANG_PROGRAM([
81 - m4_case([$1],
82 - [alias], [
83 - int foo( void ) { return 0; }
84 - int bar( void ) __attribute__(($1("foo")));
85 - ],
86 - [aligned], [
87 - int foo( void ) __attribute__(($1(32)));
88 - ],
89 - [alloc_size], [
90 - void *foo(int a) __attribute__(($1(1)));
91 - ],
92 - [always_inline], [
93 - inline __attribute__(($1)) int foo( void ) { return 0; }
94 - ],
95 - [artificial], [
96 - inline __attribute__(($1)) int foo( void ) { return 0; }
97 - ],
98 - [cold], [
99 - int foo( void ) __attribute__(($1));
100 - ],
101 - [const], [
102 - int foo( void ) __attribute__(($1));
103 - ],
104 - [constructor_priority], [
105 - int foo( void ) __attribute__((__constructor__(65535/2)));
106 - ],
107 - [constructor], [
108 - int foo( void ) __attribute__(($1));
109 - ],
110 - [deprecated], [
111 - int foo( void ) __attribute__(($1("")));
112 - ],
113 - [destructor], [
114 - int foo( void ) __attribute__(($1));
115 - ],
116 - [dllexport], [
117 - __attribute__(($1)) int foo( void ) { return 0; }
118 - ],
119 - [dllimport], [
120 - int foo( void ) __attribute__(($1));
121 - ],
122 - [error], [
123 - int foo( void ) __attribute__(($1("")));
124 - ],
125 - [externally_visible], [
126 - int foo( void ) __attribute__(($1));
127 - ],
128 - [flatten], [
129 - int foo( void ) __attribute__(($1));
130 - ],
131 - [format], [
132 - int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
133 - ],
134 - [format_arg], [
135 - char *foo(const char *p) __attribute__(($1(1)));
136 - ],
137 - [gnu_inline], [
138 - inline __attribute__(($1)) int foo( void ) { return 0; }
139 - ],
140 - [hot], [
141 - int foo( void ) __attribute__(($1));
142 - ],
143 - [ifunc], [
144 - int my_foo( void ) { return 0; }
145 - static int (*resolve_foo(void))(void) { return my_foo; }
146 - int foo( void ) __attribute__(($1("resolve_foo")));
147 - ],
148 - [leaf], [
149 - __attribute__(($1)) int foo( void ) { return 0; }
150 - ],
151 - [malloc], [
152 - void *foo( void ) __attribute__(($1));
153 - ],
154 - [noclone], [
155 - int foo( void ) __attribute__(($1));
156 - ],
157 - [noinline], [
158 - __attribute__(($1)) int foo( void ) { return 0; }
159 - ],
160 - [nonnull], [
161 - int foo(char *p) __attribute__(($1(1)));
162 - ],
163 - [noreturn], [
164 - void foo( void ) __attribute__(($1));
165 - ],
166 - [nothrow], [
167 - int foo( void ) __attribute__(($1));
168 - ],
169 - [optimize], [
170 - __attribute__(($1(3))) int foo( void ) { return 0; }
171 - ],
172 - [pure], [
173 - int foo( void ) __attribute__(($1));
174 - ],
175 - [returns_nonnull], [
176 - void *foo( void ) __attribute__(($1));
177 - ],
178 - [unused], [
179 - int foo( void ) __attribute__(($1));
180 - ],
181 - [used], [
182 - int foo( void ) __attribute__(($1));
183 - ],
184 - [visibility], [
185 - int foo_def( void ) __attribute__(($1("default")));
186 - int foo_hid( void ) __attribute__(($1("hidden")));
187 - int foo_int( void ) __attribute__(($1("internal")));
188 - int foo_pro( void ) __attribute__(($1("protected")));
189 - ],
190 - [warning], [
191 - int foo( void ) __attribute__(($1("")));
192 - ],
193 - [warn_unused_result], [
194 - int foo( void ) __attribute__(($1));
195 - ],
196 - [weak], [
197 - int foo( void ) __attribute__(($1));
198 - ],
199 - [weakref], [
200 - static int foo( void ) { return 0; }
201 - static int bar( void ) __attribute__(($1("foo")));
202 - ],
203 - [
204 - m4_warn([syntax], [Unsupported attribute $1, the test may fail])
205 - int foo( void ) __attribute__(($1));
206 - ]
207 - )], [])
208 - ],
209 - dnl GCC doesn't exit with an error if an unknown attribute is
210 - dnl provided but only outputs a warning, so accept the attribute
211 - dnl only if no warning were issued.
212 - [AS_IF([test -s conftest.err],
213 - [AS_VAR_SET([ac_var], [no])],
214 - [AS_VAR_SET([ac_var], [yes])])],
215 - [AS_VAR_SET([ac_var], [no])])
216 - ])
217 -
218 - AS_IF([test yes = AS_VAR_GET([ac_var])],
219 - [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
220 - [Define to 1 if the system has the `$1' function attribute])], [])
221 -
222 - AS_VAR_POPDEF([ac_var])
223 -])
build/m4/ax_pthread.m4 deleted
-522
@@ -1,522 +0,0 @@
1 -# ===========================================================================
2 -# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
3 -# ===========================================================================
4 -#
5 -# SYNOPSIS
6 -#
7 -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8 -#
9 -# DESCRIPTION
10 -#
11 -# This macro figures out how to build C programs using POSIX threads. It
12 -# sets the PTHREAD_LIBS output variable to the threads library and linker
13 -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
14 -# flags that are needed. (The user can also force certain compiler
15 -# flags/libs to be tested by setting these environment variables.)
16 -#
17 -# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
18 -# needed for multi-threaded programs (defaults to the value of CC
19 -# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
20 -# special cc_r/CC_r compiler alias.)
21 -#
22 -# NOTE: You are assumed to not only compile your program with these flags,
23 -# but also to link with them as well. For example, you might link with
24 -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
25 -# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
26 -#
27 -# If you are only building threaded programs, you may wish to use these
28 -# variables in your default LIBS, CFLAGS, and CC:
29 -#
30 -# LIBS="$PTHREAD_LIBS $LIBS"
31 -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
32 -# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
33 -# CC="$PTHREAD_CC"
34 -# CXX="$PTHREAD_CXX"
35 -#
36 -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
37 -# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
38 -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
39 -#
40 -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
41 -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
42 -# PTHREAD_CFLAGS.
43 -#
44 -# ACTION-IF-FOUND is a list of shell commands to run if a threads library
45 -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
46 -# is not found. If ACTION-IF-FOUND is not specified, the default action
47 -# will define HAVE_PTHREAD.
48 -#
49 -# Please let the authors know if this macro fails on any platform, or if
50 -# you have any other suggestions or comments. This macro was based on work
51 -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
52 -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
53 -# Alejandro Forero Cuervo to the autoconf macro repository. We are also
54 -# grateful for the helpful feedback of numerous users.
55 -#
56 -# Updated for Autoconf 2.68 by Daniel Richard G.
57 -#
58 -# LICENSE
59 -#
60 -# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
61 -# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
62 -# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
63 -#
64 -# This program is free software: you can redistribute it and/or modify it
65 -# under the terms of the GNU General Public License as published by the
66 -# Free Software Foundation, either version 3 of the License, or (at your
67 -# option) any later version.
68 -#
69 -# This program is distributed in the hope that it will be useful, but
70 -# WITHOUT ANY WARRANTY; without even the implied warranty of
71 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
72 -# Public License for more details.
73 -#
74 -# You should have received a copy of the GNU General Public License along
75 -# with this program. If not, see <https://www.gnu.org/licenses/>.
76 -#
77 -# As a special exception, the respective Autoconf Macro's copyright owner
78 -# gives unlimited permission to copy, distribute and modify the configure
79 -# scripts that are the output of Autoconf when processing the Macro. You
80 -# need not follow the terms of the GNU General Public License when using
81 -# or distributing such scripts, even though portions of the text of the
82 -# Macro appear in them. The GNU General Public License (GPL) does govern
83 -# all other use of the material that constitutes the Autoconf Macro.
84 -#
85 -# This special exception to the GPL applies to versions of the Autoconf
86 -# Macro released by the Autoconf Archive. When you make and distribute a
87 -# modified version of the Autoconf Macro, you may extend this special
88 -# exception to the GPL to apply to your modified version as well.
89 -
90 -#serial 31
91 -
92 -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
93 -AC_DEFUN([AX_PTHREAD], [
94 -AC_REQUIRE([AC_CANONICAL_HOST])
95 -AC_REQUIRE([AC_PROG_CC])
96 -AC_REQUIRE([AC_PROG_SED])
97 -AC_LANG_PUSH([C])
98 -ax_pthread_ok=no
99 -
100 -# We used to check for pthread.h first, but this fails if pthread.h
101 -# requires special compiler flags (e.g. on Tru64 or Sequent).
102 -# It gets checked for in the link test anyway.
103 -
104 -# First of all, check if the user has set any of the PTHREAD_LIBS,
105 -# etcetera environment variables, and if threads linking works using
106 -# them:
107 -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
108 - ax_pthread_save_CC="$CC"
109 - ax_pthread_save_CFLAGS="$CFLAGS"
110 - ax_pthread_save_LIBS="$LIBS"
111 - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
112 - AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
113 - CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
114 - LIBS="$PTHREAD_LIBS $LIBS"
115 - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
116 - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
117 - AC_MSG_RESULT([$ax_pthread_ok])
118 - if test "x$ax_pthread_ok" = "xno"; then
119 - PTHREAD_LIBS=""
120 - PTHREAD_CFLAGS=""
121 - fi
122 - CC="$ax_pthread_save_CC"
123 - CFLAGS="$ax_pthread_save_CFLAGS"
124 - LIBS="$ax_pthread_save_LIBS"
125 -fi
126 -
127 -# We must check for the threads library under a number of different
128 -# names; the ordering is very important because some systems
129 -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
130 -# libraries is broken (non-POSIX).
131 -
132 -# Create a list of thread flags to try. Items with a "," contain both
133 -# C compiler flags (before ",") and linker flags (after ","). Other items
134 -# starting with a "-" are C compiler flags, and remaining items are
135 -# library names, except for "none" which indicates that we try without
136 -# any flags at all, and "pthread-config" which is a program returning
137 -# the flags for the Pth emulation library.
138 -
139 -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
140 -
141 -# The ordering *is* (sometimes) important. Some notes on the
142 -# individual items follow:
143 -
144 -# pthreads: AIX (must check this before -lpthread)
145 -# none: in case threads are in libc; should be tried before -Kthread and
146 -# other compiler flags to prevent continual compiler warnings
147 -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
148 -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
149 -# (Note: HP C rejects this with "bad form for `-t' option")
150 -# -pthreads: Solaris/gcc (Note: HP C also rejects)
151 -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
152 -# doesn't hurt to check since this sometimes defines pthreads and
153 -# -D_REENTRANT too), HP C (must be checked before -lpthread, which
154 -# is present but should not be used directly; and before -mthreads,
155 -# because the compiler interprets this as "-mt" + "-hreads")
156 -# -mthreads: Mingw32/gcc, Lynx/gcc
157 -# pthread: Linux, etcetera
158 -# --thread-safe: KAI C++
159 -# pthread-config: use pthread-config program (for GNU Pth library)
160 -
161 -case $host_os in
162 -
163 - freebsd*)
164 -
165 - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
166 - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
167 -
168 - ax_pthread_flags="-kthread lthread $ax_pthread_flags"
169 - ;;
170 -
171 - hpux*)
172 -
173 - # From the cc(1) man page: "[-mt] Sets various -D flags to enable
174 - # multi-threading and also sets -lpthread."
175 -
176 - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
177 - ;;
178 -
179 - openedition*)
180 -
181 - # IBM z/OS requires a feature-test macro to be defined in order to
182 - # enable POSIX threads at all, so give the user a hint if this is
183 - # not set. (We don't define these ourselves, as they can affect
184 - # other portions of the system API in unpredictable ways.)
185 -
186 - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
187 - [
188 -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
189 - AX_PTHREAD_ZOS_MISSING
190 -# endif
191 - ],
192 - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
193 - ;;
194 -
195 - solaris*)
196 -
197 - # On Solaris (at least, for some versions), libc contains stubbed
198 - # (non-functional) versions of the pthreads routines, so link-based
199 - # tests will erroneously succeed. (N.B.: The stubs are missing
200 - # pthread_cleanup_push, or rather a function called by this macro,
201 - # so we could check for that, but who knows whether they'll stub
202 - # that too in a future libc.) So we'll check first for the
203 - # standard Solaris way of linking pthreads (-mt -lpthread).
204 -
205 - ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
206 - ;;
207 -esac
208 -
209 -# Are we compiling with Clang?
210 -
211 -AC_CACHE_CHECK([whether $CC is Clang],
212 - [ax_cv_PTHREAD_CLANG],
213 - [ax_cv_PTHREAD_CLANG=no
214 - # Note that Autoconf sets GCC=yes for Clang as well as GCC
215 - if test "x$GCC" = "xyes"; then
216 - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
217 - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
218 -# if defined(__clang__) && defined(__llvm__)
219 - AX_PTHREAD_CC_IS_CLANG
220 -# endif
221 - ],
222 - [ax_cv_PTHREAD_CLANG=yes])
223 - fi
224 - ])
225 -ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
226 -
227 -
228 -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
229 -
230 -# Note that for GCC and Clang -pthread generally implies -lpthread,
231 -# except when -nostdlib is passed.
232 -# This is problematic using libtool to build C++ shared libraries with pthread:
233 -# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
234 -# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
235 -# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
236 -# To solve this, first try -pthread together with -lpthread for GCC
237 -
238 -AS_IF([test "x$GCC" = "xyes"],
239 - [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
240 -
241 -# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
242 -
243 -AS_IF([test "x$ax_pthread_clang" = "xyes"],
244 - [ax_pthread_flags="-pthread,-lpthread -pthread"])
245 -
246 -
247 -# The presence of a feature test macro requesting re-entrant function
248 -# definitions is, on some systems, a strong hint that pthreads support is
249 -# correctly enabled
250 -
251 -case $host_os in
252 - darwin* | hpux* | linux* | osf* | solaris*)
253 - ax_pthread_check_macro="_REENTRANT"
254 - ;;
255 -
256 - aix*)
257 - ax_pthread_check_macro="_THREAD_SAFE"
258 - ;;
259 -
260 - *)
261 - ax_pthread_check_macro="--"
262 - ;;
263 -esac
264 -AS_IF([test "x$ax_pthread_check_macro" = "x--"],
265 - [ax_pthread_check_cond=0],
266 - [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
267 -
268 -
269 -if test "x$ax_pthread_ok" = "xno"; then
270 -for ax_pthread_try_flag in $ax_pthread_flags; do
271 -
272 - case $ax_pthread_try_flag in
273 - none)
274 - AC_MSG_CHECKING([whether pthreads work without any flags])
275 - ;;
276 -
277 - *,*)
278 - PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
279 - PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
280 - AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
281 - ;;
282 -
283 - -*)
284 - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
285 - PTHREAD_CFLAGS="$ax_pthread_try_flag"
286 - ;;
287 -
288 - pthread-config)
289 - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
290 - AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
291 - PTHREAD_CFLAGS="`pthread-config --cflags`"
292 - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
293 - ;;
294 -
295 - *)
296 - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
297 - PTHREAD_LIBS="-l$ax_pthread_try_flag"
298 - ;;
299 - esac
300 -
301 - ax_pthread_save_CFLAGS="$CFLAGS"
302 - ax_pthread_save_LIBS="$LIBS"
303 - CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
304 - LIBS="$PTHREAD_LIBS $LIBS"
305 -
306 - # Check for various functions. We must include pthread.h,
307 - # since some functions may be macros. (On the Sequent, we
308 - # need a special flag -Kthread to make this header compile.)
309 - # We check for pthread_join because it is in -lpthread on IRIX
310 - # while pthread_create is in libc. We check for pthread_attr_init
311 - # due to DEC craziness with -lpthreads. We check for
312 - # pthread_cleanup_push because it is one of the few pthread
313 - # functions on Solaris that doesn't have a non-functional libc stub.
314 - # We try pthread_create on general principles.
315 -
316 - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
317 -# if $ax_pthread_check_cond
318 -# error "$ax_pthread_check_macro must be defined"
319 -# endif
320 - static void *some_global = NULL;
321 - static void routine(void *a)
322 - {
323 - /* To avoid any unused-parameter or
324 - unused-but-set-parameter warning. */
325 - some_global = a;
326 - }
327 - static void *start_routine(void *a) { return a; }],
328 - [pthread_t th; pthread_attr_t attr;
329 - pthread_create(&th, 0, start_routine, 0);
330 - pthread_join(th, 0);
331 - pthread_attr_init(&attr);
332 - pthread_cleanup_push(routine, 0);
333 - pthread_cleanup_pop(0) /* ; */])],
334 - [ax_pthread_ok=yes],
335 - [])
336 -
337 - CFLAGS="$ax_pthread_save_CFLAGS"
338 - LIBS="$ax_pthread_save_LIBS"
339 -
340 - AC_MSG_RESULT([$ax_pthread_ok])
341 - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
342 -
343 - PTHREAD_LIBS=""
344 - PTHREAD_CFLAGS=""
345 -done
346 -fi
347 -
348 -
349 -# Clang needs special handling, because older versions handle the -pthread
350 -# option in a rather... idiosyncratic way
351 -
352 -if test "x$ax_pthread_clang" = "xyes"; then
353 -
354 - # Clang takes -pthread; it has never supported any other flag
355 -
356 - # (Note 1: This will need to be revisited if a system that Clang
357 - # supports has POSIX threads in a separate library. This tends not
358 - # to be the way of modern systems, but it's conceivable.)
359 -
360 - # (Note 2: On some systems, notably Darwin, -pthread is not needed
361 - # to get POSIX threads support; the API is always present and
362 - # active. We could reasonably leave PTHREAD_CFLAGS empty. But
363 - # -pthread does define _REENTRANT, and while the Darwin headers
364 - # ignore this macro, third-party headers might not.)
365 -
366 - # However, older versions of Clang make a point of warning the user
367 - # that, in an invocation where only linking and no compilation is
368 - # taking place, the -pthread option has no effect ("argument unused
369 - # during compilation"). They expect -pthread to be passed in only
370 - # when source code is being compiled.
371 - #
372 - # Problem is, this is at odds with the way Automake and most other
373 - # C build frameworks function, which is that the same flags used in
374 - # compilation (CFLAGS) are also used in linking. Many systems
375 - # supported by AX_PTHREAD require exactly this for POSIX threads
376 - # support, and in fact it is often not straightforward to specify a
377 - # flag that is used only in the compilation phase and not in
378 - # linking. Such a scenario is extremely rare in practice.
379 - #
380 - # Even though use of the -pthread flag in linking would only print
381 - # a warning, this can be a nuisance for well-run software projects
382 - # that build with -Werror. So if the active version of Clang has
383 - # this misfeature, we search for an option to squash it.
384 -
385 - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
386 - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
387 - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
388 - # Create an alternate version of $ac_link that compiles and
389 - # links in two steps (.c -> .o, .o -> exe) instead of one
390 - # (.c -> exe), because the warning occurs only in the second
391 - # step
392 - ax_pthread_save_ac_link="$ac_link"
393 - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
394 - ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
395 - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
396 - ax_pthread_save_CFLAGS="$CFLAGS"
397 - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
398 - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
399 - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
400 - ac_link="$ax_pthread_save_ac_link"
401 - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
402 - [ac_link="$ax_pthread_2step_ac_link"
403 - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
404 - [break])
405 - ])
406 - done
407 - ac_link="$ax_pthread_save_ac_link"
408 - CFLAGS="$ax_pthread_save_CFLAGS"
409 - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
410 - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
411 - ])
412 -
413 - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
414 - no | unknown) ;;
415 - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
416 - esac
417 -
418 -fi # $ax_pthread_clang = yes
419 -
420 -
421 -
422 -# Various other checks:
423 -if test "x$ax_pthread_ok" = "xyes"; then
424 - ax_pthread_save_CFLAGS="$CFLAGS"
425 - ax_pthread_save_LIBS="$LIBS"
426 - CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
427 - LIBS="$PTHREAD_LIBS $LIBS"
428 -
429 - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
430 - AC_CACHE_CHECK([for joinable pthread attribute],
431 - [ax_cv_PTHREAD_JOINABLE_ATTR],
432 - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
433 - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
434 - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
435 - [int attr = $ax_pthread_attr; return attr /* ; */])],
436 - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
437 - [])
438 - done
439 - ])
440 - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
441 - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
442 - test "x$ax_pthread_joinable_attr_defined" != "xyes"],
443 - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
444 - [$ax_cv_PTHREAD_JOINABLE_ATTR],
445 - [Define to necessary symbol if this constant
446 - uses a non-standard name on your system.])
447 - ax_pthread_joinable_attr_defined=yes
448 - ])
449 -
450 - AC_CACHE_CHECK([whether more special flags are required for pthreads],
451 - [ax_cv_PTHREAD_SPECIAL_FLAGS],
452 - [ax_cv_PTHREAD_SPECIAL_FLAGS=no
453 - case $host_os in
454 - solaris*)
455 - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
456 - ;;
457 - esac
458 - ])
459 - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
460 - test "x$ax_pthread_special_flags_added" != "xyes"],
461 - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
462 - ax_pthread_special_flags_added=yes])
463 -
464 - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
465 - [ax_cv_PTHREAD_PRIO_INHERIT],
466 - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
467 - [[int i = PTHREAD_PRIO_INHERIT;
468 - return i;]])],
469 - [ax_cv_PTHREAD_PRIO_INHERIT=yes],
470 - [ax_cv_PTHREAD_PRIO_INHERIT=no])
471 - ])
472 - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
473 - test "x$ax_pthread_prio_inherit_defined" != "xyes"],
474 - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
475 - ax_pthread_prio_inherit_defined=yes
476 - ])
477 -
478 - CFLAGS="$ax_pthread_save_CFLAGS"
479 - LIBS="$ax_pthread_save_LIBS"
480 -
481 - # More AIX lossage: compile with *_r variant
482 - if test "x$GCC" != "xyes"; then
483 - case $host_os in
484 - aix*)
485 - AS_CASE(["x/$CC"],
486 - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
487 - [#handle absolute path differently from PATH based program lookup
488 - AS_CASE(["x$CC"],
489 - [x/*],
490 - [
491 - AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
492 - AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
493 - ],
494 - [
495 - AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
496 - AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
497 - ]
498 - )
499 - ])
500 - ;;
501 - esac
502 - fi
503 -fi
504 -
505 -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
506 -test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
507 -
508 -AC_SUBST([PTHREAD_LIBS])
509 -AC_SUBST([PTHREAD_CFLAGS])
510 -AC_SUBST([PTHREAD_CC])
511 -AC_SUBST([PTHREAD_CXX])
512 -
513 -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
514 -if test "x$ax_pthread_ok" = "xyes"; then
515 - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
516 - :
517 -else
518 - ax_pthread_ok=no
519 - $2
520 -fi
521 -AC_LANG_POP
522 -])dnl AX_PTHREAD
build/m4/jemalloc.m4 deleted
-75
@@ -1,75 +0,0 @@
1 -dnl -------------------------------------------------------- -*- autoconf -*-
2 -dnl SPDX-License-Identifier: Apache-2.0
3 -
4 -dnl
5 -dnl jemalloc.m4: Trafficserver's jemalloc autoconf macros
6 -dnl modified to skip other TS_ helpers
7 -dnl
8 -
9 -AC_DEFUN([TS_CHECK_JEMALLOC], [
10 -AC_ARG_WITH([jemalloc-prefix],
11 - [AS_HELP_STRING([--with-jemalloc-prefix=PREFIX],[Specify the jemalloc prefix [default=""]])],
12 - [
13 - jemalloc_prefix="$withval"
14 - ],[
15 - if test "`uname -s`" = "Darwin"; then
16 - jemalloc_prefix="je_"
17 - else
18 - jemalloc_prefix=""
19 - fi
20 - ]
21 -)
22 -AC_DEFINE_UNQUOTED([prefix_jemalloc], [${jemalloc_prefix}], [jemalloc prefix])
23 -
24 -enable_jemalloc=no
25 -AC_ARG_WITH([jemalloc], [AS_HELP_STRING([--with-jemalloc=DIR], [use a specific jemalloc library])],
26 -[
27 - if test "$withval" != "no"; then
28 - if test "x${enable_tcmalloc}" = "xyes"; then
29 - AC_MSG_ERROR([Cannot compile with both jemalloc and tcmalloc])
30 - fi
31 - enable_jemalloc=yes
32 - jemalloc_base_dir="$withval"
33 - case "$withval" in
34 - yes)
35 - jemalloc_base_dir="/usr"
36 - AC_MSG_CHECKING(checking for jemalloc includes standard directories)
37 - ;;
38 - *":"*)
39 - jemalloc_include="`echo $withval |sed -e 's/:.*$//'`"
40 - jemalloc_ldflags="`echo $withval |sed -e 's/^.*://'`"
41 - AC_MSG_CHECKING(checking for jemalloc includes in $jemalloc_include libs in $jemalloc_ldflags)
42 - ;;
43 - *)
44 - jemalloc_include="$withval/include"
45 - jemalloc_ldflags="$withval/lib"
46 - AC_MSG_CHECKING(checking for jemalloc includes in $withval)
47 - ;;
48 - esac
49 - fi
50 -])
51 -
52 -has_jemalloc=0
53 -if test "$enable_jemalloc" != "no"; then
54 - jemalloc_have_headers=0
55 - jemalloc_have_libs=0
56 - if test "$jemalloc_base_dir" != "/usr"; then
57 - CFLAGS="${CFLAGS} -I${jemalloc_include}"
58 - LDFLAGS="${LDFLAGS} -L${jemalloc_ldflags}"
59 - LIBTOOL_LINK_FLAGS="${LIBTOOL_LINK_FLAGS} -R${jemalloc_ldflags}"
60 - fi
61 - func="${jemalloc_prefix}malloc_stats_print"
62 - AC_CHECK_LIB(jemalloc, ${func}, [jemalloc_have_libs=1])
63 - if test "$jemalloc_have_libs" != "0"; then
64 - AC_CHECK_HEADERS([jemalloc/jemalloc.h], [jemalloc_have_headers=1])
65 - fi
66 - if test "$jemalloc_have_headers" != "0"; then
67 - has_jemalloc=1
68 - LIBS="${LIBS} -ljemalloc"
69 - AC_DEFINE(has_jemalloc, [1], [Link/compile against jemalloc])
70 - else
71 - AC_MSG_ERROR([Couldn't find a jemalloc installation])
72 - fi
73 -fi
74 -AC_SUBST(has_jemalloc)
75 -])
build/m4/tcmalloc.m4 deleted
-45
@@ -1,45 +0,0 @@
1 -dnl -------------------------------------------------------- -*- autoconf -*-
2 -dnl SPDX-License-Identifier: Apache-2.0
3 -
4 -dnl
5 -dnl tcmalloc.m4: Trafficserver's tcmalloc autoconf macros
6 -dnl modified to skip other TS_ helpers
7 -dnl
8 -
9 -dnl This is kinda fugly, but need a way to both specify a directory and which
10 -dnl of the many tcmalloc libraries to use ...
11 -AC_DEFUN([TS_CHECK_TCMALLOC], [
12 -AC_ARG_WITH([tcmalloc-lib],
13 - [AS_HELP_STRING([--with-tcmalloc-lib],[specify the tcmalloc library to use [default=tcmalloc]])],
14 - [
15 - with_tcmalloc_lib="$withval"
16 - ],[
17 - with_tcmalloc_lib="tcmalloc"
18 - ]
19 -)
20 -
21 -has_tcmalloc=0
22 -AC_ARG_WITH([tcmalloc], [AS_HELP_STRING([--with-tcmalloc=DIR], [use the tcmalloc library])],
23 -[
24 - if test "$withval" != "no"; then
25 - if test "x${enable_jemalloc}" = "xyes"; then
26 - AC_MSG_ERROR([Cannot compile with both tcmalloc and jemalloc])
27 - fi
28 - tcmalloc_have_lib=0
29 - if test "x$withval" != "xyes" && test "x$withval" != "x"; then
30 - tcmalloc_ldflags="$withval/lib"
31 - LDFLAGS="${LDFLAGS} -L${tcmalloc_ldflags}"
32 - LIBTOOL_LINK_FLAGS="${LIBTOOL_LINK_FLAGS} -rpath ${tcmalloc_ldflags}"
33 - fi
34 - AC_CHECK_LIB(${with_tcmalloc_lib}, tc_cfree, [tcmalloc_have_lib=1])
35 - if test "$tcmalloc_have_lib" != "0"; then
36 - LIBS="${LIBS} -l${with_tcmalloc_lib}"
37 - has_tcmalloc=1
38 - AC_DEFINE(has_tcmalloc, [1], [Link/compile against tcmalloc])
39 - else
40 - AC_MSG_ERROR([Couldn't find a tcmalloc installation])
41 - fi
42 - fi
43 -])
44 -AC_SUBST(has_tcmalloc)
45 -])
build/subst.inc deleted
-22
@@ -1,22 +0,0 @@
1 -.in:
2 - if sed \
3 - -e 's#[@]localstatedir_POST@#$(localstatedir)#g' \
4 - -e 's#[@]sbindir_POST@#$(sbindir)#g' \
5 - -e 's#[@]pluginsdir_POST@#$(pluginsdir)#g' \
6 - -e 's#[@]configdir_POST@#$(configdir)#g' \
7 - -e 's#[@]libconfigdir_POST@#$(libconfigdir)#g' \
8 - -e 's#[@]pkglibexecdir_POST@#$(pkglibexecdir)#g' \
9 - -e 's#[@]cachedir_POST@#$(cachedir)#g' \
10 - -e 's#[@]registrydir_POST@#$(registrydir)#g' \
11 - -e 's#[@]varlibdir_POST@#$(varlibdir)#g' \
12 - -e 's#[@]webdir_POST@#$(webdir)#g' \
13 - -e 's#[@]libsysdir_POST@#$(libsysdir)#g' \
14 - -e 's#[@]enable_aclk_POST@#$(enable_aclk)#g' \
15 - -e 's#[@]enable_cloud_POST@#$(enable_cloud)#g' \
16 - -e 's#[@]netdata_user_POST@#$(netdata_user)#g' \
17 - $< > $@.tmp; then \
18 - mv "$@.tmp" "$@"; \
19 - else \
20 - rm -f "$@.tmp"; \
21 - false; \
22 - fi