diff options
| author | Po Lu <luangruo@yahoo.com> | 2024-09-05 08:41:11 +0800 |
|---|---|---|
| committer | Po Lu <luangruo@yahoo.com> | 2024-09-05 08:45:18 +0800 |
| commit | 1a13c5e63e1eb8fcf15c53ae4ed0caca8b928a3b (patch) | |
| tree | a40610febdebe7a02acf3981b7f966b323c0d1c3 /m4 | |
| parent | a13eef1fae00411bc03165933870de73d10551af (diff) | |
; Update from Gnulib
* configure.ac:
* src/conf_post.h: Remove workarounds now rendered redundant by
Gnulib.
Diffstat (limited to 'm4')
| -rw-r--r-- | m4/builtin-expect.m4 | 4 | ||||
| -rw-r--r-- | m4/errno_h.m4 | 10 | ||||
| -rw-r--r-- | m4/extensions-aix.m4 | 25 | ||||
| -rw-r--r-- | m4/fchmodat.m4 | 14 | ||||
| -rw-r--r-- | m4/fpieee.m4 | 2 | ||||
| -rw-r--r-- | m4/gnulib-common.m4 | 223 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 17 | ||||
| -rw-r--r-- | m4/locale-en.m4 | 137 | ||||
| -rw-r--r-- | m4/malloc.m4 | 7 | ||||
| -rw-r--r-- | m4/realloc.m4 | 7 | ||||
| -rw-r--r-- | m4/sig2str.m4 | 11 | ||||
| -rw-r--r-- | m4/signal_h.m4 | 8 | ||||
| -rw-r--r-- | m4/std-gnu11.m4 | 8 | ||||
| -rw-r--r-- | m4/stdlib_h.m4 | 18 | ||||
| -rw-r--r-- | m4/time_h.m4 | 7 | ||||
| -rw-r--r-- | m4/time_rz.m4 | 30 |
16 files changed, 482 insertions, 46 deletions
diff --git a/m4/builtin-expect.m4 b/m4/builtin-expect.m4 index c7af926b34c..33f255e9f56 100644 --- a/m4/builtin-expect.m4 +++ b/m4/builtin-expect.m4 @@ -1,11 +1,11 @@ # builtin-expect.m4 -# serial 1 +# serial 2 dnl Copyright 2016-2024 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 Check for __builtin_expect. +dnl Provide a GCC-compatible __builtin_expect macro in <config.h>. dnl Written by Paul Eggert. diff --git a/m4/errno_h.m4 b/m4/errno_h.m4 index b6050e5d8e0..920ea6cc653 100644 --- a/m4/errno_h.m4 +++ b/m4/errno_h.m4 @@ -1,5 +1,5 @@ # errno_h.m4 -# serial 14 +# serial 18 dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -10,6 +10,11 @@ AC_PREREQ([2.61]) AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This persuades + dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST. + AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_EGREP_CPP([booboo],[ #include <errno.h> @@ -64,6 +69,9 @@ booboo #if !defined EILSEQ booboo #endif +#if !defined ESOCKTNOSUPPORT +booboo +#endif ], [gl_cv_header_errno_h_complete=no], [gl_cv_header_errno_h_complete=yes]) diff --git a/m4/extensions-aix.m4 b/m4/extensions-aix.m4 new file mode 100644 index 00000000000..990a7ac3ef0 --- /dev/null +++ b/m4/extensions-aix.m4 @@ -0,0 +1,25 @@ +# extensions-aix.m4 +# serial 1 +dnl Copyright (C) 2024 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. + +# On AIX, most extensions are already enabled through the _ALL_SOURCE macro, +# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally +# activates more GNU and Linux-like behaviours, affecting +# - the time_t type, +# - errno values in <errno.h>: ENOTEMPTY +# - functions in <stdlib.h>: malloc calloc realloc valloc +# <https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine> +# - functions in <string.h>: strerror_r (returns 'char *', like glibc) +# - functions in <dirent.h>: scandir, alphasort, readdir_r +# - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r +# - declarations in <unistd.h>: sbrk +# and a couple of secondary <sys/*> header files. + +AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS], +[ + AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], + [Define so that AIX headers are more compatible with GNU/Linux.]) +]) diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4 index e71ee8e8ef6..99dcf58aa7a 100644 --- a/m4/fchmodat.m4 +++ b/m4/fchmodat.m4 @@ -1,5 +1,5 @@ # fchmodat.m4 -# serial 8 +# serial 9 dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -70,12 +70,12 @@ AC_DEFUN([gl_FUNC_FCHMODAT], esac ], [case "$host_os" in - # Guess no on Linux with glibc and Cygwin. - linux-gnu* | cygwin*) gl_cv_func_fchmodat_works="guessing no" ;; - # Guess 'nearly' on AIX. - aix*) gl_cv_func_fchmodat_works="guessing nearly" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_fchmodat_works="$gl_cross_guess_normal" ;; + # Guess no on Linux with glibc and Cygwin. + linux*-gnu* | cygwin*) gl_cv_func_fchmodat_works="guessing no" ;; + # Guess 'nearly' on AIX. + aix*) gl_cv_func_fchmodat_works="guessing nearly" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fchmodat_works="$gl_cross_guess_normal" ;; esac ]) rm -f conftest.fchmodat]) diff --git a/m4/fpieee.m4 b/m4/fpieee.m4 index 665543d0ed8..086d51ddf5b 100644 --- a/m4/fpieee.m4 +++ b/m4/fpieee.m4 @@ -1,5 +1,5 @@ # fpieee.m4 -# serial 2 -*- coding: utf-8 -*- +# serial 2 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 06dd6029759..d985522893f 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,5 +1,5 @@ # gnulib-common.m4 -# serial 95 +# serial 103 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -21,10 +21,22 @@ AC_DEFUN([gl_COMMON_BODY], [ #define _GL_CONFIG_H_INCLUDED 1 ]) AH_VERBATIM([_GL_GNUC_PREREQ], -[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ -#if defined __GNUC__ && defined __GNUC_MINOR__ +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. + Except that + - clang groks GNU C 4.2, even on Windows, where it does not define + __GNUC__. + - The OpenMandriva-modified clang compiler pretends that it groks + GNU C version 13.1, but it doesn't: It does not support + __attribute__ ((__malloc__ (f, i))), nor does it support + __attribute__ ((__warning__ (message))) on a function redeclaration. + - Users can make clang lie as well, through the -fgnuc-version option. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#elif defined __clang__ + /* clang really only groks GNU C 4.2. */ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < 4 + ((minor) <= 2)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif @@ -133,6 +145,23 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAVE___HAS_C_ATTRIBUTE 0 #endif +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in function declarations. There are two problems here. + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration + in any order. + =========================== foo.c = foo.cc =========================== + __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); + [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int); + ====================================================================== + This gives a syntax error + - in C mode with gcc + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and + - in C++ mode with clang++ version < 16, and + - in C++ mode, inside extern "C" {}, still in newer clang++ versions + <https://github.com/llvm/llvm-project/issues/101990>. + */ /* Define if, in a function declaration, the attributes in bracket syntax [[...]] must come before the attributes in __attribute__((...)) syntax. If this is defined, it is best to avoid the bracket syntax, so that the @@ -147,6 +176,176 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 # endif #endif +/* + 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration + - without 'extern', in C as well as in C++, + - with 'extern', in C, + - with 'extern "C"', in C++ + in the same position. That is, we don't want to be forced to use a + macro which arranges for the attribute to come before 'extern' in + one case and after 'extern' in the other case, because such a macro + would make the source code of .h files pretty ugly. + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define ND [[__nodiscard__]] + #define WUR __attribute__((__warn_unused_result__)) + + #ifdef __cplusplus + extern "C" { + #endif + // gcc clang g++ clang++ + + ND int foo (int); + int ND foo (int); // warn error warn error + int foo ND (int); + int foo (int) ND; // warn error warn error + + WUR int foo (int); + int WUR foo (int); + int fo1 WUR (int); // error error error error + int foo (int) WUR; + + #ifdef __cplusplus + } + #endif + + // gcc clang g++ clang++ + + ND extern CC int foo (int); // error error + extern CC ND int foo (int); // error error + extern CC int ND foo (int); // warn error warn error + extern CC int foo ND (int); + extern CC int foo (int) ND; // warn error warn error + + WUR extern CC int foo (int); // warn + extern CC WUR int foo (int); + extern CC int WUR foo (int); + extern CC int foo WUR (int); // error error error error + extern CC int foo (int) WUR; + + ND EXTERN_C_FUNC int foo (int); // error error + EXTERN_C_FUNC ND int foo (int); + EXTERN_C_FUNC int ND foo (int); // warn error warn error + EXTERN_C_FUNC int foo ND (int); + EXTERN_C_FUNC int foo (int) ND; // warn error warn error + + WUR EXTERN_C_FUNC int foo (int); // warn + EXTERN_C_FUNC WUR int foo (int); + EXTERN_C_FUNC int WUR foo (int); + EXTERN_C_FUNC int fo2 WUR (int); // error error error error + EXTERN_C_FUNC int foo (int) WUR; + ====================================================================== + So, if we insist on using the 'extern' keyword ('extern CC' idiom): + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there is one available position: + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is no available position: + it would need to come before 'extern' in C but after 'extern "C"' + in C++. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally + omits the 'extern' keyword: + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there are two available positions: + - before the return type, + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is one available position: + - before the return type. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and + put the attributes before the return type. This works regardless + to what the _GL_ATTRIBUTE_* macros expand. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in static/inline function definitions. + + There are similar constraints as for function declarations. However, here, + we cannot omit the storage-class specifier. Therefore, the following rule + applies: + * The macros + _GL_ATTRIBUTE_CONST + _GL_ATTRIBUTE_DEPRECATED + _GL_ATTRIBUTE_MAYBE_UNUSED + _GL_ATTRIBUTE_NODISCARD + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_REPRODUCIBLE + _GL_ATTRIBUTE_UNSEQUENCED + which may expand to bracket syntax [[...]], must come first, before the + storage-class specifier. + * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax, + are better placed between the storage-class specifier and the return + type. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in variable declarations. + + At which position can they be placed? + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define BD [[__deprecated__]] + #define AD __attribute__ ((__deprecated__)) + + // gcc clang g++ clang++ + + BD extern CC int var; // error error + extern CC BD int var; // error error + extern CC int BD var; // warn error warn error + extern CC int var BD; + + AD extern CC int var; // warn + extern CC AD int var; + extern CC int AD var; + extern CC int var AD; + + BD extern CC int z[]; // error error + extern CC BD int z[]; // error error + extern CC int BD z[]; // warn error warn error + extern CC int z1 BD []; + extern CC int z[] BD; // warn error error + + AD extern CC int z[]; // warn + extern CC AD int z[]; + extern CC int AD z[]; + extern CC int z2 AD []; // error error error error + extern CC int z[] AD; + ====================================================================== + + * For non-array variables, the only good position is after the variable name, + that is, at the end of the declaration. + * For array variables, you will need to distinguish C and C++: + - In C, before the 'extern' keyword. + - In C++, between the 'extern "C"' and the variable's type. + */ ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. [ /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function @@ -488,7 +687,7 @@ AC_DEFUN([gl_COMMON_BODY], [ other attributes. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -1156,7 +1355,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], dnl -Wno-unused-parameter >= 3 >= 3.9 dnl cat > conftest.c <<\EOF - #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-cast-qual -Wno-conversion -Wno-float-equal @@ -1165,23 +1364,23 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], -Wno-unused-function -Wno-unused-parameter #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-float-conversion #endif - #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wimplicit-fallthrough #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-pedantic #endif #if 3 < __clang_major__ + (9 <= __clang_minor__) -Wno-tautological-constant-out-of-range-compare #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-sign-conversion -Wno-type-limits #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 + #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__) -Wno-unsuffixed-float-constants #endif EOF @@ -1364,7 +1563,7 @@ dnl dnl This macro sets two variables: dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" dnl - ac_cv_func_<func> to yes / no / no -dnl The first variable allows distinguishing all three cases. +dnl The first variable allows to distinguish all three cases. dnl The second variable is set, so that an invocation dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) dnl can be used as a drop-in replacement for @@ -1417,7 +1616,7 @@ dnl dnl This macro sets two variables: dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" dnl - ac_cv_func_<func> to yes / no / no -dnl The first variable allows distinguishing all three cases. +dnl The first variable allows to distinguish all three cases. dnl The second variable is set, so that an invocation dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) dnl can be used as a drop-in replacement for diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 79a0f27382a..31784600d44 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -83,6 +83,10 @@ AC_DEFUN([gl_EARLY], # Code from module euidaccess: # Code from module execinfo: # Code from module extensions: + # This is actually already done in the pre-early phase. + # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module extensions-aix: + AC_REQUIRE([gl_USE_AIX_EXTENSIONS]) # Code from module extern-inline: # Code from module faccessat: # Code from module fchmodat: @@ -129,6 +133,7 @@ AC_DEFUN([gl_EARLY], # Code from module lchmod: # Code from module libc-config: # Code from module libgmp: + # Code from module libgmp-mpz: # Code from module limits-h: # Code from module lstat: # Code from module malloc-gnu: @@ -339,6 +344,7 @@ AC_DEFUN([gl_INIT], gl_CONDITIONAL([GL_COND_OBJ_FSTATAT], [test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1]) gl_SYS_STAT_MODULE_INDICATOR([fstatat]) + gl_MODULE_INDICATOR([fstatat]) gl_FSUSAGE gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ @@ -417,6 +423,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_LSTAT ]) gl_SYS_STAT_MODULE_INDICATOR([lstat]) + gl_MODULE_INDICATOR([lstat]) gl_FUNC_MEMMEM_SIMPLE if test $HAVE_MEMMEM = 0 || test $REPLACE_MEMMEM = 1; then AC_LIBOBJ([memmem]) @@ -496,10 +503,12 @@ AC_DEFUN([gl_INIT], gl_PREREQ_REGEX ]) gl_FUNC_SIG2STR - gl_CONDITIONAL([GL_COND_OBJ_SIG2STR], [test $ac_cv_func_sig2str = no]) + gl_CONDITIONAL([GL_COND_OBJ_SIG2STR], + [test $HAVE_SIG2STR = 0 || test $HAVE_STR2SIG = 0]) AM_COND_IF([GL_COND_OBJ_SIG2STR], [ gl_PREREQ_SIG2STR ]) + gl_SIGNAL_MODULE_INDICATOR([sig2str]) gl_FUNC_SIGDESCR_NP gl_CONDITIONAL([GL_COND_OBJ_SIGDESCR_NP], [test $HAVE_SIGDESCR_NP = 0]) gl_STRING_MODULE_INDICATOR([sigdescr_np]) @@ -626,7 +635,8 @@ AC_DEFUN([gl_INIT], ]) gl_TIME_MODULE_INDICATOR([time_r]) gl_TIME_RZ - gl_CONDITIONAL([GL_COND_OBJ_TIME_RZ], [test $HAVE_TIMEZONE_T = 0]) + gl_CONDITIONAL([GL_COND_OBJ_TIME_RZ], + [test $HAVE_TZALLOC = 0 || test $REPLACE_LOCALTIME_RZ = 1 || test $REPLACE_MKTIME_Z = 1]) gl_TIME_MODULE_INDICATOR([time_rz]) gl_FUNC_TIMEGM gl_CONDITIONAL([GL_COND_OBJ_TIMEGM], @@ -1521,6 +1531,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/errno_h.m4 m4/euidaccess.m4 m4/execinfo.m4 + m4/extensions-aix.m4 m4/extensions.m4 m4/extern-inline.m4 m4/faccessat.m4 @@ -1557,7 +1568,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/lchmod.m4 m4/libgmp.m4 m4/limits-h.m4 - m4/locale-fr.m4 + m4/locale-en.m4 m4/lstat.m4 m4/malloc.m4 m4/manywarnings-c++.m4 diff --git a/m4/locale-en.m4 b/m4/locale-en.m4 new file mode 100644 index 00000000000..39d08a23b0b --- /dev/null +++ b/m4/locale-en.m4 @@ -0,0 +1,137 @@ +# locale-en.m4 +# serial 1 +dnl Copyright (C) 2003-2024 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl Determine the name of an English (or American English) locale with +dnl UTF-8 encoding. +AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [ + case "$host_os" in + *-musl* | midipix*) + dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without + dnl any locale file on disk. But they are effectively equivalent to the + dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) + dnl for which localizations (.mo files) have been installed. + gt_cv_locale_en_utf8=en_US.UTF-8 + ;; + *) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include <locale.h> +#include <time.h> +#if HAVE_LANGINFO_CODESET +# include <langinfo.h> +#endif +#include <stdlib.h> +#include <string.h> +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0 + || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0)) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check the third month name. */ + t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24; + if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0) + return 1; +#endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a dot. */ + if (localeconv () ->decimal_point[0] != '.') return 1; +#endif + return 0; +} + ]])]) + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw* | windows*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8='English_United States.65001' + else + # None found. + gt_cv_locale_en_utf8=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name with explicit encoding suffix first + # (this is necessary on Haiku). + if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US.UTF-8 + else + # Test for the locale name without encoding suffix. + if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US + else + # Test for the Solaris 10 locale name. + if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en.UTF-8 + else + # None found. + gt_cv_locale_en_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + ;; + esac + ]) + LOCALE_EN_UTF8="$gt_cv_locale_en_utf8" + case "$LOCALE_EN_UTF8" in #( + '' | *[[\"\$\'*@<:@]]*) + dnl The empty value occurs when the conftest.c program above could not + dnl be compiled. The other values might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"]) + LOCALE_EN_UTF8=none;; + esac + AC_SUBST([LOCALE_EN_UTF8]) +]) diff --git a/m4/malloc.m4 b/m4/malloc.m4 index 41a46937ead..ee6df5c3fb6 100644 --- a/m4/malloc.m4 +++ b/m4/malloc.m4 @@ -1,5 +1,5 @@ # malloc.m4 -# serial 31 +# serial 34 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -45,6 +45,11 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This helps + dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. + REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) diff --git a/m4/realloc.m4 b/m4/realloc.m4 index eb90d5885c7..cc91102836f 100644 --- a/m4/realloc.m4 +++ b/m4/realloc.m4 @@ -1,5 +1,5 @@ # realloc.m4 -# serial 29 +# serial 32 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -45,6 +45,11 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This helps + dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. + if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) fi diff --git a/m4/sig2str.m4 b/m4/sig2str.m4 index 096d0253fcb..acef58a6a40 100644 --- a/m4/sig2str.m4 +++ b/m4/sig2str.m4 @@ -1,5 +1,5 @@ # sig2str.m4 -# serial 7 +# serial 8 dnl Copyright (C) 2002, 2005-2006, 2009-2024 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,14 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_SIG2STR], [ - AC_CHECK_FUNCS([sig2str]) + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_CHECK_FUNCS([sig2str str2sig]) + if test $ac_cv_func_sig2str = no; then + HAVE_SIG2STR=0 + fi + if test $ac_cv_func_str2sig = no; then + HAVE_STR2SIG=0 + fi ]) # Prerequisites of lib/sig2str.c. diff --git a/m4/signal_h.m4 b/m4/signal_h.m4 index 65afa2a1dee..7a7d2b3c526 100644 --- a/m4/signal_h.m4 +++ b/m4/signal_h.m4 @@ -1,5 +1,5 @@ # signal_h.m4 -# serial 22 +# serial 23 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -32,7 +32,8 @@ AC_DEFUN_ONCE([gl_SIGNAL_H], dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[#include <signal.h> - ]], [pthread_sigmask sigaction + ]], [sig2str str2sig + pthread_sigmask sigaction sigaddset sigdelset sigemptyset sigfillset sigismember sigpending sigprocmask]) @@ -74,6 +75,7 @@ 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_SIG2STR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION]) @@ -88,9 +90,11 @@ AC_DEFUN([gl_SIGNAL_H_DEFAULTS], HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) HAVE_RAISE=1; AC_SUBST([HAVE_RAISE]) + HAVE_SIG2STR=1; AC_SUBST([HAVE_SIG2STR]) HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) + HAVE_STR2SIG=1; AC_SUBST([HAVE_STR2SIG]) HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4 index 37324c158e7..e8d5de7a1e1 100644 --- a/m4/std-gnu11.m4 +++ b/m4/std-gnu11.m4 @@ -1,8 +1,11 @@ # std-gnu11.m4 -# serial 1 +# serial 2 # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- +# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us. +m4_ifndef([_AC_C_C23_OPTIONS], [ + # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 # commit 017d5ddd82854911f0119691d91ea8a1438824d6 # dated Sun Apr 3 13:57:17 2016 -0700 @@ -38,7 +41,7 @@ m4_version_prereq([2.70], [], [ # COMPILER ... is a space separated list of C compilers to search for. # This just gives the user an opportunity to specify an alternative # search list for the C compiler. -AC_DEFUN_ONCE([AC_PROG_CC], +AC_DEFUN([AC_PROG_CC], [AC_LANG_PUSH(C)dnl AC_ARG_VAR([CC], [C compiler command])dnl AC_ARG_VAR([CFLAGS], [C compiler flags])dnl @@ -830,3 +833,4 @@ dnl with extended modes being tried first. ])# m4_version_prereq +])# !_AC_C_C23_OPTIONS diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index bb5a6460414..5d9b3017c44 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ # stdlib_h.m4 -# serial 78 +# serial 81 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -37,7 +37,7 @@ AC_DEFUN_ONCE([gl_STDLIB_H], dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_CACHE_CHECK([whether MB_CUR_MAX is correct], [gl_cv_macro_MB_CUR_MAX_good], [ @@ -45,13 +45,13 @@ AC_DEFUN_ONCE([gl_STDLIB_H], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on Solaris. - solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; + # Guess no on Solaris and Haiku. + solaris* | haiku*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include <locale.h> @@ -59,7 +59,7 @@ changequote([,])dnl int main () { int result = 0; - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { if (MB_CUR_MAX < 4) result |= 1; @@ -146,6 +146,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], 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_STACK_TRACE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) @@ -261,4 +262,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) + CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE]) ]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 4ca7305792c..88c76c03c02 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -1,5 +1,5 @@ # time_h.m4 -# serial 26 +# serial 27 dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -163,13 +163,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) - dnl Even GNU libc does not have timezone_t yet. + dnl Even GNU libc does not have timezone_t and tzalloc() yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) + HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC]) REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ]) REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) + REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z]) REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) diff --git a/m4/time_rz.m4 b/m4/time_rz.m4 index 9613597aca0..1a3dd3befb1 100644 --- a/m4/time_rz.m4 +++ b/m4/time_rz.m4 @@ -1,5 +1,5 @@ # time_rz.m4 -# serial 2 +# serial 3 dnl Copyright (C) 2015-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,8 +11,9 @@ dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_RZ], [ - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([gl_TIME_H_DEFAULTS]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([AC_CANONICAL_HOST]) # On Mac OS X 10.6, localtime loops forever with some time_t values. # See Bug#27706, Bug#27736, and @@ -51,4 +52,29 @@ AC_DEFUN([gl_TIME_RZ], if test "$ac_cv_type_timezone_t" = yes; then HAVE_TIMEZONE_T=1 fi + + gl_CHECK_FUNCS_ANDROID([tzalloc], [[#include <time.h>]]) + if test $ac_cv_func_tzalloc = yes; then + HAVE_TZALLOC=1 + fi + dnl Assume that tzalloc, localtime_rz, mktime_z are all defined together. + case "$gl_cv_onwards_func_tzalloc" in + yes) + case "$host_os" in + *-android*) + dnl The Android libc functions localtime_rz, mktime_z don't support + dnl a NULL timezone_t argument. + AC_DEFINE([NEED_TIMEZONE_NULL_SUPPORT], [1], + [Define to 1 if localtime_rz, mktime_z exist and can be used with + non-NULL timezone_t values.]) + REPLACE_LOCALTIME_RZ=1 + REPLACE_MKTIME_Z=1 + ;; + esac + ;; + future*) + REPLACE_LOCALTIME_RZ=1 + REPLACE_MKTIME_Z=1 + ;; + esac ]) |
