diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:07 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2022-01-08 11:51:07 +0100 |
commit | be8efac78d067c138ad8dda03df4336e73f94887 (patch) | |
tree | 5f5254a628ba0ef72065b93d949d1c985742ea8e /gnulib-m4 | |
parent | 7b65dbd4ebade81d504cfe5e681292a58ad1fdf0 (diff) |
New upstream version 1.0upstream/1.0
Diffstat (limited to 'gnulib-m4')
189 files changed, 10885 insertions, 3461 deletions
diff --git a/gnulib-m4/00gnulib.m4 b/gnulib-m4/00gnulib.m4 index bd24796a..dea34e83 100644 --- a/gnulib-m4/00gnulib.m4 +++ b/gnulib-m4/00gnulib.m4 @@ -1,43 +1,82 @@ -# 00gnulib.m4 serial 3 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. +# 00gnulib.m4 serial 8 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl This file must be named something that sorts before all other -dnl gnulib-provided .m4 files. It is needed until such time as we can -dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE and -dnl m4_divert semantics. +dnl gnulib-provided .m4 files. It is needed until the clang fix has +dnl been included in Autoconf. -# Until autoconf 2.63, handling of the diversion stack required m4_init -# to be called first; but this does not happen with aclocal. Wrapping -# the entire execution in another layer of the diversion stack fixes this. -# Worse, prior to autoconf 2.62, m4_wrap depended on the underlying m4 -# for whether it was FIFO or LIFO; in order to properly balance with -# m4_init, we need to undo our push just before anything wrapped within -# the m4_init body. The way to ensure this is to wrap both sides of -# m4_init with a one-shot macro that does the pop at the right time. -m4_ifndef([_m4_divert_diversion], -[m4_divert_push([KILL]) -m4_define([gl_divert_fixup], [m4_divert_pop()m4_define([$0])]) -m4_define([m4_init], - [gl_divert_fixup()]m4_defn([m4_init])[gl_divert_fixup()])]) - - -# AC_DEFUN_ONCE([NAME], VALUE) -# ---------------------------- -# Define NAME to expand to VALUE on the first use (whether by direct -# expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. -# Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This -# definition is slower than the version in Autoconf 2.64, because it -# can only use interfaces that existed since 2.59; but it achieves the -# same effect. Quoting is necessary to avoid confusing Automake. -m4_version_prereq([2.63.263], [], -[m4_define([AC][_DEFUN_ONCE], - [AC][_DEFUN([$1], - [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], - [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl -[AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) +# The following definitions arrange to use a compiler option +# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the +# compiler is clang. Without it, clang implicitly declares "known" +# library functions in C mode, but not in C++ mode, which would cause +# Gnulib to omit a declaration and thus later produce an error in C++ +# mode. As of clang 9.0, these "known" functions are identified through +# LIBBUILTIN invocations in the LLVM source file +# llvm/tools/clang/include/clang/Basic/Builtins.def. +# It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL, +# because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed +# to AC_REQUIRE anything: some configure.ac files have their first +# AC_CHECK_DECL executed conditionally. Therefore append the extra tests +# to AC_PROG_CC. +AC_DEFUN([gl_COMPILER_CLANG], +[ +dnl AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([whether the compiler is clang], + [gl_cv_compiler_clang], + [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error + dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has + dnl not yet been invoked. + _AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __clang__ + barfbarf + #endif + ]],[[]]) + ], + [gl_cv_compiler_clang=no], + [gl_cv_compiler_clang=yes]) + ]) +]) +AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL], +[ +dnl AC_REQUIRE([AC_PROG_CC]) +dnl AC_REQUIRE([gl_COMPILER_CLANG]) + AC_CACHE_CHECK([for compiler option needed when checking for declarations], + [gl_cv_compiler_check_decl_option], + [if test $gl_cv_compiler_clang = yes; then + dnl Test whether the compiler supports the option + dnl '-Werror=implicit-function-declaration'. + save_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=implicit-function-declaration" + dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a + dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], + [gl_cv_compiler_check_decl_option=none]) + ac_compile="$save_ac_compile" + else + gl_cv_compiler_check_decl_option=none + fi + ]) + if test "x$gl_cv_compiler_check_decl_option" != xnone; then + ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" + else + ac_compile_for_check_decl="$ac_compile" + fi +]) +dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl +dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC +dnl in zzgnulib.m4 is inactive, use the original ac_compile. +m4_define([_AC_CHECK_DECL_BODY], +[ ac_save_ac_compile="$ac_compile" + if test -n "$ac_compile_for_check_decl"; then + ac_compile="$ac_compile_for_check_decl" + fi] +m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" +]) # gl_00GNULIB # ----------- diff --git a/gnulib-m4/absolute-header.m4 b/gnulib-m4/absolute-header.m4 index 4e67e5fa..67d6507c 100644 --- a/gnulib-m4/absolute-header.m4 +++ b/gnulib-m4/absolute-header.m4 @@ -1,5 +1,5 @@ -# absolute-header.m4 serial 16 -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +# absolute-header.m4 serial 17 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,23 +22,21 @@ dnl From Derek Price. AC_DEFUN([gl_ABSOLUTE_HEADER], [AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_PREPROC_REQUIRE()dnl -dnl FIXME: gl_absolute_header and ac_header_exists must be used unquoted -dnl until we can assume autoconf 2.64 or newer. m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_absolute_header], [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], - m4_defn([gl_absolute_header]), + [gl_absolute_header], [AS_VAR_PUSHDEF([ac_header_exists], [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl - if test AS_VAR_GET(ac_header_exists) = yes; then + if test AS_VAR_GET([ac_header_exists]) = yes; then gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) fi AS_VAR_POPDEF([ac_header_exists])dnl ])dnl AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), - ["AS_VAR_GET(gl_absolute_header)"], + ["AS_VAR_GET([gl_absolute_header])"], [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) AS_VAR_POPDEF([gl_absolute_header])dnl ])dnl diff --git a/gnulib-m4/alloca.m4 b/gnulib-m4/alloca.m4 index b9d94e89..dc6f47e3 100644 --- a/gnulib-m4/alloca.m4 +++ b/gnulib-m4/alloca.m4 @@ -1,5 +1,5 @@ -# alloca.m4 serial 14 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2018 Free Software Foundation, +# alloca.m4 serial 21 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,30 +26,35 @@ AC_DEFUN([gl_FUNC_ALLOCA], AC_DEFINE([HAVE_ALLOCA], [1], [Define to 1 if you have 'alloca' after including <alloca.h>, a header that may be supplied by this distribution.]) - ALLOCA_H=alloca.h + GL_GENERATE_ALLOCA_H=true else dnl alloca exists as a library function, i.e. it is slow and probably dnl a memory leak. Don't define HAVE_ALLOCA in this case. - ALLOCA_H= + GL_GENERATE_ALLOCA_H=false fi else - ALLOCA_H=alloca.h + GL_GENERATE_ALLOCA_H=true fi - AC_SUBST([ALLOCA_H]) - AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) + + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi + AC_SUBST([HAVE_ALLOCA_H]) ]) # Prerequisites of lib/alloca.c. # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. AC_DEFUN([gl_PREREQ_ALLOCA], [:]) -# This works around a bug in autoconf <= 2.68. -# See <https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html>. +m4_version_prereq([2.70], [], [ -m4_version_prereq([2.69], [] ,[ - -# This is taken from the following Autoconf patch: -# https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6cd9f12520b0d6f76d3230d7565feba1ecf29497 +# This works around a bug in autoconf <= 2.68 and has simplifications +# from 2.70. See: +# https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a # _AC_LIBOBJ_ALLOCA # ----------------- @@ -65,26 +70,6 @@ AC_LIBSOURCES(alloca.c) AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) -AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray, -[AC_EGREP_CPP(webecray, -[#if defined CRAY && ! defined CRAY2 -webecray -#else -wenotbecray -#endif -], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) -if test $ac_cv_os_cray = yes; then - for ac_func in _getb67 GETB67 getb67; do - AC_CHECK_FUNC($ac_func, - [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, - [Define to one of '_getb67', 'GETB67', - 'getb67' for Cray-2 and Cray-YMP - systems. This function is required for - 'alloca.c' support on those systems.]) - break]) - done -fi - AC_CACHE_CHECK([stack direction for C alloca], [ac_cv_c_stack_direction], [AC_RUN_IFELSE([AC_LANG_SOURCE( @@ -115,7 +100,7 @@ AH_VERBATIM([STACK_DIRECTION], STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ -@%:@undef STACK_DIRECTION])dnl +#undef STACK_DIRECTION])dnl AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) ])# _AC_LIBOBJ_ALLOCA ]) diff --git a/gnulib-m4/arpa_inet_h.m4 b/gnulib-m4/arpa_inet_h.m4 new file mode 100644 index 00000000..057e13fc --- /dev/null +++ b/gnulib-m4/arpa_inet_h.m4 @@ -0,0 +1,74 @@ +# arpa_inet_h.m4 serial 17 +dnl Copyright (C) 2006, 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Simon Josefsson and Bruno Haible + +AC_DEFUN_ONCE([gl_ARPA_INET_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + + AC_CHECK_HEADERS_ONCE([arpa/inet.h]) + if test $ac_cv_header_arpa_inet_h = yes; then + HAVE_ARPA_INET_H=1 + else + HAVE_ARPA_INET_H=0 + fi + AC_SUBST([HAVE_ARPA_INET_H]) + dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([arpa/inet.h]) + + AC_REQUIRE([gl_FEATURES_H]) + + gl_PREREQ_SYS_H_WS2TCPIP + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* On some systems, this header is not self-consistent. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) +# include <sys/socket.h> +#endif +#ifdef __TANDEM +# include <netdb.h> +#endif +#include <arpa/inet.h> + ]], [inet_ntop inet_pton]) +]) + +# gl_ARPA_INET_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_ARPA_INET_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_NTOP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_INET_PTON]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_ARPA_INET_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) +]) + +AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) + HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) + REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) + REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) +]) diff --git a/gnulib-m4/asm-underscore.m4 b/gnulib-m4/asm-underscore.m4 deleted file mode 100644 index 58a5299c..00000000 --- a/gnulib-m4/asm-underscore.m4 +++ /dev/null @@ -1,72 +0,0 @@ -# asm-underscore.m4 serial 4 -dnl Copyright (C) 2010-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp. - -# gl_ASM_SYMBOL_PREFIX -# Tests for the prefix of C symbols at the assembly language level and the -# linker level. This prefix is either an underscore or empty. Defines the -# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to -# a stringified variant of this prefix. - -AC_DEFUN([gl_ASM_SYMBOL_PREFIX], -[ - AC_REQUIRE([AC_PROG_EGREP]) - dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because - dnl 1. It works only for GCC. - dnl 2. It is incorrectly defined on some platforms, in some GCC versions. - AC_REQUIRE([gl_C_ASM]) - AC_CACHE_CHECK( - [whether C symbols are prefixed with underscore at the linker level], - [gl_cv_prog_as_underscore], - [cat > conftest.c <<EOF -#ifdef __cplusplus -extern "C" int foo (void); -#endif -int foo(void) { return 0; } -EOF - # Look for the assembly language name in the .s file. - AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 - if LC_ALL=C $EGREP '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then - gl_cv_prog_as_underscore=yes - else - gl_cv_prog_as_underscore=no - fi - rm -f conftest* - ]) - if test $gl_cv_prog_as_underscore = yes; then - USER_LABEL_PREFIX=_ - else - USER_LABEL_PREFIX= - fi - AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX], - [Define to the prefix of C symbols at the assembler and linker level, - either an underscore or empty.]) - ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' - AC_SUBST([ASM_SYMBOL_PREFIX]) -]) - -# gl_C_ASM -# Determines how to produce an assembly language file from C source code. -# Sets the variables: -# gl_asmext - the extension of assembly language output, -# gl_c_asm_opt - the C compiler option that produces assembly language output. - -AC_DEFUN([gl_C_ASM], -[ - AC_EGREP_CPP([MicrosoftCompiler], - [ -#ifdef _MSC_VER -MicrosoftCompiler -#endif - ], - [gl_asmext='asm' - gl_c_asm_opt='-c -Fa' - ], - [gl_asmext='s' - gl_c_asm_opt='-S' - ]) -]) diff --git a/gnulib-m4/btowc.m4 b/gnulib-m4/btowc.m4 index 8acdffc5..45a61f5e 100644 --- a/gnulib-m4/btowc.m4 +++ b/gnulib-m4/btowc.m4 @@ -1,5 +1,5 @@ -# btowc.m4 serial 11 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +# btowc.m4 serial 12 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -28,14 +28,6 @@ AC_DEFUN([gl_FUNC_BTOWC], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -79,14 +71,7 @@ changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> #include <stdio.h> -#include <time.h> #include <wchar.h> int main () { diff --git a/gnulib-m4/builtin-expect.m4 b/gnulib-m4/builtin-expect.m4 index a1eaf965..b1fb12a3 100644 --- a/gnulib-m4/builtin-expect.m4 +++ b/gnulib-m4/builtin-expect.m4 @@ -1,6 +1,6 @@ dnl Check for __builtin_expect. -dnl Copyright 2016-2018 Free Software Foundation, Inc. +dnl Copyright 2016-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/calloc.m4 b/gnulib-m4/calloc.m4 new file mode 100644 index 00000000..c01520e5 --- /dev/null +++ b/gnulib-m4/calloc.m4 @@ -0,0 +1,83 @@ +# calloc.m4 serial 29 + +# Copyright (C) 2004-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Jim Meyering. + +# Determine whether calloc (N, S) returns non-NULL when N*S is zero, +# and returns NULL when N*S overflows. +# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc +# and arrange to use a calloc wrapper function that does work in that case. + +# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) +# ------------------------------------- +# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. +AC_DEFUN([_AC_FUNC_CALLOC_IF], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], + [ac_cv_func_calloc_0_nonnull], + [if test $cross_compiling != yes; then + ac_cv_func_calloc_0_nonnull=yes + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[int result = 0; + char * volatile p = calloc (0, 0); + if (!p) + result |= 1; + free (p); + return result; + ]])], + [], + [ac_cv_func_calloc_0_nonnull=no]) + else + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on native Windows. + mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + fi + ]) + AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) +]) + + +# gl_FUNC_CALLOC_GNU +# ------------------ +# Replace calloc if it is not compatible with GNU libc. +AC_DEFUN([gl_FUNC_CALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) + REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" + if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then + _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) + fi +])# gl_FUNC_CALLOC_GNU + +# gl_FUNC_CALLOC_POSIX +# -------------------- +# Test whether 'calloc' is POSIX compliant (sets errno to ENOMEM when it +# fails, and doesn't mess up with ptrdiff_t or size_t overflow), +# and replace calloc if it is not. +AC_DEFUN([gl_FUNC_CALLOC_POSIX], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then + REPLACE_CALLOC_FOR_CALLOC_POSIX=1 + fi + dnl Although in theory we should also test for size_t overflow, + dnl in practice testing for ptrdiff_t overflow suffices + dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. + dnl A separate size_t test would slow down 'configure'. +]) diff --git a/gnulib-m4/close.m4 b/gnulib-m4/close.m4 new file mode 100644 index 00000000..f95dbc9d --- /dev/null +++ b/gnulib-m4/close.m4 @@ -0,0 +1,35 @@ +# close.m4 serial 9 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_CLOSE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + m4_ifdef([gl_MSVC_INVAL], [ + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi + ]) + m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ + gl_PREREQ_SYS_H_WINSOCK2 + if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then + dnl Even if the 'socket' module is not used here, another part of the + dnl application may use it and pass file descriptors that refer to + dnl sockets to the close() function. So enable the support for sockets. + REPLACE_CLOSE=1 + fi + ]) + dnl Replace close() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_CLOSE = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_CLOSE=1 + fi + fi + ]) +]) diff --git a/gnulib-m4/codeset.m4 b/gnulib-m4/codeset.m4 index bc98201e..eb732601 100644 --- a/gnulib-m4/codeset.m4 +++ b/gnulib-m4/codeset.m4 @@ -1,6 +1,6 @@ # codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016 Free Software Foundation, -dnl Inc. +dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2022 Free Software +dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/configmake.m4 b/gnulib-m4/configmake.m4 deleted file mode 100644 index e0b5835b..00000000 --- a/gnulib-m4/configmake.m4 +++ /dev/null @@ -1,55 +0,0 @@ -# configmake.m4 serial 2 -dnl Copyright (C) 2010-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# gl_CONFIGMAKE_PREP -# ------------------ -# Guarantee all of the standard directory variables, even when used with -# autoconf 2.59 (datarootdir wasn't supported until 2.59c, and runstatedir -# in 2.70) or automake 1.9.6 (pkglibexecdir wasn't supported until 1.10b, -# and runstatedir in 1.14.1). -AC_DEFUN([gl_CONFIGMAKE_PREP], -[ - dnl Technically, datadir should default to datarootdir. But if - dnl autoconf is too old to provide datarootdir, then reversing the - dnl definition is a reasonable compromise. Only AC_SUBST a variable - dnl if it was not already defined earlier by autoconf. - if test "x$datarootdir" = x; then - AC_SUBST([datarootdir], ['${datadir}']) - fi - dnl Copy the approach used in autoconf 2.60. - if test "x$docdir" = x; then - AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME], - ['${datarootdir}/doc/${PACKAGE_TARNAME}'], - ['${datarootdir}/doc/${PACKAGE}'])]) - fi - dnl The remaining variables missing from autoconf 2.59 are easier. - if test "x$htmldir" = x; then - AC_SUBST([htmldir], ['${docdir}']) - fi - if test "x$dvidir" = x; then - AC_SUBST([dvidir], ['${docdir}']) - fi - if test "x$pdfdir" = x; then - AC_SUBST([pdfdir], ['${docdir}']) - fi - if test "x$psdir" = x; then - AC_SUBST([psdir], ['${docdir}']) - fi - if test "x$lispdir" = x; then - AC_SUBST([lispdir], ['${datarootdir}/emacs/site-lisp']) - fi - if test "x$localedir" = x; then - AC_SUBST([localedir], ['${datarootdir}/locale']) - fi - dnl Added in autoconf 2.70 - if test "x$runstatedir" = x; then - AC_SUBST([runstatedir], ['${localstatedir}/run']) - fi - - dnl Automake 1.9.6 only lacks pkglibexecdir; and since 1.11 merely - dnl provides it without AC_SUBST, this blind use of AC_SUBST is safe. - AC_SUBST([pkglibexecdir], ['${libexecdir}/${PACKAGE}']) -]) diff --git a/gnulib-m4/ctype.m4 b/gnulib-m4/ctype.m4 deleted file mode 100644 index 85a7e3e6..00000000 --- a/gnulib-m4/ctype.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# ctype_h.m4 serial 6 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_CTYPE_H], -[ - AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) - - dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK. - gl_NEXT_HEADERS([ctype.h]) - - dnl Check for declarations of anything we want to poison if the - dnl corresponding gnulib module is not in use. - gl_WARN_ON_USE_PREPARE([[#include <ctype.h> - ]], [isblank]) -]) - -AC_DEFUN([gl_CTYPE_MODULE_INDICATOR], -[ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) - gl_MODULE_INDICATOR_SET_VARIABLE([$1]) -]) - -AC_DEFUN([gl_CTYPE_H_DEFAULTS], -[ - GNULIB_ISBLANK=0; AC_SUBST([GNULIB_ISBLANK]) - dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_ISBLANK=1; AC_SUBST([HAVE_ISBLANK]) -]) diff --git a/gnulib-m4/ctype_h.m4 b/gnulib-m4/ctype_h.m4 new file mode 100644 index 00000000..6f420de3 --- /dev/null +++ b/gnulib-m4/ctype_h.m4 @@ -0,0 +1,47 @@ +# ctype_h.m4 serial 9 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_CTYPE_H], +[ + AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) + + dnl <ctype.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_NEXT_HEADERS([ctype.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <ctype.h> + ]], [isblank]) +]) + +# gl_CTYPE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_CTYPE_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_CTYPE_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_CTYPE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISBLANK]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_CTYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_CTYPE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_CTYPE_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_ISBLANK=1; AC_SUBST([HAVE_ISBLANK]) +]) diff --git a/gnulib-m4/dirname.m4 b/gnulib-m4/dirname.m4 deleted file mode 100644 index 820b0478..00000000 --- a/gnulib-m4/dirname.m4 +++ /dev/null @@ -1,19 +0,0 @@ -#serial 10 -*- autoconf -*- -dnl Copyright (C) 2002-2006, 2009-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_DIRNAME], -[ - AC_REQUIRE([gl_DIRNAME_LGPL]) -]) - -AC_DEFUN([gl_DIRNAME_LGPL], -[ - dnl Prerequisites of lib/dirname.h. - AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) - - dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, - dnl lib/stripslash.c. -]) diff --git a/gnulib-m4/double-slash-root.m4 b/gnulib-m4/double-slash-root.m4 index e99d4a36..09ff5f0d 100644 --- a/gnulib-m4/double-slash-root.m4 +++ b/gnulib-m4/double-slash-root.m4 @@ -1,5 +1,5 @@ # double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/dup2.m4 b/gnulib-m4/dup2.m4 new file mode 100644 index 00000000..7e777cde --- /dev/null +++ b/gnulib-m4/dup2.m4 @@ -0,0 +1,105 @@ +#serial 27 +dnl Copyright (C) 2002, 2005, 2007, 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_DUP2], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], + [AC_RUN_IFELSE([ + AC_LANG_PROGRAM( + [[#include <errno.h> + #include <fcntl.h> + #include <limits.h> + #include <sys/resource.h> + #include <unistd.h> + ]GL_MDA_DEFINES[ + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + close (fd); + } + return result;]]) + ], + [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], + [case "$host_os" in + mingw*) # on this platform, dup2 always returns 0 for success + gl_cv_func_dup2_works="guessing no" ;; + cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 + gl_cv_func_dup2_works="guessing no" ;; + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. + gl_cv_func_dup2_works="guessing no" ;; + haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. + gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; + *) gl_cv_func_dup2_works="guessing yes" ;; + esac]) + ]) + case "$gl_cv_func_dup2_works" in + *yes) ;; + *) + REPLACE_DUP2=1 + AC_CHECK_FUNCS([setdtablesize]) + ;; + esac + dnl Replace dup2() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_DUP2=1 + fi + ]) +]) + +# Prerequisites of lib/dup2.c. +AC_DEFUN([gl_PREREQ_DUP2], []) diff --git a/gnulib-m4/eealloc.m4 b/gnulib-m4/eealloc.m4 index a5a4e267..a6aa2f88 100644 --- a/gnulib-m4/eealloc.m4 +++ b/gnulib-m4/eealloc.m4 @@ -1,5 +1,5 @@ # eealloc.m4 serial 3 -dnl Copyright (C) 2003, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/environ.m4 b/gnulib-m4/environ.m4 index 68b67eac..583dac39 100644 --- a/gnulib-m4/environ.m4 +++ b/gnulib-m4/environ.m4 @@ -1,5 +1,5 @@ -# environ.m4 serial 6 -dnl Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc. +# environ.m4 serial 8 +dnl Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -29,16 +29,15 @@ AC_DEFUN_ONCE([gl_ENVIRON], AC_DEFUN([gt_CHECK_VAR_DECL], [ define([gt_cv_var], [gt_cv_var_]$2[_declaration]) - AC_MSG_CHECKING([if $2 is properly declared]) - AC_CACHE_VAL([gt_cv_var], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[$1 - extern struct { int foo; } $2;]], - [[$2.foo = 1;]])], - [gt_cv_var=no], - [gt_cv_var=yes])]) - AC_MSG_RESULT([$gt_cv_var]) + AC_CACHE_CHECK([if $2 is properly declared], [gt_cv_var], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[$1 + typedef struct { int foo; } foo_t; + extern foo_t $2;]], + [[$2.foo = 1;]])], + [gt_cv_var=no], + [gt_cv_var=yes])]) if test $gt_cv_var = yes; then AC_DEFINE([HAVE_]m4_translit($2, [a-z], [A-Z])[_DECL], 1, [Define if you have the declaration of $2.]) diff --git a/gnulib-m4/errno_h.m4 b/gnulib-m4/errno_h.m4 index 9dbdedd5..4be9780a 100644 --- a/gnulib-m4/errno_h.m4 +++ b/gnulib-m4/errno_h.m4 @@ -1,9 +1,11 @@ -# errno_h.m4 serial 12 -dnl Copyright (C) 2004, 2006, 2008-2018 Free Software Foundation, Inc. +# errno_h.m4 serial 14 +dnl Copyright (C) 2004, 2006, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +AC_PREREQ([2.61]) + AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) @@ -66,13 +68,11 @@ booboo [gl_cv_header_errno_h_complete=yes]) ]) if test $gl_cv_header_errno_h_complete = yes; then - ERRNO_H='' + GL_GENERATE_ERRNO_H=false else gl_NEXT_HEADERS([errno.h]) - ERRNO_H='errno.h' + GL_GENERATE_ERRNO_H=true fi - AC_SUBST([ERRNO_H]) - AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) gl_REPLACE_ERRNO_VALUE([ENOLINK]) gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) @@ -86,7 +86,7 @@ booboo # Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. AC_DEFUN([gl_REPLACE_ERRNO_VALUE], [ - if test -n "$ERRNO_H"; then + if $GL_GENERATE_ERRNO_H; then AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ AC_EGREP_CPP([yes],[ #include <errno.h> @@ -129,9 +129,3 @@ yes AC_SUBST($1[_VALUE]) fi ]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff --git a/gnulib-m4/error.m4 b/gnulib-m4/error.m4 index 280fdcea..7a103446 100644 --- a/gnulib-m4/error.m4 +++ b/gnulib-m4/error.m4 @@ -1,6 +1,6 @@ -#serial 14 +#serial 15 -# Copyright (C) 1996-1998, 2001-2004, 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-1998, 2001-2004, 2009-2022 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -22,6 +22,10 @@ AC_DEFUN([gl_ERROR], # Prerequisites of lib/error.c. AC_DEFUN([gl_PREREQ_ERROR], [ + dnl Use system extensions on Android, so that AC_FUNC_STRERROR_R + dnl discovers the GNU API for strerror_r on Android API level 23 and later. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_FUNC_STRERROR_R]) : ]) diff --git a/gnulib-m4/exponentd.m4 b/gnulib-m4/exponentd.m4 index 7b02a4c2..83ac08bf 100644 --- a/gnulib-m4/exponentd.m4 +++ b/gnulib-m4/exponentd.m4 @@ -1,5 +1,5 @@ # exponentd.m4 serial 3 -dnl Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/exponentf.m4 b/gnulib-m4/exponentf.m4 index b259b911..32fdb6a2 100644 --- a/gnulib-m4/exponentf.m4 +++ b/gnulib-m4/exponentf.m4 @@ -1,5 +1,5 @@ # exponentf.m4 serial 2 -dnl Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2008, 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/exponentl.m4 b/gnulib-m4/exponentl.m4 index 136fa61e..653ad5a9 100644 --- a/gnulib-m4/exponentl.m4 +++ b/gnulib-m4/exponentl.m4 @@ -1,5 +1,5 @@ -# exponentl.m4 serial 4 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# exponentl.m4 serial 5 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,14 +22,14 @@ typedef union { long double value; unsigned int word[NWORDS]; } memory_long_double; static unsigned int ored_words[NWORDS]; static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (long double x) +static void add_to_ored_words (long double *x) { memory_long_double m; size_t i; /* Clear it first, in case sizeof (long double) < sizeof (memory_long_double). */ memset (&m, 0, sizeof (memory_long_double)); - m.value = x; + m.value = *x; for (i = 0; i < NWORDS; i++) { ored_words[i] |= m.word[i]; @@ -38,17 +38,15 @@ static void add_to_ored_words (long double x) } int main () { + static long double samples[5] = { 0.25L, 0.5L, 1.0L, 2.0L, 4.0L }; size_t j; FILE *fp = fopen ("conftest.out", "w"); if (fp == NULL) return 1; for (j = 0; j < NWORDS; j++) anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25L); - add_to_ored_words (0.5L); - add_to_ored_words (1.0L); - add_to_ored_words (2.0L); - add_to_ored_words (4.0L); + for (j = 0; j < 5; j++) + add_to_ored_words (&samples[j]); /* Remove bits that are common (e.g. if representation of the first mantissa bit is explicit). */ for (j = 0; j < NWORDS; j++) diff --git a/gnulib-m4/extensions.m4 b/gnulib-m4/extensions.m4 index 71a854f8..0b3e4b5a 100644 --- a/gnulib-m4/extensions.m4 +++ b/gnulib-m4/extensions.m4 @@ -1,14 +1,19 @@ -# serial 18 -*- Autoconf -*- +# serial 22 -*- Autoconf -*- # Enable extensions on systems that normally disable them. -# Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006-2022 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that +dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. +m4_ifndef([AC_CHECK_INCLUDES_DEFAULT], + [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])]) + # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git # Autoconf. Perhaps we can remove this once we can assume Autoconf -# 2.70 or later everywhere, but since Autoconf mutates rapidly +# is recent-enough everywhere, but since Autoconf mutates rapidly # enough in this area it's likely we'll need to redefine # AC_USE_SYSTEM_EXTENSIONS for quite some time. @@ -26,36 +31,27 @@ # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS # invocation occurs in gl_EARLY, not in gl_INIT. +m4_version_prereq([2.70.1], [], [ + # AC_USE_SYSTEM_EXTENSIONS # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. -# -# Remember that #undef in AH_VERBATIM gets replaced with #define by -# AC_DEFINE. The goal here is to define all known feature-enabling -# macros, then, if reports of conflicts are made, disable macros that -# cause problems on some platforms (such as __EXTENSIONS__). +# We unconditionally define as many of the known feature-enabling +# as possible, reserving conditional behavior for macros that are +# known to cause problems on some platforms (such as __EXTENSIONS__). AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], -[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +[AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl +AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_LINK_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) - if test "$MINIX" = yes; then - AC_DEFINE([_POSIX_SOURCE], [1], - [Define to 1 if you need to in order for 'stat' and other - things to work.]) - AC_DEFINE([_POSIX_1_SOURCE], [2], - [Define to 2 if the system does not provide POSIX.1 features - except with this defined.]) - AC_DEFINE([_MINIX], [1], - [Define to 1 if on MINIX.]) - AC_DEFINE([_NETBSD_SOURCE], [1], - [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) - fi - +AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl +dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE. dnl Use a different key than __EXTENSIONS__, as that name broke existing dnl configure.ac when using autoheader 2.62. - AH_VERBATIM([USE_SYSTEM_EXTENSIONS], +dnl The macros below are in alphabetical order ignoring leading _ or __ +dnl prefixes. +AH_VERBATIM([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE @@ -64,19 +60,44 @@ dnl configure.ac when using autoheader 2.62. #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif -/* Enable NetBSD extensions on NetBSD. */ +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ #ifndef _NETBSD_SOURCE # undef _NETBSD_SOURCE #endif -/* Enable OpenBSD extensions on NetBSD. */ +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ #ifndef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE #endif -/* Enable threading extensions on Solaris. */ +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif @@ -112,22 +133,19 @@ dnl configure.ac when using autoheader 2.62. #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif -/* Enable X/Open extensions if necessary. HP-UX 11.11 defines - mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of - whether compiling with -Ae or -D_HPUX_SOURCE=1. */ +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ #ifndef _XOPEN_SOURCE # undef _XOPEN_SOURCE #endif -/* Enable X/Open compliant socket functions that do not require linking - with -lxnet on HP-UX 11.11. */ -#ifndef _HPUX_ALT_XOPEN_SOCKET_API -# undef _HPUX_ALT_XOPEN_SOCKET_API -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif -]) +])dnl + + AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl + _AC_CHECK_HEADER_ONCE([wchar.h]) + _AC_CHECK_HEADER_ONCE([minix/config.h]) + +dnl Defining __EXTENSIONS__ may break the system headers on some systems. +dnl (FIXME: Which ones?) AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], [ac_cv_safe_to_define___extensions__], [AC_COMPILE_IFELSE( @@ -136,11 +154,33 @@ dnl configure.ac when using autoheader 2.62. ]AC_INCLUDES_DEFAULT])], [ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=no])]) - test $ac_cv_safe_to_define___extensions__ = yes && - AC_DEFINE([__EXTENSIONS__]) + +dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to +dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. +dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms +dnl not covered by turn-on-extensions macros (notably Dragonfly, Free, +dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so +dnl it should only be defined when necessary. + AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], + [ac_cv_should_define__xopen_source], + [ac_cv_should_define__xopen_source=no + AS_IF([test $ac_cv_header_wchar_h = yes], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include <wchar.h> + mbstate_t x;]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 500 + #include <wchar.h> + mbstate_t x;]])], + [ac_cv_should_define__xopen_source=yes])])])]) + AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) AC_DEFINE([_NETBSD_SOURCE]) AC_DEFINE([_OPENBSD_SOURCE]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) @@ -152,24 +192,18 @@ dnl configure.ac when using autoheader 2.62. AC_DEFINE([__STDC_WANT_LIB_EXT2__]) AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) AC_DEFINE([_TANDEM_SOURCE]) - AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], - [ac_cv_should_define__xopen_source], - [ac_cv_should_define__xopen_source=no - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #include <wchar.h> - mbstate_t x;]])], - [], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #define _XOPEN_SOURCE 500 - #include <wchar.h> - mbstate_t x;]])], - [ac_cv_should_define__xopen_source=yes])])]) - test $ac_cv_should_define__xopen_source = yes && - AC_DEFINE([_XOPEN_SOURCE], [500]) - AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) + AS_IF([test $ac_cv_header_minix_config_h = yes], + [MINIX=yes + AC_DEFINE([_MINIX]) + AC_DEFINE([_POSIX_SOURCE]) + AC_DEFINE([_POSIX_1_SOURCE], [2])], + [MINIX=]) + AS_IF([test $ac_cv_safe_to_define___extensions__ = yes], + [AC_DEFINE([__EXTENSIONS__])]) + AS_IF([test $ac_cv_should_define__xopen_source = yes], + [AC_DEFINE([_XOPEN_SOURCE], [500])]) ])# AC_USE_SYSTEM_EXTENSIONS +]) # gl_USE_SYSTEM_EXTENSIONS # ------------------------ @@ -177,13 +211,17 @@ dnl configure.ac when using autoheader 2.62. # typically due to standards-conformance issues. AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], [ - dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. - dnl gnulib does not need it. But if it gets required by third-party macros - dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a - dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". - dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, - dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. - AC_REQUIRE([AC_GNU_SOURCE]) - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl On OpenBSD 6.8 with GCC, the include files contain a couple of + dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE. + dnl That's because this version of GCC (4.2.1) supports the option + dnl '-std=gnu99' but not the option '-std=gnu11'. + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + openbsd*) + AC_DEFINE([_ISOC11_SOURCE], [1], + [Define to enable the declarations of ISO C 11 types and functions.]) + ;; + esac ]) diff --git a/gnulib-m4/extern-inline.m4 b/gnulib-m4/extern-inline.m4 index da8a2cc0..2e914dbc 100644 --- a/gnulib-m4/extern-inline.m4 +++ b/gnulib-m4/extern-inline.m4 @@ -1,6 +1,6 @@ dnl 'extern inline' a la ISO C99. -dnl Copyright 2012-2018 Free Software Foundation, Inc. +dnl Copyright 2012-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -17,7 +17,8 @@ AC_DEFUN([gl_EXTERN_INLINE], mishandles inline functions that call each other. E.g., for 'inline void f (void) { } inline void g (void) { f (); }', c99 incorrectly complains 'reference to static identifier "f" in extern inline function'. - This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. + This bug was observed with Oracle Developer Studio 12.6 + (Sun C 5.15 SunOS_sparc 2017/05/30). Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) on configurations that mistakenly use 'static inline' to implement @@ -25,20 +26,32 @@ AC_DEFUN([gl_EXTERN_INLINE], if isdigit is mistakenly implemented via a static inline function, a program containing an extern inline function that calls isdigit may not work since the C standard prohibits extern inline functions - from calling static functions. This bug is known to occur on: + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: OS X 10.8 and earlier; see: https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html DragonFly; see - http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log FreeBSD; see: https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and for clang but remains for g++; see <https://trac.macports.org/ticket/41033>. - Assume DragonFly and FreeBSD will be similar. */ + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ #if (((defined __APPLE__ && defined __MACH__) \ || defined __DragonFly__ || defined __FreeBSD__) \ && (defined __header_inline \ @@ -71,8 +84,8 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_EXTERN_INLINE extern # define _GL_EXTERN_INLINE_IN_USE #else -# define _GL_INLINE static _GL_UNUSED -# define _GL_EXTERN_INLINE static _GL_UNUSED +# define _GL_INLINE _GL_UNUSED static +# define _GL_EXTERN_INLINE _GL_UNUSED static #endif /* In GCC 4.6 (inclusive) to 5.1 (exclusive), diff --git a/gnulib-m4/fcntl-o.m4 b/gnulib-m4/fcntl-o.m4 index 4dc3daa2..4dcde9e0 100644 --- a/gnulib-m4/fcntl-o.m4 +++ b/gnulib-m4/fcntl-o.m4 @@ -1,22 +1,20 @@ -# fcntl-o.m4 serial 5 -dnl Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. +# fcntl-o.m4 serial 7 +dnl Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. +AC_PREREQ([2.60]) + # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. AC_DEFUN([gl_FCNTL_O_FLAGS], [ dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([unistd.h]) @@ -34,6 +32,7 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], # defined sleep(n) _sleep ((n) * 1000) #endif #include <fcntl.h> + ]GL_MDA_DEFINES[ #ifndef O_NOATIME #define O_NOATIME 0 #endif diff --git a/gnulib-m4/fcntl.m4 b/gnulib-m4/fcntl.m4 new file mode 100644 index 00000000..428e5709 --- /dev/null +++ b/gnulib-m4/fcntl.m4 @@ -0,0 +1,151 @@ +# fcntl.m4 serial 11 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# For now, this module ensures that fcntl() +# - supports F_DUPFD correctly +# - supports or emulates F_DUPFD_CLOEXEC +# - supports F_GETFD +# Still to be ported to mingw: +# - F_SETFD +# - F_GETFL, F_SETFL +# - F_GETOWN, F_SETOWN +# - F_GETLK, F_SETLK, F_SETLKW +AC_DEFUN([gl_FUNC_FCNTL], +[ + dnl Persuade glibc to expose F_DUPFD_CLOEXEC. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + gl_REPLACE_FCNTL + else + dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target + dnl haiku alpha 2 F_DUPFD has wrong errno + AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], + [gl_cv_func_fcntl_f_dupfd_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <errno.h> + #include <fcntl.h> + #include <limits.h> + #include <sys/resource.h> + #include <unistd.h> + ]GL_MDA_DEFINES[ + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + + close (fd); + } + return result;]])], + [gl_cv_func_fcntl_f_dupfd_works=yes], + [gl_cv_func_fcntl_f_dupfd_works=no], + [case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; + esac])]) + case $gl_cv_func_fcntl_f_dupfd_works in + *yes) ;; + *) gl_REPLACE_FCNTL + AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD + behavior does not match POSIX]) ;; + esac + + dnl Many systems lack F_DUPFD_CLOEXEC. + dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. + AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], + [gl_cv_func_fcntl_f_dupfd_cloexec], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include <fcntl.h> + #include <unistd.h> + int main (int argc, char *argv[]) + { + if (argc == 1) + /* parent process */ + { + if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) + return 1; + return execl ("./conftest", "./conftest", "child", NULL); + } + else + /* child process */ + return (fcntl (10, F_GETFL) < 0 ? 0 : 42); + } + ]]) + ], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef __linux__ +/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace + it to support the semantics on older kernels that failed with EINVAL. */ +choke me +#endif + ]])], + [gl_cv_func_fcntl_f_dupfd_cloexec=yes], + [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"]) + ], + [gl_cv_func_fcntl_f_dupfd_cloexec=no], + [case "$host_os" in + # Guess no on NetBSD. + netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_fcntl_f_dupfd_cloexec" in + *yes) ;; + *) gl_REPLACE_FCNTL + dnl No witness macro needed for this bug. + ;; + esac + fi + dnl Replace fcntl() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_FCNTL + fi + ]) +]) + +AC_DEFUN([gl_REPLACE_FCNTL], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi +]) diff --git a/gnulib-m4/fcntl_h.m4 b/gnulib-m4/fcntl_h.m4 new file mode 100644 index 00000000..267f98bf --- /dev/null +++ b/gnulib-m4/fcntl_h.m4 @@ -0,0 +1,70 @@ +# serial 20 +# Configure fcntl.h. +dnl Copyright (C) 2006-2007, 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +AC_DEFUN_ONCE([gl_FCNTL_H], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) + gl_NEXT_HEADERS([fcntl.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> + ]], [fcntl openat]) +]) + +# gl_FCNTL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_FCNTL_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) +]) + +AC_DEFUN([gl_FCNTL_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) + HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) + REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) + REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) + REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) +]) diff --git a/gnulib-m4/fdopen.m4 b/gnulib-m4/fdopen.m4 index bff80ab0..32e0e1d8 100644 --- a/gnulib-m4/fdopen.m4 +++ b/gnulib-m4/fdopen.m4 @@ -1,5 +1,5 @@ -# fdopen.m4 serial 4 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# fdopen.m4 serial 5 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -22,6 +22,7 @@ AC_DEFUN([gl_FUNC_FDOPEN], [AC_LANG_SOURCE([[ #include <stdio.h> #include <errno.h> +]GL_MDA_DEFINES[ int main (void) { diff --git a/gnulib-m4/flexmember.m4 b/gnulib-m4/flexmember.m4 index db93cf35..3b4237e9 100644 --- a/gnulib-m4/flexmember.m4 +++ b/gnulib-m4/flexmember.m4 @@ -1,7 +1,7 @@ # serial 5 # Check for flexible array member support. -# Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -34,12 +34,10 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [], [Define to nothing if C supports flexible array members, and to 1 if it does not. That way, with a declaration like 'struct s - { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack + { int n; short d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack can be used with pre-C99 compilers. - When computing the size of such an object, don't use 'sizeof (struct s)' - as it overestimates the size. Use 'offsetof (struct s, d)' instead. - Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with - MSVC and with C++ compilers.]) + Use 'FLEXSIZEOF (struct s, d, N * sizeof (short))' to calculate + the size in bytes of such a struct containing an N-element array.]) else AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [1]) fi diff --git a/gnulib-m4/float_h.m4 b/gnulib-m4/float_h.m4 index 02beb853..0e845726 100644 --- a/gnulib-m4/float_h.m4 +++ b/gnulib-m4/float_h.m4 @@ -1,5 +1,5 @@ -# float_h.m4 serial 12 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +# float_h.m4 serial 13 +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,18 +8,18 @@ AC_DEFUN([gl_FLOAT_H], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) - FLOAT_H= + GL_GENERATE_FLOAT_H=false REPLACE_FLOAT_LDBL=0 case "$host_os" in aix* | beos* | openbsd* | mirbsd* | irix*) - FLOAT_H=float.h + GL_GENERATE_FLOAT_H=true ;; freebsd* | dragonfly*) case "$host_cpu" in changequote(,)dnl i[34567]86 ) changequote([,])dnl - FLOAT_H=float.h + GL_GENERATE_FLOAT_H=true ;; x86_64 ) # On x86_64 systems, the C compiler may still be generating @@ -33,21 +33,21 @@ changequote([,])dnl #endif ]])], [], - [FLOAT_H=float.h]) + [GL_GENERATE_FLOAT_H=true]) ;; esac ;; linux*) case "$host_cpu" in powerpc*) - FLOAT_H=float.h + GL_GENERATE_FLOAT_H=true ;; esac ;; esac case "$host_os" in aix* | freebsd* | dragonfly* | linux*) - if test -n "$FLOAT_H"; then + if $GL_GENERATE_FLOAT_H; then REPLACE_FLOAT_LDBL=1 fi ;; @@ -95,14 +95,12 @@ int main () REPLACE_ITOLD=1 dnl We add the workaround to <float.h> but also to <math.h>, dnl to increase the chances that the fix function gets pulled in. - FLOAT_H=float.h + GL_GENERATE_FLOAT_H=true ;; esac - if test -n "$FLOAT_H"; then + if $GL_GENERATE_FLOAT_H; then gl_NEXT_HEADERS([float.h]) fi - AC_SUBST([FLOAT_H]) - AM_CONDITIONAL([GL_GENERATE_FLOAT_H], [test -n "$FLOAT_H"]) AC_SUBST([REPLACE_ITOLD]) ]) diff --git a/gnulib-m4/fpieee.m4 b/gnulib-m4/fpieee.m4 index b58840f7..c0c23e95 100644 --- a/gnulib-m4/fpieee.m4 +++ b/gnulib-m4/fpieee.m4 @@ -1,5 +1,5 @@ # fpieee.m4 serial 2 -*- coding: utf-8 -*- -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/free.m4 b/gnulib-m4/free.m4 new file mode 100644 index 00000000..dfeecd2b --- /dev/null +++ b/gnulib-m4/free.m4 @@ -0,0 +1,52 @@ +# free.m4 serial 6 +# Copyright (C) 2003-2005, 2009-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert and Bruno Haible. + +AC_DEFUN([gl_FUNC_FREE], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + + dnl In the next release of POSIX, free must preserve errno. + dnl https://www.austingroupbugs.net/view.php?id=385 + dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 + dnl So far, we know of three platforms that do this: + dnl * glibc >= 2.33, thanks to the fix for this bug: + dnl <https://sourceware.org/bugzilla/show_bug.cgi?id=17924> + dnl * OpenBSD >= 4.5, thanks to this commit: + dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h> + dnl * Solaris, because its malloc() implementation is based on brk(), + dnl not mmap(); hence its free() implementation makes no system calls. + dnl For other platforms, you can only be sure if they state it in their + dnl documentation, or by code inspection of the free() implementation in libc. + AC_CACHE_CHECK([whether free is known to preserve errno], + [gl_cv_func_free_preserves_errno], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + ]], + [[#if 2 < __GLIBC__ + (33 <= __GLIBC_MINOR__) + #elif defined __OpenBSD__ + #elif defined __sun + #else + #error "'free' is not known to preserve errno" + #endif + ]])], + [gl_cv_func_free_preserves_errno=yes], + [gl_cv_func_free_preserves_errno=no]) + ]) + + case $gl_cv_func_free_preserves_errno in + *yes) + AC_DEFINE([HAVE_FREE_POSIX], [1], + [Define if the 'free' function is guaranteed to preserve errno.]) + ;; + *) REPLACE_FREE=1 ;; + esac +]) + +# Prerequisites of lib/free.c. +AC_DEFUN([gl_PREREQ_FREE], [:]) diff --git a/gnulib-m4/frexp.m4 b/gnulib-m4/frexp.m4 index 33e07f59..d8f3cef4 100644 --- a/gnulib-m4/frexp.m4 +++ b/gnulib-m4/frexp.m4 @@ -1,5 +1,5 @@ # frexp.m4 serial 16 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/frexpl.m4 b/gnulib-m4/frexpl.m4 index d7845d19..45576131 100644 --- a/gnulib-m4/frexpl.m4 +++ b/gnulib-m4/frexpl.m4 @@ -1,5 +1,5 @@ -# frexpl.m4 serial 21 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# frexpl.m4 serial 22 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -150,6 +150,7 @@ extern "C" #endif long double frexpl (long double, int *); +long double zero = 0.0L; int main() { int result = 0; @@ -207,7 +208,8 @@ int main() } } /* Test on infinite numbers. */ - x = 1.0L / 0.0L; + /* The Microsoft MSVC 14 compiler chokes on the expression 1.0 / 0.0. */ + x = 1.0L / zero; { int exp; long double y = frexpl (x, &exp); diff --git a/gnulib-m4/fseterr.m4 b/gnulib-m4/fseterr.m4 index ca920c4a..1596bbc0 100644 --- a/gnulib-m4/fseterr.m4 +++ b/gnulib-m4/fseterr.m4 @@ -1,5 +1,5 @@ # fseterr.m4 serial 1 -dnl Copyright (C) 2012-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/fstat.m4 b/gnulib-m4/fstat.m4 new file mode 100644 index 00000000..9e61bcce --- /dev/null +++ b/gnulib-m4/fstat.m4 @@ -0,0 +1,40 @@ +# fstat.m4 serial 8 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FSTAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + case "$host_os" in + mingw* | solaris*) + dnl On MinGW, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + dnl Solaris stat can return a negative tv_nsec. + REPLACE_FSTAT=1 + ;; + esac + + dnl Replace fstat() for supporting the gnulib-defined open() on directories. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + case "$gl_cv_func_open_directory_works" in + *yes) ;; + *) + REPLACE_FSTAT=1 + ;; + esac + fi + ]) +]) + +# Prerequisites of lib/fstat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_FSTAT], [ + AC_REQUIRE([gl_SYS_STAT_H]) + AC_REQUIRE([gl_PREREQ_STAT_W32]) + : +]) diff --git a/gnulib-m4/ftruncate.m4 b/gnulib-m4/ftruncate.m4 new file mode 100644 index 00000000..2697e0eb --- /dev/null +++ b/gnulib-m4/ftruncate.m4 @@ -0,0 +1,40 @@ +# serial 21 + +# See if we need to emulate a missing ftruncate function using _chsize. + +# Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FTRUNCATE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([ftruncate]) + if test $ac_cv_func_ftruncate = yes; then + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + dnl Native Windows, and Large File Support is requested. + dnl The MSVCRT _chsize() function only accepts a 32-bit file size, + dnl and the mingw64 ftruncate64() function is unreliable (it may + dnl delete the file, see + dnl <https://web.archive.org/web/20160425005423/http://mingw-w64.sourcearchive.com/documentation/2.0-1/ftruncate64_8c_source.html>). + dnl Use gnulib's ftruncate() implementation instead. + REPLACE_FTRUNCATE=1 + ;; + esac + ], [ + : + ]) + else + HAVE_FTRUNCATE=0 + fi +]) + +# Prerequisites of lib/ftruncate.c. +AC_DEFUN([gl_PREREQ_FTRUNCATE], +[ + AC_CHECK_FUNCS([_chsize]) +]) diff --git a/gnulib-m4/getcwd.m4 b/gnulib-m4/getcwd.m4 new file mode 100644 index 00000000..076ca314 --- /dev/null +++ b/gnulib-m4/getcwd.m4 @@ -0,0 +1,166 @@ +# getcwd.m4 - check for working getcwd that is compatible with glibc + +# Copyright (C) 2001, 2003-2007, 2009-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert. +# serial 19 + +AC_DEFUN([gl_FUNC_GETCWD_NULL], + [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CACHE_CHECK([whether getcwd (NULL, 0) allocates memory for result], + [gl_cv_func_getcwd_null], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +# include <stdlib.h> +# if HAVE_UNISTD_H +# include <unistd.h> +# else /* on Windows with MSVC */ +# include <direct.h> +# endif + ]GL_MDA_DEFINES[ +# ifndef getcwd + char *getcwd (); +# endif +]], [[ +#if defined _WIN32 && ! defined __CYGWIN__ +/* mingw cwd does not start with '/', but _getcwd does allocate. + However, mingw fails to honor non-zero size. */ +#else + if (chdir ("/") != 0) + return 1; + else + { + char *f = getcwd (NULL, 0); + if (! f) + return 2; + if (f[0] != '/') + { free (f); return 3; } + if (f[1] != '\0') + { free (f); return 4; } + free (f); + return 0; + } +#endif + ]])], + [gl_cv_func_getcwd_null=yes], + [gl_cv_func_getcwd_null=no], + [[case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_getcwd_null="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_getcwd_null="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_getcwd_null="$gl_cross_guess_normal";; + esac + ]])]) +]) + +AC_DEFUN([gl_FUNC_GETCWD_SIGNATURE], +[ + AC_CACHE_CHECK([for getcwd with POSIX signature], + [gl_cv_func_getcwd_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> + ]GL_MDA_DEFINES], + [[extern + #ifdef __cplusplus + "C" + #endif + char *getcwd (char *, size_t); + ]]) + ], + [gl_cv_func_getcwd_posix_signature=yes], + [gl_cv_func_getcwd_posix_signature=no]) + ]) +]) + +dnl Guarantee that getcwd will malloc with a NULL first argument. Assumes +dnl that either the system getcwd is robust, or that calling code is okay +dnl with spurious failures when run from a directory with an absolute name +dnl larger than 4k bytes. +dnl +dnl Assumes that getcwd exists; if you are worried about obsolete +dnl platforms that lacked getcwd(), then you need to use the GPL module. +AC_DEFUN([gl_FUNC_GETCWD_LGPL], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_GETCWD_NULL]) + AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE]) + + case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_posix_signature in + *yes,yes) ;; + *) + dnl Minimal replacement lib/getcwd-lgpl.c. + REPLACE_GETCWD=1 + ;; + esac +]) + +dnl Check for all known getcwd bugs; useful for a program likely to be +dnl executed from an arbitrary location. +AC_DEFUN([gl_FUNC_GETCWD], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_GETCWD_NULL]) + AC_REQUIRE([gl_FUNC_GETCWD_SIGNATURE]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + gl_abort_bug=no + case "$host_os" in + mingw*) + gl_cv_func_getcwd_path_max=yes + ;; + *) + gl_FUNC_GETCWD_PATH_MAX + case "$gl_cv_func_getcwd_null" in + *yes) + gl_FUNC_GETCWD_ABORT_BUG([gl_abort_bug=yes]) + ;; + esac + ;; + esac + dnl Define HAVE_MINIMALLY_WORKING_GETCWD and HAVE_PARTLY_WORKING_GETCWD + dnl if appropriate. + case "$gl_cv_func_getcwd_path_max" in + *"no" | *"no, it has the AIX bug") ;; + *) + AC_DEFINE([HAVE_MINIMALLY_WORKING_GETCWD], [1], + [Define to 1 if getcwd minimally works, that is, its result can be + trusted when it succeeds.]) + ;; + esac + case "$gl_cv_func_getcwd_path_max" in + *"no, but it is partly working") + AC_DEFINE([HAVE_PARTLY_WORKING_GETCWD], [1], + [Define to 1 if getcwd works, except it sometimes fails when it + shouldn't, setting errno to ERANGE, ENAMETOOLONG, or ENOENT.]) + ;; + *"yes, but with shorter paths") + AC_DEFINE([HAVE_GETCWD_SHORTER], [1], + [Define to 1 if getcwd works, but with shorter paths + than is generally tested with the replacement.]) + ;; + esac + + if { case "$gl_cv_func_getcwd_null" in *yes) false;; *) true;; esac; } \ + || test $gl_cv_func_getcwd_posix_signature != yes \ + || { case "$gl_cv_func_getcwd_path_max" in *yes*) false;; *) true;; esac; } \ + || test $gl_abort_bug = yes; then + REPLACE_GETCWD=1 + fi +]) + +# Prerequisites of lib/getcwd.c, when full replacement is in effect. +AC_DEFUN([gl_PREREQ_GETCWD], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) + : +]) diff --git a/gnulib-m4/getdtablesize.m4 b/gnulib-m4/getdtablesize.m4 new file mode 100644 index 00000000..6134eaac --- /dev/null +++ b/gnulib-m4/getdtablesize.m4 @@ -0,0 +1,63 @@ +# getdtablesize.m4 serial 8 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETDTABLESIZE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([getdtablesize]) + AC_CHECK_DECLS_ONCE([getdtablesize]) + if test $ac_cv_func_getdtablesize = yes && + test $ac_cv_have_decl_getdtablesize = yes; then + AC_CACHE_CHECK([whether getdtablesize works], + [gl_cv_func_getdtablesize_works], + [dnl There are two concepts: the "maximum possible file descriptor value + 1" + dnl and the "maximum number of open file descriptors in a process". + dnl Per SUSv2 and POSIX, getdtablesize() should return the first one. + dnl On most platforms, the first and the second concept are the same. + dnl On OpenVMS, however, they are different and getdtablesize() returns + dnl the second one; thus the test below fails. But we don't care + dnl because there's no good way to write a replacement getdtablesize(). + case "$host_os" in + vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; + *) + dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft + dnl limit up to an unchangeable hard limit; all other platforms + dnl correctly require setrlimit before getdtablesize() can report + dnl a larger value. + AC_RUN_IFELSE([ + AC_LANG_PROGRAM( + [[#include <unistd.h>] + GL_MDA_DEFINES + ], + [[int size = getdtablesize(); + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; + ]])], + [gl_cv_func_getdtablesize_works=yes], + [gl_cv_func_getdtablesize_works=no], + [case "$host_os" in + cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows + gl_cv_func_getdtablesize_works="guessing no" ;; + *) gl_cv_func_getdtablesize_works="guessing yes" ;; + esac + ]) + ;; + esac + ]) + case "$gl_cv_func_getdtablesize_works" in + *yes | "no (limitation)") ;; + *) REPLACE_GETDTABLESIZE=1 ;; + esac + else + HAVE_GETDTABLESIZE=0 + fi +]) + +# Prerequisites of lib/getdtablesize.c. +AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:]) diff --git a/gnulib-m4/getpagesize.m4 b/gnulib-m4/getpagesize.m4 index eb17d60d..19f894ca 100644 --- a/gnulib-m4/getpagesize.m4 +++ b/gnulib-m4/getpagesize.m4 @@ -1,5 +1,5 @@ # getpagesize.m4 serial 10 -dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2018 Free Software Foundation, +dnl Copyright (C) 2002, 2004-2005, 2007, 2009-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gnulib-m4/getprogname.m4 b/gnulib-m4/getprogname.m4 index 3a9ba8b6..b26146e9 100644 --- a/gnulib-m4/getprogname.m4 +++ b/gnulib-m4/getprogname.m4 @@ -1,6 +1,6 @@ # getprogname.m4 - check for getprogname or replacements for it -# Copyright (C) 2016-2018 Free Software Foundation, Inc. +# Copyright (C) 2016-2022 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/gettimeofday.m4 b/gnulib-m4/gettimeofday.m4 new file mode 100644 index 00000000..f729601b --- /dev/null +++ b/gnulib-m4/gettimeofday.m4 @@ -0,0 +1,69 @@ +# serial 29 + +# Copyright (C) 2001-2003, 2005, 2007, 2009-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Jim Meyering. + +AC_DEFUN([gl_FUNC_GETTIMEOFDAY], +[ + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_TIME_H]) + AC_CHECK_FUNCS_ONCE([gettimeofday]) + + gl_gettimeofday_timezone=void + if test $ac_cv_func_gettimeofday != yes; then + HAVE_GETTIMEOFDAY=0 + else + AC_CACHE_CHECK([for gettimeofday with POSIX signature], + [gl_cv_func_gettimeofday_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/time.h> + struct timeval c; + int gettimeofday (struct timeval *restrict, void *restrict); + ]], + [[/* glibc uses struct timezone * rather than the POSIX void * + if _GNU_SOURCE is defined. However, since the only portable + use of gettimeofday uses NULL as the second parameter, and + since the glibc definition is actually more typesafe, it is + not worth wrapping this to get a compliant signature. */ + int (*f) (struct timeval *restrict, void *restrict) + = gettimeofday; + int x = f (&c, 0); + return !(x | c.tv_sec | c.tv_usec); + ]])], + [gl_cv_func_gettimeofday_posix_signature=yes], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/time.h> +int gettimeofday (struct timeval *restrict, struct timezone *restrict); + ]])], + [gl_cv_func_gettimeofday_posix_signature=almost], + [gl_cv_func_gettimeofday_posix_signature=no])])]) + if test $gl_cv_func_gettimeofday_posix_signature = almost; then + gl_gettimeofday_timezone='struct timezone' + elif test $gl_cv_func_gettimeofday_posix_signature != yes; then + REPLACE_GETTIMEOFDAY=1 + fi + dnl If we override 'struct timeval', we also have to override gettimeofday. + if test $REPLACE_STRUCT_TIMEVAL = 1; then + REPLACE_GETTIMEOFDAY=1 + fi + dnl On mingw, the original gettimeofday has only a precision of 15.6 + dnl milliseconds. So override it. + case "$host_os" in + mingw*) REPLACE_GETTIMEOFDAY=1 ;; + esac + fi + AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone], + [Define this to 'void' or 'struct timezone' to match the system's + declaration of the second argument to gettimeofday.]) +]) + +# Prerequisites of lib/gettimeofday.c. +AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:]) diff --git a/gnulib-m4/glibc21.m4 b/gnulib-m4/glibc21.m4 deleted file mode 100644 index 126aa1a9..00000000 --- a/gnulib-m4/glibc21.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# glibc21.m4 serial 5 -dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2018 Free Software Foundation, -dnl Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# Test for the GNU C Library, version 2.1 or newer, or uClibc. -# From Bruno Haible. - -AC_DEFUN([gl_GLIBC21], - [ - AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], - [ac_cv_gnu_library_2_1], - [AC_EGREP_CPP([Lucky], - [ -#include <features.h> -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif - ], - [ac_cv_gnu_library_2_1=yes], - [ac_cv_gnu_library_2_1=no]) - ] - ) - AC_SUBST([GLIBC21]) - GLIBC21="$ac_cv_gnu_library_2_1" - ] -) diff --git a/gnulib-m4/gnulib-cache.m4 b/gnulib-m4/gnulib-cache.m4 index 0a8bc005..5e2df6be 100644 --- a/gnulib-m4/gnulib-cache.m4 +++ b/gnulib-m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2022 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,7 +27,376 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --local-dir=gnulib-local --lib=libunistring --source-base=lib --m4-base=gnulib-m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --lgpl=3orGPLv2 --makefile-name=Makefile.gnulib --no-conditional-dependencies --libtool --macro-prefix=gl relocatable-lib-lgpl unicase/base unicase/empty-prefix-context unicase/empty-suffix-context unicase/locale-language unicase/tolower unicase/totitle unicase/toupper unicase/u16-casecmp unicase/u16-casecoll unicase/u16-casefold unicase/u16-casexfrm unicase/u16-ct-casefold unicase/u16-ct-tolower unicase/u16-ct-totitle unicase/u16-ct-toupper unicase/u16-is-cased unicase/u16-is-casefolded unicase/u16-is-lowercase unicase/u16-is-titlecase unicase/u16-is-uppercase unicase/u16-prefix-context unicase/u16-suffix-context unicase/u16-tolower unicase/u16-totitle unicase/u16-toupper unicase/u32-casecmp unicase/u32-casecoll unicase/u32-casefold unicase/u32-casexfrm unicase/u32-ct-casefold unicase/u32-ct-tolower unicase/u32-ct-totitle unicase/u32-ct-toupper unicase/u32-is-cased unicase/u32-is-casefolded unicase/u32-is-lowercase unicase/u32-is-titlecase unicase/u32-is-uppercase unicase/u32-prefix-context unicase/u32-suffix-context unicase/u32-tolower unicase/u32-totitle unicase/u32-toupper unicase/u8-casecmp unicase/u8-casecoll unicase/u8-casefold unicase/u8-casexfrm unicase/u8-ct-casefold unicase/u8-ct-tolower unicase/u8-ct-totitle unicase/u8-ct-toupper unicase/u8-is-cased unicase/u8-is-casefolded unicase/u8-is-lowercase unicase/u8-is-titlecase unicase/u8-is-uppercase unicase/u8-prefix-context unicase/u8-suffix-context unicase/u8-tolower unicase/u8-totitle unicase/u8-toupper unicase/ulc-casecmp unicase/ulc-casecoll unicase/ulc-casexfrm uniconv/base uniconv/u16-conv-from-enc uniconv/u16-conv-to-enc uniconv/u16-strconv-from-enc uniconv/u16-strconv-from-locale uniconv/u16-strconv-to-enc uniconv/u16-strconv-to-locale uniconv/u32-conv-from-enc uniconv/u32-conv-to-enc uniconv/u32-strconv-from-enc uniconv/u32-strconv-from-locale uniconv/u32-strconv-to-enc uniconv/u32-strconv-to-locale uniconv/u8-conv-from-enc uniconv/u8-conv-to-enc uniconv/u8-strconv-from-enc uniconv/u8-strconv-from-locale uniconv/u8-strconv-to-enc uniconv/u8-strconv-to-locale unictype/base unictype/bidiclass-all unictype/block-all unictype/category-all unictype/combining-class-all unictype/ctype-alnum unictype/ctype-alpha unictype/ctype-blank unictype/ctype-cntrl unictype/ctype-digit unictype/ctype-graph unictype/ctype-lower unictype/ctype-print unictype/ctype-punct unictype/ctype-space unictype/ctype-upper unictype/ctype-xdigit unictype/decimal-digit unictype/digit unictype/joininggroup-all unictype/joiningtype-all unictype/mirror unictype/numeric unictype/property-all unictype/scripts-all unictype/syntax-c-ident unictype/syntax-c-whitespace unictype/syntax-java-ident unictype/syntax-java-whitespace unigbrk/base unigbrk/u16-grapheme-breaks unigbrk/u16-grapheme-next unigbrk/u16-grapheme-prev unigbrk/u32-grapheme-breaks unigbrk/u32-grapheme-next unigbrk/u32-grapheme-prev unigbrk/u8-grapheme-breaks unigbrk/u8-grapheme-next unigbrk/u8-grapheme-prev unigbrk/uc-gbrk-prop unigbrk/uc-grapheme-breaks unigbrk/uc-is-grapheme-break unigbrk/ulc-grapheme-breaks unilbrk/base unilbrk/u16-possible-linebreaks unilbrk/u16-width-linebreaks unilbrk/u32-possible-linebreaks unilbrk/u32-width-linebreaks unilbrk/u8-possible-linebreaks unilbrk/u8-width-linebreaks unilbrk/ulc-possible-linebreaks unilbrk/ulc-width-linebreaks uniname/base uniname/uniname uninorm/base uninorm/canonical-decomposition uninorm/composition uninorm/decomposition uninorm/filter uninorm/nfc uninorm/nfd uninorm/nfkc uninorm/nfkd uninorm/u16-normalize uninorm/u16-normcmp uninorm/u16-normcoll uninorm/u16-normxfrm uninorm/u32-normalize uninorm/u32-normcmp uninorm/u32-normcoll uninorm/u32-normxfrm uninorm/u8-normalize uninorm/u8-normcmp uninorm/u8-normcoll uninorm/u8-normxfrm unistdio/base unistdio/u16-asnprintf unistdio/u16-asprintf unistdio/u16-snprintf unistdio/u16-sprintf unistdio/u16-u16-asnprintf unistdio/u16-u16-asprintf unistdio/u16-u16-snprintf unistdio/u16-u16-sprintf unistdio/u16-u16-vasnprintf unistdio/u16-u16-vasprintf unistdio/u16-u16-vsnprintf unistdio/u16-u16-vsprintf unistdio/u16-vasnprintf unistdio/u16-vasprintf unistdio/u16-vsnprintf unistdio/u16-vsprintf unistdio/u32-asnprintf unistdio/u32-asprintf unistdio/u32-snprintf unistdio/u32-sprintf unistdio/u32-u32-asnprintf unistdio/u32-u32-asprintf unistdio/u32-u32-snprintf unistdio/u32-u32-sprintf unistdio/u32-u32-vasnprintf unistdio/u32-u32-vasprintf unistdio/u32-u32-vsnprintf unistdio/u32-u32-vsprintf unistdio/u32-vasnprintf unistdio/u32-vasprintf unistdio/u32-vsnprintf unistdio/u32-vsprintf unistdio/u8-asnprintf unistdio/u8-asprintf unistdio/u8-snprintf unistdio/u8-sprintf unistdio/u8-u8-asnprintf unistdio/u8-u8-asprintf unistdio/u8-u8-snprintf unistdio/u8-u8-sprintf unistdio/u8-u8-vasnprintf unistdio/u8-u8-vasprintf unistdio/u8-u8-vsnprintf unistdio/u8-u8-vsprintf unistdio/u8-vasnprintf unistdio/u8-vasprintf unistdio/u8-vsnprintf unistdio/u8-vsprintf unistdio/ulc-asnprintf unistdio/ulc-asprintf unistdio/ulc-fprintf unistdio/ulc-snprintf unistdio/ulc-sprintf unistdio/ulc-vasnprintf unistdio/ulc-vasprintf unistdio/ulc-vfprintf unistdio/ulc-vsnprintf unistdio/ulc-vsprintf unistr/base unistr/u16-check unistr/u16-chr unistr/u16-cmp unistr/u16-cmp2 unistr/u16-cpy unistr/u16-cpy-alloc unistr/u16-endswith unistr/u16-mblen unistr/u16-mbsnlen unistr/u16-mbtouc unistr/u16-mbtouc-unsafe unistr/u16-mbtoucr unistr/u16-move unistr/u16-next unistr/u16-prev unistr/u16-set unistr/u16-startswith unistr/u16-stpcpy unistr/u16-stpncpy unistr/u16-strcat unistr/u16-strchr unistr/u16-strcmp unistr/u16-strcoll unistr/u16-strcpy unistr/u16-strcspn unistr/u16-strdup unistr/u16-strlen unistr/u16-strmblen unistr/u16-strmbtouc unistr/u16-strncat unistr/u16-strncmp unistr/u16-strncpy unistr/u16-strnlen unistr/u16-strpbrk unistr/u16-strrchr unistr/u16-strspn unistr/u16-strstr unistr/u16-strtok unistr/u16-to-u32 unistr/u16-to-u8 unistr/u16-uctomb unistr/u32-check unistr/u32-chr unistr/u32-cmp unistr/u32-cmp2 unistr/u32-cpy unistr/u32-cpy-alloc unistr/u32-endswith unistr/u32-mblen unistr/u32-mbsnlen unistr/u32-mbtouc unistr/u32-mbtouc-unsafe unistr/u32-mbtoucr unistr/u32-move unistr/u32-next unistr/u32-prev unistr/u32-set unistr/u32-startswith unistr/u32-stpcpy unistr/u32-stpncpy unistr/u32-strcat unistr/u32-strchr unistr/u32-strcmp unistr/u32-strcoll unistr/u32-strcpy unistr/u32-strcspn unistr/u32-strdup unistr/u32-strlen unistr/u32-strmblen unistr/u32-strmbtouc unistr/u32-strncat unistr/u32-strncmp unistr/u32-strncpy unistr/u32-strnlen unistr/u32-strpbrk unistr/u32-strrchr unistr/u32-strspn unistr/u32-strstr unistr/u32-strtok unistr/u32-to-u16 unistr/u32-to-u8 unistr/u32-uctomb unistr/u8-check unistr/u8-chr unistr/u8-cmp unistr/u8-cmp2 unistr/u8-cpy unistr/u8-cpy-alloc unistr/u8-endswith unistr/u8-mblen unistr/u8-mbsnlen unistr/u8-mbtouc unistr/u8-mbtouc-unsafe unistr/u8-mbtoucr unistr/u8-move unistr/u8-next unistr/u8-prev unistr/u8-set unistr/u8-startswith unistr/u8-stpcpy unistr/u8-stpncpy unistr/u8-strcat unistr/u8-strchr unistr/u8-strcmp unistr/u8-strcoll unistr/u8-strcpy unistr/u8-strcspn unistr/u8-strdup unistr/u8-strlen unistr/u8-strmblen unistr/u8-strmbtouc unistr/u8-strncat unistr/u8-strncmp unistr/u8-strncpy unistr/u8-strnlen unistr/u8-strpbrk unistr/u8-strrchr unistr/u8-strspn unistr/u8-strstr unistr/u8-strtok unistr/u8-to-u16 unistr/u8-to-u32 unistr/u8-uctomb unitypes uniwbrk/base uniwbrk/u16-wordbreaks uniwbrk/u32-wordbreaks uniwbrk/u8-wordbreaks uniwbrk/ulc-wordbreaks uniwbrk/wordbreak-property uniwidth/base uniwidth/u16-strwidth uniwidth/u16-width uniwidth/u32-strwidth uniwidth/u32-width uniwidth/u8-strwidth uniwidth/u8-width uniwidth/width +# gnulib-tool --import --local-dir=gnulib-local \ +# --lib=libunistring \ +# --source-base=lib \ +# --m4-base=gnulib-m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=build-aux \ +# --with-tests \ +# --lgpl=3orGPLv2 \ +# --makefile-name=Makefile.gnulib \ +# --no-conditional-dependencies \ +# --libtool \ +# --macro-prefix=gl \ +# relocatable-lib-lgpl \ +# unicase/base \ +# unicase/empty-prefix-context \ +# unicase/empty-suffix-context \ +# unicase/locale-language \ +# unicase/tolower \ +# unicase/totitle \ +# unicase/toupper \ +# unicase/u16-casecmp \ +# unicase/u16-casecoll \ +# unicase/u16-casefold \ +# unicase/u16-casexfrm \ +# unicase/u16-ct-casefold \ +# unicase/u16-ct-tolower \ +# unicase/u16-ct-totitle \ +# unicase/u16-ct-toupper \ +# unicase/u16-is-cased \ +# unicase/u16-is-casefolded \ +# unicase/u16-is-lowercase \ +# unicase/u16-is-titlecase \ +# unicase/u16-is-uppercase \ +# unicase/u16-prefix-context \ +# unicase/u16-suffix-context \ +# unicase/u16-tolower \ +# unicase/u16-totitle \ +# unicase/u16-toupper \ +# unicase/u32-casecmp \ +# unicase/u32-casecoll \ +# unicase/u32-casefold \ +# unicase/u32-casexfrm \ +# unicase/u32-ct-casefold \ +# unicase/u32-ct-tolower \ +# unicase/u32-ct-totitle \ +# unicase/u32-ct-toupper \ +# unicase/u32-is-cased \ +# unicase/u32-is-casefolded \ +# unicase/u32-is-lowercase \ +# unicase/u32-is-titlecase \ +# unicase/u32-is-uppercase \ +# unicase/u32-prefix-context \ +# unicase/u32-suffix-context \ +# unicase/u32-tolower \ +# unicase/u32-totitle \ +# unicase/u32-toupper \ +# unicase/u8-casecmp \ +# unicase/u8-casecoll \ +# unicase/u8-casefold \ +# unicase/u8-casexfrm \ +# unicase/u8-ct-casefold \ +# unicase/u8-ct-tolower \ +# unicase/u8-ct-totitle \ +# unicase/u8-ct-toupper \ +# unicase/u8-is-cased \ +# unicase/u8-is-casefolded \ +# unicase/u8-is-lowercase \ +# unicase/u8-is-titlecase \ +# unicase/u8-is-uppercase \ +# unicase/u8-prefix-context \ +# unicase/u8-suffix-context \ +# unicase/u8-tolower \ +# unicase/u8-totitle \ +# unicase/u8-toupper \ +# unicase/ulc-casecmp \ +# unicase/ulc-casecoll \ +# unicase/ulc-casexfrm \ +# uniconv/base \ +# uniconv/u16-conv-from-enc \ +# uniconv/u16-conv-to-enc \ +# uniconv/u16-strconv-from-enc \ +# uniconv/u16-strconv-from-locale \ +# uniconv/u16-strconv-to-enc \ +# uniconv/u16-strconv-to-locale \ +# uniconv/u32-conv-from-enc \ +# uniconv/u32-conv-to-enc \ +# uniconv/u32-strconv-from-enc \ +# uniconv/u32-strconv-from-locale \ +# uniconv/u32-strconv-to-enc \ +# uniconv/u32-strconv-to-locale \ +# uniconv/u8-conv-from-enc \ +# uniconv/u8-conv-to-enc \ +# uniconv/u8-strconv-from-enc \ +# uniconv/u8-strconv-from-locale \ +# uniconv/u8-strconv-to-enc \ +# uniconv/u8-strconv-to-locale \ +# unictype/base \ +# unictype/bidiclass-all \ +# unictype/block-all \ +# unictype/category-all \ +# unictype/combining-class-all \ +# unictype/ctype-alnum \ +# unictype/ctype-alpha \ +# unictype/ctype-blank \ +# unictype/ctype-cntrl \ +# unictype/ctype-digit \ +# unictype/ctype-graph \ +# unictype/ctype-lower \ +# unictype/ctype-print \ +# unictype/ctype-punct \ +# unictype/ctype-space \ +# unictype/ctype-upper \ +# unictype/ctype-xdigit \ +# unictype/decimal-digit \ +# unictype/digit \ +# unictype/joininggroup-all \ +# unictype/joiningtype-all \ +# unictype/mirror \ +# unictype/numeric \ +# unictype/property-all \ +# unictype/scripts-all \ +# unictype/syntax-c-ident \ +# unictype/syntax-c-whitespace \ +# unictype/syntax-java-ident \ +# unictype/syntax-java-whitespace \ +# unigbrk/base \ +# unigbrk/u16-grapheme-breaks \ +# unigbrk/u16-grapheme-next \ +# unigbrk/u16-grapheme-prev \ +# unigbrk/u32-grapheme-breaks \ +# unigbrk/u32-grapheme-next \ +# unigbrk/u32-grapheme-prev \ +# unigbrk/u8-grapheme-breaks \ +# unigbrk/u8-grapheme-next \ +# unigbrk/u8-grapheme-prev \ +# unigbrk/uc-gbrk-prop \ +# unigbrk/uc-grapheme-breaks \ +# unigbrk/uc-is-grapheme-break \ +# unigbrk/ulc-grapheme-breaks \ +# unilbrk/base \ +# unilbrk/u16-possible-linebreaks \ +# unilbrk/u16-width-linebreaks \ +# unilbrk/u32-possible-linebreaks \ +# unilbrk/u32-width-linebreaks \ +# unilbrk/u8-possible-linebreaks \ +# unilbrk/u8-width-linebreaks \ +# unilbrk/ulc-possible-linebreaks \ +# unilbrk/ulc-width-linebreaks \ +# uniname/base \ +# uniname/uniname \ +# uninorm/base \ +# uninorm/canonical-decomposition \ +# uninorm/composition \ +# uninorm/decomposition \ +# uninorm/filter \ +# uninorm/nfc \ +# uninorm/nfd \ +# uninorm/nfkc \ +# uninorm/nfkd \ +# uninorm/u16-normalize \ +# uninorm/u16-normcmp \ +# uninorm/u16-normcoll \ +# uninorm/u16-normxfrm \ +# uninorm/u32-normalize \ +# uninorm/u32-normcmp \ +# uninorm/u32-normcoll \ +# uninorm/u32-normxfrm \ +# uninorm/u8-normalize \ +# uninorm/u8-normcmp \ +# uninorm/u8-normcoll \ +# uninorm/u8-normxfrm \ +# unistdio/base \ +# unistdio/u16-asnprintf \ +# unistdio/u16-asprintf \ +# unistdio/u16-snprintf \ +# unistdio/u16-sprintf \ +# unistdio/u16-u16-asnprintf \ +# unistdio/u16-u16-asprintf \ +# unistdio/u16-u16-snprintf \ +# unistdio/u16-u16-sprintf \ +# unistdio/u16-u16-vasnprintf \ +# unistdio/u16-u16-vasprintf \ +# unistdio/u16-u16-vsnprintf \ +# unistdio/u16-u16-vsprintf \ +# unistdio/u16-vasnprintf \ +# unistdio/u16-vasprintf \ +# unistdio/u16-vsnprintf \ +# unistdio/u16-vsprintf \ +# unistdio/u32-asnprintf \ +# unistdio/u32-asprintf \ +# unistdio/u32-snprintf \ +# unistdio/u32-sprintf \ +# unistdio/u32-u32-asnprintf \ +# unistdio/u32-u32-asprintf \ +# unistdio/u32-u32-snprintf \ +# unistdio/u32-u32-sprintf \ +# unistdio/u32-u32-vasnprintf \ +# unistdio/u32-u32-vasprintf \ +# unistdio/u32-u32-vsnprintf \ +# unistdio/u32-u32-vsprintf \ +# unistdio/u32-vasnprintf \ +# unistdio/u32-vasprintf \ +# unistdio/u32-vsnprintf \ +# unistdio/u32-vsprintf \ +# unistdio/u8-asnprintf \ +# unistdio/u8-asprintf \ +# unistdio/u8-snprintf \ +# unistdio/u8-sprintf \ +# unistdio/u8-u8-asnprintf \ +# unistdio/u8-u8-asprintf \ +# unistdio/u8-u8-snprintf \ +# unistdio/u8-u8-sprintf \ +# unistdio/u8-u8-vasnprintf \ +# unistdio/u8-u8-vasprintf \ +# unistdio/u8-u8-vsnprintf \ +# unistdio/u8-u8-vsprintf \ +# unistdio/u8-vasnprintf \ +# unistdio/u8-vasprintf \ +# unistdio/u8-vsnprintf \ +# unistdio/u8-vsprintf \ +# unistdio/ulc-asnprintf \ +# unistdio/ulc-asprintf \ +# unistdio/ulc-fprintf \ +# unistdio/ulc-snprintf \ +# unistdio/ulc-sprintf \ +# unistdio/ulc-vasnprintf \ +# unistdio/ulc-vasprintf \ +# unistdio/ulc-vfprintf \ +# unistdio/ulc-vsnprintf \ +# unistdio/ulc-vsprintf \ +# unistr/base \ +# unistr/u16-check \ +# unistr/u16-chr \ +# unistr/u16-cmp \ +# unistr/u16-cmp2 \ +# unistr/u16-cpy \ +# unistr/u16-cpy-alloc \ +# unistr/u16-endswith \ +# unistr/u16-mblen \ +# unistr/u16-mbsnlen \ +# unistr/u16-mbtouc \ +# unistr/u16-mbtouc-unsafe \ +# unistr/u16-mbtoucr \ +# unistr/u16-move \ +# unistr/u16-next \ +# unistr/u16-prev \ +# unistr/u16-set \ +# unistr/u16-startswith \ +# unistr/u16-stpcpy \ +# unistr/u16-stpncpy \ +# unistr/u16-strcat \ +# unistr/u16-strchr \ +# unistr/u16-strcmp \ +# unistr/u16-strcoll \ +# unistr/u16-strcpy \ +# unistr/u16-strcspn \ +# unistr/u16-strdup \ +# unistr/u16-strlen \ +# unistr/u16-strmblen \ +# unistr/u16-strmbtouc \ +# unistr/u16-strncat \ +# unistr/u16-strncmp \ +# unistr/u16-strncpy \ +# unistr/u16-strnlen \ +# unistr/u16-strpbrk \ +# unistr/u16-strrchr \ +# unistr/u16-strspn \ +# unistr/u16-strstr \ +# unistr/u16-strtok \ +# unistr/u16-to-u32 \ +# unistr/u16-to-u8 \ +# unistr/u16-uctomb \ +# unistr/u32-check \ +# unistr/u32-chr \ +# unistr/u32-cmp \ +# unistr/u32-cmp2 \ +# unistr/u32-cpy \ +# unistr/u32-cpy-alloc \ +# unistr/u32-endswith \ +# unistr/u32-mblen \ +# unistr/u32-mbsnlen \ +# unistr/u32-mbtouc \ +# unistr/u32-mbtouc-unsafe \ +# unistr/u32-mbtoucr \ +# unistr/u32-move \ +# unistr/u32-next \ +# unistr/u32-prev \ +# unistr/u32-set \ +# unistr/u32-startswith \ +# unistr/u32-stpcpy \ +# unistr/u32-stpncpy \ +# unistr/u32-strcat \ +# unistr/u32-strchr \ +# unistr/u32-strcmp \ +# unistr/u32-strcoll \ +# unistr/u32-strcpy \ +# unistr/u32-strcspn \ +# unistr/u32-strdup \ +# unistr/u32-strlen \ +# unistr/u32-strmblen \ +# unistr/u32-strmbtouc \ +# unistr/u32-strncat \ +# unistr/u32-strncmp \ +# unistr/u32-strncpy \ +# unistr/u32-strnlen \ +# unistr/u32-strpbrk \ +# unistr/u32-strrchr \ +# unistr/u32-strspn \ +# unistr/u32-strstr \ +# unistr/u32-strtok \ +# unistr/u32-to-u16 \ +# unistr/u32-to-u8 \ +# unistr/u32-uctomb \ +# unistr/u8-check \ +# unistr/u8-chr \ +# unistr/u8-cmp \ +# unistr/u8-cmp2 \ +# unistr/u8-cpy \ +# unistr/u8-cpy-alloc \ +# unistr/u8-endswith \ +# unistr/u8-mblen \ +# unistr/u8-mbsnlen \ +# unistr/u8-mbtouc \ +# unistr/u8-mbtouc-unsafe \ +# unistr/u8-mbtoucr \ +# unistr/u8-move \ +# unistr/u8-next \ +# unistr/u8-prev \ +# unistr/u8-set \ +# unistr/u8-startswith \ +# unistr/u8-stpcpy \ +# unistr/u8-stpncpy \ +# unistr/u8-strcat \ +# unistr/u8-strchr \ +# unistr/u8-strcmp \ +# unistr/u8-strcoll \ +# unistr/u8-strcpy \ +# unistr/u8-strcspn \ +# unistr/u8-strdup \ +# unistr/u8-strlen \ +# unistr/u8-strmblen \ +# unistr/u8-strmbtouc \ +# unistr/u8-strncat \ +# unistr/u8-strncmp \ +# unistr/u8-strncpy \ +# unistr/u8-strnlen \ +# unistr/u8-strpbrk \ +# unistr/u8-strrchr \ +# unistr/u8-strspn \ +# unistr/u8-strstr \ +# unistr/u8-strtok \ +# unistr/u8-to-u16 \ +# unistr/u8-to-u32 \ +# unistr/u8-uctomb \ +# unitypes \ +# uniwbrk/base \ +# uniwbrk/u16-wordbreaks \ +# uniwbrk/u32-wordbreaks \ +# uniwbrk/u8-wordbreaks \ +# uniwbrk/ulc-wordbreaks \ +# uniwbrk/wordbreak-property \ +# uniwidth/base \ +# uniwidth/u16-strwidth \ +# uniwidth/u16-width \ +# uniwidth/u32-strwidth \ +# uniwidth/u32-width \ +# uniwidth/u8-strwidth \ +# uniwidth/u8-width \ +# uniwidth/width # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([gnulib-local]) diff --git a/gnulib-m4/gnulib-common.m4 b/gnulib-m4/gnulib-common.m4 index 736e4210..87a9a751 100644 --- a/gnulib-m4/gnulib-common.m4 +++ b/gnulib-m4/gnulib-common.m4 @@ -1,25 +1,54 @@ -# gnulib-common.m4 serial 39 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# gnulib-common.m4 serial 69 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +AC_PREREQ([2.62]) + # gl_COMMON # is expanded unconditionally through gnulib-tool magic. AC_DEFUN([gl_COMMON], [ dnl Use AC_REQUIRE here, so that the code is expanded once only. AC_REQUIRE([gl_00GNULIB]) AC_REQUIRE([gl_COMMON_BODY]) + AC_REQUIRE([gl_ZZGNULIB]) ]) AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([_GL_GNUC_PREREQ], +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _GL_GNUC_PREREQ(major, minor) 0 +#endif +]) AH_VERBATIM([_Noreturn], [/* The _Noreturn keyword of C11. */ -#if ! (defined _Noreturn \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) -# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ - || 0x5110 <= __SUNPRO_C) +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (_GL_GNUC_PREREQ (4, 7) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) + /* _Noreturn works as-is. */ +# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C # define _Noreturn __attribute__ ((__noreturn__)) -# elif defined _MSC_VER && 1200 <= _MSC_VER +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) # else # define _Noreturn @@ -36,50 +65,437 @@ AC_DEFUN([gl_COMMON_BODY], [ #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ # define __GNUC_STDC_INLINE__ 1 #endif]) - AH_VERBATIM([unused_parameter], -[/* Define as a marker that can be attached to declarations that might not - be used. This helps to reduce warnings, such as from - GCC -Wunused-parameter. */ -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -# define _GL_UNUSED __attribute__ ((__unused__)) + AH_VERBATIM([attribute], +[/* Attributes. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) #else -# define _GL_UNUSED -#endif -/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name - is a misnomer outside of parameter lists. */ -#define _UNUSED_PARAMETER_ _GL_UNUSED - -/* gcc supports the "unused" attribute on possibly unused labels, and - g++ has since version 4.5. Note to support C++ as well as C, - _GL_UNUSED_LABEL should be used with a trailing ; */ -#if !defined __cplusplus || __GNUC__ > 4 \ - || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) -# define _GL_UNUSED_LABEL _GL_UNUSED +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_diagnose_if 0 +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) +#endif + +#ifdef __has_c_attribute +# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__) #else -# define _GL_UNUSED_LABEL +# define _GL_HAS_C_ATTRIBUTE(attr) 0 #endif -/* The __pure__ attribute was added in gcc 2.96. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) -# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. +[ +/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function + is the size of the returned memory block. + _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied + by the Nth argument of the function is the size of the returned memory block. + */ +/* Applies to: function, pointer to function, function types. */ +#if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +#else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +#endif + +/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the + function and report an error if it cannot do so. */ +/* Applies to: function. */ +#if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#else +# define _GL_ATTRIBUTE_ALWAYS_INLINE +#endif + +/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show + in stack traces when debugging. The compiler should omit the function from + stack traces. */ +/* Applies to: function. */ +#if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +#else +# define _GL_ATTRIBUTE_ARTIFICIAL +#endif + +/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */ +/* Applies to: functions. */ +/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at + <https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>. + Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ +#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif #else -# define _GL_ATTRIBUTE_PURE /* empty */ +# define _GL_ATTRIBUTE_COLD #endif -/* The __const__ attribute was added in gcc 2.95. */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate + calls to the function with the same arguments. + This attribute is safe for a function that neither depends on nor affects + observable state, and always returns exactly once - e.g., does not loop + forever, and does not call longjmp. + (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) #else -# define _GL_ATTRIBUTE_CONST /* empty */ +# define _GL_ATTRIBUTE_CONST #endif -/* The __malloc__ attribute was added in gcc 3. */ -#if 3 <= __GNUC__ +/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers + that can be freed by passing them as the Ith argument to the + function F. + _GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that + can be freed via 'free'; it can be used only after declaring 'free'. */ +/* Applies to: functions. Cannot be used on inline functions. */ +#if _GL_GNUC_PREREQ (11, 0) +# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i))) +#else +# define _GL_ATTRIBUTE_DEALLOC(f, i) +#endif +#define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (free, 1) + +/* _GL_ATTRIBUTE_DEPRECATED: Declares that an entity is deprecated. + The compiler may warn if the entity is used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: namespace, class, template specialization. */ +#if _GL_HAS_C_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +#elif _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +#else +# define _GL_ATTRIBUTE_DEPRECATED +#endif + +/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and + the function call is not optimized away. + _GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and + the function call is not optimized away. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) +#elif _GL_HAS_ATTRIBUTE (diagnose_if) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +#else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +#endif + +/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain + visible to debuggers etc., even with '-fwhole-program'. */ +/* Applies to: functions, variables. */ +#if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +#else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#endif + +/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if + the control flow falls through to the immediately following 'case' or + 'default' label. The compiler should not warn in this case. */ +/* Applies to: Empty statement (;), inside a 'switch' statement. */ +/* Always expands to something. */ +#if _GL_HAS_C_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +#elif _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +#else +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +#endif + +/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) + declares that the STRING-INDEXth function argument is a format string of + style ARCHETYPE, which is one of: + printf, gnu_printf + scanf, gnu_scanf, + strftime, gnu_strftime, + strfmon, + or the same thing prefixed and suffixed with '__'. + If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK + are suitable for the format string. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) +#endif + +/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other + compilation unit, it executes code from that unit only by return or by + exception handling. This declaration lets the compiler optimize that unit + more aggressively. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +#else +# define _GL_ATTRIBUTE_LEAF +#endif + +/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly + allocated memory. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (malloc) # define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) #else -# define _GL_ATTRIBUTE_MALLOC /* empty */ +# define _GL_ATTRIBUTE_MALLOC +#endif + +/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the + same storage as pointers to other types. Thus this declaration disables + strict aliasing optimization. */ +/* Applies to: types. */ +/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ +#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +#else +# define _GL_ATTRIBUTE_MAY_ALIAS +#endif + +/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if + the entity is not used. The compiler should not warn if the entity is not + used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: class. */ +/* In C++ and C2x, this is spelled [[__maybe_unused__]]. + GCC's syntax is __attribute__ ((__unused__)). + clang supports both syntaxes. */ +#if _GL_HAS_C_ATTRIBUTE (maybe_unused) +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +#else +# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED +#endif +/* Alternative spelling of this macro, for convenience. */ +#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +/* Earlier spellings of this macro. */ +#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED + +/* _GL_ATTRIBUTE_NODISCARD declares that the caller of the function should not + discard the return value. The compiler may warn if the caller does not use + the return value, unless the caller uses something like ignore_value. */ +/* Applies to: function, enumeration, class. */ +#if _GL_HAS_C_ATTRIBUTE (nodiscard) +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +#elif _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +#else +# define _GL_ATTRIBUTE_NODISCARD +#endif + +/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the + function. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +#else +# define _GL_ATTRIBUTE_NOINLINE +#endif + +/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,... + must not be NULL. + _GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be + null. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +#else +# define _GL_ATTRIBUTE_NONNULL(args) +#endif + +/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is + not meant to be NUL-terminated. */ +/* Applies to: struct/union members and variables that are arrays of element + type '[[un]signed] char'. */ +#if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +#else +# define _GL_ATTRIBUTE_NONSTRING +#endif + +/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ + +/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. + */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +#else +# define _GL_ATTRIBUTE_NOTHROW +#endif + +/* _GL_ATTRIBUTE_PACKED declares: + For struct members: The member has the smallest possible alignment. + For struct, union, class: All members have the smallest possible alignment, + minimizing the memory required. */ +/* Applies to: struct members, struct, union, + in C++ also: class. */ +#if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#else +# define _GL_ATTRIBUTE_PACKED +#endif + +/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate + calls to the function with the same arguments if observable state is not + changed between calls. + This attribute is safe for a function that does not affect + observable state, and always returns exactly once. + (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE +#endif + +/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is + a non-NULL pointer. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (returns_nonnull) +# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +#else +# define _GL_ATTRIBUTE_RETURNS_NONNULL +#endif + +/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a + trailing NULL argument. + _GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). + _GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ +/* Applies to: functions. */ +#if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +#else +# define _GL_ATTRIBUTE_SENTINEL(pos) +#endif + +/* A helper macro. Don't use it directly. */ +#if _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_ATTRIBUTE_UNUSED +#endif + +]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. +[ +/* _GL_UNUSED_LABEL; declares that it is not a programming mistake if the + immediately preceding label is not used. The compiler should not warn + if the label is not used. */ +/* Applies to: label (both in C and C++). */ +/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;' + syntax. But clang does. */ +#if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__ +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED +#else +# define _GL_UNUSED_LABEL #endif ]) + AH_VERBATIM([async_safe], +[/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04> + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE +]) + AH_VERBATIM([micro_optimizations], +[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where + n1 and n2 are expressions without side effects, that evaluate to real + numbers (excluding NaN). + It returns + 1 if n1 > n2 + 0 if n1 == n2 + -1 if n1 < n2 + The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional + jump with nearly all GCC versions up to GCC 10. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many + GCC versions up to GCC 9. + The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 + avoids conditional jumps in all GCC versions >= 3.4. */ +#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) +]) + dnl Hint which direction to take regarding cross-compilation guesses: + dnl When a user installs a program on a platform they are not intimately + dnl familiar with, --enable-cross-guesses=conservative is the appropriate + dnl choice. It implements the "If we don't know, assume the worst" principle. + dnl However, when an operating system developer (on a platform which is not + dnl yet known to gnulib) builds packages for their platform, they want to + dnl expose, not hide, possible platform bugs; in this case, + dnl --enable-cross-guesses=risky is the appropriate choice. + dnl Sets the variables + dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), + dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). + AC_ARG_ENABLE([cross-guesses], + [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], + [specify policy for cross-compilation guesses])], + [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) + enableval=conservative + fi + gl_cross_guesses="$enableval"], + [gl_cross_guesses=conservative]) + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi dnl Preparation for running test programs: dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not dnl to /dev/tty, so they can be redirected to log files. Such diagnostics @@ -88,6 +504,16 @@ AC_DEFUN([gl_COMMON_BODY], [ export LIBC_FATAL_STDERR_ ]) +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) +# initializes the shell variable that indicates the presence of the given module +# as a C preprocessor expression. +AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], +[ + GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) + AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) +]) + # gl_MODULE_INDICATOR_CONDITION # expands to a C preprocessor expression that evaluates to 1 or 0, depending # whether a gnulib module that has been requested shall be considered present @@ -100,9 +526,9 @@ m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], [ gl_MODULE_INDICATOR_SET_VARIABLE_AUX( - [GNULIB_[]m4_translit([[$1]], - [abcdefghijklmnopqrstuvwxyz./-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], + [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], [gl_MODULE_INDICATOR_CONDITION]) ]) @@ -214,42 +640,20 @@ AC_DEFUN([gl_FEATURES_H], AC_SUBST([HAVE_FEATURES_H]) ]) -# m4_foreach_w -# is a backport of autoconf-2.59c's m4_foreach_w. -# Remove this macro when we can assume autoconf >= 2.60. -m4_ifndef([m4_foreach_w], - [m4_define([m4_foreach_w], - [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])]) - -# AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH]) -# ---------------------------------------------------- -# Backport of autoconf-2.63b's macro. -# Remove this macro when we can assume autoconf >= 2.64. -m4_ifndef([AS_VAR_IF], -[m4_define([AS_VAR_IF], -[AS_IF([test x"AS_VAR_GET([$1])" = x""$2], [$3], [$4])])]) - # gl_PROG_CC_C99 # Modifies the value of the shell variable CC in an attempt to make $CC # understand ISO C99 source code. -# This is like AC_PROG_CC_C99, except that -# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60, -# - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC -# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>, -# but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99 -# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00441.html>. -# Remaining problems: -# - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options -# to CC twice -# <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00431.html>. -# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard. AC_DEFUN([gl_PROG_CC_C99], [ - dnl Change that version number to the minimum Autoconf version that supports - dnl mixing AC_PROG_CC_C99 calls with AC_PROG_CC_STDC calls. - m4_version_prereq([9.0], - [AC_REQUIRE([AC_PROG_CC_C99])], - [AC_REQUIRE([AC_PROG_CC_STDC])]) + dnl Just use AC_PROG_CC_C99. + dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the substituted + dnl value of CC will contain the C99 enabling options twice. But this is only + dnl a cosmetic problem. + dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99; + dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete." + m4_version_prereq([2.70], + [AC_REQUIRE([AC_PROG_CC])], + [AC_REQUIRE([AC_PROG_CC_C99])]) ]) # gl_PROG_AR_RANLIB @@ -322,48 +726,29 @@ Amsterdam AC_SUBST([RANLIB]) ]) -# AC_PROG_MKDIR_P -# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix -# for interoperability with automake-1.9.6 from autoconf-2.62. -# Remove this macro when we can assume autoconf >= 2.62 or -# autoconf >= 2.60 && automake >= 1.10. -# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness. -m4_ifndef([AC_AUTOCONF_VERSION],[ -m4_ifdef([AC_PROG_MKDIR_P], [ - dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed. - m4_define([AC_PROG_MKDIR_P], - m4_defn([AC_PROG_MKDIR_P])[ - AC_SUBST([MKDIR_P])])], [ - dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P. - AC_DEFUN_ONCE([AC_PROG_MKDIR_P], - [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake - MKDIR_P='$(mkdir_p)' - AC_SUBST([MKDIR_P])])]) -]) - # AC_C_RESTRICT -# This definition is copied from post-2.69 Autoconf and overrides the -# AC_C_RESTRICT macro from autoconf 2.60..2.69. It can be removed -# once autoconf >= 2.70 can be assumed. It's painful to check version -# numbers, and in practice this macro is more up-to-date than Autoconf -# is, so override Autoconf unconditionally. +# This definition is copied from post-2.70 Autoconf and overrides the +# AC_C_RESTRICT macro from autoconf 2.60..2.70. +m4_version_prereq([2.70.1], [], [ AC_DEFUN([AC_C_RESTRICT], [AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], [ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do + # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: + # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html + # Put 'restrict' last, because C++ lacks it. + for ac_kw in __restrict__ __restrict _Restrict restrict; do AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[typedef int *int_ptr; - int foo (int_ptr $ac_kw ip) { return ip[0]; } - int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ - int bar (int ip[$ac_kw]) { return ip[0]; } - ]], - [[int s[1]; - int *$ac_kw t = s; - t[0] = 0; - return foo (t) + bar (t); - ]])], + [[typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + ]], + [[int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ]])], [ac_cv_c_restrict=$ac_kw]) test "$ac_cv_c_restrict" != no && break done @@ -371,14 +756,15 @@ AC_DEFUN([AC_C_RESTRICT], AH_VERBATIM([restrict], [/* Define to the equivalent of the C99 'restrict' keyword, or to nothing if this is not supported. Do not define if restrict is - supported directly. */ + supported only directly. */ #undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT +/* Work around a bug in older versions of Sun C++, which did not + #define __restrict__ or support _Restrict or __restrict__ + even though the corresponding Sun C compiler ended up with + "#define restrict _Restrict" or "#define restrict __restrict__" + in the previous line. This workaround can be removed once + we assume Oracle Developer Studio 12.5 (2016) or later. */ +#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif]) @@ -388,6 +774,7 @@ AC_DEFUN([AC_C_RESTRICT], *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; esac ])# AC_C_RESTRICT +]) # gl_BIGENDIAN # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. @@ -398,6 +785,22 @@ AC_DEFUN([gl_BIGENDIAN], AC_C_BIGENDIAN ]) +# A temporary file descriptor. +# Must be less than 10, because dash 0.5.8 does not support redirections +# with multi-digit file descriptors. +m4_define([GL_TMP_FD], 9) + +# gl_SILENT(command) +# executes command, but without the normal configure output. +# This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.) +# inside another AC_CACHE_CHECK. +AC_DEFUN([gl_SILENT], +[ + exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null + $1 + exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&- +]) + # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not # output a spurious "(cached)" mark in the midst of other configure output. @@ -405,70 +808,173 @@ AC_DEFUN([gl_BIGENDIAN], # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. AC_DEFUN([gl_CACHE_VAL_SILENT], [ - saved_as_echo_n="$as_echo_n" - as_echo_n=':' - AC_CACHE_VAL([$1], [$2]) - as_echo_n="$saved_as_echo_n" + gl_SILENT([ + AC_CACHE_VAL([$1], [$2]) + ]) ]) -# AS_VAR_COPY was added in autoconf 2.63b -m4_define_default([AS_VAR_COPY], -[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])]) - -# AC_PROG_SED was added in autoconf 2.59b -m4_ifndef([AC_PROG_SED], -[AC_DEFUN([AC_PROG_SED], -[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, - [dnl ac_script should not contain more than 99 commands (for HP-UX sed), - dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed. - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - AS_UNSET([ac_script]) - if test -z "$SED"; then - ac_path_SED_found=false - _AS_PATH_WALK([], [ - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - AS_EXECUTABLE_P(["$ac_path_SED"]) || continue - case `"$ac_path_SED" --version 2>&1` in - *GNU*) ac_cv_path_SED=$ac_path_SED ac_path_SED_found=:;; - *) - ac_count=0 - _AS_ECHO_N([0123456789]) >conftest.in - while : - do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >> conftest.nl - "$ac_path_SED" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break - diff conftest.out conftest.nl >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best so far, but keep looking for better - ac_cv_path_SED=$ac_path_SED - ac_path_SED_max=$ac_count - fi - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; - esac - $ac_path_SED_found && break 3 - done - done]) - if test -z "$ac_cv_path_SED"; then - AC_ERROR([no acceptable sed could be found in \$PATH]) - fi +# gl_CC_ALLOW_WARNINGS +# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang +# and empty otherwise. +AC_DEFUN([gl_CC_ALLOW_WARNINGS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for C compiler option to allow warnings], + [gl_cv_cc_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.c + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlc accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cc_wallow='-Wno-error' else - ac_cv_path_SED=$SED + gl_cv_cc_wallow=none fi + rm -f conftest* ]) - SED="$ac_cv_path_SED" - AC_SUBST([SED])dnl - rm -f conftest.sed + case "$gl_cv_cc_wallow" in + none) GL_CFLAG_ALLOW_WARNINGS='' ;; + *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; + esac + AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) +]) + +# gl_CXX_ALLOW_WARNINGS +# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +AC_DEFUN([gl_CXX_ALLOW_WARNINGS], +[ + dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. + if test -n "$CXX" && test "$CXX" != no; then + AC_CACHE_CHECK([for C++ compiler option to allow warnings], + [gl_cv_cxx_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.cc + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlC accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cxx_wallow='-Wno-error' + else + gl_cv_cxx_wallow=none + fi + rm -f conftest* + ]) + case "$gl_cv_cxx_wallow" in + none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; + *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; + esac + else + GL_CXXFLAG_ALLOW_WARNINGS='' + fi + AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) +]) + +dnl gl_CONDITIONAL_HEADER([foo.h]) +dnl takes a shell variable GL_GENERATE_FOO_H (with value true or false) as input +dnl and produces +dnl - an AC_SUBSTed variable FOO_H that is either a file name or empty, based +dnl on whether GL_GENERATE_FOO_H is true or false, +dnl - an Automake conditional GL_GENERATE_FOO_H that evaluates to the value of +dnl the shell variable GL_GENERATE_FOO_H. +AC_DEFUN([gl_CONDITIONAL_HEADER], +[ + m4_pushdef([gl_header_name], AS_TR_SH(m4_toupper($1))) + m4_pushdef([gl_generate_var], [GL_GENERATE_]AS_TR_SH(m4_toupper($1))) + m4_pushdef([gl_generate_cond], [GL_GENERATE_]AS_TR_SH(m4_toupper($1))) + case "$gl_generate_var" in + false) gl_header_name='' ;; + true) + dnl It is OK to use a .h file in lib/ from within tests/, but not vice + dnl versa. + if test -z "$gl_header_name"; then + gl_header_name="${gl_source_base_prefix}$1" + fi + ;; + *) echo "*** gl_generate_var is not set correctly" 1>&2; exit 1 ;; + esac + AC_SUBST(gl_header_name) + AM_CONDITIONAL(gl_generate_cond, [$gl_generate_var]) + m4_popdef([gl_generate_cond]) + m4_popdef([gl_generate_var]) + m4_popdef([gl_header_name]) ]) + +dnl Expands to some code for use in .c programs that, on native Windows, defines +dnl the Microsoft deprecated alias function names to the underscore-prefixed +dnl actual function names. With this macro, these function names are available +dnl without linking with '-loldnames' and without generating warnings. +dnl Usage: Use it after all system header files are included. +dnl #include <...> +dnl #include <...> +dnl ]GL_MDA_DEFINES[ +dnl ... +AC_DEFUN([GL_MDA_DEFINES],[ +AC_REQUIRE([_GL_MDA_DEFINES]) +[$gl_mda_defines] +]) +AC_DEFUN([_GL_MDA_DEFINES], +[gl_mda_defines=' +#if defined _WIN32 && !defined __CYGWIN__ +#define access _access +#define chdir _chdir +#define chmod _chmod +#define close _close +#define creat _creat +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define execvpe _execvpe +#define fcloseall _fcloseall +#define fcvt _fcvt +#define fdopen _fdopen +#define fileno _fileno +#define gcvt _gcvt +#define getcwd _getcwd +#define getpid _getpid +#define getw _getw +#define isatty _isatty +#define j0 _j0 +#define j1 _j1 +#define jn _jn +#define lfind _lfind +#define lsearch _lsearch +#define lseek _lseek +#define memccpy _memccpy +#define mkdir _mkdir +#define mktemp _mktemp +#define open _open +#define putenv _putenv +#define putw _putw +#define read _read +#define rmdir _rmdir +#define strdup _strdup +#define swab _swab +#define tempnam _tempnam +#define tzset _tzset +#define umask _umask +#define unlink _unlink +#define utime _utime +#define wcsdup _wcsdup +#define write _write +#define y0 _y0 +#define y1 _y1 +#define yn _yn +#endif +' ]) diff --git a/gnulib-m4/gnulib-comp.m4 b/gnulib-m4/gnulib-comp.m4 index b0f3e895..62dedba8 100644 --- a/gnulib-m4/gnulib-comp.m4 +++ b/gnulib-m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2018 Free Software Foundation, Inc. +# Copyright (C) 2002-2022 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,11 +44,22 @@ AC_DEFUN([gl_EARLY], AC_REQUIRE([AM_PROG_CC_C_O]) # Code from module absolute-header: + # Code from module accept: + # Code from module accept-tests: + # Code from module alloca: # Code from module alloca-opt: # Code from module alloca-opt-tests: # Code from module amemxfrm: + # Code from module arpa_inet: + # Code from module arpa_inet-tests: # Code from module array-mergesort: # Code from module array-mergesort-tests: + # Code from module attribute: + # Code from module basename-lgpl: + # Code from module binary-io: + # Code from module binary-io-tests: + # Code from module bind: + # Code from module bind-tests: # Code from module btowc: # Code from module btowc-tests: # Code from module builtin-expect: @@ -57,12 +68,21 @@ AC_DEFUN([gl_EARLY], # Code from module c-strcase: # Code from module c-strcase-tests: # Code from module c-strcaseeq: - # Code from module configmake: + # Code from module c99: + # Code from module calloc-gnu: + # Code from module calloc-gnu-tests: + # Code from module calloc-posix: + # Code from module cloexec: + # Code from module cloexec-tests: + # Code from module close: + # Code from module close-tests: + # Code from module connect: + # Code from module connect-tests: # Code from module ctype: # Code from module ctype-tests: - # Code from module dirname-lgpl: - # Code from module dosname: # Code from module double-slash-root: + # Code from module dup2: + # Code from module dup2-tests: # Code from module environ: # Code from module environ-tests: # Code from module errno: @@ -71,9 +91,15 @@ AC_DEFUN([gl_EARLY], # Code from module exitfail: # Code from module extensions: # Code from module extern-inline: + # Code from module fcntl: + # Code from module fcntl-h: + # Code from module fcntl-h-tests: + # Code from module fcntl-tests: + # Code from module fd-hook: # Code from module fdopen: # Code from module fdopen-tests: # Code from module fgetc-tests: + # Code from module filename: # Code from module flexmember: # Code from module float: # Code from module float-tests: @@ -82,33 +108,54 @@ AC_DEFUN([gl_EARLY], # Code from module fpucw: # Code from module fputc-tests: # Code from module fread-tests: + # Code from module free-posix: + # Code from module free-posix-tests: # Code from module frexp-nolibm: # Code from module frexp-nolibm-tests: # Code from module frexpl-nolibm: # Code from module frexpl-nolibm-tests: # Code from module fseterr: # Code from module fseterr-tests: + # Code from module fstat: + # Code from module fstat-tests: + # Code from module ftruncate: + # Code from module ftruncate-tests: # Code from module fwrite-tests: + # Code from module gen-header: + # Code from module getcwd-lgpl: + # Code from module getcwd-lgpl-tests: + # Code from module getdtablesize: + # Code from module getdtablesize-tests: # Code from module getpagesize: # Code from module getprogname: # Code from module getprogname-tests: # Code from module gettext-h: + # Code from module gettimeofday: + # Code from module gettimeofday-tests: # Code from module gperf: # Code from module hard-locale: + # Code from module hard-locale-tests: # Code from module havelib: - # Code from module host-cpu-c-abi: + # Code from module ialloc: # Code from module iconv: # Code from module iconv-h: # Code from module iconv-h-tests: # Code from module iconv-tests: # Code from module iconv_open: + # Code from module idx: + # Code from module ignore-value: + # Code from module ignore-value-tests: # Code from module include_next: + # Code from module inet_pton: + # Code from module inet_pton-tests: # Code from module inline: # Code from module intprops: # Code from module intprops-tests: # Code from module inttypes: # Code from module inttypes-incomplete: # Code from module inttypes-tests: + # Code from module ioctl: + # Code from module ioctl-tests: # Code from module isblank: # Code from module isblank-tests: # Code from module isnand-nolibm: @@ -119,17 +166,31 @@ AC_DEFUN([gl_EARLY], # Code from module isnanl-nolibm-tests: # Code from module iswblank: # Code from module iswblank-tests: + # Code from module iswdigit: + # Code from module iswdigit-tests: + # Code from module iswxdigit: + # Code from module iswxdigit-tests: # Code from module langinfo: # Code from module langinfo-tests: + # Code from module largefile: + AC_REQUIRE([AC_SYS_LARGEFILE]) + AC_REQUIRE([gl_YEAR2038_EARLY]) # Code from module limits-h: # Code from module limits-h-tests: + # Code from module listen: + # Code from module listen-tests: # Code from module localcharset: + # Code from module localcharset-tests: # Code from module locale: # Code from module locale-tests: # Code from module localename: # Code from module localename-tests: # Code from module lock: # Code from module lock-tests: + # Code from module lstat: + # Code from module lstat-tests: + # Code from module malloc-gnu: + # Code from module malloc-gnu-tests: # Code from module malloc-posix: # Code from module malloca: # Code from module malloca-tests: @@ -150,22 +211,56 @@ AC_DEFUN([gl_EARLY], # Code from module msvc-inval: # Code from module msvc-nothrow: # Code from module multiarch: + # Code from module nanosleep: + # Code from module nanosleep-tests: + # Code from module netinet_in: + # Code from module netinet_in-tests: # Code from module nocrash: + # Code from module open: + # Code from module open-tests: + # Code from module pathmax: + # Code from module pathmax-tests: + # Code from module perror: + # Code from module perror-tests: + # Code from module pipe-posix: + # Code from module pipe-posix-tests: # Code from module printf-frexp: # Code from module printf-frexp-tests: # Code from module printf-frexpl: # Code from module printf-frexpl-tests: # Code from module printf-safe: + # Code from module pthread-h: + gl_ANYTHREADLIB_EARLY + # Code from module pthread-h-tests: + # Code from module pthread-thread: + # Code from module pthread-thread-tests: # Code from module pthread_sigmask: # Code from module pthread_sigmask-tests: # Code from module putenv: # Code from module raise: # Code from module raise-tests: + # Code from module realloc-gnu: + # Code from module realloc-gnu-tests: + # Code from module realloc-posix: + # Code from module reallocarray: + # Code from module reallocarray-tests: # Code from module relocatable-lib-lgpl: + # Code from module same-inode: + # Code from module sched: + # Code from module sched-tests: + # Code from module sched_yield: + # Code from module select: + # Code from module select-tests: # Code from module setenv: # Code from module setenv-tests: # Code from module setlocale: + # Code from module setlocale-null: + # Code from module setlocale-null-tests: # Code from module setlocale-tests: + # Code from module setsockopt: + # Code from module setsockopt-tests: + # Code from module sigaction: + # Code from module sigaction-tests: # Code from module signal-h: # Code from module signal-h-tests: # Code from module signbit: @@ -178,9 +273,18 @@ AC_DEFUN([gl_EARLY], # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: - # Code from module snippet/unused-parameter: # Code from module snippet/warn-on-use: + # Code from module socket: + # Code from module socketlib: + # Code from module sockets: + # Code from module sockets-tests: + # Code from module socklen: # Code from module ssize_t: + # Code from module stat: + # Code from module stat-tests: + # Code from module stat-time: + # Code from module stat-time-tests: + # Code from module std-gnu11: # Code from module stdalign: # Code from module stdalign-tests: # Code from module stdbool: @@ -197,6 +301,8 @@ AC_DEFUN([gl_EARLY], # Code from module strerror: # Code from module strerror-override: # Code from module strerror-tests: + # Code from module strerror_r-posix: + # Code from module strerror_r-posix-tests: # Code from module striconveh: # Code from module striconveh-tests: # Code from module striconveha: @@ -208,11 +314,26 @@ AC_DEFUN([gl_EARLY], # Code from module strstr: # Code from module strstr-simple: # Code from module strstr-tests: + # Code from module symlink: + # Code from module symlink-tests: + # Code from module sys_ioctl: + # Code from module sys_ioctl-tests: + # Code from module sys_select: + # Code from module sys_select-tests: + # Code from module sys_socket: + # Code from module sys_socket-tests: + # Code from module sys_stat: + # Code from module sys_stat-tests: + # Code from module sys_time: + # Code from module sys_time-tests: # Code from module sys_types: # Code from module sys_types-tests: + # Code from module sys_uio: + # Code from module sys_uio-tests: # Code from module test-framework-sh: # Code from module test-framework-sh-tests: # Code from module thread: + # Code from module thread-optim: # Code from module thread-tests: # Code from module threadlib: gl_THREADLIB_EARLY @@ -607,6 +728,18 @@ AC_DEFUN([gl_EARLY], # Code from module unictype/property-deprecated-tests: # Code from module unictype/property-diacritic: # Code from module unictype/property-diacritic-tests: + # Code from module unictype/property-emoji: + # Code from module unictype/property-emoji-component: + # Code from module unictype/property-emoji-component-tests: + # Code from module unictype/property-emoji-modifier: + # Code from module unictype/property-emoji-modifier-base: + # Code from module unictype/property-emoji-modifier-base-tests: + # Code from module unictype/property-emoji-modifier-tests: + # Code from module unictype/property-emoji-presentation: + # Code from module unictype/property-emoji-presentation-tests: + # Code from module unictype/property-emoji-tests: + # Code from module unictype/property-extended-pictographic: + # Code from module unictype/property-extended-pictographic-tests: # Code from module unictype/property-extender: # Code from module unictype/property-extender-tests: # Code from module unictype/property-format-control: @@ -685,6 +818,8 @@ AC_DEFUN([gl_EARLY], # Code from module unictype/property-quotation-mark-tests: # Code from module unictype/property-radical: # Code from module unictype/property-radical-tests: + # Code from module unictype/property-regional-indicator: + # Code from module unictype/property-regional-indicator-tests: # Code from module unictype/property-sentence-terminal: # Code from module unictype/property-sentence-terminal-tests: # Code from module unictype/property-soft-dotted: @@ -1160,6 +1295,7 @@ AC_DEFUN([gl_EARLY], # Code from module unsetenv-tests: # Code from module usleep: # Code from module usleep-tests: + # Code from module vararrays: # Code from module verify: # Code from module verify-tests: # Code from module wchar: @@ -1172,6 +1308,12 @@ AC_DEFUN([gl_EARLY], # Code from module wctype-h-tests: # Code from module wcwidth: # Code from module wcwidth-tests: + # Code from module windows-mutex: + # Code from module windows-once: + # Code from module windows-recmutex: + # Code from module windows-rwlock: + # Code from module windows-thread: + # Code from module windows-tls: # Code from module xalloc: # Code from module xalloc-die: # Code from module xalloc-die-tests: @@ -1184,6 +1326,7 @@ AC_DEFUN([gl_EARLY], # "Check for header files, types and library functions". AC_DEFUN([gl_INIT], [ + AC_CONFIG_LIBOBJ_DIR([tests]) AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) gl_cond_libtool=true gl_m4_base='gnulib-m4' @@ -1192,21 +1335,36 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) m4_pushdef([gl_LIBSOURCES_LIST], []) m4_pushdef([gl_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gl]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON gl_source_base='lib' + gl_source_base_prefix= gl_FUNC_ALLOCA + gl_CONDITIONAL_HEADER([alloca.h]) + AC_PROG_MKDIR_P + AC_REQUIRE([AC_C_RESTRICT]) gl___BUILTIN_EXPECT - gl_CONFIGMAKE_PREP gl_HEADER_ERRNO_H + gl_CONDITIONAL_HEADER([errno.h]) + AC_PROG_MKDIR_P AC_REQUIRE([gl_EXTERN_INLINE]) AC_C_FLEXIBLE_ARRAY_MEMBER gl_FLOAT_H + gl_CONDITIONAL_HEADER([float.h]) + AC_PROG_MKDIR_P if test $REPLACE_FLOAT_LDBL = 1; then AC_LIBOBJ([float]) fi if test $REPLACE_ITOLD = 1; then AC_LIBOBJ([itold]) fi + gl_FUNC_FREE + if test $REPLACE_FREE = 1; then + AC_LIBOBJ([free]) + gl_PREREQ_FREE + fi + gl_STDLIB_MODULE_INDICATOR([free-posix]) gl_FUNC_FREXP_NO_LIBM if test $gl_func_frexp_no_libm != yes; then AC_LIBOBJ([frexp]) @@ -1221,13 +1379,20 @@ AC_DEFUN([gl_INIT], if test $ac_cv_func___fseterr = no; then AC_LIBOBJ([fseterr]) fi - gl_HARD_LOCALE - AC_REQUIRE([gl_HOST_CPU_C_ABI]) + AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) + LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" + AC_SUBST([LIB_HARD_LOCALE]) + AC_DEFUN([gl_HAVE_MODULE_HAVELIB]) AM_ICONV m4_ifdef([gl_ICONV_MODULE_INDICATOR], [gl_ICONV_MODULE_INDICATOR([iconv])]) gl_ICONV_H + gl_ICONV_H_REQUIRE_DEFAULTS + gl_CONDITIONAL_HEADER([iconv.h]) + AC_PROG_MKDIR_P gl_FUNC_ICONV_OPEN + dnl Because of gl_REPLACE_ICONV_H: + gl_CONDITIONAL_HEADER([iconv.h]) if test $REPLACE_ICONV_OPEN = 1; then AC_LIBOBJ([iconv_open]) fi @@ -1236,6 +1401,9 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([iconv_close]) fi gl_INLINE + gl_INTTYPES_INCOMPLETE + gl_INTTYPES_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_FUNC_ISNAND_NO_LIBM if test $gl_func_isnand_no_libm != yes; then AC_LIBOBJ([isnand]) @@ -1260,26 +1428,60 @@ AC_DEFUN([gl_INIT], fi fi gl_WCTYPE_MODULE_INDICATOR([iswblank]) + gl_FUNC_ISWDIGIT + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $REPLACE_ISWDIGIT = 1; then + AC_LIBOBJ([iswdigit]) + fi + fi + gl_WCTYPE_MODULE_INDICATOR([iswdigit]) + gl_FUNC_ISWXDIGIT + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + else + if test $REPLACE_ISWXDIGIT = 1; then + AC_LIBOBJ([iswxdigit]) + fi + fi + gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) gl_LANGINFO_H + gl_LANGINFO_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_LIMITS_H + gl_CONDITIONAL_HEADER([limits.h]) + AC_PROG_MKDIR_P gl_LOCALCHARSET - LOCALCHARSET_TESTS_ENVIRONMENT="CHARSETALIASDIR=\"\$(abs_top_builddir)/$gl_source_base\"" + dnl For backward compatibility. Some packages still use this. + LOCALCHARSET_TESTS_ENVIRONMENT= AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) + gl_LOCALE_H + gl_LOCALE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_LOCALENAME + gl_LOCALE_MODULE_INDICATOR([localename]) gl_LOCK gl_MODULE_INDICATOR([lock]) - gl_FUNC_MALLOC_POSIX - if test $REPLACE_MALLOC = 1; then + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then AC_LIBOBJ([malloc]) fi gl_STDLIB_MODULE_INDICATOR([malloc-posix]) gl_MALLOCA gl_MATH_H + gl_MATH_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_MBCHAR gl_MBITER gl_FUNC_MBRTOWC if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then AC_LIBOBJ([mbrtowc]) + if test $REPLACE_MBSTATE_T = 1; then + AC_LIBOBJ([lc-charset-dispatch]) + AC_LIBOBJ([mbtowc-lock]) + gl_PREREQ_MBTOWC_LOCK + fi gl_PREREQ_MBRTOWC fi gl_WCHAR_MODULE_INDICATOR([mbrtowc]) @@ -1291,7 +1493,7 @@ AC_DEFUN([gl_INIT], gl_WCHAR_MODULE_INDICATOR([mbsinit]) gl_STRING_MODULE_INDICATOR([mbsnlen]) gl_FUNC_MEMCHR - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + if test $REPLACE_MEMCHR = 1; then AC_LIBOBJ([memchr]) gl_PREREQ_MEMCHR fi @@ -1305,6 +1507,12 @@ AC_DEFUN([gl_INIT], if test $RELOCATABLE = yes; then AC_LIBOBJ([relocatable]) fi + gl_FUNC_SETLOCALE_NULL + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + AC_LIBOBJ([setlocale-lock]) + gl_PREREQ_SETLOCALE_LOCK + fi + gl_LOCALE_MODULE_INDICATOR([setlocale_null]) gl_SIGNBIT if test $REPLACE_SIGNBIT = 1; then AC_LIBOBJ([signbitf]) @@ -1314,15 +1522,28 @@ AC_DEFUN([gl_INIT], gl_MATH_MODULE_INDICATOR([signbit]) gl_SIZE_MAX gt_TYPE_SSIZE_T - AM_STDBOOL_H + gl_STDBOOL_H + gl_CONDITIONAL_HEADER([stdbool.h]) + AC_PROG_MKDIR_P gl_STDDEF_H + gl_STDDEF_H_REQUIRE_DEFAULTS + gl_CONDITIONAL_HEADER([stddef.h]) + AC_PROG_MKDIR_P gl_STDINT_H + gl_CONDITIONAL_HEADER([stdint.h]) + dnl Because of gl_REPLACE_LIMITS_H: + gl_CONDITIONAL_HEADER([limits.h]) + AC_PROG_MKDIR_P gl_STDLIB_H + gl_STDLIB_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi - gl_HEADER_STRING_H + gl_STRING_H + gl_STRING_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_FUNC_STRNCAT if test $REPLACE_STRNCAT = 1; then AC_LIBOBJ([strncat]) @@ -1339,75 +1560,80 @@ AC_DEFUN([gl_INIT], fi gl_STRING_MODULE_INDICATOR([strstr]) gl_SYS_TYPES_H + gl_SYS_TYPES_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_CHECK_HEADERS([sys/single_threaded.h]) + AC_REQUIRE([gl_THREADLIB]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unicase.h]) AC_PROG_MKDIR_P - gl_THREADLIB - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unicase.h]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.1], [unicase/empty-prefix-context]) - gl_LIBUNISTRING_MODULE([0.9.1], [unicase/empty-suffix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/empty-prefix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/empty-suffix-context]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.3], [unicase/locale-language]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-casecmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-casecoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-casexfrm]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-ct-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-ct-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-ct-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-ct-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-is-cased]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-is-casefolded]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-is-lowercase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-is-titlecase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-is-uppercase]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u16-prefix-context]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u16-suffix-context]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u16-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-casecmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-casecoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-casexfrm]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-ct-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-ct-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-ct-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-ct-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-is-cased]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-is-casefolded]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-is-lowercase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-is-titlecase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-is-uppercase]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u32-prefix-context]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u32-suffix-context]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u32-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-casecmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-casecoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-casexfrm]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-ct-casefold]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-ct-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-ct-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-ct-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-is-cased]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-is-casefolded]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-is-lowercase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-is-titlecase]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-is-uppercase]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u8-prefix-context]) - gl_LIBUNISTRING_MODULE([0.9.10], [unicase/u8-suffix-context]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-tolower]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-totitle]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/u8-toupper]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/ulc-casecmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/ulc-casecoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [unicase/ulc-casexfrm]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [uniconv.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-casecmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-casecoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-casexfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-ct-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-ct-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-ct-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-ct-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-is-cased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-is-casefolded]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-is-lowercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-is-titlecase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-is-uppercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-prefix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-suffix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u16-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-casecmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-casecoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-casexfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-ct-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-ct-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-ct-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-ct-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-is-cased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-is-casefolded]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-is-lowercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-is-titlecase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-is-uppercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-prefix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-suffix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u32-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-casecmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-casecoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-casexfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-ct-casefold]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-ct-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-ct-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-ct-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-is-cased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-is-casefolded]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-is-lowercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-is-titlecase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-is-uppercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-prefix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-suffix-context]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-tolower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-totitle]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/u8-toupper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/ulc-casecmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/ulc-casecoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [unicase/ulc-casexfrm]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniconv.h]) + AC_PROG_MKDIR_P AC_REQUIRE([gl_BIGENDIAN]) gl_LIBUNISTRING_MODULE([0.9], [uniconv/u16-conv-from-enc]) AC_REQUIRE([gl_BIGENDIAN]) @@ -1429,48 +1655,49 @@ AC_DEFUN([gl_INIT], gl_LIBUNISTRING_MODULE([0.9], [uniconv/u8-strconv-from-locale]) gl_LIBUNISTRING_MODULE([0.9], [uniconv/u8-strconv-to-enc]) gl_LIBUNISTRING_MODULE([0.9], [uniconv/u8-strconv-to-locale]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unictype.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/bidiclass-byname]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/bidiclass-longname]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/bidiclass-name]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/bidiclass-of]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/bidiclass-test]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/block-list]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/block-test]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-C]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unictype.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/bidiclass-byname]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/bidiclass-longname]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/bidiclass-name]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/bidiclass-of]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/bidiclass-test]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/block-list]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/block-test]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-C]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Cc]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Cf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Cn]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Cf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Cn]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Co]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Cs]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-L]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-LC]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Ll]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Lm]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Lo]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-L]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-LC]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Ll]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Lm]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Lo]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Lt]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Lu]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-M]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Mc]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Lu]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-M]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Mc]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Me]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Mn]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-N]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Nd]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Mn]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-N]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Nd]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Nl]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-No]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-P]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-No]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-P]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Pc]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Pd]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Pe]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Pd]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Pe]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Pf]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Pi]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Po]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Ps]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-S]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Sc]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Sk]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Po]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Ps]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-S]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Sc]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-Sk]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Sm]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-So]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-So]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Z]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Zl]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-Zp]) @@ -1482,18 +1709,18 @@ AC_DEFUN([gl_INIT], gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-name]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-none]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-of]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/category-of]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-or]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/category-test]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/combining-class]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/combining-class]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/combining-class-byname]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/combining-class-longname]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/combining-class-name]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-alnum]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-alnum]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-alpha]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-alpha]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank]) AC_REQUIRE([AC_C_INLINE]) @@ -1501,38 +1728,38 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-graph]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-graph]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-lower]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-lower]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-print]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-print]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-punct]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-punct]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-upper]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/ctype-upper]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/decimal-digit]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/digit]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joininggroup-byname]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joininggroup-name]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joininggroup-of]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/decimal-digit]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/digit]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/joininggroup-byname]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/joininggroup-name]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/joininggroup-of]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joiningtype-byname]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joiningtype-longname]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joiningtype-name]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/joiningtype-of]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/mirror]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/numeric]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/joiningtype-of]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/mirror]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/numeric]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-alphabetic]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-alphabetic]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-ascii-hex-digit]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-arabic-digit]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-arabic-digit]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-arabic-right-to-left]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-arabic-right-to-left]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-block-separator]) AC_REQUIRE([AC_C_INLINE]) @@ -1546,80 +1773,92 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-eur-num-separator]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-eur-num-terminator]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-eur-num-terminator]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-european-digit]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-european-digit]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-hebrew-right-to-left]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-hebrew-right-to-left]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-left-to-right]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-left-to-right]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-non-spacing-mark]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-non-spacing-mark]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-other-neutral]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-bidi-other-neutral]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-pdf]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-segment-separator]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-bidi-whitespace]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-byname]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-byname]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-case-ignorable]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-case-ignorable]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-cased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-cased]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-changes-when-casefolded]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-changes-when-casefolded]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-changes-when-casemapped]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-changes-when-casemapped]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-changes-when-lowercased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-changes-when-lowercased]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-changes-when-titlecased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-changes-when-titlecased]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-changes-when-uppercased]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-changes-when-uppercased]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-combining]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-combining]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-composite]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-composite]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-currency-symbol]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-currency-symbol]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-dash]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-dash]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-decimal-digit]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-decimal-digit]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-default-ignorable-code-point]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-default-ignorable-code-point]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-deprecated]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-diacritic]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-diacritic]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-emoji]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-emoji-component]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-emoji-modifier]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-emoji-modifier-base]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-emoji-presentation]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-extender]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-extended-pictographic]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-extender]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-format-control]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-grapheme-base]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-grapheme-base]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-grapheme-extend]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-grapheme-extend]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-grapheme-link]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-grapheme-link]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-hex-digit]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-hyphen]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-id-continue]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-id-continue]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-id-start]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-id-start]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-ideographic]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-ideographic]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-ids-binary-operator]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-ids-trinary-operator]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-ignorable-control]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-ignorable-control]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-iso-control]) AC_REQUIRE([AC_C_INLINE]) @@ -1631,7 +1870,7 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-logical-order-exception]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-lowercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-lowercase]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-math]) AC_REQUIRE([AC_C_INLINE]) @@ -1639,19 +1878,19 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-not-a-character]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-numeric]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-numeric]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-alphabetic]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-other-alphabetic]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-default-ignorable-code-point]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-grapheme-extend]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-other-grapheme-extend]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-id-continue]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-id-start]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-lowercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-other-lowercase]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-other-math]) AC_REQUIRE([AC_C_INLINE]) @@ -1667,110 +1906,119 @@ AC_DEFUN([gl_INIT], AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-private-use]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-punctuation]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-punctuation]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-quotation-mark]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-radical]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-sentence-terminal]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-regional-indicator]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-sentence-terminal]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-soft-dotted]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-soft-dotted]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-space]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-terminal-punctuation]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-terminal-punctuation]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-test]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-titlecase]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-unassigned-code-value]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-unassigned-code-value]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-unified-ideograph]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-unified-ideograph]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-uppercase]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-uppercase]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-variation-selector]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-variation-selector]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-white-space]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-xid-continue]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-xid-continue]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-xid-start]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-xid-start]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/property-zero-width]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/scripts]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/property-zero-width]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/scripts]) AC_REQUIRE([AC_C_INLINE]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/syntax-c-ident]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/syntax-c-whitespace]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unictype/syntax-java-ident]) + gl_LIBUNISTRING_MODULE([0.9.11], [unictype/syntax-java-ident]) gl_LIBUNISTRING_MODULE([0.9.8], [unictype/syntax-java-whitespace]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unigbrk.h]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unigbrk.h]) + AC_PROG_MKDIR_P gl_MODULE_INDICATOR([unigbrk/u16-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u16-grapheme-breaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u16-grapheme-breaks]) gl_MODULE_INDICATOR([unigbrk/u16-grapheme-next]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u16-grapheme-next]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u16-grapheme-next]) gl_MODULE_INDICATOR([unigbrk/u16-grapheme-prev]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u16-grapheme-prev]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u16-grapheme-prev]) gl_MODULE_INDICATOR([unigbrk/u32-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u32-grapheme-breaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u32-grapheme-breaks]) gl_MODULE_INDICATOR([unigbrk/u32-grapheme-next]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u32-grapheme-next]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u32-grapheme-next]) gl_MODULE_INDICATOR([unigbrk/u32-grapheme-prev]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u32-grapheme-prev]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u32-grapheme-prev]) gl_MODULE_INDICATOR([unigbrk/u8-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u8-grapheme-breaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u8-grapheme-breaks]) gl_MODULE_INDICATOR([unigbrk/u8-grapheme-next]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u8-grapheme-next]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u8-grapheme-next]) gl_MODULE_INDICATOR([unigbrk/u8-grapheme-prev]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/u8-grapheme-prev]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/uc-gbrk-prop]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/u8-grapheme-prev]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/uc-gbrk-prop]) gl_MODULE_INDICATOR([unigbrk/uc-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/uc-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/uc-is-grapheme-break]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/uc-grapheme-breaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/uc-is-grapheme-break]) gl_MODULE_INDICATOR([unigbrk/ulc-grapheme-breaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unigbrk/ulc-grapheme-breaks]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unilbrk.h]) + gl_LIBUNISTRING_MODULE([0.9.11], [unigbrk/ulc-grapheme-breaks]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unilbrk.h]) + AC_PROG_MKDIR_P AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u16-possible-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u16-width-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u32-possible-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u32-width-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u8-possible-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/u8-width-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/ulc-possible-linebreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [unilbrk/ulc-width-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u16-possible-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u16-width-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u32-possible-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u32-width-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u8-possible-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/u8-width-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/ulc-possible-linebreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [unilbrk/ulc-width-linebreaks]) gl_LIBUNISTRING_LIBHEADER([0.9.5], [uniname.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniname/uniname]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [uninorm.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/canonical-decomposition]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/composition]) - gl_LIBUNISTRING_MODULE([0.9.5], [uninorm/decomposing-form]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/decomposition]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [uniname/uniname]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uninorm.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/canonical-decomposition]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/composition]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/decomposing-form]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/decomposition]) AC_REQUIRE([AC_C_INLINE]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/filter]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/nfc]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/nfd]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/nfkc]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/nfkd]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/filter]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/nfc]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/nfd]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/nfkc]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/nfkd]) gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u16-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u16-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u16-normcmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u16-normcoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u16-normxfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u16-normalize]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u16-normcmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u16-normcoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u16-normxfrm]) gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u32-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u32-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u32-normcmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u32-normcoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u32-normxfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u32-normalize]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u32-normcmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u32-normcoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u32-normxfrm]) gl_MODULE_INDICATOR_FOR_TESTS([uninorm/u8-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u8-normalize]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u8-normcmp]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u8-normcoll]) - gl_LIBUNISTRING_MODULE([0.9.8], [uninorm/u8-normxfrm]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u8-normalize]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u8-normcmp]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u8-normcoll]) + gl_LIBUNISTRING_MODULE([0.9.11], [uninorm/u8-normxfrm]) gl_UNISTD_H - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unistdio.h]) + gl_UNISTD_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unistdio.h]) + AC_PROG_MKDIR_P gl_PREREQ_PRINTF_ARGS gl_LIBUNISTRING_MODULE([0.9], [unistdio/u16-asnprintf]) gl_LIBUNISTRING_MODULE([0.9], [unistdio/u16-asprintf]) @@ -1829,19 +2077,20 @@ AC_DEFUN([gl_INIT], gl_LIBUNISTRING_MODULE([0.9], [unistdio/u8-vasprintf]) gl_LIBUNISTRING_MODULE([0.9], [unistdio/u8-vsnprintf]) gl_LIBUNISTRING_MODULE([0.9], [unistdio/u8-vsprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-asnprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-asprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-fprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-asnprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-asprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-fprintf]) gl_PREREQ_PRINTF_PARSE - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-snprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-sprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-snprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-sprintf]) gl_PREREQ_VASNPRINTF_WITH_EXTRAS - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-vasnprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-vasprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-vfprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-vsnprintf]) - gl_LIBUNISTRING_MODULE([0.9.8], [unistdio/ulc-vsprintf]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unistr.h]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-vasnprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-vasprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-vfprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-vsnprintf]) + gl_LIBUNISTRING_MODULE([0.9.11], [unistdio/ulc-vsprintf]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unistr.h]) + AC_PROG_MKDIR_P gl_LIBUNISTRING_MODULE([0.9], [unistr/u16-check]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u16-chr]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u16-cmp]) @@ -1979,28 +2228,75 @@ AC_DEFUN([gl_INIT], gl_LIBUNISTRING_MODULE([0.9.3], [unistr/u8-to-u32]) gl_MODULE_INDICATOR([unistr/u8-uctomb]) gl_LIBUNISTRING_MODULE([0.9], [unistr/u8-uctomb]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [unitypes.h]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [uniwbrk.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwbrk/u16-wordbreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwbrk/u32-wordbreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwbrk/u8-wordbreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwbrk/ulc-wordbreaks]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwbrk/wordbreak-property]) - gl_LIBUNISTRING_LIBHEADER([0.9.4], [uniwidth.h]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u16-strwidth]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u16-width]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u32-strwidth]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u32-width]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u8-strwidth]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/u8-width]) - gl_LIBUNISTRING_MODULE([0.9.8], [uniwidth/width]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) + AC_PROG_MKDIR_P + AH_VERBATIM([unitypes_restrict], [ + /* This definition is a duplicate of the one in unitypes.h. + It is here so that we can cope with an older version of unitypes.h + that does not contain this definition and that is pre-installed among + the public header files. */ + # if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 + # define _UC_RESTRICT __restrict + # elif 199901L <= __STDC_VERSION__ || defined restrict + # define _UC_RESTRICT restrict + # else + # define _UC_RESTRICT + # endif + ]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwbrk.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [uniwbrk/u16-wordbreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwbrk/u32-wordbreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwbrk/u8-wordbreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwbrk/ulc-wordbreaks]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwbrk/wordbreak-property]) + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u16-strwidth]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u16-width]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u32-strwidth]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u32-width]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u8-strwidth]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/u8-width]) + gl_LIBUNISTRING_MODULE([0.9.11], [uniwidth/width]) gl_WCHAR_H + gl_WCHAR_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_WCTYPE_H + gl_WCTYPE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_FUNC_WCWIDTH if test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) + gl_PREREQ_WCWIDTH fi gl_WCHAR_MODULE_INDICATOR([wcwidth]) + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-mutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-once]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-recmutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-rwlock]) + ;; + esac gl_XSIZE # End of code from modules m4_ifval(gl_LIBSOURCES_LIST, [ @@ -2014,6 +2310,8 @@ AC_DEFUN([gl_INIT], m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gl_LIBSOURCES_DIR]) m4_popdef([gl_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) @@ -2040,14 +2338,32 @@ AC_DEFUN([gl_INIT], m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) m4_pushdef([gltests_LIBSOURCES_LIST], []) m4_pushdef([gltests_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gltests]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) gl_COMMON + AC_REQUIRE([gl_CC_ALLOW_WARNINGS]) + AC_REQUIRE([gl_CXX_ALLOW_WARNINGS]) gl_source_base='tests' + gl_source_base_prefix= changequote(,)dnl gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS changequote([, ])dnl AC_SUBST([gltests_WITNESS]) gl_module_indicator_condition=$gltests_WITNESS m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([accept]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([accept]) + gl_ARPA_INET_H + gl_ARPA_INET_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([bind]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([bind]) gl_FUNC_BTOWC if test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1; then AC_LIBOBJ([btowc]) @@ -2058,25 +2374,89 @@ changequote([, ])dnl gt_LOCALE_FR_UTF8 gt_LOCALE_FR gt_LOCALE_TR_UTF8 + gl_FUNC_CALLOC_GNU + if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then + AC_LIBOBJ([calloc]) + fi + gl_STDLIB_MODULE_INDICATOR([calloc-gnu]) + gl_FUNC_CALLOC_POSIX + if test $REPLACE_CALLOC_FOR_CALLOC_POSIX = 1; then + AC_LIBOBJ([calloc]) + fi + gl_STDLIB_MODULE_INDICATOR([calloc-posix]) + gl_MODULE_INDICATOR_FOR_TESTS([cloexec]) + gl_FUNC_CLOSE + if test $REPLACE_CLOSE = 1; then + AC_LIBOBJ([close]) + fi + gl_UNISTD_MODULE_INDICATOR([close]) + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([connect]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([connect]) gl_CTYPE_H - gl_DIRNAME_LGPL + gl_CTYPE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_DOUBLE_SLASH_ROOT + gl_FUNC_DUP2 + if test $REPLACE_DUP2 = 1; then + AC_LIBOBJ([dup2]) + gl_PREREQ_DUP2 + fi + gl_UNISTD_MODULE_INDICATOR([dup2]) gl_ENVIRON gl_UNISTD_MODULE_INDICATOR([environ]) gl_ERROR - if test $ac_cv_lib_error_at_line = no; then + AS_IF([test "$ac_cv_lib_error_at_line" = no], [ AC_LIBOBJ([error]) gl_PREREQ_ERROR - fi + ]) m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) + gl_FUNC_FCNTL + if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then + AC_LIBOBJ([fcntl]) + fi + gl_FCNTL_MODULE_INDICATOR([fcntl]) + gl_FCNTL_H + gl_FCNTL_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_FUNC_FDOPEN if test $REPLACE_FDOPEN = 1; then AC_LIBOBJ([fdopen]) gl_PREREQ_FDOPEN fi gl_STDIO_MODULE_INDICATOR([fdopen]) + gl_FUNC_FSTAT + if test $REPLACE_FSTAT = 1; then + AC_LIBOBJ([fstat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac + gl_PREREQ_FSTAT + fi + gl_SYS_STAT_MODULE_INDICATOR([fstat]) + gl_FUNC_FTRUNCATE + if test $HAVE_FTRUNCATE = 0 || test $REPLACE_FTRUNCATE = 1; then + AC_LIBOBJ([ftruncate]) + gl_PREREQ_FTRUNCATE + fi + gl_UNISTD_MODULE_INDICATOR([ftruncate]) + gl_FUNC_GETCWD_LGPL + if test $REPLACE_GETCWD = 1; then + AC_LIBOBJ([getcwd-lgpl]) + fi + gl_UNISTD_MODULE_INDICATOR([getcwd]) + gl_FUNC_GETDTABLESIZE + if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then + AC_LIBOBJ([getdtablesize]) + gl_PREREQ_GETDTABLESIZE + fi + gl_UNISTD_MODULE_INDICATOR([getdtablesize]) gl_FUNC_GETPAGESIZE if test $REPLACE_GETPAGESIZE = 1; then AC_LIBOBJ([getpagesize]) @@ -2085,28 +2465,75 @@ changequote([, ])dnl gl_FUNC_GETPROGNAME AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) + gl_FUNC_GETTIMEOFDAY + if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then + AC_LIBOBJ([gettimeofday]) + gl_PREREQ_GETTIMEOFDAY + fi + gl_SYS_TIME_MODULE_INDICATOR([gettimeofday]) + gl_MUSL_LIBC + dnl Distinguish OpenBSD >= 6.2 from OpenBSD < 6.2. + AC_CHECK_FUNCS_ONCE([duplocale]) + gl_FUNC_INET_PTON + if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1; then + AC_LIBOBJ([inet_pton]) + gl_PREREQ_INET_PTON + fi + gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) + AC_C_BIGENDIAN gl_INTTYPES_H - gl_INTTYPES_INCOMPLETE + gl_FUNC_IOCTL + if test $HAVE_IOCTL = 0 || test $REPLACE_IOCTL = 1; then + AC_LIBOBJ([ioctl]) + fi + gl_SYS_IOCTL_MODULE_INDICATOR([ioctl]) gl_FUNC_ISBLANK if test $HAVE_ISBLANK = 0; then AC_LIBOBJ([isblank]) fi + gl_MODULE_INDICATOR([isblank]) gl_CTYPE_MODULE_INDICATOR([isblank]) gl_DOUBLE_EXPONENT_LOCATION gl_FLOAT_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) - gl_LOCALE_H + gt_LOCALE_FR + gt_LOCALE_FR_UTF8 + gt_LOCALE_JA + gt_LOCALE_ZH_CN + gt_LOCALE_FR + gt_LOCALE_FR_UTF8 + gt_LOCALE_JA + gt_LOCALE_ZH_CN + AC_REQUIRE([gl_LARGEFILE]) + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([listen]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([listen]) AC_CHECK_FUNCS_ONCE([newlocale]) AC_CHECK_FUNCS_ONCE([newlocale]) AC_CHECK_HEADERS_ONCE([semaphore.h]) + AC_CHECK_DECLS_ONCE([alarm]) + AC_REQUIRE([gl_SEMAPHORE]) + gl_FUNC_LSTAT + if test $REPLACE_LSTAT = 1; then + AC_LIBOBJ([lstat]) + gl_PREREQ_LSTAT + fi + gl_SYS_STAT_MODULE_INDICATOR([lstat]) + gl_FUNC_MALLOC_GNU + if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then + AC_LIBOBJ([malloc]) + fi + gl_STDLIB_MODULE_INDICATOR([malloc-gnu]) gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN gt_LOCALE_FR_UTF8 gl_FUNC_MBTOWC - if test $REPLACE_MBTOWC = 1; then + if test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1; then AC_LIBOBJ([mbtowc]) gl_PREREQ_MBTOWC fi @@ -2124,6 +2551,41 @@ changequote([, ])dnl AC_LIBOBJ([msvc-nothrow]) fi gl_MODULE_INDICATOR([msvc-nothrow]) + gl_FUNC_NANOSLEEP + if test $HAVE_NANOSLEEP = 0 || test $REPLACE_NANOSLEEP = 1; then + AC_LIBOBJ([nanosleep]) + gl_PREREQ_NANOSLEEP + fi + gl_TIME_MODULE_INDICATOR([nanosleep]) + AC_CHECK_DECLS_ONCE([alarm]) + gl_HEADER_NETINET_IN + gl_CONDITIONAL_HEADER([netinet/in.h]) + AC_PROG_MKDIR_P + gl_FUNC_OPEN + if test $REPLACE_OPEN = 1; then + AC_LIBOBJ([open]) + gl_PREREQ_OPEN + fi + gl_FCNTL_MODULE_INDICATOR([open]) + gl_PATHMAX + gl_FUNC_PERROR + if test $REPLACE_PERROR = 1; then + AC_LIBOBJ([perror]) + fi + gl_STRING_MODULE_INDICATOR([perror]) + gl_FUNC_PIPE + if test $HAVE_PIPE = 0; then + AC_LIBOBJ([pipe]) + fi + gl_UNISTD_MODULE_INDICATOR([pipe]) + gl_PTHREAD_H + gl_PTHREAD_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_PTHREAD_THREAD + if test $HAVE_PTHREAD_CREATE = 0 || test $REPLACE_PTHREAD_CREATE = 1; then + AC_LIBOBJ([pthread-thread]) + fi + gl_PTHREAD_MODULE_INDICATOR([pthread-thread]) gl_FUNC_PTHREAD_SIGMASK if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then AC_LIBOBJ([pthread_sigmask]) @@ -2142,6 +2604,37 @@ changequote([, ])dnl gl_PREREQ_RAISE fi gl_SIGNAL_MODULE_INDICATOR([raise]) + gl_FUNC_REALLOC_GNU + if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then + AC_LIBOBJ([realloc]) + fi + gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) + gl_FUNC_REALLOC_POSIX + if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then + AC_LIBOBJ([realloc]) + fi + gl_STDLIB_MODULE_INDICATOR([realloc-posix]) + gl_FUNC_REALLOCARRAY + if test $HAVE_REALLOCARRAY = 0 || test $REPLACE_REALLOCARRAY = 1; then + AC_LIBOBJ([reallocarray]) + gl_PREREQ_REALLOCARRAY + fi + gl_MODULE_INDICATOR([reallocarray]) + gl_STDLIB_MODULE_INDICATOR([reallocarray]) + gl_SCHED_H + gl_SCHED_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_FUNC_SCHED_YIELD + if test $HAVE_SCHED_YIELD = 0 || test $REPLACE_SCHED_YIELD = 1; then + AC_LIBOBJ([sched_yield]) + fi + gl_SCHED_MODULE_INDICATOR([sched_yield]) + gl_FUNC_SELECT + if test $REPLACE_SELECT = 1; then + AC_LIBOBJ([select]) + fi + gl_SYS_SELECT_MODULE_INDICATOR([select]) + AC_CHECK_HEADERS_ONCE([sys/wait.h]) gl_FUNC_SETENV if test $HAVE_SETENV = 0 || test $REPLACE_SETENV = 1; then AC_LIBOBJ([setenv]) @@ -2157,7 +2650,20 @@ changequote([, ])dnl gt_LOCALE_FR_UTF8 gt_LOCALE_JA gt_LOCALE_ZH_CN + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([setsockopt]) + fi + gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt]) + gl_SIGACTION + if test $HAVE_SIGACTION = 0; then + AC_LIBOBJ([sigaction]) + gl_PREREQ_SIGACTION + fi + gl_SIGNAL_MODULE_INDICATOR([sigaction]) gl_SIGNAL_H + gl_SIGNAL_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P AC_REQUIRE([gl_FLOAT_EXPONENT_LOCATION]) AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) AC_REQUIRE([gl_LONG_DOUBLE_EXPONENT_LOCATION]) @@ -2173,10 +2679,67 @@ changequote([, ])dnl fi gl_UNISTD_MODULE_INDICATOR([sleep]) AC_CHECK_DECLS_ONCE([alarm]) + AC_REQUIRE([gl_SYS_SOCKET_H]) + if test "$ac_cv_header_winsock2_h" = yes; then + AC_LIBOBJ([socket]) + fi + # When this module is used, sockets may actually occur as file descriptors, + # hence it is worth warning if the modules 'close' and 'ioctl' are not used. + m4_ifdef([gl_UNISTD_H_DEFAULTS], [gl_UNISTD_H_REQUIRE_DEFAULTS]) + m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [gl_SYS_IOCTL_H_REQUIRE_DEFAULTS]) + AC_REQUIRE([gl_PREREQ_SYS_H_WINSOCK2]) + if test "$ac_cv_header_winsock2_h" = yes; then + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=1 + fi + gl_SYS_SOCKET_MODULE_INDICATOR([socket]) + AC_REQUIRE([gl_SOCKETLIB]) + AC_REQUIRE([gl_SOCKETS]) + gl_TYPE_SOCKLEN_T + gl_FUNC_STAT + if test $REPLACE_STAT = 1; then + AC_LIBOBJ([stat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac + gl_PREREQ_STAT + fi + gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_STAT_TIME + gl_STAT_BIRTHTIME gl_STDALIGN_H + gl_CONDITIONAL_HEADER([stdalign.h]) + AC_PROG_MKDIR_P AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) gl_STDIO_H + gl_STDIO_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + dnl No need to create extra modules for these functions. Everyone who uses + dnl <stdio.h> likely needs them. + gl_STDIO_MODULE_INDICATOR([fscanf]) + gl_MODULE_INDICATOR([fscanf]) + gl_STDIO_MODULE_INDICATOR([scanf]) + gl_MODULE_INDICATOR([scanf]) + gl_STDIO_MODULE_INDICATOR([fgetc]) + gl_STDIO_MODULE_INDICATOR([getc]) + gl_STDIO_MODULE_INDICATOR([getchar]) + gl_STDIO_MODULE_INDICATOR([fgets]) + gl_STDIO_MODULE_INDICATOR([fread]) + dnl No need to create extra modules for these functions. Everyone who uses + dnl <stdio.h> likely needs them. + gl_STDIO_MODULE_INDICATOR([fprintf]) + gl_STDIO_MODULE_INDICATOR([printf]) + gl_STDIO_MODULE_INDICATOR([vfprintf]) + gl_STDIO_MODULE_INDICATOR([vprintf]) + gl_STDIO_MODULE_INDICATOR([fputc]) + gl_STDIO_MODULE_INDICATOR([putc]) + gl_STDIO_MODULE_INDICATOR([putchar]) + gl_STDIO_MODULE_INDICATOR([fputs]) + gl_STDIO_MODULE_INDICATOR([puts]) + gl_STDIO_MODULE_INDICATOR([fwrite]) gl_FUNC_STRERROR if test $REPLACE_STRERROR = 1; then AC_LIBOBJ([strerror]) @@ -2189,6 +2752,14 @@ changequote([, ])dnl AC_LIBOBJ([strerror-override]) gl_PREREQ_SYS_H_WINSOCK2 fi + gl_FUNC_STRERROR_R + AS_IF([test $HAVE_DECL_STRERROR_R = 0 || test $REPLACE_STRERROR_R = 1], [ + AC_LIBOBJ([strerror_r]) + gl_PREREQ_STRERROR_R + ]) + gl_STRING_MODULE_INDICATOR([strerror_r]) + dnl For the modules argp, error. + gl_MODULE_INDICATOR([strerror_r-posix]) gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) @@ -2196,8 +2767,34 @@ changequote([, ])dnl gl_FUNC_MMAP_ANON AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) + gl_FUNC_SYMLINK + if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then + AC_LIBOBJ([symlink]) + fi + gl_UNISTD_MODULE_INDICATOR([symlink]) + gl_SYS_IOCTL_H + gl_SYS_IOCTL_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_SYS_SELECT_H + gl_SYS_SELECT_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_SYS_SOCKET_H + gl_SYS_SOCKET_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_CHECK_FUNCS_ONCE([shutdown]) + gl_SYS_STAT_H + gl_SYS_STAT_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_SYS_TIME_H + gl_SYS_TIME_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_SYS_UIO_H + gl_SYS_UIO_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_THREAD - gl_HEADER_TIME_H + gl_TIME_H + gl_TIME_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gt_LOCALE_FR gt_LOCALE_FR_UTF8 gt_LOCALE_JA @@ -2298,6 +2895,7 @@ changequote([, ])dnl AC_LIBOBJ([usleep]) fi gl_UNISTD_MODULE_INDICATOR([usleep]) + AC_C_VARARRAYS gl_FUNC_WCRTOMB if test $HAVE_WCRTOMB = 0 || test $REPLACE_WCRTOMB = 1; then AC_LIBOBJ([wcrtomb]) @@ -2320,8 +2918,22 @@ changequote([, ])dnl gl_PREREQ_WCTOMB fi gl_STDLIB_MODULE_INDICATOR([wctomb]) + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-thread]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-tls]) + ;; + esac gl_XALLOC - gl_YIELD + gl_MODULE_INDICATOR([xalloc]) + gl_MODULE_INDICATOR([xalloc-die]) + AC_REQUIRE([gl_YIELD]) m4_popdef([gl_MODULE_INDICATOR_CONDITION]) m4_ifval(gltests_LIBSOURCES_LIST, [ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || @@ -2334,6 +2946,8 @@ changequote([, ])dnl m4_if(m4_sysval, [0], [], [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) m4_popdef([gltests_LIBSOURCES_DIR]) m4_popdef([gltests_LIBSOURCES_LIST]) m4_popdef([AC_LIBSOURCES]) @@ -2422,6 +3036,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/amemxfrm.h lib/arg-nonnull.h lib/array-mergesort.h + lib/attribute.h lib/c++defs.h lib/c-ctype.c lib/c-ctype.h @@ -2429,13 +3044,13 @@ AC_DEFUN([gl_FILE_LIST], [ lib/c-strcasecmp.c lib/c-strcaseeq.h lib/c-strncasecmp.c - lib/config.charset lib/errno.in.h lib/flexmember.h lib/float+.h lib/float.c lib/float.in.h lib/fpucw.h + lib/free.c lib/frexp.c lib/frexpl.c lib/fseterr.c @@ -2453,8 +3068,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/iconv_open-irix.gperf lib/iconv_open-osf.gperf lib/iconv_open-solaris.gperf + lib/iconv_open-zos.gperf lib/iconv_open.c lib/iconveh.h + lib/idx.h + lib/intprops.h + lib/inttypes.in.h lib/isnan.c lib/isnand-nolibm.h lib/isnand.c @@ -2463,11 +3082,18 @@ AC_DEFUN([gl_FILE_LIST], [ lib/isnanl-nolibm.h lib/isnanl.c lib/iswblank.c + lib/iswdigit.c + lib/iswxdigit.c lib/itold.c lib/langinfo.in.h + lib/lc-charset-dispatch.c + lib/lc-charset-dispatch.h lib/limits.in.h lib/localcharset.c lib/localcharset.h + lib/locale.in.h + lib/localename-table.c + lib/localename-table.h lib/localename.c lib/localename.h lib/malloc.c @@ -2479,9 +3105,13 @@ AC_DEFUN([gl_FILE_LIST], [ lib/mbchar.h lib/mbiter.c lib/mbiter.h + lib/mbrtowc-impl-utf8.h + lib/mbrtowc-impl.h lib/mbrtowc.c lib/mbsinit.c lib/mbsnlen.c + lib/mbtowc-lock.c + lib/mbtowc-lock.h lib/memchr.c lib/memchr.valgrind lib/memcmp2.c @@ -2495,11 +3125,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/printf-frexpl.h lib/printf-parse.c lib/printf-parse.h - lib/ref-add.sin - lib/ref-del.sin lib/relocatable.c lib/relocatable.h lib/relocatable.valgrind + lib/setlocale-lock.c + lib/setlocale_null.c + lib/setlocale_null.h lib/signbitd.c lib/signbitf.c lib/signbitl.c @@ -2520,6 +3151,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/strncat.c lib/strstr.c lib/sys_types.in.h + lib/thread-optim.h lib/unicase.in.h lib/unicase/cased.c lib/unicase/cased.h @@ -2864,6 +3496,18 @@ AC_DEFUN([gl_FILE_LIST], [ lib/unictype/pr_deprecated.h lib/unictype/pr_diacritic.c lib/unictype/pr_diacritic.h + lib/unictype/pr_emoji.c + lib/unictype/pr_emoji.h + lib/unictype/pr_emoji_component.c + lib/unictype/pr_emoji_component.h + lib/unictype/pr_emoji_modifier.c + lib/unictype/pr_emoji_modifier.h + lib/unictype/pr_emoji_modifier_base.c + lib/unictype/pr_emoji_modifier_base.h + lib/unictype/pr_emoji_presentation.c + lib/unictype/pr_emoji_presentation.h + lib/unictype/pr_extended_pictographic.c + lib/unictype/pr_extended_pictographic.h lib/unictype/pr_extender.c lib/unictype/pr_extender.h lib/unictype/pr_format_control.c @@ -2942,6 +3586,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/unictype/pr_quotation_mark.h lib/unictype/pr_radical.c lib/unictype/pr_radical.h + lib/unictype/pr_regional_indicator.c lib/unictype/pr_sentence_terminal.c lib/unictype/pr_sentence_terminal.h lib/unictype/pr_soft_dotted.c @@ -2995,6 +3640,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/unigbrk/uc-is-grapheme-break.c lib/unigbrk/ulc-grapheme-breaks.c lib/unilbrk.in.h + lib/unilbrk/internal.h lib/unilbrk/lbrkprop1.h lib/unilbrk/lbrkprop2.h lib/unilbrk/lbrktables.c @@ -3295,7 +3941,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/uniwidth/u8-strwidth.c lib/uniwidth/u8-width.c lib/uniwidth/width.c - lib/unused-parameter.h + lib/uniwidth/width0.h + lib/uniwidth/width2.h lib/vasnprintf.c lib/verify.h lib/warn-on-use.h @@ -3303,20 +3950,30 @@ AC_DEFUN([gl_FILE_LIST], [ lib/wctype-h.c lib/wctype.in.h lib/wcwidth.c + lib/windows-initguard.h + lib/windows-mutex.c + lib/windows-mutex.h + lib/windows-once.c + lib/windows-once.h + lib/windows-recmutex.c + lib/windows-recmutex.h + lib/windows-rwlock.c + lib/windows-rwlock.h lib/xalloc-oversized.h lib/xsize.c lib/xsize.h m4/00gnulib.m4 m4/absolute-header.m4 m4/alloca.m4 - m4/asm-underscore.m4 + m4/arpa_inet_h.m4 m4/btowc.m4 m4/builtin-expect.m4 + m4/calloc.m4 + m4/close.m4 m4/codeset.m4 - m4/configmake.m4 - m4/ctype.m4 - m4/dirname.m4 + m4/ctype_h.m4 m4/double-slash-root.m4 + m4/dup2.m4 m4/eealloc.m4 m4/environ.m4 m4/errno_h.m4 @@ -3327,35 +3984,46 @@ AC_DEFUN([gl_FILE_LIST], [ m4/extensions.m4 m4/extern-inline.m4 m4/fcntl-o.m4 + m4/fcntl.m4 + m4/fcntl_h.m4 m4/fdopen.m4 m4/flexmember.m4 m4/float_h.m4 m4/fpieee.m4 + m4/free.m4 m4/frexp.m4 m4/frexpl.m4 m4/fseterr.m4 + m4/fstat.m4 + m4/ftruncate.m4 + m4/getcwd.m4 + m4/getdtablesize.m4 m4/getpagesize.m4 m4/getprogname.m4 - m4/glibc21.m4 + m4/gettimeofday.m4 m4/gnulib-common.m4 - m4/hard-locale.m4 m4/host-cpu-c-abi.m4 m4/iconv.m4 m4/iconv_h.m4 m4/iconv_open.m4 m4/include_next.m4 + m4/inet_pton.m4 m4/inline.m4 + m4/intl-thread-locale.m4 m4/intlmacosx.m4 m4/intmax_t.m4 - m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 + m4/ioctl.m4 m4/isblank.m4 m4/isnand.m4 m4/isnanf.m4 m4/isnanl.m4 m4/iswblank.m4 + m4/iswdigit.m4 + m4/iswxdigit.m4 m4/langinfo_h.m4 + m4/largefile.m4 m4/lcmessage.m4 m4/ldexpl.m4 m4/lib-ld.m4 @@ -3372,7 +4040,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/locale_h.m4 m4/localename.m4 m4/lock.m4 - m4/longlong.m4 + m4/lstat.m4 m4/malloc.m4 m4/malloca.m4 m4/math_h.m4 @@ -3385,27 +4053,55 @@ AC_DEFUN([gl_FILE_LIST], [ m4/memchr.m4 m4/minmax.m4 m4/mmap-anon.m4 + m4/mode_t.m4 m4/msvc-inval.m4 m4/msvc-nothrow.m4 m4/multiarch.m4 + m4/musl.m4 + m4/nanosleep.m4 + m4/netinet_in_h.m4 m4/nocrash.m4 m4/off_t.m4 + m4/open-cloexec.m4 + m4/open-slash.m4 + m4/open.m4 + m4/pathmax.m4 + m4/perror.m4 + m4/pid_t.m4 + m4/pipe.m4 m4/printf-frexp.m4 m4/printf-frexpl.m4 m4/printf.m4 + m4/pthread-thread.m4 + m4/pthread_h.m4 m4/pthread_rwlock_rdlock.m4 m4/pthread_sigmask.m4 m4/putenv.m4 m4/raise.m4 + m4/realloc.m4 + m4/reallocarray.m4 m4/relocatable-lib.m4 + m4/sched_h.m4 + m4/sched_yield.m4 + m4/select.m4 + m4/semaphore.m4 m4/setenv.m4 m4/setlocale.m4 + m4/setlocale_null.m4 + m4/sigaction.m4 m4/signal_h.m4 m4/signalblocking.m4 m4/signbit.m4 m4/size_max.m4 m4/sleep.m4 + m4/socketlib.m4 + m4/sockets.m4 + m4/socklen.m4 + m4/sockpfaf.m4 m4/ssize_t.m4 + m4/stat-time.m4 + m4/stat.m4 + m4/std-gnu11.m4 m4/stdalign.m4 m4/stdbool.m4 m4/stddef_h.m4 @@ -3414,17 +4110,26 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stdio_h.m4 m4/stdlib_h.m4 m4/strerror.m4 + m4/strerror_r.m4 m4/string_h.m4 m4/strncat.m4 m4/strstr.m4 + m4/symlink.m4 + m4/sys_ioctl_h.m4 + m4/sys_select_h.m4 m4/sys_socket_h.m4 + m4/sys_stat_h.m4 + m4/sys_time_h.m4 m4/sys_types_h.m4 + m4/sys_uio_h.m4 m4/thread.m4 m4/threadlib.m4 m4/time_h.m4 m4/unistd_h.m4 m4/usleep.m4 + m4/vararrays.m4 m4/vasnprintf.m4 + m4/visibility.m4 m4/warn-on-use.m4 m4/wchar_h.m4 m4/wchar_t.m4 @@ -3436,18 +4141,28 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wint_t.m4 m4/xalloc.m4 m4/xsize.m4 + m4/year2038.m4 m4/yield.m4 + m4/zzgnulib.m4 + tests/atomic-int-gnulib.h tests/iconvsupport.c tests/infinity.h tests/init.sh + tests/locale.c tests/macros.h tests/minus-zero.h tests/nan.h + tests/nap.h tests/randomd.c tests/randoml.c tests/signature.h + tests/test-accept.c tests/test-alloca-opt.c + tests/test-arpa_inet.c tests/test-array-mergesort.c + tests/test-binary-io.c + tests/test-binary-io.sh + tests/test-bind.c tests/test-btowc.c tests/test-btowc1.sh tests/test-btowc2.sh @@ -3455,25 +4170,43 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-c-strcase.sh tests/test-c-strcasecmp.c tests/test-c-strncasecmp.c + tests/test-calloc-gnu.c + tests/test-cloexec.c + tests/test-close.c + tests/test-connect.c tests/test-ctype.c + tests/test-dup2.c tests/test-environ.c tests/test-errno.c + tests/test-fcntl-h.c + tests/test-fcntl.c tests/test-fdopen.c tests/test-fgetc.c tests/test-float.c tests/test-fputc.c tests/test-fread.c + tests/test-free.c tests/test-frexp.c tests/test-frexp.h tests/test-frexpl.c tests/test-fseterr.c + tests/test-fstat.c + tests/test-ftruncate.c + tests/test-ftruncate.sh tests/test-fwrite.c + tests/test-getcwd-lgpl.c + tests/test-getdtablesize.c tests/test-getprogname.c + tests/test-gettimeofday.c + tests/test-hard-locale.c tests/test-iconv-h.c tests/test-iconv.c + tests/test-ignore-value.c + tests/test-inet_pton.c tests/test-init.sh tests/test-intprops.c tests/test-inttypes.c + tests/test-ioctl.c tests/test-isblank.c tests/test-isnand-nolibm.c tests/test-isnand.h @@ -3482,11 +4215,20 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-isnanl-nolibm.c tests/test-isnanl.h tests/test-iswblank.c + tests/test-iswdigit.c + tests/test-iswdigit.sh + tests/test-iswxdigit.c + tests/test-iswxdigit.sh tests/test-langinfo.c tests/test-limits-h.c + tests/test-listen.c + tests/test-localcharset.c tests/test-locale.c tests/test-localename.c tests/test-lock.c + tests/test-lstat.c + tests/test-lstat.h + tests/test-malloc-gnu.c tests/test-malloca.c tests/test-math.c tests/test-mbrtowc-w32-1.sh @@ -3494,6 +4236,8 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-mbrtowc-w32-3.sh tests/test-mbrtowc-w32-4.sh tests/test-mbrtowc-w32-5.sh + tests/test-mbrtowc-w32-6.sh + tests/test-mbrtowc-w32-7.sh tests/test-mbrtowc-w32.c tests/test-mbrtowc.c tests/test-mbrtowc1.sh @@ -3504,22 +4248,51 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-mbsinit.c tests/test-mbsinit.sh tests/test-memchr.c + tests/test-nanosleep.c + tests/test-netinet_in.c tests/test-once.c + tests/test-open.c + tests/test-open.h + tests/test-pathmax.c + tests/test-perror.c + tests/test-perror.sh + tests/test-perror2.c + tests/test-pipe.c tests/test-printf-frexp.c tests/test-printf-frexpl.c + tests/test-pthread-thread.c + tests/test-pthread.c tests/test-pthread_sigmask1.c tests/test-pthread_sigmask2.c tests/test-raise.c + tests/test-realloc-gnu.c + tests/test-reallocarray.c tests/test-rwlock1.c + tests/test-sched.c + tests/test-select-fd.c + tests/test-select-in.sh + tests/test-select-out.sh + tests/test-select-stdin.c + tests/test-select.c + tests/test-select.h tests/test-setenv.c tests/test-setlocale1.c tests/test-setlocale1.sh tests/test-setlocale2.c tests/test-setlocale2.sh + tests/test-setlocale_null-mt-all.c + tests/test-setlocale_null-mt-one.c + tests/test-setlocale_null.c + tests/test-setsockopt.c + tests/test-sigaction.c tests/test-signal-h.c tests/test-signbit.c tests/test-sigprocmask.c tests/test-sleep.c + tests/test-sockets.c + tests/test-stat-time.c + tests/test-stat.c + tests/test-stat.h tests/test-stdalign.c tests/test-stdbool.c tests/test-stddef.c @@ -3527,12 +4300,21 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-stdio.c tests/test-stdlib.c tests/test-strerror.c + tests/test-strerror_r.c tests/test-striconveh.c tests/test-striconveha.c tests/test-string.c tests/test-strncat.c tests/test-strstr.c + tests/test-symlink.c + tests/test-symlink.h + tests/test-sys_ioctl.c + tests/test-sys_select.c + tests/test-sys_socket.c + tests/test-sys_stat.c + tests/test-sys_time.c tests/test-sys_types.c + tests/test-sys_uio.c tests/test-sys_wait.h tests/test-thread_create.c tests/test-thread_self.c @@ -3549,6 +4331,8 @@ AC_DEFUN([gl_FILE_LIST], [ tests/test-wcrtomb-w32-3.sh tests/test-wcrtomb-w32-4.sh tests/test-wcrtomb-w32-5.sh + tests/test-wcrtomb-w32-6.sh + tests/test-wcrtomb-w32-7.sh tests/test-wcrtomb-w32.c tests/test-wcrtomb.c tests/test-wcrtomb.sh @@ -3746,6 +4530,12 @@ AC_DEFUN([gl_FILE_LIST], [ tests/unictype/test-pr_default_ignorable_code_point.c tests/unictype/test-pr_deprecated.c tests/unictype/test-pr_diacritic.c + tests/unictype/test-pr_emoji.c + tests/unictype/test-pr_emoji_component.c + tests/unictype/test-pr_emoji_modifier.c + tests/unictype/test-pr_emoji_modifier_base.c + tests/unictype/test-pr_emoji_presentation.c + tests/unictype/test-pr_extended_pictographic.c tests/unictype/test-pr_extender.c tests/unictype/test-pr_format_control.c tests/unictype/test-pr_grapheme_base.c @@ -3785,6 +4575,7 @@ AC_DEFUN([gl_FILE_LIST], [ tests/unictype/test-pr_punctuation.c tests/unictype/test-pr_quotation_mark.c tests/unictype/test-pr_radical.c + tests/unictype/test-pr_regional_indicator.c tests/unictype/test-pr_sentence_terminal.c tests/unictype/test-pr_soft_dotted.c tests/unictype/test-pr_space.c @@ -4073,59 +4864,122 @@ AC_DEFUN([gl_FILE_LIST], [ tests/uniwidth/test-uc_width2.sh tests/zerosize-ptr.h tests=lib/_Noreturn.h + tests=lib/accept.c + tests=lib/alloca.c tests=lib/arg-nonnull.h + tests=lib/arpa_inet.in.h tests=lib/basename-lgpl.c + tests=lib/basename-lgpl.h + tests=lib/binary-io.c + tests=lib/binary-io.h + tests=lib/bind.c tests=lib/btowc.c tests=lib/c++defs.h + tests=lib/calloc.c + tests=lib/cloexec.c + tests=lib/cloexec.h + tests=lib/close.c + tests=lib/connect.c tests=lib/ctype.in.h - tests=lib/dirname-lgpl.c - tests=lib/dirname.h - tests=lib/dosname.h + tests=lib/dup2.c tests=lib/error.c tests=lib/error.h tests=lib/exitfail.c tests=lib/exitfail.h + tests=lib/fcntl.c + tests=lib/fcntl.in.h + tests=lib/fd-hook.c + tests=lib/fd-hook.h tests=lib/fdopen.c + tests=lib/filename.h + tests=lib/fstat.c + tests=lib/ftruncate.c + tests=lib/getcwd-lgpl.c + tests=lib/getdtablesize.c tests=lib/getpagesize.c tests=lib/getprogname.c tests=lib/getprogname.h tests=lib/gettext.h + tests=lib/gettimeofday.c tests=lib/glthread/thread.c tests=lib/glthread/thread.h tests=lib/glthread/yield.h - tests=lib/intprops.h - tests=lib/inttypes.in.h + tests=lib/ialloc.c + tests=lib/ialloc.h + tests=lib/ignore-value.h + tests=lib/inet_pton.c + tests=lib/ioctl.c tests=lib/isblank.c - tests=lib/locale.in.h + tests=lib/listen.c + tests=lib/lstat.c + tests=lib/malloc.c tests=lib/mbtowc-impl.h tests=lib/mbtowc.c tests=lib/msvc-inval.c tests=lib/msvc-inval.h tests=lib/msvc-nothrow.c tests=lib/msvc-nothrow.h + tests=lib/nanosleep.c + tests=lib/netinet_in.in.h + tests=lib/open.c + tests=lib/pathmax.h + tests=lib/perror.c + tests=lib/pipe.c + tests=lib/pthread-thread.c + tests=lib/pthread.in.h tests=lib/pthread_sigmask.c tests=lib/putenv.c tests=lib/raise.c + tests=lib/realloc.c + tests=lib/reallocarray.c + tests=lib/same-inode.h + tests=lib/sched.in.h + tests=lib/sched_yield.c + tests=lib/select.c tests=lib/setenv.c tests=lib/setlocale.c + tests=lib/setsockopt.c + tests=lib/sig-handler.c + tests=lib/sig-handler.h + tests=lib/sigaction.c tests=lib/signal.in.h tests=lib/sigprocmask.c tests=lib/sleep.c + tests=lib/socket.c + tests=lib/sockets.c + tests=lib/sockets.h + tests=lib/stat-time.c + tests=lib/stat-time.h + tests=lib/stat-w32.c + tests=lib/stat-w32.h + tests=lib/stat.c tests=lib/stdalign.in.h tests=lib/stdio.in.h tests=lib/strerror-override.c tests=lib/strerror-override.h tests=lib/strerror.c - tests=lib/stripslash.c + tests=lib/strerror_r.c + tests=lib/symlink.c + tests=lib/sys_ioctl.in.h + tests=lib/sys_select.in.h + tests=lib/sys_socket.c + tests=lib/sys_socket.in.h + tests=lib/sys_stat.in.h + tests=lib/sys_time.in.h + tests=lib/sys_uio.in.h tests=lib/time.in.h tests=lib/unsetenv.c - tests=lib/unused-parameter.h tests=lib/usleep.c + tests=lib/w32sock.h tests=lib/warn-on-use.h tests=lib/wcrtomb.c tests=lib/wctob.c tests=lib/wctomb-impl.h tests=lib/wctomb.c + tests=lib/windows-thread.c + tests=lib/windows-thread.h + tests=lib/windows-tls.c + tests=lib/windows-tls.h tests=lib/xalloc-die.c tests=lib/xalloc.h tests=lib/xmalloc.c diff --git a/gnulib-m4/hard-locale.m4 b/gnulib-m4/hard-locale.m4 deleted file mode 100644 index 19222236..00000000 --- a/gnulib-m4/hard-locale.m4 +++ /dev/null @@ -1,11 +0,0 @@ -# hard-locale.m4 serial 8 -dnl Copyright (C) 2002-2006, 2009-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl No prerequisites of lib/hard-locale.c. -AC_DEFUN([gl_HARD_LOCALE], -[ - : -]) diff --git a/gnulib-m4/host-cpu-c-abi.m4 b/gnulib-m4/host-cpu-c-abi.m4 index 3fac6f70..6d1e4578 100644 --- a/gnulib-m4/host-cpu-c-abi.m4 +++ b/gnulib-m4/host-cpu-c-abi.m4 @@ -1,5 +1,5 @@ -# host-cpu-c-abi.m4 serial 10 -dnl Copyright (C) 2002-2018 Free Software Foundation, Inc. +# host-cpu-c-abi.m4 serial 14 +dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -55,7 +55,7 @@ AC_DEFUN([gl_HOST_CPU_C_ABI], [case "$host_cpu" in changequote(,)dnl - i[4567]86 ) + i[34567]86 ) changequote([,])dnl gl_cv_host_cpu_c_abi=i386 ;; @@ -211,7 +211,7 @@ changequote([,])dnl # be generating 64-bit code. AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail @@ -454,3 +454,222 @@ EOF ]) ]) + + +dnl Sets the HOST_CPU_C_ABI_32BIT variable to 'yes' if the C language ABI +dnl (application binary interface) is a 32-bit one, to 'no' if it is a 64-bit +dnl one, or to 'unknown' if unknown. +dnl This is a simplified variant of gl_HOST_CPU_C_ABI. +AC_DEFUN([gl_HOST_CPU_C_ABI_32BIT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([32-bit host C ABI], [gl_cv_host_cpu_c_abi_32bit], + [if test -n "$gl_cv_host_cpu_c_abi"; then + case "$gl_cv_host_cpu_c_abi" in + i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) + gl_cv_host_cpu_c_abi_32bit=yes ;; + x86_64 | alpha | arm64 | hppa64 | ia64 | mips64 | powerpc64 | powerpc64-elfv2 | riscv*-lp64* | s390x | sparc64 ) + gl_cv_host_cpu_c_abi_32bit=no ;; + *) + gl_cv_host_cpu_c_abi_32bit=unknown ;; + esac + else + case "$host_cpu" in + + # CPUs that only support a 32-bit ABI. + arc \ + | bfin \ + | cris* \ + | csky \ + | epiphany \ + | ft32 \ + | h8300 \ + | m68k \ + | microblaze | microblazeel \ + | nds32 | nds32le | nds32be \ + | nios2 | nios2eb | nios2el \ + | or1k* \ + | or32 \ + | sh | sh[1234] | sh[1234]e[lb] \ + | tic6x \ + | xtensa* ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + # CPUs that only support a 64-bit ABI. +changequote(,)dnl + alpha | alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] \ + | mmix ) +changequote([,])dnl + gl_cv_host_cpu_c_abi_32bit=no + ;; + +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) \ + && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=yes], + [gl_cv_host_cpu_c_abi_32bit=no]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi_32bit=yes + ;; + + riscv32 | riscv64 ) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi_32bit=no], + [gl_cv_host_cpu_c_abi_32bit=yes]) + ;; + + *) + gl_cv_host_cpu_c_abi_32bit=unknown + ;; + esac + fi + ]) + + HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" +]) diff --git a/gnulib-m4/iconv.m4 b/gnulib-m4/iconv.m4 index 877d8822..00057953 100644 --- a/gnulib-m4/iconv.m4 +++ b/gnulib-m4/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial 21 -dnl Copyright (C) 2000-2002, 2007-2014, 2016-2018 Free Software Foundation, +# iconv.m4 serial 24 +dnl Copyright (C) 2000-2002, 2007-2014, 2016-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,6 +7,12 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +AC_PREREQ([2.64]) + +dnl Note: AM_ICONV is documented in the GNU gettext manual +dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>. +dnl Don't make changes that are incompatible with that documentation! + AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], [ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. @@ -86,8 +92,9 @@ AC_DEFUN([AM_ICONV_LINK], #endif ]], [[int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ + /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from + successful returns. This is even documented in + <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) @@ -225,8 +232,7 @@ AC_DEFUN([AM_ICONV_LINK], AC_SUBST([LTLIBICONV]) ]) -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like +dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". dnl This is tricky because of the way 'aclocal' is implemented: dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. @@ -234,54 +240,43 @@ dnl Otherwise aclocal's initial scan pass would miss the macro definition. dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. dnl Otherwise aclocal would emit many "Use of uninitialized value $1" dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], +AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ + AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature], + [gl_cv_iconv_nonconst], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ #include <stdlib.h> #include <iconv.h> extern #ifdef __cplusplus "C" #endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) + ]], + [[]])], + [gl_cv_iconv_nonconst=yes], + [gl_cv_iconv_nonconst=no]) + ]) else dnl When compiling GNU libiconv on a system that does not have iconv yet, dnl pick the POSIX compliant declaration without 'const'. - am_cv_proto_iconv_arg1="" + gl_cv_iconv_nonconst=yes + fi + if test $gl_cv_iconv_nonconst = yes; then + iconv_arg1="" + else + iconv_arg1="const" fi - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1], [Define as const if the declaration of iconv() needs const.]) dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. m4_ifdef([gl_ICONV_H_DEFAULTS], [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test -n "$am_cv_proto_iconv_arg1"; then + if test $gl_cv_iconv_nonconst != yes; then ICONV_CONST="const" fi ]) diff --git a/gnulib-m4/iconv_h.m4 b/gnulib-m4/iconv_h.m4 index 824f90c2..58465662 100644 --- a/gnulib-m4/iconv_h.m4 +++ b/gnulib-m4/iconv_h.m4 @@ -1,41 +1,70 @@ -# iconv_h.m4 serial 8 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# iconv_h.m4 serial 16 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_ICONV_H], +AC_DEFUN_ONCE([gl_ICONV_H], [ AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - dnl Execute this unconditionally, because ICONV_H may be set by other - dnl modules, after this code is executed. + dnl Execute this unconditionally, because GL_GENERATE_ICONV_H may be set to + dnl true by other modules, after this code is executed. gl_CHECK_NEXT_HEADERS([iconv.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include <iconv.h> + ]], [iconv iconv_open]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) dnl Unconditionally enables the replacement of <iconv.h>. AC_DEFUN([gl_REPLACE_ICONV_H], [ - AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - ICONV_H='iconv.h' - AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) + gl_ICONV_H_REQUIRE_DEFAULTS + GL_GENERATE_ICONV_H=true ]) +# gl_ICONV_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_ICONV_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_ICONV_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_ICONV_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ICONV]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_ICONV_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_ICONV_H_DEFAULTS]) +]) + AC_DEFUN([gl_ICONV_H_DEFAULTS], [ - GNULIB_ICONV=0; AC_SUBST([GNULIB_ICONV]) + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) dnl Assume proper GNU behavior unless another module says otherwise. ICONV_CONST=; AC_SUBST([ICONV_CONST]) REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV]) REPLACE_ICONV_OPEN=0; AC_SUBST([REPLACE_ICONV_OPEN]) REPLACE_ICONV_UTF=0; AC_SUBST([REPLACE_ICONV_UTF]) - ICONV_H=''; AC_SUBST([ICONV_H]) - AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) + GL_GENERATE_ICONV_H=false + m4_ifdef([gl_POSIXCHECK], + [GL_GENERATE_ICONV_H=true], + [if m4_ifdef([gl_ANSI_CXX], [test "$CXX" != no], [false]); then + dnl Override <fnmatch.h> always, to support the C++ GNULIB_NAMESPACE. + GL_GENERATE_ICONV_H=true + fi + ]) ]) diff --git a/gnulib-m4/iconv_open.m4 b/gnulib-m4/iconv_open.m4 index 818a0c49..1ed26cd8 100644 --- a/gnulib-m4/iconv_open.m4 +++ b/gnulib-m4/iconv_open.m4 @@ -1,5 +1,5 @@ -# iconv_open.m4 serial 14 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# iconv_open.m4 serial 16 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -23,11 +23,12 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], if test $gl_func_iconv_gnu = no; then iconv_flavor= case "$host_os" in - aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; - irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; - hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; - osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; - solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; + aix*) iconv_flavor=ICONV_FLAVOR_AIX ;; + irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;; + hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;; + osf*) iconv_flavor=ICONV_FLAVOR_OSF ;; + solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;; + openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;; esac if test -n "$iconv_flavor"; then AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor], @@ -38,13 +39,16 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN], fi m4_ifdef([gl_FUNC_ICONV_OPEN_UTF_SUPPORT], [ gl_FUNC_ICONV_OPEN_UTF_SUPPORT - if test $gl_cv_func_iconv_supports_utf = no; then - REPLACE_ICONV_UTF=1 - AC_DEFINE([REPLACE_ICONV_UTF], [1], - [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.]) - REPLACE_ICONV=1 - gl_REPLACE_ICONV_OPEN - fi + case "$gl_cv_func_iconv_supports_utf" in + *yes) ;; + *) + REPLACE_ICONV_UTF=1 + AC_DEFINE([REPLACE_ICONV_UTF], [1], + [Define if the iconv() functions are enhanced to handle the UTF-{16,32}{BE,LE} encodings.]) + REPLACE_ICONV=1 + gl_REPLACE_ICONV_OPEN + ;; + esac ]) fi ]) diff --git a/gnulib-m4/include_next.m4 b/gnulib-m4/include_next.m4 index a363cb01..a9247f6f 100644 --- a/gnulib-m4/include_next.m4 +++ b/gnulib-m4/include_next.m4 @@ -1,5 +1,5 @@ -# include_next.m4 serial 24 -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +# include_next.m4 serial 26 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -106,19 +106,21 @@ dnl We intentionally avoid using AC_LANG_SOURCE here. AC_SUBST([INCLUDE_NEXT]) AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) AC_SUBST([PRAGMA_SYSTEM_HEADER]) - AC_CACHE_CHECK([whether system header files limit the line length], - [gl_cv_pragma_columns], - [dnl HP NonStop systems, which define __TANDEM, have this misfeature. - AC_EGREP_CPP([choke me], + + dnl HP NonStop systems, which define __TANDEM, limit the line length + dnl after including some system header files. + AC_CACHE_CHECK([whether source code line length is unlimited], + [gl_cv_source_line_length_unlimited], + [AC_EGREP_CPP([choke me], [ #ifdef __TANDEM choke me #endif ], - [gl_cv_pragma_columns=yes], - [gl_cv_pragma_columns=no]) + [gl_cv_source_line_length_unlimited=no], + [gl_cv_source_line_length_unlimited=yes]) ]) - if test $gl_cv_pragma_columns = yes; then + if test $gl_cv_source_line_length_unlimited = no; then PRAGMA_COLUMNS="#pragma COLUMNS 10000" else PRAGMA_COLUMNS= @@ -176,42 +178,40 @@ AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], [AC_CHECK_HEADERS_ONCE([$1]) ]) -dnl FIXME: gl_next_header and gl_header_exists must be used unquoted -dnl until we can assume autoconf 2.64 or newer. m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) if test $gl_cv_have_include_next = yes; then - AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) else AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], - m4_defn([gl_next_header]), + [gl_next_header], [m4_if([$2], [check], [AS_VAR_PUSHDEF([gl_header_exists], [ac_cv_header_]m4_defn([gl_HEADER_NAME])) - if test AS_VAR_GET(gl_header_exists) = yes; then + if test AS_VAR_GET([gl_header_exists]) = yes; then AS_VAR_POPDEF([gl_header_exists]) ]) - gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) - AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) - AS_VAR_SET(gl_next_header, ['"'$gl_header'"']) + gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) + AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) + AS_VAR_SET([gl_next_header], ['"'$gl_header'"']) m4_if([$2], [check], [else - AS_VAR_SET(gl_next_header, ['<'gl_HEADER_NAME'>']) + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) fi ]) ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), - [AS_VAR_GET(gl_next_header)]) + [AS_VAR_GET([gl_next_header])]) if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' gl_next_as_first_directive='<'gl_HEADER_NAME'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=AS_VAR_GET(gl_next_header) + gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) fi AC_SUBST( AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), diff --git a/gnulib-m4/inet_pton.m4 b/gnulib-m4/inet_pton.m4 new file mode 100644 index 00000000..9507296d --- /dev/null +++ b/gnulib-m4/inet_pton.m4 @@ -0,0 +1,70 @@ +# inet_pton.m4 serial 19 +dnl Copyright (C) 2006, 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_INET_PTON], +[ + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + + dnl Persuade Solaris <arpa/inet.h> to declare inet_pton. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl Most platforms that provide inet_pton define it in libc. + dnl Solaris 8..10 provide inet_pton in libnsl instead. + dnl Solaris 2.6..7 provide inet_pton in libresolv instead. + dnl Haiku provides it in -lnetwork. + dnl Native Windows provides it in -lws2_32 instead, with a declaration in + dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl + dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). + HAVE_INET_PTON=1 + INET_PTON_LIB= + gl_PREREQ_SYS_H_WINSOCK2 + if test $HAVE_WINSOCK2_H = 1; then + dnl It needs to be overridden, because the stdcall calling convention + dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid + dnl a name conflict at the linker level, even though the header file + dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600. + REPLACE_INET_PTON=1 + AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]]) + if test $ac_cv_have_decl_inet_pton = yes; then + INET_PTON_LIB="-lws2_32" + else + HAVE_DECL_INET_PTON=0 + fi + else + gl_save_LIBS=$LIBS + AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [], + [AC_CHECK_FUNCS([inet_pton]) + if test $ac_cv_func_inet_pton = no; then + HAVE_INET_PTON=0 + fi + ]) + LIBS=$gl_save_LIBS + + if test "$ac_cv_search_inet_pton" != "no" \ + && test "$ac_cv_search_inet_pton" != "none required"; then + INET_PTON_LIB="$ac_cv_search_inet_pton" + fi + + AC_CHECK_HEADERS_ONCE([netdb.h]) + AC_CHECK_DECLS([inet_pton],,, + [[#include <arpa/inet.h> + #if HAVE_NETDB_H + # include <netdb.h> + #endif + ]]) + if test $ac_cv_have_decl_inet_pton = no; then + HAVE_DECL_INET_PTON=0 + fi + fi + AC_SUBST([INET_PTON_LIB]) +]) + +# Prerequisites of lib/inet_pton.c. +AC_DEFUN([gl_PREREQ_INET_PTON], [ + AC_REQUIRE([gl_SOCKET_FAMILIES]) +]) diff --git a/gnulib-m4/inline.m4 b/gnulib-m4/inline.m4 index 52f2b7bf..3f072655 100644 --- a/gnulib-m4/inline.m4 +++ b/gnulib-m4/inline.m4 @@ -1,5 +1,5 @@ # inline.m4 serial 4 -dnl Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/intl-thread-locale.m4 b/gnulib-m4/intl-thread-locale.m4 new file mode 100644 index 00000000..d5d5b26a --- /dev/null +++ b/gnulib-m4/intl-thread-locale.m4 @@ -0,0 +1,219 @@ +# intl-thread-locale.m4 serial 9 +dnl Copyright (C) 2015-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl This file can be used in projects which are not available under +dnl the GNU General Public License or the GNU Lesser General Public +dnl License but which still want to provide support for the GNU gettext +dnl functionality. +dnl Please note that the actual code of the GNU gettext library is covered +dnl by the GNU Lesser General Public License, and the rest of the GNU +dnl gettext package is covered by the GNU General Public License. +dnl They are *not* in the public domain. + +dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t). +dnl Sets gt_nameless_locales. +AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + + dnl Persuade Solaris <locale.h> to define 'locale_t'. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl Test whether uselocale() exists and works at all. + gt_FUNC_USELOCALE + + dnl On OpenBSD >= 6.2, the locale_t type and the uselocale(), newlocale(), + dnl duplocale(), freelocale() functions exist but are effectively useless, + dnl because the locale_t value depends only on the LC_CTYPE category of the + dnl locale and furthermore contains only one bit of information (it + dnl distinguishes the "C" locale from the *.UTF-8 locales). See + dnl <https://cvsweb.openbsd.org/src/lib/libc/locale/newlocale.c?rev=1.1&content-type=text/x-cvsweb-markup>. + dnl In the setlocale() implementation they have thought about the programs + dnl that use the API ("Even though only LC_CTYPE has any effect in the + dnl OpenBSD base system, store complete information about the global locale, + dnl such that third-party software can access it"), but for uselocale() + dnl they did not think about the programs. + dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work. + dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support. + case "$gt_cv_func_uselocale_works" in + *yes) + AC_CHECK_HEADERS_ONCE([xlocale.h]) + AC_CACHE_CHECK([for fake locale system (OpenBSD)], + [gt_cv_locale_fake], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#if HAVE_XLOCALE_H +# include <xlocale.h> +#endif +int main () +{ + locale_t loc1, loc2; + if (setlocale (LC_ALL, "de_DE.UTF-8") == NULL) return 1; + if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) return 1; + loc1 = newlocale (LC_ALL_MASK, "de_DE.UTF-8", (locale_t)0); + loc2 = newlocale (LC_ALL_MASK, "fr_FR.UTF-8", (locale_t)0); + return !(loc1 == loc2); +}]])], + [gt_cv_locale_fake=yes], + [gt_cv_locale_fake=no], + [dnl Guess the locale system is fake only on OpenBSD. + case "$host_os" in + openbsd*) gt_cv_locale_fake="guessing yes" ;; + *) gt_cv_locale_fake="guessing no" ;; + esac + ]) + ]) + ;; + *) gt_cv_locale_fake=no ;; + esac + case "$gt_cv_locale_fake" in + *yes) + gt_fake_locales=yes + AC_DEFINE([HAVE_FAKE_LOCALES], [1], + [Define if the locale_t type contains insufficient information, as on OpenBSD.]) + ;; + *) + gt_fake_locales=no + ;; + esac + + case "$gt_cv_func_uselocale_works" in + *yes) + AC_CACHE_CHECK([for Solaris 11.4 locale system], + [gt_cv_locale_solaris114], + [case "$host_os" in + solaris*) + dnl Test whether <locale.h> defines locale_t as a typedef of + dnl 'struct _LC_locale_t **' (whereas Illumos defines it as a + dnl typedef of 'struct _locale *'). + dnl Another possible test would be to include <sys/localedef.h> + dnl and test whether it defines the _LC_core_data_locale_t type. + dnl This type was added in Solaris 11.4. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include <locale.h> + struct _LC_locale_t *x; + locale_t y; + ]], + [[*y = x;]])], + [gt_cv_locale_solaris114=yes], + [gt_cv_locale_solaris114=no]) + ;; + *) gt_cv_locale_solaris114=no ;; + esac + ]) + ;; + *) gt_cv_locale_solaris114=no ;; + esac + if test $gt_cv_locale_solaris114 = yes; then + AC_DEFINE([HAVE_SOLARIS114_LOCALES], [1], + [Define if the locale_t type is as on Solaris 11.4.]) + fi + + dnl Solaris 12 will maybe provide getlocalename_l. If it does, it will + dnl improve the implementation of gl_locale_name_thread(), by removing + dnl the use of undocumented structures. + case "$gt_cv_func_uselocale_works" in + *yes) + AC_CHECK_FUNCS([getlocalename_l]) + ;; + esac + + dnl This code is for platforms where the locale_t type does not provide access + dnl to the name of each locale category. This code has the drawback that it + dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale', + dnl which is a problem for GNU libunistring. Therefore try hard to avoid + dnl enabling this code! + gt_nameless_locales=no + case "$host_os" in + dnl It's needed on AIX 7.2. + aix*) + gt_nameless_locales=yes + AC_DEFINE([HAVE_NAMELESS_LOCALES], [1], + [Define if the locale_t type does not contain the name of each locale category.]) + ;; + esac + + dnl We cannot support uselocale() on platforms where the locale_t type is + dnl fake. So, set + dnl gt_good_uselocale = gt_working_uselocale && !gt_fake_locales. + if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then + gt_good_uselocale=yes + AC_DEFINE([HAVE_GOOD_USELOCALE], [1], + [Define if the uselocale exists, may be safely called, and returns sufficient information.]) + else + gt_good_uselocale=no + fi + + dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c + dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale + dnl names. + if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then + gt_localename_enhances_locale_funcs=yes + LOCALENAME_ENHANCE_LOCALE_FUNCS=1 + AC_DEFINE([LOCALENAME_ENHANCE_LOCALE_FUNCS], [1], + [Define if localename.c overrides newlocale(), duplocale(), freelocale().]) + else + gt_localename_enhances_locale_funcs=no + fi +]) + +dnl Tests whether uselocale() exists and is usable. +dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE. +AC_DEFUN([gt_FUNC_USELOCALE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc and Solaris <locale.h> to define 'locale_t'. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_FUNCS_ONCE([uselocale]) + + dnl On AIX 7.2, the uselocale() function is not documented and leads to + dnl crashes in subsequent setlocale() invocations. + dnl In 2019, some versions of z/OS lack the locale_t type and have a broken + dnl uselocale function. + if test $ac_cv_func_uselocale = yes; then + AC_CHECK_HEADERS_ONCE([xlocale.h]) + AC_CACHE_CHECK([whether uselocale works], + [gt_cv_func_uselocale_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#if HAVE_XLOCALE_H +# include <xlocale.h> +#endif +locale_t loc1; +int main () +{ + uselocale (NULL); + setlocale (LC_ALL, "en_US.UTF-8"); + return 0; +}]])], + [gt_cv_func_uselocale_works=yes], + [gt_cv_func_uselocale_works=no], + [# Guess no on AIX and z/OS, yes otherwise. + case "$host_os" in + aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;; + *) gt_cv_func_uselocale_works="guessing yes" ;; + esac + ]) + ]) + else + gt_cv_func_uselocale_works=no + fi + case "$gt_cv_func_uselocale_works" in + *yes) + gt_working_uselocale=yes + AC_DEFINE([HAVE_WORKING_USELOCALE], [1], + [Define if the uselocale function exists and may safely be called.]) + ;; + *) + gt_working_uselocale=no + ;; + esac +]) diff --git a/gnulib-m4/intlmacosx.m4 b/gnulib-m4/intlmacosx.m4 index aca924c6..ecc88d6e 100644 --- a/gnulib-m4/intlmacosx.m4 +++ b/gnulib-m4/intlmacosx.m4 @@ -1,15 +1,15 @@ -# intlmacosx.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2004-2014, 2016 Free Software Foundation, Inc. +# intlmacosx.m4 serial 8 (gettext-0.20.2) +dnl Copyright (C) 2004-2014, 2016, 2019-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public +dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU +dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. @@ -17,7 +17,7 @@ dnl Checks for special options needed on Mac OS X. dnl Defines INTL_MACOSX_LIBS. AC_DEFUN([gt_INTL_MACOSX], [ - dnl Check for API introduced in Mac OS X 10.2. + dnl Check for API introduced in Mac OS X 10.4. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" @@ -33,23 +33,32 @@ AC_DEFUN([gt_INTL_MACOSX], AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi - dnl Check for API introduced in Mac OS X 10.3. - AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], + dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent, + dnl because in macOS 10.13.4 it has the following behaviour: + dnl When two or more languages are specified in the + dnl "System Preferences > Language & Region > Preferred Languages" panel, + dnl it returns en_CC where CC is the territory (even when English is not among + dnl the preferred languages!). What we want instead is what + dnl CFLocaleCopyCurrent returned in earlier macOS releases and what + dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the + dnl first among the preferred languages and CC is the territory. + AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <CoreFoundation/CFLocale.h>]], - [[CFLocaleCopyCurrent();]])], - [gt_cv_func_CFLocaleCopyCurrent=yes], - [gt_cv_func_CFLocaleCopyCurrent=no]) + [[CFLocaleCopyPreferredLanguages();]])], + [gt_cv_func_CFLocaleCopyPreferredLanguages=yes], + [gt_cv_func_CFLocaleCopyPreferredLanguages=no]) LIBS="$gt_save_LIBS"]) - if test $gt_cv_func_CFLocaleCopyCurrent = yes; then - AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], - [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) + if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then + AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1], + [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= - if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then + if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ + || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) diff --git a/gnulib-m4/intmax_t.m4 b/gnulib-m4/intmax_t.m4 index 7ab676e6..8a15dabd 100644 --- a/gnulib-m4/intmax_t.m4 +++ b/gnulib-m4/intmax_t.m4 @@ -1,5 +1,5 @@ -# intmax_t.m4 serial 8 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2018 Free Software Foundation, +# intmax_t.m4 serial 9 +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,11 +19,7 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T], AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) AC_REQUIRE([gl_AC_HEADER_STDINT_H]) if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long' \ - || ac_type='long' - AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], + AC_DEFINE_UNQUOTED([intmax_t], [long long], [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) else AC_DEFINE([HAVE_INTMAX_T], [1], @@ -57,11 +53,7 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T], AC_DEFINE([HAVE_INTMAX_T], [1], [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) else - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long' \ - || ac_type='long' - AC_DEFINE_UNQUOTED([intmax_t], [$ac_type], + AC_DEFINE_UNQUOTED([intmax_t], [long long], [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) fi ]) diff --git a/gnulib-m4/inttypes-pri.m4 b/gnulib-m4/inttypes-pri.m4 deleted file mode 100644 index c8442625..00000000 --- a/gnulib-m4/inttypes-pri.m4 +++ /dev/null @@ -1,42 +0,0 @@ -# inttypes-pri.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1997-2002, 2006, 2008-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ([2.53]) - -# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* -# macros to non-string values. This is the case on AIX 4.3.3. - -AC_DEFUN([gt_INTTYPES_PRI], -[ - AC_CHECK_HEADERS([inttypes.h]) - if test $ac_cv_header_inttypes_h = yes; then - AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], - [gt_cv_inttypes_pri_broken], - [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <inttypes.h> -#ifdef PRId32 -char *p = PRId32; -#endif - ]], - [[]])], - [gt_cv_inttypes_pri_broken=no], - [gt_cv_inttypes_pri_broken=yes]) - ]) - fi - if test "$gt_cv_inttypes_pri_broken" = yes; then - AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], - [Define if <inttypes.h> exists and defines unusable PRI* macros.]) - PRI_MACROS_BROKEN=1 - else - PRI_MACROS_BROKEN=0 - fi - AC_SUBST([PRI_MACROS_BROKEN]) -]) diff --git a/gnulib-m4/inttypes.m4 b/gnulib-m4/inttypes.m4 index d756f012..df25a21e 100644 --- a/gnulib-m4/inttypes.m4 +++ b/gnulib-m4/inttypes.m4 @@ -1,5 +1,5 @@ -# inttypes.m4 serial 27 -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +# inttypes.m4 serial 36 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Derek Price, Bruno Haible. dnl Test whether <inttypes.h> is supported or must be substituted. -AC_DEFUN([gl_INTTYPES_H], +AC_DEFUN_ONCE([gl_INTTYPES_H], [ AC_REQUIRE([gl_INTTYPES_INCOMPLETE]) gl_INTTYPES_PRI_SCN @@ -28,17 +28,26 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> ]], [imaxabs imaxdiv strtoimax strtoumax]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) # Ensure that the PRI* and SCN* macros are defined appropriately. AC_DEFUN([gl_INTTYPES_PRI_SCN], [ - AC_REQUIRE([gt_INTTYPES_PRI]) - PRIPTR_PREFIX= - if test -n "$STDINT_H"; then - dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'. - PRIPTR_PREFIX='"l"' + if $GL_GENERATE_STDINT_H; then + dnl Using the gnulib <stdint.h>. It defines intptr_t to 'long' or + dnl 'long long', depending on _WIN64. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef _WIN64 + LLP64 + #endif + ]]) + ], + [PRIPTR_PREFIX='"l"'], + [PRIPTR_PREFIX='"ll"']) else dnl Using the system's <stdint.h>. for glpfx in '' l ll I64; do @@ -113,10 +122,8 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], #if $2 #define CONDITION ($3) - #elif HAVE_LONG_LONG_INT - #define CONDITION ($4) #else - #define CONDITION 0 + #define CONDITION ($4) #endif int test[CONDITION ? 1 : -1];]])], [gl_cv_test_$1=yes], @@ -129,19 +136,34 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], AC_SUBST([$1]) ]) +# gl_INTTYPES_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_INTTYPES_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_INTTYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXABS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IMAXDIV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOIMAX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUMAX]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_INTTYPES_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) +]) + AC_DEFUN([gl_INTTYPES_H_DEFAULTS], [ - GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) - GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) - GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) - GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) @@ -152,7 +174,6 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX]) - PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN]) PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX]) UINT32_MAX_LT_UINTMAX_MAX=1; AC_SUBST([UINT32_MAX_LT_UINTMAX_MAX]) UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX]) diff --git a/gnulib-m4/inttypes_h.m4 b/gnulib-m4/inttypes_h.m4 index 954848bd..6e9eebf1 100644 --- a/gnulib-m4/inttypes_h.m4 +++ b/gnulib-m4/inttypes_h.m4 @@ -1,5 +1,5 @@ # inttypes_h.m4 serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/ioctl.m4 b/gnulib-m4/ioctl.m4 new file mode 100644 index 00000000..7c721345 --- /dev/null +++ b/gnulib-m4/ioctl.m4 @@ -0,0 +1,44 @@ +# ioctl.m4 serial 6 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_IOCTL], +[ + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_SOCKET_H]) + HAVE_IOCTL=1 + if test "$ac_cv_header_winsock2_h" = yes; then + dnl Even if the 'socket' module is not used here, another part of the + dnl application may use it and pass file descriptors that refer to + dnl sockets to the ioctl() function. So enable the support for sockets. + HAVE_IOCTL=0 + else + AC_CHECK_FUNCS([ioctl]) + dnl On glibc systems, the second parameter is 'unsigned long int request', + dnl not 'int request'. We cannot simply cast the function pointer, but + dnl instead need a wrapper. + AC_CACHE_CHECK([for ioctl with POSIX signature], + [gl_cv_func_ioctl_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/ioctl.h> + /* On some platforms, ioctl() is declared in <unistd.h>. */ + #include <unistd.h> + ]], + [[extern + #ifdef __cplusplus + "C" + #endif + int ioctl (int, int, ...); + ]]) + ], + [gl_cv_func_ioctl_posix_signature=yes], + [gl_cv_func_ioctl_posix_signature=no]) + ]) + if test $gl_cv_func_ioctl_posix_signature != yes; then + REPLACE_IOCTL=1 + fi + fi +]) diff --git a/gnulib-m4/isblank.m4 b/gnulib-m4/isblank.m4 index f98dfbfe..1d0ed6ce 100644 --- a/gnulib-m4/isblank.m4 +++ b/gnulib-m4/isblank.m4 @@ -1,5 +1,5 @@ # isblank.m4 serial 3 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/isnand.m4 b/gnulib-m4/isnand.m4 index 03da55d6..4eadde7c 100644 --- a/gnulib-m4/isnand.m4 +++ b/gnulib-m4/isnand.m4 @@ -1,5 +1,5 @@ -# isnand.m4 serial 11 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# isnand.m4 serial 12 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -58,7 +58,7 @@ AC_DEFUN([gl_HAVE_ISNAND_IN_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnand # define isnand(x) __builtin_isnan ((double)(x)) #elif defined isnan @@ -81,7 +81,7 @@ AC_DEFUN([gl_HAVE_ISNAND_NO_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnand # define isnand(x) __builtin_isnan ((double)(x)) #else diff --git a/gnulib-m4/isnanf.m4 b/gnulib-m4/isnanf.m4 index c0dcdb74..44c825a1 100644 --- a/gnulib-m4/isnanf.m4 +++ b/gnulib-m4/isnanf.m4 @@ -1,5 +1,5 @@ -# isnanf.m4 serial 15 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# isnanf.m4 serial 18 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -74,9 +74,9 @@ AC_DEFUN([gl_HAVE_ISNANF_NO_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) + # define isnanf(x) __builtin_isnan ((float)(x)) #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) @@ -99,9 +99,9 @@ AC_DEFUN([gl_HAVE_ISNANF_IN_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanf - # define isnanf(x) __builtin_isnanf ((float)(x)) + # define isnanf(x) __builtin_isnan ((float)(x)) #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) @@ -127,9 +127,9 @@ AC_DEFUN([gl_ISNANF_WORKS], AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <math.h> -#if __GNUC__ >= 4 +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanf -# define isnanf(x) __builtin_isnanf ((float)(x)) +# define isnanf(x) __builtin_isnan ((float)(x)) #elif defined isnan # undef isnanf # define isnanf(x) isnan ((float)(x)) @@ -169,7 +169,7 @@ int main() m.value = NaN (); /* Set the bits below the exponent to 01111...111. */ m.word[0] &= -1U << FLT_EXPBIT0_BIT; - m.word[0] |= 1U << (FLT_EXPBIT0_BIT - 1) - 1; + m.word[0] |= (1U << (FLT_EXPBIT0_BIT - 1)) - 1; if (!isnanf (m.value)) result |= 4; } diff --git a/gnulib-m4/isnanl.m4 b/gnulib-m4/isnanl.m4 index 74014d63..fa49a644 100644 --- a/gnulib-m4/isnanl.m4 +++ b/gnulib-m4/isnanl.m4 @@ -1,5 +1,5 @@ -# isnanl.m4 serial 20 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# isnanl.m4 serial 22 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -68,9 +68,9 @@ AC_DEFUN([gl_HAVE_ISNANL_NO_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) + # define isnanl(x) __builtin_isnan ((long double)(x)) #elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) @@ -93,9 +93,9 @@ AC_DEFUN([gl_HAVE_ISNANL_IN_LIBM], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <math.h> - #if __GNUC__ >= 4 + #if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanl - # define isnanl(x) __builtin_isnanl ((long double)(x)) + # define isnanl(x) __builtin_isnan ((long double)(x)) #elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) @@ -123,9 +123,9 @@ AC_DEFUN([gl_FUNC_ISNANL_WORKS], #include <float.h> #include <limits.h> #include <math.h> -#if __GNUC__ >= 4 +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) # undef isnanl -# define isnanl(x) __builtin_isnanl ((long double)(x)) +# define isnanl(x) __builtin_isnan ((long double)(x)) #elif defined isnan # undef isnanl # define isnanl(x) isnan ((long double)(x)) diff --git a/gnulib-m4/iswblank.m4 b/gnulib-m4/iswblank.m4 index 4906a473..ddecf9b8 100644 --- a/gnulib-m4/iswblank.m4 +++ b/gnulib-m4/iswblank.m4 @@ -1,5 +1,5 @@ -# iswblank.m4 serial 4 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# iswblank.m4 serial 5 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,16 +12,9 @@ AC_DEFUN([gl_FUNC_ISWBLANK], AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([iswblank]) AC_CHECK_DECLS([iswblank], , , [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -#include <wctype.h> -]]) + #include <wchar.h> + #include <wctype.h> + ]]) if test $ac_cv_func_iswblank = no; then HAVE_ISWBLANK=0 if test $ac_cv_have_decl_iswblank = yes; then diff --git a/gnulib-m4/iswdigit.m4 b/gnulib-m4/iswdigit.m4 new file mode 100644 index 00000000..643c5b29 --- /dev/null +++ b/gnulib-m4/iswdigit.m4 @@ -0,0 +1,115 @@ +# iswdigit.m4 serial 3 +dnl Copyright (C) 2020-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ISWDIGIT], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([gt_LOCALE_FR]) + AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl <wctype.h> redefines iswdigit already. + REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" + else + AC_CACHE_CHECK([whether iswdigit is ISO C compliant], + [gl_cv_func_iswdigit_works], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw*) + gl_cv_func_iswdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswdigit_works="guessing yes" ;; + esac +changequote([,])dnl + if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <stdlib.h> +#include <string.h> +#include <wchar.h> +#include <wctype.h> + +/* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); + + return iswdigit (wc); +} + +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; + + if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + /* This fails on mingw, MSVC 14. */ + /* U+00B2 SUPERSCRIPT TWO */ + is = for_character ("\262", 1); + if (!(is == 0)) + result |= 1; + } + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 8.0. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 2; + } + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 4; + /* This fails on FreeBSD 13.0, NetBSD 8.0, MSVC 14. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\357\274\221", 3); + if (!(is == 0)) + result |= 8; + } + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on NetBSD 8.0, Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 16; + } + return result; +}]])], + [gl_cv_func_iswdigit_works=yes], + [gl_cv_func_iswdigit_works=no], + [:]) + fi + ]) + case "$gl_cv_func_iswdigit_works" in + *yes) ;; + *) REPLACE_ISWDIGIT=1 ;; + esac + fi +]) diff --git a/gnulib-m4/iswxdigit.m4 b/gnulib-m4/iswxdigit.m4 new file mode 100644 index 00000000..cc7c1a24 --- /dev/null +++ b/gnulib-m4/iswxdigit.m4 @@ -0,0 +1,106 @@ +# iswxdigit.m4 serial 3 +dnl Copyright (C) 2020-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ISWXDIGIT], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl <wctype.h> redefines iswxdigit already. + REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" + else + AC_CACHE_CHECK([whether iswxdigit is ISO C compliant], + [gl_cv_func_iswxdigit_works], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw*) + gl_cv_func_iswxdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswxdigit_works="guessing yes" ;; + esac +changequote([,])dnl + if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <stdlib.h> +#include <string.h> +#include <wchar.h> +#include <wctype.h> + +/* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); + + return iswxdigit (wc); +} + +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; + + if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 8.0. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\243\301", 2); + if (!(is == 0)) + result |= 1; + } + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 2; + /* This fails on MSVC 14. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\357\274\241", 3); + if (!(is == 0)) + result |= 4; + } + if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 8; + } + return result; +}]])], + [gl_cv_func_iswxdigit_works=yes], + [gl_cv_func_iswxdigit_works=no], + [:]) + fi + ]) + case "$gl_cv_func_iswxdigit_works" in + *yes) ;; + *) REPLACE_ISWXDIGIT=1 ;; + esac + fi +]) diff --git a/gnulib-m4/langinfo_h.m4 b/gnulib-m4/langinfo_h.m4 index de077c37..563c8c43 100644 --- a/gnulib-m4/langinfo_h.m4 +++ b/gnulib-m4/langinfo_h.m4 @@ -1,10 +1,10 @@ -# langinfo_h.m4 serial 8 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. +# langinfo_h.m4 serial 12 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_LANGINFO_H], +AC_DEFUN_ONCE([gl_LANGINFO_H], [ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) @@ -23,8 +23,10 @@ AC_DEFUN([gl_LANGINFO_H], AC_CHECK_HEADERS_ONCE([langinfo.h]) if test $ac_cv_header_langinfo_h = yes; then HAVE_LANGINFO_H=1 - dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing - dnl on OpenBSD 3.8. T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. + dnl Determine what <langinfo.h> defines. + dnl CODESET is missing on OpenBSD 3.8. + dnl ERA etc. are missing on OpenBSD 6.7. + dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. dnl ALTMON_* are missing on glibc 2.26 and many other systems. AC_CACHE_CHECK([whether langinfo.h defines CODESET], [gl_cv_header_langinfo_codeset], @@ -102,18 +104,33 @@ int a = YESEXPR; ]], [nl_langinfo]) ]) +# gl_LANGINFO_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_LANGINFO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_LANGINFO_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NL_LANGINFO]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_LANGINFO_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) +]) + AC_DEFUN([gl_LANGINFO_H_DEFAULTS], [ - GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO]) REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO]) diff --git a/gnulib-m4/largefile.m4 b/gnulib-m4/largefile.m4 new file mode 100644 index 00000000..3e8b5e39 --- /dev/null +++ b/gnulib-m4/largefile.m4 @@ -0,0 +1,180 @@ +# Enable large files on systems where this is not the default. +# Enable support for files on Linux file systems with 64-bit inode numbers. + +# Copyright 1992-1996, 1998-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: +# It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this +# setting of _LARGEFILE_SOURCE is needed so that <stdio.h> declares fseeko +# and ftello in C++ mode as well. +AC_DEFUN([gl_SET_LARGEFILE_SOURCE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_FUNC_FSEEKO + case "$host_os" in + hpux*) + AC_DEFINE([_LARGEFILE_SOURCE], [1], + [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) + ;; + esac +]) + +# Work around a problem in Autoconf through at least 2.71 on glibc 2.34+ +# with _TIME_BITS. Also, work around a problem in autoconf <= 2.69: +# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, +# or configures them incorrectly in some cases. +m4_version_prereq([2.70], [], [ + +# _AC_SYS_LARGEFILE_TEST_INCLUDES +# ------------------------------- +m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], +[#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]];[]dnl +]) +])# m4_version_prereq 2.70 + + +# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, +# CACHE-VAR, +# DESCRIPTION, +# PROLOGUE, [FUNCTION-BODY]) +# -------------------------------------------------------- +m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], +[AC_CACHE_CHECK([for $1 value needed for large files], [$3], +[while :; do + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([$5], [$6])], + [$3=no; break]) + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([#undef $1 +#define $1 $2 +$5], [$6])], + [$3=$2; break]) + $3=unknown + break +done]) +case $$3 in #( + no | unknown) ;; + *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; +esac +rm -rf conftest*[]dnl +])# _AC_SYS_LARGEFILE_MACRO_VALUE + + +# AC_SYS_LARGEFILE +# ---------------- +# By default, many hosts won't let programs access large files; +# one must use special compiler options to get large-file access to work. +# For more details about this brain damage please see: +# http://www.unix.org/version2/whatsnew/lfs20mar.html +# Additionally, on Linux file systems with 64-bit inodes a file that happens +# to have a 64-bit inode number cannot be accessed by 32-bit applications on +# Linux x86/x86_64. This can occur with file systems such as XFS and NFS. +AC_DEFUN([AC_SYS_LARGEFILE], +[AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) +AS_IF([test "$enable_largefile" != no], + [AC_CACHE_CHECK([for special C compiler options needed for large files], + ac_cv_sys_largefile_CC, + [ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) + AC_COMPILE_IFELSE([], [break]) + CC="$CC -n32" + AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi]) + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + AS_CASE([$ac_cv_sys_file_offset_bits], + [unknown], + [_AC_SYS_LARGEFILE_MACRO_VALUE([_LARGE_FILES], [1], + [ac_cv_sys_large_files], + [Define for large files, on AIX-style hosts.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES])], + [64], + [gl_YEAR2038_BODY([])])]) +])# AC_SYS_LARGEFILE + +# Enable large files on systems where this is implemented by Gnulib, not by the +# system headers. +# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib +# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively. +AC_DEFUN([gl_LARGEFILE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + dnl Native Windows. + dnl mingw64 defines off_t to a 64-bit type already, if + dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. + AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no]) + ]) + if test $gl_cv_type_off_t_64 = no; then + WINDOWS_64_BIT_OFF_T=1 + else + WINDOWS_64_BIT_OFF_T=0 + fi + dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' + dnl to 'struct _stat32i64' or 'struct _stat64' (depending on + dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. + AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) + ]) + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi + ;; + *) + dnl Nothing to do on gnulib's side. + dnl A 64-bit off_t is + dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, + dnl OSF/1, Cygwin, + dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on + dnl glibc, HP-UX, Solaris, + dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, + dnl - impossible to achieve on Minix 3.1.8. + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac +]) diff --git a/gnulib-m4/lcmessage.m4 b/gnulib-m4/lcmessage.m4 index 1c24d6d9..1a3eefe7 100644 --- a/gnulib-m4/lcmessage.m4 +++ b/gnulib-m4/lcmessage.m4 @@ -1,16 +1,16 @@ -# lcmessage.m4 serial 7 (gettext-0.18.2) -dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014, 2016 Free Software -dnl Foundation, Inc. +# lcmessage.m4 serial 8 +dnl Copyright (C) 1995-2002, 2004-2005, 2008-2014, 2016, 2019-2022 Free +dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under -dnl the GNU General Public License or the GNU Library General Public +dnl the GNU General Public License or the GNU Lesser General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered -dnl by the GNU Library General Public License, and the rest of the GNU +dnl by the GNU Lesser General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. diff --git a/gnulib-m4/ldexpl.m4 b/gnulib-m4/ldexpl.m4 index 744dede5..06d30f71 100644 --- a/gnulib-m4/ldexpl.m4 +++ b/gnulib-m4/ldexpl.m4 @@ -1,5 +1,5 @@ # ldexpl.m4 serial 17 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/lib-ld.m4 b/gnulib-m4/lib-ld.m4 index 1244ff81..934207a7 100644 --- a/gnulib-m4/lib-ld.m4 +++ b/gnulib-m4/lib-ld.m4 @@ -1,5 +1,5 @@ -# lib-ld.m4 serial 9 -dnl Copyright (C) 1996-2003, 2009-2018 Free Software Foundation, Inc. +# lib-ld.m4 serial 10 +dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -122,7 +122,7 @@ else *-*-aix*) AC_COMPILE_IFELSE( [AC_LANG_SOURCE( - [[#if defined __powerpc64__ || defined _ARCH_PPC64 + [[#if defined __powerpc64__ || defined __LP64__ int ok; #else error fail diff --git a/gnulib-m4/lib-link.m4 b/gnulib-m4/lib-link.m4 index df77db98..ed5186af 100644 --- a/gnulib-m4/lib-link.m4 +++ b/gnulib-m4/lib-link.m4 @@ -1,12 +1,12 @@ -# lib-link.m4 serial 26 (gettext-0.18.2) -dnl Copyright (C) 2001-2018 Free Software Foundation, Inc. +# lib-link.m4 serial 32 +dnl Copyright (C) 2001-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. -AC_PREREQ([2.54]) +AC_PREREQ([2.61]) dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and dnl the libraries corresponding to explicit and implicit dependencies. @@ -124,8 +124,8 @@ dnl acl_hardcode_direct, dnl acl_hardcode_minus_L. AC_DEFUN([AC_LIB_RPATH], [ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + dnl Complain if config.rpath is missing. + AC_REQUIRE_AUX_FILE([config.rpath]) AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host @@ -187,17 +187,17 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) dnl By default, look in $includedir and $libdir. use_additional=yes AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], + AC_ARG_WITH(PACK[-prefix], +[[ --with-]]PACK[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]PACK[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -206,17 +206,23 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], AC_LIB_WITH_FINAL_PREFIX([ eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" + eval additional_libdir2=\"$exec_prefix/$acl_libdirstem2\" + eval additional_libdir3=\"$exec_prefix/$acl_libdirstem3\" ]) else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && test ! -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi + additional_libdir2="$withval/$acl_libdirstem2" + additional_libdir3="$withval/$acl_libdirstem3" fi fi ]) + if test "X$additional_libdir2" = "X$additional_libdir"; then + additional_libdir2= + fi + if test "X$additional_libdir3" = "X$additional_libdir"; then + additional_libdir3= + fi dnl Search the library and its dependencies in $additional_libdir and dnl $LDFLAGS. Using breadth-first-seach. LIB[]NAME= @@ -272,48 +278,54 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], shrext= fi if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" + for additional_libdir_variable in additional_libdir additional_libdir2 additional_libdir3; do + if test "X$found_dir" = "X"; then + eval dir=\$$additional_libdir_variable + if test -n "$dir"; then + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" - found_so="$dir/$f" - break + found_a="$dir/$libname.$acl_libext" fi - done + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi fi fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi + done fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIB[]NAME; do @@ -323,7 +335,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dir=`echo "X$x" | sed -e 's/^X-L//'` dnl First look for a shared library. if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then + if test -f "$dir/$libname$shrext" && acl_is_expected_elfclass < "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else @@ -333,14 +345,14 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver" && acl_is_expected_elfclass < "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do - if test -f "$dir/$f"; then + if test -f "$dir/$f" && acl_is_expected_elfclass < "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break @@ -351,7 +363,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi dnl Then look for a static library. if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then + if test -f "$dir/$libname.$acl_libext" && ${AR-ar} -p "$dir/$libname.$acl_libext" | acl_is_expected_elfclass; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi @@ -377,7 +389,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], dnl standard /usr/lib. if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + || test "X$found_dir" = "X/usr/$acl_libdirstem2" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem3"; then dnl No hardcoding is needed. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else @@ -477,6 +490,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], fi additional_includedir="$basedir/include" ;; + */$acl_libdirstem3 | */$acl_libdirstem3/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem3/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. @@ -527,19 +547,21 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], for dep in $dependency_libs; do case "$dep" in -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dependency_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $dependency_libdir to $LIBNAME and $LTLIBNAME. dnl But don't add it dnl 1. if it's the standard /usr/lib, dnl 2. if it's /usr/local/lib and we are using GCC on Linux, dnl 3. if it's already present in $LDFLAGS or the already dnl constructed $LIBNAME, dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + if test "X$dependency_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem2" \ + && test "X$dependency_libdir" != "X/usr/$acl_libdirstem3"; then haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem2" \ + || test "X$dependency_libdir" = "X/usr/local/$acl_libdirstem3"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; @@ -550,29 +572,29 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], haveit= for x in $LDFLAGS $LIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$dependency_libdir" fi fi haveit= for x in $LDFLAGS $LTLIB[]NAME; do AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then + if test "X$x" = "X-L$dependency_libdir"; then haveit=yes break fi done if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + if test -d "$dependency_libdir"; then + dnl Really add $dependency_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$dependency_libdir" fi fi fi @@ -609,7 +631,20 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], ;; -l*) dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + dnl But on GNU systems, ignore -lc options, because + dnl - linking with libc is the default anyway, + dnl - linking with libc.a may produce an error + dnl "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `strcmp' with pointer equality in `/usr/lib/libc.a(strcmp.o)' can not be used when making an executable; recompile with -fPIE and relink with -pie" + dnl or may produce an executable that always crashes, see + dnl <https://lists.gnu.org/archive/html/grep-devel/2020-09/msg00052.html>. + dep=`echo "X$dep" | sed -e 's/^X-l//'` + if test "X$dep" != Xc \ + || case $host_os in + linux* | gnu* | k*bsd*-gnu) false ;; + *) true ;; + esac; then + names_next_round="$names_next_round $dep" + fi ;; *.la) dnl Handle this in the next round. Throw away the .la's @@ -670,7 +705,6 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" done fi - popdef([P_A_C_K]) popdef([PACKLIBS]) popdef([PACKUP]) popdef([PACK]) @@ -721,7 +755,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], dir="$next" dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= @@ -731,7 +766,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` dnl No need to hardcode the standard /usr/lib. if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then + && test "X$dir" != "X/usr/$acl_libdirstem2" \ + && test "X$dir" != "X/usr/$acl_libdirstem3"; then rpathdirs="$rpathdirs $dir" fi next= ;; diff --git a/gnulib-m4/lib-prefix.m4 b/gnulib-m4/lib-prefix.m4 index 16b26fb2..75071e9a 100644 --- a/gnulib-m4/lib-prefix.m4 +++ b/gnulib-m4/lib-prefix.m4 @@ -1,18 +1,11 @@ -# lib-prefix.m4 serial 11 -dnl Copyright (C) 2001-2005, 2008-2018 Free Software Foundation, Inc. +# lib-prefix.m4 serial 19 +dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed dnl to access previously installed libraries. The basic assumption is that dnl a user will want packages to use other packages he previously installed @@ -32,9 +25,9 @@ AC_DEFUN([AC_LIB_PREFIX], eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], + AC_ARG_WITH([lib-prefix], +[[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir]], [ if test "X$withval" = "Xno"; then use_additional=no @@ -154,32 +147,100 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], ]) dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". +dnl - a function acl_is_expected_elfclass, that tests whether standard input +dn; has a 32-bit or 64-bit ELF header, depending on the host CPU ABI, +dnl - 3 variables acl_libdirstem, acl_libdirstem2, acl_libdirstem3, containing +dnl the basename of the libdir to try in turn, either "lib" or "lib64" or +dnl "lib/64" or "lib32" or "lib/sparcv9" or "lib/amd64" or similar. AC_DEFUN([AC_LIB_PREPARE_MULTILIB], [ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting + dnl There is no formal standard regarding lib, lib32, and lib64. + dnl On most glibc systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. However, on + dnl Arch Linux based distributions, it's the opposite: 32-bit libraries go + dnl under $prefix/lib32 and 64-bit libraries go under $prefix/lib. + dnl We determine the compiler's default mode by looking at the compiler's + dnl library search path. If at least one of its elements ends in /lib64 or + dnl points to a directory whose absolute pathname ends in /lib64, we use that + dnl for 64-bit ABIs. Similarly for 32-bit ABIs. Otherwise we use the default, + dnl namely "lib". dnl On Solaris systems, the current practice is that on a system supporting dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_HOST_CPU_C_ABI]) + AC_REQUIRE([gl_HOST_CPU_C_ABI_32BIT]) + + AC_CACHE_CHECK([for ELF binary format], [gl_cv_elf], + [AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_elf=yes], + [gl_cv_elf=no]) + ]) + if test $gl_cv_elf = yes; then + # Extract the ELF class of a file (5th byte) in decimal. + # Cf. https://en.wikipedia.org/wiki/Executable_and_Linkable_Format#File_header + if od -A x < /dev/null >/dev/null 2>/dev/null; then + # Use POSIX od. + func_elfclass () + { + od -A n -t d1 -j 4 -N 1 + } + else + # Use BSD hexdump. + func_elfclass () + { + dd bs=1 count=1 skip=4 2>/dev/null | hexdump -e '1/1 "%3d "' + echo + } + fi + # Use 'expr', not 'test', to compare the values of func_elfclass, because on + # Solaris 11 OpenIndiana and Solaris 11 OmniOS, the result is 001 or 002, + # not 1 or 2. +changequote(,)dnl + case $HOST_CPU_C_ABI_32BIT in + yes) + # 32-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 1 > /dev/null + } + ;; + no) + # 64-bit ABI. + acl_is_expected_elfclass () + { + expr "`func_elfclass | sed -e 's/[ ]//g'`" = 2 > /dev/null + } + ;; + *) + # Unknown. + acl_is_expected_elfclass () + { + : + } + ;; + esac +changequote([,])dnl + else + acl_is_expected_elfclass () + { + : + } + fi + dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], - [acl_libdirstem=lib + [dnl Try 'lib' first, because that's the default for libdir in GNU, see + dnl <https://www.gnu.org/prep/standards/html_node/Directory-Variables.html>. + acl_libdirstem=lib acl_libdirstem2= + acl_libdirstem3= case "$host_os" in solaris*) dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment @@ -187,69 +248,76 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB], dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef _LP64 - int ok; - #else - error fail - #endif - ]])], - [gl_cv_solaris_64bit=yes], - [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 + if test $HOST_CPU_C_ABI_32BIT = no; then + acl_libdirstem2=lib/64 case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + sparc*) acl_libdirstem3=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem3=lib/amd64 ;; esac fi ;; *) dnl If $CC generates code for a 32-bit ABI, the libraries are - dnl surely under $prefix/lib, not $prefix/lib64. - case "$gl_cv_host_cpu_c_abi" in - i386 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | s390 | sparc) - ;; - *) # x86_64 | arm64 | hppa64 | ia64 | mips64 | powerpc64* | s390x | sparc64 | ... - dnl The result is a property of the system. However, non-system - dnl compilers sometimes have odd library search paths. Therefore - dnl prefer asking /usr/bin/gcc, if available, rather than $CC. - searchpath=`(if test -f /usr/bin/gcc \ - && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ - LC_ALL=C /usr/bin/gcc -print-search-dirs; \ - else \ - LC_ALL=C $CC -print-search-dirs; \ - fi) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" + dnl surely under $prefix/lib or $prefix/lib32, not $prefix/lib64. + dnl Similarly, if $CC generates code for a 64-bit ABI, the libraries + dnl are surely under $prefix/lib or $prefix/lib64, not $prefix/lib32. + dnl Find the compiler's search path. However, non-system compilers + dnl sometimes have odd library search paths. But we can't simply invoke + dnl '/usr/bin/gcc -print-search-dirs' because that would not take into + dnl account the -m32/-m31 or -m64 options from the $CC or $CFLAGS. + searchpath=`(LC_ALL=C $CC $CPPFLAGS $CFLAGS -print-search-dirs) 2>/dev/null \ + | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test $HOST_CPU_C_ABI_32BIT != no; then + # 32-bit or unknown ABI. + if test -d /usr/lib32; then + acl_libdirstem2=lib32 + fi + fi + if test $HOST_CPU_C_ABI_32BIT != yes; then + # 64-bit or unknown ABI. + if test -d /usr/lib64; then + acl_libdirstem3=lib64 + fi + fi + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib32/ | */lib32 ) acl_libdirstem2=lib32 ;; + */lib64/ | */lib64 ) acl_libdirstem3=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib32 ) acl_libdirstem2=lib32 ;; + */lib64 ) acl_libdirstem3=lib64 ;; + esac ;; + esac fi - ;; - esac + done + IFS="$acl_save_IFS" + if test $HOST_CPU_C_ABI_32BIT = yes; then + # 32-bit ABI. + acl_libdirstem3= + fi + if test $HOST_CPU_C_ABI_32BIT = no; then + # 64-bit ABI. + acl_libdirstem2= + fi + fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + test -n "$acl_libdirstem3" || acl_libdirstem3="$acl_libdirstem" + acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2,$acl_libdirstem3" ]) - # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. + dnl Decompose acl_cv_libdirstems into acl_libdirstem, acl_libdirstem2, and + dnl acl_libdirstem3. +changequote(,)dnl acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` + acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,//' -e 's/,.*//'` + acl_libdirstem3=`echo "$acl_cv_libdirstems" | sed -e 's/^[^,]*,[^,]*,//' -e 's/,.*//'` +changequote([,])dnl ]) diff --git a/gnulib-m4/libunistring-base.m4 b/gnulib-m4/libunistring-base.m4 index 1587f369..3815b3e3 100644 --- a/gnulib-m4/libunistring-base.m4 +++ b/gnulib-m4/libunistring-base.m4 @@ -1,5 +1,5 @@ -# libunistring-base.m4 serial 5 -dnl Copyright (C) 2010-2018 Free Software Foundation, Inc. +# libunistring-base.m4 serial 6 +dnl Copyright (C) 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -51,7 +51,11 @@ AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from dnl gl_LIBUNISTRING_CORE if that macro has been run. if gl_LIBUNISTRING_VERSION_CMP([$1]); then - LIBUNISTRING_[]AS_TR_CPP([$2])='$2' + dnl It is OK to use a .h file in lib/ from within tests/, but not vice + dnl versa. + if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then + LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2" + fi else LIBUNISTRING_[]AS_TR_CPP([$2])= fi diff --git a/gnulib-m4/limits-h.m4 b/gnulib-m4/limits-h.m4 index 511dcef5..5d5a5bf5 100644 --- a/gnulib-m4/limits-h.m4 +++ b/gnulib-m4/limits-h.m4 @@ -1,6 +1,6 @@ dnl Check whether limits.h has needed features. -dnl Copyright 2016-2018 Free Software Foundation, Inc. +dnl Copyright 2016-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -11,21 +11,31 @@ AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) - AC_CACHE_CHECK([whether limits.h has ULLONG_WIDTH etc.], + AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.], [gl_cv_header_limits_width], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include <limits.h> - int ullw = ULLONG_WIDTH;]])], + [AC_LANG_PROGRAM( + [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include <limits.h> + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + int bw = BOOL_WIDTH; + ]])], [gl_cv_header_limits_width=yes], [gl_cv_header_limits_width=no])]) if test "$gl_cv_header_limits_width" = yes; then - LIMITS_H= + GL_GENERATE_LIMITS_H=false else - LIMITS_H=limits.h + GL_GENERATE_LIMITS_H=true fi - AC_SUBST([LIMITS_H]) - AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) +]) + +dnl Unconditionally enables the replacement of <limits.h>. +AC_DEFUN([gl_REPLACE_LIMITS_H], +[ + AC_REQUIRE([gl_LIMITS_H]) + GL_GENERATE_LIMITS_H=true ]) diff --git a/gnulib-m4/localcharset.m4 b/gnulib-m4/localcharset.m4 index 2d7ca64f..f5dbbd4f 100644 --- a/gnulib-m4/localcharset.m4 +++ b/gnulib-m4/localcharset.m4 @@ -1,5 +1,5 @@ -# localcharset.m4 serial 7 -dnl Copyright (C) 2002, 2004, 2006, 2009-2018 Free Software Foundation, Inc. +# localcharset.m4 serial 8 +dnl Copyright (C) 2002, 2004, 2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,10 +8,4 @@ AC_DEFUN([gl_LOCALCHARSET], [ dnl Prerequisites of lib/localcharset.c. AC_REQUIRE([AM_LANGINFO_CODESET]) - AC_REQUIRE([gl_FCNTL_O_FLAGS]) - AC_CHECK_DECLS_ONCE([getc_unlocked]) - - dnl Prerequisites of the lib/Makefile.am snippet. - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gl_GLIBC21]) ]) diff --git a/gnulib-m4/locale-ar.m4 b/gnulib-m4/locale-ar.m4 index ee386b9a..574311da 100644 --- a/gnulib-m4/locale-ar.m4 +++ b/gnulib-m4/locale-ar.m4 @@ -1,5 +1,5 @@ -# locale-ar.m4 serial 8 -dnl Copyright (C) 2003, 2005-2018 Free Software Foundation, Inc. +# locale-ar.m4 serial 9 +dnl Copyright (C) 2003, 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_AR], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a traditional Arabic locale], [gt_cv_locale_ar], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET @@ -61,8 +60,7 @@ int main () { return 0; #endif } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets diff --git a/gnulib-m4/locale-fr.m4 b/gnulib-m4/locale-fr.m4 index a37a0d20..3753891f 100644 --- a/gnulib-m4/locale-fr.m4 +++ b/gnulib-m4/locale-fr.m4 @@ -1,5 +1,5 @@ -# locale-fr.m4 serial 19 -dnl Copyright (C) 2003, 2005-2018 Free Software Foundation, Inc. +# locale-fr.m4 serial 20 +dnl Copyright (C) 2003, 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_FR], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET @@ -78,8 +77,7 @@ int main () { return 0; #endif } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets @@ -143,8 +141,7 @@ AC_DEFUN([gt_LOCALE_FR_UTF8], [ AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET @@ -206,8 +203,7 @@ int main () { #endif return 0; } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets diff --git a/gnulib-m4/locale-ja.m4 b/gnulib-m4/locale-ja.m4 index 9f162319..73a5d1ae 100644 --- a/gnulib-m4/locale-ja.m4 +++ b/gnulib-m4/locale-ja.m4 @@ -1,5 +1,5 @@ -# locale-ja.m4 serial 14 -dnl Copyright (C) 2003, 2005-2018 Free Software Foundation, Inc. +# locale-ja.m4 serial 15 +dnl Copyright (C) 2003, 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_JA], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET @@ -82,8 +81,7 @@ int main () return 0; #endif } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets diff --git a/gnulib-m4/locale-tr.m4 b/gnulib-m4/locale-tr.m4 index 2f2cf478..4b99e67d 100644 --- a/gnulib-m4/locale-tr.m4 +++ b/gnulib-m4/locale-tr.m4 @@ -1,5 +1,5 @@ -# locale-tr.m4 serial 11 -dnl Copyright (C) 2003, 2005-2018 Free Software Foundation, Inc. +# locale-tr.m4 serial 13 +dnl Copyright (C) 2003, 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_TR_UTF8], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a turkish Unicode locale], [gt_cv_locale_tr_utf8], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <time.h> #if HAVE_LANGINFO_CODESET @@ -21,6 +20,7 @@ changequote(,)dnl #endif #include <stdlib.h> #include <string.h> +#include <wctype.h> struct tm t; char buf[16]; int main () { @@ -74,8 +74,7 @@ int main () { return 1; return 0; } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets diff --git a/gnulib-m4/locale-zh.m4 b/gnulib-m4/locale-zh.m4 index cfb447f0..c997971f 100644 --- a/gnulib-m4/locale-zh.m4 +++ b/gnulib-m4/locale-zh.m4 @@ -1,5 +1,5 @@ -# locale-zh.m4 serial 14 -dnl Copyright (C) 2003, 2005-2018 Free Software Foundation, Inc. +# locale-zh.m4 serial 15 +dnl Copyright (C) 2003, 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -12,8 +12,7 @@ AC_DEFUN([gt_LOCALE_ZH_CN], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([ -changequote(,)dnl + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include <locale.h> #include <stdlib.h> #include <time.h> @@ -83,8 +82,7 @@ int main () return 0; #endif } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then case "$host_os" in # Handle native Windows specially, because there setlocale() interprets diff --git a/gnulib-m4/locale_h.m4 b/gnulib-m4/locale_h.m4 index 4bd9e574..ca5d0d0f 100644 --- a/gnulib-m4/locale_h.m4 +++ b/gnulib-m4/locale_h.m4 @@ -1,13 +1,13 @@ -# locale_h.m4 serial 20 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +# locale_h.m4 serial 28 +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_LOCALE_H], +AC_DEFUN_ONCE([gl_LOCALE_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) dnl Persuade glibc <locale.h> to define locale_t and the int_p_*, int_n_* @@ -17,6 +17,8 @@ AC_DEFUN([gl_LOCALE_H], dnl If <stddef.h> is replaced, then <locale.h> must also be replaced. AC_REQUIRE([gl_STDDEF_H]) + AC_REQUIRE([gl_LOCALE_T]) + dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' dnl only if _LCONV_C99 is defined. AC_REQUIRE([AC_CANONICAL_HOST]) @@ -37,34 +39,6 @@ AC_DEFUN([gl_LOCALE_H], [gl_cv_header_locale_h_posix2001=yes], [gl_cv_header_locale_h_posix2001=no])]) - dnl Check for <xlocale.h>. - AC_CHECK_HEADERS_ONCE([xlocale.h]) - if test $ac_cv_header_xlocale_h = yes; then - HAVE_XLOCALE_H=1 - dnl Check whether use of locale_t requires inclusion of <xlocale.h>, - dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by - dnl itself, we assume that <xlocale.h> will do so. - AC_CACHE_CHECK([whether locale.h defines locale_t], - [gl_cv_header_locale_has_locale_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <locale.h> - locale_t x;]], - [[]])], - [gl_cv_header_locale_has_locale_t=yes], - [gl_cv_header_locale_has_locale_t=no]) - ]) - if test $gl_cv_header_locale_has_locale_t = yes; then - gl_cv_header_locale_h_needs_xlocale_h=no - else - gl_cv_header_locale_h_needs_xlocale_h=yes - fi - else - HAVE_XLOCALE_H=0 - gl_cv_header_locale_h_needs_xlocale_h=no - fi - AC_SUBST([HAVE_XLOCALE_H]) - dnl Check whether 'struct lconv' is complete. dnl Bionic libc's 'struct lconv' is just a dummy. dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, @@ -82,7 +56,20 @@ AC_DEFUN([gl_LOCALE_H], [gl_cv_sys_struct_lconv_ok=no]) ]) if test $gl_cv_sys_struct_lconv_ok = no; then - REPLACE_STRUCT_LCONV=1 + dnl On native Windows with MSVC, merely define these member names as macros. + dnl This avoids trouble in C++ mode. + case "$host_os" in + mingw*) + AC_EGREP_CPP([Special], [ +#ifdef _MSC_VER + Special +#endif + ], + [], + [REPLACE_STRUCT_LCONV=1]) + ;; + *) REPLACE_STRUCT_LCONV=1 ;; + esac fi dnl <locale.h> is always overridden, because of GNULIB_POSIXCHECK. @@ -96,27 +83,92 @@ AC_DEFUN([gl_LOCALE_H], # include <xlocale.h> #endif ]], - [setlocale duplocale]) + [setlocale newlocale duplocale freelocale]) +]) + +dnl Checks to determine whether the system has the locale_t type, +dnl and how to obtain it. +AC_DEFUN([gl_LOCALE_T], +[ + dnl Persuade glibc and Solaris <locale.h> to define locale_t. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + dnl Check whether use of locale_t requires inclusion of <xlocale.h>, + dnl e.g. on Mac OS X 10.5. If <locale.h> does not define locale_t by + dnl itself, we assume that <xlocale.h> will do so. + AC_CACHE_CHECK([whether locale.h defines locale_t], + [gl_cv_header_locale_has_locale_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <locale.h> + locale_t x;]], + [[]])], + [gl_cv_header_locale_has_locale_t=yes], + [gl_cv_header_locale_has_locale_t=no]) + ]) + + dnl Check for <xlocale.h>. + AC_CHECK_HEADERS_ONCE([xlocale.h]) + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi + HAVE_LOCALE_T=1 + else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + if test $gl_cv_header_locale_has_locale_t = yes; then + HAVE_LOCALE_T=1 + else + HAVE_LOCALE_T=0 + fi + fi + AC_SUBST([HAVE_XLOCALE_H]) ]) +# gl_LOCALE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_LOCALE_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_LOCALE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) +]) + AC_DEFUN([gl_LOCALE_H_DEFAULTS], [ - GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV]) - GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE]) - GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) + REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) + REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) + LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) ]) diff --git a/gnulib-m4/localename.m4 b/gnulib-m4/localename.m4 index a0e13675..e0cf8c5c 100644 --- a/gnulib-m4/localename.m4 +++ b/gnulib-m4/localename.m4 @@ -1,18 +1,41 @@ -# localename.m4 serial 3 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +# localename.m4 serial 8 +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_LOCALENAME], [ + AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + AC_REQUIRE([gl_LOCALE_T]) AC_REQUIRE([gt_LC_MESSAGES]) + AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME]) AC_REQUIRE([gt_INTL_MACOSX]) AC_CHECK_HEADERS_ONCE([langinfo.h]) - AC_CHECK_FUNCS([setlocale uselocale]) - dnl Solaris 12 provides getlocalename_l, while Illumos doesn't have - dnl it nor the equivalent. - if test $ac_cv_func_uselocale = yes; then - AC_CHECK_FUNCS([getlocalename_l]) + if test $HAVE_LOCALE_T = 1; then + AC_CHECK_FUNCS_ONCE([newlocale duplocale freelocale]) + gl_func_newlocale="$ac_cv_func_newlocale" + gl_func_duplocale="$ac_cv_func_duplocale" + gl_func_freelocale="$ac_cv_func_freelocale" + else + dnl In 2019, some versions of z/OS lack the locale_t type and have broken + dnl newlocale, duplocale, freelocale functions. + gl_func_newlocale=no + gl_func_duplocale=no + gl_func_freelocale=no + fi + if test $gl_func_newlocale != yes; then + HAVE_NEWLOCALE=0 + fi + if test $gl_func_duplocale != yes; then + HAVE_DUPLOCALE=0 + fi + if test $gl_func_freelocale != yes; then + HAVE_FREELOCALE=0 + fi + if test $gt_localename_enhances_locale_funcs = yes; then + REPLACE_NEWLOCALE=1 + REPLACE_DUPLOCALE=1 + REPLACE_FREELOCALE=1 fi ]) diff --git a/gnulib-m4/lock.m4 b/gnulib-m4/lock.m4 index dac4c383..c4cbf07b 100644 --- a/gnulib-m4/lock.m4 +++ b/gnulib-m4/lock.m4 @@ -1,5 +1,5 @@ # lock.m4 serial 14 -dnl Copyright (C) 2005-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/longlong.m4 b/gnulib-m4/longlong.m4 deleted file mode 100644 index 27e63265..00000000 --- a/gnulib-m4/longlong.m4 +++ /dev/null @@ -1,113 +0,0 @@ -# longlong.m4 serial 17 -dnl Copyright (C) 1999-2007, 2009-2018 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Paul Eggert. - -# Define HAVE_LONG_LONG_INT if 'long long int' works. -# This fixes a bug in Autoconf 2.61, and can be faster -# than what's in Autoconf 2.62 through 2.68. - -# Note: If the type 'long long int' exists but is only 32 bits large -# (as on some very old compilers), HAVE_LONG_LONG_INT will not be -# defined. In this case you can treat 'long long int' like 'long int'. - -AC_DEFUN([AC_TYPE_LONG_LONG_INT], -[ - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], - [ac_cv_type_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_long_long_int = yes; then - dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. - dnl If cross compiling, assume the bug is not important, since - dnl nobody cross compiles for this platform as far as we know. - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[@%:@include <limits.h> - @%:@ifndef LLONG_MAX - @%:@ define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - @%:@ define LLONG_MAX (HALF - 1 + HALF) - @%:@endif]], - [[long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0;]])], - [], - [ac_cv_type_long_long_int=no], - [:]) - fi - fi]) - if test $ac_cv_type_long_long_int = yes; then - AC_DEFINE([HAVE_LONG_LONG_INT], [1], - [Define to 1 if the system has the type 'long long int'.]) - fi -]) - -# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. -# This fixes a bug in Autoconf 2.61, and can be faster -# than what's in Autoconf 2.62 through 2.68. - -# Note: If the type 'unsigned long long int' exists but is only 32 bits -# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT -# will not be defined. In this case you can treat 'unsigned long long int' -# like 'unsigned long int'. - -AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], -[ - AC_CACHE_CHECK([for unsigned long long int], - [ac_cv_type_unsigned_long_long_int], - [ac_cv_type_unsigned_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - AC_LINK_IFELSE( - [_AC_TYPE_LONG_LONG_SNIPPET], - [], - [ac_cv_type_unsigned_long_long_int=no]) - fi]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], - [Define to 1 if the system has the type 'unsigned long long int'.]) - fi -]) - -# Expands to a C program that can be used to test for simultaneous support -# of 'long long' and 'unsigned long long'. We don't want to say that -# 'long long' is available if 'unsigned long long' is not, or vice versa, -# because too many programs rely on the symmetry between signed and unsigned -# integer types (excluding 'bool'). -AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], -[ - AC_LANG_PROGRAM( - [[/* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63;]], - [[/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull));]]) -]) diff --git a/gnulib-m4/lstat.m4 b/gnulib-m4/lstat.m4 new file mode 100644 index 00000000..d987060b --- /dev/null +++ b/gnulib-m4/lstat.m4 @@ -0,0 +1,79 @@ +# serial 33 + +# Copyright (C) 1997-2001, 2003-2022 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Jim Meyering. + +AC_DEFUN([gl_FUNC_LSTAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + dnl If lstat does not exist, the replacement <sys/stat.h> does + dnl "#define lstat stat", and lstat.c is a no-op. + AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + solaris* | *no) + REPLACE_LSTAT=1 + ;; + esac + else + HAVE_LSTAT=0 + fi +]) + +# Prerequisites of lib/lstat.c. +AC_DEFUN([gl_PREREQ_LSTAT], [:]) + +AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], +[ + dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it + dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether lstat correctly handles trailing slash], + [gl_cv_func_lstat_dereferences_slashed_symlink], + [rm -f conftest.sym conftest.file + echo >conftest.file + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ]])], + [gl_cv_func_lstat_dereferences_slashed_symlink=yes], + [gl_cv_func_lstat_dereferences_slashed_symlink=no], + [case "$host_os" in + linux-* | linux) + # Guess yes on Linux systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *-gnu* | gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + mingw*) + # Guess no on native Windows. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.sym conftest.file + ]) + case "$gl_cv_func_lstat_dereferences_slashed_symlink" in + *yes) + AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], + [Define to 1 if 'lstat' dereferences a symlink specified + with a trailing slash.]) + ;; + esac +]) diff --git a/gnulib-m4/malloc.m4 b/gnulib-m4/malloc.m4 index 4c182b41..6b76c1e6 100644 --- a/gnulib-m4/malloc.m4 +++ b/gnulib-m4/malloc.m4 @@ -1,29 +1,21 @@ -# malloc.m4 serial 17 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +# malloc.m4 serial 28 +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -m4_version_prereq([2.70], [] ,[ - # This is adapted with modifications from upstream Autoconf here: -# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 AC_DEFUN([_AC_FUNC_MALLOC_IF], [ - AC_REQUIRE([AC_HEADER_STDC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles - AC_CHECK_HEADERS([stdlib.h]) - AC_CACHE_CHECK([for GNU libc compatible malloc], + AC_CACHE_CHECK([whether malloc (0) returns nonnull], [ac_cv_func_malloc_0_nonnull], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( - [[#if defined STDC_HEADERS || defined HAVE_STDLIB_H - # include <stdlib.h> - #else - char *malloc (); - #endif + [[#include <stdlib.h> ]], - [[char *p = malloc (0); + [[void *p = malloc (0); int result = !p; free (p); return result;]]) @@ -32,70 +24,152 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [ac_cv_func_malloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. - *-gnu* | gnu* | freebsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull=yes ;; - # If we don't know, assume the worst. - *) ac_cv_func_malloc_0_nonnull=no ;; + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; esac ]) ]) - AS_IF([test $ac_cv_func_malloc_0_nonnull = yes], [$1], [$2]) + AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) ])# _AC_FUNC_MALLOC_IF -]) - # gl_FUNC_MALLOC_GNU # ------------------ -# Test whether 'malloc (0)' is handled like in GNU libc, and replace malloc if -# it is not. +# Replace malloc if it is not compatible with GNU libc. AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - dnl _AC_FUNC_MALLOC_IF is defined in Autoconf. - _AC_FUNC_MALLOC_IF( - [AC_DEFINE([HAVE_MALLOC_GNU], [1], - [Define to 1 if your system has a GNU libc compatible 'malloc' - function, and to 0 otherwise.])], - [AC_DEFINE([HAVE_MALLOC_GNU], [0]) - REPLACE_MALLOC=1 + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" + if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then + _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) + fi +]) + +# gl_FUNC_MALLOC_PTRDIFF +# ---------------------- +# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, +# and replace malloc otherwise. +AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) + test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 +]) + +# Test whether malloc, realloc, calloc refuse to create objects +# larger than what can be expressed in ptrdiff_t. +# Set gl_cv_func_malloc_gnu to yes or no accordingly. +AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], +[ + AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], + [gl_cv_malloc_ptrdiff], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdint.h> + ]], + [[/* 64-bit ptrdiff_t is so wide that no practical platform + can exceed it. */ + #define WIDE_PTRDIFF (PTRDIFF_MAX >> 31 >> 31 != 0) + + /* On rare machines where size_t fits in ptrdiff_t there + is no problem. */ + #define NARROW_SIZE (SIZE_MAX <= PTRDIFF_MAX) + + /* glibc 2.30 and later malloc refuses to exceed ptrdiff_t + bounds even on 32-bit platforms. We don't know which + non-glibc systems are safe. */ + #define KNOWN_SAFE (2 < __GLIBC__ + (30 <= __GLIBC_MINOR__)) + + #if WIDE_PTRDIFF || NARROW_SIZE || KNOWN_SAFE + return 0; + #else + #error "malloc might not be ptrdiff_t safe" + syntax error + #endif + ]])], + [gl_cv_malloc_ptrdiff=yes], + [gl_cv_malloc_ptrdiff=no]) ]) ]) # gl_FUNC_MALLOC_POSIX # -------------------- # Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it -# fails), and replace malloc if it is not. +# fails, and doesn't mess up with ptrdiff_t overflow), and replace +# malloc if it is not. AC_DEFUN([gl_FUNC_MALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix = yes; then + if test "$gl_cv_func_malloc_posix" = yes; then AC_DEFINE([HAVE_MALLOC_POSIX], [1], - [Define if the 'malloc' function is POSIX compliant.]) + [Define if malloc, realloc, and calloc set errno on allocation failure.]) else - REPLACE_MALLOC=1 + REPLACE_MALLOC_FOR_MALLOC_POSIX=1 fi ]) -# Test whether malloc, realloc, calloc are POSIX compliant, +# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. # Set gl_cv_func_malloc_posix to yes or no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ - AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant], + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], [gl_cv_func_malloc_posix], [ dnl It is too dangerous to try to allocate a large amount of memory: dnl some systems go to their knees when you do that. So assume that - dnl all Unix implementations of the function are POSIX compliant. - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[]], - [[#if defined _WIN32 && ! defined __CYGWIN__ - choke me - #endif - ]])], - [gl_cv_func_malloc_posix=yes], - [gl_cv_func_malloc_posix=no]) + dnl all Unix implementations of the function set errno on failure, + dnl except on those platforms where we have seen 'test-malloc-gnu', + dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. + case "$host_os" in + mingw*) + gl_cv_func_malloc_posix=no ;; + irix* | solaris*) + dnl On IRIX 6.5, the three functions return NULL with errno unset + dnl when the argument is larger than PTRDIFF_MAX. + dnl On Solaris 11.3, the three functions return NULL with errno set + dnl to EAGAIN, not ENOMEM, when the argument is larger than + dnl PTRDIFF_MAX. + dnl Here is a test program: +m4_divert_push([KILL]) +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#define ptrdiff_t long +#ifndef PTRDIFF_MAX +# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1)) +#endif + +int main () +{ + void *p; + + fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX); + + errno = 0; + p = malloc ((unsigned long) PTRDIFF_MAX + 1); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + errno = 0; + p = calloc (PTRDIFF_MAX / 2 + 1, 2); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + errno = 0; + p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); + fprintf (stderr, "p=%p errno=%d\n", p, errno); + + return 0; +} +m4_divert_pop([KILL]) + gl_cv_func_malloc_posix=no ;; + *) + gl_cv_func_malloc_posix=yes ;; + esac ]) ]) diff --git a/gnulib-m4/malloca.m4 b/gnulib-m4/malloca.m4 index 2251e613..77eb96a0 100644 --- a/gnulib-m4/malloca.m4 +++ b/gnulib-m4/malloca.m4 @@ -1,5 +1,5 @@ -# malloca.m4 serial 1 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2018 Free Software Foundation, +# malloca.m4 serial 2 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,5 +11,4 @@ AC_DEFUN([gl_MALLOCA], dnl @ALLOCA@ and @LTALLOCA@. dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. AC_REQUIRE([gl_EEMALLOC]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) ]) diff --git a/gnulib-m4/math_h.m4 b/gnulib-m4/math_h.m4 index d0c7ed11..a08526a7 100644 --- a/gnulib-m4/math_h.m4 +++ b/gnulib-m4/math_h.m4 @@ -1,16 +1,16 @@ -# math_h.m4 serial 116 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# math_h.m4 serial 125 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_MATH_H], +AC_DEFUN_ONCE([gl_MATH_H], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([math.h]) AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[/* Solaris 10 has a broken definition of NAN. Other platforms fail to provide NAN, or provide it only in C99 mode; this test only needs to fail when NAN is provided but wrong. */ @@ -25,7 +25,7 @@ AC_DEFUN([gl_MATH_H], REPLACE_NAN=1 fi AC_CACHE_CHECK([whether HUGE_VAL works], [gl_cv_header_math_huge_val_works], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[/* Solaris 10 has a broken definition of HUGE_VAL. */ double d = HUGE_VAL; return d == 0;]])], @@ -53,285 +53,310 @@ AC_DEFUN([gl_MATH_H], tanf tanl tanhf trunc truncf truncl]) ]) +# gl_MATH_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_MATH_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_MATH_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_MATH_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACOSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ASINL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATANL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATAN2F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CBRTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEIL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CEILL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPYSIGNL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COSHF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXP2L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPM1L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FABSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOOR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOORL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMA]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMAL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FMODL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREXPL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG10L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1P]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG1PL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG2L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POWF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMAINDERL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RINTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ROUNDL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SQRTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TANHF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J0], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_J1], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_JN], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y0], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_Y1], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_YN], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_MATH_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_MATH_H_DEFAULTS]) +]) + AC_DEFUN([gl_MATH_H_DEFAULTS], [ - GNULIB_ACOSF=0; AC_SUBST([GNULIB_ACOSF]) - GNULIB_ACOSL=0; AC_SUBST([GNULIB_ACOSL]) - GNULIB_ASINF=0; AC_SUBST([GNULIB_ASINF]) - GNULIB_ASINL=0; AC_SUBST([GNULIB_ASINL]) - GNULIB_ATANF=0; AC_SUBST([GNULIB_ATANF]) - GNULIB_ATANL=0; AC_SUBST([GNULIB_ATANL]) - GNULIB_ATAN2F=0; AC_SUBST([GNULIB_ATAN2F]) - GNULIB_CBRT=0; AC_SUBST([GNULIB_CBRT]) - GNULIB_CBRTF=0; AC_SUBST([GNULIB_CBRTF]) - GNULIB_CBRTL=0; AC_SUBST([GNULIB_CBRTL]) - GNULIB_CEIL=0; AC_SUBST([GNULIB_CEIL]) - GNULIB_CEILF=0; AC_SUBST([GNULIB_CEILF]) - GNULIB_CEILL=0; AC_SUBST([GNULIB_CEILL]) - GNULIB_COPYSIGN=0; AC_SUBST([GNULIB_COPYSIGN]) - GNULIB_COPYSIGNF=0; AC_SUBST([GNULIB_COPYSIGNF]) - GNULIB_COPYSIGNL=0; AC_SUBST([GNULIB_COPYSIGNL]) - GNULIB_COSF=0; AC_SUBST([GNULIB_COSF]) - GNULIB_COSL=0; AC_SUBST([GNULIB_COSL]) - GNULIB_COSHF=0; AC_SUBST([GNULIB_COSHF]) - GNULIB_EXPF=0; AC_SUBST([GNULIB_EXPF]) - GNULIB_EXPL=0; AC_SUBST([GNULIB_EXPL]) - GNULIB_EXP2=0; AC_SUBST([GNULIB_EXP2]) - GNULIB_EXP2F=0; AC_SUBST([GNULIB_EXP2F]) - GNULIB_EXP2L=0; AC_SUBST([GNULIB_EXP2L]) - GNULIB_EXPM1=0; AC_SUBST([GNULIB_EXPM1]) - GNULIB_EXPM1F=0; AC_SUBST([GNULIB_EXPM1F]) - GNULIB_EXPM1L=0; AC_SUBST([GNULIB_EXPM1L]) - GNULIB_FABSF=0; AC_SUBST([GNULIB_FABSF]) - GNULIB_FABSL=0; AC_SUBST([GNULIB_FABSL]) - GNULIB_FLOOR=0; AC_SUBST([GNULIB_FLOOR]) - GNULIB_FLOORF=0; AC_SUBST([GNULIB_FLOORF]) - GNULIB_FLOORL=0; AC_SUBST([GNULIB_FLOORL]) - GNULIB_FMA=0; AC_SUBST([GNULIB_FMA]) - GNULIB_FMAF=0; AC_SUBST([GNULIB_FMAF]) - GNULIB_FMAL=0; AC_SUBST([GNULIB_FMAL]) - GNULIB_FMOD=0; AC_SUBST([GNULIB_FMOD]) - GNULIB_FMODF=0; AC_SUBST([GNULIB_FMODF]) - GNULIB_FMODL=0; AC_SUBST([GNULIB_FMODL]) - GNULIB_FREXPF=0; AC_SUBST([GNULIB_FREXPF]) - GNULIB_FREXP=0; AC_SUBST([GNULIB_FREXP]) - GNULIB_FREXPL=0; AC_SUBST([GNULIB_FREXPL]) - GNULIB_HYPOT=0; AC_SUBST([GNULIB_HYPOT]) - GNULIB_HYPOTF=0; AC_SUBST([GNULIB_HYPOTF]) - GNULIB_HYPOTL=0; AC_SUBST([GNULIB_HYPOTL]) - GNULIB_ILOGB=0; AC_SUBST([GNULIB_ILOGB]) - GNULIB_ILOGBF=0; AC_SUBST([GNULIB_ILOGBF]) - GNULIB_ILOGBL=0; AC_SUBST([GNULIB_ILOGBL]) - GNULIB_ISFINITE=0; AC_SUBST([GNULIB_ISFINITE]) - GNULIB_ISINF=0; AC_SUBST([GNULIB_ISINF]) - GNULIB_ISNAN=0; AC_SUBST([GNULIB_ISNAN]) - GNULIB_ISNANF=0; AC_SUBST([GNULIB_ISNANF]) - GNULIB_ISNAND=0; AC_SUBST([GNULIB_ISNAND]) - GNULIB_ISNANL=0; AC_SUBST([GNULIB_ISNANL]) - GNULIB_LDEXPF=0; AC_SUBST([GNULIB_LDEXPF]) - GNULIB_LDEXPL=0; AC_SUBST([GNULIB_LDEXPL]) - GNULIB_LOG=0; AC_SUBST([GNULIB_LOG]) - GNULIB_LOGF=0; AC_SUBST([GNULIB_LOGF]) - GNULIB_LOGL=0; AC_SUBST([GNULIB_LOGL]) - GNULIB_LOG10=0; AC_SUBST([GNULIB_LOG10]) - GNULIB_LOG10F=0; AC_SUBST([GNULIB_LOG10F]) - GNULIB_LOG10L=0; AC_SUBST([GNULIB_LOG10L]) - GNULIB_LOG1P=0; AC_SUBST([GNULIB_LOG1P]) - GNULIB_LOG1PF=0; AC_SUBST([GNULIB_LOG1PF]) - GNULIB_LOG1PL=0; AC_SUBST([GNULIB_LOG1PL]) - GNULIB_LOG2=0; AC_SUBST([GNULIB_LOG2]) - GNULIB_LOG2F=0; AC_SUBST([GNULIB_LOG2F]) - GNULIB_LOG2L=0; AC_SUBST([GNULIB_LOG2L]) - GNULIB_LOGB=0; AC_SUBST([GNULIB_LOGB]) - GNULIB_LOGBF=0; AC_SUBST([GNULIB_LOGBF]) - GNULIB_LOGBL=0; AC_SUBST([GNULIB_LOGBL]) - GNULIB_MODF=0; AC_SUBST([GNULIB_MODF]) - GNULIB_MODFF=0; AC_SUBST([GNULIB_MODFF]) - GNULIB_MODFL=0; AC_SUBST([GNULIB_MODFL]) - GNULIB_POWF=0; AC_SUBST([GNULIB_POWF]) - GNULIB_REMAINDER=0; AC_SUBST([GNULIB_REMAINDER]) - GNULIB_REMAINDERF=0; AC_SUBST([GNULIB_REMAINDERF]) - GNULIB_REMAINDERL=0; AC_SUBST([GNULIB_REMAINDERL]) - GNULIB_RINT=0; AC_SUBST([GNULIB_RINT]) - GNULIB_RINTF=0; AC_SUBST([GNULIB_RINTF]) - GNULIB_RINTL=0; AC_SUBST([GNULIB_RINTL]) - GNULIB_ROUND=0; AC_SUBST([GNULIB_ROUND]) - GNULIB_ROUNDF=0; AC_SUBST([GNULIB_ROUNDF]) - GNULIB_ROUNDL=0; AC_SUBST([GNULIB_ROUNDL]) - GNULIB_SIGNBIT=0; AC_SUBST([GNULIB_SIGNBIT]) - GNULIB_SINF=0; AC_SUBST([GNULIB_SINF]) - GNULIB_SINL=0; AC_SUBST([GNULIB_SINL]) - GNULIB_SINHF=0; AC_SUBST([GNULIB_SINHF]) - GNULIB_SQRTF=0; AC_SUBST([GNULIB_SQRTF]) - GNULIB_SQRTL=0; AC_SUBST([GNULIB_SQRTL]) - GNULIB_TANF=0; AC_SUBST([GNULIB_TANF]) - GNULIB_TANL=0; AC_SUBST([GNULIB_TANL]) - GNULIB_TANHF=0; AC_SUBST([GNULIB_TANHF]) - GNULIB_TRUNC=0; AC_SUBST([GNULIB_TRUNC]) - GNULIB_TRUNCF=0; AC_SUBST([GNULIB_TRUNCF]) - GNULIB_TRUNCL=0; AC_SUBST([GNULIB_TRUNCL]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) - HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) - HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) - HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) - HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) - HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) - HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) - HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) - HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) - HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) - HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) - HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) - HAVE_COSF=1; AC_SUBST([HAVE_COSF]) - HAVE_COSL=1; AC_SUBST([HAVE_COSL]) - HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) - HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) - HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) - HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) - HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) - HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) - HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) - HAVE_FMA=1; AC_SUBST([HAVE_FMA]) - HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) - HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) - HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) - HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) - HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) - HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) - HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) - HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) - HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) - HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) - HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) - HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) - HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) - HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) - HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) - HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) - HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) - HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) - HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) - HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) - HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) - HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) - HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) - HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) - HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) - HAVE_POWF=1; AC_SUBST([HAVE_POWF]) - HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) - HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) - HAVE_RINT=1; AC_SUBST([HAVE_RINT]) - HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) - HAVE_SINF=1; AC_SUBST([HAVE_SINF]) - HAVE_SINL=1; AC_SUBST([HAVE_SINL]) - HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) - HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) - HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) - HAVE_TANF=1; AC_SUBST([HAVE_TANF]) - HAVE_TANL=1; AC_SUBST([HAVE_TANL]) - HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) - HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) - HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) - HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) - HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) - HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) - HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) - HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) - HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) - HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) - HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) - HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) - HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) - HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) - HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) - HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) - HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) - HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) - HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) - HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) - HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) - HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) - HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) - HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) - HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) - HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) - HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) - HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) - HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) - HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) - HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) - HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) - HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) - HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) - HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) - HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) - HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) - REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) - REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) - REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) - REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) - REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) - REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) - REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) - REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) - REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) - REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) - REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) - REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) - REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) - REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) - REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) - REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) - REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) - REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) - REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) - REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) - REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) - REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) - REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) - REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) - REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) - REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) - REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) - REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) - REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) - REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) - REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) - REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) - REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) - REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) - REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) - REPLACE_ILOGBL=0; AC_SUBST([REPLACE_ILOGBL]) - REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) - REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) - REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) - REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) - REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) - REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) - REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) - REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) - REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) - REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) - REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) - REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) - REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) - REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) - REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) - REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) - REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) - REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) - REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) - REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) - REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) - REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) - REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) - REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) - REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) - REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) - REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) - REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) - REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) - REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) - REPLACE_SIGNBIT_USING_GCC=0; AC_SUBST([REPLACE_SIGNBIT_USING_GCC]) - REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) - REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) - REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) - REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) - REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) - REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) - REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) - REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) - REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) + HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) + HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) + HAVE_ASINF=1; AC_SUBST([HAVE_ASINF]) + HAVE_ASINL=1; AC_SUBST([HAVE_ASINL]) + HAVE_ATANF=1; AC_SUBST([HAVE_ATANF]) + HAVE_ATANL=1; AC_SUBST([HAVE_ATANL]) + HAVE_ATAN2F=1; AC_SUBST([HAVE_ATAN2F]) + HAVE_CBRT=1; AC_SUBST([HAVE_CBRT]) + HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) + HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) + HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) + HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) + HAVE_COSF=1; AC_SUBST([HAVE_COSF]) + HAVE_COSL=1; AC_SUBST([HAVE_COSL]) + HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) + HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) + HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) + HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) + HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) + HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) + HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) + HAVE_FMA=1; AC_SUBST([HAVE_FMA]) + HAVE_FMAF=1; AC_SUBST([HAVE_FMAF]) + HAVE_FMAL=1; AC_SUBST([HAVE_FMAL]) + HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) + HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) + HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) + HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) + HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) + HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) + HAVE_ILOGBF=1; AC_SUBST([HAVE_ILOGBF]) + HAVE_ILOGBL=1; AC_SUBST([HAVE_ILOGBL]) + HAVE_ISNANF=1; AC_SUBST([HAVE_ISNANF]) + HAVE_ISNAND=1; AC_SUBST([HAVE_ISNAND]) + HAVE_ISNANL=1; AC_SUBST([HAVE_ISNANL]) + HAVE_LDEXPF=1; AC_SUBST([HAVE_LDEXPF]) + HAVE_LOGF=1; AC_SUBST([HAVE_LOGF]) + HAVE_LOGL=1; AC_SUBST([HAVE_LOGL]) + HAVE_LOG10F=1; AC_SUBST([HAVE_LOG10F]) + HAVE_LOG10L=1; AC_SUBST([HAVE_LOG10L]) + HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) + HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) + HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) + HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) + HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) + HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) + HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) + HAVE_POWF=1; AC_SUBST([HAVE_POWF]) + HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) + HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) + HAVE_RINT=1; AC_SUBST([HAVE_RINT]) + HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) + HAVE_SINF=1; AC_SUBST([HAVE_SINF]) + HAVE_SINL=1; AC_SUBST([HAVE_SINL]) + HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) + HAVE_SQRTF=1; AC_SUBST([HAVE_SQRTF]) + HAVE_SQRTL=1; AC_SUBST([HAVE_SQRTL]) + HAVE_TANF=1; AC_SUBST([HAVE_TANF]) + HAVE_TANL=1; AC_SUBST([HAVE_TANL]) + HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) + HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) + HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) + HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) + HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF]) + HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL]) + HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) + HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) + HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF]) + HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) + HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) + HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2]) + HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F]) + HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L]) + HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L]) + HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) + HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) + HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) + HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) + HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) + HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) + HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2]) + HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F]) + HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L]) + HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) + HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER]) + HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL]) + HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF]) + HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND]) + HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF]) + HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL]) + HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) + HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) + HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) + HAVE_DECL_TRUNC=1; AC_SUBST([HAVE_DECL_TRUNC]) + HAVE_DECL_TRUNCF=1; AC_SUBST([HAVE_DECL_TRUNCF]) + HAVE_DECL_TRUNCL=1; AC_SUBST([HAVE_DECL_TRUNCL]) + REPLACE_ACOSF=0; AC_SUBST([REPLACE_ACOSF]) + REPLACE_ASINF=0; AC_SUBST([REPLACE_ASINF]) + REPLACE_ATANF=0; AC_SUBST([REPLACE_ATANF]) + REPLACE_ATAN2F=0; AC_SUBST([REPLACE_ATAN2F]) + REPLACE_CBRTF=0; AC_SUBST([REPLACE_CBRTF]) + REPLACE_CBRTL=0; AC_SUBST([REPLACE_CBRTL]) + REPLACE_CEIL=0; AC_SUBST([REPLACE_CEIL]) + REPLACE_CEILF=0; AC_SUBST([REPLACE_CEILF]) + REPLACE_CEILL=0; AC_SUBST([REPLACE_CEILL]) + REPLACE_COSF=0; AC_SUBST([REPLACE_COSF]) + REPLACE_COSHF=0; AC_SUBST([REPLACE_COSHF]) + REPLACE_EXPF=0; AC_SUBST([REPLACE_EXPF]) + REPLACE_EXPL=0; AC_SUBST([REPLACE_EXPL]) + REPLACE_EXPM1=0; AC_SUBST([REPLACE_EXPM1]) + REPLACE_EXPM1F=0; AC_SUBST([REPLACE_EXPM1F]) + REPLACE_EXPM1L=0; AC_SUBST([REPLACE_EXPM1L]) + REPLACE_EXP2=0; AC_SUBST([REPLACE_EXP2]) + REPLACE_EXP2L=0; AC_SUBST([REPLACE_EXP2L]) + REPLACE_FABSL=0; AC_SUBST([REPLACE_FABSL]) + REPLACE_FLOOR=0; AC_SUBST([REPLACE_FLOOR]) + REPLACE_FLOORF=0; AC_SUBST([REPLACE_FLOORF]) + REPLACE_FLOORL=0; AC_SUBST([REPLACE_FLOORL]) + REPLACE_FMA=0; AC_SUBST([REPLACE_FMA]) + REPLACE_FMAF=0; AC_SUBST([REPLACE_FMAF]) + REPLACE_FMAL=0; AC_SUBST([REPLACE_FMAL]) + REPLACE_FMOD=0; AC_SUBST([REPLACE_FMOD]) + REPLACE_FMODF=0; AC_SUBST([REPLACE_FMODF]) + REPLACE_FMODL=0; AC_SUBST([REPLACE_FMODL]) + REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) + REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) + REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) + REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) + REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) + REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) + REPLACE_HYPOTL=0; AC_SUBST([REPLACE_HYPOTL]) + REPLACE_ILOGB=0; AC_SUBST([REPLACE_ILOGB]) + REPLACE_ILOGBF=0; AC_SUBST([REPLACE_ILOGBF]) + REPLACE_ILOGBL=0; AC_SUBST([REPLACE_ILOGBL]) + REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) + REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) + REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) + REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) + REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) + REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) + REPLACE_LOGL=0; AC_SUBST([REPLACE_LOGL]) + REPLACE_LOG10=0; AC_SUBST([REPLACE_LOG10]) + REPLACE_LOG10F=0; AC_SUBST([REPLACE_LOG10F]) + REPLACE_LOG10L=0; AC_SUBST([REPLACE_LOG10L]) + REPLACE_LOG1P=0; AC_SUBST([REPLACE_LOG1P]) + REPLACE_LOG1PF=0; AC_SUBST([REPLACE_LOG1PF]) + REPLACE_LOG1PL=0; AC_SUBST([REPLACE_LOG1PL]) + REPLACE_LOG2=0; AC_SUBST([REPLACE_LOG2]) + REPLACE_LOG2F=0; AC_SUBST([REPLACE_LOG2F]) + REPLACE_LOG2L=0; AC_SUBST([REPLACE_LOG2L]) + REPLACE_LOGB=0; AC_SUBST([REPLACE_LOGB]) + REPLACE_LOGBF=0; AC_SUBST([REPLACE_LOGBF]) + REPLACE_LOGBL=0; AC_SUBST([REPLACE_LOGBL]) + REPLACE_MODF=0; AC_SUBST([REPLACE_MODF]) + REPLACE_MODFF=0; AC_SUBST([REPLACE_MODFF]) + REPLACE_MODFL=0; AC_SUBST([REPLACE_MODFL]) + REPLACE_NAN=0; AC_SUBST([REPLACE_NAN]) + REPLACE_REMAINDER=0; AC_SUBST([REPLACE_REMAINDER]) + REPLACE_REMAINDERF=0; AC_SUBST([REPLACE_REMAINDERF]) + REPLACE_REMAINDERL=0; AC_SUBST([REPLACE_REMAINDERL]) + REPLACE_RINTL=0; AC_SUBST([REPLACE_RINTL]) + REPLACE_ROUND=0; AC_SUBST([REPLACE_ROUND]) + REPLACE_ROUNDF=0; AC_SUBST([REPLACE_ROUNDF]) + REPLACE_ROUNDL=0; AC_SUBST([REPLACE_ROUNDL]) + REPLACE_SIGNBIT=0; AC_SUBST([REPLACE_SIGNBIT]) + REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) + REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) + REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) + REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) + REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) + REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) + REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) + REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) + REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) + REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) ]) # gl_LONG_DOUBLE_VS_DOUBLE diff --git a/gnulib-m4/mbchar.m4 b/gnulib-m4/mbchar.m4 index 2ecb4d41..22673922 100644 --- a/gnulib-m4/mbchar.m4 +++ b/gnulib-m4/mbchar.m4 @@ -1,5 +1,5 @@ # mbchar.m4 serial 9 -dnl Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/mbiter.m4 b/gnulib-m4/mbiter.m4 index 8ffa6f44..7815edb0 100644 --- a/gnulib-m4/mbiter.m4 +++ b/gnulib-m4/mbiter.m4 @@ -1,5 +1,5 @@ # mbiter.m4 serial 7 -dnl Copyright (C) 2005, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/mbrtowc.m4 b/gnulib-m4/mbrtowc.m4 index f789875e..ec8716b5 100644 --- a/gnulib-m4/mbrtowc.m4 +++ b/gnulib-m4/mbrtowc.m4 @@ -1,5 +1,5 @@ -# mbrtowc.m4 serial 30 -*- coding: utf-8 -*- -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2018 Free Software Foundation, +# mbrtowc.m4 serial 38 -*- coding: utf-8 -*- +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2022 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -8,6 +8,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_MBRTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([gl_PTHREADLIB]) + AC_CHECK_HEADERS_ONCE([threads.h]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN @@ -16,15 +18,8 @@ AC_DEFUN([gl_FUNC_MBRTOWC], if test $ac_cv_func_mbrtowc = no; then HAVE_MBRTOWC=0 AC_CHECK_DECLS([mbrtowc],,, [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -]]) + #include <wchar.h> + ]]) if test $ac_cv_have_decl_mbrtowc = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbrtowc() although dnl it does not have the function. Avoid a collision with gnulib's @@ -39,6 +34,7 @@ AC_DEFUN([gl_FUNC_MBRTOWC], gl_MBRTOWC_NULL_ARG2 gl_MBRTOWC_RETVAL gl_MBRTOWC_NUL_RETVAL + gl_MBRTOWC_STORES_INCOMPLETE gl_MBRTOWC_EMPTY_INPUT gl_MBRTOWC_C_LOCALE case "$gl_cv_func_mbrtowc_null_arg1" in @@ -69,6 +65,13 @@ AC_DEFUN([gl_FUNC_MBRTOWC], REPLACE_MBRTOWC=1 ;; esac + case "$gl_cv_func_mbrtowc_stores_incomplete" in + *no) ;; + *) AC_DEFINE([MBRTOWC_STORES_INCOMPLETE_BUG], [1], + [Define if the mbrtowc function stores a wide character when reporting incomplete input.]) + REPLACE_MBRTOWC=1 + ;; + esac case "$gl_cv_func_mbrtowc_empty_input" in *yes) ;; *) AC_DEFINE([MBRTOWC_EMPTY_INPUT_BUG], [1], @@ -77,15 +80,32 @@ AC_DEFUN([gl_FUNC_MBRTOWC], REPLACE_MBRTOWC=1 ;; esac - case $gl_cv_C_locale_sans_EILSEQ in + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; - *) AC_DEFINE([C_LOCALE_MAYBE_EILSEQ], [1], - [Define to 1 if the C locale may have encoding errors.]) + *) AC_DEFINE([MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ], [1], + [Define if the mbrtowc function may signal encoding errors in the C locale.]) REPLACE_MBRTOWC=1 ;; esac fi fi + if test $REPLACE_MBSTATE_T = 1; then + case "$host_os" in + mingw*) LIB_MBRTOWC= ;; + *) + gl_WEAK_SYMBOLS + case "$gl_cv_have_weak" in + *yes) LIB_MBRTOWC= ;; + *) LIB_MBRTOWC="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_MBRTOWC= + fi + dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX + dnl with gcc or xlc, and empty otherwise. + AC_SUBST([LIB_MBRTOWC]) ]) dnl Test whether mbsinit() and mbrtowc() need to be overridden in a way that @@ -97,11 +117,19 @@ dnl avoid inconsistencies. AC_DEFUN([gl_MBSTATE_T_BROKEN], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) AC_CHECK_FUNCS_ONCE([mbsinit]) AC_CHECK_FUNCS_ONCE([mbrtowc]) - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + dnl On native Windows, we know exactly how mbsinit() behaves and don't need + dnl to override it, even if - like on MSVC - mbsinit() is only defined as + dnl an inline function, not as a global function. + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then gl_MBRTOWC_INCOMPLETE_STATE gl_MBRTOWC_SANITYCHECK REPLACE_MBSTATE_T=0 @@ -126,6 +154,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], [gl_cv_func_mbrtowc_incomplete_state], @@ -145,13 +174,6 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -171,6 +193,32 @@ int main () [gl_cv_func_mbrtowc_incomplete_state=yes], [gl_cv_func_mbrtowc_incomplete_state=no], [:]) + else + if test $LOCALE_FR_UTF8 != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <string.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +}]])], + [gl_cv_func_mbrtowc_incomplete_state=yes], + [gl_cv_func_mbrtowc_incomplete_state=no], + [:]) + fi fi ]) ]) @@ -202,13 +250,6 @@ changequote([,])dnl #include <locale.h> #include <stdlib.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -262,13 +303,6 @@ changequote([,])dnl #include <locale.h> #include <stdlib.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -331,13 +365,6 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -393,13 +420,6 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -521,13 +541,6 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> int main () { @@ -550,6 +563,112 @@ int main () ]) ]) +dnl Test whether mbrtowc stores a wide character when reporting incomplete +dnl input. + +AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtowc stores incomplete characters], + [gl_cv_func_mbrtowc_stores_incomplete], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; + *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; + esac +changequote([,])dnl + case "$host_os" in + mingw*) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <string.h> +#include <wchar.h> +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "French_France.65001") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 1; + } + if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 2; + } + if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 4; + } + if (setlocale (LC_ALL, "Chinese_China.936") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 8; + } + return result; +}]])], + [gl_cv_func_mbrtowc_stores_incomplete=no], + [gl_cv_func_mbrtowc_stores_incomplete=yes], + [:]) + ;; + *) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + if test $LOCALE_FR_UTF8 != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +#include <string.h> +#include <wchar.h> +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + return 1; + } + return 0; +}]])], + [gl_cv_func_mbrtowc_stores_incomplete=no], + [gl_cv_func_mbrtowc_stores_incomplete=yes], + [:]) + fi + ;; + esac + ]) +]) + dnl Test whether mbrtowc returns the correct value on empty input. AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], @@ -595,11 +714,11 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether the C locale is free of encoding errors], - [gl_cv_C_locale_sans_EILSEQ], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], [ dnl Initial guess, used when cross-compiling or when no suitable locale dnl is present. - gl_cv_C_locale_sans_EILSEQ="guessing no" + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" AC_RUN_IFELSE( [AC_LANG_PROGRAM( @@ -622,21 +741,28 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], } return 0; ]])], - [gl_cv_C_locale_sans_EILSEQ=yes], - [gl_cv_C_locale_sans_EILSEQ=no], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], [case "$host_os" in # Guess yes on native Windows. - mingw*) gl_cv_C_locale_sans_EILSEQ="guessing yes" ;; + mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac ]) ]) ]) -# Prerequisites of lib/mbrtowc.c. +# Prerequisites of lib/mbrtowc.c and lib/lc-charset-dispatch.c. AC_DEFUN([gl_PREREQ_MBRTOWC], [ + AC_REQUIRE([AC_C_INLINE]) : ]) +# Prerequisites of lib/mbtowc-lock.c. +AC_DEFUN([gl_PREREQ_MBTOWC_LOCK], +[ + gl_VISIBILITY +]) + dnl From Paul Eggert @@ -649,14 +775,7 @@ AC_DEFUN([AC_FUNC_MBRTOWC], [gl_cv_func_mbrtowc], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be - included before <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> - must be included before <wchar.h>. */ - #include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h>]], + [[#include <wchar.h>]], [[wchar_t wc; char const s[] = ""; size_t n = 1; diff --git a/gnulib-m4/mbsinit.m4 b/gnulib-m4/mbsinit.m4 index 5cba3df0..ebd2d4ff 100644 --- a/gnulib-m4/mbsinit.m4 +++ b/gnulib-m4/mbsinit.m4 @@ -1,5 +1,5 @@ -# mbsinit.m4 serial 8 -dnl Copyright (C) 2008, 2010-2018 Free Software Foundation, Inc. +# mbsinit.m4 serial 9 +dnl Copyright (C) 2008, 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -16,15 +16,8 @@ AC_DEFUN([gl_FUNC_MBSINIT], if test $ac_cv_func_mbsinit = no; then HAVE_MBSINIT=0 AC_CHECK_DECLS([mbsinit],,, [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -]]) + #include <wchar.h> + ]]) if test $ac_cv_have_decl_mbsinit = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares mbsinit() although dnl it does not have the function. Avoid a collision with gnulib's diff --git a/gnulib-m4/mbstate_t.m4 b/gnulib-m4/mbstate_t.m4 index 004aa0d1..a6eba1bc 100644 --- a/gnulib-m4/mbstate_t.m4 +++ b/gnulib-m4/mbstate_t.m4 @@ -1,5 +1,5 @@ -# mbstate_t.m4 serial 13 -dnl Copyright (C) 2000-2002, 2008-2018 Free Software Foundation, Inc. +# mbstate_t.m4 serial 14 +dnl Copyright (C) 2000-2002, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -20,14 +20,7 @@ AC_DEFUN([AC_TYPE_MBSTATE_T], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [AC_INCLUDES_DEFAULT[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h>]], + #include <wchar.h>]], [[mbstate_t x; return sizeof x;]])], [ac_cv_type_mbstate_t=yes], [ac_cv_type_mbstate_t=no])]) diff --git a/gnulib-m4/mbtowc.m4 b/gnulib-m4/mbtowc.m4 index ecac6a26..2827e833 100644 --- a/gnulib-m4/mbtowc.m4 +++ b/gnulib-m4/mbtowc.m4 @@ -1,5 +1,5 @@ -# mbtowc.m4 serial 2 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# mbtowc.m4 serial 3 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -8,8 +8,13 @@ AC_DEFUN([gl_FUNC_MBTOWC], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - if false; then - REPLACE_MBTOWC=1 + AC_CHECK_FUNCS([mbtowc]) + if test $ac_cv_func_mbtowc = no; then + HAVE_MBTOWC=0 + else + if false; then + REPLACE_MBTOWC=1 + fi fi ]) diff --git a/gnulib-m4/memchr.m4 b/gnulib-m4/memchr.m4 index 83c65c11..c7489d87 100644 --- a/gnulib-m4/memchr.m4 +++ b/gnulib-m4/memchr.m4 @@ -1,5 +1,5 @@ -# memchr.m4 serial 13 -dnl Copyright (C) 2002-2004, 2009-2018 Free Software Foundation, Inc. +# memchr.m4 serial 18 +dnl Copyright (C) 2002-2004, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,25 +13,18 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], AC_CHECK_HEADERS_ONCE([sys/mman.h]) AC_CHECK_FUNCS_ONCE([mprotect]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) - m4_ifdef([gl_FUNC_MEMCHR_OBSOLETE], [ - dnl These days, we assume memchr is present. But if support for old - dnl platforms is desired: - AC_CHECK_FUNCS_ONCE([memchr]) - if test $ac_cv_func_memchr = no; then - HAVE_MEMCHR=0 - fi - ]) - if test $HAVE_MEMCHR = 1; then - # Detect platform-specific bugs in some versions of glibc: - # memchr should not dereference anything with length 0 - # https://bugzilla.redhat.com/show_bug.cgi?id=499689 - # memchr should not dereference overestimated length after a match - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 - # Assume that memchr works on platforms that lack mprotect. - AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + # Detect platform-specific bugs in some versions of glibc: + # memchr should not dereference anything with length 0 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 + # memchr should not dereference overestimated length after a match + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. + # Assume that memchr works on platforms that lack mprotect. + AC_CACHE_CHECK([whether memchr works], [gl_cv_func_memchr_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> #if HAVE_SYS_MMAN_H # include <fcntl.h> @@ -66,6 +59,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], #endif if (fence) { + /* Test against bugs on glibc systems. */ if (memchr (fence, 0, 0)) result |= 1; strcpy (fence - 9, "12345678"); @@ -73,24 +67,37 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], result |= 2; if (memchr (fence - 1, 0, 3) != fence - 1) result |= 4; + /* Test against bug on AIX 7.2. */ + if (memchr (fence - 4, '6', 16) != fence - 4) + result |= 8; } + /* Test against bug on Android 4.3. */ + { + char input[3]; + input[0] = 'a'; + input[1] = 'b'; + input[2] = 'c'; + if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) + result |= 16; + } return result; ]])], - [gl_cv_func_memchr_works=yes], - [gl_cv_func_memchr_works=no], - [case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_memchr_works="guessing yes" ;; - # Be pessimistic for now. - *) gl_cv_func_memchr_works="guessing no" ;; - esac - ]) - ]) - case "$gl_cv_func_memchr_works" in - *yes) ;; - *) REPLACE_MEMCHR=1 ;; - esac - fi + [gl_cv_func_memchr_works=yes], + [gl_cv_func_memchr_works=no], + [case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac ]) # Prerequisites of lib/memchr.c. diff --git a/gnulib-m4/minmax.m4 b/gnulib-m4/minmax.m4 index 5e885087..b9767397 100644 --- a/gnulib-m4/minmax.m4 +++ b/gnulib-m4/minmax.m4 @@ -1,5 +1,5 @@ # minmax.m4 serial 4 -dnl Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/mmap-anon.m4 b/gnulib-m4/mmap-anon.m4 index 55fea82b..a4580ff9 100644 --- a/gnulib-m4/mmap-anon.m4 +++ b/gnulib-m4/mmap-anon.m4 @@ -1,5 +1,5 @@ -# mmap-anon.m4 serial 10 -dnl Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc. +# mmap-anon.m4 serial 12 +dnl Copyright (C) 2005, 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,11 +9,11 @@ dnl with or without modifications, as long as this notice is preserved. # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS # and MAP_ANON exist and have the same value. # - On HP-UX, only MAP_ANONYMOUS exists. -# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists. +# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be # used. -AC_DEFUN([gl_FUNC_MMAP_ANON], +AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], [ dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) diff --git a/gnulib-m4/mode_t.m4 b/gnulib-m4/mode_t.m4 new file mode 100644 index 00000000..e08d27a7 --- /dev/null +++ b/gnulib-m4/mode_t.m4 @@ -0,0 +1,26 @@ +# mode_t.m4 serial 2 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and +# include <sys/types.h>. + +# Define PROMOTED_MODE_T to the type that is the result of "default argument +# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. +AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], +[ + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ + dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', + dnl and to itself otherwise. This assumption is not guaranteed by the ISO C + dnl standard, but we don't know of any real-world counterexamples. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], + [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], + [gl_cv_promoted_mode_t='int'], + [gl_cv_promoted_mode_t='mode_t']) + ]) + AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], + [Define to the type that is the result of default argument promotions of type mode_t.]) +]) diff --git a/gnulib-m4/msvc-inval.m4 b/gnulib-m4/msvc-inval.m4 index 55baeecc..b32cf6eb 100644 --- a/gnulib-m4/msvc-inval.m4 +++ b/gnulib-m4/msvc-inval.m4 @@ -1,5 +1,5 @@ # msvc-inval.m4 serial 1 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/msvc-nothrow.m4 b/gnulib-m4/msvc-nothrow.m4 index 74ae4277..16ceb1f1 100644 --- a/gnulib-m4/msvc-nothrow.m4 +++ b/gnulib-m4/msvc-nothrow.m4 @@ -1,5 +1,5 @@ # msvc-nothrow.m4 serial 1 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/multiarch.m4 b/gnulib-m4/multiarch.m4 index 38a11cc1..5d942765 100644 --- a/gnulib-m4/multiarch.m4 +++ b/gnulib-m4/multiarch.m4 @@ -1,5 +1,5 @@ -# multiarch.m4 serial 7 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +# multiarch.m4 serial 9 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -21,37 +21,40 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_MULTIARCH], [ dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. - gl_cv_c_multiarch=no - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - ]])], - [ - dnl Check for potential -arch flags. It is not universal unless - dnl there are at least two -arch flags with different values. - arch= - prev= - for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if test -n "$prev"; then - case $word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$arch" || test "$arch" = "$word"; then - arch="$word" - else - gl_cv_c_multiarch=yes - fi - ;; - esac - prev= - else - if test "x$word" = "x-arch"; then - prev=arch - fi - fi - done + AC_CACHE_CHECK([whether the compiler produces multi-arch binaries], + [gl_cv_c_multiarch], + [gl_cv_c_multiarch=no + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + ]])], + [ + dnl Check for potential -arch flags. It is not universal unless + dnl there are at least two -arch flags with different values. + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64 | arm | arm64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done + ]) ]) if test $gl_cv_c_multiarch = yes; then APPLE_UNIVERSAL_BUILD=1 diff --git a/gnulib-m4/musl.m4 b/gnulib-m4/musl.m4 new file mode 100644 index 00000000..111f75d3 --- /dev/null +++ b/gnulib-m4/musl.m4 @@ -0,0 +1,18 @@ +# musl.m4 serial 3 +dnl Copyright (C) 2019-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Test for musl libc, despite the musl libc authors don't like it +# <https://wiki.musl-libc.org/faq.html> +# <https://lists.gnu.org/archive/html/bug-gnulib/2018-02/msg00079.html>. +# From Bruno Haible. + +AC_DEFUN_ONCE([gl_MUSL_LIBC], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + *-musl*) AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) ;; + esac +]) diff --git a/gnulib-m4/nanosleep.m4 b/gnulib-m4/nanosleep.m4 new file mode 100644 index 00000000..6a51f28e --- /dev/null +++ b/gnulib-m4/nanosleep.m4 @@ -0,0 +1,161 @@ +# serial 40 + +dnl From Jim Meyering. +dnl Check for the nanosleep function. +dnl If not found, use the supplied replacement. +dnl + +# Copyright (C) 1999-2001, 2003-2022 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_NANOSLEEP], +[ + AC_REQUIRE([gl_TIME_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc and Solaris <time.h> to declare nanosleep. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_REQUIRE([gl_FUNC_SELECT]) + + AC_CHECK_DECLS_ONCE([alarm]) + + nanosleep_save_libs=$LIBS + + # Solaris 2.5.1 needs -lposix4 to get the nanosleep function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + LIB_NANOSLEEP= + AC_SUBST([LIB_NANOSLEEP]) + AC_SEARCH_LIBS([nanosleep], [rt posix4], + [test "$ac_cv_search_nanosleep" = "none required" || + LIB_NANOSLEEP=$ac_cv_search_nanosleep]) + if test "x$ac_cv_search_nanosleep" != xno; then + dnl The system has a nanosleep function. + + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 1; then + # A universal build on Apple Mac OS X platforms. + # The test result would be 'no (mishandles large arguments)' in 64-bit + # mode but 'yes' in 32-bit mode. But we need a configuration result that + # is valid in both modes. + gl_cv_func_nanosleep='no (mishandles large arguments)' + fi + + AC_CACHE_CHECK([for working nanosleep], + [gl_cv_func_nanosleep], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include <errno.h> + #include <limits.h> + #include <signal.h> + #if HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <time.h> + #include <unistd.h> + #define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + #define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) + + #if HAVE_DECL_ALARM + static void + check_for_SIGALRM (int sig) + { + if (sig != SIGALRM) + _exit (1); + } + #endif + + int + main () + { + static struct timespec ts_sleep; + static struct timespec ts_remaining; + /* Test for major problems first. */ + if (! nanosleep) + return 2; + ts_sleep.tv_sec = 0; + ts_sleep.tv_nsec = 1; + #if HAVE_DECL_ALARM + { + static struct sigaction act; + act.sa_handler = check_for_SIGALRM; + sigemptyset (&act.sa_mask); + sigaction (SIGALRM, &act, NULL); + alarm (1); + if (nanosleep (&ts_sleep, NULL) != 0) + return 3; + /* Test for a minor problem: the handling of large arguments. */ + ts_sleep.tv_sec = TYPE_MAXIMUM (time_t); + ts_sleep.tv_nsec = 999999999; + alarm (1); + if (nanosleep (&ts_sleep, &ts_remaining) != -1) + return 4; + if (errno != EINTR) + return 5; + if (ts_remaining.tv_sec <= TYPE_MAXIMUM (time_t) - 10) + return 6; + } + #else /* A simpler test for native Windows. */ + if (nanosleep (&ts_sleep, &ts_remaining) < 0) + return 3; + #endif + return 0; + }]])], + [gl_cv_func_nanosleep=yes], + [case $? in dnl ( + 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( + *) gl_cv_func_nanosleep=no;; + esac], + [case "$host_os" in dnl (( + linux*) # Guess it halfway works when the kernel is Linux. + gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;; + mingw*) # Guess no on native Windows. + gl_cv_func_nanosleep='guessing no' ;; + *) # If we don't know, obey --enable-cross-guesses. + gl_cv_func_nanosleep="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_nanosleep" in + *yes) + REPLACE_NANOSLEEP=0 + ;; + *) + REPLACE_NANOSLEEP=1 + case "$gl_cv_func_nanosleep" in + *"mishandles large arguments"*) + AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], [1], + [Define to 1 if nanosleep mishandles large arguments.]) + ;; + *) + # The replacement uses select(). Add $LIBSOCKET to $LIB_NANOSLEEP. + for ac_lib in $LIBSOCKET; do + case " $LIB_NANOSLEEP " in + *" $ac_lib "*) ;; + *) LIB_NANOSLEEP="$LIB_NANOSLEEP $ac_lib";; + esac + done + ;; + esac + ;; + esac + else + HAVE_NANOSLEEP=0 + fi + LIBS=$nanosleep_save_libs +]) + +# Prerequisites of lib/nanosleep.c. +AC_DEFUN([gl_PREREQ_NANOSLEEP], +[ + AC_CHECK_HEADERS_ONCE([sys/select.h]) + gl_PREREQ_SIG_HANDLER_H +]) diff --git a/gnulib-m4/netinet_in_h.m4 b/gnulib-m4/netinet_in_h.m4 new file mode 100644 index 00000000..de26fe85 --- /dev/null +++ b/gnulib-m4/netinet_in_h.m4 @@ -0,0 +1,29 @@ +# netinet_in_h.m4 serial 6 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_HEADER_NETINET_IN], +[ + AC_CACHE_CHECK([whether <netinet/in.h> is self-contained], + [gl_cv_header_netinet_in_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>]], [[]])], + [gl_cv_header_netinet_in_h_selfcontained=yes], + [gl_cv_header_netinet_in_h_selfcontained=no]) + ]) + if test $gl_cv_header_netinet_in_h_selfcontained = yes; then + GL_GENERATE_NETINET_IN_H=false + else + GL_GENERATE_NETINET_IN_H=true + AC_CHECK_HEADERS([netinet/in.h]) + gl_CHECK_NEXT_HEADERS([netinet/in.h]) + if test $ac_cv_header_netinet_in_h = yes; then + HAVE_NETINET_IN_H=1 + else + HAVE_NETINET_IN_H=0 + fi + AC_SUBST([HAVE_NETINET_IN_H]) + fi +]) diff --git a/gnulib-m4/nocrash.m4 b/gnulib-m4/nocrash.m4 index 49140074..91f00c1b 100644 --- a/gnulib-m4/nocrash.m4 +++ b/gnulib-m4/nocrash.m4 @@ -1,5 +1,5 @@ # nocrash.m4 serial 5 -dnl Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -53,7 +53,7 @@ nocrash_init (void) /* Allocate a port on which the thread shall listen for exceptions. */ if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) == KERN_SUCCESS) { - /* See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ if (mach_port_insert_right (self, our_exception_port, our_exception_port, MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS) { @@ -72,7 +72,7 @@ nocrash_init (void) for a particular thread. This has the effect that when our exception port gets the message, the thread specific exception port has already been asked, and we don't need to bother about it. - See http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ task_set_exception_ports (self, mask, our_exception_port, EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); } diff --git a/gnulib-m4/off_t.m4 b/gnulib-m4/off_t.m4 index f4d57875..0890adaf 100644 --- a/gnulib-m4/off_t.m4 +++ b/gnulib-m4/off_t.m4 @@ -1,5 +1,5 @@ # off_t.m4 serial 1 -dnl Copyright (C) 2012-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/open-cloexec.m4 b/gnulib-m4/open-cloexec.m4 new file mode 100644 index 00000000..16cd5ec4 --- /dev/null +++ b/gnulib-m4/open-cloexec.m4 @@ -0,0 +1,21 @@ +# Test whether O_CLOEXEC is defined. + +dnl Copyright 2017-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PREPROC_O_CLOEXEC], +[ + AC_CACHE_CHECK([for O_CLOEXEC], + [gl_cv_macro_O_CLOEXEC], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <fcntl.h> + #ifndef O_CLOEXEC + choke me; + #endif + ]], + [[return O_CLOEXEC;]])], + [gl_cv_macro_O_CLOEXEC=yes], + [gl_cv_macro_O_CLOEXEC=no])]) +]) diff --git a/gnulib-m4/open-slash.m4 b/gnulib-m4/open-slash.m4 new file mode 100644 index 00000000..4fbf491a --- /dev/null +++ b/gnulib-m4/open-slash.m4 @@ -0,0 +1,60 @@ +# open-slash.m4 serial 2 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Tests whether open() and creat() recognize a trailing slash. +dnl Sets gl_cv_func_open_slash. +AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) + AC_CACHE_CHECK([whether open recognizes a trailing slash], + [gl_cv_func_open_slash], + [# Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <fcntl.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +]GL_MDA_DEFINES[ +int main () +{ + int result = 0; +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) + result |= 1; +#endif + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; + return result; +}]])], + [gl_cv_func_open_slash=yes], + [gl_cv_func_open_slash=no], + [ +changequote(,)dnl + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac +changequote([,])dnl + ]) + rm -f conftest.sl conftest.tmp conftest.lnk + ]) + case "$gl_cv_func_open_slash" in + *no) + AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], + [Define to 1 if open() fails to recognize a trailing slash.]) + ;; + esac +]) diff --git a/gnulib-m4/open.m4 b/gnulib-m4/open.m4 new file mode 100644 index 00000000..f82fd6ca --- /dev/null +++ b/gnulib-m4/open.m4 @@ -0,0 +1,56 @@ +# open.m4 serial 15 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_OPEN], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) + case "$host_os" in + mingw* | pw*) + REPLACE_OPEN=1 + ;; + *) + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi + gl_OPEN_TRAILING_SLASH_BUG + case "$gl_cv_func_open_slash" in + *no) + REPLACE_OPEN=1 + ;; + esac + ;; + esac + dnl Replace open() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_OPEN = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_OPEN=1 + fi + fi + ]) + dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. + m4_ifdef([gl_NONBLOCKING_IO], [ + if test $REPLACE_OPEN = 0; then + gl_NONBLOCKING_IO + if test $gl_cv_have_open_O_NONBLOCK != yes; then + REPLACE_OPEN=1 + fi + fi + ]) +]) + +# Prerequisites of lib/open.c. +AC_DEFUN([gl_PREREQ_OPEN], +[ + AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) + : +]) diff --git a/gnulib-m4/pathmax.m4 b/gnulib-m4/pathmax.m4 new file mode 100644 index 00000000..44add990 --- /dev/null +++ b/gnulib-m4/pathmax.m4 @@ -0,0 +1,42 @@ +# pathmax.m4 serial 11 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2022 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) + +# Expands to a piece of C program that defines PATH_MAX in the same way as +# "pathmax.h" will do. +AC_DEFUN([gl_PATHMAX_SNIPPET], [[ +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +#include <limits.h> +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include <sys/param.h> +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +]]) + +# Prerequisites of gl_PATHMAX_SNIPPET. +AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) +]) diff --git a/gnulib-m4/perror.m4 b/gnulib-m4/perror.m4 new file mode 100644 index 00000000..02d44ca2 --- /dev/null +++ b/gnulib-m4/perror.m4 @@ -0,0 +1,71 @@ +# perror.m4 serial 10 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_PERROR], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([gl_HEADER_ERRNO_H]) + AC_REQUIRE([gl_FUNC_STRERROR_R]) + AC_REQUIRE([gl_FUNC_STRERROR_0]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl We intentionally do not check for the broader REPLACE_STRERROR_R, + dnl since on glibc systems, strerror_r is replaced only for signature + dnl issues, and perror is just fine. Rather, we only want to + dnl replace perror if strerror_r was replaced for a content fix. + if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" != false:0; then + dnl The system's perror() cannot know about the new errno values we add + dnl to <errno.h>, or any fix for strerror(0). Replace it. + REPLACE_PERROR=1 + fi + case ${gl_cv_func_strerror_r_works-unset} in + unset|*yes) + AC_CACHE_CHECK([whether perror matches strerror], + [gl_cv_func_perror_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <errno.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + ]], + [[char *str = strerror (-1); + if (!getenv("CONFTEST_OUTPUT")) return 0; + if (!str) str = ""; + puts (str); + errno = -1; + perror (""); + return 0; + ]])], + [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2 \ + && cmp conftest.txt1 conftest.txt2 >/dev/null; then + gl_cv_func_perror_works=yes + else + gl_cv_func_perror_works=no + fi + rm -rf conftest.txt1 conftest.txt2], + [gl_cv_func_perror_works=no], + [case "$host_os" in + # Guess yes on musl systems. + *-musl*) gl_cv_func_perror_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_perror_works="guessing yes" ;; + # Otherwise obey --enable-cross-guesses. + *) gl_cv_func_perror_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_perror_works" in + *yes) ;; + *) REPLACE_PERROR=1 ;; + esac + ;; + *) + dnl The system's perror() probably inherits the bugs in the + dnl system's strerror_r(). Replace it. + REPLACE_PERROR=1 + ;; + esac +]) diff --git a/gnulib-m4/pipe.m4 b/gnulib-m4/pipe.m4 new file mode 100644 index 00000000..62871c6d --- /dev/null +++ b/gnulib-m4/pipe.m4 @@ -0,0 +1,15 @@ +# pipe.m4 serial 2 +dnl Copyright (C) 2010-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_PIPE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + + AC_CHECK_FUNCS_ONCE([pipe]) + if test $ac_cv_func_pipe != yes; then + HAVE_PIPE=0 + fi +]) diff --git a/gnulib-m4/printf-frexp.m4 b/gnulib-m4/printf-frexp.m4 index e7308255..0628b5ab 100644 --- a/gnulib-m4/printf-frexp.m4 +++ b/gnulib-m4/printf-frexp.m4 @@ -1,5 +1,5 @@ # printf-frexp.m4 serial 5 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/printf-frexpl.m4 b/gnulib-m4/printf-frexpl.m4 index cb8ac452..137c8718 100644 --- a/gnulib-m4/printf-frexpl.m4 +++ b/gnulib-m4/printf-frexpl.m4 @@ -1,5 +1,5 @@ # printf-frexpl.m4 serial 10 -dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/printf.m4 b/gnulib-m4/printf.m4 index 82f48bfd..667452e3 100644 --- a/gnulib-m4/printf.m4 +++ b/gnulib-m4/printf.m4 @@ -1,5 +1,5 @@ -# printf.m4 serial 58 -dnl Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc. +# printf.m4 serial 73 +dnl Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -62,9 +62,12 @@ int main () changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + midnightbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; @@ -79,6 +82,8 @@ changequote(,)dnl netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_sizes_c99="guessing no";; netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ @@ -89,8 +94,8 @@ changequote([,])dnl [gl_cv_func_printf_sizes_c99="guessing yes"], [gl_cv_func_printf_sizes_c99="guessing no"]) ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_sizes_c99="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; esac ]) ]) @@ -132,17 +137,20 @@ int main () [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], [case "$host_os" in - beos*) gl_cv_func_printf_long_double="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + # Guess no on BeOS. + beos*) gl_cv_func_printf_long_double="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_long_double="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif - ], - [gl_cv_func_printf_long_double="guessing yes"], - [gl_cv_func_printf_long_double="guessing no"]) - ;; - *) gl_cv_func_printf_long_double="guessing yes";; + ], + [gl_cv_func_printf_long_double="guessing yes"], + [gl_cv_func_printf_long_double="guessing no"]) + ;; + *) gl_cv_func_printf_long_double="guessing yes";; esac ]) ]) @@ -235,9 +243,12 @@ int main () changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + midnightbsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; darwin*) gl_cv_func_printf_infinite="guessing yes";; @@ -248,8 +259,13 @@ changequote(,)dnl netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) gl_cv_func_printf_infinite="guessing no";; netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; + openbsd*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_printf_infinite="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ @@ -260,8 +276,8 @@ changequote([,])dnl [gl_cv_func_printf_infinite="guessing yes"], [gl_cv_func_printf_infinite="guessing no"]) ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; esac ]) ]) @@ -450,12 +466,20 @@ int main () changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + midnightbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on HP-UX >= 11. hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; + openbsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ @@ -466,8 +490,8 @@ changequote([,])dnl [gl_cv_func_printf_infinite_long_double="guessing yes"], [gl_cv_func_printf_infinite_long_double="guessing no"]) ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_infinite_long_double="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; esac ;; esac @@ -513,7 +537,7 @@ int main () && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) result |= 2; - /* This catches a FreeBSD 6.1 bug: it doesn't round. */ + /* This catches a FreeBSD 13.0 bug: it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 @@ -566,10 +590,14 @@ int main () [gl_cv_func_printf_directive_a="guessing yes"], [gl_cv_func_printf_directive_a="guessing no"]) ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_a="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_a="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_printf_directive_a="guessing no";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_a="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; esac ]) ]) @@ -614,15 +642,23 @@ int main () changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + midnightbsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; + openbsd*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on Solaris >= 2.10. solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; solaris*) gl_cv_func_printf_directive_f="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_f="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ @@ -633,8 +669,8 @@ changequote([,])dnl [gl_cv_func_printf_directive_f="guessing yes"], [gl_cv_func_printf_directive_f="guessing no"]) ;; - # If we don't know, assume the worst. - *) gl_cv_func_printf_directive_f="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; esac ]) ]) @@ -657,7 +693,10 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], #include <stdlib.h> #include <string.h> #ifdef _MSC_VER -/* See page about "Parameter Validation" on msdn.microsoft.com. */ +#include <inttypes.h> +/* See page about "Parameter Validation" on msdn.microsoft.com. + <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> + <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-invalid-parameter-handler-set-thread-local-invalid-parameter-handler> */ static void cdecl invalid_parameter_handler (const wchar_t *expression, const wchar_t *function, @@ -688,9 +727,21 @@ int main () [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], [case "$host_os" in - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_n="guessing no";; - *) gl_cv_func_printf_directive_n="guessing yes";; + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if _FORTIFY_SOURCE >= 2 + error fail + #endif + ]])], + [gl_cv_func_printf_directive_n="guessing yes"], + [gl_cv_func_printf_directive_n="guessing no"]) + ;; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_n="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; esac ]) ]) @@ -712,13 +763,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> #include <stdio.h> -#include <time.h> #include <wchar.h> #include <string.h> int main () @@ -766,14 +811,18 @@ int main () [ changequote(,)dnl case "$host_os" in - openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_directive_ls="guessing yes";; - *) gl_cv_func_printf_directive_ls="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; + openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; + irix*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; + cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_directive_ls="guessing yes";; + *) gl_cv_func_printf_directive_ls="guessing yes";; esac changequote([,])dnl ]) @@ -810,11 +859,13 @@ int main () changequote(,)dnl case "$host_os" in netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; + gl_cv_func_printf_positions="guessing no";; + beos*) gl_cv_func_printf_positions="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_positions="guessing yes";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_positions="guessing no";; + *) gl_cv_func_printf_positions="guessing yes";; esac changequote([,])dnl ]) @@ -849,11 +900,13 @@ int main () [ changequote(,)dnl case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; esac changequote([,])dnl ]) @@ -890,14 +943,16 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on HP-UX 11. - hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess no on HP-UX 10 and older. - hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes otherwise. - *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; esac changequote([,])dnl ]) @@ -935,14 +990,18 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_flag_zero="guessing no";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_flag_zero="guessing no";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_flag_zero="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; esac changequote([,])dnl ]) @@ -995,10 +1054,12 @@ int main () changequote(,)dnl case "$host_os" in # Guess no only on Solaris, native Windows, and BeOS systems. - solaris*) gl_cv_func_printf_precision="guessing no" ;; - mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; + solaris*) gl_cv_func_printf_precision="guessing no" ;; + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; esac changequote([,])dnl ]) @@ -1020,9 +1081,8 @@ AC_DEFUN([gl_PRINTF_ENOMEM], gl_cv_func_printf_enomem="guessing no" if test "$cross_compiling" = no; then if test $APPLE_UNIVERSAL_BUILD = 0; then - AC_LANG_CONFTEST([AC_LANG_SOURCE([ + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ ]GL_NOCRASH[ -changequote(,)dnl #include <stdio.h> #include <sys/types.h> #include <sys/time.h> @@ -1067,8 +1127,7 @@ int main() ret = printf ("%.5000000f", 1.0); return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); } -changequote([,])dnl - ])]) + ]])]) if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then (./conftest 2>&AS_MESSAGE_LOG_FD result=$? @@ -1095,28 +1154,30 @@ changequote([,])dnl if test "$gl_cv_func_printf_enomem" = "guessing no"; then changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Solaris. - solaris*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on AIX. - aix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on HP-UX/hppa. - hpux*) case "$host_cpu" in - hppa*) gl_cv_func_printf_enomem="guessing yes";; - *) gl_cv_func_printf_enomem="guessing no";; - esac - ;; - # Guess yes on IRIX. - irix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on OSF/1. - osf*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Haiku. - haiku*) gl_cv_func_printf_enomem="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_printf_enomem="guessing no";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Solaris. + solaris*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on AIX. + aix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on HP-UX/hppa. + hpux*) case "$host_cpu" in + hppa*) gl_cv_func_printf_enomem="guessing yes";; + *) gl_cv_func_printf_enomem="guessing no";; + esac + ;; + # Guess yes on IRIX. + irix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on OSF/1. + osf*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Haiku. + haiku*) gl_cv_func_printf_enomem="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_enomem="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; esac changequote([,])dnl fi @@ -1135,7 +1196,7 @@ dnl Test whether the string produced by the snprintf function is always NUL dnl terminated. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_snprintf_truncation_c99. -AC_DEFUN([gl_SNPRINTF_TRUNCATION_C99], +AC_DEFUN_ONCE([gl_SNPRINTF_TRUNCATION_C99], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -1177,9 +1238,12 @@ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_truncation_c99="guessing no";; darwin*) gl_cv_func_snprintf_truncation_c99="guessing yes";; @@ -1208,10 +1272,12 @@ changequote(,)dnl netbsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess no on native Windows. mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_truncation_c99="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; esac changequote([,])dnl ]) @@ -1277,9 +1343,12 @@ int main () changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; @@ -1299,6 +1368,8 @@ changequote(,)dnl netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. mingw*) AC_EGREP_CPP([Known], [ @@ -1309,8 +1380,8 @@ changequote([,])dnl [gl_cv_func_snprintf_retval_c99="guessing yes"], [gl_cv_func_snprintf_retval_c99="guessing no"]) ;; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_retval_c99="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; esac ]) ]) @@ -1363,13 +1434,24 @@ int main () [gl_cv_func_snprintf_directive_n=yes], [gl_cv_func_snprintf_directive_n=no], [ -changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if _FORTIFY_SOURCE >= 2 + error fail + #endif + ]])], + [gl_cv_func_snprintf_directive_n="guessing yes"], + [gl_cv_func_snprintf_directive_n="guessing no"]) + ;; +changequote(,)dnl + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; + midnightbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_snprintf_directive_n="guessing no";; darwin*) gl_cv_func_snprintf_directive_n="guessing yes";; @@ -1391,12 +1473,14 @@ changequote(,)dnl netbsd*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; # Guess no on native Windows. mingw*) gl_cv_func_snprintf_directive_n="guessing no";; - # If we don't know, assume the worst. - *) gl_cv_func_snprintf_directive_n="guessing no";; - esac + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; changequote([,])dnl + esac ]) ]) ]) @@ -1440,9 +1524,11 @@ int main() [gl_cv_func_snprintf_size1=yes], [gl_cv_func_snprintf_size1=no], [case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; esac ]) ]) @@ -1517,9 +1603,12 @@ changequote(,)dnl case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on Mac OS X >= 10.3. darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; @@ -1540,10 +1629,12 @@ changequote(,)dnl netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on BeOS. beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; # Guess yes on native Windows. mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, assume the worst. - *) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; esac changequote([,])dnl ]) @@ -1599,13 +1690,17 @@ dnl dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . +dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . +dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . +dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . +dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . @@ -1620,11 +1715,13 @@ dnl HP-UX 10.20 # . # . # # . ? . . # # . . . dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # +dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . dnl Haiku . . . # # # . # . . . . . ? . . ? . . . dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . +dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . diff --git a/gnulib-m4/pthread-thread.m4 b/gnulib-m4/pthread-thread.m4 new file mode 100644 index 00000000..969628ea --- /dev/null +++ b/gnulib-m4/pthread-thread.m4 @@ -0,0 +1,69 @@ +# pthread-thread.m4 serial 2 +dnl Copyright (C) 2019-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PTHREAD_THREAD], +[ + AC_REQUIRE([gl_PTHREAD_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if { case "$host_os" in mingw*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_PTHREAD_CREATE=1 + REPLACE_PTHREAD_ATTR_INIT=1 + REPLACE_PTHREAD_ATTR_GETDETACHSTATE=1 + REPLACE_PTHREAD_ATTR_SETDETACHSTATE=1 + REPLACE_PTHREAD_ATTR_DESTROY=1 + REPLACE_PTHREAD_SELF=1 + REPLACE_PTHREAD_EQUAL=1 + REPLACE_PTHREAD_DETACH=1 + REPLACE_PTHREAD_JOIN=1 + REPLACE_PTHREAD_EXIT=1 + else + if test $HAVE_PTHREAD_H = 0; then + HAVE_PTHREAD_CREATE=0 + HAVE_PTHREAD_ATTR_INIT=0 + HAVE_PTHREAD_ATTR_GETDETACHSTATE=0 + HAVE_PTHREAD_ATTR_SETDETACHSTATE=0 + HAVE_PTHREAD_ATTR_DESTROY=0 + HAVE_PTHREAD_SELF=0 + HAVE_PTHREAD_EQUAL=0 + HAVE_PTHREAD_DETACH=0 + HAVE_PTHREAD_JOIN=0 + HAVE_PTHREAD_EXIT=0 + else + dnl On HP-UX 11.11, pthread_create() and pthread_attr_init() are only + dnl defined as inline functions. + AC_CACHE_CHECK([whether pthread_create exists as a global function], + [gl_cv_func_pthread_create], + [saved_LIBS="$LIBS" + LIBS="$LIBS $LIBPMULTITHREAD" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [[extern + #ifdef __cplusplus + "C" + #endif + int pthread_create (void); + int main () + { + return pthread_create (); + } + ]])], + [gl_cv_func_pthread_create=yes], + [gl_cv_func_pthread_create=no]) + LIBS="$saved_LIBS" + ]) + if test $gl_cv_func_pthread_create = no; then + REPLACE_PTHREAD_CREATE=1 + REPLACE_PTHREAD_ATTR_INIT=1 + AC_DEFINE([PTHREAD_CREATE_IS_INLINE], [1], + [Define if pthread_create is an inline function.]) + fi + fi + fi +]) diff --git a/gnulib-m4/pthread_h.m4 b/gnulib-m4/pthread_h.m4 new file mode 100644 index 00000000..4146aef3 --- /dev/null +++ b/gnulib-m4/pthread_h.m4 @@ -0,0 +1,283 @@ +# pthread_h.m4 serial 8 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_PTHREAD_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + + gl_CHECK_NEXT_HEADERS([pthread.h]) + if test $ac_cv_header_pthread_h = yes; then + HAVE_PTHREAD_H=1 + dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used, + dnl ignore the <pthread.h> from the mingw-w64 winpthreads library. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) + if { case "$host_os" in mingw*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + HAVE_PTHREAD_H=0 + fi + ]) + else + HAVE_PTHREAD_H=0 + fi + AC_SUBST([HAVE_PTHREAD_H]) + + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], + [AC_INCLUDES_DEFAULT[ + #if HAVE_PTHREAD_H + #include <pthread.h> + #endif]]) + if test $ac_cv_type_pthread_t != yes; then + HAVE_PTHREAD_T=0 + fi + if test $ac_cv_type_pthread_spinlock_t != yes; then + HAVE_PTHREAD_SPINLOCK_T=0 + fi + + dnl Constants may be defined as C preprocessor macros or as enum items. + + AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED], + [gl_cv_const_PTHREAD_CREATE_DETACHED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + int x = PTHREAD_CREATE_DETACHED; + ]], + [[]])], + [gl_cv_const_PTHREAD_CREATE_DETACHED=yes], + [gl_cv_const_PTHREAD_CREATE_DETACHED=no]) + ]) + if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then + HAVE_PTHREAD_CREATE_DETACHED=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + int x = PTHREAD_MUTEX_RECURSIVE; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then + HAVE_PTHREAD_MUTEX_RECURSIVE=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST], + [gl_cv_const_PTHREAD_MUTEX_ROBUST], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + int x = PTHREAD_MUTEX_ROBUST; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then + HAVE_PTHREAD_MUTEX_ROBUST=0 + fi + + AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED], + [gl_cv_const_PTHREAD_PROCESS_SHARED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + int x = PTHREAD_PROCESS_SHARED; + ]], + [[]])], + [gl_cv_const_PTHREAD_PROCESS_SHARED=yes], + [gl_cv_const_PTHREAD_PROCESS_SHARED=no]) + ]) + if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then + HAVE_PTHREAD_PROCESS_SHARED=0 + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include <pthread.h> + ]], [ + pthread_create pthread_attr_init pthread_attr_getdetachstate + pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal + pthread_detach pthread_join pthread_exit + pthread_once + pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype + pthread_mutexattr_settype pthread_mutexattr_getrobust + pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock + pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock + pthread_mutex_destroy + pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy + pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock + pthread_rwlock_trywrlock pthread_rwlock_timedrdlock + pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy + pthread_cond_init pthread_condattr_init pthread_condattr_destroy + pthread_cond_wait pthread_cond_timedwait pthread_cond_signal + pthread_cond_broadcast pthread_cond_destroy + pthread_key_create pthread_setspecific pthread_getspecific + pthread_key_delete + pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock + pthread_spin_destroy]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl For backward compatibility with gnulib versions <= 2019-07. + LIB_PTHREAD="$LIBPMULTITHREAD" + AC_SUBST([LIB_PTHREAD]) +]) + +# gl_PTHREAD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_PTHREAD_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) +]) + +AC_DEFUN([gl_PTHREAD_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) + HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) + HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED]) + HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE]) + HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST]) + HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED]) + HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE]) + HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT]) + HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE]) + HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE]) + HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY]) + HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF]) + HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL]) + HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH]) + HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN]) + HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT]) + HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE]) + HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT]) + HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT]) + HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE]) + HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE]) + HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST]) + HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST]) + HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY]) + HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK]) + HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK]) + HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK]) + HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK]) + HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY]) + HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT]) + HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT]) + HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY]) + HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK]) + HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK]) + HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK]) + HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK]) + HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY]) + HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT]) + HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT]) + HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY]) + HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT]) + HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT]) + HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL]) + HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST]) + HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY]) + HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE]) + HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC]) + HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC]) + HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE]) + HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT]) + HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK]) + HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK]) + HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK]) + HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY]) + REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE]) + REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT]) + REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY]) + REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF]) + REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL]) + REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH]) + REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN]) + REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT]) + REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE]) + REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT]) + REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT]) + REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY]) + REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK]) + REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK]) + REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK]) + REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK]) + REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY]) + REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY]) + REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK]) + REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK]) + REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY]) + REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT]) + REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT]) + REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY]) + REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT]) + REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT]) + REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL]) + REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST]) + REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY]) + REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE]) + REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC]) + REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC]) + REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE]) + REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT]) + REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK]) + REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK]) + REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK]) + REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY]) +]) diff --git a/gnulib-m4/pthread_rwlock_rdlock.m4 b/gnulib-m4/pthread_rwlock_rdlock.m4 index 9c1d5d01..8ad78392 100644 --- a/gnulib-m4/pthread_rwlock_rdlock.m4 +++ b/gnulib-m4/pthread_rwlock_rdlock.m4 @@ -1,5 +1,5 @@ -# pthread_rwlock_rdlock.m4 serial 1 -dnl Copyright (C) 2017-2018 Free Software Foundation, Inc. +# pthread_rwlock_rdlock.m4 serial 4 +dnl Copyright (C) 2017-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -23,15 +23,19 @@ dnl time, a phenomenon called "writer starvation". dnl Without such a guarantee, applications have a hard time avoiding writer dnl starvation. dnl -dnl POSIX:2008 makes this requirement only for implementations that support TPS +dnl POSIX:2017 makes this requirement only for implementations that support TPS dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO dnl and SCHED_RR, see -dnl http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html -dnl but test verifies the guarantee regardless of TPS and regardless of +dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html +dnl but this test verifies the guarantee regardless of TPS and regardless of dnl scheduling policy. +dnl Glibc does not provide this guarantee (and never will on Linux), see +dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 +dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [ AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], [gl_cv_pthread_rwlock_rdlock_prefer_writer], [save_LIBS="$LIBS" @@ -151,7 +155,25 @@ main () ]])], [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], - [gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes"]) + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + esac + ]) LIBS="$save_LIBS" ]) case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in diff --git a/gnulib-m4/pthread_sigmask.m4 b/gnulib-m4/pthread_sigmask.m4 index a33b433c..0aa8c53f 100644 --- a/gnulib-m4/pthread_sigmask.m4 +++ b/gnulib-m4/pthread_sigmask.m4 @@ -1,5 +1,5 @@ -# pthread_sigmask.m4 serial 16 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# pthread_sigmask.m4 serial 21 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -9,103 +9,97 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([pthread_sigmask]) + + dnl On MinGW pthread_sigmask is just a macro which always returns 0. + dnl It does not exist as a real function, which is required by POSIX. + AC_CACHE_CHECK([whether pthread_sigmask is a macro], + [gl_cv_func_pthread_sigmask_macro], + [AC_EGREP_CPP([headers_define_pthread_sigmask], [ +#include <pthread.h> +#include <signal.h> +#ifdef pthread_sigmask + headers_define_pthread_sigmask +#endif], + [gl_cv_func_pthread_sigmask_macro=yes], + [gl_cv_func_pthread_sigmask_macro=no]) + ]) + LIB_PTHREAD_SIGMASK= - dnl Test whether the gnulib module 'threadlib' is in use. - dnl Some packages like Emacs use --avoid=threadlib. - dnl Write the symbol in such a way that it does not cause 'aclocal' to pick - dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. - m4_ifdef([gl_][THREADLIB], [ - AC_REQUIRE([gl_][THREADLIB]) + if test $gl_cv_func_pthread_sigmask_macro = yes; then + dnl pthread_sigmask is a dummy macro. + HAVE_PTHREAD_SIGMASK=0 + dnl Make sure to '#undef pthread_sigmask' before defining it. + REPLACE_PTHREAD_SIGMASK=1 + else + dnl Test whether the gnulib module 'threadlib' is in use. + dnl Some packages like Emacs use --avoid=threadlib. + dnl Write the symbol in such a way that it does not cause 'aclocal' to pick + dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) - if test "$gl_threads_api" = posix; then - if test $ac_cv_func_pthread_sigmask = yes; then - dnl pthread_sigmask is available without -lpthread. - : - else - if test -n "$LIBMULTITHREAD"; then - AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD], - [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD], - [gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBMULTITHREAD" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <pthread.h> - #include <signal.h> - ]], - [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]]) - ], - [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes], - [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no]) - LIBS="$gl_save_LIBS" - ]) - if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then - AC_CACHE_CHECK([whether pthread_sigmask is only a macro], - [gl_cv_func_pthread_sigmask_is_macro], + if test "$gl_threads_api" = posix; then + if test $ac_cv_func_pthread_sigmask = yes; then + dnl pthread_sigmask is available without -lpthread. + : + else + if test -n "$LIBMULTITHREAD"; then + AC_CACHE_CHECK([for pthread_sigmask in $LIBMULTITHREAD], + [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD], [gl_save_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <pthread.h> #include <signal.h> - #undef pthread_sigmask ]], [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);]]) ], - [gl_cv_func_pthread_sigmask_is_macro=no], - [gl_cv_func_pthread_sigmask_is_macro=yes]) + [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes], + [gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no]) LIBS="$gl_save_LIBS" ]) - if test $gl_cv_func_pthread_sigmask_is_macro = yes; then - dnl On MinGW pthread_sigmask is just a macro which always returns 0. - dnl It does not exist as a real function, which is required by POSIX. - REPLACE_PTHREAD_SIGMASK=1 - gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no + if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then + dnl pthread_sigmask is available with -pthread or -lpthread. + LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" + else + dnl pthread_sigmask is not available at all. + HAVE_PTHREAD_SIGMASK=0 fi - fi - if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then - dnl pthread_sigmask is available with -pthread or -lpthread. - LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD" else dnl pthread_sigmask is not available at all. HAVE_PTHREAD_SIGMASK=0 fi + fi + else + dnl pthread_sigmask may exist but does not interoperate with the chosen + dnl multithreading facility. + if test $ac_cv_func_pthread_sigmask = yes; then + REPLACE_PTHREAD_SIGMASK=1 else - dnl pthread_sigmask is not available at all. HAVE_PTHREAD_SIGMASK=0 fi fi - else - dnl pthread_sigmask may exist but does not interoperate with the chosen - dnl multithreading facility. - dnl If "$gl_threads_api" = pth, we could use the function pth_sigmask, - dnl but it is equivalent to sigprocmask, so we choose to emulate - dnl pthread_sigmask with sigprocmask also in this case. This yields fewer - dnl link dependencies. + ], [ + dnl The module 'threadlib' is not in use, due to --avoid=threadlib being + dnl specified. + dnl The package either has prepared CPPFLAGS and LIBS for use of + dnl POSIX:2008 threads, or wants to build single-threaded programs. if test $ac_cv_func_pthread_sigmask = yes; then - REPLACE_PTHREAD_SIGMASK=1 + dnl pthread_sigmask exists and does not require extra libraries. + dnl Assume that it is declared. + : else + dnl pthread_sigmask either does not exist or needs extra libraries. HAVE_PTHREAD_SIGMASK=0 + dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask, + dnl so as to not accidentally override the system's pthread_sigmask + dnl symbol from libpthread. This is necessary on IRIX 6.5. + REPLACE_PTHREAD_SIGMASK=1 fi - fi - ], [ - dnl The module 'threadlib' is not in use, due to --avoid=threadlib being - dnl specified. - dnl The package either has prepared CPPFLAGS and LIBS for use of POSIX:2008 - dnl threads, or wants to build single-threaded programs. - if test $ac_cv_func_pthread_sigmask = yes; then - dnl pthread_sigmask exists and does not require extra libraries. - dnl Assume that it is declared. - : - else - dnl pthread_sigmask either does not exist or needs extra libraries. - HAVE_PTHREAD_SIGMASK=0 - dnl Define the symbol rpl_pthread_sigmask, not pthread_sigmask, - dnl so as to not accidentally override the system's pthread_sigmask - dnl symbol from libpthread. This is necessary on IRIX 6.5. - REPLACE_PTHREAD_SIGMASK=1 - fi - ]) + ]) + fi AC_SUBST([LIB_PTHREAD_SIGMASK]) dnl We don't need a variable LTLIB_PTHREAD_SIGMASK, because when @@ -117,48 +111,48 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK], AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - dnl On FreeBSD 6.4, HP-UX 11.31, Solaris 9, in programs that are not linked - dnl with -lpthread, the pthread_sigmask() function always returns 0 and has - dnl no effect. + dnl On FreeBSD 13.0, MidnightBSD 1.1, HP-UX 11.31, Solaris 9, in programs + dnl that are not linked with -lpthread, the pthread_sigmask() function + dnl always returns 0 and has no effect. if test -z "$LIB_PTHREAD_SIGMASK"; then case " $LIBS " in *' -pthread '*) ;; *' -lpthread '*) ;; - *) - AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], - [gl_cv_func_pthread_sigmask_in_libc_works], - [ - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ - #include <pthread.h> - #include <signal.h> - #include <stddef.h> - int main () - { - sigset_t set; - sigemptyset (&set); - return pthread_sigmask (1729, &set, NULL) != 0; - }]])], - [gl_cv_func_pthread_sigmask_in_libc_works=no], - [gl_cv_func_pthread_sigmask_in_libc_works=yes], - [ - changequote(,)dnl - case "$host_os" in - freebsd* | hpux* | solaris | solaris2.[2-9]*) - gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; - *) - gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; - esac - changequote([,])dnl - ]) - ]) - case "$gl_cv_func_pthread_sigmask_in_libc_works" in - *no) - REPLACE_PTHREAD_SIGMASK=1 - AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], - [Define to 1 if pthread_sigmask may return 0 and have no effect.]) - ;; - esac;; + *) + AC_CACHE_CHECK([whether pthread_sigmask works without -lpthread], + [gl_cv_func_pthread_sigmask_in_libc_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include <pthread.h> + #include <signal.h> + #include <stddef.h> + int main () + { + sigset_t set; + sigemptyset (&set); + return pthread_sigmask (1729, &set, NULL) != 0; + }]])], + [gl_cv_func_pthread_sigmask_in_libc_works=no], + [gl_cv_func_pthread_sigmask_in_libc_works=yes], + [ + changequote(,)dnl + case "$host_os" in + freebsd* | midnightbsd* | hpux* | solaris | solaris2.[2-9]*) + gl_cv_func_pthread_sigmask_in_libc_works="guessing no";; + *) + gl_cv_func_pthread_sigmask_in_libc_works="guessing yes";; + esac + changequote([,])dnl + ]) + ]) + case "$gl_cv_func_pthread_sigmask_in_libc_works" in + *no) + REPLACE_PTHREAD_SIGMASK=1 + AC_DEFINE([PTHREAD_SIGMASK_INEFFECTIVE], [1], + [Define to 1 if pthread_sigmask may return 0 and have no effect.]) + ;; + esac;; esac fi @@ -226,6 +220,7 @@ int main () #include <stdio.h> #include <stdlib.h> #include <unistd.h> +]GL_MDA_DEFINES[ static volatile int sigint_occurred; static void sigint_handler (int sig) diff --git a/gnulib-m4/putenv.m4 b/gnulib-m4/putenv.m4 index f2a76b22..c7b45034 100644 --- a/gnulib-m4/putenv.m4 +++ b/gnulib-m4/putenv.m4 @@ -1,5 +1,5 @@ -# putenv.m4 serial 22 -dnl Copyright (C) 2002-2018 Free Software Foundation, Inc. +# putenv.m4 serial 25 +dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -14,35 +14,41 @@ AC_DEFUN([gl_FUNC_PUTENV], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([for putenv compatible with GNU and SVID], - [gl_cv_func_svid_putenv], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[ - /* Put it in env. */ - if (putenv ("CONFTEST_putenv=val")) - return 1; + [gl_cv_func_svid_putenv], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT + GL_MDA_DEFINES], + [[ + /* Put it in env. */ + if (putenv ("CONFTEST_putenv=val")) + return 1; - /* Try to remove it. */ - if (putenv ("CONFTEST_putenv")) - return 2; + /* Try to remove it. */ + if (putenv ("CONFTEST_putenv")) + return 2; - /* Make sure it was deleted. */ - if (getenv ("CONFTEST_putenv") != 0) - return 3; + /* Make sure it was deleted. */ + if (getenv ("CONFTEST_putenv") != 0) + return 3; - return 0; - ]])], - gl_cv_func_svid_putenv=yes, - gl_cv_func_svid_putenv=no, - dnl When crosscompiling, assume putenv is broken. - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_svid_putenv="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_svid_putenv="guessing no" ;; - esac - ]) - ]) + return 0; + ]])], + [gl_cv_func_svid_putenv=yes], + [gl_cv_func_svid_putenv=no], + [dnl When crosscompiling, assume putenv is broken. + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_svid_putenv="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_svid_putenv="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_svid_putenv="$gl_cross_guess_normal" ;; + esac + ]) + ]) case "$gl_cv_func_svid_putenv" in *yes) ;; *) diff --git a/gnulib-m4/raise.m4 b/gnulib-m4/raise.m4 index 761e4b9f..0c78d095 100644 --- a/gnulib-m4/raise.m4 +++ b/gnulib-m4/raise.m4 @@ -1,5 +1,5 @@ # raise.m4 serial 4 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/realloc.m4 b/gnulib-m4/realloc.m4 new file mode 100644 index 00000000..86e57c25 --- /dev/null +++ b/gnulib-m4/realloc.m4 @@ -0,0 +1,63 @@ +# realloc.m4 serial 26 +dnl Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# This is adapted with modifications from upstream Autoconf here: +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 +AC_DEFUN([_AC_FUNC_REALLOC_IF], +[ + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], + [ac_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stdlib.h> + ]], + [[void *p = realloc (0, 0); + int result = !p; + free (p); + return result;]]) + ], + [ac_cv_func_realloc_0_nonnull=yes], + [ac_cv_func_realloc_0_nonnull=no], + [case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_realloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + ]) + ]) + AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) +])# AC_FUNC_REALLOC + +# gl_FUNC_REALLOC_GNU +# ------------------- +# Replace realloc if it is not compatible with GNU libc. +AC_DEFUN([gl_FUNC_REALLOC_GNU], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then + _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) + fi +])# gl_FUNC_REALLOC_GNU + +# gl_FUNC_REALLOC_POSIX +# --------------------- +# Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it +# fails, and doesn't mess up with ptrdiff_t overflow), +# and replace realloc if it is not. +AC_DEFUN([gl_FUNC_REALLOC_POSIX], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then + REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + fi +]) diff --git a/gnulib-m4/reallocarray.m4 b/gnulib-m4/reallocarray.m4 new file mode 100644 index 00000000..f39ab6ea --- /dev/null +++ b/gnulib-m4/reallocarray.m4 @@ -0,0 +1,23 @@ +# reallocarray.m4 serial 3 +dnl Copyright (C) 2017-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_REALLOCARRAY], +[ + dnl Persuade glibc <stdlib.h> to declare reallocarray. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) + AC_CHECK_FUNCS([reallocarray]) + if test "$ac_cv_func_reallocarray" = no; then + HAVE_REALLOCARRAY=0 + elif test "$gl_cv_malloc_ptrdiff" = no; then + REPLACE_REALLOCARRAY=1 + fi +]) + +# Prerequisites of lib/reallocarray.c. +AC_DEFUN([gl_PREREQ_REALLOCARRAY], [:]) diff --git a/gnulib-m4/relocatable-lib.m4 b/gnulib-m4/relocatable-lib.m4 index 6a1ced4f..b8a33e77 100644 --- a/gnulib-m4/relocatable-lib.m4 +++ b/gnulib-m4/relocatable-lib.m4 @@ -1,5 +1,5 @@ # relocatable-lib.m4 serial 6 -dnl Copyright (C) 2003, 2005-2007, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2007, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/sched_h.m4 b/gnulib-m4/sched_h.m4 new file mode 100644 index 00000000..ce44f7b3 --- /dev/null +++ b/gnulib-m4/sched_h.m4 @@ -0,0 +1,106 @@ +# sched_h.m4 serial 15 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Bruno Haible. + +AC_DEFUN_ONCE([gl_SCHED_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) + AC_CHECK_HEADERS([sched.h], [], [], + [[#if HAVE_SYS_CDEFS_H + #include <sys/cdefs.h> + #endif + ]]) + gl_NEXT_HEADERS([sched.h]) + + if test "$ac_cv_header_sched_h" = yes; then + HAVE_SCHED_H=1 + else + HAVE_SCHED_H=0 + fi + AC_SUBST([HAVE_SCHED_H]) + + if test "$HAVE_SCHED_H" = 1; then + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], + [[#if HAVE_SYS_CDEFS_H + #include <sys/cdefs.h> + #endif + #include <sched.h> + ]]) + else + HAVE_STRUCT_SCHED_PARAM=0 + case "$host_os" in + os2*) + dnl On OS/2 kLIBC, struct sched_param is in spawn.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include <spawn.h>]) + ;; + vms) + dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include <pthread.h>]) + ;; + esac + fi + AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) + + if test "$ac_cv_header_sys_cdefs_h" = yes; then + HAVE_SYS_CDEFS_H=1 + else + HAVE_SYS_CDEFS_H=0 + fi + AC_SUBST([HAVE_SYS_CDEFS_H]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include <sched.h> + ]], [sched_yield]) +]) + +# gl_SCHED_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SCHED_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SCHED_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SCHED_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD]) + REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD]) +]) diff --git a/gnulib-m4/sched_yield.m4 b/gnulib-m4/sched_yield.m4 new file mode 100644 index 00000000..d463a702 --- /dev/null +++ b/gnulib-m4/sched_yield.m4 @@ -0,0 +1,22 @@ +# sched_yield.m4 serial 2 +dnl Copyright (C) 2019-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_SCHED_YIELD], +[ + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) + AC_REQUIRE([gl_PTHREADLIB]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if { case "$host_os" in mingw*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_SCHED_YIELD=1 + else + AC_CHECK_DECL([sched_yield], , [HAVE_SCHED_YIELD=0], + [[#include <sched.h>]]) + fi +]) diff --git a/gnulib-m4/select.m4 b/gnulib-m4/select.m4 new file mode 100644 index 00000000..163f8fbf --- /dev/null +++ b/gnulib-m4/select.m4 @@ -0,0 +1,117 @@ +# select.m4 serial 13 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_SELECT], +[ + AC_REQUIRE([gl_SYS_SELECT_H]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([gl_SOCKETS]) + if test "$ac_cv_header_winsock2_h" = yes; then + REPLACE_SELECT=1 + else + dnl On Interix 3.5, select(0, NULL, NULL, NULL, timeout) fails with error + dnl EFAULT. + AC_CHECK_HEADERS_ONCE([sys/select.h]) + AC_CACHE_CHECK([whether select supports a 0 argument], + [gl_cv_func_select_supports0], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#include <sys/time.h> +#if HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif +int main () +{ + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 5; + return select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout) < 0; +}]])], [gl_cv_func_select_supports0=yes], [gl_cv_func_select_supports0=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no on Interix. + interix*) gl_cv_func_select_supports0="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_select_supports0="guessing yes";; + esac +changequote([,])dnl + ]) + ]) + case "$gl_cv_func_select_supports0" in + *yes) ;; + *) REPLACE_SELECT=1 ;; + esac + + dnl On FreeBSD 8.2, select() doesn't always reject bad fds. + AC_CACHE_CHECK([whether select detects invalid fds], + [gl_cv_func_select_detects_ebadf], + [ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include <sys/types.h> +#include <sys/time.h> +#if HAVE_SYS_SELECT_H +# include <sys/select.h> +#endif +#include <unistd.h> +#include <errno.h> +]GL_MDA_DEFINES], +[[ + fd_set set; + dup2(0, 16); + FD_ZERO(&set); + FD_SET(16, &set); + close(16); + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 5; + return select (17, &set, NULL, NULL, &timeout) != -1 || errno != EBADF; +]])], [gl_cv_func_select_detects_ebadf=yes], + [gl_cv_func_select_detects_ebadf=no], + [ + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_select_detects_ebadf="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_select_detects_ebadf="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_select_detects_ebadf="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case $gl_cv_func_select_detects_ebadf in + *yes) ;; + *) REPLACE_SELECT=1 ;; + esac + fi + + dnl Determine the needed libraries. + LIB_SELECT="$LIBSOCKET" + if test $REPLACE_SELECT = 1; then + case "$host_os" in + mingw*) + dnl On the MSVC platform, the function MsgWaitForMultipleObjects + dnl (used in lib/select.c) requires linking with -luser32. On mingw, + dnl it is implicit. + AC_LINK_IFELSE( + [AC_LANG_SOURCE([[ +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +int +main () +{ + MsgWaitForMultipleObjects (0, NULL, 0, 0, 0); + return 0; +}]])], + [], + [LIB_SELECT="$LIB_SELECT -luser32"]) + ;; + esac + fi + AC_SUBST([LIB_SELECT]) +]) diff --git a/gnulib-m4/semaphore.m4 b/gnulib-m4/semaphore.m4 new file mode 100644 index 00000000..c6be7b94 --- /dev/null +++ b/gnulib-m4/semaphore.m4 @@ -0,0 +1,45 @@ +# semaphore.m4 serial 1 +dnl Copyright (C) 2019-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Sets LIB_SEMAPHORE to the library needed, in addition to $(LIBMULTITHREAD), +# for getting the <semaphore.h> functions. + +AC_DEFUN([gl_SEMAPHORE], +[ + AC_REQUIRE([gl_THREADLIB]) + dnl sem_post is + dnl - in libc on macOS, FreeBSD, AIX, IRIX, Solaris 11, Haiku, Cygwin, + dnl - in libpthread on glibc systems, OpenBSD, + dnl - in libpthread or librt on NetBSD, + dnl - in librt on HP-UX 11, OSF/1, Solaris 10. + dnl On the platforms where -lpthread is needed, it is contained in + dnl $LIBMULTITHREAD. Therefore, the only library we need to test for is -lrt. + AC_CACHE_CHECK([for library needed for semaphore functions], + [gl_cv_semaphore_lib], + [save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <semaphore.h>]], + [[sem_post ((sem_t *)0);]])], + [gl_cv_semaphore_lib=none], + [LIBS="$LIBS -lrt" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <semaphore.h>]], + [[sem_post ((sem_t *)0);]])], + [gl_cv_semaphore_lib='-lrt'], + [gl_cv_semaphore_lib=none]) + ]) + LIBS="$save_LIBS" + ]) + if test "x$gl_cv_semaphore_lib" = xnone; then + LIB_SEMAPHORE= + else + LIB_SEMAPHORE="$gl_cv_semaphore_lib" + fi + AC_SUBST([LIB_SEMAPHORE]) +]) diff --git a/gnulib-m4/setenv.m4 b/gnulib-m4/setenv.m4 index 5d257f71..2000039a 100644 --- a/gnulib-m4/setenv.m4 +++ b/gnulib-m4/setenv.m4 @@ -1,5 +1,5 @@ -# setenv.m4 serial 27 -dnl Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc. +# setenv.m4 serial 30 +dnl Copyright (C) 2001-2004, 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -37,8 +37,10 @@ AC_DEFUN([gl_FUNC_SETENV], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_setenv_works="guessing no" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_setenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_setenv_works" in @@ -104,35 +106,39 @@ int unsetenv (const char *name); dnl OpenBSD 4.7 unsetenv("") does not fail. AC_CACHE_CHECK([whether unsetenv obeys POSIX], [gl_cv_func_unsetenv_works], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ - #include <stdlib.h> - #include <errno.h> - extern char **environ; - ]], [[ - char entry1[] = "a=1"; - char entry2[] = "b=2"; - char *env[] = { entry1, entry2, NULL }; - if (putenv ((char *) "a=1")) return 1; - if (putenv (entry2)) return 2; - entry2[0] = 'a'; - unsetenv ("a"); - if (getenv ("a")) return 3; - if (!unsetenv ("") || errno != EINVAL) return 4; - entry2[0] = 'b'; - environ = env; - if (!getenv ("a")) return 5; - entry2[0] = 'a'; - unsetenv ("a"); - if (getenv ("a")) return 6; - ]])], - [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no], - [case "$host_os" in - # Guess yes on glibc systems. - *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_unsetenv_works="guessing no" ;; - esac - ])]) + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ + #include <stdlib.h> + #include <errno.h> + extern char **environ; + ]GL_MDA_DEFINES], + [[ + char entry1[] = "a=1"; + char entry2[] = "b=2"; + char *env[] = { entry1, entry2, NULL }; + if (putenv ((char *) "a=1")) return 1; + if (putenv (entry2)) return 2; + entry2[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 3; + if (!unsetenv ("") || errno != EINVAL) return 4; + entry2[0] = 'b'; + environ = env; + if (!getenv ("a")) return 5; + entry2[0] = 'a'; + unsetenv ("a"); + if (getenv ("a")) return 6; + ]])], + [gl_cv_func_unsetenv_works=yes], + [gl_cv_func_unsetenv_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_unsetenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_unsetenv_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) case "$gl_cv_func_unsetenv_works" in *yes) ;; *) diff --git a/gnulib-m4/setlocale.m4 b/gnulib-m4/setlocale.m4 index 802ee01f..c0023d9c 100644 --- a/gnulib-m4/setlocale.m4 +++ b/gnulib-m4/setlocale.m4 @@ -1,5 +1,5 @@ -# setlocale.m4 serial 4 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# setlocale.m4 serial 7 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,23 +7,79 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SETLOCALE], [ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) AC_REQUIRE([AC_CANONICAL_HOST]) + + dnl Test whether we need to improve on the general working of setlocale. + NEED_SETLOCALE_IMPROVED=0 case "$host_os" in dnl On native Windows systems, setlocale(category,NULL) does not look at dnl the environment variables LC_ALL, category, and LANG. - mingw*) REPLACE_SETLOCALE=1 ;; + mingw*) NEED_SETLOCALE_IMPROVED=1 ;; dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL) dnl is then still "C". cygwin*) case `uname -r` in - 1.5.*) REPLACE_SETLOCALE=1 ;; + 1.5.*) NEED_SETLOCALE_IMPROVED=1 ;; + esac + ;; + dnl On Android 4.3, setlocale(category,"C") always fails. + *) + AC_CACHE_CHECK([whether setlocale supports the C locale], + [gl_cv_func_setlocale_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <locale.h> +int main () +{ + return setlocale (LC_ALL, "C") == NULL; +}]])], + [gl_cv_func_setlocale_works=yes], + [gl_cv_func_setlocale_works=no], + [case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_setlocale_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_setlocale_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_setlocale_works" in + *yes) ;; + *) NEED_SETLOCALE_IMPROVED=1 ;; esac ;; esac + AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED], + [Define to 1 to enable general improvements of setlocale.]) + + dnl Test whether we need a multithread-safe setlocale(category,NULL). + NEED_SETLOCALE_MTSAFE=0 + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + NEED_SETLOCALE_MTSAFE=1 + fi + AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE], + [Define to 1 to enable a multithread-safety fix of setlocale.]) + + if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then + REPLACE_SETLOCALE=1 + fi + + if test $NEED_SETLOCALE_MTSAFE = 1; then + LIB_SETLOCALE="$LIB_SETLOCALE_NULL" + else + LIB_SETLOCALE= + fi + dnl LIB_SETLOCALE is expected to be '-pthread' or '-lpthread' on AIX with gcc + dnl or xlc, and empty otherwise. + AC_SUBST([LIB_SETLOCALE]) ]) # Prerequisites of lib/setlocale.c. AC_DEFUN([gl_PREREQ_SETLOCALE], [ + dnl No need to check for CFLocaleCopyPreferredLanguages and + dnl CFPreferencesCopyAppValue because lib/setlocale.c is not used on Mac OS X. + dnl (The Mac OS X specific code is only used in libintl.) : ]) diff --git a/gnulib-m4/setlocale_null.m4 b/gnulib-m4/setlocale_null.m4 new file mode 100644 index 00000000..09ea50ea --- /dev/null +++ b/gnulib-m4/setlocale_null.m4 @@ -0,0 +1,98 @@ +# setlocale_null.m4 serial 5 +dnl Copyright (C) 2019-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_SETLOCALE_NULL], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + AC_CHECK_HEADERS_ONCE([threads.h]) + + AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], + [gl_cv_func_setlocale_null_all_mtsafe], + [case "$host_os" in + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. + *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + gl_cv_func_setlocale_null_all_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; + esac + ]) + dnl On platforms without multithreading, there is no issue. + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_all_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_all_mtsafe" in + *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; + *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; + esac + AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE], + [Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.]) + + dnl This is about a single category (not LC_ALL). + AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe], + [gl_cv_func_setlocale_null_one_mtsafe], + [case "$host_os" in + # Guess no on OpenBSD, AIX. + openbsd* | aix*) + gl_cv_func_setlocale_null_one_mtsafe=no ;; + # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + gl_cv_func_setlocale_null_one_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; + esac + ]) + dnl On platforms without multithreading, there is no issue. + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_one_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_one_mtsafe" in + *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; + *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; + esac + AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE], + [Define to 1 if setlocale (category, NULL) is multithread-safe.]) + + dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + case "$host_os" in + mingw*) LIB_SETLOCALE_NULL= ;; + *) + gl_WEAK_SYMBOLS + case "$gl_cv_have_weak" in + *yes) LIB_SETLOCALE_NULL= ;; + *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_SETLOCALE_NULL= + fi + dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX + dnl with gcc or xlc, and empty otherwise. + AC_SUBST([LIB_SETLOCALE_NULL]) +]) + +# Prerequisites of lib/setlocale-lock.c. +AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK], +[ + gl_VISIBILITY +]) diff --git a/gnulib-m4/sigaction.m4 b/gnulib-m4/sigaction.m4 new file mode 100644 index 00000000..62c83e03 --- /dev/null +++ b/gnulib-m4/sigaction.m4 @@ -0,0 +1,40 @@ +# sigaction.m4 serial 7 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Determine if sigaction interface is present. +AC_DEFUN([gl_SIGACTION], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([sigaction]) + if test $ac_cv_func_sigaction = yes; then + AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , + [[#include <signal.h>]]) + if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then + HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 + fi + else + HAVE_SIGACTION=0 + fi +]) + +# Prerequisites of the part of lib/signal.in.h and of lib/sigaction.c. +AC_DEFUN([gl_PREREQ_SIGACTION], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_TYPE_UID_T]) + AC_REQUIRE([gl_PREREQ_SIG_HANDLER_H]) + AC_CHECK_FUNCS_ONCE([sigaltstack siginterrupt]) + AC_CHECK_TYPES([siginfo_t], [], [], [[ +#include <signal.h> + ]]) + if test $ac_cv_type_siginfo_t = no; then + HAVE_SIGINFO_T=0 + fi +]) + +# Prerequisites of lib/sig-handler.h. +AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], [:]) diff --git a/gnulib-m4/signal_h.m4 b/gnulib-m4/signal_h.m4 index 394b91d3..4c05c627 100644 --- a/gnulib-m4/signal_h.m4 +++ b/gnulib-m4/signal_h.m4 @@ -1,10 +1,10 @@ -# signal_h.m4 serial 18 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# signal_h.m4 serial 22 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_SIGNAL_H], +AC_DEFUN_ONCE([gl_SIGNAL_H], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) @@ -34,6 +34,8 @@ AC_DEFUN([gl_SIGNAL_H], ]], [pthread_sigmask sigaction sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], @@ -50,22 +52,37 @@ AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], fi ]) +# gl_SIGNAL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SIGNAL_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) +]) + AC_DEFUN([gl_SIGNAL_H_DEFAULTS], [ - GNULIB_PTHREAD_SIGMASK=0; AC_SUBST([GNULIB_PTHREAD_SIGMASK]) - GNULIB_RAISE=0; AC_SUBST([GNULIB_RAISE]) - GNULIB_SIGNAL_H_SIGPIPE=0; AC_SUBST([GNULIB_SIGNAL_H_SIGPIPE]) - GNULIB_SIGPROCMASK=0; AC_SUBST([GNULIB_SIGPROCMASK]) - GNULIB_SIGACTION=0; AC_SUBST([GNULIB_SIGACTION]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) diff --git a/gnulib-m4/signalblocking.m4 b/gnulib-m4/signalblocking.m4 index 4350b21d..b586ef53 100644 --- a/gnulib-m4/signalblocking.m4 +++ b/gnulib-m4/signalblocking.m4 @@ -1,5 +1,5 @@ -# signalblocking.m4 serial 14 -dnl Copyright (C) 2001-2002, 2006-2018 Free Software Foundation, Inc. +# signalblocking.m4 serial 17 +dnl Copyright (C) 2001-2002, 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,11 +13,9 @@ AC_DEFUN([gl_SIGNALBLOCKING], [ AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) - if test $gl_cv_type_sigset_t = yes; then - AC_CHECK_FUNC([sigprocmask], [gl_cv_func_sigprocmask=1]) - fi - if test -z "$gl_cv_func_sigprocmask"; then - HAVE_POSIX_SIGNALBLOCKING=0 + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + AC_CHECK_FUNC([sigprocmask], [HAVE_POSIX_SIGNALBLOCKING=1]) fi ]) diff --git a/gnulib-m4/signbit.m4 b/gnulib-m4/signbit.m4 index 9e7884d2..8a4114db 100644 --- a/gnulib-m4/signbit.m4 +++ b/gnulib-m4/signbit.m4 @@ -1,5 +1,5 @@ -# signbit.m4 serial 16 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# signbit.m4 serial 20 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_SIGNBIT], [ AC_REQUIRE([gl_MATH_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([for signbit macro], [gl_cv_func_signbit], [ AC_RUN_IFELSE( @@ -31,22 +31,25 @@ AC_DEFUN([gl_SIGNBIT], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_signbit="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_signbit="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_signbit="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_signbit="$gl_cross_guess_normal" ;; esac ]) ]) - dnl GCC 4.0 and newer provides three built-ins for signbit. + dnl GCC >= 4.0 and clang provide three built-ins for signbit. dnl They can be used without warnings, also in C++, regardless of <math.h>. dnl But they may expand to calls to functions, which may or may not be in dnl libc. - AC_CACHE_CHECK([for signbit compiler built-ins], [gl_cv_func_signbit_gcc], + AC_CACHE_CHECK([for signbit compiler built-ins], + [gl_cv_func_signbit_builtins], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ -#if __GNUC__ >= 4 +#if (__GNUC__ >= 4) || (__clang_major__ >= 4) # define signbit(x) \ (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ @@ -57,28 +60,30 @@ AC_DEFUN([gl_SIGNBIT], #include <string.h> ]gl_SIGNBIT_TEST_PROGRAM ])], - [gl_cv_func_signbit_gcc=yes], - [gl_cv_func_signbit_gcc=no], + [gl_cv_func_signbit_builtins=yes], + [gl_cv_func_signbit_builtins=no], [case "$host_os" in # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_signbit_gcc="guessing yes" ;; + *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_signbit_builtins="guessing yes" ;; # Guess yes on mingw, no on MSVC. mingw*) if test -n "$GCC"; then - gl_cv_func_signbit_gcc="guessing yes" + gl_cv_func_signbit_builtins="guessing yes" else - gl_cv_func_signbit_gcc="guessing no" + gl_cv_func_signbit_builtins="guessing no" fi ;; - # If we don't know, assume the worst. - *) gl_cv_func_signbit_gcc="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;; esac ]) ]) dnl Use the compiler built-ins whenever possible, because they are more dnl efficient than the system library functions (if they exist). - case "$gl_cv_func_signbit_gcc" in + case "$gl_cv_func_signbit_builtins" in *yes) - REPLACE_SIGNBIT_USING_GCC=1 + REPLACE_SIGNBIT_USING_BUILTINS=1 ;; *) case "$gl_cv_func_signbit" in @@ -86,79 +91,90 @@ AC_DEFUN([gl_SIGNBIT], *) dnl REPLACE_SIGNBIT=1 makes sure the signbit[fdl] functions get built. REPLACE_SIGNBIT=1 - gl_FLOAT_SIGN_LOCATION - gl_DOUBLE_SIGN_LOCATION - gl_LONG_DOUBLE_SIGN_LOCATION - if test "$gl_cv_cc_float_signbit" = unknown; then - dnl Test whether copysignf() is declared. - AC_CHECK_DECLS([copysignf], , , [[#include <math.h>]]) - if test "$ac_cv_have_decl_copysignf" = yes; then - dnl Test whether copysignf() can be used without libm. - AC_CACHE_CHECK([whether copysignf can be used without linking with libm], - [gl_cv_func_copysignf_no_libm], - [ - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <math.h> - float x, y;]], - [[return copysignf (x, y) < 0;]])], - [gl_cv_func_copysignf_no_libm=yes], - [gl_cv_func_copysignf_no_libm=no]) - ]) - if test $gl_cv_func_copysignf_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], [1], - [Define if the copysignf function is declared in <math.h> and available in libc.]) - fi - fi - fi - if test "$gl_cv_cc_double_signbit" = unknown; then - dnl Test whether copysign() is declared. - AC_CHECK_DECLS([copysign], , , [[#include <math.h>]]) - if test "$ac_cv_have_decl_copysign" = yes; then - dnl Test whether copysign() can be used without libm. - AC_CACHE_CHECK([whether copysign can be used without linking with libm], - [gl_cv_func_copysign_no_libm], - [ - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <math.h> - double x, y;]], - [[return copysign (x, y) < 0;]])], - [gl_cv_func_copysign_no_libm=yes], - [gl_cv_func_copysign_no_libm=no]) - ]) - if test $gl_cv_func_copysign_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], [1], - [Define if the copysign function is declared in <math.h> and available in libc.]) - fi - fi - fi - if test "$gl_cv_cc_long_double_signbit" = unknown; then - dnl Test whether copysignl() is declared. - AC_CHECK_DECLS([copysignl], , , [[#include <math.h>]]) - if test "$ac_cv_have_decl_copysignl" = yes; then - dnl Test whether copysignl() can be used without libm. - AC_CACHE_CHECK([whether copysignl can be used without linking with libm], - [gl_cv_func_copysignl_no_libm], - [ - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <math.h> - long double x, y;]], - [[return copysignl (x, y) < 0;]])], - [gl_cv_func_copysignl_no_libm=yes], - [gl_cv_func_copysignl_no_libm=no]) - ]) - if test $gl_cv_func_copysignl_no_libm = yes; then - AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], [1], - [Define if the copysignl function is declared in <math.h> and available in libc.]) - fi - fi - fi ;; esac ;; esac + dnl On Solaris 10, with CC in C++ mode, signbit is not available although + dnl is with cc in C mode. This cannot be worked around by defining + dnl _XOPEN_SOURCE=600, because the latter does not work in C++ mode on + dnl Solaris 11.0. Therefore use the replacement functions on Solaris. + case "$host_os" in + solaris*) + REPLACE_SIGNBIT=1 + ;; + esac + if test $REPLACE_SIGNBIT = 1; then + gl_FLOAT_SIGN_LOCATION + gl_DOUBLE_SIGN_LOCATION + gl_LONG_DOUBLE_SIGN_LOCATION + if test "$gl_cv_cc_float_signbit" = unknown; then + dnl Test whether copysignf() is declared. + AC_CHECK_DECLS([copysignf], , , [[#include <math.h>]]) + if test "$ac_cv_have_decl_copysignf" = yes; then + dnl Test whether copysignf() can be used without libm. + AC_CACHE_CHECK([whether copysignf can be used without linking with libm], + [gl_cv_func_copysignf_no_libm], + [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <math.h> + float x, y;]], + [[return copysignf (x, y) < 0;]])], + [gl_cv_func_copysignf_no_libm=yes], + [gl_cv_func_copysignf_no_libm=no]) + ]) + if test $gl_cv_func_copysignf_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNF_IN_LIBC], [1], + [Define if the copysignf function is declared in <math.h> and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + dnl Test whether copysign() is declared. + AC_CHECK_DECLS([copysign], , , [[#include <math.h>]]) + if test "$ac_cv_have_decl_copysign" = yes; then + dnl Test whether copysign() can be used without libm. + AC_CACHE_CHECK([whether copysign can be used without linking with libm], + [gl_cv_func_copysign_no_libm], + [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <math.h> + double x, y;]], + [[return copysign (x, y) < 0;]])], + [gl_cv_func_copysign_no_libm=yes], + [gl_cv_func_copysign_no_libm=no]) + ]) + if test $gl_cv_func_copysign_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGN_IN_LIBC], [1], + [Define if the copysign function is declared in <math.h> and available in libc.]) + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + dnl Test whether copysignl() is declared. + AC_CHECK_DECLS([copysignl], , , [[#include <math.h>]]) + if test "$ac_cv_have_decl_copysignl" = yes; then + dnl Test whether copysignl() can be used without libm. + AC_CACHE_CHECK([whether copysignl can be used without linking with libm], + [gl_cv_func_copysignl_no_libm], + [ + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <math.h> + long double x, y;]], + [[return copysignl (x, y) < 0;]])], + [gl_cv_func_copysignl_no_libm=yes], + [gl_cv_func_copysignl_no_libm=no]) + ]) + if test $gl_cv_func_copysignl_no_libm = yes; then + AC_DEFINE([HAVE_COPYSIGNL_IN_LIBC], [1], + [Define if the copysignl function is declared in <math.h> and available in libc.]) + fi + fi + fi + fi ]) AC_DEFUN([gl_SIGNBIT_TEST_PROGRAM], [[ diff --git a/gnulib-m4/size_max.m4 b/gnulib-m4/size_max.m4 index 2b770e6c..1d6abaea 100644 --- a/gnulib-m4/size_max.m4 +++ b/gnulib-m4/size_max.m4 @@ -1,17 +1,19 @@ -# size_max.m4 serial 10 -dnl Copyright (C) 2003, 2005-2006, 2008-2018 Free Software Foundation, Inc. +# size_max.m4 serial 12 +dnl Copyright (C) 2003, 2005-2006, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +AC_PREREQ([2.61]) + AC_DEFUN([gl_SIZE_MAX], [ AC_CHECK_HEADERS([stdint.h]) dnl First test whether the system already has SIZE_MAX. AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ - gl_cv_size_max= + gl_cv_size_max=no AC_EGREP_CPP([Found it], [ #include <limits.h> #if HAVE_STDINT_H @@ -21,7 +23,7 @@ AC_DEFUN([gl_SIZE_MAX], Found it #endif ], [gl_cv_size_max=yes]) - if test -z "$gl_cv_size_max"; then + if test $gl_cv_size_max != yes; then dnl Define it ourselves. Here we assume that the type 'size_t' is not wider dnl than the type 'unsigned long'. Try hard to find a definition that can dnl be used in a preprocessor #if, i.e. doesn't contain a cast. @@ -71,9 +73,3 @@ Found it # undef SIZE_MAX #endif]) ]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff --git a/gnulib-m4/sleep.m4 b/gnulib-m4/sleep.m4 index 7ddaffae..e73651f5 100644 --- a/gnulib-m4/sleep.m4 +++ b/gnulib-m4/sleep.m4 @@ -1,5 +1,5 @@ -# sleep.m4 serial 9 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# sleep.m4 serial 11 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -48,10 +48,12 @@ handle_alarm (int sig) [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_sleep_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_sleep_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_sleep_works="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_sleep_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_sleep_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_sleep_works" in diff --git a/gnulib-m4/socketlib.m4 b/gnulib-m4/socketlib.m4 new file mode 100644 index 00000000..b8bd0afa --- /dev/null +++ b/gnulib-m4/socketlib.m4 @@ -0,0 +1,96 @@ +# socketlib.m4 serial 3 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl gl_SOCKETLIB +dnl Determines the library to use for socket functions. +dnl Sets and AC_SUBSTs LIBSOCKET. + +AC_DEFUN([gl_SOCKETLIB], +[ + gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H + LIBSOCKET= + if test $HAVE_WINSOCK2_H = 1; then + dnl Native Windows API (not Cygwin). + dnl If the function WSAStartup exists (declared in <winsock2.h> and + dnl defined through -lws2_32), we need to call it. + AC_CACHE_CHECK([for WSAStartup], + [gl_cv_func_wsastartup], [ + gl_save_LIBS="$LIBS" + LIBS="$LIBS -lws2_32" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif]], [[ + WORD wVersionRequested = MAKEWORD(1, 1); + WSADATA wsaData; + int err = WSAStartup(wVersionRequested, &wsaData); + WSACleanup (); + ]]) + ], + [gl_cv_func_wsastartup=yes], + [gl_cv_func_wsastartup=no]) + LIBS="$gl_save_LIBS" + ]) + if test "$gl_cv_func_wsastartup" = "yes"; then + AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) + LIBSOCKET='-lws2_32' + fi + else + dnl Unix API. + dnl Solaris has most socket functions in libsocket. + dnl Haiku has most socket functions in libnetwork. + dnl BeOS has most socket functions in libnet. + dnl On HP-UX, do NOT link with libxnet, because in 64-bit mode this would + dnl break code (e.g. in libraries) that invokes accept(), getpeername(), + dnl getsockname(), getsockopt(), or recvfrom() with a 32-bit addrlen. See + dnl "man xopen_networking" for details. + AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [ + gl_cv_lib_socket= + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [], + [gl_save_LIBS="$LIBS" + LIBS="$gl_save_LIBS -lsocket" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lsocket"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnetwork" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnetwork"]) + if test -z "$gl_cv_lib_socket"; then + LIBS="$gl_save_LIBS -lnet" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern +#ifdef __cplusplus +"C" +#endif +char setsockopt();]], [[setsockopt();]])], + [gl_cv_lib_socket="-lnet"]) + fi + fi + LIBS="$gl_save_LIBS" + ]) + if test -z "$gl_cv_lib_socket"; then + gl_cv_lib_socket="none needed" + fi + ]) + if test "$gl_cv_lib_socket" != "none needed"; then + LIBSOCKET="$gl_cv_lib_socket" + fi + fi + AC_SUBST([LIBSOCKET]) +]) diff --git a/gnulib-m4/sockets.m4 b/gnulib-m4/sockets.m4 new file mode 100644 index 00000000..aa04acc3 --- /dev/null +++ b/gnulib-m4/sockets.m4 @@ -0,0 +1,17 @@ +# sockets.m4 serial 7 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_SOCKETS], +[ + AC_REQUIRE([AC_C_INLINE]) + AC_REQUIRE([gl_SOCKETLIB]) + gl_PREREQ_SOCKETS +]) + +# Prerequisites of lib/sockets.c. +AC_DEFUN([gl_PREREQ_SOCKETS], [ + : +]) diff --git a/gnulib-m4/socklen.m4 b/gnulib-m4/socklen.m4 new file mode 100644 index 00000000..1390ac41 --- /dev/null +++ b/gnulib-m4/socklen.m4 @@ -0,0 +1,76 @@ +# socklen.m4 serial 11 +dnl Copyright (C) 2005-2007, 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Albert Chin, Windows fixes from Simon Josefsson. + +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc.: +dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. +dnl So we have to test to find something that will work. + +AC_DEFUN([gl_TYPE_SOCKLEN_T], + [AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])dnl + AC_CHECK_TYPE([socklen_t], , + [AC_CACHE_CHECK([for socklen_t equivalent], + [gl_cv_socklen_t_equiv], + [# Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + gl_cv_socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t "unsigned int" "long int" "unsigned long int"; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/socket.h> + + int getpeername (int, $arg2 *, $t *);]], + [[$t len; + getpeername (0, 0, &len);]])], + [gl_cv_socklen_t_equiv="$t"]) + test "$gl_cv_socklen_t_equiv" != "" && break + done + test "$gl_cv_socklen_t_equiv" != "" && break + done + if test "$gl_cv_socklen_t_equiv" = ""; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_DEFINE_UNQUOTED([socklen_t], [$gl_cv_socklen_t_equiv], + [type to use in place of socklen_t if not defined])], + [gl_SOCKET_HEADERS])]) + +dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find +dnl it there too. But on Cygwin, wc2tcpip.h must not be included. Users +dnl of this module should use the same include pattern as gl_SOCKET_HEADERS. +dnl When you change this macro, keep also in sync: +dnl - gl_CHECK_SOCKET_HEADERS, +dnl - the Include section of modules/socklen. +AC_DEFUN([gl_SOCKET_HEADERS], +[ +/* <sys/types.h> is not needed according to POSIX, but the + <sys/socket.h> in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include <sys/types.h> +#if HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#elif HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif +]) + +dnl Tests for the existence of the header for socket facilities. +dnl Defines the C macros HAVE_SYS_SOCKET_H, HAVE_WS2TCPIP_H. +dnl This macro must match gl_SOCKET_HEADERS. +AC_DEFUN([gl_CHECK_SOCKET_HEADERS], + [AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = no; then + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([ws2tcpip.h]) + fi + ]) diff --git a/gnulib-m4/sockpfaf.m4 b/gnulib-m4/sockpfaf.m4 new file mode 100644 index 00000000..b1c4068a --- /dev/null +++ b/gnulib-m4/sockpfaf.m4 @@ -0,0 +1,84 @@ +# sockpfaf.m4 serial 10 +dnl Copyright (C) 2004, 2006, 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) +dnl and some common address families (AF_INET, AF_INET6, ...). +dnl This test assumes that a system supports an address family if and only if +dnl it supports the corresponding protocol family. + +dnl From Bruno Haible. + +AC_DEFUN([gl_SOCKET_FAMILIES], +[ + AC_REQUIRE([gl_SYS_SOCKET_H]) + AC_CHECK_HEADERS_ONCE([netinet/in.h]) + + AC_CACHE_CHECK([for IPv4 sockets], + [gl_cv_socket_ipv4], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif]], +[[int x = AF_INET; struct in_addr y; struct sockaddr_in z; + if (&x && &y && &z) return 0;]])], + gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)]) + if test $gl_cv_socket_ipv4 = yes; then + AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.]) + fi + + AC_CACHE_CHECK([for IPv6 sockets], + [gl_cv_socket_ipv6], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H +#include <netinet/in.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif +#ifdef HAVE_WS2TCPIP_H +#include <ws2tcpip.h> +#endif]], +[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z; + if (&x && &y && &z) return 0;]])], + gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)]) + if test $gl_cv_socket_ipv6 = yes; then + AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.]) + fi +]) + +AC_DEFUN([gl_SOCKET_FAMILY_UNIX], +[ + AC_REQUIRE([gl_SYS_SOCKET_H]) + AC_CHECK_HEADERS_ONCE([sys/un.h]) + + AC_CACHE_CHECK([for UNIX domain sockets], + [gl_cv_socket_unix], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#ifdef HAVE_SYS_UN_H +#include <sys/un.h> +#endif +#ifdef HAVE_WINSOCK2_H +#include <winsock2.h> +#endif]], +[[int x = AF_UNIX; struct sockaddr_un y; + if (&x && &y) return 0;]])], + gl_cv_socket_unix=yes, gl_cv_socket_unix=no)]) + if test $gl_cv_socket_unix = yes; then + AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.]) + fi +]) diff --git a/gnulib-m4/ssize_t.m4 b/gnulib-m4/ssize_t.m4 index 0977f205..03b2b895 100644 --- a/gnulib-m4/ssize_t.m4 +++ b/gnulib-m4/ssize_t.m4 @@ -1,5 +1,5 @@ # ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/stat-time.m4 b/gnulib-m4/stat-time.m4 new file mode 100644 index 00000000..342857d3 --- /dev/null +++ b/gnulib-m4/stat-time.m4 @@ -0,0 +1,83 @@ +# Checks for stat-related time functions. + +# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2022 Free Software +# Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# st_atim.tv_nsec - Linux, Solaris, Cygwin +# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE +# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE +# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) + +# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) +# st_birthtim - Cygwin 1.7.0+ + +AC_DEFUN([gl_STAT_TIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + + AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], + [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ + #include <sys/types.h> + #include <sys/stat.h> + #if HAVE_SYS_TIME_H + # include <sys/time.h> + #endif + #include <time.h> + struct timespec ts; + struct stat st; + ]], + [[ + st.st_atim = ts; + ]])], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) + if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then + AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], + [Define to 1 if the type of the st_atim member of a struct stat is + struct timespec.]) + fi], + [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>]) +]) + +# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) +# and NTFS (Cygwin). +# There was a time when this field was named st_createtime (21 June +# 2002 to 16 July 2002) But that window is very small and applied only +# to development code, so systems still using that configuration are +# not supported. See revisions 1.10 and 1.11 of FreeBSD's +# src/sys/ufs/ufs/dinode.h. +# +AC_DEFUN([gl_STAT_BIRTHTIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>])], + [#include <sys/types.h> + #include <sys/stat.h>]) +]) diff --git a/gnulib-m4/stat.m4 b/gnulib-m4/stat.m4 new file mode 100644 index 00000000..916eb886 --- /dev/null +++ b/gnulib-m4/stat.m4 @@ -0,0 +1,85 @@ +# serial 18 + +# Copyright (C) 2009-2022 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([lstat]) + case "$host_os" in + mingw*) + dnl On this platform, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + REPLACE_STAT=1 + ;; + *) + dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). + dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). + AC_CACHE_CHECK([whether stat handles trailing slashes on files], + [gl_cv_func_stat_file_slash], + [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/stat.h> +]], [[int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) + result |= 2; +#endif + return result; + ]])], + [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], + [case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.tmp conftest.lnk]) + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs + help when passed a file name with a trailing slash]);; + esac + case $host_os in + dnl Solaris stat can return a negative tv_nsec. + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; + esac +]) + +# Prerequisites of lib/stat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_STAT], [ + AC_REQUIRE([gl_SYS_STAT_H]) + AC_REQUIRE([gl_PREREQ_STAT_W32]) + : +]) + +# Prerequisites of lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_STAT_W32], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_CHECK_HEADERS([sdkddkver.h]) + ;; + esac +]) diff --git a/gnulib-m4/stdalign.m4 b/gnulib-m4/stdalign.m4 index c74fe9b7..78577cb2 100644 --- a/gnulib-m4/stdalign.m4 +++ b/gnulib-m4/stdalign.m4 @@ -1,6 +1,6 @@ # Check for stdalign.h that conforms to C11. -dnl Copyright 2011-2018 Free Software Foundation, Inc. +dnl Copyright 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -13,7 +13,8 @@ AC_DEFUN([gl_STDALIGN_H], [gl_cv_header_working_stdalign_h], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[#include <stdalign.h> + [[#include <stdint.h> + #include <stdalign.h> #include <stddef.h> /* Test that alignof yields a result consistent with offsetof. @@ -32,6 +33,7 @@ AC_DEFUN([gl_STDALIGN_H], /* Test _Alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ + || (__TINYC__ && defined __attribute__) \ || (defined __APPLE__ && defined __MACH__ \ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ : __GNUC__) \ @@ -47,11 +49,8 @@ AC_DEFUN([gl_STDALIGN_H], [gl_cv_header_working_stdalign_h=no])]) if test $gl_cv_header_working_stdalign_h = yes; then - STDALIGN_H='' + GL_GENERATE_STDALIGN_H=false else - STDALIGN_H='stdalign.h' + GL_GENERATE_STDALIGN_H=true fi - - AC_SUBST([STDALIGN_H]) - AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"]) ]) diff --git a/gnulib-m4/stdbool.m4 b/gnulib-m4/stdbool.m4 index f8c05776..3e6c4005 100644 --- a/gnulib-m4/stdbool.m4 +++ b/gnulib-m4/stdbool.m4 @@ -1,27 +1,39 @@ # Check for stdbool.h that conforms to C99. -dnl Copyright (C) 2002-2006, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -#serial 7 +#serial 9 # Prepare for substituting <stdbool.h> if it is not supported. -AC_DEFUN([AM_STDBOOL_H], +AC_DEFUN([gl_STDBOOL_H], [ AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + AC_REQUIRE([AC_CANONICAL_HOST]) - # Define two additional variables used in the Makefile substitution. - + dnl On some platforms, <stdbool.h> does not exist or does not conform to C99. + dnl On Solaris 10 with CC=cc CXX=CC, <stdbool.h> exists but is not usable + dnl in C++ mode (and no <cstdbool> exists). In this case, we use our + dnl replacement, also in C mode (for binary compatibility between C and C++). if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' + case "$host_os" in + solaris*) + if test -z "$GCC"; then + GL_GENERATE_STDBOOL_H=true + else + GL_GENERATE_STDBOOL_H=false + fi + ;; + *) + GL_GENERATE_STDBOOL_H=false + ;; + esac else - STDBOOL_H='stdbool.h' + GL_GENERATE_STDBOOL_H=true fi - AC_SUBST([STDBOOL_H]) - AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) if test "$ac_cv_type__Bool" = yes; then HAVE__BOOL=1 @@ -31,9 +43,6 @@ AC_DEFUN([AM_STDBOOL_H], AC_SUBST([HAVE__BOOL]) ]) -# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. -AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) - # This version of the macro is needed in autoconf <= 2.68. AC_DEFUN([AC_CHECK_HEADER_STDBOOL], diff --git a/gnulib-m4/stddef_h.m4 b/gnulib-m4/stddef_h.m4 index ba3d201c..abfd2030 100644 --- a/gnulib-m4/stddef_h.m4 +++ b/gnulib-m4/stddef_h.m4 @@ -1,22 +1,54 @@ -dnl A placeholder for <stddef.h>, for platforms that have issues. -# stddef_h.m4 serial 5 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. +# stddef_h.m4 serial 12 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_STDDEF_H], +dnl A placeholder for <stddef.h>, for platforms that have issues. + +AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) - STDDEF_H= - AC_CHECK_TYPE([max_align_t], [], [HAVE_MAX_ALIGN_T=0; STDDEF_H=stddef.h], - [[#include <stddef.h> - ]]) + + dnl Persuade OpenBSD <stddef.h> to declare max_align_t. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + GL_GENERATE_STDDEF_H=false + + dnl Test whether the type max_align_t exists and whether its alignment + dnl "is as great as is supported by the implementation in all contexts". + AC_CACHE_CHECK([for good max_align_t], + [gl_cv_type_max_align_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <stddef.h> + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + typedef struct { char a; max_align_t b; } max_helper; + typedef struct { char a; long b; } long_helper; + typedef struct { char a; double b; } double_helper; + typedef struct { char a; long double b; } long_double_helper; + int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; + int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; + int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; + ]])], + [gl_cv_type_max_align_t=yes], + [gl_cv_type_max_align_t=no]) + ]) + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + GL_GENERATE_STDDEF_H=true + fi + if test $gt_cv_c_wchar_t = no; then HAVE_WCHAR_T=0 - STDDEF_H=stddef.h + GL_GENERATE_STDDEF_H=true fi + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> @@ -26,22 +58,36 @@ AC_DEFUN([gl_STDDEF_H], [gl_cv_decl_null_works=no])]) if test $gl_cv_decl_null_works = no; then REPLACE_NULL=1 - STDDEF_H=stddef.h + GL_GENERATE_STDDEF_H=true fi - AC_SUBST([STDDEF_H]) - AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) - if test -n "$STDDEF_H"; then + + if $GL_GENERATE_STDDEF_H; then gl_NEXT_HEADERS([stddef.h]) fi ]) +# gl_STDDEF_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDDEF_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. diff --git a/gnulib-m4/stdint.m4 b/gnulib-m4/stdint.m4 index b86184c2..c3f08942 100644 --- a/gnulib-m4/stdint.m4 +++ b/gnulib-m4/stdint.m4 @@ -1,5 +1,5 @@ -# stdint.m4 serial 51 -dnl Copyright (C) 2001-2018 Free Software Foundation, Inc. +# stdint.m4 serial 61 +dnl Copyright (C) 2001-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Paul Eggert and Bruno Haible. dnl Test whether <stdint.h> is supported or must be substituted. +AC_PREREQ([2.61]) + AC_DEFUN_ONCE([gl_STDINT_H], [ AC_PREREQ([2.59])dnl @@ -15,21 +17,12 @@ AC_DEFUN_ONCE([gl_STDINT_H], AC_REQUIRE([gl_LIMITS_H]) AC_REQUIRE([gt_TYPE_WINT_T]) - dnl Check for long long int and unsigned long long int. - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) - if test $ac_cv_type_long_long_int = yes; then - HAVE_LONG_LONG_INT=1 - else - HAVE_LONG_LONG_INT=0 - fi - AC_SUBST([HAVE_LONG_LONG_INT]) - AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) - if test $ac_cv_type_unsigned_long_long_int = yes; then - HAVE_UNSIGNED_LONG_LONG_INT=1 - else - HAVE_UNSIGNED_LONG_LONG_INT=0 - fi - AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) + dnl For backward compatibility. Some packages may still be testing these + dnl macros. + AC_DEFINE([HAVE_LONG_LONG_INT], [1], + [Define to 1 if the system has the type 'long long int'.]) + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], + [Define to 1 if the system has the type 'unsigned long long int'.]) dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does. AC_CHECK_HEADERS_ONCE([wchar.h]) @@ -41,7 +34,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], AC_SUBST([HAVE_WCHAR_H]) dnl Check for <inttypes.h>. - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. + AC_CHECK_HEADERS_ONCE([inttypes.h]) if test $ac_cv_header_inttypes_h = yes; then HAVE_INTTYPES_H=1 else @@ -50,7 +43,7 @@ AC_DEFUN_ONCE([gl_STDINT_H], AC_SUBST([HAVE_INTTYPES_H]) dnl Check for <sys/types.h>. - dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. + AC_CHECK_HEADERS_ONCE([sys/types.h]) if test $ac_cv_header_sys_types_h = yes; then HAVE_SYS_TYPES_H=1 else @@ -159,7 +152,7 @@ uintmax_t j = UINTMAX_MAX; /* Check that SIZE_MAX has the correct type, if possible. */ #if 201112 <= __STDC_VERSION__ int k = _Generic (SIZE_MAX, size_t: 0); -#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ +#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ || (0x5110 <= __SUNPRO_C && !__STDC__)) extern size_t k; extern __typeof__ (SIZE_MAX) k; @@ -177,7 +170,7 @@ struct s { PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ + /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ int check_SIG_ATOMIC: SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) @@ -303,15 +296,16 @@ static const char *macro_values[] = HAVE_C99_STDINT_H=0 HAVE_SYS_BITYPES_H=0 HAVE_SYS_INTTYPES_H=0 - STDINT_H=stdint.h + GL_GENERATE_STDINT_H=true case "$gl_cv_header_working_stdint_h" in *yes) HAVE_C99_STDINT_H=1 dnl Now see whether the system <stdint.h> works without dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. - AC_CACHE_CHECK([whether stdint.h predates C++11], - [gl_cv_header_stdint_predates_cxx11_h], - [gl_cv_header_stdint_predates_cxx11_h=yes + dnl If not, there would be problems when stdint.h is included from C++. + AC_CACHE_CHECK([whether stdint.h works without ISO C predefines], + [gl_cv_header_stdint_without_STDC_macros], + [gl_cv_header_stdint_without_STDC_macros=no AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[ #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ @@ -322,13 +316,14 @@ gl_STDINT_INCLUDES intmax_t im = INTMAX_MAX; int32_t i32 = INT32_C (0x7fffffff); ]])], - [gl_cv_header_stdint_predates_cxx11_h=no])]) + [gl_cv_header_stdint_without_STDC_macros=yes]) + ]) - if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + if test $gl_cv_header_stdint_without_STDC_macros = no; then AC_DEFINE([__STDC_CONSTANT_MACROS], [1], - [Define to 1 if the system <stdint.h> predates C++11.]) + [Define to 1 if the system <stdint.h> predates C++11.]) AC_DEFINE([__STDC_LIMIT_MACROS], [1], - [Define to 1 if the system <stdint.h> predates C++11.]) + [Define to 1 if the system <stdint.h> predates C++11.]) fi AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], [gl_cv_header_stdint_width], @@ -346,7 +341,7 @@ int32_t i32 = INT32_C (0x7fffffff); ]])], [gl_cv_header_stdint_width=yes])]) if test "$gl_cv_header_stdint_width" = yes; then - STDINT_H= + GL_GENERATE_STDINT_H=false fi ;; *) @@ -364,14 +359,11 @@ int32_t i32 = INT32_C (0x7fffffff); esac dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. - LIMITS_H=limits.h - AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) + gl_REPLACE_LIMITS_H AC_SUBST([HAVE_C99_STDINT_H]) AC_SUBST([HAVE_SYS_BITYPES_H]) AC_SUBST([HAVE_SYS_INTTYPES_H]) - AC_SUBST([STDINT_H]) - AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) ]) dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) @@ -499,13 +491,9 @@ AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], dnl gl_STDINT_INCLUDES AC_DEFUN([gl_STDINT_INCLUDES], [[ - /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ #include <stddef.h> #include <signal.h> #if HAVE_WCHAR_H - # include <stdio.h> - # include <time.h> # include <wchar.h> #endif ]]) @@ -537,13 +525,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t. dnl Set the variable BITSIZEOF_WINT_T accordingly. - if test $GNULIB_OVERRIDES_WINT_T = 1; then + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then BITSIZEOF_WINT_T=32 fi ]) - -dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. -dnl Remove this when we can assume autoconf >= 2.61. -m4_ifdef([AC_COMPUTE_INT], [], [ - AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) -]) diff --git a/gnulib-m4/stdint_h.m4 b/gnulib-m4/stdint_h.m4 index 2d2a33c4..b8684b61 100644 --- a/gnulib-m4/stdint_h.m4 +++ b/gnulib-m4/stdint_h.m4 @@ -1,5 +1,5 @@ # stdint_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/stdio_h.m4 b/gnulib-m4/stdio_h.m4 index 0debe69e..cc80e773 100644 --- a/gnulib-m4/stdio_h.m4 +++ b/gnulib-m4/stdio_h.m4 @@ -1,11 +1,12 @@ -# stdio_h.m4 serial 49 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# stdio_h.m4 serial 57 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_STDIO_H], +AC_DEFUN_ONCE([gl_STDIO_H], [ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AH_VERBATIM([MINGW_ANSI_STDIO], [/* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO @@ -13,7 +14,6 @@ AC_DEFUN([gl_STDIO_H], #endif ]) AC_DEFINE([__USE_MINGW_ANSI_STDIO]) - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and @@ -40,17 +40,6 @@ AC_DEFUN([gl_STDIO_H], attribute "__gnu_printf__" instead of "__printf__"]) fi - dnl No need to create extra modules for these functions. Everyone who uses - dnl <stdio.h> likely needs them. - GNULIB_FSCANF=1 - gl_MODULE_INDICATOR([fscanf]) - GNULIB_SCANF=1 - gl_MODULE_INDICATOR([scanf]) - GNULIB_FGETC=1 - GNULIB_GETC=1 - GNULIB_GETCHAR=1 - GNULIB_FGETS=1 - GNULIB_FREAD=1 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result @@ -64,18 +53,6 @@ AC_DEFUN([gl_STDIO_H], fi ]) - dnl No need to create extra modules for these functions. Everyone who uses - dnl <stdio.h> likely needs them. - GNULIB_FPRINTF=1 - GNULIB_PRINTF=1 - GNULIB_VFPRINTF=1 - GNULIB_VPRINTF=1 - GNULIB_FPUTC=1 - GNULIB_PUTC=1 - GNULIB_PUTCHAR=1 - GNULIB_FPUTS=1 - GNULIB_PUTS=1 - GNULIB_FWRITE=1 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" dnl "expected source file, required through AC_LIBSOURCES, not found". It is dnl also an optimization, to avoid performing a configure check whose result @@ -107,73 +84,104 @@ AC_DEFUN([gl_STDIO_H], gl_WARN_ON_USE_PREPARE([[#include <stdio.h> ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen renameat snprintf tmpfile vdprintf vsnprintf]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS_ONCE([fcloseall]) + if test $ac_cv_have_decl_fcloseall = no; then + HAVE_DECL_FCLOSEALL=0 + fi ]) +# gl_STDIO_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDIO_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDIO_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN_GNU]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDIO_H_DEFAULTS], [ - GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) - GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE]) - GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN]) - GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH]) - GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC]) - GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS]) - GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN]) - GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF]) - GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX]) - GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE]) - GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC]) - GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS]) - GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD]) - GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN]) - GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF]) - GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK]) - GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO]) - GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL]) - GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO]) - GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE]) - GNULIB_GETC=0; AC_SUBST([GNULIB_GETC]) - GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR]) - GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM]) - GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE]) - GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) - GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) - GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE]) - GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR]) - GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN]) - GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF]) - GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX]) - GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC]) - GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR]) - GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS]) - GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE]) - GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME]) - GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT]) - GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF]) - GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF]) - GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX]) - GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING]) - GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE]) - GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE]) - GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) - GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF]) - GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF]) - GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) - GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF]) - GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX]) - GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF]) - GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) - GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) - GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) @@ -195,6 +203,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FOPEN_FOR_FOPEN_GNU=0; AC_SUBST([REPLACE_FOPEN_FOR_FOPEN_GNU]) REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) diff --git a/gnulib-m4/stdlib_h.m4 b/gnulib-m4/stdlib_h.m4 index 49dc5d59..9e209697 100644 --- a/gnulib-m4/stdlib_h.m4 +++ b/gnulib-m4/stdlib_h.m4 @@ -1,10 +1,10 @@ -# stdlib_h.m4 serial 45 -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +# stdlib_h.m4 serial 66 +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_STDLIB_H], +AC_DEFUN_ONCE([gl_STDLIB_H], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) gl_NEXT_HEADERS([stdlib.h]) @@ -22,71 +22,125 @@ AC_DEFUN([gl_STDLIB_H], #if HAVE_RANDOM_H # include <random.h> #endif - ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt - initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps - posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray - realpath rpmatch secure_getenv setenv setstate setstate_r srandom - srandom_r strtod strtoll strtoull unlockpt unsetenv]) + ]], [_Exit aligned_alloc atoll canonicalize_file_name free + getloadavg getsubopt grantpt + initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps + posix_memalign posix_openpt ptsname ptsname_r qsort_r + random random_r reallocarray realpath rpmatch secure_getenv setenv + setstate setstate_r srandom srandom_r + strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS_ONCE([ecvt]) + if test $ac_cv_have_decl_ecvt = no; then + HAVE_DECL_ECVT=0 + fi + AC_CHECK_DECLS_ONCE([fcvt]) + if test $ac_cv_have_decl_fcvt = no; then + HAVE_DECL_FCVT=0 + fi + AC_CHECK_DECLS_ONCE([gcvt]) + if test $ac_cv_have_decl_gcvt = no; then + HAVE_DECL_GCVT=0 + fi ]) +# gl_STDLIB_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STDLIB_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKSTEMPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_MEMALIGN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POSIX_OPENPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTSNAME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_QSORT_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOUL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOULL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYSTEM_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLOCKPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNSETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOMB]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ECVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GCVT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKTEMP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTENV], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) +]) + AC_DEFUN([gl_STDLIB_H_DEFAULTS], [ - GNULIB__EXIT=0; AC_SUBST([GNULIB__EXIT]) - GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL]) - GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX]) - GNULIB_CANONICALIZE_FILE_NAME=0; AC_SUBST([GNULIB_CANONICALIZE_FILE_NAME]) - GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG]) - GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT]) - GNULIB_GRANTPT=0; AC_SUBST([GNULIB_GRANTPT]) - GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX]) - GNULIB_MBTOWC=0; AC_SUBST([GNULIB_MBTOWC]) - GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP]) - GNULIB_MKOSTEMP=0; AC_SUBST([GNULIB_MKOSTEMP]) - GNULIB_MKOSTEMPS=0; AC_SUBST([GNULIB_MKOSTEMPS]) - GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP]) - GNULIB_MKSTEMPS=0; AC_SUBST([GNULIB_MKSTEMPS]) - GNULIB_POSIX_OPENPT=0; AC_SUBST([GNULIB_POSIX_OPENPT]) - GNULIB_PTSNAME=0; AC_SUBST([GNULIB_PTSNAME]) - GNULIB_PTSNAME_R=0; AC_SUBST([GNULIB_PTSNAME_R]) - GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV]) - GNULIB_QSORT_R=0; AC_SUBST([GNULIB_QSORT_R]) - GNULIB_RANDOM=0; AC_SUBST([GNULIB_RANDOM]) - GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R]) - GNULIB_REALLOCARRAY=0; AC_SUBST([GNULIB_REALLOCARRAY]) - GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX]) - GNULIB_REALPATH=0; AC_SUBST([GNULIB_REALPATH]) - GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH]) - GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV]) - GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV]) - GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD]) - GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) - GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL]) - GNULIB_SYSTEM_POSIX=0; AC_SUBST([GNULIB_SYSTEM_POSIX]) - GNULIB_UNLOCKPT=0; AC_SUBST([GNULIB_UNLOCKPT]) - GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV]) - GNULIB_WCTOMB=0; AC_SUBST([GNULIB_WCTOMB]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE__EXIT=1; AC_SUBST([HAVE__EXIT]) + HAVE_ALIGNED_ALLOC=1; AC_SUBST([HAVE_ALIGNED_ALLOC]) HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL]) HAVE_CANONICALIZE_FILE_NAME=1; AC_SUBST([HAVE_CANONICALIZE_FILE_NAME]) + HAVE_DECL_ECVT=1; AC_SUBST([HAVE_DECL_ECVT]) + HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) + HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) + HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) HAVE_DECL_INITSTATE=1; AC_SUBST([HAVE_DECL_INITSTATE]) + HAVE_MBTOWC=1; AC_SUBST([HAVE_MBTOWC]) HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP]) HAVE_MKOSTEMP=1; AC_SUBST([HAVE_MKOSTEMP]) HAVE_MKOSTEMPS=1; AC_SUBST([HAVE_MKOSTEMPS]) HAVE_MKSTEMP=1; AC_SUBST([HAVE_MKSTEMP]) HAVE_MKSTEMPS=1; AC_SUBST([HAVE_MKSTEMPS]) + HAVE_POSIX_MEMALIGN=1; AC_SUBST([HAVE_POSIX_MEMALIGN]) HAVE_POSIX_OPENPT=1; AC_SUBST([HAVE_POSIX_OPENPT]) HAVE_PTSNAME=1; AC_SUBST([HAVE_PTSNAME]) HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) @@ -100,28 +154,47 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SECURE_GETENV=1; AC_SUBST([HAVE_SECURE_GETENV]) HAVE_SETENV=1; AC_SUBST([HAVE_SETENV]) HAVE_DECL_SETENV=1; AC_SUBST([HAVE_DECL_SETENV]) + HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) + HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) + HAVE_STRTOUL=1; AC_SUBST([HAVE_STRTOUL]) HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) - REPLACE_CALLOC=0; AC_SUBST([REPLACE_CALLOC]) + REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) + REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) + REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) - REPLACE_MALLOC=0; AC_SUBST([REPLACE_MALLOC]) + REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) + REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) + REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) + REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) + REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) - REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) + REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) + REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) + REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) + REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) + REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) + REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) + REPLACE_STRTOUL=0; AC_SUBST([REPLACE_STRTOUL]) + REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) ]) diff --git a/gnulib-m4/strerror.m4 b/gnulib-m4/strerror.m4 index b886b8d6..4716649b 100644 --- a/gnulib-m4/strerror.m4 +++ b/gnulib-m4/strerror.m4 @@ -1,19 +1,19 @@ -# strerror.m4 serial 19 -dnl Copyright (C) 2002, 2007-2018 Free Software Foundation, Inc. +# strerror.m4 serial 23 +dnl Copyright (C) 2002, 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRERROR], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_HEADER_ERRNO_H]) AC_REQUIRE([gl_FUNC_STRERROR_0]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) ]) - if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then AC_CACHE_CHECK([for working strerror function], [gl_cv_func_working_strerror], [AC_RUN_IFELSE( @@ -26,8 +26,10 @@ AC_DEFUN([gl_FUNC_STRERROR], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_working_strerror="guessing no" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac ]) ]) @@ -80,10 +82,12 @@ AC_DEFUN([gl_FUNC_STRERROR_0], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; # Guess yes on native Windows. mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; - # If we don't know, assume the worst. - *) gl_cv_func_strerror_0_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gnulib-m4/strerror_r.m4 b/gnulib-m4/strerror_r.m4 new file mode 100644 index 00000000..23c3b423 --- /dev/null +++ b/gnulib-m4/strerror_r.m4 @@ -0,0 +1,176 @@ +# strerror_r.m4 serial 24 +dnl Copyright (C) 2002, 2007-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRERROR_R], +[ + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) + + dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT + dnl are not defined. + AC_CHECK_DECLS_ONCE([strerror_r]) + if test $ac_cv_have_decl_strerror_r = no; then + HAVE_DECL_STRERROR_R=0 + fi + + if test $ac_cv_func_strerror_r = yes; then + if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then + if test $gl_cv_func_strerror_r_posix_signature = yes; then + case "$gl_cv_func_strerror_r_works" in + dnl The system's strerror_r has bugs. Replace it. + *no) REPLACE_STRERROR_R=1 ;; + esac + else + dnl The system's strerror_r() has a wrong signature. Replace it. + REPLACE_STRERROR_R=1 + fi + else + dnl The system's strerror_r() cannot know about the new errno values we + dnl add to <errno.h>, or any fix for strerror(0). Replace it. + REPLACE_STRERROR_R=1 + fi + fi +]) + +# Prerequisites of lib/strerror_r.c. +AC_DEFUN([gl_PREREQ_STRERROR_R], [ + AC_REQUIRE([AC_FUNC_STRERROR_R]) + dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r. + AC_CHECK_FUNCS_ONCE([__xpg_strerror_r]) + AC_CHECK_FUNCS_ONCE([catgets]) + AC_CHECK_FUNCS_ONCE([snprintf]) +]) + +# Detect if strerror_r works, but without affecting whether a replacement +# strerror_r will be used. +AC_DEFUN([gl_FUNC_STRERROR_R_WORKS], +[ + AC_REQUIRE([gl_HEADER_ERRNO_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade Android <string.h> to use the GNU strerror_r API, + dnl and Solaris <string.h> to declare strerror_r. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gl_FUNC_STRERROR_0]) + + AC_CHECK_FUNCS_ONCE([strerror_r]) + if test $ac_cv_func_strerror_r = yes; then + if test "$GL_GENERATE_ERRNO_H:$REPLACE_STRERROR_0" = false:0; then + dnl The POSIX prototype is: int strerror_r (int, char *, size_t); + dnl glibc, Cygwin: char *strerror_r (int, char *, size_t); + dnl AIX 5.1, OSF/1 5.1: int strerror_r (int, char *, int); + AC_CACHE_CHECK([for strerror_r with POSIX signature], + [gl_cv_func_strerror_r_posix_signature], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <string.h> + int strerror_r (int, char *, size_t); + ]], + [])], + [gl_cv_func_strerror_r_posix_signature=yes], + [gl_cv_func_strerror_r_posix_signature=no]) + ]) + if test $gl_cv_func_strerror_r_posix_signature = yes; then + dnl AIX 6.1 strerror_r fails by returning -1, not an error number. + dnl HP-UX 11.31 strerror_r always fails when the buffer length argument + dnl is less than 80. + dnl FreeBSD 8.s strerror_r claims failure on 0 + dnl Mac OS X 10.5 strerror_r treats 0 like -1 + dnl Solaris 10 strerror_r corrupts errno on failure + AC_CACHE_CHECK([whether strerror_r works], + [gl_cv_func_strerror_r_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <errno.h> + #include <string.h> + ]], + [[int result = 0; + char buf[79]; + if (strerror_r (EACCES, buf, 0) < 0) + result |= 1; + errno = 0; + if (strerror_r (EACCES, buf, sizeof buf) != 0) + result |= 2; + strcpy (buf, "Unknown"); + if (strerror_r (0, buf, sizeof buf) != 0) + result |= 4; + if (errno) + result |= 8; + if (strstr (buf, "nknown") || strstr (buf, "ndefined")) + result |= 0x10; + errno = 0; + *buf = 0; + if (strerror_r (-3, buf, sizeof buf) < 0) + result |= 0x20; + if (errno) + result |= 0x40; + if (!*buf) + result |= 0x80; + return result; + ]])], + [gl_cv_func_strerror_r_works=yes], + [gl_cv_func_strerror_r_works=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no on AIX. + aix*) gl_cv_func_strerror_r_works="guessing no";; + # Guess no on HP-UX. + hpux*) gl_cv_func_strerror_r_works="guessing no";; + # Guess no on BSD variants. + *bsd*) gl_cv_func_strerror_r_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_strerror_r_works="guessing yes";; + esac +changequote([,])dnl + ]) + ]) + else + dnl The system's strerror() has a wrong signature. + dnl glibc >= 2.3.4 and cygwin 1.7.9 have a function __xpg_strerror_r. + AC_CHECK_FUNCS_ONCE([__xpg_strerror_r]) + dnl In glibc < 2.14, __xpg_strerror_r does not populate buf on failure. + dnl In cygwin < 1.7.10, __xpg_strerror_r clobbers strerror's buffer. + if test $ac_cv_func___xpg_strerror_r = yes; then + AC_CACHE_CHECK([whether __xpg_strerror_r works], + [gl_cv_func_strerror_r_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <errno.h> + #include <string.h> + extern + #ifdef __cplusplus + "C" + #endif + int __xpg_strerror_r(int, char *, size_t); + ]], + [[int result = 0; + char buf[256] = "^"; + char copy[256]; + char *str = strerror (-1); + strcpy (copy, str); + if (__xpg_strerror_r (-2, buf, 1) == 0) + result |= 1; + if (*buf) + result |= 2; + __xpg_strerror_r (-2, buf, 256); + if (strcmp (str, copy)) + result |= 4; + return result; + ]])], + [gl_cv_func_strerror_r_works=yes], + [gl_cv_func_strerror_r_works=no], + [dnl Guess no on all platforms that have __xpg_strerror_r, + dnl at least until fixed glibc and cygwin are more common. + gl_cv_func_strerror_r_works="$gl_cross_guess_normal" + ]) + ]) + fi + fi + fi + fi +]) diff --git a/gnulib-m4/string_h.m4 b/gnulib-m4/string_h.m4 index 97c80dcc..9e09b96e 100644 --- a/gnulib-m4/string_h.m4 +++ b/gnulib-m4/string_h.m4 @@ -1,25 +1,19 @@ # Configure a GNU-like replacement for <string.h>. -# Copyright (C) 2007-2018 Free Software Foundation, Inc. +# Copyright (C) 2007-2022 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 22 +# serial 34 # Written by Paul Eggert. -AC_DEFUN([gl_HEADER_STRING_H], +AC_DEFUN_ONCE([gl_STRING_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_STRING_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_STRING_H_BODY], -[ - AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_STRING_H_DEFAULTS]) gl_NEXT_HEADERS([string.h]) dnl Check for declarations of anything we want to poison if the @@ -29,64 +23,88 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], ]], [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r - strerror_r strsignal strverscmp]) + strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) +# gl_STRING_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_STRING_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_STRING_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) -AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) + dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized. + gl_STDLIB_H_REQUIRE_DEFAULTS + AC_REQUIRE([gl_STRING_H_DEFAULTS]) +]) + +AC_DEFUN([gl_STRING_H_DEFAULTS], [ - GNULIB_EXPLICIT_BZERO=0; AC_SUBST([GNULIB_EXPLICIT_BZERO]) - GNULIB_FFSL=0; AC_SUBST([GNULIB_FFSL]) - GNULIB_FFSLL=0; AC_SUBST([GNULIB_FFSLL]) - GNULIB_MEMCHR=0; AC_SUBST([GNULIB_MEMCHR]) - GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM]) - GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY]) - GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR]) - GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR]) - GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY]) - GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY]) - GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL]) - GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP]) - GNULIB_STRNCAT=0; AC_SUBST([GNULIB_STRNCAT]) - GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP]) - GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN]) - GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK]) - GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP]) - GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR]) - GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR]) - GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R]) - GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN]) - GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN]) - GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR]) - GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR]) - GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR]) - GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP]) - GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP]) - GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP]) - GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR]) - GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN]) - GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK]) - GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN]) - GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP]) - GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R]) - GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR]) - GNULIB_STRERROR_R=0; AC_SUBST([GNULIB_STRERROR_R]) - GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) - HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) + HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) - HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR]) HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) @@ -102,8 +120,12 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) + HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) + HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) + HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) @@ -117,6 +139,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS], REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) + REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) diff --git a/gnulib-m4/strncat.m4 b/gnulib-m4/strncat.m4 index b4fcbe2e..627280cf 100644 --- a/gnulib-m4/strncat.m4 +++ b/gnulib-m4/strncat.m4 @@ -1,12 +1,12 @@ -# strncat.m4 serial 4 -dnl Copyright (C) 2002-2004, 2009-2018 Free Software Foundation, Inc. +# strncat.m4 serial 6 +dnl Copyright (C) 2002-2004, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_FUNC_STRNCAT], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -31,7 +31,8 @@ AC_DEFUN_ONCE([gl_FUNC_STRNCAT], # define MAP_FILE 0 # endif #endif -]], [[ +]GL_MDA_DEFINES], +[[ char *fence = NULL; #if HAVE_SYS_MMAN_H && HAVE_MPROTECT # if HAVE_MAP_ANONYMOUS diff --git a/gnulib-m4/strstr.m4 b/gnulib-m4/strstr.m4 index aa590a97..6cc20727 100644 --- a/gnulib-m4/strstr.m4 +++ b/gnulib-m4/strstr.m4 @@ -1,5 +1,5 @@ -# strstr.m4 serial 19 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +# strstr.m4 serial 24 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -7,30 +7,40 @@ dnl with or without modifications, as long as this notice is preserved. dnl Check that strstr works. AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MEMCHR]) - if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then + if test $REPLACE_MEMCHR = 1; then REPLACE_STRSTR=1 else - dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092. + dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 + dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. AC_CACHE_CHECK([whether strstr works], [gl_cv_func_strstr_works_always], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ -#include <string.h> /* for strstr */ + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include <string.h> /* for __GNU_LIBRARY__, strstr */ +#ifdef __GNU_LIBRARY__ + #include <features.h> + #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28 + Unlucky user + #endif +#endif #define P "_EF_BF_BD" #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P #define NEEDLE P P P P P -]], [[return !!strstr (HAYSTACK, NEEDLE); - ]])], - [gl_cv_func_strstr_works_always=yes], - [gl_cv_func_strstr_works_always=no], - [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not - dnl affected, since it uses different source code for strstr than - dnl glibc. - dnl Assume that it works on all other platforms, even if it is not - dnl linear. - AC_EGREP_CPP([Lucky user], - [ +]], + [[return !!strstr (HAYSTACK, NEEDLE); + ]])], + [gl_cv_func_strstr_works_always=yes], + [gl_cv_func_strstr_works_always=no], + [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not + dnl affected, since it uses different source code for strstr than + dnl glibc. + dnl Assume that it works on all other platforms, even if it is not + dnl linear. + AC_EGREP_CPP([Lucky user], + [ +#include <string.h> /* for __GNU_LIBRARY__ */ #ifdef __GNU_LIBRARY__ #include <features.h> #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ @@ -45,10 +55,10 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], #else Lucky user #endif - ], - [gl_cv_func_strstr_works_always="guessing yes"], - [gl_cv_func_strstr_works_always="guessing no"]) - ]) + ], + [gl_cv_func_strstr_works_always="guessing yes"], + [gl_cv_func_strstr_works_always="$gl_cross_guess_normal"]) + ]) ]) case "$gl_cv_func_strstr_works_always" in *yes) ;; @@ -126,7 +136,7 @@ static void quit (int sig) { _exit (sig + 128); } #endif ], [gl_cv_func_strstr_linear="guessing yes"], - [gl_cv_func_strstr_linear="guessing no"]) + [gl_cv_func_strstr_linear="$gl_cross_guess_normal"]) ]) ]) case "$gl_cv_func_strstr_linear" in diff --git a/gnulib-m4/symlink.m4 b/gnulib-m4/symlink.m4 new file mode 100644 index 00000000..5be2babb --- /dev/null +++ b/gnulib-m4/symlink.m4 @@ -0,0 +1,55 @@ +# serial 9 +# See if we need to provide symlink replacement. + +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Written by Eric Blake. + +AC_DEFUN([gl_FUNC_SYMLINK], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([symlink]) + dnl The best we can do on mingw is provide a dummy that always fails, so + dnl that compilation can proceed with fewer ifdefs. On FreeBSD 7.2, AIX 7.1, + dnl and Solaris 9, we want to fix a bug with trailing slash handling. + if test $ac_cv_func_symlink = no; then + HAVE_SYMLINK=0 + else + AC_CACHE_CHECK([whether symlink handles trailing slash correctly], + [gl_cv_func_symlink_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include <unistd.h> + ]], + [[int result = 0; + if (!symlink ("a", "conftest.link/")) + result |= 1; + if (symlink ("conftest.f", "conftest.lnk2")) + result |= 2; + else if (!symlink ("a", "conftest.lnk2/")) + result |= 4; + return result; + ]])], + [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no], + [case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_symlink_works="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.f conftest.link conftest.lnk2]) + case "$gl_cv_func_symlink_works" in + *yes) ;; + *) + REPLACE_SYMLINK=1 + ;; + esac + fi +]) diff --git a/gnulib-m4/sys_ioctl_h.m4 b/gnulib-m4/sys_ioctl_h.m4 new file mode 100644 index 00000000..be653643 --- /dev/null +++ b/gnulib-m4/sys_ioctl_h.m4 @@ -0,0 +1,79 @@ +# sys_ioctl_h.m4 serial 15 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Bruno Haible. + +AC_DEFUN_ONCE([gl_SYS_IOCTL_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) + + AC_CHECK_HEADERS_ONCE([sys/ioctl.h]) + if test $ac_cv_header_sys_ioctl_h = yes; then + HAVE_SYS_IOCTL_H=1 + dnl Test whether <sys/ioctl.h> declares ioctl(), or whether some other + dnl header file, such as <unistd.h> or <stropts.h>, is needed for that. + AC_CACHE_CHECK([whether <sys/ioctl.h> declares ioctl], + [gl_cv_decl_ioctl_in_sys_ioctl_h], + [dnl We cannot use AC_CHECK_DECL because it produces its own messages. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/ioctl.h>]], + [[(void) ioctl;]])], + [gl_cv_decl_ioctl_in_sys_ioctl_h=yes], + [gl_cv_decl_ioctl_in_sys_ioctl_h=no]) + ]) + else + HAVE_SYS_IOCTL_H=0 + fi + AC_SUBST([HAVE_SYS_IOCTL_H]) + dnl <sys/ioctl.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/ioctl.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/ioctl.h> +/* Some platforms declare ioctl in the wrong header. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include <unistd.h> +#endif + ]], [ioctl]) +]) + +# gl_SYS_IOCTL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_IOCTL_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_IOCTL_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_IOCTL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_IOCTL]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_IOCTL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_IOCTL_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + SYS_IOCTL_H_HAVE_WINSOCK2_H=0; AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H]) + SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + AC_SUBST([SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) + REPLACE_IOCTL=0; AC_SUBST([REPLACE_IOCTL]) +]) diff --git a/gnulib-m4/sys_select_h.m4 b/gnulib-m4/sys_select_h.m4 new file mode 100644 index 00000000..2743cd17 --- /dev/null +++ b/gnulib-m4/sys_select_h.m4 @@ -0,0 +1,110 @@ +# sys_select_h.m4 serial 23 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SYS_SELECT_H], +[ + AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_CACHE_CHECK([whether <sys/select.h> is self-contained], + [gl_cv_header_sys_select_h_selfcontained], + [ + dnl Test against two bugs: + dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of + dnl <sys/types.h>. + dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration + dnl of 'struct timeval', and no definition of this type. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]], + [[struct timeval b;]])], + [gl_cv_header_sys_select_h_selfcontained=yes], + [gl_cv_header_sys_select_h_selfcontained=no]) + dnl Test against another bug: + dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation + dnl that relies on memset(), but without including <string.h>. + if test $gl_cv_header_sys_select_h_selfcontained = yes; then + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <sys/select.h>]], + [[int memset; int bzero;]]) + ], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[ + #undef memset + #define memset nonexistent_memset + extern + #ifdef __cplusplus + "C" + #endif + void *memset (void *, int, unsigned long); + #undef bzero + #define bzero nonexistent_bzero + extern + #ifdef __cplusplus + "C" + #endif + void bzero (void *, unsigned long); + fd_set fds; + FD_ZERO (&fds); + ]]) + ], + [], + [gl_cv_header_sys_select_h_selfcontained=no]) + ]) + fi + ]) + dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/select.h]) + if test $ac_cv_header_sys_select_h = yes; then + HAVE_SYS_SELECT_H=1 + else + HAVE_SYS_SELECT_H=0 + fi + AC_SUBST([HAVE_SYS_SELECT_H]) + gl_PREREQ_SYS_H_WINSOCK2 + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require prerequisite headers. */ +#include <sys/types.h> +#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H +# include <sys/time.h> +#endif +#include <sys/select.h> + ]], [pselect select]) +]) + +# gl_SYS_SELECT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_SELECT_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_SELECT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PSELECT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SELECT]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SELECT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT]) + REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT]) + REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT]) +]) diff --git a/gnulib-m4/sys_socket_h.m4 b/gnulib-m4/sys_socket_h.m4 index f2103787..ba3ae68e 100644 --- a/gnulib-m4/sys_socket_h.m4 +++ b/gnulib-m4/sys_socket_h.m4 @@ -1,12 +1,12 @@ -# sys_socket_h.m4 serial 23 -dnl Copyright (C) 2005-2018 Free Software Foundation, Inc. +# sys_socket_h.m4 serial 29 +dnl Copyright (C) 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Simon Josefsson. -AC_DEFUN([gl_HEADER_SYS_SOCKET], +AC_DEFUN_ONCE([gl_SYS_SOCKET_H], [ AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -22,6 +22,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], ;; esac + GL_GENERATE_SYS_SOCKET_H=false AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], [gl_cv_header_sys_socket_h_selfcontained], [ @@ -44,7 +45,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], [gl_cv_header_sys_socket_h_shut=no]) ]) if test $gl_cv_header_sys_socket_h_shut = no; then - SYS_SOCKET_H='sys/socket.h' + GL_GENERATE_SYS_SOCKET_H=true fi fi fi @@ -83,7 +84,7 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], fi if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then - SYS_SOCKET_H='sys/socket.h' + GL_GENERATE_SYS_SOCKET_H=true fi gl_PREREQ_SYS_H_WINSOCK2 @@ -95,6 +96,8 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], #include <sys/socket.h> ]], [socket connect accept bind getpeername getsockname getsockopt listen recv send recvfrom sendto setsockopt shutdown accept4]) + + AC_REQUIRE([AC_C_RESTRICT]) ]) AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], @@ -104,17 +107,11 @@ AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], gl_CHECK_NEXT_HEADERS([sys/socket.h]) if test $ac_cv_header_sys_socket_h = yes; then HAVE_SYS_SOCKET_H=1 - HAVE_WS2TCPIP_H=0 else HAVE_SYS_SOCKET_H=0 - if test $ac_cv_header_ws2tcpip_h = yes; then - HAVE_WS2TCPIP_H=1 - else - HAVE_WS2TCPIP_H=0 - fi fi AC_SUBST([HAVE_SYS_SOCKET_H]) - AC_SUBST([HAVE_WS2TCPIP_H]) + gl_PREREQ_SYS_H_WS2TCPIP ]) # Common prerequisites of the <sys/socket.h> replacement and of the @@ -142,32 +139,65 @@ AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], AC_SUBST([HAVE_WINSOCK2_H]) ]) +# Common prerequisites of the <sys/socket.h> replacement and of the +# <arpa/inet.h> replacement. +# Sets and substitutes HAVE_WS2TCPIP_H. +AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], +[ + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_WS2TCPIP_H]) +]) + +# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_SOCKET_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], [ - GNULIB_SOCKET=0; AC_SUBST([GNULIB_SOCKET]) - GNULIB_CONNECT=0; AC_SUBST([GNULIB_CONNECT]) - GNULIB_ACCEPT=0; AC_SUBST([GNULIB_ACCEPT]) - GNULIB_BIND=0; AC_SUBST([GNULIB_BIND]) - GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME]) - GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME]) - GNULIB_GETSOCKOPT=0; AC_SUBST([GNULIB_GETSOCKOPT]) - GNULIB_LISTEN=0; AC_SUBST([GNULIB_LISTEN]) - GNULIB_RECV=0; AC_SUBST([GNULIB_RECV]) - GNULIB_SEND=0; AC_SUBST([GNULIB_SEND]) - GNULIB_RECVFROM=0; AC_SUBST([GNULIB_RECVFROM]) - GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) - GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) - GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) - GNULIB_ACCEPT4=0; AC_SUBST([GNULIB_ACCEPT4]) HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) diff --git a/gnulib-m4/sys_stat_h.m4 b/gnulib-m4/sys_stat_h.m4 new file mode 100644 index 00000000..b5a9789b --- /dev/null +++ b/gnulib-m4/sys_stat_h.m4 @@ -0,0 +1,127 @@ +# sys_stat_h.m4 serial 41 -*- Autoconf -*- +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Eric Blake. +dnl Provide a GNU-like <sys/stat.h>. + +AC_DEFUN_ONCE([gl_SYS_STAT_H], +[ + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + dnl Check for broken stat macros. + AC_REQUIRE([AC_HEADER_STAT]) + + gl_CHECK_NEXT_HEADERS([sys/stat.h]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to enable precise timestamps in 'struct stat'. + m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [ + AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC]) + ], [ + WINDOWS_STAT_TIMESPEC=0 + ]) + AC_SUBST([WINDOWS_STAT_TIMESPEC]) + + dnl Whether to ensure that struct stat.st_size is 64-bit wide. + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([gl_LARGEFILE]) + ], [ + WINDOWS_64_BIT_ST_SIZE=0 + ]) + AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) + + dnl Define types that are supposed to be defined in <sys/types.h> or + dnl <sys/stat.h>. + AC_CHECK_TYPE([nlink_t], [], + [AC_DEFINE([nlink_t], [int], + [Define to the type of st_nlink in struct stat, or a supertype.])], + [#include <sys/types.h> + #include <sys/stat.h>]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h> + ]], [fchmodat fstat fstatat futimens getumask lchmod lstat + mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) + + AC_REQUIRE([AC_C_RESTRICT]) +]) + +# gl_SYS_STAT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_STAT_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) + HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) + HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) + HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK]) + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) + HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) + HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) + HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) + HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) + HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) + HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) + REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT]) + REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) + REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) + REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) + REPLACE_MKFIFOAT=0; AC_SUBST([REPLACE_MKFIFOAT]) + REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) + REPLACE_MKNODAT=0; AC_SUBST([REPLACE_MKNODAT]) + REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) + REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) +]) diff --git a/gnulib-m4/sys_time_h.m4 b/gnulib-m4/sys_time_h.m4 new file mode 100644 index 00000000..bc5e2b13 --- /dev/null +++ b/gnulib-m4/sys_time_h.m4 @@ -0,0 +1,120 @@ +# Configure a replacement for <sys/time.h>. +# serial 12 + +# Copyright (C) 2007, 2009-2022 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert and Martin Lambers. + +AC_DEFUN_ONCE([gl_SYS_TIME_H], +[ + dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement + dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1 + dnl statements that occur in other macros. + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + gl_CHECK_NEXT_HEADERS([sys/time.h]) + + if test $ac_cv_header_sys_time_h != yes; then + HAVE_SYS_TIME_H=0 + fi + + dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h> + dnl only. So include that header in the list. + gl_PREREQ_SYS_H_WINSOCK2 + AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <time.h> + #if HAVE_WINSOCK2_H + # include <winsock2.h> + #endif + ]], + [[static struct timeval x; x.tv_sec = x.tv_usec;]])], + [gl_cv_sys_struct_timeval=yes], + [gl_cv_sys_struct_timeval=no]) + ]) + if test $gl_cv_sys_struct_timeval != yes; then + HAVE_STRUCT_TIMEVAL=0 + else + dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined + dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only + dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is + dnl smaller than the 'time_t' type mandated by POSIX. + dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but + dnl that is good enough. + AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member], + [gl_cv_sys_struct_timeval_tv_sec], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if HAVE_SYS_TIME_H + #include <sys/time.h> + #endif + #include <time.h> + #if HAVE_WINSOCK2_H + # include <winsock2.h> + #endif + ]], + [[static struct timeval x; + typedef int verify_tv_sec_type[ + sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1 + ]; + ]])], + [gl_cv_sys_struct_timeval_tv_sec=yes], + [gl_cv_sys_struct_timeval_tv_sec=no]) + ]) + if test $gl_cv_sys_struct_timeval_tv_sec != yes; then + REPLACE_STRUCT_TIMEVAL=1 + fi + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +#if HAVE_SYS_TIME_H +# include <sys/time.h> +#endif +#include <time.h> + ]], [gettimeofday]) +]) + +# gl_SYS_TIME_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_TIME_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_TIME_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETTIMEOFDAY]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIME_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_TIME_H_DEFAULTS], +[ + dnl Assume POSIX behavior unless another module says otherwise. + HAVE_GETTIMEOFDAY=1; AC_SUBST([HAVE_GETTIMEOFDAY]) + HAVE_STRUCT_TIMEVAL=1; AC_SUBST([HAVE_STRUCT_TIMEVAL]) + HAVE_SYS_TIME_H=1; AC_SUBST([HAVE_SYS_TIME_H]) + REPLACE_GETTIMEOFDAY=0; AC_SUBST([REPLACE_GETTIMEOFDAY]) + REPLACE_STRUCT_TIMEVAL=0; AC_SUBST([REPLACE_STRUCT_TIMEVAL]) +]) diff --git a/gnulib-m4/sys_types_h.m4 b/gnulib-m4/sys_types_h.m4 index 2debfb0d..a5bef220 100644 --- a/gnulib-m4/sys_types_h.m4 +++ b/gnulib-m4/sys_types_h.m4 @@ -1,15 +1,16 @@ -# sys_types_h.m4 serial 9 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +# sys_types_h.m4 serial 13 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN_ONCE([gl_SYS_TYPES_H], [ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + dnl Use sane struct stat types in OpenVMS 8.2 and later. AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) - AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) gl_NEXT_HEADERS([sys/types.h]) dnl Ensure the type pid_t gets defined. @@ -30,31 +31,40 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], AC_SUBST([WINDOWS_STAT_INODES]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], [ ]) # This works around a buggy version in autoconf <= 2.69. # See <https://lists.gnu.org/r/autoconf/2016-08/msg00014.html> +# The 2.70 version isn't quoted properly, so override it too. -m4_version_prereq([2.70], [], [ - -# This is taken from the following Autoconf patch: -# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e17a30e987d7ee695fb4294a82d987ec3dc9b974 +m4_version_prereq([2.70.1], [], [ m4_undefine([AC_HEADER_MAJOR]) AC_DEFUN([AC_HEADER_MAJOR], [AC_CHECK_HEADERS_ONCE([sys/types.h]) AC_CHECK_HEADER([sys/mkdev.h], - [AC_DEFINE([MAJOR_IN_MKDEV], [1], - [Define to 1 if `major', `minor', and `makedev' are declared in - <mkdev.h>.])]) + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are + declared in <mkdev.h>.])]) if test $ac_cv_header_sys_mkdev_h = no; then AC_CHECK_HEADER([sys/sysmacros.h], - [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], - [Define to 1 if `major', `minor', and `makedev' are declared in - <sysmacros.h>.])]) + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' + are declared in <sysmacros.h>.])]) fi -]) +])# AC_HEADER_MAJOR ]) diff --git a/gnulib-m4/sys_uio_h.m4 b/gnulib-m4/sys_uio_h.m4 new file mode 100644 index 00000000..36f55ead --- /dev/null +++ b/gnulib-m4/sys_uio_h.m4 @@ -0,0 +1,46 @@ +# sys_uio_h.m4 serial 3 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SYS_UIO_H], +[ + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + dnl <sys/uio.h> is always overridden, because of GNULIB_POSIXCHECK. + gl_CHECK_NEXT_HEADERS([sys/uio.h]) + if test $ac_cv_header_sys_uio_h = yes; then + HAVE_SYS_UIO_H=1 + else + HAVE_SYS_UIO_H=0 + fi + AC_SUBST([HAVE_SYS_UIO_H]) +]) + +# gl_SYS_UIO_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_UIO_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_UIO_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_UIO_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_UIO_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_UIO_H_DEFAULTS], +[ +]) diff --git a/gnulib-m4/thread.m4 b/gnulib-m4/thread.m4 index 4048ac1f..1a8e543c 100644 --- a/gnulib-m4/thread.m4 +++ b/gnulib-m4/thread.m4 @@ -1,5 +1,5 @@ # thread.m4 serial 3 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/threadlib.m4 b/gnulib-m4/threadlib.m4 index 1f7b1341..ecb4970a 100644 --- a/gnulib-m4/threadlib.m4 +++ b/gnulib-m4/threadlib.m4 @@ -1,11 +1,388 @@ -# threadlib.m4 serial 13 -dnl Copyright (C) 2005-2018 Free Software Foundation, Inc. +# threadlib.m4 serial 32 +dnl Copyright (C) 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +AC_PREREQ([2.60]) + +dnl The general structure of the multithreading modules in gnulib is that we +dnl have three set of modules: +dnl +dnl * POSIX API: +dnl pthread, which combines +dnl pthread-h +dnl pthread-thread +dnl pthread-once +dnl pthread-mutex +dnl pthread-rwlock +dnl pthread-cond +dnl pthread-tss +dnl pthread-spin +dnl sched_yield +dnl +dnl * ISO C API: +dnl threads, which combines +dnl threads-h +dnl thrd +dnl mtx +dnl cnd +dnl tss +dnl +dnl * Gnulib API, with an implementation that can be chosen at configure +dnl time through the option --enable-threads=... +dnl thread +dnl lock +dnl cond +dnl tls +dnl yield +dnl +dnl They are independent, except for the fact that +dnl - the implementation of the ISO C API may use the POSIX (or some other +dnl platform dependent) API, +dnl - the implementation of the Gnulib API may use the POSIX or ISO C or +dnl some other platform dependent API, depending on the --enable-threads +dnl option. +dnl +dnl This file contains macros for all of these APIs! + +dnl ============================================================================ +dnl Macros for all thread APIs + +AC_DEFUN([gl_ANYTHREADLIB_EARLY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + if test -z "$gl_anythreadlib_early_done"; then + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks <pthread.h>. cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_LINK_IFELSE test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in <errno.h>. + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + gl_anythreadlib_early_done=done + fi +]) + +dnl Checks whether the compiler and linker support weak declarations of symbols. + +AC_DEFUN([gl_WEAK_SYMBOLS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether imported symbols can be declared weak], + [gl_cv_have_weak], + [case "$host_os" in + cygwin*) + dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but + dnl programs that use pthread_in_use() with weak symbol references + dnl crash miserably at runtime. + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no + dnl First, test whether the compiler accepts it syntactically. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[extern void xyzzy (); +#pragma weak xyzzy]], + [[xyzzy();]])], + [gl_cv_have_weak=maybe]) + if test $gl_cv_have_weak = maybe; then + dnl Second, test whether it actually works. On Cygwin 1.7.2, with + dnl gcc 4.3, symbols declared weak always evaluate to the address 0. + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <stdio.h> +#pragma weak fputs +int main () +{ + return (fputs == NULL); +}]])], + [gl_cv_have_weak=yes], + [gl_cv_have_weak=no], + [dnl When cross-compiling, assume that only ELF platforms support + dnl weak symbols. + AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_have_weak="guessing yes"], + [gl_cv_have_weak="guessing no"]) + ]) + fi + ;; + esac + dnl But when linking statically, weak symbols don't work. + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak + dnl symbol and linking against a shared library that has a dependency on + dnl the shared library that defines the symbol. + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 + cat <<EOF > conftest2.c +#include <pthread.h> +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + ]) + case "$gl_cv_have_weak" in + *yes) + AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], + [Define to 1 if the compiler and linker support weak declarations of symbols.]) + ;; + esac +]) + +dnl ============================================================================ +dnl Macros for the POSIX API + +dnl gl_PTHREADLIB +dnl ------------- +dnl Tests for the libraries needs for using the POSIX threads API. +dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile. +dnl Sets the variable LIBPMULTITHREAD, for programs that really need +dnl multithread functionality. The difference between LIBPTHREAD and +dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically +dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. +dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the +dnl sched_yield() function. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX +dnl threads API is available. + +dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_PTHREADLIB_BODY], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. + AC_CHECK_HEADER([pthread.h], + [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h> + pthread_mutex_t m; + pthread_mutexattr_t ma; + ]], + [[pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma);]])], + [gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread]) + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: LIBPTHREAD=$LIBPTHREAD" >&AS_MESSAGE_LOG_FD + + gl_pthread_in_glibc=no + # On Linux with glibc >= 2.34, libc contains the fully functional + # pthread functions. + case "$host_os" in + linux*) + AC_EGREP_CPP([Lucky user], + [#include <features.h> + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 34) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + ], + [gl_pthread_in_glibc=yes], + []) + ;; + esac + echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + AC_CHECK_LIB([pthread], [pthread_kill], + [if test $gl_pthread_in_glibc = yes; then + LIBPMULTITHREAD= + else + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + esac + fi + ]) + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + AC_CHECK_LIB([pthread], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread]) + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + AC_CHECK_LIB([c_r], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r]) + fi + fi + echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD + fi + AC_MSG_CHECKING([whether POSIX threads API is available]) + AC_MSG_RESULT([$gl_pthread_api]) + AC_SUBST([LIBPTHREAD]) + AC_SUBST([LIBPMULTITHREAD]) + if test $gl_pthread_api = yes; then + AC_DEFINE([HAVE_PTHREAD_API], [1], + [Define if you have the <pthread.h> header and the POSIX threads API.]) + fi + + dnl On some systems, sched_yield is in librt, rather than in libpthread. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sched.h>]], + [[sched_yield ();]])], + [LIB_SCHED_YIELD= + ], + [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. + AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], + [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. + AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) + ]) + AC_SUBST([LIB_SCHED_YIELD]) + + gl_pthreadlib_body_done=done + fi +]) + +AC_DEFUN([gl_PTHREADLIB], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + gl_PTHREADLIB_BODY +]) + +dnl ============================================================================ +dnl Macros for the ISO C API + +dnl gl_STDTHREADLIB +dnl --------------- +dnl Tests for the libraries needs for using the ISO C threads API. +dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads +dnl API is available. + +dnl The guts of gl_STDTHREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_STDTHREADLIB_BODY], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test -z "$gl_stdthreadlib_body_done"; then + AC_CHECK_HEADERS_ONCE([threads.h]) + + case "$host_os" in + mingw*) + LIBSTDTHREAD= + ;; + *) + gl_PTHREADLIB_BODY + if test $ac_cv_header_threads_h = yes; then + dnl glibc >= 2.29 has thrd_create in libpthread. + dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends + dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). + dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in + dnl libc. + AC_CHECK_FUNCS([thrd_create]) + if test $ac_cv_func_thrd_create = yes; then + LIBSTDTHREAD= + else + AC_CHECK_LIB([stdthreads], [thrd_create], [ + LIBSTDTHREAD='-lstdthreads -lpthread' + ], [ + dnl Guess that thrd_create is in libpthread. + LIBSTDTHREAD="$LIBPMULTITHREAD" + ]) + fi + else + dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. + LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + fi + ;; + esac + AC_SUBST([LIBSTDTHREAD]) + + AC_MSG_CHECKING([whether ISO C threads API is available]) + AC_MSG_RESULT([$ac_cv_header_threads_h]) + gl_stdthreadlib_body_done=done + fi +]) + +AC_DEFUN([gl_STDTHREADLIB], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + gl_STDTHREADLIB_BODY +]) + +dnl ============================================================================ +dnl Macros for the Gnulib API + dnl gl_THREADLIB dnl ------------ dnl Tests for a multithreading library to be used. @@ -14,8 +391,13 @@ dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the dnl default is 'no', otherwise it is system dependent. In both cases, the user dnl can change the choice through the options --enable-threads=choice or dnl --disable-threads. -dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, -dnl USE_PTH_THREADS, USE_WINDOWS_THREADS +dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, +dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS. +dnl The choice --enable-threads=isoc+posix is available only on platforms that +dnl have both the ISO C and the POSIX threads APIs. It has the effect of using +dnl the ISO C API for most things and the POSIX API only for creating and +dnl controlling threads (because there is no equivalent to pthread_atfork in +dnl the ISO C API). dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with dnl libtool). @@ -25,6 +407,9 @@ dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. +dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the +dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the +dnl same value. Only system libraries are needed. AC_DEFUN([gl_THREADLIB_EARLY], [ @@ -43,18 +428,15 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], AC_REQUIRE([AC_CANONICAL_HOST]) dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. - dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes - dnl AC_GNU_SOURCE. - m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], - [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], - [AC_REQUIRE([AC_GNU_SOURCE])]) + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl Check for multithreading. m4_ifdef([gl_THREADLIB_DEFAULT_NO], [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) + m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) AC_ARG_ENABLE([threads], -AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ -AC_HELP_STRING([--disable-threads], [build without multithread safety])]), +AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AS_HELP_STRING([--disable-threads], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" @@ -64,41 +446,35 @@ changequote(,)dnl dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). + osf*) gl_use_threads=no ;; dnl Disable multithreading by default on Cygwin 1.5.x, because it has dnl bugs that lead to endless loops or crashes. See dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. - osf*) gl_use_threads=no ;; cygwin*) case `uname -r` in 1.[0-5].*) gl_use_threads=no ;; *) gl_use_threads=yes ;; esac ;; + dnl Obey gl_AVOID_WINPTHREAD on mingw. + mingw*) + case "$gl_use_winpthreads_default" in + yes) gl_use_threads=posix ;; + no) gl_use_threads=windows ;; + *) gl_use_threads=yes ;; + esac + ;; *) gl_use_threads=yes ;; esac changequote([,])dnl fi ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # For using <pthread.h>: - case "$host_os" in - osf*) - # On OSF/1, the compiler needs the flag -D_REENTRANT so that it - # groks <pthread.h>. cc also understands the flag -pthread, but - # we don't use it because 1. gcc-2.95 doesn't understand -pthread, - # 2. putting a flag into CPPFLAGS that has an effect on the linker - # causes the AC_LINK_IFELSE test below to succeed unexpectedly, - # leading to wrong values of LIBTHREAD and LTLIBTHREAD. - CPPFLAGS="$CPPFLAGS -D_REENTRANT" - ;; - esac - # Some systems optimize for single-threaded programs by default, and - # need special flags to disable these optimizations. For example, the - # definition of 'errno' in <errno.h>. - case "$host_os" in - aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; - solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; - esac + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using <threads.h> or <pthread.h>: + gl_ANYTHREADLIB_EARLY fi ]) @@ -114,190 +490,69 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBMULTITHREAD= if test "$gl_use_threads" != no; then dnl Check whether the compiler and linker support weak declarations. - AC_CACHE_CHECK([whether imported symbols can be declared weak], - [gl_cv_have_weak], - [gl_cv_have_weak=no - dnl First, test whether the compiler accepts it syntactically. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[extern void xyzzy (); -#pragma weak xyzzy]], - [[xyzzy();]])], - [gl_cv_have_weak=maybe]) - if test $gl_cv_have_weak = maybe; then - dnl Second, test whether it actually works. On Cygwin 1.7.2, with - dnl gcc 4.3, symbols declared weak always evaluate to the address 0. - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include <stdio.h> -#pragma weak fputs -int main () -{ - return (fputs == NULL); -}]])], - [gl_cv_have_weak=yes], - [gl_cv_have_weak=no], - [dnl When cross-compiling, assume that only ELF platforms support - dnl weak symbols. - AC_EGREP_CPP([Extensible Linking Format], - [#ifdef __ELF__ - Extensible Linking Format - #endif - ], - [gl_cv_have_weak="guessing yes"], - [gl_cv_have_weak="guessing no"]) - ]) - fi - dnl But when linking statically, weak symbols don't work. - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac - ]) - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. - AC_CHECK_HEADER([pthread.h], - [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - gl_have_pthread= - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include <pthread.h> - pthread_mutex_t m; - pthread_mutexattr_t ma; - ]], - [[pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma);]])], - [gl_have_pthread=yes - LIBTHREAD=$gl_pthread LTLIBTHREAD=$gl_pthread - LIBMULTITHREAD=$gl_pthread LTLIBMULTITHREAD=$gl_pthread]) - LIBS=$save_LIBS - test -n "$gl_have_pthread" && break - done - - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - AC_CHECK_LIB([pthread], [pthread_kill], - [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - esac - ]) - elif test -z "$gl_have_pthread"; then - # Some library is needed. Try libpthread and libc_r. - AC_CHECK_LIB([pthread], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) - if test -z "$gl_have_pthread"; then - # For FreeBSD 4. - AC_CHECK_LIB([c_r], [pthread_kill], - [gl_have_pthread=yes - LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r - LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) - fi - fi - if test -n "$gl_have_pthread"; then + gl_WEAK_SYMBOLS + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + dnl If we use weak symbols to implement pthread_in_use / pth_in_use / + dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create + dnl facility is in use. + AC_CHECK_HEADERS_ONCE([threads.h]) + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + AC_CHECK_HEADERS_ONCE([threads.h]) + gl_have_isoc_threads="$ac_cv_header_threads_h" + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + gl_PTHREADLIB_BODY + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], + [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) + LIBTHREAD= LTLIBTHREAD= + else gl_threads_api=posix AC_DEFINE([USE_POSIX_THREADS], [1], [Define if the POSIX multithreading library can be used.]) - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then + AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], + [Define if references to the POSIX multithreading library are satisfied by libc.]) + else if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], [Define if references to the POSIX multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= + LIBTHREAD= LTLIBTHREAD= + else + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then + dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() + dnl etc. will succeed, we need a runtime test. + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + fi + ;; + esac fi fi fi fi fi - if test -z "$gl_have_pthread"; then - if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then - gl_have_solaristhread= - gl_save_LIBS="$LIBS" - LIBS="$LIBS -lthread" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include <thread.h> -#include <synch.h> - ]], - [[thr_self();]])], - [gl_have_solaristhread=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_solaristhread"; then - gl_threads_api=solaris - LIBTHREAD=-lthread - LTLIBTHREAD=-lthread - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_SOLARIS_THREADS], [1], - [Define if the old Solaris multithreading library can be used.]) - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], - [Define if references to the old Solaris multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - fi - fi - if test "$gl_use_threads" = pth; then - gl_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_LINKFLAGS([pth]) - gl_have_pth= - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBPTH" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])], - [gl_have_pth=yes]) - LIBS="$gl_save_LIBS" - if test -n "$gl_have_pth"; then - gl_threads_api=pth - LIBTHREAD="$LIBPTH" - LTLIBTHREAD="$LTLIBPTH" - LIBMULTITHREAD="$LIBTHREAD" - LTLIBMULTITHREAD="$LTLIBTHREAD" - AC_DEFINE([USE_PTH_THREADS], [1], - [Define if the GNU Pth multithreading library can be used.]) - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_PTH_THREADS_WEAK], [1], - [Define if references to the GNU Pth multithreading library should be made weak.]) - LIBTHREAD= - LTLIBTHREAD= - fi - fi - else - CPPFLAGS="$gl_save_CPPFLAGS" + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + gl_STDTHREADLIB_BODY + LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD + LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD + gl_threads_api=isoc + AC_DEFINE([USE_ISOC_THREADS], [1], + [Define if the ISO C multithreading library can be used.]) fi fi - if test -z "$gl_have_pthread"; then + if test $gl_threads_api = none; then case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in @@ -339,6 +594,21 @@ AC_DEFUN([gl_DISABLE_THREADS], [ ]) +dnl gl_AVOID_WINPTHREAD +dnl ------------------- +dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the +dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_AVOID_WINPTHREAD], [ + m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) +]) + + +dnl ============================================================================ + + dnl Survey of platforms: dnl dnl Platform Available Compiler Supports test-lock @@ -346,7 +616,9 @@ dnl flavours option weak result dnl --------------- --------- --------- -------- --------- dnl Linux 2.4/glibc posix -lpthread Y OK dnl -dnl GNU Hurd/glibc posix +dnl Linux/glibc 2.34 posix Y OK +dnl +dnl GNU Hurd/glibc posix -lpthread Y OK dnl dnl Ubuntu 14.04 posix -pthread Y OK dnl @@ -368,7 +640,6 @@ dnl dnl Mac OS X 10.[123] posix -lpthread Y OK dnl dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK -dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK dnl dnl HP-UX 11 posix -lpthread N (cc) OK dnl Y (gcc) @@ -382,8 +653,6 @@ dnl -lpthread (gcc) Y dnl dnl Cygwin posix -lpthread Y OK dnl -dnl Any of the above pth -lpth 0.0 -dnl dnl Mingw windows N OK dnl dnl BeOS 5 -- diff --git a/gnulib-m4/time_h.m4 b/gnulib-m4/time_h.m4 index ad6f2f59..98d7b6e0 100644 --- a/gnulib-m4/time_h.m4 +++ b/gnulib-m4/time_h.m4 @@ -1,8 +1,8 @@ # Configure a more-standard replacement for <time.h>. -# Copyright (C) 2000-2001, 2003-2007, 2009-2018 Free Software Foundation, Inc. +# Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc. -# serial 11 +# serial 19 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10,19 +10,32 @@ # Written by Paul Eggert and Jim Meyering. -AC_DEFUN([gl_HEADER_TIME_H], +AC_DEFUN_ONCE([gl_TIME_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. - AC_REQUIRE([gl_HEADER_TIME_H_BODY]) -]) + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_TIME_H_DEFAULTS]) -AC_DEFUN([gl_HEADER_TIME_H_BODY], -[ - AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CACHE_CHECK([for TIME_UTC in <time.h>], + [gl_cv_time_h_has_TIME_UTC], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include <time.h> + ]], + [[static int x = TIME_UTC; x++;]])], + [gl_cv_time_h_has_TIME_UTC=yes], + [gl_cv_time_h_has_TIME_UTC=no])]) + if test $gl_cv_time_h_has_TIME_UTC = yes; then + TIME_H_DEFINES_TIME_UTC=1 + else + TIME_H_DEFINES_TIME_UTC=0 + fi + AC_SUBST([TIME_H_DEFINES_TIME_UTC]) ]) dnl Check whether 'struct timespec' is declared @@ -93,33 +106,53 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) ]) +# gl_TIME_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_TIME_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_TIME_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) -AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS], +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) +]) + +AC_DEFUN([gl_TIME_H_DEFAULTS], [ - GNULIB_CTIME=0; AC_SUBST([GNULIB_CTIME]) - GNULIB_MKTIME=0; AC_SUBST([GNULIB_MKTIME]) - GNULIB_LOCALTIME=0; AC_SUBST([GNULIB_LOCALTIME]) - GNULIB_NANOSLEEP=0; AC_SUBST([GNULIB_NANOSLEEP]) - GNULIB_STRFTIME=0; AC_SUBST([GNULIB_STRFTIME]) - GNULIB_STRPTIME=0; AC_SUBST([GNULIB_STRPTIME]) - GNULIB_TIMEGM=0; AC_SUBST([GNULIB_TIMEGM]) - GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R]) - GNULIB_TIME_RZ=0; AC_SUBST([GNULIB_TIME_RZ]) - GNULIB_TZSET=0; AC_SUBST([GNULIB_TZSET]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) - HAVE_TZSET=1; AC_SUBST([HAVE_TZSET]) + HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) + HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) dnl Even GNU libc does not have timezone_t yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) dnl If another module says to replace or to not replace, do that. diff --git a/gnulib-m4/unistd_h.m4 b/gnulib-m4/unistd_h.m4 index 159c48ae..f93f97a1 100644 --- a/gnulib-m4/unistd_h.m4 +++ b/gnulib-m4/unistd_h.m4 @@ -1,15 +1,15 @@ -# unistd_h.m4 serial 73 -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +# unistd_h.m4 serial 90 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson, Bruno Haible. -AC_DEFUN([gl_UNISTD_H], +AC_DEFUN_ONCE([gl_UNISTD_H], [ - dnl Use AC_REQUIRE here, so that the default behavior below is expanded - dnl once only, before all statements that occur in other macros. + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([unistd.h]) @@ -41,154 +41,229 @@ AC_DEFUN([gl_UNISTD_H], # include <io.h> # endif #endif - ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat - fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups - gethostname getlogin getlogin_r getpagesize + ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess + execl execle execlp execv execve execvp execvpe + faccessat fchdir + fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize + getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass getusershell setusershell endusershell group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite readlink readlinkat rmdir sethostname sleep symlink symlinkat truncate ttyname_r unlink unlinkat usleep]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS_ONCE([execvpe]) + if test $ac_cv_have_decl_execvpe = no; then + HAVE_DECL_EXECVPE=0 + fi ]) +# gl_UNISTD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_UNISTD_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS_GNU]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) +]) + AC_DEFUN([gl_UNISTD_H_DEFAULTS], [ - GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_DUP=0; AC_SUBST([GNULIB_DUP]) - GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2]) - GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3]) - GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON]) - GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS]) - GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT]) - GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR]) - GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT]) - GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC]) - GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC]) - GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE]) - GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD]) - GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME]) - GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE]) - GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS]) - GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME]) - GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN]) - GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) - GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER]) - GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY]) - GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) - GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) - GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT]) - GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) - GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE]) - GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2]) - GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD]) - GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE]) - GNULIB_READ=0; AC_SUBST([GNULIB_READ]) - GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) - GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT]) - GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR]) - GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME]) - GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) - GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK]) - GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT]) - GNULIB_TRUNCATE=0; AC_SUBST([GNULIB_TRUNCATE]) - GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R]) - GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING]) - GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE]) - GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK]) - GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT]) - GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP]) - GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) - HAVE_DUP2=1; AC_SUBST([HAVE_DUP2]) - HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) - HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) - HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) - HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) - HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) - HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) - HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) - HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) - HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) - HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) - HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) - HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) - HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) - HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) - HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) - HAVE_LINK=1; AC_SUBST([HAVE_LINK]) - HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) - HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) - HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) - HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) - HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) - HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) - HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) - HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) - HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) - HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) - HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) - HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) - HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) - HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) - HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) - HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) - HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) - HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) - HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) - HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) - HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) - HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) - HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE]) - HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) - HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) - HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) - REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) - REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) - REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) - REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) - REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) - REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) - REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) - REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) - REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) - REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) - REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) - REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) - REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) - REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) - REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) - REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) - REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) - REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) - REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) - REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) - REPLACE_READ=0; AC_SUBST([REPLACE_READ]) - REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) - REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) - REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) - REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) - REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) - REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) - REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) - REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) - REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) - REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) - REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) - REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) - UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) + HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) + HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) + HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) + HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) + HAVE_EXECVPE=1; AC_SUBST([HAVE_EXECVPE]) + HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) + HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) + HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) + HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) + HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETENTROPY=1; AC_SUBST([HAVE_GETENTROPY]) + HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) + HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) + HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) + HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) + HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) + HAVE_LINK=1; AC_SUBST([HAVE_LINK]) + HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) + HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) + HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) + HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) + HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) + HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) + HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) + HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) + HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) + HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) + HAVE_DECL_EXECVPE=1; AC_SUBST([HAVE_DECL_EXECVPE]) + HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) + HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) + HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) + HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) + HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) + HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) + HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) + HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE]) + HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) + HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) + HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) + REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) + REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) + REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) + REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) + REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) + REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) + REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) + REPLACE_EXECV=0; AC_SUBST([REPLACE_EXECV]) + REPLACE_EXECVE=0; AC_SUBST([REPLACE_EXECVE]) + REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) + REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) + REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) + REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) + REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) + REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) + REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) + REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) + REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) + REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) + REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) + REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) + REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) + REPLACE_READ=0; AC_SUBST([REPLACE_READ]) + REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) + REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) + REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) + REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) + REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) + REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) + REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) + REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) + REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) + REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) + UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H]) + UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) ]) diff --git a/gnulib-m4/usleep.m4 b/gnulib-m4/usleep.m4 index 08842810..25d23f51 100644 --- a/gnulib-m4/usleep.m4 +++ b/gnulib-m4/usleep.m4 @@ -1,5 +1,5 @@ -# usleep.m4 serial 5 -dnl Copyright (C) 2009-2018 Free Software Foundation, Inc. +# usleep.m4 serial 7 +dnl Copyright (C) 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -31,10 +31,12 @@ AC_DEFUN([gl_FUNC_USLEEP], [case "$host_os" in # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_usleep_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_usleep_works="guessing yes" ;; # Guess no on native Windows. mingw*) gl_cv_func_usleep_works="guessing no" ;; - # If we don't know, assume the worst. - *) gl_cv_func_usleep_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_usleep_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_usleep_works" in diff --git a/gnulib-m4/vasnprintf.m4 b/gnulib-m4/vasnprintf.m4 index b3fda27e..afdece71 100644 --- a/gnulib-m4/vasnprintf.m4 +++ b/gnulib-m4/vasnprintf.m4 @@ -1,5 +1,5 @@ -# vasnprintf.m4 serial 36 -dnl Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc. +# vasnprintf.m4 serial 38 +dnl Copyright (C) 2002-2004, 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -32,7 +32,6 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], # Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) @@ -41,7 +40,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([gl_FEATURES_H]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) @@ -56,7 +54,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) @@ -77,6 +74,16 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], if the buffer had been large enough.]) ;; esac + dnl Additionally, the use of %n can be eliminated by assuming that snprintf + dnl always produces NUL-terminated strings (no truncation). + AC_REQUIRE([gl_SNPRINTF_TRUNCATION_C99]) + case "$gl_cv_func_snprintf_truncation_c99" in + *yes) + AC_DEFINE([HAVE_SNPRINTF_TRUNCATION_C99], [1], + [Define if the string produced by the snprintf function is always NUL + terminated.]) + ;; + esac ]) # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' diff --git a/gnulib-m4/visibility.m4 b/gnulib-m4/visibility.m4 new file mode 100644 index 00000000..4a212a4e --- /dev/null +++ b/gnulib-m4/visibility.m4 @@ -0,0 +1,82 @@ +# visibility.m4 serial 8 +dnl Copyright (C) 2005, 2008, 2010-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Tests whether the compiler supports the command-line option +dnl -fvisibility=hidden and the function and variable attributes +dnl __attribute__((__visibility__("hidden"))) and +dnl __attribute__((__visibility__("default"))). +dnl Does *not* test for __visibility__("protected") - which has tricky +dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on +dnl Mac OS X. +dnl Does *not* test for __visibility__("internal") - which has processor +dnl dependent semantics. +dnl Does *not* test for #pragma GCC visibility push(hidden) - which is +dnl "really only recommended for legacy code". +dnl Set the variable CFLAG_VISIBILITY. +dnl Defines and sets the variable HAVE_VISIBILITY. + +AC_DEFUN([gl_VISIBILITY], +[ + AC_REQUIRE([AC_PROG_CC]) + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + dnl First, check whether -Werror can be added to the command line, or + dnl whether it leads to an error because of some other option that the + dnl user has put into $CC $CFLAGS $CPPFLAGS. + AC_CACHE_CHECK([whether the -Werror option is usable], + [gl_cv_cc_vis_werror], + [gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [gl_cv_cc_vis_werror=yes], + [gl_cv_cc_vis_werror=no]) + CFLAGS="$gl_save_CFLAGS" + ]) + dnl Now check whether visibility declarations are supported. + AC_CACHE_CHECK([for simple visibility declarations], + [gl_cv_cc_visibility], + [gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + dnl We use the option -Werror and a function dummyfunc, because on some + dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning + dnl "visibility attribute not supported in this configuration; ignored" + dnl at the first function definition in every compilation unit, and we + dnl don't want to use the option in this case. + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void); + int hiddenvar; + int exportedvar; + int hiddenfunc (void) { return 51; } + int exportedfunc (void) { return 1225736919; } + void dummyfunc (void) {} + ]], + [[]])], + [gl_cv_cc_visibility=yes], + [gl_cv_cc_visibility=no]) + CFLAGS="$gl_save_CFLAGS" + ]) + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi + fi + AC_SUBST([CFLAG_VISIBILITY]) + AC_SUBST([HAVE_VISIBILITY]) + AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], + [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) +]) diff --git a/gnulib-m4/warn-on-use.m4 b/gnulib-m4/warn-on-use.m4 index e9c48bb5..d43355ab 100644 --- a/gnulib-m4/warn-on-use.m4 +++ b/gnulib-m4/warn-on-use.m4 @@ -1,11 +1,13 @@ -# warn-on-use.m4 serial 5 -dnl Copyright (C) 2010-2018 Free Software Foundation, Inc. +# warn-on-use.m4 serial 9 +dnl Copyright (C) 2010-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- +# If the module 'posixcheck' is in use: +# # For each whitespace-separated element in the list of NAMES, define # HAVE_RAW_DECL_name if the function has a declaration among INCLUDES # even after being undefined as a macro. @@ -23,25 +25,25 @@ dnl with or without modifications, as long as this notice is preserved. # needing gl_WARN_ON_USE_PREPARE. AC_DEFUN([gl_WARN_ON_USE_PREPARE], [ - m4_foreach_w([gl_decl], [$2], - [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), - [Define to 1 if ]m4_defn([gl_decl])[ is declared even after - undefining macros.])])dnl -dnl FIXME: gl_Symbol must be used unquoted until we can assume -dnl autoconf 2.64 or newer. - for gl_func in m4_flatten([$2]); do - AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl - AC_CACHE_CHECK([whether $gl_func is declared without a macro], - gl_Symbol, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], -[@%:@undef $gl_func - (void) $gl_func;])], - [AS_VAR_SET(gl_Symbol, [yes])], [AS_VAR_SET(gl_Symbol, [no])])]) - AS_VAR_IF(gl_Symbol, [yes], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) - dnl shortcut - if the raw declaration exists, then set a cache - dnl variable to allow skipping any later AC_CHECK_DECL efforts - eval ac_cv_have_decl_$gl_func=yes]) - AS_VAR_POPDEF([gl_Symbol])dnl - done + m4_ifdef([gl_POSIXCHECK], + [m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + [gl_Symbol], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], +[[#undef $gl_func + (void) $gl_func;]])], + [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) + AS_VAR_IF([gl_Symbol], [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done + ]) ]) diff --git a/gnulib-m4/wchar_h.m4 b/gnulib-m4/wchar_h.m4 index 416e0a1f..4baba1af 100644 --- a/gnulib-m4/wchar_h.m4 +++ b/gnulib-m4/wchar_h.m4 @@ -1,15 +1,15 @@ dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. -dnl Copyright (C) 2007-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 42 +# wchar_h.m4 serial 55 -AC_DEFUN([gl_WCHAR_H], +AC_DEFUN_ONCE([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) @@ -40,23 +40,24 @@ AC_DEFUN([gl_WCHAR_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> -#endif -#include <wchar.h> + #include <wchar.h> ]], [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb - wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset + wcsrtombs wcsnrtombs wcwidth + wmemchr wmemcmp wmemcpy wmemmove wmempcpy wmemset wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth wcsftime ]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS([wcsdup], [], [], [[ + #include <wchar.h> + ]]) + if test $ac_cv_have_decl_wcsdup = no; then + HAVE_DECL_WCSDUP=0 + fi ]) dnl Check whether <wchar.h> is usable at all. @@ -67,54 +68,49 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. + AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly], [gl_cv_header_wchar_h_correct_inline], [gl_cv_header_wchar_h_correct_inline=yes - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -extern int zero (void); -int main () { return zero(); } -]])]) - dnl Do not rename the object file from conftest.$ac_objext to - dnl conftest1.$ac_objext, as this will cause the link to fail on - dnl z/OS when using the XPLINK object format (due to duplicate - dnl CSECT names). Instead, temporarily redefine $ac_compile so - dnl that the object file has the latter name from the start. - save_ac_compile="$ac_compile" - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` - if AC_TRY_EVAL([ac_compile]); then - AC_LANG_CONFTEST([ - AC_LANG_SOURCE([[#define wcstod renamed_wcstod -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -int zero (void) { return 0; } -]])]) - dnl See note above about renaming object files. - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` - if AC_TRY_EVAL([ac_compile]); then - if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then - : - else - gl_cv_header_wchar_h_correct_inline=no + case "$host_os" in + *-gnu* | gnu*) + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[ + #define wcstod renamed_wcstod + #include <wchar.h> + extern int zero (void); + int main () { return zero(); } + ]])]) + dnl Do not rename the object file from conftest.$ac_objext to + dnl conftest1.$ac_objext, as this will cause the link to fail on + dnl z/OS when using the XPLINK object format (due to duplicate + dnl CSECT names). Instead, temporarily redefine $ac_compile so + dnl that the object file has the latter name from the start. + save_ac_compile="$ac_compile" + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` + if echo '#include "conftest.c"' >conftest1.c \ + && AC_TRY_EVAL([ac_compile]); then + AC_LANG_CONFTEST([ + AC_LANG_SOURCE([[ + #define wcstod renamed_wcstod + #include <wchar.h> + int zero (void) { return 0; } + ]])]) + dnl See note above about renaming object files. + ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` + if echo '#include "conftest.c"' >conftest2.c \ + && AC_TRY_EVAL([ac_compile]); then + if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then + : + else + gl_cv_header_wchar_h_correct_inline=no + fi + fi fi - fi - fi - ac_compile="$save_ac_compile" - rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext + ac_compile="$save_ac_compile" + rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext + ;; + esac ]) if test $gl_cv_header_wchar_h_correct_inline = no; then AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS). @@ -129,57 +125,77 @@ Configuration aborted.]) fi ]) +# gl_WCHAR_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_WCHAR_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_WCHAR_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOWC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTOB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSINIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOWCS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCRTOMB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCWIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMMOVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WMEMSET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCPNCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCOLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSXFRM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSCSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_WCHAR_H_MODULE_INDICATOR_DEFAULTS]) + dnl Make sure the shell variable for GNULIB_FREE_POSIX is initialized. + gl_STDLIB_H_REQUIRE_DEFAULTS + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) +]) + AC_DEFUN([gl_WCHAR_H_DEFAULTS], [ - GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC]) - GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB]) - GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT]) - GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC]) - GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN]) - GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS]) - GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS]) - GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB]) - GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS]) - GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) - GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) - GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR]) - GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP]) - GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY]) - GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE]) - GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET]) - GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN]) - GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN]) - GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY]) - GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY]) - GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY]) - GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY]) - GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT]) - GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT]) - GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP]) - GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP]) - GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP]) - GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP]) - GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL]) - GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM]) - GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP]) - GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR]) - GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR]) - GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN]) - GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN]) - GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK]) - GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR]) - GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK]) - GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH]) - GNULIB_WCSFTIME=0; AC_SUBST([GNULIB_WCSFTIME]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) @@ -194,6 +210,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP]) HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY]) HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE]) + HAVE_WMEMPCPY=1; AC_SUBST([HAVE_WMEMPCPY]) HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET]) HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN]) HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN]) @@ -220,6 +237,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) + HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) @@ -235,4 +253,5 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) + REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) ]) diff --git a/gnulib-m4/wchar_t.m4 b/gnulib-m4/wchar_t.m4 index 83bc3d5b..268e3e51 100644 --- a/gnulib-m4/wchar_t.m4 +++ b/gnulib-m4/wchar_t.m4 @@ -1,5 +1,5 @@ # wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2003, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/wcrtomb.m4 b/gnulib-m4/wcrtomb.m4 index c4e44630..fee21d7e 100644 --- a/gnulib-m4/wcrtomb.m4 +++ b/gnulib-m4/wcrtomb.m4 @@ -1,5 +1,5 @@ -# wcrtomb.m4 serial 12 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +# wcrtomb.m4 serial 17 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -15,15 +15,8 @@ AC_DEFUN([gl_FUNC_WCRTOMB], if test $ac_cv_func_wcrtomb = no; then HAVE_WCRTOMB=0 AC_CHECK_DECLS([wcrtomb],,, [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -]]) + #include <wchar.h> + ]]) if test $ac_cv_have_decl_wcrtomb = yes; then dnl On Minix 3.1.8, the system's <wchar.h> declares wcrtomb() although dnl it does not have the function. Avoid a collision with gnulib's @@ -31,17 +24,56 @@ AC_DEFUN([gl_FUNC_WCRTOMB], REPLACE_WCRTOMB=1 fi else - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_WCRTOMB=1 - else - dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes - dnl returns 0 instead of 1. + dnl We don't actually need to override wcrtomb when redefining the semantics + dnl of the mbstate_t type. Tested on 32-bit AIX. + dnl if test $REPLACE_MBSTATE_T = 1; then + dnl REPLACE_WCRTOMB=1 + dnl fi + if test $REPLACE_WCRTOMB = 0; then + dnl On Android 4.3, wcrtomb produces wrong characters in the C locale. + dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL) + dnl sometimes returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) AC_REQUIRE([gt_LOCALE_FR_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether wcrtomb works in the C locale], + [gl_cv_func_wcrtomb_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include <string.h> +#include <stdlib.h> +#include <wchar.h> +int main () +{ + mbstate_t state; + char out[64]; + int count; + memset (&state, 0, sizeof (state)); + out[0] = 'x'; + count = wcrtomb (out, L'a', &state); + return !(count == 1 && out[0] == 'a'); +}]])], + [gl_cv_func_wcrtomb_works=yes], + [gl_cv_func_wcrtomb_works=no], + [case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_wcrtomb_works="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_wcrtomb_works="guessing yes";; + esac + ]) + ]) + case "$gl_cv_func_wcrtomb_works" in + *yes) ;; + *) AC_DEFINE([WCRTOMB_C_LOCALE_BUG], [1], + [Define if the wcrtomb function does not work in the C locale.]) + REPLACE_WCRTOMB=1 ;; + esac + fi + if test $REPLACE_WCRTOMB = 0; then AC_CACHE_CHECK([whether wcrtomb return value is correct], [gl_cv_func_wcrtomb_retval], [ @@ -49,12 +81,10 @@ AC_DEFUN([gl_FUNC_WCRTOMB], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on AIX 4, OSF/1 and Solaris. - aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_wcrtomb_retval="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_wcrtomb_retval="guessing yes" ;; + # Guess no on AIX 4, OSF/1, Solaris, native Windows. + aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_wcrtomb_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then @@ -62,14 +92,8 @@ changequote([,])dnl [AC_LANG_SOURCE([[ #include <locale.h> #include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> +#include <stdlib.h> int main () { int result = 0; @@ -82,6 +106,12 @@ int main () { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; + { + wchar_t wc = (wchar_t) 0xBADFACE; + if (mbtowc (&wc, "\303\274", 2) == 2) + if (wcrtomb (NULL, wc, NULL) != 1) + result |= 2; + } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { @@ -102,7 +132,9 @@ int main () ]) case "$gl_cv_func_wcrtomb_retval" in *yes) ;; - *) REPLACE_WCRTOMB=1 ;; + *) AC_DEFINE([WCRTOMB_RETVAL_BUG], [1], + [Define if the wcrtomb function has an incorrect return value.]) + REPLACE_WCRTOMB=1 ;; esac fi fi diff --git a/gnulib-m4/wctob.m4 b/gnulib-m4/wctob.m4 index c7eeb5f7..af172cd1 100644 --- a/gnulib-m4/wctob.m4 +++ b/gnulib-m4/wctob.m4 @@ -1,5 +1,5 @@ -# wctob.m4 serial 11 -dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. +# wctob.m4 serial 13 +dnl Copyright (C) 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -43,13 +43,6 @@ changequote([,])dnl AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> register long global __asm__ ("%ebx"); @@ -74,14 +67,7 @@ int main () AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> +#include <stdlib.h> #include <wchar.h> int main () { @@ -108,15 +94,8 @@ int main () dnl IRIX 6.5 has the wctob() function but does not declare it. AC_CHECK_DECLS([wctob], [], [], [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -]]) + #include <wchar.h> + ]]) if test $ac_cv_have_decl_wctob != yes; then HAVE_DECL_WCTOB=0 fi diff --git a/gnulib-m4/wctomb.m4 b/gnulib-m4/wctomb.m4 index 962ed842..12329d8e 100644 --- a/gnulib-m4/wctomb.m4 +++ b/gnulib-m4/wctomb.m4 @@ -1,5 +1,5 @@ # wctomb.m4 serial 2 -dnl Copyright (C) 2011-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/wctype_h.m4 b/gnulib-m4/wctype_h.m4 index 15d1ef32..702cb39c 100644 --- a/gnulib-m4/wctype_h.m4 +++ b/gnulib-m4/wctype_h.m4 @@ -1,15 +1,15 @@ -# wctype_h.m4 serial 21 +# wctype_h.m4 serial 30 dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. -AC_DEFUN([gl_WCTYPE_H], +AC_DEFUN_ONCE([gl_WCTYPE_H], [ AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) AC_REQUIRE([AC_PROG_CC]) @@ -41,13 +41,6 @@ AC_DEFUN([gl_WCTYPE_H], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ - /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be - included before <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> - must be included before <wchar.h>. */ - #include <stddef.h> - #include <stdio.h> - #include <time.h> #include <wchar.h> #include <wctype.h> int main () { return iswprint ('x') == 0; } @@ -57,7 +50,7 @@ AC_DEFUN([gl_WCTYPE_H], AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> #if __GNU_LIBRARY__ == 1 Linux libc5 i18n is broken. - #endif]], [])], + #endif]], [[]])], [gl_cv_func_iswcntrl_works="guessing yes"], [gl_cv_func_iswcntrl_works="guessing no"]) ]) @@ -69,10 +62,14 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WCTYPE_H]) - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi AC_SUBST([REPLACE_ISWCNTRL]) if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then @@ -88,14 +85,7 @@ AC_DEFUN([gl_WCTYPE_H], REPLACE_TOWLOWER=0 else AC_CHECK_DECLS([towlower],,, - [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be - included before <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> - must be included before <wchar.h>. */ - #include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> + [[#include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif @@ -124,14 +114,7 @@ AC_DEFUN([gl_WCTYPE_H], AC_CACHE_CHECK([for wctype_t], [gl_cv_type_wctype_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be - included before <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> - must be included before <wchar.h>. */ - #include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> + [[#include <wchar.h> #if HAVE_WCTYPE_H # include <wctype.h> #endif @@ -150,14 +133,7 @@ AC_DEFUN([gl_WCTYPE_H], AC_CACHE_CHECK([for wctrans_t], [gl_cv_type_wctrans_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be - included before <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> - must be included before <wchar.h>. */ - #include <stddef.h> - #include <stdio.h> - #include <time.h> - #include <wchar.h> + [[#include <wchar.h> #include <wctype.h> wctrans_t a; ]], @@ -172,14 +148,7 @@ AC_DEFUN([gl_WCTYPE_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ #if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> # include <wchar.h> #endif #include <wctype.h> @@ -188,25 +157,44 @@ AC_DEFUN([gl_WCTYPE_H], ]) ]) +# gl_WCTYPE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. AC_DEFUN([gl_WCTYPE_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_WCTYPE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) dnl Define it also as a C macro, for the benefit of the unit tests. gl_MODULE_INDICATOR_FOR_TESTS([$1]) ]) +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_WCTYPE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWBLANK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTRANS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOWCTRANS]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_WCTYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) +]) + AC_DEFUN([gl_WCTYPE_H_DEFAULTS], [ - GNULIB_ISWBLANK=0; AC_SUBST([GNULIB_ISWBLANK]) - GNULIB_WCTYPE=0; AC_SUBST([GNULIB_WCTYPE]) - GNULIB_ISWCTYPE=0; AC_SUBST([GNULIB_ISWCTYPE]) - GNULIB_WCTRANS=0; AC_SUBST([GNULIB_WCTRANS]) - GNULIB_TOWCTRANS=0; AC_SUBST([GNULIB_TOWCTRANS]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ISWBLANK=1; AC_SUBST([HAVE_ISWBLANK]) HAVE_WCTYPE_T=1; AC_SUBST([HAVE_WCTYPE_T]) HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) + REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) + REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) ]) diff --git a/gnulib-m4/wcwidth.m4 b/gnulib-m4/wcwidth.m4 index 0605ce8c..9dd59579 100644 --- a/gnulib-m4/wcwidth.m4 +++ b/gnulib-m4/wcwidth.m4 @@ -1,5 +1,5 @@ -# wcwidth.m4 serial 26 -dnl Copyright (C) 2006-2018 Free Software Foundation, Inc. +# wcwidth.m4 serial 34 +dnl Copyright (C) 2006-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -19,17 +19,8 @@ AC_DEFUN([gl_FUNC_WCWIDTH], AC_CHECK_FUNCS_ONCE([wcwidth]) AC_CHECK_DECLS([wcwidth], [], [], [[ -/* AIX 3.2.5 declares wcwidth in <string.h>. */ -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> -]]) + #include <wchar.h> + ]]) if test $ac_cv_have_decl_wcwidth != yes; then HAVE_DECL_WCWIDTH=0 fi @@ -50,25 +41,20 @@ AC_DEFUN([gl_FUNC_WCWIDTH], if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then HAVE_WCWIDTH=1 dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. - dnl On OpenBSD 5.0, wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. - dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl On NetBSD 9.0, OpenBSD 5.0, MidnightBSD 1.1, + dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. + dnl On NetBSD 9.0, MidnightBSD 1.1, OSF/1 5.1, + dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0. dnl This leads to bugs in 'ls' (coreutils). + dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2, + dnl even in Western locales. AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], [gl_cv_func_wcwidth_works], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> -/* AIX 3.2.5 declares wcwidth in <string.h>. */ -#include <string.h> -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> #include <wchar.h> #if !HAVE_DECL_WCWIDTH extern @@ -80,7 +66,7 @@ int wcwidth (int); int main () { int result = 0; - if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL) + if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) { if (wcwidth (0x0301) > 0) result |= 1; @@ -90,6 +76,8 @@ int main () result |= 4; if (wcwidth (0xFF1A) == 0) result |= 8; + if (wcwidth (0x2202) > 1) + result |= 16; } return result; }]])], @@ -98,9 +86,13 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on glibc and AIX 7 systems. - *-gnu* | gnu* | aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; - *) gl_cv_func_wcwidth_works="guessing no";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on AIX 7 systems. + aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; + *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; esac changequote([,])dnl ]) @@ -115,3 +107,9 @@ changequote([,])dnl dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not dnl have the wcwidth function, then it does not declare it. ]) + +# Prerequisites of lib/wcwidth.c. +AC_DEFUN([gl_PREREQ_WCWIDTH], [ + AC_REQUIRE([AC_C_INLINE]) + : +]) diff --git a/gnulib-m4/wint_t.m4 b/gnulib-m4/wint_t.m4 index 95f68548..adc58661 100644 --- a/gnulib-m4/wint_t.m4 +++ b/gnulib-m4/wint_t.m4 @@ -1,5 +1,5 @@ -# wint_t.m4 serial 7 -dnl Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc. +# wint_t.m4 serial 11 +dnl Copyright (C) 2003, 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -14,15 +14,7 @@ AC_DEFUN([gt_TYPE_WINT_T], AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( - [[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included - before <wchar.h>. */ -#include <stddef.h> -#include <stdio.h> -#include <time.h> -#include <wchar.h> + [[#include <wchar.h> wint_t foo = (wchar_t)'\0';]], [[]])], [gt_cv_c_wint_t=yes], @@ -32,33 +24,24 @@ AC_DEFUN([gt_TYPE_WINT_T], dnl Determine whether gnulib's <wchar.h> or <wctype.h> would, if present, dnl override 'wint_t'. - AC_CACHE_CHECK([whether wint_t is too small], - [gl_cv_type_wint_t_too_small], + AC_CACHE_CHECK([whether wint_t is large enough], + [gl_cv_type_wint_t_large_enough], [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before - <wchar.h>. - BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be - included before <wchar.h>. */ -#if !(defined __GLIBC__ && !defined __UCLIBC__) -# include <stddef.h> -# include <stdio.h> -# include <time.h> -#endif -#include <wchar.h> + [AC_LANG_PROGRAM( + [[#include <wchar.h> int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; - ]])], - [gl_cv_type_wint_t_too_small=no], - [gl_cv_type_wint_t_too_small=yes])]) - if test $gl_cv_type_wint_t_too_small = yes; then - GNULIB_OVERRIDES_WINT_T=1 + ]])], + [gl_cv_type_wint_t_large_enough=yes], + [gl_cv_type_wint_t_large_enough=no])]) + if test $gl_cv_type_wint_t_large_enough = no; then + GNULIBHEADERS_OVERRIDE_WINT_T=1 else - GNULIB_OVERRIDES_WINT_T=0 + GNULIBHEADERS_OVERRIDE_WINT_T=0 fi else - GNULIB_OVERRIDES_WINT_T=0 + GNULIBHEADERS_OVERRIDE_WINT_T=0 fi - AC_SUBST([GNULIB_OVERRIDES_WINT_T]) + AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T]) ]) dnl Prerequisites of the 'wint_t' override. diff --git a/gnulib-m4/xalloc.m4 b/gnulib-m4/xalloc.m4 index 7bd360be..17a9c06d 100644 --- a/gnulib-m4/xalloc.m4 +++ b/gnulib-m4/xalloc.m4 @@ -1,5 +1,5 @@ # xalloc.m4 serial 18 -dnl Copyright (C) 2002-2006, 2009-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/xsize.m4 b/gnulib-m4/xsize.m4 index fc7c1ab3..0109049e 100644 --- a/gnulib-m4/xsize.m4 +++ b/gnulib-m4/xsize.m4 @@ -1,5 +1,5 @@ # xsize.m4 serial 5 -dnl Copyright (C) 2003-2004, 2008-2018 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2008-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/gnulib-m4/year2038.m4 b/gnulib-m4/year2038.m4 new file mode 100644 index 00000000..06db589b --- /dev/null +++ b/gnulib-m4/year2038.m4 @@ -0,0 +1,124 @@ +# year2038.m4 serial 7 +dnl Copyright (C) 2017-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Attempt to ensure that 'time_t' can go past the year 2038 and that +dnl the functions 'time', 'stat', etc. work with post-2038 timestamps. + +AC_DEFUN([gl_YEAR2038_EARLY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], + [For 64-bit time_t on 32-bit mingw.]) + ;; + esac +]) + +# gl_YEAR2038_TEST_INCLUDES +# ------------------------- +AC_DEFUN([gl_YEAR2038_TEST_INCLUDES], +[[ + #include <time.h> + /* Check that time_t can represent 2**32 - 1 correctly. */ + #define LARGE_TIME_T \\ + ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) + int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 + && LARGE_TIME_T % 65537 == 0) + ? 1 : -1]; +]]) + +# gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE) +----------------------------------------- +AC_DEFUN([gl_YEAR2038_BODY], +[ + AC_ARG_ENABLE([year2038], + [ --disable-year2038 omit support for timestamps past the year 2038]) + AS_IF([test "$enable_year2038" != no], + [ + dnl On many systems, time_t is already a 64-bit type. + dnl On those systems where time_t is still 32-bit, it requires kernel + dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux, + dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM. + dnl + dnl On native Windows, the system include files define types __time32_t + dnl and __time64_t. By default, time_t is an alias of + dnl - __time32_t on 32-bit mingw, + dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8). + dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an + dnl alias of __time64_t. + dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of + dnl __time32_t. + AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])], + [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no]) + ]) + if test "$gl_cv_type_time_t_y2038" = no; then + AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64], + [gl_cv_type_time_t_bits_macro], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[#define _TIME_BITS 64 + #define _FILE_OFFSET_BITS 64 + ]gl_YEAR2038_TEST_INCLUDES])], + [gl_cv_type_time_t_bits_macro=yes], + [gl_cv_type_time_t_bits_macro=no]) + ]) + if test "$gl_cv_type_time_t_bits_macro" = yes; then + AC_DEFINE([_TIME_BITS], [64], + [Number of bits in a timestamp, on hosts where this is settable.]) + dnl AC_SYS_LARGFILE also defines this; it's OK if we do too. + AC_DEFINE([_FILE_OFFSET_BITS], [64], + [Number of bits in a file offset, on hosts where this is settable.]) + gl_cv_type_time_t_y2038=yes + fi + fi + if test $gl_cv_type_time_t_y2038 = no; then + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _USE_32BIT_TIME_T + int ok; + #else + error fail + #endif + ]])], + [AC_MSG_FAILURE( + [The 'time_t' type stops working after January 2038. + Remove _USE_32BIT_TIME_T from the compiler flags.])], + [# If not cross-compiling and $1 says we should check, + # and 'touch' works with a large timestamp, then evidently wider time_t + # is desired and supported, so fail and ask the builder to fix the + # problem. Otherwise, just warn the builder. + m4_ifval([$1], + [if test $cross_compiling = no \ + && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then + case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in + *'Feb 7 2106'* | *'Feb 7 17:10'*) + AC_MSG_FAILURE( + [The 'time_t' type stops working after January 2038, + and your system appears to support a wider 'time_t'. + Try configuring with 'CC="${CC} -m64"'. + To build with a 32-bit time_t anyway (not recommended), + configure with '--disable-year2038'.]);; + esac + rm -f conftest.time + fi]) + if test "$gl_warned_about_y2038" != yes; then + AC_MSG_WARN( + [The 'time_t' type stops working after January 2038, + and this package needs a wider 'time_t' type + if there is any way to access timestamps after that. + Configure with 'CC="${CC} -m64"' perhaps?]) + gl_warned_about_y2038=yes + fi + ]) + fi]) +]) + +AC_DEFUN([gl_YEAR2038], +[ + gl_YEAR2038_BODY([require-year2038-safe]) +]) diff --git a/gnulib-m4/yield.m4 b/gnulib-m4/yield.m4 index 2a7c9077..58bdb519 100644 --- a/gnulib-m4/yield.m4 +++ b/gnulib-m4/yield.m4 @@ -1,19 +1,18 @@ -# yield.m4 serial 2 -dnl Copyright (C) 2005-2018 Free Software Foundation, Inc. +# yield.m4 serial 4 +dnl Copyright (C) 2005-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_YIELD], [ + AC_REQUIRE([gl_PTHREADLIB]) AC_REQUIRE([gl_THREADLIB]) - dnl On some systems, sched_yield is in librt, rather than in libpthread. - YIELD_LIB= + if test $gl_threads_api = posix; then - dnl Solaris has sched_yield in librt, not in libpthread or libc. - AC_CHECK_LIB([rt], [sched_yield], [YIELD_LIB=-lrt], - [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. - AC_CHECK_LIB([posix4], [sched_yield], [YIELD_LIB=-lposix4])]) + YIELD_LIB="$LIB_SCHED_YIELD" + else + YIELD_LIB= fi AC_SUBST([YIELD_LIB]) ]) diff --git a/gnulib-m4/zzgnulib.m4 b/gnulib-m4/zzgnulib.m4 new file mode 100644 index 00000000..fd73a201 --- /dev/null +++ b/gnulib-m4/zzgnulib.m4 @@ -0,0 +1,23 @@ +# zzgnulib.m4 serial 1 +dnl Copyright (C) 2020-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This file must be named something that sorts after all other +dnl package- or gnulib-provided .m4 files - at least for those packages +dnl that redefine AC_PROG_CC. + +dnl Redefine AC_PROG_CC so that it ends with invocations of gl_COMPILER_CLANG +dnl and gl_COMPILER_PREPARE_CHECK_DECL. +m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[ +gl_COMPILER_CLANG +gl_COMPILER_PREPARE_CHECK_DECL +]) + +# gl_ZZGNULIB +# ----------- +# Witness macro that this file has been included. Needed to force +# Automake to include this file after all other gnulib .m4 files. +AC_DEFUN([gl_ZZGNULIB]) |