From b4a80f4239b19fea4d2cc3e9d197f24b809f0624 Mon Sep 17 00:00:00 2001 From: Daniel Llorens Date: Mon, 16 Aug 2021 13:23:27 +0200 Subject: Update gnulib to 8f4538a53d64054ae2fc8b86c0f87c418c6176e6 Includes gnulib:0c907f7da13232908f05c415b8cec56024071906 to fix #49930 https://lists.gnu.org/archive/html/bug-guile/2021-08/msg00003.html. --- m4/arpa_inet_h.m4 | 31 +++++-- m4/dirent_h.m4 | 45 +++++++---- m4/environ.m4 | 5 +- m4/fcntl_h.m4 | 39 ++++++--- m4/flock.m4 | 4 +- m4/fstat.m4 | 4 +- m4/getaddrinfo.m4 | 10 +-- m4/gnulib-common.m4 | 140 +++++++++++++++++++++++++++----- m4/gnulib-comp.m4 | 140 +++++++++++++++++++++----------- m4/hostent.m4 | 4 +- m4/iconv_h.m4 | 27 +++++-- m4/inttypes.m4 | 31 +++++-- m4/langinfo_h.m4 | 25 ++++-- m4/largefile.m4 | 28 ++++--- m4/limits-h.m4 | 3 +- m4/locale_h.m4 | 37 ++++++--- m4/malloc.m4 | 152 ++++++++++++++++++++++++++--------- m4/math_h.m4 | 227 ++++++++++++++++++++++++++++------------------------ m4/memchr.m4 | 4 +- m4/mempcpy.m4 | 4 +- m4/mktime.m4 | 4 +- m4/netdb_h.m4 | 25 ++++-- m4/poll_h.m4 | 29 +++++-- m4/printf.m4 | 5 +- m4/rawmemchr.m4 | 4 +- m4/realloc.m4 | 47 ++++------- m4/regex.m4 | 44 +++++++++- m4/select.m4 | 4 +- m4/servent.m4 | 4 +- m4/signal_h.m4 | 33 +++++--- m4/sockpfaf.m4 | 6 +- m4/stat.m4 | 4 +- m4/stddef_h.m4 | 23 +++++- m4/stdint.m4 | 6 +- m4/stdio_h.m4 | 168 ++++++++++++++++++-------------------- m4/stdlib_h.m4 | 116 +++++++++++++++------------ m4/strdup.m4 | 6 +- m4/string_h.m4 | 124 +++++++++++++++------------- m4/sys_file_h.m4 | 29 +++++-- m4/sys_random_h.m4 | 25 ++++-- m4/sys_select_h.m4 | 29 +++++-- m4/sys_socket_h.m4 | 53 +++++++----- m4/sys_stat_h.m4 | 65 +++++++++------ m4/sys_time_h.m4 | 34 +++++--- m4/sys_times_h.m4 | 25 ++++-- m4/sys_types_h.m4 | 16 +++- m4/sys_uio_h.m4 | 23 +++++- m4/threadlib.m4 | 64 +++++++++++---- m4/time_h.m4 | 62 ++++++++------ m4/time_r.m4 | 2 +- m4/time_rz.m4 | 2 +- m4/timegm.m4 | 4 +- m4/tzset.m4 | 4 +- m4/unistd_h.m4 | 194 ++++++++++++++++++++++++-------------------- m4/visibility.m4 | 6 +- m4/wchar_h.m4 | 109 ++++++++++++++----------- m4/wctype_h.m4 | 39 ++++++--- m4/wint_t.m4 | 10 +-- m4/year2038.m4 | 124 ++++++++++++++++++++++++++++ 59 files changed, 1662 insertions(+), 869 deletions(-) create mode 100644 m4/year2038.m4 (limited to 'm4') diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index c4e386d1f..a3ba25624 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -1,4 +1,4 @@ -# arpa_inet_h.m4 serial 14 +# arpa_inet_h.m4 serial 17 dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Simon Josefsson and Bruno Haible -AC_DEFUN([gl_HEADER_ARPA_INET], +AC_DEFUN_ONCE([gl_ARPA_INET_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_ARPA_INET_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([arpa/inet.h]) @@ -40,17 +40,32 @@ AC_DEFUN([gl_HEADER_ARPA_INET], ]], [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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + 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], [ - GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP]) - GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON]) 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]) diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4 index 6d8614258..17e2a20c5 100644 --- a/m4/dirent_h.m4 +++ b/m4/dirent_h.m4 @@ -1,4 +1,4 @@ -# dirent_h.m4 serial 16 +# dirent_h.m4 serial 19 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. -AC_DEFUN([gl_DIRENT_H], +AC_DEFUN_ONCE([gl_DIRENT_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_DIRENT_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. @@ -27,26 +27,41 @@ AC_DEFUN([gl_DIRENT_H], ]], [alphasort closedir dirfd fdopendir opendir readdir rewinddir scandir]) ]) +# gl_DIRENT_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_DIRENT_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_DIRENT_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_DIRENT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REWINDDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSEDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DIRFD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPENDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALPHASORT]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_DIRENT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_DIRENT_H_DEFAULTS]) +]) + AC_DEFUN([gl_DIRENT_H_DEFAULTS], [ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - GNULIB_OPENDIR=0; AC_SUBST([GNULIB_OPENDIR]) - GNULIB_READDIR=0; AC_SUBST([GNULIB_READDIR]) - GNULIB_REWINDDIR=0; AC_SUBST([GNULIB_REWINDDIR]) - GNULIB_CLOSEDIR=0; AC_SUBST([GNULIB_CLOSEDIR]) - GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD]) - GNULIB_FDOPENDIR=0; AC_SUBST([GNULIB_FDOPENDIR]) - GNULIB_SCANDIR=0; AC_SUBST([GNULIB_SCANDIR]) - GNULIB_ALPHASORT=0; AC_SUBST([GNULIB_ALPHASORT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_OPENDIR=1; AC_SUBST([HAVE_OPENDIR]) HAVE_READDIR=1; AC_SUBST([HAVE_READDIR]) diff --git a/m4/environ.m4 b/m4/environ.m4 index d97177086..ae5329108 100644 --- a/m4/environ.m4 +++ b/m4/environ.m4 @@ -1,4 +1,4 @@ -# environ.m4 serial 7 +# environ.m4 serial 8 dnl Copyright (C) 2001-2004, 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -33,7 +33,8 @@ AC_DEFUN([gt_CHECK_VAR_DECL], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[$1 - extern struct { int foo; } $2;]], + typedef struct { int foo; } foo_t; + extern foo_t $2;]], [[$2.foo = 1;]])], [gt_cv_var=no], [gt_cv_var=yes])]) diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index e63a82f10..aba44735d 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 17 +# serial 20 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Paul Eggert. -AC_DEFUN([gl_FCNTL_H], +AC_DEFUN_ONCE([gl_FCNTL_H], [ AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) AC_REQUIRE([gl_FCNTL_O_FLAGS]) @@ -26,25 +26,40 @@ AC_DEFUN([gl_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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + 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], [ - GNULIB_CREAT=0; AC_SUBST([GNULIB_CREAT]) - GNULIB_FCNTL=0; AC_SUBST([GNULIB_FCNTL]) - GNULIB_NONBLOCKING=0; AC_SUBST([GNULIB_NONBLOCKING]) - GNULIB_OPEN=0; AC_SUBST([GNULIB_OPEN]) - GNULIB_OPENAT=0; AC_SUBST([GNULIB_OPENAT]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_CREAT=1; AC_SUBST([GNULIB_MDA_CREAT]) - GNULIB_MDA_OPEN=1; AC_SUBST([GNULIB_MDA_OPEN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) diff --git a/m4/flock.m4 b/m4/flock.m4 index eb46642d8..e1e5fe030 100644 --- a/m4/flock.m4 +++ b/m4/flock.m4 @@ -1,4 +1,4 @@ -# flock.m4 serial 3 +# flock.m4 serial 4 dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FLOCK], [ - AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([flock]) if test $ac_cv_func_flock = no; then HAVE_FLOCK=0 diff --git a/m4/fstat.m4 b/m4/fstat.m4 index 3b5b238fa..cdaca80da 100644 --- a/m4/fstat.m4 +++ b/m4/fstat.m4 @@ -1,4 +1,4 @@ -# fstat.m4 serial 7 +# fstat.m4 serial 8 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_FSTAT], # Prerequisites of lib/fstat.c and lib/stat-w32.c. AC_DEFUN([gl_PREREQ_FSTAT], [ - AC_REQUIRE([gl_HEADER_SYS_STAT_H]) + AC_REQUIRE([gl_SYS_STAT_H]) AC_REQUIRE([gl_PREREQ_STAT_W32]) : ]) diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4 index 97889a8b5..3f8e04f9b 100644 --- a/m4/getaddrinfo.m4 +++ b/m4/getaddrinfo.m4 @@ -1,4 +1,4 @@ -# getaddrinfo.m4 serial 33 +# getaddrinfo.m4 serial 34 dnl Copyright (C) 2004-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,8 +6,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_GETADDRINFO], [ - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H - AC_REQUIRE([gl_HEADER_NETDB])dnl for HAVE_NETDB_H + AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H + AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H GETADDRINFO_LIB= gai_saved_LIBS="$LIBS" @@ -156,13 +156,13 @@ const char *gai_strerror(int);]])], # Prerequisites of lib/netdb.in.h and lib/getaddrinfo.c. AC_DEFUN([gl_PREREQ_GETADDRINFO], [ AC_REQUIRE([gl_NETDB_H_DEFAULTS]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H + AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_REQUIRE([gl_HOSTENT]) dnl for HOSTENT_LIB AC_REQUIRE([gl_SERVENT]) dnl for SERVENT_LIB AC_REQUIRE([gl_FUNC_INET_NTOP]) dnl for INET_NTOP_LIB AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_SOCKET_FAMILIES]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) dnl Including sys/socket.h is wrong for Windows, but Windows does not diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index f2eff10de..c801b3de9 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 63 +# gnulib-common.m4 serial 67 dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -85,12 +85,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # 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_malloc _GL_GNUC_PREREQ (3, 0) # 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) @@ -103,6 +103,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # 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_HAS_C_ATTRIBUTE(attr) 0 +#endif + ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. [ #if _GL_HAS_ATTRIBUTE (alloc_size) @@ -142,7 +148,20 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_CONST #endif -#if 201710L < __STDC_VERSION__ +/* _GL_ATTRIBUTE_DEALLOC (F, I) is for functions returning pointers + that can be freed by passing them as the Ith argument to the + function F. _GL_ATTRIBUTE_DEALLOC_FREE is for functions that + return pointers that can be freed via 'free'; it can be used + only after including stdlib.h. These macros 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) + +#if _GL_HAS_C_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] #elif _GL_HAS_ATTRIBUTE (deprecated) # define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) @@ -168,7 +187,7 @@ AC_DEFUN([gl_COMMON_BODY], [ #endif /* FALLTHROUGH is special, because it always expands to something. */ -#if 201710L < __STDC_VERSION__ +#if _GL_HAS_C_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] #elif _GL_HAS_ATTRIBUTE (fallthrough) # define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) @@ -188,6 +207,12 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_LEAF #endif +#if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +#else +# define _GL_ATTRIBUTE_MALLOC +#endif + /* 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__)) @@ -195,24 +220,15 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_MAY_ALIAS #endif -#if 201710L < __STDC_VERSION__ +#if _GL_HAS_C_ATTRIBUTE (maybe_unused) # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] -#elif _GL_HAS_ATTRIBUTE (unused) -# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) #else -# define _GL_ATTRIBUTE_MAYBE_UNUSED +# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED #endif /* Earlier spellings of this macro. */ -#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED #define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED -#if _GL_HAS_ATTRIBUTE (malloc) -# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -#else -# define _GL_ATTRIBUTE_MALLOC -#endif - -#if 201710L < __STDC_VERSION__ +#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__)) @@ -270,11 +286,19 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_ATTRIBUTE_SENTINEL(pos) #endif +#if _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_ATTRIBUTE_UNUSED +#endif +/* Earlier spellings of this macro. */ +#define _GL_UNUSED _GL_ATTRIBUTE_UNUSED + ]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. [ /* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ #if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) -# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED #else # define _GL_UNUSED_LABEL #endif @@ -357,6 +381,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 @@ -369,9 +403,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]) ]) @@ -656,6 +690,72 @@ AC_DEFUN([gl_CACHE_VAL_SILENT], ]) ]) +# 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 + gl_cv_cc_wallow=none + fi + rm -f conftest* + ]) + 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 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 diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 1290d7589..0ae96ead7 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -142,6 +142,7 @@ AC_DEFUN([gl_EARLY], # Code from module langinfo: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) + AC_REQUIRE([gl_YEAR2038_EARLY]) # Code from module ldexp: # Code from module lib-symbol-versions: # Code from module lib-symbol-visibility: @@ -281,9 +282,11 @@ 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' - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([accept]) fi @@ -291,9 +294,10 @@ AC_DEFUN([gl_INIT], gl_FUNC_ACCEPT4 gl_SYS_SOCKET_MODULE_INDICATOR([accept4]) gl_FUNC_ALLOCA - gl_HEADER_ARPA_INET + gl_ARPA_INET_H + gl_ARPA_INET_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([bind]) fi @@ -317,7 +321,7 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([close]) fi gl_UNISTD_MODULE_INDICATOR([close]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([connect]) fi @@ -328,6 +332,7 @@ AC_DEFUN([gl_INIT], fi gl_MATH_MODULE_INDICATOR([copysign]) gl_DIRENT_H + gl_DIRENT_H_REQUIRE_DEFAULTS gl_FUNC_DIRFD if test $ac_cv_func_dirfd = no && test $gl_cv_func_dirfd_macro = no \ || test $REPLACE_DIRFD = 1; then @@ -347,6 +352,7 @@ AC_DEFUN([gl_INIT], gl_HEADER_ERRNO_H AC_REQUIRE([gl_EXTERN_INLINE]) gl_FCNTL_H + gl_FCNTL_H_REQUIRE_DEFAULTS AC_C_FLEXIBLE_ARRAY_MEMBER gl_FLOAT_H if test $REPLACE_FLOAT_LDBL = 1; then @@ -360,7 +366,7 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([flock]) gl_PREREQ_FLOCK fi - gl_HEADER_SYS_FILE_MODULE_INDICATOR([flock]) + gl_SYS_FILE_MODULE_INDICATOR([flock]) AC_REQUIRE([gl_FUNC_FLOOR]) if test $REPLACE_FLOOR = 1; then AC_LIBOBJ([floor]) @@ -409,17 +415,17 @@ AC_DEFUN([gl_INIT], fi gl_UNISTD_MODULE_INDICATOR([getlogin]) AC_REQUIRE([gl_LIB_GETLOGIN]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([getpeername]) fi gl_SYS_SOCKET_MODULE_INDICATOR([getpeername]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([getsockname]) fi gl_SYS_SOCKET_MODULE_INDICATOR([getsockname]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([getsockopt]) fi @@ -439,6 +445,7 @@ AC_DEFUN([gl_INIT], m4_ifdef([gl_ICONV_MODULE_INDICATOR], [gl_ICONV_MODULE_INDICATOR([iconv])]) gl_ICONV_H + gl_ICONV_H_REQUIRE_DEFAULTS gl_FUNC_ICONV_OPEN if test $REPLACE_ICONV_OPEN = 1; then AC_LIBOBJ([iconv_open]) @@ -461,6 +468,7 @@ AC_DEFUN([gl_INIT], fi gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_INTTYPES_INCOMPLETE + gl_INTTYPES_H_REQUIRE_DEFAULTS gl_ISFINITE if test $REPLACE_ISFINITE = 1; then AC_LIBOBJ([isfinite]) @@ -501,6 +509,7 @@ AC_DEFUN([gl_INIT], fi gl_MATH_MODULE_INDICATOR([isnanl]) gl_LANGINFO_H + gl_LANGINFO_H_REQUIRE_DEFAULTS AC_REQUIRE([gl_LARGEFILE]) gl_FUNC_LDEXP gl_LD_VERSION_SCRIPT @@ -512,7 +521,7 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([link]) fi gl_UNISTD_MODULE_INDICATOR([link]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([listen]) fi @@ -522,6 +531,7 @@ AC_DEFUN([gl_INIT], LOCALCHARSET_TESTS_ENVIRONMENT= AC_SUBST([LOCALCHARSET_TESTS_ENVIRONMENT]) gl_LOCALE_H + gl_LOCALE_H_REQUIRE_DEFAULTS gl_FUNC_LOG1P if test $HAVE_LOG1P = 0 || test $REPLACE_LOG1P = 1; then AC_LIBOBJ([log1p]) @@ -541,15 +551,14 @@ AC_DEFUN([gl_INIT], if test $REPLACE_MALLOC = 1; then AC_LIBOBJ([malloc]) fi - gl_MODULE_INDICATOR([malloc-gnu]) - gl_FUNC_MALLOC_POSIX + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) if test $REPLACE_MALLOC = 1; then AC_LIBOBJ([malloc]) fi gl_STDLIB_MODULE_INDICATOR([malloc-posix]) - gl_MODULE_INDICATOR([malloc-posix]) gl_MALLOCA gl_MATH_H + gl_MATH_H_REQUIRE_DEFAULTS gl_MINMAX gl_FUNC_MKDIR if test $REPLACE_MKDIR = 1; then @@ -573,7 +582,8 @@ AC_DEFUN([gl_INIT], fi gl_MODULE_INDICATOR([msvc-nothrow]) gl_MULTIARCH - gl_HEADER_NETDB + gl_NETDB_H + gl_NETDB_H_REQUIRE_DEFAULTS gl_HEADER_NETINET_IN AC_PROG_MKDIR_P gl_FUNC_NL_LANGINFO @@ -607,6 +617,7 @@ AC_DEFUN([gl_INIT], fi gl_POLL_MODULE_INDICATOR([poll]) gl_POLL_H + gl_POLL_H_REQUIRE_DEFAULTS gl_FUNC_PUTENV if test $REPLACE_PUTENV = 1; then AC_LIBOBJ([putenv]) @@ -625,12 +636,12 @@ AC_DEFUN([gl_INIT], gl_PREREQ_READLINK fi gl_UNISTD_MODULE_INDICATOR([readlink]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([recv]) fi gl_SYS_SOCKET_MODULE_INDICATOR([recv]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([recvfrom]) fi @@ -657,12 +668,12 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([select]) fi gl_SYS_SELECT_MODULE_INDICATOR([select]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([send]) fi gl_SYS_SOCKET_MODULE_INDICATOR([send]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([sendto]) fi @@ -672,25 +683,26 @@ AC_DEFUN([gl_INIT], AC_LIBOBJ([setenv]) fi gl_STDLIB_MODULE_INDICATOR([setenv]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + 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]) - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) if test "$ac_cv_header_winsock2_h" = yes; then AC_LIBOBJ([shutdown]) fi gl_SYS_SOCKET_MODULE_INDICATOR([shutdown]) gl_SIGNAL_H - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + gl_SIGNAL_H_REQUIRE_DEFAULTS + 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], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) - m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) + 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 @@ -705,31 +717,67 @@ AC_DEFUN([gl_INIT], gl_STDALIGN_H AM_STDBOOL_H gl_STDDEF_H + gl_STDDEF_H_REQUIRE_DEFAULTS gl_STDINT_H gl_STDIO_H + gl_STDIO_H_REQUIRE_DEFAULTS + dnl No need to create extra modules for these functions. Everyone who uses + dnl 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 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_STDLIB_H + gl_STDLIB_H_REQUIRE_DEFAULTS if test $gl_cond_libtool = false; then gl_ltlibdeps="$gl_ltlibdeps $LTLIBICONV" gl_libdeps="$gl_libdeps $LIBICONV" fi - gl_HEADER_STRING_H - gl_HEADER_SYS_FILE_H + gl_STRING_H + gl_STRING_H_REQUIRE_DEFAULTS + gl_SYS_FILE_H + gl_SYS_FILE_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - AC_REQUIRE([gl_HEADER_SYS_SELECT]) + gl_SYS_SELECT_H + gl_SYS_SELECT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + gl_SYS_SOCKET_H + gl_SYS_SOCKET_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_SYS_STAT_H + gl_SYS_STAT_H + gl_SYS_STAT_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_SYS_TIME_H + gl_SYS_TIME_H + gl_SYS_TIME_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_TIMES_H + gl_SYS_TIMES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_SYS_TYPES_H + gl_SYS_TYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_SYS_UIO + gl_SYS_UIO_H + gl_SYS_UIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_HEADER_TIME_H + gl_TIME_H + gl_TIME_H_REQUIRE_DEFAULTS gl_TIME_RZ if test $HAVE_TIMEZONE_T = 0; then AC_LIBOBJ([time_rz]) @@ -746,9 +794,11 @@ AC_DEFUN([gl_INIT], fi gl_MATH_MODULE_INDICATOR([trunc]) gl_UNISTD_H + gl_UNISTD_H_REQUIRE_DEFAULTS gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) gl_WCHAR_H + gl_WCHAR_H_REQUIRE_DEFAULTS gl_FUNC_WRITE if test $REPLACE_WRITE = 1; then AC_LIBOBJ([write]) @@ -771,7 +821,6 @@ AC_DEFUN([gl_INIT], gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false gl_gnulib_enabled_30838f5439487421042f2225bed3af76=false gl_gnulib_enabled_hostent=false - gl_gnulib_enabled_idx=false gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21=false gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66=false gl_gnulib_enabled_dbdf22868a5367f28bf18e0013ac6f8f=false @@ -880,7 +929,9 @@ AC_SUBST([LTALLOCA]) func_gl_gnulib_m4code_dynarray () { if ! $gl_gnulib_enabled_dynarray; then + AC_PROG_MKDIR_P gl_gnulib_enabled_dynarray=true + func_gl_gnulib_m4code_37f71b604aa9c54446783d80f42fe547 func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 fi } @@ -963,12 +1014,6 @@ AC_SUBST([LTALLOCA]) gl_gnulib_enabled_hostent=true fi } - func_gl_gnulib_m4code_idx () - { - if ! $gl_gnulib_enabled_idx; then - gl_gnulib_enabled_idx=true - fi - } func_gl_gnulib_m4code_b1df7117b479d2da59d76deba468ee21 () { if ! $gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21; then @@ -1181,7 +1226,6 @@ AC_SUBST([LTALLOCA]) AC_LIBOBJ([realloc]) fi gl_STDLIB_MODULE_INDICATOR([realloc-posix]) - gl_MODULE_INDICATOR([realloc-posix]) gl_gnulib_enabled_61bcaca76b3e6f9ae55d57a1c3193bc4=true fi } @@ -1205,7 +1249,9 @@ AC_SUBST([LTALLOCA]) func_gl_gnulib_m4code_scratch_buffer () { if ! $gl_gnulib_enabled_scratch_buffer; then + AC_PROG_MKDIR_P gl_gnulib_enabled_scratch_buffer=true + func_gl_gnulib_m4code_37f71b604aa9c54446783d80f42fe547 func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4 fi @@ -1319,7 +1365,8 @@ AC_SUBST([LTALLOCA]) func_gl_gnulib_m4code_sys_random () { if ! $gl_gnulib_enabled_sys_random; then - gl_HEADER_SYS_RANDOM + gl_SYS_RANDOM_H + gl_SYS_RANDOM_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P gl_gnulib_enabled_sys_random=true fi @@ -1416,6 +1463,7 @@ AC_SUBST([LTALLOCA]) { if ! $gl_gnulib_enabled_3dcce957eadc896e63ab5f137947b410; then gl_WCTYPE_H + gl_WCTYPE_H_REQUIRE_DEFAULTS gl_gnulib_enabled_3dcce957eadc896e63ab5f137947b410=true fi } @@ -1430,9 +1478,6 @@ AC_SUBST([LTALLOCA]) if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then func_gl_gnulib_m4code_925677f0343de64b89a9f0c790b4104c fi - if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then - func_gl_gnulib_m4code_idx - fi if test $HAVE_CANONICALIZE_FILE_NAME = 0 || test $REPLACE_CANONICALIZE_FILE_NAME = 1; then func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467 fi @@ -1583,9 +1628,6 @@ AC_SUBST([LTALLOCA]) if test "$ac_cv_header_winsock2_h" = yes; then func_gl_gnulib_m4code_sockets fi - if test $HAVE_TIMEZONE_T = 0; then - func_gl_gnulib_m4code_idx - fi if test $HAVE_TIMEZONE_T = 0; then func_gl_gnulib_m4code_time_r fi @@ -1621,7 +1663,6 @@ AC_SUBST([LTALLOCA]) AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36]) AM_CONDITIONAL([gl_GNULIB_ENABLED_30838f5439487421042f2225bed3af76], [$gl_gnulib_enabled_30838f5439487421042f2225bed3af76]) AM_CONDITIONAL([gl_GNULIB_ENABLED_hostent], [$gl_gnulib_enabled_hostent]) - AM_CONDITIONAL([gl_GNULIB_ENABLED_idx], [$gl_gnulib_enabled_idx]) AM_CONDITIONAL([gl_GNULIB_ENABLED_b1df7117b479d2da59d76deba468ee21], [$gl_gnulib_enabled_b1df7117b479d2da59d76deba468ee21]) AM_CONDITIONAL([gl_GNULIB_ENABLED_3f0e593033d1fc2c127581960f641b66], [$gl_gnulib_enabled_3f0e593033d1fc2c127581960f641b66]) AM_CONDITIONAL([gl_GNULIB_ENABLED_dbdf22868a5367f28bf18e0013ac6f8f], [$gl_gnulib_enabled_dbdf22868a5367f28bf18e0013ac6f8f]) @@ -1673,6 +1714,8 @@ AC_SUBST([LTALLOCA]) 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]) @@ -1699,6 +1742,8 @@ AC_SUBST([LTALLOCA]) 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 gl_source_base='tests' changequote(,)dnl @@ -1720,6 +1765,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]) @@ -2265,6 +2312,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wint_t.m4 m4/write.m4 m4/xsize.m4 + m4/year2038.m4 m4/zzgnulib.m4 top/GNUmakefile top/maint.mk diff --git a/m4/hostent.m4 b/m4/hostent.m4 index 641d72fa3..f1390a32e 100644 --- a/m4/hostent.m4 +++ b/m4/hostent.m4 @@ -1,4 +1,4 @@ -# hostent.m4 serial 3 +# hostent.m4 serial 4 dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,7 @@ AC_DEFUN([gl_HOSTENT], dnl - On BeOS, they are in libnet. dnl - On native Windows, they are in ws2_32.dll. dnl - Otherwise they are in libc. - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H + AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H HOSTENT_LIB= gl_saved_libs="$LIBS" AC_SEARCH_LIBS([gethostbyname], [nsl network net], diff --git a/m4/iconv_h.m4 b/m4/iconv_h.m4 index ab8e2837a..294098829 100644 --- a/m4/iconv_h.m4 +++ b/m4/iconv_h.m4 @@ -1,10 +1,10 @@ -# iconv_h.m4 serial 12 +# iconv_h.m4 serial 15 dnl Copyright (C) 2007-2021 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]) @@ -24,22 +24,37 @@ AC_DEFUN([gl_ICONV_H], dnl Unconditionally enables the replacement of . AC_DEFUN([gl_REPLACE_ICONV_H], [ - AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + gl_ICONV_H_REQUIRE_DEFAULTS ICONV_H='iconv.h' AM_CONDITIONAL([GL_GENERATE_ICONV_H], [test -n "$ICONV_H"]) ]) +# 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], [ m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) - GNULIB_ICONV=0; AC_SUBST([GNULIB_ICONV]) dnl Assume proper GNU behavior unless another module says otherwise. ICONV_CONST=; AC_SUBST([ICONV_CONST]) REPLACE_ICONV=0; AC_SUBST([REPLACE_ICONV]) diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index f56e94a88..64b1de5c4 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 32 +# inttypes.m4 serial 35 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -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 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 @@ -136,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]) diff --git a/m4/langinfo_h.m4 b/m4/langinfo_h.m4 index 950fe20af..87959f77a 100644 --- a/m4/langinfo_h.m4 +++ b/m4/langinfo_h.m4 @@ -1,10 +1,10 @@ -# langinfo_h.m4 serial 9 +# langinfo_h.m4 serial 12 dnl Copyright (C) 2009-2021 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]) @@ -104,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/m4/largefile.m4 b/m4/largefile.m4 index cadb16dc9..fbde5e664 100644 --- a/m4/largefile.m4 +++ b/m4/largefile.m4 @@ -22,7 +22,8 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], esac ]) -# The following implementation works around a problem in autoconf <= 2.69; +# 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], [], [ @@ -40,6 +41,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]];[]dnl ]) +])# m4_version_prereq 2.70 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, @@ -54,7 +56,8 @@ m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], [AC_LANG_PROGRAM([$5], [$6])], [$3=no; break]) m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( - [AC_LANG_PROGRAM([#define $1 $2 + [AC_LANG_PROGRAM([#undef $1 +#define $1 $2 $5], [$6])], [$3=$2; break]) $3=unknown @@ -80,9 +83,8 @@ rm -rf conftest*[]dnl AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) -if test "$enable_largefile" != no; then - - AC_CACHE_CHECK([for special C compiler options needed 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 @@ -107,15 +109,15 @@ if test "$enable_largefile" != no; then ac_cv_sys_file_offset_bits, [Number of bits in a file offset, on hosts where this is settable.], [_AC_SYS_LARGEFILE_TEST_INCLUDES]) - if test $ac_cv_sys_file_offset_bits = unknown; then - _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]) - fi -fi + 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 -])# m4_version_prereq 2.70 # Enable large files on systems where this is implemented by Gnulib, not by the # system headers. diff --git a/m4/limits-h.m4 b/m4/limits-h.m4 index 70dbb7dcf..00c9fe9e5 100644 --- a/m4/limits-h.m4 +++ b/m4/limits-h.m4 @@ -11,7 +11,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) - AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, 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( @@ -22,6 +22,7 @@ AC_DEFUN_ONCE([gl_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])]) diff --git a/m4/locale_h.m4 b/m4/locale_h.m4 index 7b50aa7a8..444a38178 100644 --- a/m4/locale_h.m4 +++ b/m4/locale_h.m4 @@ -1,13 +1,13 @@ -# locale_h.m4 serial 25 +# locale_h.m4 serial 28 dnl Copyright (C) 2007, 2009-2021 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 to define locale_t and the int_p_*, int_n_* @@ -129,22 +129,37 @@ AC_DEFUN([gl_LOCALE_T], 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_SETLOCALE_NULL=0; AC_SUBST([GNULIB_SETLOCALE_NULL]) - GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE]) - GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 32ab42ec0..972e808ab 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,21 +1,21 @@ -# malloc.m4 serial 22 +# malloc.m4 serial 27 dnl Copyright (C) 2007, 2009-2021 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/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_CANONICAL_HOST])dnl for cross-compiles - 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( [[#include ]], - [[char *p = malloc (0); + [[void *p = malloc (0); int result = !p; free (p); return result;]]) @@ -24,75 +24,151 @@ 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* | *-musl* | freebsd* | midnightbsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) + *-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 ]) ]) - case "$ac_cv_func_malloc_0_nonnull" in - *yes) - $1 - ;; - *) - $2 - ;; - esac + 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]) + if test $REPLACE_MALLOC = 0; then + _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC=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=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 + ]], + [[/* 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 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 +#include +#include +#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/m4/math_h.m4 b/m4/math_h.m4 index a9ba5e655..b3a10c3fb 100644 --- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,10 +1,10 @@ -# math_h.m4 serial 122 +# math_h.m4 serial 125 dnl Copyright (C) 2007-2021 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]) @@ -53,119 +53,134 @@ 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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_J0=1; AC_SUBST([GNULIB_MDA_J0]) - GNULIB_MDA_J1=1; AC_SUBST([GNULIB_MDA_J1]) - GNULIB_MDA_JN=1; AC_SUBST([GNULIB_MDA_JN]) - GNULIB_MDA_Y0=1; AC_SUBST([GNULIB_MDA_Y0]) - GNULIB_MDA_Y1=1; AC_SUBST([GNULIB_MDA_Y1]) - GNULIB_MDA_YN=1; AC_SUBST([GNULIB_MDA_YN]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_ACOSF=1; AC_SUBST([HAVE_ACOSF]) HAVE_ACOSL=1; AC_SUBST([HAVE_ACOSL]) diff --git a/m4/memchr.m4 b/m4/memchr.m4 index 64470ded5..ca08192a6 100644 --- a/m4/memchr.m4 +++ b/m4/memchr.m4 @@ -1,4 +1,4 @@ -# memchr.m4 serial 17 +# memchr.m4 serial 18 dnl Copyright (C) 2002-2004, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,7 @@ 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]) + 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 diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4 index c5ee2af8c..f9d9ec8f3 100644 --- a/m4/mempcpy.m4 +++ b/m4/mempcpy.m4 @@ -1,4 +1,4 @@ -# mempcpy.m4 serial 11 +# mempcpy.m4 serial 12 dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -13,7 +13,7 @@ AC_DEFUN([gl_FUNC_MEMPCPY], dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'. AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([mempcpy]) if test $ac_cv_func_mempcpy = no; then HAVE_MEMPCPY=0 diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 245649e77..721189af5 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 35 +# serial 36 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2021 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -255,7 +255,7 @@ main () dnl Main macro of module 'mktime'. AC_DEFUN([gl_FUNC_MKTIME], [ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) diff --git a/m4/netdb_h.m4 b/m4/netdb_h.m4 index db84c787e..eb7c3b8b5 100644 --- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -1,10 +1,10 @@ -# netdb_h.m4 serial 12 +# netdb_h.m4 serial 15 dnl Copyright (C) 2008-2021 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_NETDB], +AC_DEFUN_ONCE([gl_NETDB_H], [ AC_REQUIRE([gl_NETDB_H_DEFAULTS]) gl_CHECK_NEXT_HEADERS([netdb.h]) @@ -21,18 +21,33 @@ AC_DEFUN([gl_HEADER_NETDB], [getaddrinfo freeaddrinfo gai_strerror getnameinfo]) ]) +# gl_NETDB_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_NETDB_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_NETDB_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_NETDB_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_NETDB_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETADDRINFO]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_NETDB_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_NETDB_H_DEFAULTS]) +]) + AC_DEFUN([gl_NETDB_H_DEFAULTS], [ - GNULIB_GETADDRINFO=0; AC_SUBST([GNULIB_GETADDRINFO]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_STRUCT_ADDRINFO=1; AC_SUBST([HAVE_STRUCT_ADDRINFO]) HAVE_DECL_FREEADDRINFO=1; AC_SUBST([HAVE_DECL_FREEADDRINFO]) diff --git a/m4/poll_h.m4 b/m4/poll_h.m4 index 20692d866..1f0d7964a 100644 --- a/m4/poll_h.m4 +++ b/m4/poll_h.m4 @@ -1,4 +1,4 @@ -# poll_h.m4 serial 3 +# poll_h.m4 serial 6 dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Bruno Haible. -AC_DEFUN([gl_POLL_H], +AC_DEFUN_ONCE([gl_POLL_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_POLL_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([poll.h]) @@ -31,18 +31,33 @@ AC_DEFUN([gl_POLL_H], [poll]) ]) +# gl_POLL_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_POLL_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_POLL_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_POLL_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_POLL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POLL]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_POLL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_POLL_H_DEFAULTS]) +]) + AC_DEFUN([gl_POLL_H_DEFAULTS], [ - GNULIB_POLL=0; AC_SUBST([GNULIB_POLL]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_POLL=1; AC_SUBST([HAVE_POLL]) REPLACE_POLL=0; AC_SUBST([REPLACE_POLL]) diff --git a/m4/printf.m4 b/m4/printf.m4 index d8b352104..284c7c5d3 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 72 +# printf.m4 serial 73 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -537,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 @@ -1690,6 +1690,7 @@ 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 . . . # # . . . . . . # . . . . . . . . diff --git a/m4/rawmemchr.m4 b/m4/rawmemchr.m4 index f92846543..452fab18f 100644 --- a/m4/rawmemchr.m4 +++ b/m4/rawmemchr.m4 @@ -1,4 +1,4 @@ -# rawmemchr.m4 serial 2 +# rawmemchr.m4 serial 3 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_RAWMEMCHR], dnl Persuade glibc to declare rawmemchr(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_FUNCS([rawmemchr]) if test $ac_cv_func_rawmemchr = no; then HAVE_RAWMEMCHR=0 diff --git a/m4/realloc.m4 b/m4/realloc.m4 index a80a02a6b..0abc4185e 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -1,21 +1,21 @@ -# realloc.m4 serial 20 +# realloc.m4 serial 24 dnl Copyright (C) 2007, 2009-2021 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/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c +# 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([for GNU libc compatible realloc], + AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], [ac_cv_func_realloc_0_nonnull], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include ]], - [[char *p = realloc (0, 0); + [[void *p = realloc (0, 0); int result = !p; free (p); return result;]]) @@ -24,53 +24,40 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], [ac_cv_func_realloc_0_nonnull=no], [case "$host_os" in # Guess yes on platforms where we know the result. - *-gnu* | gnu* | *-musl* | freebsd* | midnightbsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) + *-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 ]) ]) - case "$ac_cv_func_realloc_0_nonnull" in - *yes) - $1 - ;; - *) - $2 - ;; - esac + AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) ])# AC_FUNC_REALLOC # gl_FUNC_REALLOC_GNU # ------------------- -# Test whether 'realloc (0, 0)' is handled like in GNU libc, and replace -# realloc if it is not. +# Replace realloc if it is not compatible with GNU libc. AC_DEFUN([gl_FUNC_REALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - dnl _AC_FUNC_REALLOC_IF is defined in Autoconf. - _AC_FUNC_REALLOC_IF( - [AC_DEFINE([HAVE_REALLOC_GNU], [1], - [Define to 1 if your system has a GNU libc compatible 'realloc' - function, and to 0 otherwise.])], - [AC_DEFINE([HAVE_REALLOC_GNU], [0]) - REPLACE_REALLOC=1 - ]) + AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + if test $REPLACE_REALLOC = 0; then + _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC=1]) + fi ])# gl_FUNC_REALLOC_GNU # gl_FUNC_REALLOC_POSIX # --------------------- # Test whether 'realloc' is POSIX compliant (sets errno to ENOMEM when it -# fails), and replace realloc if it is not. +# 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_CHECK_MALLOC_POSIX]) - if test $gl_cv_func_malloc_posix = yes; then - AC_DEFINE([HAVE_REALLOC_POSIX], [1], - [Define if the 'realloc' function is POSIX compliant.]) - else + AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + if test $REPLACE_MALLOC = 1; then REPLACE_REALLOC=1 fi ]) diff --git a/m4/regex.m4 b/m4/regex.m4 index 850c57222..1c7e562f6 100644 --- a/m4/regex.m4 +++ b/m4/regex.m4 @@ -1,4 +1,4 @@ -# serial 71 +# serial 73 # Copyright (C) 1996-2001, 2003-2021 Free Software Foundation, Inc. # @@ -246,7 +246,7 @@ AC_DEFUN([gl_REGEX], & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES); memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("[[:alnum:]_-]\\\\+$", 16, ®ex); + s = re_compile_pattern ("[[:alnum:]_-]\\\\+\$", 16, ®ex); if (s) result |= 32; else @@ -264,14 +264,50 @@ AC_DEFUN([gl_REGEX], back reference. */ re_set_syntax (RE_SYNTAX_POSIX_EGREP); memset (®ex, 0, sizeof regex); - s = re_compile_pattern ("0|()0|\\1|0", 10, ®ex); + s = re_compile_pattern ("0|()0|\\\\1|0", 10, ®ex); if (!s) - result |= 64; + { + memset (®s, 0, sizeof regs); + i = re_search (®ex, "x", 1, 0, 1, ®s); + if (i != -1) + result |= 64; + if (0 <= i) + { + free (regs.start); + free (regs.end); + } + regfree (®ex); + } else { if (strcmp (s, "Invalid back reference")) result |= 64; + } + + /* glibc bug 11053. */ + re_set_syntax (RE_SYNTAX_POSIX_BASIC); + memset (®ex, 0, sizeof regex); + static char const pat_sub2[] = "\\\\(a*\\\\)*a*\\\\1"; + s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, ®ex); + if (s) + result |= 64; + else + { + memset (®s, 0, sizeof regs); + static char const data[] = "a"; + int datalen = sizeof data - 1; + i = re_search (®ex, data, datalen, 0, datalen, ®s); + if (i != 0) + result |= 64; + else if (regs.num_regs < 2) + result |= 64; + else if (! (regs.start[0] == 0 && regs.end[0] == 1)) + result |= 64; + else if (! (regs.start[1] == 0 && regs.end[1] == 0)) + result |= 64; regfree (®ex); + free (regs.start); + free (regs.end); } #if 0 diff --git a/m4/select.m4 b/m4/select.m4 index c7409d204..72c068fa4 100644 --- a/m4/select.m4 +++ b/m4/select.m4 @@ -1,4 +1,4 @@ -# select.m4 serial 12 +# select.m4 serial 13 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SELECT], [ - AC_REQUIRE([gl_HEADER_SYS_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]) diff --git a/m4/servent.m4 b/m4/servent.m4 index 2dda17750..9bc3bcd4f 100644 --- a/m4/servent.m4 +++ b/m4/servent.m4 @@ -1,4 +1,4 @@ -# servent.m4 serial 3 +# servent.m4 serial 4 dnl Copyright (C) 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -15,7 +15,7 @@ AC_DEFUN([gl_SERVENT], dnl - On BeOS, they are in libnet. dnl - On native Windows, they are in ws2_32.dll. dnl - Otherwise they are in libc. - AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H + AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H SERVENT_LIB= gl_saved_libs="$LIBS" AC_SEARCH_LIBS([getservbyname], [socket network net], diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index ff9f0251f..8b938809b 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,10 +1,10 @@ -# signal_h.m4 serial 19 +# signal_h.m4 serial 22 dnl Copyright (C) 2007-2021 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]) @@ -52,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/m4/sockpfaf.m4 b/m4/sockpfaf.m4 index edae5d85c..17e14c7a6 100644 --- a/m4/sockpfaf.m4 +++ b/m4/sockpfaf.m4 @@ -1,4 +1,4 @@ -# sockpfaf.m4 serial 9 +# sockpfaf.m4 serial 10 dnl Copyright (C) 2004, 2006, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -13,7 +13,7 @@ dnl From Bruno Haible. AC_DEFUN([gl_SOCKET_FAMILIES], [ - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([netinet/in.h]) AC_CACHE_CHECK([for IPv4 sockets], @@ -60,7 +60,7 @@ AC_DEFUN([gl_SOCKET_FAMILIES], AC_DEFUN([gl_SOCKET_FAMILY_UNIX], [ - AC_REQUIRE([gl_HEADER_SYS_SOCKET]) + AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([sys/un.h]) AC_CACHE_CHECK([for UNIX domain sockets], diff --git a/m4/stat.m4 b/m4/stat.m4 index 66f6c8c5c..9bcdb72d6 100644 --- a/m4/stat.m4 +++ b/m4/stat.m4 @@ -1,4 +1,4 @@ -# serial 17 +# serial 18 # Copyright (C) 2009-2021 Free Software Foundation, Inc. # @@ -69,7 +69,7 @@ AC_DEFUN([gl_FUNC_STAT], # Prerequisites of lib/stat.c and lib/stat-w32.c. AC_DEFUN([gl_PREREQ_STAT], [ - AC_REQUIRE([gl_HEADER_SYS_STAT_H]) + AC_REQUIRE([gl_SYS_STAT_H]) AC_REQUIRE([gl_PREREQ_STAT_W32]) : ]) diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4 index cd666c4a5..1303d2e06 100644 --- a/m4/stddef_h.m4 +++ b/m4/stddef_h.m4 @@ -1,4 +1,4 @@ -# stddef_h.m4 serial 9 +# stddef_h.m4 serial 11 dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl A placeholder for , for platforms that have issues. -AC_DEFUN([gl_STDDEF_H], +AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) AC_REQUIRE([gt_TYPE_WCHAR_T]) @@ -68,13 +68,28 @@ AC_DEFUN([gl_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/m4/stdint.m4 b/m4/stdint.m4 index a785b44ed..2eb1652d8 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,4 +1,4 @@ -# stdint.m4 serial 58 +# stdint.m4 serial 60 dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -170,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) @@ -527,7 +527,7 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], dnl requirement that wint_t is "unchanged by default argument promotions". dnl In this case gnulib's and 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 ]) diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4 index 4c3f24acc..e70438386 100644 --- a/m4/stdio_h.m4 +++ b/m4/stdio_h.m4 @@ -1,11 +1,12 @@ -# stdio_h.m4 serial 52 +# stdio_h.m4 serial 56 dnl Copyright (C) 2007-2021 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 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 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 @@ -116,77 +93,92 @@ AC_DEFUN([gl_STDIO_H], 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_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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_FCLOSEALL=1; AC_SUBST([GNULIB_MDA_FCLOSEALL]) - GNULIB_MDA_FDOPEN=1; AC_SUBST([GNULIB_MDA_FDOPEN]) - GNULIB_MDA_FILENO=1; AC_SUBST([GNULIB_MDA_FILENO]) - GNULIB_MDA_GETW=1; AC_SUBST([GNULIB_MDA_GETW]) - GNULIB_MDA_PUTW=1; AC_SUBST([GNULIB_MDA_PUTW]) - GNULIB_MDA_TEMPNAM=1; AC_SUBST([GNULIB_MDA_TEMPNAM]) 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]) diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 5fdb0a706..9c1d1c76c 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,10 +1,10 @@ -# stdlib_h.m4 serial 59 +# stdlib_h.m4 serial 63 dnl Copyright (C) 2007-2021 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]) @@ -46,63 +46,78 @@ AC_DEFUN([gl_STDLIB_H], 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_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_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_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_ALIGNED_ALLOC=0; AC_SUBST([GNULIB_ALIGNED_ALLOC]) - 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_FREE_POSIX=0; AC_SUBST([GNULIB_FREE_POSIX]) - 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_MEMALIGN=0;AC_SUBST([GNULIB_POSIX_MEMALIGN]) - 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_STRTOL=0; AC_SUBST([GNULIB_STRTOL]) - GNULIB_STRTOLD=0; AC_SUBST([GNULIB_STRTOLD]) - GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL]) - GNULIB_STRTOUL=0; AC_SUBST([GNULIB_STRTOUL]) - 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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_ECVT=1; AC_SUBST([GNULIB_MDA_ECVT]) - GNULIB_MDA_FCVT=1; AC_SUBST([GNULIB_MDA_FCVT]) - GNULIB_MDA_GCVT=1; AC_SUBST([GNULIB_MDA_GCVT]) - GNULIB_MDA_MKTEMP=1; AC_SUBST([GNULIB_MDA_MKTEMP]) - GNULIB_MDA_PUTENV=1; AC_SUBST([GNULIB_MDA_PUTENV]) 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]) @@ -164,6 +179,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC=0; AC_SUBST([REPLACE_REALLOC]) + 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]) diff --git a/m4/strdup.m4 b/m4/strdup.m4 index f6f421d94..5b6018ff2 100644 --- a/m4/strdup.m4 +++ b/m4/strdup.m4 @@ -1,4 +1,4 @@ -# strdup.m4 serial 14 +# strdup.m4 serial 15 dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. @@ -8,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STRDUP], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_CHECK_DECLS_ONCE([strdup]) if test $ac_cv_have_decl_strdup = no; then HAVE_DECL_STRDUP=0 @@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_STRDUP], AC_DEFUN([gl_FUNC_STRDUP_POSIX], [ - AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) if test $gl_cv_func_malloc_posix != yes; then REPLACE_STRDUP=1 diff --git a/m4/string_h.m4 b/m4/string_h.m4 index a4cc5b437..80d1e5875 100644 --- a/m4/string_h.m4 +++ b/m4/string_h.m4 @@ -5,20 +5,15 @@ # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 29 +# serial 32 # 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([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 @@ -33,62 +28,77 @@ AC_DEFUN([gl_HEADER_STRING_H_BODY], 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]) + 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_STRERRORNAME_NP=0; AC_SUBST([GNULIB_STRERRORNAME_NP]) - GNULIB_SIGABBREV_NP=0; AC_SUBST([GNULIB_SIGABBREV_NP]) - GNULIB_SIGDESCR_NP=0; AC_SUBST([GNULIB_SIGDESCR_NP]) - GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL]) - GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP]) HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_MEMCCPY=1; AC_SUBST([GNULIB_MDA_MEMCCPY]) - GNULIB_MDA_STRDUP=1; AC_SUBST([GNULIB_MDA_STRDUP]) 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]) diff --git a/m4/sys_file_h.m4 b/m4/sys_file_h.m4 index 99c2285dd..bcde4d70b 100644 --- a/m4/sys_file_h.m4 +++ b/m4/sys_file_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# serial 6 +# serial 9 # Copyright (C) 2008-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -8,9 +8,9 @@ # Written by Richard W.M. Jones. -AC_DEFUN([gl_HEADER_SYS_FILE_H], +AC_DEFUN_ONCE([gl_SYS_FILE_H], [ - AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS]) + AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([sys/file.h]) @@ -28,14 +28,29 @@ AC_DEFUN([gl_HEADER_SYS_FILE_H], ]], [flock]) ]) -AC_DEFUN([gl_HEADER_SYS_FILE_MODULE_INDICATOR], +# gl_SYS_FILE_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_FILE_MODULE_INDICATOR], [ - AC_REQUIRE([gl_HEADER_SYS_FILE_H_DEFAULTS]) + gl_SYS_FILE_H_REQUIRE_DEFAULTS gl_MODULE_INDICATOR_SET_VARIABLE([$1]) ]) -AC_DEFUN([gl_HEADER_SYS_FILE_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_SYS_FILE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FLOCK]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_FILE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_FILE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_FILE_H_DEFAULTS], [ - GNULIB_FLOCK=0; AC_SUBST([GNULIB_FLOCK]) HAVE_FLOCK=1; AC_SUBST([HAVE_FLOCK]) ]) diff --git a/m4/sys_random_h.m4 b/m4/sys_random_h.m4 index 45e0469ba..37bc31606 100644 --- a/m4/sys_random_h.m4 +++ b/m4/sys_random_h.m4 @@ -1,10 +1,10 @@ -# sys_random_h.m4 serial 5 +# sys_random_h.m4 serial 8 dnl Copyright (C) 2020-2021 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_SYS_RANDOM], +AC_DEFUN_ONCE([gl_SYS_RANDOM_H], [ AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. @@ -35,18 +35,33 @@ AC_DEFUN([gl_HEADER_SYS_RANDOM], [getrandom]) ]) +# gl_SYS_RANDOM_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_RANDOM_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_RANDOM_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_RANDOM_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETRANDOM]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_RANDOM_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_RANDOM_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_RANDOM_H_DEFAULTS], [ - GNULIB_GETRANDOM=0; AC_SUBST([GNULIB_GETRANDOM]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_GETRANDOM=1; AC_SUBST([HAVE_GETRANDOM]) REPLACE_GETRANDOM=0; AC_SUBST([REPLACE_GETRANDOM]) diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4 index 4b33d312e..2e7d140de 100644 --- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -1,13 +1,13 @@ -# sys_select_h.m4 serial 20 +# sys_select_h.m4 serial 23 dnl Copyright (C) 2006-2021 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_SYS_SELECT], +AC_DEFUN_ONCE([gl_SYS_SELECT_H], [ - AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([whether is self-contained], [gl_cv_header_sys_select_h_selfcontained], [ @@ -75,19 +75,34 @@ AC_DEFUN([gl_HEADER_SYS_SELECT], ]], [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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS]) + 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], [ - GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT]) - GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT]) REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT]) diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4 index 503cb9668..5676a0d21 100644 --- a/m4/sys_socket_h.m4 +++ b/m4/sys_socket_h.m4 @@ -1,4 +1,4 @@ -# sys_socket_h.m4 serial 25 +# sys_socket_h.m4 serial 28 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ 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]) @@ -156,32 +156,47 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], 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/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index 23cbdd28e..ac91d425b 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 38 -*- Autoconf -*- +# sys_stat_h.m4 serial 41 -*- Autoconf -*- dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Eric Blake. dnl Provide a GNU-like . -AC_DEFUN([gl_HEADER_SYS_STAT_H], +AC_DEFUN_ONCE([gl_SYS_STAT_H], [ AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) @@ -52,38 +52,53 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], 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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + 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], [ - AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR - GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) - GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) - GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) - GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) - GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK]) - GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) - GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) - GNULIB_MKDIR=0; AC_SUBST([GNULIB_MKDIR]) - GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) - GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) - GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) - GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) - GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) - GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) - GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) - GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT]) - dnl Support Microsoft deprecated alias function names by default. - GNULIB_MDA_CHMOD=1; AC_SUBST([GNULIB_MDA_CHMOD]) - GNULIB_MDA_MKDIR=1; AC_SUBST([GNULIB_MDA_MKDIR]) - GNULIB_MDA_UMASK=1; AC_SUBST([GNULIB_MDA_UMASK]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4 index 64f133d51..c425a9639 100644 --- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# serial 9 +# serial 12 # Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -8,18 +8,13 @@ # Written by Paul Eggert and Martin Lambers. -AC_DEFUN([gl_HEADER_SYS_TIME_H], +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_HEADER_SYS_TIME_H_BODY]) -]) - -AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], -[ + AC_REQUIRE([gl_SYS_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) AC_CHECK_HEADERS_ONCE([sys/time.h]) gl_CHECK_NEXT_HEADERS([sys/time.h]) @@ -89,18 +84,33 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], ]], [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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS]) + 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]) ]) -AC_DEFUN([gl_HEADER_SYS_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_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], [ - GNULIB_GETTIMEOFDAY=0; AC_SUBST([GNULIB_GETTIMEOFDAY]) 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]) diff --git a/m4/sys_times_h.m4 b/m4/sys_times_h.m4 index b9daaa7ca..577ead66f 100644 --- a/m4/sys_times_h.m4 +++ b/m4/sys_times_h.m4 @@ -1,5 +1,5 @@ # Configure a replacement for . -# serial 8 +# serial 11 # Copyright (C) 2008-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -8,7 +8,7 @@ # Written by Simon Josefsson. -AC_DEFUN([gl_SYS_TIMES_H], +AC_DEFUN_ONCE([gl_SYS_TIMES_H], [ AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS]) @@ -36,16 +36,31 @@ AC_DEFUN([gl_SYS_TIMES_H], ]], [times]) ]) +# gl_SYS_TIMES_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_TIMES_MODULE_INDICATOR], [ - dnl Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS]) + dnl Ensure to expand the default settings once only. + gl_SYS_TIMES_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_SYS_TIMES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMES]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TIMES_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TIMES_H_DEFAULTS]) +]) + AC_DEFUN([gl_SYS_TIMES_H_DEFAULTS], [ - GNULIB_TIMES=0; AC_SUBST([GNULIB_TIMES]) HAVE_STRUCT_TMS=1; AC_SUBST([HAVE_STRUCT_TMS]) HAVE_TIMES=1; AC_SUBST([HAVE_TIMES]) ]) diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4 index 2172c836d..6dd6fee10 100644 --- a/m4/sys_types_h.m4 +++ b/m4/sys_types_h.m4 @@ -1,4 +1,4 @@ -# sys_types_h.m4 serial 11 +# sys_types_h.m4 serial 13 dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,11 @@ 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,6 +31,17 @@ 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], [ ]) diff --git a/m4/sys_uio_h.m4 b/m4/sys_uio_h.m4 index 503de4d1f..fa176e0b6 100644 --- a/m4/sys_uio_h.m4 +++ b/m4/sys_uio_h.m4 @@ -1,10 +1,10 @@ -# sys_uio_h.m4 serial 1 +# sys_uio_h.m4 serial 3 dnl Copyright (C) 2011-2021 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_SYS_UIO], +AC_DEFUN_ONCE([gl_SYS_UIO_H], [ AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) dnl is always overridden, because of GNULIB_POSIXCHECK. @@ -17,15 +17,30 @@ AC_DEFUN([gl_HEADER_SYS_UIO], 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 Use AC_REQUIRE here, so that the default settings are expanded once only. - AC_REQUIRE([gl_SYS_UIO_H_DEFAULTS]) + 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/m4/threadlib.m4 b/m4/threadlib.m4 index 8fc3dfd1f..37b797c18 100644 --- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -1,4 +1,4 @@ -# threadlib.m4 serial 30 +# threadlib.m4 serial 31 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -212,6 +212,27 @@ AC_DEFUN([gl_PTHREADLIB_BODY], 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 + #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.) @@ -219,18 +240,22 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # 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], - [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 + [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. @@ -246,6 +271,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], 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]) @@ -311,7 +337,8 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], 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 AIX >= 7.1 and Solaris >= 11.4 have thrd_create in libc. + 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= @@ -481,7 +508,10 @@ AC_DEFUN([gl_THREADLIB_BODY], 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.]) @@ -576,7 +606,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 diff --git a/m4/time_h.m4 b/m4/time_h.m4 index b6a1aa3bc..b57474b48 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. -# serial 15 +# serial 18 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -10,16 +10,11 @@ # 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]) -]) - -AC_DEFUN([gl_HEADER_TIME_H_BODY], -[ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_TIME_H_DEFAULTS]) gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) @@ -111,30 +106,45 @@ 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_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_TIMESPEC_GET=0; AC_SUBST([GNULIB_TIMESPEC_GET]) - 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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_TZSET=1; AC_SUBST([GNULIB_MDA_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]) diff --git a/m4/time_r.m4 b/m4/time_r.m4 index 713e93ac2..2d49b64f1 100644 --- a/m4/time_r.m4 +++ b/m4/time_r.m4 @@ -12,7 +12,7 @@ AC_DEFUN([gl_TIME_R], dnl Persuade glibc and Solaris to declare localtime_r. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_C_RESTRICT]) dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is diff --git a/m4/time_rz.m4 b/m4/time_rz.m4 index 34ef0bab4..c5e85dc62 100644 --- a/m4/time_rz.m4 +++ b/m4/time_rz.m4 @@ -10,7 +10,7 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_RZ], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_STRUCT_TIMEZONE]) # On Mac OS X 10.6, localtime loops forever with some time_t values. diff --git a/m4/timegm.m4 b/m4/timegm.m4 index 098c857e7..58123beb0 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 12 +# timegm.m4 serial 13 dnl Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,7 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_TIMEGM], [ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) REPLACE_TIMEGM=0 AC_CHECK_FUNCS_ONCE([timegm]) diff --git a/m4/tzset.m4 b/m4/tzset.m4 index 8eaf41f41..8a4f28557 100644 --- a/m4/tzset.m4 +++ b/m4/tzset.m4 @@ -1,4 +1,4 @@ -# serial 15 +# serial 16 # Copyright (C) 2003, 2007, 2009-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_TZSET], [ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) REPLACE_TZSET=0 case "$host_os" in diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4 index 0f26fb908..0ce4ea451 100644 --- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 85 +# unistd_h.m4 serial 89 dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,10 +6,10 @@ 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]) @@ -59,100 +59,116 @@ AC_DEFUN([gl_UNISTD_H], 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_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_ACCESS=0; AC_SUBST([GNULIB_ACCESS]) - GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR]) - GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN]) - GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE]) - GNULIB_COPY_FILE_RANGE=0; AC_SUBST([GNULIB_COPY_FILE_RANGE]) - 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_EXECL=0; AC_SUBST([GNULIB_EXECL]) - GNULIB_EXECLE=0; AC_SUBST([GNULIB_EXECLE]) - GNULIB_EXECLP=0; AC_SUBST([GNULIB_EXECLP]) - GNULIB_EXECV=0; AC_SUBST([GNULIB_EXECV]) - GNULIB_EXECVE=0; AC_SUBST([GNULIB_EXECVE]) - GNULIB_EXECVP=0; AC_SUBST([GNULIB_EXECVP]) - GNULIB_EXECVPE=0; AC_SUBST([GNULIB_EXECVPE]) - 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_GETENTROPY=0; AC_SUBST([GNULIB_GETENTROPY]) - 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_GETOPT_POSIX=0; AC_SUBST([GNULIB_GETOPT_POSIX]) - GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) - GNULIB_GETPASS=0; AC_SUBST([GNULIB_GETPASS]) - 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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_ACCESS=1; AC_SUBST([GNULIB_MDA_ACCESS]) - GNULIB_MDA_CHDIR=1; AC_SUBST([GNULIB_MDA_CHDIR]) - GNULIB_MDA_CLOSE=1; AC_SUBST([GNULIB_MDA_CLOSE]) - GNULIB_MDA_DUP=1; AC_SUBST([GNULIB_MDA_DUP]) - GNULIB_MDA_DUP2=1; AC_SUBST([GNULIB_MDA_DUP2]) - GNULIB_MDA_EXECL=1; AC_SUBST([GNULIB_MDA_EXECL]) - GNULIB_MDA_EXECLE=1; AC_SUBST([GNULIB_MDA_EXECLE]) - GNULIB_MDA_EXECLP=1; AC_SUBST([GNULIB_MDA_EXECLP]) - GNULIB_MDA_EXECV=1; AC_SUBST([GNULIB_MDA_EXECV]) - GNULIB_MDA_EXECVE=1; AC_SUBST([GNULIB_MDA_EXECVE]) - GNULIB_MDA_EXECVP=1; AC_SUBST([GNULIB_MDA_EXECVP]) - GNULIB_MDA_EXECVPE=1; AC_SUBST([GNULIB_MDA_EXECVPE]) - GNULIB_MDA_GETCWD=1; AC_SUBST([GNULIB_MDA_GETCWD]) - GNULIB_MDA_GETPID=1; AC_SUBST([GNULIB_MDA_GETPID]) - GNULIB_MDA_ISATTY=1; AC_SUBST([GNULIB_MDA_ISATTY]) - GNULIB_MDA_LSEEK=1; AC_SUBST([GNULIB_MDA_LSEEK]) - GNULIB_MDA_READ=1; AC_SUBST([GNULIB_MDA_READ]) - GNULIB_MDA_RMDIR=1; AC_SUBST([GNULIB_MDA_RMDIR]) - GNULIB_MDA_SWAB=1; AC_SUBST([GNULIB_MDA_SWAB]) - GNULIB_MDA_UNLINK=1; AC_SUBST([GNULIB_MDA_UNLINK]) - GNULIB_MDA_WRITE=1; AC_SUBST([GNULIB_MDA_WRITE]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) diff --git a/m4/visibility.m4 b/m4/visibility.m4 index 8f27a122d..d161bd7f7 100644 --- a/m4/visibility.m4 +++ b/m4/visibility.m4 @@ -1,4 +1,4 @@ -# visibility.m4 serial 7 +# visibility.m4 serial 8 dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -59,6 +59,10 @@ AC_DEFUN([gl_VISIBILITY], 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) {} ]], [[]])], diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index 59c55fcda..818b3192e 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,9 +7,9 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 50 +# wchar_h.m4 serial 53 -AC_DEFUN([gl_WCHAR_H], +AC_DEFUN_ONCE([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) @@ -125,60 +125,75 @@ 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]) + 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_WMEMPCPY=0; AC_SUBST([GNULIB_WMEMPCPY]) - 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 Support Microsoft deprecated alias function names by default. - GNULIB_MDA_WCSDUP=1; AC_SUBST([GNULIB_MDA_WCSDUP]) dnl Assume proper GNU behavior unless another module says otherwise. HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) diff --git a/m4/wctype_h.m4 b/m4/wctype_h.m4 index 1ab0bc985..7d7421277 100644 --- a/m4/wctype_h.m4 +++ b/m4/wctype_h.m4 @@ -1,4 +1,4 @@ -# wctype_h.m4 serial 26 +# wctype_h.m4 serial 30 dnl A placeholder for ISO C99 , for platforms that lack it. @@ -9,7 +9,7 @@ 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]) @@ -62,7 +62,7 @@ AC_DEFUN([gl_WCTYPE_H], fi AC_SUBST([HAVE_WCTYPE_H]) - if test $GNULIB_OVERRIDES_WINT_T = 1; then + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then REPLACE_ISWCNTRL=1 else case "$gl_cv_func_iswcntrl_works" in @@ -157,24 +157,39 @@ 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_ISWDIGIT=0; AC_SUBST([GNULIB_ISWDIGIT]) - GNULIB_ISWXDIGIT=0; AC_SUBST([GNULIB_ISWXDIGIT]) - 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]) diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 index 2fc7467f4..a49c50813 100644 --- a/m4/wint_t.m4 +++ b/m4/wint_t.m4 @@ -1,4 +1,4 @@ -# wint_t.m4 serial 10 +# wint_t.m4 serial 11 dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,14 +34,14 @@ AC_DEFUN([gt_TYPE_WINT_T], [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 - GNULIB_OVERRIDES_WINT_T=1 + 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/m4/year2038.m4 b/m4/year2038.m4 new file mode 100644 index 000000000..da0f8d730 --- /dev/null +++ b/m4/year2038.m4 @@ -0,0 +1,124 @@ +# year2038.m4 serial 7 +dnl Copyright (C) 2017-2021 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 + /* 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]) +]) -- cgit v1.2.1