From 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:27:12 +0100 Subject: Sync with the latest Gnulib code (d4ec02b3cc) --- gl/m4/00gnulib.m4 | 13 +- gl/m4/__inline.m4 | 7 +- gl/m4/absolute-header.m4 | 7 +- gl/m4/af_alg.m4 | 5 +- gl/m4/alloca.m4 | 5 +- gl/m4/arpa_inet_h.m4 | 5 +- gl/m4/assert_h.m4 | 27 +- gl/m4/base64.m4 | 5 +- gl/m4/btowc.m4 | 85 +++- gl/m4/builtin-expect.m4 | 8 +- gl/m4/byteswap.m4 | 5 +- gl/m4/c-bool.m4 | 8 +- gl/m4/calloc.m4 | 28 +- gl/m4/close.m4 | 7 +- gl/m4/codeset.m4 | 5 +- gl/m4/double-slash-root.m4 | 5 +- gl/m4/dup2.m4 | 7 +- gl/m4/eealloc.m4 | 5 +- gl/m4/environ.m4 | 5 +- gl/m4/errno_h.m4 | 5 +- gl/m4/error.m4 | 22 +- gl/m4/error_h.m4 | 125 ++++++ gl/m4/exponentd.m4 | 7 +- gl/m4/extensions.m4 | 24 +- gl/m4/extern-inline.m4 | 12 +- gl/m4/fclose.m4 | 99 +++++ gl/m4/fcntl-o.m4 | 11 +- gl/m4/fcntl.m4 | 7 +- gl/m4/fcntl_h.m4 | 6 +- gl/m4/fflush.m4 | 18 +- gl/m4/float_h.m4 | 13 +- gl/m4/floorf.m4 | 29 +- gl/m4/fopen.m4 | 24 +- gl/m4/fpurge.m4 | 15 +- gl/m4/freading.m4 | 10 +- gl/m4/free.m4 | 11 +- gl/m4/fseek.m4 | 5 +- gl/m4/fseeko.m4 | 5 +- gl/m4/fstat.m4 | 9 +- gl/m4/fstypename.m4 | 14 +- gl/m4/fsusage.m4 | 14 +- gl/m4/ftell.m4 | 5 +- gl/m4/ftello.m4 | 30 +- gl/m4/getaddrinfo.m4 | 9 +- gl/m4/getdelim.m4 | 14 +- gl/m4/getdtablesize.m4 | 5 +- gl/m4/gethostname.m4 | 9 +- gl/m4/getline.m4 | 23 +- gl/m4/getloadavg.m4 | 37 +- gl/m4/getopt.m4 | 9 +- gl/m4/getprogname.m4 | 33 +- gl/m4/gl-openssl.m4 | 8 +- gl/m4/gnulib-cache.m4 | 2 +- gl/m4/gnulib-common.m4 | 426 ++++++++++++++++--- gl/m4/gnulib-comp.m4 | 100 ++++- gl/m4/gnulib-tool.m4 | 5 +- gl/m4/hostent.m4 | 9 +- gl/m4/idpriv.m4 | 5 +- gl/m4/include_next.m4 | 13 +- gl/m4/inet_ntop.m4 | 9 +- gl/m4/intmax_t.m4 | 5 +- gl/m4/inttypes.m4 | 9 +- gl/m4/inttypes_h.m4 | 5 +- gl/m4/iswblank.m4 | 39 ++ gl/m4/iswctype.m4 | 14 + gl/m4/iswdigit.m4 | 121 ++++++ gl/m4/iswpunct.m4 | 49 +++ gl/m4/iswxdigit.m4 | 111 +++++ gl/m4/langinfo_h.m4 | 5 +- gl/m4/largefile.m4 | 229 +++++----- gl/m4/limits-h.m4 | 31 +- gl/m4/localcharset.m4 | 5 +- gl/m4/locale-fr.m4 | 142 ++++--- gl/m4/locale-ja.m4 | 17 +- gl/m4/locale-zh.m4 | 15 +- gl/m4/locale_h.m4 | 11 +- gl/m4/localeconv.m4 | 42 +- gl/m4/lock.m4 | 5 +- gl/m4/lseek.m4 | 45 +- gl/m4/malloc.m4 | 14 +- gl/m4/malloca.m4 | 5 +- gl/m4/math_h.m4 | 60 ++- gl/m4/mbrtowc.m4 | 123 +++--- gl/m4/mbsinit.m4 | 7 +- gl/m4/mbstate_t.m4 | 5 +- gl/m4/mbtowc.m4 | 10 +- gl/m4/memchr.m4 | 17 +- gl/m4/minmax.m4 | 5 +- gl/m4/mktime.m4 | 15 +- gl/m4/mmap-anon.m4 | 5 +- gl/m4/mode_t.m4 | 5 +- gl/m4/mountlist.m4 | 18 +- gl/m4/msvc-inval.m4 | 5 +- gl/m4/msvc-nothrow.m4 | 5 +- gl/m4/multiarch.m4 | 5 +- gl/m4/musl.m4 | 21 + gl/m4/netdb_h.m4 | 5 +- gl/m4/netinet_in_h.m4 | 5 +- gl/m4/nl_langinfo.m4 | 12 +- gl/m4/nocrash.m4 | 5 +- gl/m4/off_t.m4 | 5 +- gl/m4/open-cloexec.m4 | 8 +- gl/m4/open-slash.m4 | 5 +- gl/m4/open.m4 | 7 +- gl/m4/pathmax.m4 | 5 +- gl/m4/pid_t.m4 | 5 +- gl/m4/printf.m4 | 931 +++++++++++++++++++++++++++++++---------- gl/m4/pthread_rwlock_rdlock.m4 | 43 +- gl/m4/realloc.m4 | 12 +- gl/m4/reallocarray.m4 | 10 +- gl/m4/regex.m4 | 23 +- gl/m4/servent.m4 | 9 +- gl/m4/setenv.m4 | 20 +- gl/m4/setlocale_null.m4 | 46 +- gl/m4/sha256.m4 | 5 +- gl/m4/size_max.m4 | 5 +- gl/m4/snprintf.m4 | 5 +- gl/m4/socketlib.m4 | 19 +- gl/m4/sockets.m4 | 5 +- gl/m4/socklen.m4 | 5 +- gl/m4/sockpfaf.m4 | 5 +- gl/m4/ssize_t.m4 | 31 +- gl/m4/stat-time.m4 | 14 +- gl/m4/stat.m4 | 23 +- gl/m4/std-gnu11.m4 | 5 +- gl/m4/stdalign.m4 | 202 ++++++--- gl/m4/stddef_h.m4 | 20 +- gl/m4/stdint.m4 | 18 +- gl/m4/stdint_h.m4 | 5 +- gl/m4/stdio_h.m4 | 39 +- gl/m4/stdlib_h.m4 | 72 +++- gl/m4/strcase.m4 | 5 +- gl/m4/strcasestr.m4 | 5 +- gl/m4/strerror.m4 | 33 +- gl/m4/string_h.m4 | 18 +- gl/m4/strings_h.m4 | 11 +- gl/m4/strsep.m4 | 5 +- gl/m4/strstr.m4 | 5 +- gl/m4/sys_socket_h.m4 | 5 +- gl/m4/sys_stat_h.m4 | 5 +- gl/m4/sys_types_h.m4 | 5 +- gl/m4/sys_uio_h.m4 | 5 +- gl/m4/threadlib.m4 | 63 ++- gl/m4/time_h.m4 | 48 +-- gl/m4/time_r.m4 | 12 +- gl/m4/timegm.m4 | 11 +- gl/m4/ungetc.m4 | 25 +- gl/m4/unistd_h.m4 | 11 +- gl/m4/unlocked-io.m4 | 13 +- gl/m4/vararrays.m4 | 14 +- gl/m4/vasnprintf.m4 | 207 ++++++++- gl/m4/vasprintf.m4 | 5 +- gl/m4/visibility.m4 | 13 +- gl/m4/vsnprintf.m4 | 5 +- gl/m4/warn-on-use.m4 | 9 +- gl/m4/wchar_h.m4 | 25 +- gl/m4/wchar_t.m4 | 5 +- gl/m4/wcrtomb.m4 | 23 +- gl/m4/wctype.m4 | 52 +++ gl/m4/wctype_h.m4 | 9 +- gl/m4/wint_t.m4 | 5 +- gl/m4/xalloc.m4 | 5 +- gl/m4/xsize.m4 | 5 +- gl/m4/zzgnulib.m4 | 5 +- 164 files changed, 3713 insertions(+), 1296 deletions(-) create mode 100644 gl/m4/error_h.m4 create mode 100644 gl/m4/fclose.m4 create mode 100644 gl/m4/iswblank.m4 create mode 100644 gl/m4/iswctype.m4 create mode 100644 gl/m4/iswdigit.m4 create mode 100644 gl/m4/iswpunct.m4 create mode 100644 gl/m4/iswxdigit.m4 create mode 100644 gl/m4/musl.m4 create mode 100644 gl/m4/wctype.m4 (limited to 'gl/m4') diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index 7fe03e0b..cd167718 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 @@ -1,5 +1,6 @@ -# 00gnulib.m4 serial 8 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# 00gnulib.m4 +# serial 9 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -49,14 +50,14 @@ dnl AC_REQUIRE([gl_COMPILER_CLANG]) [if test $gl_cv_compiler_clang = yes; then dnl Test whether the compiler supports the option dnl '-Werror=implicit-function-declaration'. - save_ac_compile="$ac_compile" + saved_ac_compile="$ac_compile" ac_compile="$ac_compile -Werror=implicit-function-declaration" dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], [gl_cv_compiler_check_decl_option=none]) - ac_compile="$save_ac_compile" + ac_compile="$saved_ac_compile" else gl_cv_compiler_check_decl_option=none fi @@ -71,11 +72,11 @@ dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC dnl in zzgnulib.m4 is inactive, use the original ac_compile. m4_define([_AC_CHECK_DECL_BODY], -[ ac_save_ac_compile="$ac_compile" +[ ac_saved_ac_compile="$ac_compile" if test -n "$ac_compile_for_check_decl"; then ac_compile="$ac_compile_for_check_decl" fi] -m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" +m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_saved_ac_compile" ]) # gl_00GNULIB diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4 index acf8668b..20baf164 100644 --- a/gl/m4/__inline.m4 +++ b/gl/m4/__inline.m4 @@ -1,9 +1,12 @@ -# Test for __inline keyword -dnl Copyright 2017-2023 Free Software Foundation, Inc. +# __inline.m4 +# serial 1 +dnl Copyright 2017-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. +# Test for __inline keyword + AC_DEFUN([gl___INLINE], [ AC_CACHE_CHECK([whether the compiler supports the __inline keyword], diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 index e7947648..0abd6d90 100644 --- a/gl/m4/absolute-header.m4 +++ b/gl/m4/absolute-header.m4 @@ -1,5 +1,6 @@ -# absolute-header.m4 serial 17 -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# absolute-header.m4 +# serial 18 +dnl Copyright (C) 2006-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. @@ -66,7 +67,7 @@ AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], esac changequote(,) case "$host_os" in - mingw*) + mingw* | windows*) dnl For the sake of native Windows compilers (excluding gcc), dnl treat backslash as a directory separator, like /. dnl Actually, these compilers use a double-backslash as diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4 index f4c0d624..33b74945 100644 --- a/gl/m4/af_alg.m4 +++ b/gl/m4/af_alg.m4 @@ -1,5 +1,6 @@ -# af_alg.m4 serial 6 -dnl Copyright 2018-2023 Free Software Foundation, Inc. +# af_alg.m4 +# serial 6 +dnl Copyright 2018-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. diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index c685fac9..dc78dc19 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 @@ -1,5 +1,6 @@ -# alloca.m4 serial 21 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2023 Free Software Foundation, +# alloca.m4 +# serial 21 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index fa5fe831..9eac86d7 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 @@ -1,5 +1,6 @@ -# arpa_inet_h.m4 serial 17 -dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. +# arpa_inet_h.m4 +# serial 17 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 index abba4fa3..b90d0f19 100644 --- a/gl/m4/assert_h.m4 +++ b/gl/m4/assert_h.m4 @@ -1,5 +1,6 @@ -# assert-h.m4 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# assert_h.m4 +# serial 1 +dnl Copyright (C) 2011-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. @@ -9,16 +10,16 @@ dnl From Paul Eggert. AC_DEFUN([gl_ASSERT_H], [ AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], - [gl_save_CFLAGS=$CFLAGS + [gl_saved_CFLAGS=$CFLAGS for gl_working in "yes, a keyword" "yes, an macro"; do AS_CASE([$gl_working], - [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) + [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#if defined __clang__ && __STDC_VERSION__ < 202311 #pragma clang diagnostic error "-Wc2x-extensions" - #pragma clang diagnostic error "-Wc++17-extensions" + #pragma clang diagnostic error "-Wc++1z-extensions" #endif #ifdef INCLUDE_ASSERT_H #include @@ -32,7 +33,7 @@ AC_DEFUN([gl_ASSERT_H], ]])], [gl_cv_static_assert=$gl_working], [gl_cv_static_assert=no]) - CFLAGS=$gl_save_CFLAGS + CFLAGS=$gl_saved_CFLAGS test "$gl_cv_static_assert" != no && break done]) @@ -46,10 +47,13 @@ AC_DEFUN([gl_ASSERT_H], gl_NEXT_HEADERS([assert.h])]) dnl The "zz" puts this toward config.h's end, to avoid potential - dnl collisions with other definitions. #undef assert so that - dnl programs are not tempted to use it without specifically - dnl including assert.h. Break the #undef apart with a comment - dnl so that 'configure' does not comment it out. + dnl collisions with other definitions. + dnl #undef assert so that programs are not tempted to use it without + dnl specifically including assert.h. + dnl #undef __ASSERT_H__ so that on IRIX, when programs later include + dnl , this include actually defines assert. + dnl Break the #undef_s apart with a comment so that 'configure' does + dnl not comment them out. AH_VERBATIM([zzstatic_assert], [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ && (!defined __cplusplus \ @@ -57,6 +61,9 @@ AC_DEFUN([gl_ASSERT_H], && __GNUG__ < 6 && __clang_major__ < 6))) #include #undef/**/assert + #ifdef __sgi + #undef/**/__ASSERT_H__ + #endif /* Solaris 11.4 defines static_assert as a macro with 2 arguments. We need it also to be invocable with a single argument. */ #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index 987930ab..26f2af41 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 @@ -1,5 +1,6 @@ -# base64.m4 serial 4 -dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. +# base64.m4 +# serial 4 +dnl Copyright (C) 2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index 77218a7d..d9dd7036 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 @@ -1,5 +1,6 @@ -# btowc.m4 serial 12 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# btowc.m4 +# serial 14 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -40,12 +41,12 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess no on Cygwin. - cygwin*) gl_cv_func_btowc_nul="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_btowc_nul="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_btowc_nul="guessing yes" ;; + # Guess no on Cygwin. + cygwin*) gl_cv_func_btowc_nul="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_btowc_nul="guessing yes" ;; + # Guess yes otherwise. + *) gl_cv_func_btowc_nul="guessing yes" ;; esac changequote([,])dnl ]) @@ -59,12 +60,12 @@ changequote([,])dnl dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on IRIX. - irix*) gl_cv_func_btowc_eof="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_btowc_eof="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_btowc_eof="guessing yes" ;; + # Guess no on IRIX. + irix*) gl_cv_func_btowc_eof="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;; + # Guess yes otherwise. + *) gl_cv_func_btowc_eof="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none; then @@ -88,6 +89,50 @@ int main () fi ]) + dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: + dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and + dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. + AC_CHECK_FUNCS_ONCE([mbrtowc]) + AC_CACHE_CHECK([whether btowc is consistent with mbrtowc in the C locale], + [gl_cv_func_btowc_consistent], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +int main () +{ +#if HAVE_MBRTOWC + wint_t wc1 = btowc (0x80); + wchar_t wc2 = (wchar_t) 0xbadface; + char buf[1] = { 0x80 }; + mbstate_t state; + memset (&state, 0, sizeof (mbstate_t)); + if (mbrtowc (&wc2, buf, 1, &state) != 1 || wc1 != wc2) + return 1; +#endif + return 0; +}]])], + [gl_cv_func_btowc_consistent=yes], + [gl_cv_func_btowc_consistent=no], + [case "$host_os" in + # Guess no on mingw. + mingw* | windows*) + AC_EGREP_CPP([Problem], [ +#ifdef __MINGW32__ + Problem +#endif + ], + [gl_cv_func_btowc_consistent="guessing no"], + [gl_cv_func_btowc_consistent="guessing yes"]) + ;; + # Guess yes otherwise. + *) gl_cv_func_btowc_consistent="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_btowc_nul" in *yes) ;; *) REPLACE_BTOWC=1 ;; @@ -96,10 +141,22 @@ int main () *yes) ;; *) REPLACE_BTOWC=1 ;; esac + case "$gl_cv_func_btowc_consistent" in + *yes) ;; + *) REPLACE_BTOWC=1 ;; + esac + if test $REPLACE_BTOWC = 0; then + gl_MBRTOWC_C_LOCALE + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in + *yes) ;; + *) REPLACE_BTOWC=1 ;; + esac + fi fi ]) # Prerequisites of lib/btowc.c. AC_DEFUN([gl_PREREQ_BTOWC], [ : + AC_CHECK_FUNCS_ONCE([mbrtowc]) ]) diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 index 531ed48a..c7af926b 100644 --- a/gl/m4/builtin-expect.m4 +++ b/gl/m4/builtin-expect.m4 @@ -1,10 +1,12 @@ -dnl Check for __builtin_expect. - -dnl Copyright 2016-2023 Free Software Foundation, Inc. +# builtin-expect.m4 +# serial 1 +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 Written by Paul Eggert. AC_DEFUN([gl___BUILTIN_EXPECT], diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 index 8058d178..0c76fe93 100644 --- a/gl/m4/byteswap.m4 +++ b/gl/m4/byteswap.m4 @@ -1,5 +1,6 @@ -# byteswap.m4 serial 5 -dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. +# byteswap.m4 +# serial 5 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4 index f614371b..0fb0de3b 100644 --- a/gl/m4/c-bool.m4 +++ b/gl/m4/c-bool.m4 @@ -1,10 +1,12 @@ -# Check for bool that conforms to C2023. - -dnl Copyright 2022-2023 Free Software Foundation, Inc. +# c-bool.m4 +# serial 1 +dnl Copyright 2022-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. +# Check for bool that conforms to C2023. + AC_DEFUN([gl_C_BOOL], [ AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool], diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4 index 23c0dd9f..550cf5cc 100644 --- a/gl/m4/calloc.m4 +++ b/gl/m4/calloc.m4 @@ -1,9 +1,9 @@ -# calloc.m4 serial 29 - -# Copyright (C) 2004-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# calloc.m4 +# serial 31 +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, +dnl with or without modifications, as long as this notice is preserved. # Written by Jim Meyering. @@ -36,14 +36,14 @@ AC_DEFUN([_AC_FUNC_CALLOC_IF], [ac_cv_func_calloc_0_nonnull=no]) else case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # Guess yes on native Windows. - mingw*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;; esac fi ]) diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 index 9f95c670..88c37fab 100644 --- a/gl/m4/close.m4 +++ b/gl/m4/close.m4 @@ -1,10 +1,11 @@ -# close.m4 serial 9 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# close.m4 +# serial 10 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_FUNC_CLOSE], +AC_DEFUN_ONCE([gl_FUNC_CLOSE], [ AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) m4_ifdef([gl_MSVC_INVAL], [ diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index 5804f472..e69b7402 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 @@ -1,5 +1,6 @@ -# codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2023 Free Software +# codeset.m4 +# serial 5 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index 1776e5eb..3437c699 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 @@ -1,5 +1,6 @@ -# double-slash-root.m4 serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2023 Free Software Foundation, Inc. +# double-slash-root.m4 +# serial 4 -*- Autoconf -*- +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 index e1cc73e1..786121fd 100644 --- a/gl/m4/dup2.m4 +++ b/gl/m4/dup2.m4 @@ -1,5 +1,6 @@ -#serial 27 -dnl Copyright (C) 2002, 2005, 2007, 2009-2023 Free Software Foundation, Inc. +# dup2.m4 +# serial 28 +dnl Copyright (C) 2002, 2005, 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, dnl with or without modifications, as long as this notice is preserved. @@ -67,7 +68,7 @@ AC_DEFUN([gl_FUNC_DUP2], ], [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], [case "$host_os" in - mingw*) # on this platform, dup2 always returns 0 for success + mingw* | windows*) # on this platform, dup2 always returns 0 for success gl_cv_func_dup2_works="guessing no" ;; cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 gl_cv_func_dup2_works="guessing no" ;; diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4 index cb3e08fe..8a15e705 100644 --- a/gl/m4/eealloc.m4 +++ b/gl/m4/eealloc.m4 @@ -1,5 +1,6 @@ -# eealloc.m4 serial 3 -dnl Copyright (C) 2003, 2009-2023 Free Software Foundation, Inc. +# eealloc.m4 +# serial 3 +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 741dfc56..107960b2 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 @@ -1,5 +1,6 @@ -# environ.m4 serial 8 -dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. +# environ.m4 +# serial 8 +dnl Copyright (C) 2001-2004, 2006-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. diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 4c70d225..b6050e5d 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,5 +1,6 @@ -# errno_h.m4 serial 14 -dnl Copyright (C) 2004, 2006, 2008-2023 Free Software Foundation, Inc. +# errno_h.m4 +# serial 14 +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 8cc75dff..273b636b 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 @@ -1,22 +1,12 @@ -#serial 15 - -# Copyright (C) 1996-1998, 2001-2004, 2009-2023 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# error.m4 +# serial 16 +dnl Copyright (C) 1996-1998, 2001-2004, 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, +dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_ERROR], [ - dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer - dnl maintained in Autoconf and because it invokes AC_LIBOBJ. - AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[error_at_line (0, 0, "", 0, "an error occurred");]])], - [ac_cv_lib_error_at_line=yes], - [ac_cv_lib_error_at_line=no])]) ]) # Prerequisites of lib/error.c. diff --git a/gl/m4/error_h.m4 b/gl/m4/error_h.m4 new file mode 100644 index 00000000..050a410c --- /dev/null +++ b/gl/m4/error_h.m4 @@ -0,0 +1,125 @@ +# error_h.m4 +# serial 4 +dnl Copyright (C) 1996-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 Provide a working . + +AC_DEFUN_ONCE([gl_ERROR_H], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + gl_CHECK_NEXT_HEADERS([error.h]) + if test $ac_cv_header_error_h = yes; then + HAVE_ERROR_H=1 + else + HAVE_ERROR_H=0 + fi + AC_SUBST([HAVE_ERROR_H]) + + REPLACE_ERROR=0 + + gl_CHECK_FUNCS_ANDROID([error], [[#include ]]) + if test $ac_cv_func_error = yes; then + HAVE_ERROR=1 + else + HAVE_ERROR=0 + case "$gl_cv_onwards_func_error" in + future*) REPLACE_ERROR=1 ;; + esac + fi + + dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer + dnl maintained in Autoconf and because it invokes AC_LIBOBJ. + dnl We need to notice a missing declaration, like gl_CHECK_FUNCS_ANDROID does. + AC_CHECK_DECL([error_at_line], , , [[#include ]]) + if test $ac_cv_have_decl_error_at_line = yes; then + AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[error_at_line (0, 0, "", 0, "an error occurred");]])], + [ac_cv_lib_error_at_line=yes], + [ac_cv_lib_error_at_line=no])]) + else + ac_cv_lib_error_at_line=no + fi + if test $ac_cv_lib_error_at_line = yes; then + HAVE_ERROR_AT_LINE=1 + else + HAVE_ERROR_AT_LINE=0 + fi + REPLACE_ERROR_AT_LINE=0 + + if test $ac_cv_func_error = yes && test $ac_cv_lib_error_at_line = yes; then + dnl On Android 11, when error_print_progname is set, the output of the + dnl error() function contains an extra space. + AC_CACHE_CHECK([for working error function], + [gl_cv_func_working_error], + [if test $cross_compiling != yes; then + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ + #include + static void print_no_progname (void) {} + ]], [[ + error_print_progname = print_no_progname; + error (0, 0, "foo"); + ]]) + ], + [rm -f conftest.out + if test -s conftest$ac_exeext \ + && ./conftest$ac_exeext 2> conftest.out; then + if grep ' ' conftest.out >/dev/null; then + gl_cv_func_working_error=no + else + gl_cv_func_working_error=yes + fi + else + gl_cv_func_working_error=no + fi + rm -f conftest.out + ], + [gl_cv_func_working_error=no]) + else + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + ]], [[ + error (0, 0, "foo"); + ]]) + ], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_error="guessing yes" ;; + # Guess no on Android. + linux*-android*) gl_cv_func_working_error="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_error="$gl_cross_guess_normal" ;; + esac + ], + [gl_cv_func_working_error=no]) + fi + ]) + case "$gl_cv_func_working_error" in + *no) + REPLACE_ERROR=1 + REPLACE_ERROR_AT_LINE=1 + ;; + esac + fi + + if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ + || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then + COMPILE_ERROR_C=1 + else + COMPILE_ERROR_C=0 + fi + + AC_SUBST([HAVE_ERROR]) + AC_SUBST([HAVE_ERROR_AT_LINE]) + AC_SUBST([REPLACE_ERROR]) + AC_SUBST([REPLACE_ERROR_AT_LINE]) +]) diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4 index 2ef46437..db597afc 100644 --- a/gl/m4/exponentd.m4 +++ b/gl/m4/exponentd.m4 @@ -1,9 +1,10 @@ -# exponentd.m4 serial 3 -dnl Copyright (C) 2007-2008, 2010-2023 Free Software Foundation, Inc. +# exponentd.m4 +# serial 4 +dnl Copyright (C) 2007-2008, 2010-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. -AC_DEFUN([gl_DOUBLE_EXPONENT_LOCATION], +AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], [ AC_CACHE_CHECK([where to find the exponent in a 'double'], [gl_cv_cc_double_expbit0], diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 5336b8da..1fb68956 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 @@ -1,10 +1,11 @@ -# serial 23 -*- Autoconf -*- -# Enable extensions on systems that normally disable them. +# extensions.m4 +# serial 25 -*- Autoconf -*- +dnl Copyright (C) 2003, 2006-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. -# Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Enable extensions on systems that normally disable them. dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. @@ -229,4 +230,15 @@ AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], [Define to enable the declarations of ISO C 11 types and functions.]) ;; esac + + dnl On OpenSolaris derivatives, the include files contains a couple of + dnl declarations that are only activated with an explicit + dnl -D__STDC_WANT_LIB_EXT1__. + AH_VERBATIM([USE_ISO_C_23_ANNEX_K_EXTENSIONS], +[/* Define to enable the declarations of ISO C 23 Annex K types and functions. */ +#if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__) +#undef/**/__STDC_WANT_LIB_EXT1__ +#define __STDC_WANT_LIB_EXT1__ 1 +#endif +]) ]) diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index c001b1cf..547da82a 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 @@ -1,10 +1,12 @@ -dnl 'extern inline' a la ISO C99. - -dnl Copyright 2012-2023 Free Software Foundation, Inc. +# extern-inline.m4 +# serial 1 +dnl Copyright 2012-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 'extern inline' a la ISO C99. + AC_DEFUN([gl_EXTERN_INLINE], [ AC_CACHE_CHECK([whether ctype.h defines __header_inline], @@ -79,7 +81,8 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_EXTERN_INLINE_STDHEADER_BUG #endif #if ((__GNUC__ \ - ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + ? (defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + && !defined __PCC__) \ : (199901L <= __STDC_VERSION__ \ && !defined __HP_cc \ && !defined __PGI \ @@ -89,6 +92,7 @@ AC_DEFUN([gl_EXTERN_INLINE], # define _GL_EXTERN_INLINE extern inline # define _GL_EXTERN_INLINE_IN_USE #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined __PCC__ \ && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4 new file mode 100644 index 00000000..0c1358ed --- /dev/null +++ b/gl/m4/fclose.m4 @@ -0,0 +1,99 @@ +# fclose.m4 +# serial 12 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_FUNC_FCLOSE], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + gl_FUNC_FFLUSH_STDIN + case "$gl_cv_func_fflush_stdin" in + *yes) ;; + *) REPLACE_FCLOSE=1 ;; + esac + + AC_REQUIRE([gl_FUNC_CLOSE]) + if test $REPLACE_CLOSE = 1; then + REPLACE_FCLOSE=1 + fi + + case "$host_os" in + openedition) REPLACE_FCLOSE=1 ;; + esac + + if test $REPLACE_FCLOSE = 0; then + gl_FUNC_FCLOSE_STDIN + case "$gl_cv_func_fclose_stdin" in + *yes) ;; + *) REPLACE_FCLOSE=1 ;; + esac + fi +]) + +dnl Determine whether fclose works on input streams. +dnl Sets gl_cv_func_fclose_stdin. + +AC_DEFUN([gl_FUNC_FCLOSE_STDIN], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CACHE_CHECK([whether fclose works on input streams], + [gl_cv_func_fclose_stdin], + [echo hello world > conftest.txt + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + #endif + ]GL_MDA_DEFINES], + [[int fd; + int fd2; + FILE *fp; + fd = open ("conftest.txt", O_RDONLY); + if (fd < 0) + return 1; + if (lseek (fd, 1, SEEK_SET) != 1) + return 2; + fd2 = dup (fd); + if (fd2 < 0) + return 3; + fp = fdopen (fd2, "r"); + if (fp == NULL) + return 4; + if (fgetc (fp) != 'e') + { fclose (fp); return 5; } + /* This fclose() call should reposition the underlying file + descriptor. */ + if (fclose (fp) != 0) + return 6; + if (lseek (fd2, 0, SEEK_CUR) != -1) /* should fail with EBADF */ + return 7; + /* Verify the file position. */ + if (lseek (fd, 0, SEEK_CUR) != 2) + return 8; + return 0; + ]])], + [gl_cv_func_fclose_stdin=yes], + [gl_cv_func_fclose_stdin=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_fclose_stdin="guessing no" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_fclose_stdin="guessing yes" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_fclose_stdin="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_fclose_stdin="$gl_cross_guess_normal" ;; + esac + ]) + rm conftest.txt + ]) +]) diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 59d558bd..43aa1325 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 @@ -1,5 +1,6 @@ -# fcntl-o.m4 serial 7 -dnl Copyright (C) 2006, 2009-2023 Free Software Foundation, Inc. +# fcntl-o.m4 +# serial 8 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -117,9 +118,9 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], *) gl_cv_header_working_fcntl_h='no';; esac], [case "$host_os" in - # Guess 'no' on native Windows. - mingw*) gl_cv_header_working_fcntl_h='no' ;; - *) gl_cv_header_working_fcntl_h=cross-compiling ;; + # Guess 'no' on native Windows. + mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; esac ]) ]) diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 index 524a99af..f6d0f377 100644 --- a/gl/m4/fcntl.m4 +++ b/gl/m4/fcntl.m4 @@ -1,5 +1,6 @@ -# fcntl.m4 serial 11 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# fcntl.m4 +# serial 12 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -82,7 +83,7 @@ AC_DEFUN([gl_FUNC_FCNTL], esac dnl Many systems lack F_DUPFD_CLOEXEC. - dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. + dnl NetBSD 10.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], [gl_cv_func_fcntl_f_dupfd_cloexec], [AC_RUN_IFELSE( diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 68f4e648..b69f7a0c 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 @@ -1,10 +1,12 @@ +# fcntl_h.m4 # serial 20 -# Configure fcntl.h. -dnl Copyright (C) 2006-2007, 2009-2023 Free Software Foundation, Inc. +dnl Copyright (C) 2006-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, dnl with or without modifications, as long as this notice is preserved. +# Configure fcntl.h. + dnl Written by Paul Eggert. AC_DEFUN_ONCE([gl_FCNTL_H], diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4 index 3e3c8903..43fc3bf3 100644 --- a/gl/m4/fflush.m4 +++ b/gl/m4/fflush.m4 @@ -1,9 +1,9 @@ -# fflush.m4 serial 18 - -# Copyright (C) 2007-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# fflush.m4 +# serial 19 +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, +dnl with or without modifications, as long as this notice is preserved. dnl From Eric Blake @@ -79,9 +79,9 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no], [case "$host_os" in - # Guess no on native Windows. - mingw*) gl_cv_func_fflush_stdin="guessing no" ;; - *) gl_cv_func_fflush_stdin=cross ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; + *) gl_cv_func_fflush_stdin=cross ;; esac ]) rm conftest.txt diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index 2f0c9c4e..c95d4171 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 @@ -1,5 +1,6 @@ -# float_h.m4 serial 13 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# float_h.m4 +# serial 14 +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, dnl with or without modifications, as long as this notice is preserved. @@ -84,9 +85,11 @@ int main () [gl_cv_func_itold_works="guessing no"], [gl_cv_func_itold_works="guessing yes"]) ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_itold_works="guessing yes" ;; - *) gl_cv_func_itold_works="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) + gl_cv_func_itold_works="guessing yes" ;; + *) + gl_cv_func_itold_works="guessing yes" ;; esac ]) ]) diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index c49ffa6b..2572c848 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 @@ -1,5 +1,6 @@ -# floorf.m4 serial 18 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# floorf.m4 +# serial 21 +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, dnl with or without modifications, as long as this notice is preserved. @@ -26,7 +27,7 @@ AC_DEFUN([gl_FUNC_FLOORF], AC_CACHE_CHECK([whether floorf works according to ISO C 99 with IEC 60559], [gl_cv_func_floorf_ieee], [ - save_LIBS="$LIBS" + saved_LIBS="$LIBS" LIBS="$LIBS $FLOORF_LIBM" AC_RUN_IFELSE( [AC_LANG_SOURCE([[ @@ -49,17 +50,17 @@ int main (int argc, char *argv[]) [gl_cv_func_floorf_ieee=yes], [gl_cv_func_floorf_ieee=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_floorf_ieee="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_floorf_ieee="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_floorf_ieee="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_floorf_ieee="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_floorf_ieee="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_floorf_ieee="$gl_cross_guess_normal" ;; esac ]) - LIBS="$save_LIBS" + LIBS="$saved_LIBS" ]) case "$gl_cv_func_floorf_ieee" in *yes) ;; @@ -94,7 +95,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], [[x = funcptr(x) + floorf(x);]])], [gl_cv_func_floorf_libm=]) if test "$gl_cv_func_floorf_libm" = "?"; then - save_LIBS="$LIBS" + saved_LIBS="$LIBS" LIBS="$LIBS -lm" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -106,7 +107,7 @@ AC_DEFUN([gl_FUNC_FLOORF_LIBS], float x;]], [[x = funcptr(x) + floorf(x);]])], [gl_cv_func_floorf_libm="-lm"]) - LIBS="$save_LIBS" + LIBS="$saved_LIBS" fi ]) FLOORF_LIBM="$gl_cv_func_floorf_libm" diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4 index 9c39ff72..f3b7aadd 100644 --- a/gl/m4/fopen.m4 +++ b/gl/m4/fopen.m4 @@ -1,15 +1,16 @@ -# fopen.m4 serial 13 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# fopen.m4 +# serial 16 +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, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([gl_FUNC_FOPEN], +AC_DEFUN([gl_FUNC_FOPEN_ITSELF], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in - mingw* | pw*) + mingw* | windows* | pw*) dnl Replace fopen, for handling of "/dev/null". REPLACE_FOPEN=1 dnl fopen on mingw also has the trailing slash bug. @@ -58,6 +59,15 @@ changequote([,])dnl esac ]) +AC_DEFUN([gl_FUNC_FOPEN], +[ + AC_REQUIRE([gl_FUNC_FOPEN_ITSELF]) + AC_REQUIRE([gl_FUNC_FCLOSE]) + if test $REPLACE_FCLOSE = 1; then + REPLACE_FOPEN=1 + fi +]) + AC_DEFUN([gl_FUNC_FOPEN_GNU], [ AC_REQUIRE([gl_FUNC_FOPEN]) @@ -87,7 +97,7 @@ int main () [gl_cv_func_fopen_mode_x=no], [case "$host_os" in # Guess yes on glibc and musl systems. - linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) + linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) gl_cv_func_fopen_mode_x="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. *) @@ -124,10 +134,10 @@ int main () [gl_cv_func_fopen_mode_e=no], [case "$host_os" in # Guess yes on glibc and musl systems. - linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl*) + linux*-gnu* | gnu* | kfreebsd*-gnu | *-musl* | midipix*) gl_cv_func_fopen_mode_e="guessing yes" ;; # Guess no on native Windows. - mingw*) + mingw* | windows*) gl_cv_func_fopen_mode_e="guessing no" ;; # If we don't know, obey --enable-cross-guesses. *) diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4 index b365409d..a77f5b96 100644 --- a/gl/m4/fpurge.m4 +++ b/gl/m4/fpurge.m4 @@ -1,5 +1,6 @@ -# fpurge.m4 serial 12 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# fpurge.m4 +# serial 14 +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, dnl with or without modifications, as long as this notice is preserved. @@ -10,7 +11,7 @@ AC_DEFUN([gl_FUNC_FPURGE], AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([stdio_ext.h]) AC_CHECK_FUNCS_ONCE([fpurge]) - AC_CHECK_FUNCS_ONCE([__fpurge]) + gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include ]]) AC_CHECK_DECLS([fpurge], , , [[#include ]]) if test "x$ac_cv_func_fpurge" = xyes; then HAVE_FPURGE=1 @@ -53,10 +54,10 @@ AC_DEFUN([gl_FUNC_FPURGE], [gl_cv_func_fpurge_works=yes], [gl_cv_func_fpurge_works=no], [case "$host_os" in - # Guess yes on musl systems. - *-musl*) gl_cv_func_fpurge_works="guessing yes" ;; - # Otherwise obey --enable-cross-guesses. - *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;; + # Otherwise obey --enable-cross-guesses. + *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4 index 35333369..be899456 100644 --- a/gl/m4/freading.m4 +++ b/gl/m4/freading.m4 @@ -1,5 +1,6 @@ -# freading.m4 serial 2 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# freading.m4 +# serial 3 +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, dnl with or without modifications, as long as this notice is preserved. @@ -7,5 +8,8 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_FREADING], [ AC_CHECK_HEADERS_ONCE([stdio_ext.h]) - AC_CHECK_FUNCS_ONCE([__freading]) + gl_CHECK_FUNCS_ANDROID([__freading], + [[#include + #include + ]]) ]) diff --git a/gl/m4/free.m4 b/gl/m4/free.m4 index 0389dea3..a2b596d6 100644 --- a/gl/m4/free.m4 +++ b/gl/m4/free.m4 @@ -1,8 +1,9 @@ -# free.m4 serial 6 -# Copyright (C) 2003-2005, 2009-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# free.m4 +# serial 6 +dnl Copyright (C) 2003-2005, 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, +dnl with or without modifications, as long as this notice is preserved. # Written by Paul Eggert and Bruno Haible. diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4 index c5fe688c..fb220a1f 100644 --- a/gl/m4/fseek.m4 +++ b/gl/m4/fseek.m4 @@ -1,5 +1,6 @@ -# fseek.m4 serial 4 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# fseek.m4 +# serial 4 +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 index 05ee06bc..5682a1f2 100644 --- a/gl/m4/fseeko.m4 +++ b/gl/m4/fseeko.m4 @@ -1,5 +1,6 @@ -# fseeko.m4 serial 20 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# fseeko.m4 +# serial 20 +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4 index 7cb2edb0..47777b0c 100644 --- a/gl/m4/fstat.m4 +++ b/gl/m4/fstat.m4 @@ -1,5 +1,6 @@ -# fstat.m4 serial 8 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# fstat.m4 +# serial 10 +dnl Copyright (C) 2011-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. @@ -10,10 +11,10 @@ AC_DEFUN([gl_FUNC_FSTAT], AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) case "$host_os" in - mingw* | solaris*) + darwin* | mingw* | windows* | solaris*) + dnl macOS and Solaris stat can return a negative tv_nsec. dnl On MinGW, the original stat() returns st_atime, st_mtime, dnl st_ctime values that are affected by the time zone. - dnl Solaris stat can return a negative tv_nsec. REPLACE_FSTAT=1 ;; esac diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index f65c459f..05a68805 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 @@ -1,4 +1,10 @@ -#serial 6 +# fstypename.m4 +# serial 6 +dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software +dnl Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. dnl @@ -6,12 +12,6 @@ dnl See if struct statfs has the f_fstypename member. dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. dnl -# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2023 Free Software -# Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - AC_DEFUN([gl_FSTYPENAME], [ AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 88f3ca81..1ce90660 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 @@ -1,11 +1,11 @@ +# fsusage.m4 # serial 35 -# Obtaining file system usage information. +dnl Copyright (C) 1997-1998, 2000-2001, 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. -# Copyright (C) 1997-1998, 2000-2001, 2003-2023 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Obtaining file system usage information. # Written by Jim Meyering. @@ -269,7 +269,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; # Check for SunOS statfs brokenness wrt partitions 2GB and larger. # If exists and struct statfs has a member named f_spare, -# enable the work-around code in fsusage.c. +# enable the workaround code in fsusage.c. AC_DEFUN([gl_STATFS_TRUNCATES], [ AC_CACHE_CHECK([for statfs that truncates block counts], diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4 index 79f1aaf2..ab10736b 100644 --- a/gl/m4/ftell.m4 +++ b/gl/m4/ftell.m4 @@ -1,5 +1,6 @@ -# ftell.m4 serial 3 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# ftell.m4 +# serial 3 +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 index 4901b168..0eb8fa0d 100644 --- a/gl/m4/ftello.m4 +++ b/gl/m4/ftello.m4 @@ -1,5 +1,6 @@ -# ftello.m4 serial 14 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# ftello.m4 +# serial 16 +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, dnl with or without modifications, as long as this notice is preserved. @@ -37,13 +38,24 @@ AC_DEFUN([gl_FUNC_FTELLO], if test $gl_cv_var_stdin_large_offset = no; then REPLACE_FTELLO=1 fi + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $REPLACE_FTELLO = 0; then + dnl On native Windows, in some circumstances, ftell(), ftello(), + dnl fgetpos(), lseek(), _lseeki64() all succeed on devices of type + dnl FILE_TYPE_PIPE. However, to match POSIX behaviour, we want + dnl ftell(), ftello(), fgetpos(), lseek() to fail when the argument fd + dnl designates a pipe. See also + dnl https://github.com/python/cpython/issues/78961#issuecomment-1093800325 + case "$host_os" in + mingw* | windows*) REPLACE_FTELLO=1 ;; + esac + fi if test $REPLACE_FTELLO = 0; then dnl Detect bug on Solaris. dnl ftell and ftello produce incorrect results after putc that followed a dnl getc call that reached EOF on Solaris. This is because the _IOREAD dnl flag does not get cleared in this case, even though _IOWRT gets set, dnl and ftell and ftello look whether the _IOREAD flag is set. - AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether ftello works], [gl_cv_func_ftello_works], [ @@ -51,12 +63,12 @@ AC_DEFUN([gl_FUNC_FTELLO], dnl be opened. changequote(,)dnl case "$host_os" in - # Guess no on Solaris. - solaris*) gl_cv_func_ftello_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_ftello_works="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_ftello_works="guessing yes" ;; + # Guess no on Solaris. + solaris*) gl_cv_func_ftello_works="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_ftello_works="guessing yes" ;; + # Guess yes otherwise. + *) gl_cv_func_ftello_works="guessing yes" ;; esac changequote([,])dnl AC_RUN_IFELSE( diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 15f09ffb..8e209177 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,5 +1,6 @@ -# getaddrinfo.m4 serial 34 -dnl Copyright (C) 2004-2023 Free Software Foundation, Inc. +# getaddrinfo.m4 +# serial 35 +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, dnl with or without modifications, as long as this notice is preserved. @@ -41,7 +42,7 @@ AC_DEFUN([gl_GETADDRINFO], AC_CACHE_CHECK([for getaddrinfo in ws2tcpip.h and -lws2_32], gl_cv_w32_getaddrinfo, [ gl_cv_w32_getaddrinfo=no - am_save_LIBS="$LIBS" + gl_saved_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_WS2TCPIP_H @@ -49,7 +50,7 @@ AC_DEFUN([gl_GETADDRINFO], #endif #include ]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])], [gl_cv_w32_getaddrinfo=yes]) - LIBS="$am_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test "$gl_cv_w32_getaddrinfo" = "yes"; then GETADDRINFO_LIB="-lws2_32" diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 9aaed202..61139039 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,6 +1,7 @@ -# getdelim.m4 serial 16 +# getdelim.m4 +# serial 19 -dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,7 +19,7 @@ AC_DEFUN([gl_FUNC_GETDELIM], AC_CHECK_DECLS_ONCE([getdelim]) - AC_CHECK_FUNCS_ONCE([getdelim]) + gl_CHECK_FUNCS_ANDROID([getdelim], [[#include ]]) if test $ac_cv_func_getdelim = yes; then HAVE_GETDELIM=1 dnl Found it in some library. Verify that it works. @@ -82,8 +83,8 @@ AC_DEFUN([gl_FUNC_GETDELIM], ], [gl_cv_func_working_getdelim="guessing yes"], [case "$host_os" in - *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; - *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; + *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;; + *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; esac ]) ]) @@ -96,6 +97,9 @@ AC_DEFUN([gl_FUNC_GETDELIM], esac else HAVE_GETDELIM=0 + case "$gl_cv_onwards_func_getdelim" in + future*) REPLACE_GETDELIM=1 ;; + esac fi if test $ac_cv_have_decl_getdelim = no; then diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 index 8bcda905..aaefe9b2 100644 --- a/gl/m4/getdtablesize.m4 +++ b/gl/m4/getdtablesize.m4 @@ -1,5 +1,6 @@ -# getdtablesize.m4 serial 8 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# getdtablesize.m4 +# serial 8 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 63f5f636..2f743b7d 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 @@ -1,5 +1,6 @@ -# gethostname.m4 serial 15 -dnl Copyright (C) 2002, 2008-2023 Free Software Foundation, Inc. +# gethostname.m4 +# serial 16 +dnl Copyright (C) 2002, 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, dnl with or without modifications, as long as this notice is preserved. @@ -20,7 +21,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], AC_CACHE_CHECK([for gethostname in winsock2.h and -lws2_32], [gl_cv_w32_gethostname], [gl_cv_w32_gethostname=no - gl_save_LIBS="$LIBS" + gl_saved_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_WINSOCK2_H @@ -28,7 +29,7 @@ AC_DEFUN([gl_FUNC_GETHOSTNAME], #endif #include ]], [[gethostname(NULL, 0);]])], [gl_cv_w32_gethostname=yes]) - LIBS="$gl_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test "$gl_cv_w32_gethostname" = "yes"; then GETHOSTNAME_LIB="-lws2_32" diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 03569f06..36513cd4 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 @@ -1,6 +1,7 @@ -# getline.m4 serial 30 +# getline.m4 +# serial 33 -dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, dnl Inc. dnl dnl This file is free software; the Free Software Foundation @@ -23,12 +24,9 @@ AC_DEFUN([gl_FUNC_GETLINE], AC_CHECK_DECLS_ONCE([getline]) - gl_getline_needs_run_time_check=no - AC_CHECK_FUNC([getline], - [dnl Found it in some library. Verify that it works. - gl_getline_needs_run_time_check=yes], - [am_cv_func_working_getline=no]) - if test $gl_getline_needs_run_time_check = yes; then + gl_CHECK_FUNCS_ANDROID([getline], [[#include ]]) + if test $ac_cv_func_getline = yes; then + dnl Found it in some library. Verify that it works. AC_CACHE_CHECK([for working getline function], [am_cv_func_working_getline], [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data @@ -79,12 +77,17 @@ AC_DEFUN([gl_FUNC_GETLINE], ], [am_cv_func_working_getline="guessing yes"], [case "$host_os" in - *-musl*) am_cv_func_working_getline="guessing yes" ;; - *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; + *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;; + *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; esac ]) ]) ]) + else + am_cv_func_working_getline=no + case "$gl_cv_onwards_func_getline" in + future*) REPLACE_GETLINE=1 ;; + esac fi if test $ac_cv_have_decl_getline = no; then diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 79e420ba..0918bcd2 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 @@ -1,13 +1,12 @@ -# Check for getloadavg. - -# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free Software -# Foundation, Inc. +# getloadavg.m4 +# serial 13 +dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software +dnl Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 10 +# Check for getloadavg. # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent. # New applications should use gl_GETLOADAVG instead. @@ -20,13 +19,18 @@ AC_DEFUN([gl_GETLOADAVG], # Persuade glibc to declare getloadavg(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) -gl_save_LIBS=$LIBS +gl_saved_LIBS=$LIBS # getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. HAVE_GETLOADAVG=1 -AC_CHECK_FUNC([getloadavg], [], - [gl_func_getloadavg_done=no +gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include ]]) +if test $ac_cv_func_getloadavg != yes; then + case "$gl_cv_onwards_func_getloadavg" in + future*) REPLACE_GETLOADAVG=1 ;; + esac + + gl_func_getloadavg_done=no # Some systems with -lutil have (and need) -lkvm as well, some do not. # On Solaris, -lkvm requires nlist from -lelf, so check that first @@ -73,14 +77,15 @@ AC_CHECK_FUNC([getloadavg], [], AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with .]) AC_CHECK_LIB([dgc], [dg_sys_info])]) fi - fi]) + fi +fi -if test "x$gl_save_LIBS" = x; then +if test "x$gl_saved_LIBS" = x; then GETLOADAVG_LIBS=$LIBS else - GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_save_LIBS!!"` + GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$gl_saved_LIBS!!"` fi -LIBS=$gl_save_LIBS +LIBS=$gl_saved_LIBS AC_SUBST([GETLOADAVG_LIBS])dnl diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 7981a095..297722ea 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 @@ -1,5 +1,6 @@ -# getopt.m4 serial 48 -dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc. +# getopt.m4 +# serial 49 +dnl Copyright (C) 2002-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, dnl with or without modifications, as long as this notice is preserved. @@ -197,8 +198,8 @@ main () fi else case "$host_os" in - darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; - *) gl_cv_func_getopt_posix="guessing yes";; + darwin* | aix* | mingw* | windows*) gl_cv_func_getopt_posix="guessing no";; + *) gl_cv_func_getopt_posix="guessing yes";; esac fi ]) diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 index b67c527c..b24f4480 100644 --- a/gl/m4/getprogname.m4 +++ b/gl/m4/getprogname.m4 @@ -1,16 +1,33 @@ -# getprogname.m4 - check for getprogname or replacements for it +# getprogname.m4 +# serial 8 +dnl Copyright (C) 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. -# Copyright (C) 2016-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 +# Check for getprogname or replacements for it AC_DEFUN([gl_FUNC_GETPROGNAME], [ - AC_CHECK_FUNCS_ONCE([getprogname getexecname]) + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + gl_CHECK_FUNCS_ANDROID([getprogname], [[#include ]]) + if test $ac_cv_func_getprogname = no; then + HAVE_GETPROGNAME=0 + case "$gl_cv_onwards_func_getprogname" in + future*) REPLACE_GETPROGNAME=1 ;; + esac + fi + AC_CHECK_DECLS([program_invocation_name], + [], + [HAVE_DECL_PROGRAM_INVOCATION_NAME=0], + [[#include ]]) +]) + +AC_DEFUN([gl_PREREQ_GETPROGNAME], +[ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_FUNCS_ONCE([getexecname]) ac_found=0 AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], [#include ]) diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 index 7eab4e10..c5e1f7ba 100644 --- a/gl/m4/gl-openssl.m4 +++ b/gl/m4/gl-openssl.m4 @@ -1,5 +1,6 @@ -# gl-openssl.m4 serial 6 -dnl Copyright (C) 2013-2023 Free Software Foundation, Inc. +# gl-openssl.m4 +# serial 7 +dnl Copyright (C) 2013-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. @@ -39,6 +40,9 @@ AC_DEFUN([gl_CRYPTO_CHECK], AC_SUBST([LIB_CRYPTO]) if test "x$with_openssl" != xno; then if test "x$with_openssl" = xauto-gpl-compat; then + dnl OpenSSL versions < 3 are under the OpenSSL license, which is not + dnl GPL compatible. + dnl See . AC_CACHE_CHECK([whether openssl is GPL compatible], [gl_cv_openssl_gpl_compat], [AC_COMPILE_IFELSE( diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index 267f0692..fcf84226 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 Free Software Foundation, Inc. +# Copyright (C) 2002-2024 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index facc3404..cb730449 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,5 +1,6 @@ -# gnulib-common.m4 serial 75a -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# gnulib-common.m4 +# serial 93 +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, dnl with or without modifications, as long as this notice is preserved. @@ -15,6 +16,10 @@ AC_DEFUN([gl_COMMON], [ AC_REQUIRE([gl_ZZGNULIB]) ]) AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([0witness], +[/* Witness that has been included. */ +#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__ @@ -72,50 +77,74 @@ AC_DEFUN([gl_COMMON_BODY], [ #endif]) AH_VERBATIM([attribute], [/* Attributes. */ -#if (defined __has_attribute \ - && (!defined __clang_minor__ \ - || (defined __apple_build_version__ \ - ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))) -# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) -#else -# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr -# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) -# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) -# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) -# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) -# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) -# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) -# define _GL_ATTR_diagnose_if 0 -# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) -# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) -# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) -# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) -# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) -# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) -# ifdef _ICC -# define _GL_ATTR_may_alias 0 +/* Define _GL_HAS_ATTRIBUTE only once, because on FreeBSD, with gcc < 5, if + gets included once again after , __has_attribute(x) + expands to 0 always, and redefining _GL_HAS_ATTRIBUTE would turn off all + attributes. */ +#ifndef _GL_HAS_ATTRIBUTE +# if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || (defined __apple_build_version__ \ + ? 7000000 <= __apple_build_version__ \ + : 5 <= __clang_major__))) +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) # else -# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_diagnose_if 0 +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) # endif -# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) -# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) -# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) -# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) -# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) -# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) -# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) -# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) -# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) -# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) #endif -/* Disable GCC -Wpedantic if using __has_c_attribute and this is not C23+. */ -#if (defined __has_c_attribute && _GL_GNUC_PREREQ (4, 6) \ - && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710) -# pragma GCC diagnostic ignored "-Wpedantic" +/* Use __has_c_attribute if available. However, do not use with + pre-C23 GCC, which can issue false positives if -Wpedantic. */ +#if (defined __has_c_attribute \ + && ! (_GL_GNUC_PREREQ (4, 6) \ + && (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)) +# define _GL_HAVE___HAS_C_ATTRIBUTE 1 +#else +# define _GL_HAVE___HAS_C_ATTRIBUTE 0 #endif +/* 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 + various _GL_ATTRIBUTE_* can be cumulated on the same declaration in any + order. */ +#ifdef __cplusplus +# if defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#else +# if defined __GNUC__ && !defined __clang__ +# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 +# endif +#endif ]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 @@ -223,9 +252,11 @@ AC_DEFUN([gl_COMMON_BODY], [ - typedef, in C++ also: namespace, class, template specialization. */ #ifndef _GL_ATTRIBUTE_DEPRECATED -# ifdef __has_c_attribute -# if __has_c_attribute (__deprecated__) -# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__deprecated__) +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +# endif # endif # endif # if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated) @@ -271,7 +302,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* Applies to: Empty statement (;), inside a 'switch' statement. */ /* Always expands to something. */ #ifndef _GL_ATTRIBUTE_FALLTHROUGH -# ifdef __has_c_attribute +# if _GL_HAVE___HAS_C_ATTRIBUTE # if __has_c_attribute (__fallthrough__) # define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] # endif @@ -351,11 +382,19 @@ AC_DEFUN([gl_COMMON_BODY], [ in C++ also: class. */ /* In C++ and C23, this is spelled [[__maybe_unused__]]. GCC's syntax is __attribute__ ((__unused__)). - clang supports both syntaxes. */ + clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode, + __has_c_attribute (__maybe_unused__) yields true but the use of + [[__maybe_unused__]] nevertheless produces a warning. */ #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED -# ifdef __has_c_attribute -# if __has_c_attribute (__maybe_unused__) -# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus +# if !defined __apple_build_version__ && __clang_major__ >= 10 +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__maybe_unused__) +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +# endif # endif # endif # ifndef _GL_ATTRIBUTE_MAYBE_UNUSED @@ -373,9 +412,20 @@ AC_DEFUN([gl_COMMON_BODY], [ the return value, unless the caller uses something like ignore_value. */ /* Applies to: function, enumeration, class. */ #ifndef _GL_ATTRIBUTE_NODISCARD -# ifdef __has_c_attribute -# if __has_c_attribute (__nodiscard__) -# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if defined __clang__ && defined __cplusplus + /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces + a warning. + The 1000 below means a yet unknown threshold. When clang++ version X + starts supporting [[__nodiscard__]] without warning about it, you can + replace the 1000 with X. */ +# if __clang_major__ >= 1000 +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif +# elif _GL_HAVE___HAS_C_ATTRIBUTE +# if __has_c_attribute (__nodiscard__) +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +# endif # endif # endif # if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result) @@ -427,11 +477,25 @@ AC_DEFUN([gl_COMMON_BODY], [ /* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions. */ /* Applies to: functions. */ +/* After a function's parameter list, this attribute must come first, before + other attributes. */ #ifndef _GL_ATTRIBUTE_NOTHROW -# if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus -# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +# if defined __cplusplus +# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if __cplusplus >= 201103L +# define _GL_ATTRIBUTE_NOTHROW noexcept (true) +# else +# define _GL_ATTRIBUTE_NOTHROW throw () +# endif +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif # else -# define _GL_ATTRIBUTE_NOTHROW +# if _GL_HAS_ATTRIBUTE (nothrow) +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +# else +# define _GL_ATTRIBUTE_NOTHROW +# endif # endif #endif @@ -441,8 +505,10 @@ AC_DEFUN([gl_COMMON_BODY], [ minimizing the memory required. */ /* Applies to: struct members, struct, union, in C++ also: class. */ +/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite + __has_attribute OK. */ #ifndef _GL_ATTRIBUTE_PACKED -# if _GL_HAS_ATTRIBUTE (packed) +# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) # else # define _GL_ATTRIBUTE_PACKED @@ -512,6 +578,18 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_UNUSED_LABEL # endif #endif +]) + AH_VERBATIM([c_linkage], +[/* In C++, there is the concept of "language linkage", that encompasses + name mangling and function calling conventions. + The following macros start and end a block of "C" linkage. */ +#ifdef __cplusplus +# define _GL_BEGIN_C_LINKAGE extern "C" { +# define _GL_END_C_LINKAGE } +#else +# define _GL_BEGIN_C_LINKAGE +# define _GL_END_C_LINKAGE +#endif ]) AH_VERBATIM([async_safe], [/* The _GL_ASYNC_SAFE marker should be attached to functions that are @@ -568,7 +646,7 @@ AC_DEFUN([gl_COMMON_BODY], [ dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). AC_ARG_ENABLE([cross-guesses], - [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], + [AS_HELP_STRING([[--enable-cross-guesses={conservative|risky}]], [specify policy for cross-compilation guesses])], [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) @@ -1005,6 +1083,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], dnl -Wno-pedantic >= 4.8 >= 3.9 dnl -Wno-sign-compare >= 3 >= 3.9 dnl -Wno-sign-conversion >= 4.3 >= 3.9 + dnl -Wno-tautological-out-of-range-compare - >= 3.9 dnl -Wno-type-limits >= 4.3 >= 3.9 dnl -Wno-undef >= 3 >= 3.9 dnl -Wno-unsuffixed-float-constants >= 4.5 @@ -1030,6 +1109,9 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__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) -Wno-sign-conversion -Wno-type-limits @@ -1080,6 +1162,238 @@ AC_DEFUN([gl_CONDITIONAL_HEADER], m4_popdef([gl_header_name]) ]) +dnl Preparations for gl_CHECK_FUNCS_MACOS. +AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_COMPILER_CLANG]) + AC_CACHE_CHECK([for compiler option needed when checking for future declarations], + [gl_cv_compiler_check_future_option], + [case "$host_os" in + dnl This is only needed on macOS. + darwin*) + if test $gl_cv_compiler_clang = yes; then + dnl Test whether the compiler supports the option + dnl '-Werror=unguarded-availability-new'. + saved_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=unguarded-availability-new" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'], + [gl_cv_compiler_check_future_option=none]) + ac_compile="$saved_ac_compile" + else + gl_cv_compiler_check_future_option=none + fi + ;; + *) gl_cv_compiler_check_future_option=none ;; + esac + ]) +]) + +dnl Pieces of the expansion of +dnl gl_CHECK_FUNCS_ANDROID +dnl gl_CHECK_FUNCS_MACOS +dnl gl_CHECK_FUNCS_ANDROID_MACOS + +AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE], +[ + *) + AC_CHECK_FUNC([$1]) + [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] + ;; +]) + +AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID], +[ + linux*-android*) + AC_CHECK_DECL([$1], , , [$2]) + if test $[ac_cv_have_decl_][$1] = yes; then + AC_CHECK_FUNC([[$1]]) + if test $[ac_cv_func_][$1] = yes; then + [gl_cv_onwards_func_][$1]=yes + else + dnl The function is declared but does not exist. This should not + dnl happen normally. But anyway, we know that a future version + dnl of Android will have the function. + [gl_cv_onwards_func_][$1]='future OS version' + fi + else + [gl_cv_onwards_func_][$1]='future OS version' + fi + ;; +]) + +AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS], +[ + darwin*) + if test "x$gl_cv_compiler_check_future_option" != "xnone"; then + dnl Use a compile test, not a link test. + saved_ac_compile="$ac_compile" + ac_compile="$ac_compile $gl_cv_compiler_check_future_option" + saved_ac_compile_for_check_decl="$ac_compile_for_check_decl" + ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option" + unset [ac_cv_have_decl_][$1] + AC_CHECK_DECL([$1], , , [$2]) + ac_compile="$saved_ac_compile" + ac_compile_for_check_decl="$saved_ac_compile_for_check_decl" + [ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]" + if test $[ac_cv_func_][$1] = yes; then + [gl_cv_onwards_func_][$1]=yes + else + unset [ac_cv_have_decl_][$1] + AC_CHECK_DECL([$1], , , [$2]) + if test $[ac_cv_have_decl_][$1] = yes; then + [gl_cv_onwards_func_][$1]='future OS version' + else + [gl_cv_onwards_func_][$1]=no + fi + fi + else + AC_CHECK_FUNC([$1]) + [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1] + fi + ;; +]) + +AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS], +[ + case "$[gl_cv_onwards_func_][$1]" in + future*) [ac_cv_func_][$1]=no ;; + *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;; + esac + if test $[ac_cv_func_][$1] = yes; then + AC_DEFINE([HAVE_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), + [1], [Define to 1 if you have the `$1' function.]) + fi +]) + +dnl gl_CHECK_FUNCS_ANDROID([func], [[#include ]]) +dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem +dnl on Android. +dnl +dnl When code is compiled on Android, it is in the context of a certain +dnl "Android API level", which indicates the minimum version of Android on +dnl which the app can be installed. In other words, you don't compile for a +dnl specific version of Android. You compile for all versions of Android, +dnl onwards from the given API level. +dnl Thus, the question "does the OS have the function func" has three possible +dnl answers: +dnl - yes, in all versions starting from the given API level, +dnl - no, in no version, +dnl - not in the given API level, but in a later version of Android. +dnl +dnl In detail, this works as follows: +dnl If func was added to Android API level, say, 28, then the libc.so has the +dnl symbol func always, whereas the header file declares func +dnl conditionally: +dnl #if __ANDROID_API__ >= 28 +dnl ... func (...) __INTRODUCED_IN(28); +dnl #endif +dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28", +dnl the function func is declared and exists in libc. +dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27", +dnl the function func is not declared but exists in libc. +dnl +dnl This macro sets two variables: +dnl - gl_cv_onwards_func_ to yes / no / "future OS version" +dnl - ac_cv_func_ to yes / no / no +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 ]]) +dnl can be used as a drop-in replacement for +dnl AC_CHECK_FUNCS([func]). +AC_DEFUN([gl_CHECK_FUNCS_ANDROID], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([for [$1]], + [[gl_cv_onwards_func_][$1]], + [gl_SILENT([ + case "$host_os" in + gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) + gl_CHECK_FUNCS_DEFAULT_CASE([$1]) + esac + ]) + ]) + gl_CHECK_FUNCS_SET_RESULTS([$1]) +]) + +dnl gl_CHECK_FUNCS_MACOS([func], [[#include ]]) +dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem +dnl on macOS. +dnl +dnl When code is compiled on macOS, it is in the context of a certain minimum +dnl macOS version, that can be set through the option '-mmacosx-version-min='. +dnl In other words, you don't compile for a specific version of macOS. You +dnl compile for all versions of macOS, onwards from the given version. +dnl Thus, the question "does the OS have the function func" has three possible +dnl answers: +dnl - yes, in all versions starting from the given version, +dnl - no, in no version, +dnl - not in the given version, but in a later version of macOS. +dnl +dnl In detail, this works as follows: +dnl If func was added to, say, macOS version 13, then the libc has the +dnl symbol func always, whereas the header file declares func +dnl conditionally with a special availability attribute: +dnl ... func (...) __attribute__((availability(macos,introduced=13.0))); +dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no +dnl warning about the use of func, and the resulting binary +dnl - runs fine on macOS 13, +dnl - aborts with a dyld "Symbol not found" message on macOS 12. +dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a +dnl warning: 'func' is only available on macOS 13.0 or newer +dnl [-Wunguarded-availability-new], +dnl and the resulting binary +dnl - runs fine on macOS 13, +dnl - crashes with a SIGSEGV (signal 11) on macOS 12. +dnl +dnl This macro sets two variables: +dnl - gl_cv_onwards_func_ to yes / no / "future OS version" +dnl - ac_cv_func_ to yes / no / no +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 ]]) +dnl can be used as a drop-in replacement for +dnl AC_CHECK_FUNCS([func]). +AC_DEFUN([gl_CHECK_FUNCS_MACOS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) + AC_CACHE_CHECK([for [$1]], + [[gl_cv_onwards_func_][$1]], + [gl_SILENT([ + case "$host_os" in + gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) + gl_CHECK_FUNCS_DEFAULT_CASE([$1]) + esac + ]) + ]) + gl_CHECK_FUNCS_SET_RESULTS([$1]) +]) + +dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include ]]) +dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem +dnl on Android and on macOS. +dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS. +AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS]) + AC_CACHE_CHECK([for [$1]], + [[gl_cv_onwards_func_][$1]], + [gl_SILENT([ + case "$host_os" in + gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2]) + gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2]) + gl_CHECK_FUNCS_DEFAULT_CASE([$1]) + esac + ]) + ]) + gl_CHECK_FUNCS_SET_RESULTS([$1]) +]) + 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/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 4764622e..83a0f727 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 @@ -1,5 +1,5 @@ # DO NOT EDIT! GENERATED AUTOMATICALLY! -# Copyright (C) 2002-2023 Free Software Foundation, Inc. +# Copyright (C) 2002-2024 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,6 +43,7 @@ AC_DEFUN([gl_EARLY], AC_REQUIRE([gl_PROG_AR_RANLIB]) # Code from module absolute-header: + # Code from module alignasof: # Code from module alloca-opt: # Code from module arpa_inet: # Code from module assert-h: @@ -67,6 +68,7 @@ AC_DEFUN([gl_EARLY], # Code from module environ: # Code from module errno: # Code from module error: + # Code from module error-h: # Code from module exitfail: # Code from module extensions: # Code from module extern-inline: @@ -112,6 +114,11 @@ AC_DEFUN([gl_EARLY], # Code from module inet_ntop: # Code from module intprops: # Code from module inttypes-incomplete: + # Code from module iswblank: + # Code from module iswctype: + # Code from module iswdigit: + # Code from module iswpunct: + # Code from module iswxdigit: # Code from module langinfo: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) @@ -128,6 +135,7 @@ AC_DEFUN([gl_EARLY], # Code from module math: # Code from module mbrtowc: # Code from module mbsinit: + # Code from module mbszero: # Code from module mbtowc: # Code from module memchr: # Code from module minmax: @@ -150,6 +158,7 @@ AC_DEFUN([gl_EARLY], # Code from module servent: # Code from module setenv: # Code from module setlocale-null: + # Code from module setlocale-null-unlocked: # Code from module size_max: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: @@ -163,12 +172,12 @@ AC_DEFUN([gl_EARLY], # Code from module stat: # Code from module stat-time: # Code from module std-gnu11: - # Code from module stdalign: # Code from module stdbool: # Code from module stdckdint: # Code from module stddef: # Code from module stdint: # Code from module stdio: + gl_STDIO_H_EARLY # Code from module stdlib: # Code from module strcase: # Code from module strcasestr: @@ -186,7 +195,7 @@ AC_DEFUN([gl_EARLY], # Code from module sys_uio: # Code from module threadlib: gl_THREADLIB_EARLY - # Code from module time: + # Code from module time-h: # Code from module time_r: # Code from module timegm: # Code from module unistd: @@ -199,6 +208,7 @@ AC_DEFUN([gl_EARLY], # Code from module vsnprintf: # Code from module wchar: # Code from module wcrtomb: + # Code from module wctype: # Code from module wctype-h: # Code from module windows-mutex: # Code from module windows-once: @@ -229,6 +239,7 @@ AC_DEFUN([gl_INIT], gl_COMMON gl_source_base='gl' gl_source_base_prefix= + gl_ALIGNASOF gl_FUNC_ALLOCA gl_CONDITIONAL_HEADER([alloca.h]) AC_PROG_MKDIR_P @@ -280,14 +291,17 @@ AC_DEFUN([gl_INIT], gl_HEADER_ERRNO_H gl_CONDITIONAL_HEADER([errno.h]) AC_PROG_MKDIR_P + AC_REQUIRE([gl_ERROR_H]) gl_ERROR - gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test "$ac_cv_lib_error_at_line" = no]) + gl_CONDITIONAL([GL_COND_OBJ_ERROR], [test $COMPILE_ERROR_C = 1]) AM_COND_IF([GL_COND_OBJ_ERROR], [ gl_PREREQ_ERROR ]) m4_ifdef([AM_XGETTEXT_OPTION], [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) + gl_ERROR_H + AC_PROG_MKDIR_P AC_REQUIRE([gl_EXTERN_INLINE]) gl_FUNC_FCNTL gl_CONDITIONAL([GL_COND_OBJ_FCNTL], @@ -350,7 +364,7 @@ AC_DEFUN([gl_INIT], gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) AM_COND_IF([GL_COND_OBJ_FSTAT], [ case "$host_os" in - mingw*) + mingw* | windows*) AC_LIBOBJ([stat-w32]) ;; esac @@ -406,7 +420,8 @@ AC_DEFUN([gl_INIT], gl_STDIO_MODULE_INDICATOR([getline]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_GETLOADAVG - gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0]) + gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], + [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1]) AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [ gl_PREREQ_GETLOADAVG ]) @@ -427,11 +442,20 @@ AC_DEFUN([gl_INIT], ]) gl_UNISTD_MODULE_INDICATOR([getopt-posix]) gl_FUNC_GETPROGNAME + gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], + [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) + AM_COND_IF([GL_COND_OBJ_GETPROGNAME], [ + gl_PREREQ_GETPROGNAME + ]) + gl_STDLIB_MODULE_INDICATOR([getprogname]) AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_PROG_MKDIR_P AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) - LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" + HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" + AC_SUBST([HARD_LOCALE_LIB]) + dnl For backward compatibility. + LIB_HARD_LOCALE="$HARD_LOCALE_LIB" AC_SUBST([LIB_HARD_LOCALE]) gl_HOSTENT gl_IDPRIV @@ -445,6 +469,26 @@ AC_DEFUN([gl_INIT], gl_INTTYPES_INCOMPLETE gl_INTTYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_FUNC_ISWBLANK + gl_CONDITIONAL([GL_COND_OBJ_ISWBLANK], + [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && { test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; }]) + gl_WCTYPE_MODULE_INDICATOR([iswblank]) + gl_FUNC_ISWCTYPE + gl_CONDITIONAL([GL_COND_OBJ_ISWCTYPE], + [test $HAVE_WCTYPE_T = 0 || test $GNULIBHEADERS_OVERRIDE_WINT_T = 1 || test $REPLACE_WCTYPE = 1]) + gl_WCTYPE_MODULE_INDICATOR([iswctype]) + gl_FUNC_ISWDIGIT + gl_CONDITIONAL([GL_COND_OBJ_ISWDIGIT], + [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWDIGIT = 1]) + gl_WCTYPE_MODULE_INDICATOR([iswdigit]) + gl_FUNC_ISWPUNCT + gl_CONDITIONAL([GL_COND_OBJ_ISWPUNCT], + [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWPUNCT = 1]) + gl_WCTYPE_MODULE_INDICATOR([iswpunct]) + gl_FUNC_ISWXDIGIT + gl_CONDITIONAL([GL_COND_OBJ_ISWXDIGIT], + [! { test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; } && test $REPLACE_ISWXDIGIT = 1]) + gl_WCTYPE_MODULE_INDICATOR([iswxdigit]) gl_LANGINFO_H gl_LANGINFO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P @@ -504,6 +548,10 @@ AC_DEFUN([gl_INIT], gl_PREREQ_MBSINIT ]) gl_WCHAR_MODULE_INDICATOR([mbsinit]) + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + gl_MBSTATE_T_BROKEN + gl_MUSL_LIBC + gl_WCHAR_MODULE_INDICATOR([mbszero]) gl_FUNC_MBTOWC gl_CONDITIONAL([GL_COND_OBJ_MBTOWC], [test $HAVE_MBTOWC = 0 || test $REPLACE_MBTOWC = 1]) @@ -611,7 +659,7 @@ AC_DEFUN([gl_INIT], gl_CONDITIONAL([GL_COND_OBJ_STAT], [test $REPLACE_STAT = 1]) AM_COND_IF([GL_COND_OBJ_STAT], [ case "$host_os" in - mingw*) + mingw* | windows*) AC_LIBOBJ([stat-w32]) ;; esac @@ -620,9 +668,6 @@ AC_DEFUN([gl_INIT], gl_SYS_STAT_MODULE_INDICATOR([stat]) gl_STAT_TIME gl_STAT_BIRTHTIME - gl_STDALIGN_H - gl_CONDITIONAL_HEADER([stdalign.h]) - AC_PROG_MKDIR_P gl_C_BOOL AC_CHECK_HEADERS_ONCE([stdckdint.h]) if test $ac_cv_header_stdckdint_h = yes; then @@ -781,21 +826,24 @@ AC_DEFUN([gl_INIT], gl_PREREQ_WCRTOMB ]) gl_WCHAR_MODULE_INDICATOR([wcrtomb]) + gl_FUNC_WCTYPE + gl_CONDITIONAL([GL_COND_OBJ_WCTYPE], [test $HAVE_WCTYPE = 0 || test $REPLACE_WCTYPE = 1]) + gl_WCTYPE_MODULE_INDICATOR([wctype]) gl_WCTYPE_H gl_WCTYPE_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], - [case "$host_os" in mingw*) true;; *) false;; esac]) + [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_ONCE], - [case "$host_os" in mingw*) true;; *) false;; esac]) + [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RECMUTEX], - [case "$host_os" in mingw*) true;; *) false;; esac]) + [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_RWLOCK], - [case "$host_os" in mingw*) true;; *) false;; esac]) + [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) gl_XALLOC gl_MODULE_INDICATOR([xalloc]) gl_MODULE_INDICATOR([xalloc-die]) @@ -1002,7 +1050,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/dynarray.h lib/errno.in.h lib/error.c - lib/error.h + lib/error.in.h lib/exitfail.c lib/exitfail.h lib/fcntl.c @@ -1062,6 +1110,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/intprops-internal.h lib/intprops.h lib/inttypes.in.h + lib/iswblank.c + lib/iswctype-impl.h + lib/iswctype.c + lib/iswdigit.c + lib/iswpunct.c + lib/iswxdigit.c lib/itold.c lib/langinfo.in.h lib/lc-charset-dispatch.c @@ -1089,6 +1143,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/mbrtowc-impl.h lib/mbrtowc.c lib/mbsinit.c + lib/mbszero.c lib/mbtowc-impl.h lib/mbtowc-lock.c lib/mbtowc-lock.h @@ -1124,6 +1179,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/regexec.c lib/setenv.c lib/setlocale-lock.c + lib/setlocale_null-unlocked.c lib/setlocale_null.c lib/setlocale_null.h lib/sha256-stream.c @@ -1138,7 +1194,6 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stat-w32.c lib/stat-w32.h lib/stat.c - lib/stdalign.in.h lib/stdckdint.in.h lib/stddef.in.h lib/stdint.in.h @@ -1183,6 +1238,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/wchar.in.h lib/wcrtomb.c lib/wctype-h.c + lib/wctype-impl.h + lib/wctype.c lib/wctype.in.h lib/windows-initguard.h lib/windows-mutex.c @@ -1220,9 +1277,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/environ.m4 m4/errno_h.m4 m4/error.m4 + m4/error_h.m4 m4/exponentd.m4 m4/extensions.m4 m4/extern-inline.m4 + m4/fclose.m4 m4/fcntl-o.m4 m4/fcntl.m4 m4/fcntl_h.m4 @@ -1257,6 +1316,11 @@ AC_DEFUN([gl_FILE_LIST], [ m4/intmax_t.m4 m4/inttypes.m4 m4/inttypes_h.m4 + m4/iswblank.m4 + m4/iswctype.m4 + m4/iswdigit.m4 + m4/iswpunct.m4 + m4/iswxdigit.m4 m4/langinfo_h.m4 m4/largefile.m4 m4/limits-h.m4 @@ -1284,6 +1348,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/msvc-inval.m4 m4/msvc-nothrow.m4 m4/multiarch.m4 + m4/musl.m4 m4/netdb_h.m4 m4/netinet_in_h.m4 m4/nl_langinfo.m4 @@ -1346,6 +1411,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/wchar_h.m4 m4/wchar_t.m4 m4/wcrtomb.m4 + m4/wctype.m4 m4/wctype_h.m4 m4/wint_t.m4 m4/xalloc.m4 diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index a9dd569b..ef45f51f 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 @@ -1,5 +1,6 @@ -# gnulib-tool.m4 serial 4 -dnl Copyright (C) 2004-2005, 2009-2023 Free Software Foundation, Inc. +# gnulib-tool.m4 +# serial 4 +dnl Copyright (C) 2004-2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 3b2cc2b2..36dc636e 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 @@ -1,5 +1,6 @@ -# hostent.m4 serial 4 -dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. +# hostent.m4 +# serial 5 +dnl Copyright (C) 2008, 2010-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. @@ -26,7 +27,7 @@ AC_DEFUN([gl_HOSTENT], AC_CACHE_CHECK([for gethostbyname in winsock2.h and -lws2_32], [gl_cv_w32_gethostbyname], [gl_cv_w32_gethostbyname=no - gl_save_LIBS="$LIBS" + gl_saved_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -38,7 +39,7 @@ AC_DEFUN([gl_HOSTENT], ]], [[gethostbyname(NULL);]])], [gl_cv_w32_gethostbyname=yes]) - LIBS="$gl_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test "$gl_cv_w32_gethostbyname" = "yes"; then HOSTENT_LIB="-lws2_32" diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4 index fc3dd17d..53693527 100644 --- a/gl/m4/idpriv.m4 +++ b/gl/m4/idpriv.m4 @@ -1,5 +1,6 @@ -# idpriv.m4 serial 1 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# idpriv.m4 +# serial 1 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 9f19215e..03e85251 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,5 +1,6 @@ -# include_next.m4 serial 26 -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# include_next.m4 +# serial 27 +dnl Copyright (C) 2006-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. @@ -74,17 +75,17 @@ EOF #endif #define DEFINED_IN_CONFTESTD2 EOF - gl_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" + gl_saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1b -Iconftestd2" dnl We intentionally avoid using AC_LANG_SOURCE here. AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], [gl_cv_have_include_next=yes], - [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + [CPPFLAGS="$gl_saved_CPPFLAGS -Iconftestd1a -Iconftestd2" AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], [gl_cv_have_include_next=buggy], [gl_cv_have_include_next=no]) ]) - CPPFLAGS="$gl_save_CPPFLAGS" + CPPFLAGS="$gl_saved_CPPFLAGS" rm -rf conftestd1a conftestd1b conftestd2 ]) PRAGMA_SYSTEM_HEADER= diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 48822d69..168e17e0 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 @@ -1,5 +1,6 @@ -# inet_ntop.m4 serial 21 -dnl Copyright (C) 2005-2006, 2008-2023 Free Software Foundation, Inc. +# inet_ntop.m4 +# serial 22 +dnl Copyright (C) 2005-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, dnl with or without modifications, as long as this notice is preserved. @@ -36,14 +37,14 @@ AC_DEFUN([gl_FUNC_INET_NTOP], HAVE_DECL_INET_NTOP=0 fi else - gl_save_LIBS=$LIBS + gl_saved_LIBS=$LIBS AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], [AC_CHECK_FUNCS([inet_ntop]) if test $ac_cv_func_inet_ntop = no; then HAVE_INET_NTOP=0 fi ]) - LIBS=$gl_save_LIBS + LIBS=$gl_saved_LIBS if test "$ac_cv_search_inet_ntop" != "no" \ && test "$ac_cv_search_inet_ntop" != "none required"; then diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index ef32e1b9..72858ea8 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,5 +1,6 @@ -# intmax_t.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2023 Free Software Foundation, +# intmax_t.m4 +# serial 9 +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4 index bf2eab2b..c43cd162 100644 --- a/gl/m4/inttypes.m4 +++ b/gl/m4/inttypes.m4 @@ -1,5 +1,6 @@ -# inttypes.m4 serial 36 -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# inttypes.m4 +# serial 37 +dnl Copyright (C) 2006-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. @@ -170,6 +171,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS], HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T]) + HAVE_IMAXABS=1; AC_SUBST([HAVE_IMAXABS]) + HAVE_IMAXDIV=1; AC_SUBST([HAVE_IMAXDIV]) + REPLACE_IMAXABS=0; AC_SUBST([REPLACE_IMAXABS]) + REPLACE_IMAXDIV=0; AC_SUBST([REPLACE_IMAXDIV]) REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX]) REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX]) INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX]) diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 68c60e9d..3b9da5b0 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 @@ -1,5 +1,6 @@ -# inttypes_h.m4 serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. +# inttypes_h.m4 +# serial 10 +dnl Copyright (C) 1997-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/iswblank.m4 b/gl/m4/iswblank.m4 new file mode 100644 index 00000000..4dc12d9a --- /dev/null +++ b/gl/m4/iswblank.m4 @@ -0,0 +1,39 @@ +# iswblank.m4 +# serial 7 +dnl Copyright (C) 2011-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. + +AC_DEFUN([gl_FUNC_ISWBLANK], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + dnl Persuade glibc to declare iswblank(). + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + gl_CHECK_FUNCS_ANDROID([iswblank], [[#include ]]) + AC_CHECK_DECLS([iswblank], , , [[ + #include + #include + ]]) + if test $ac_cv_func_iswblank = no; then + HAVE_ISWBLANK=0 + if test $ac_cv_have_decl_iswblank = yes \ + || case "$gl_cv_onwards_func_iswblank" in \ + future*) true ;; \ + *) false ;; \ + esac; then + REPLACE_ISWBLANK=1 + fi + fi + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl Redefine all of iswcntrl, ..., towupper in . + : + else + if test $HAVE_ISWBLANK = 0 || test $REPLACE_ISWBLANK = 1; then + dnl Redefine only iswblank. + : + fi + fi + +]) diff --git a/gl/m4/iswctype.m4 b/gl/m4/iswctype.m4 new file mode 100644 index 00000000..16031be4 --- /dev/null +++ b/gl/m4/iswctype.m4 @@ -0,0 +1,14 @@ +# iswctype.m4 +# serial 3 +dnl Copyright (C) 2011-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. + +AC_DEFUN([gl_FUNC_ISWCTYPE], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + dnl Determine REPLACE_WCTYPE. + AC_REQUIRE([gl_FUNC_WCTYPE]) +]) diff --git a/gl/m4/iswdigit.m4 b/gl/m4/iswdigit.m4 new file mode 100644 index 00000000..999acd28 --- /dev/null +++ b/gl/m4/iswdigit.m4 @@ -0,0 +1,121 @@ +# iswdigit.m4 +# serial 7 +dnl Copyright (C) 2020-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. + +AC_DEFUN([gl_FUNC_ISWDIGIT], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([gt_LOCALE_FR]) + AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl redefines iswdigit already. + REPLACE_ISWDIGIT="$REPLACE_ISWCNTRL" + else + AC_CACHE_CHECK([whether iswdigit is ISO C compliant], + [gl_cv_func_iswdigit_works], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + gl_cv_func_iswdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswdigit_works="guessing yes" ;; + esac +changequote([,])dnl + if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#include + +/* Returns the value of iswdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); + + return iswdigit (wc); +} + +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; + + if (strcmp ("$LOCALE_FR", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + /* This fails on mingw, MSVC 14. */ + /* U+00B2 SUPERSCRIPT TWO */ + is = for_character ("\262", 1); + if (!(is == 0)) + result |= 1; + } + if (strcmp ("$LOCALE_JA", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 10.0. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 2; + } + if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 4; + /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\357\274\221", 3); + if (!(is == 0)) + result |= 8; + } + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on NetBSD 10.0, Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 16; + } + return result; +}]])], + [gl_cv_func_iswdigit_works=yes], + [gl_cv_func_iswdigit_works=no], + [:]) + fi + ]) + case "$gl_cv_func_iswdigit_works" in + *yes) ;; + *) REPLACE_ISWDIGIT=1 ;; + esac + fi +]) diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4 new file mode 100644 index 00000000..1edf58aa --- /dev/null +++ b/gl/m4/iswpunct.m4 @@ -0,0 +1,49 @@ +# iswpunct.m4 +# serial 2 +dnl Copyright (C) 2023-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. + +AC_DEFUN([gl_FUNC_ISWPUNCT], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl redefines iswpunct already. + REPLACE_ISWPUNCT="$REPLACE_ISWCNTRL" + else + AC_CACHE_CHECK([whether iswpunct is consistent with ispunct], + [gl_cv_func_iswpunct_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +int +main (int argc, char *argv[]) +{ + int result = 0; + /* This fails on Android 11. */ + if ((! iswpunct ('\`')) != (! ispunct ('\`'))) + result |= 1; + return result; +}]])], + [gl_cv_func_iswpunct_works=yes], + [gl_cv_func_iswpunct_works=no], + [case "$host_os" in + # Guess no on Android. + android*) gl_cv_func_iswpunct_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswpunct_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_iswpunct_works" in + *yes) ;; + *) REPLACE_ISWPUNCT=1 ;; + esac + fi +]) diff --git a/gl/m4/iswxdigit.m4 b/gl/m4/iswxdigit.m4 new file mode 100644 index 00000000..6085bf6b --- /dev/null +++ b/gl/m4/iswxdigit.m4 @@ -0,0 +1,111 @@ +# iswxdigit.m4 +# serial 7 +dnl Copyright (C) 2020-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. + +AC_DEFUN([gl_FUNC_ISWXDIGIT], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([gt_LOCALE_JA]) + AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + dnl redefines iswxdigit already. + REPLACE_ISWXDIGIT="$REPLACE_ISWCNTRL" + else + AC_CACHE_CHECK([whether iswxdigit is ISO C compliant], + [gl_cv_func_iswxdigit_works], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. +changequote(,)dnl + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, native Windows. + freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + gl_cv_func_iswxdigit_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_iswxdigit_works="guessing yes" ;; + esac +changequote([,])dnl + if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#include + +/* Returns the value of iswxdigit for the multibyte character s[0..n-1]. */ +static int +for_character (const char *s, size_t n) +{ + mbstate_t state; + wchar_t wc; + size_t ret; + + memset (&state, '\0', sizeof (mbstate_t)); + wc = (wchar_t) 0xBADFACE; + ret = mbrtowc (&wc, s, n, &state); + if (ret != n) + abort (); + + return iswxdigit (wc); +} + +int +main (int argc, char *argv[]) +{ + int is; + int result = 0; + + if (strcmp ("$LOCALE_JA", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_JA") != NULL) + { + /* This fails on NetBSD 10.0. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\243\301", 2); + if (!(is == 0)) + result |= 1; + } + if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + /* This fails on FreeBSD 13.0. */ + /* U+0663 ARABIC-INDIC DIGIT THREE */ + is = for_character ("\331\243", 2); + if (!(is == 0)) + result |= 2; + /* This fails on NetBSD 10.0, MSVC 14. */ + /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ + is = for_character ("\357\274\241", 3); + if (!(is == 0)) + result |= 4; + } + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + /* This fails on Solaris 10, Solaris 11.4. */ + /* U+FF11 FULLWIDTH DIGIT ONE */ + is = for_character ("\243\261", 2); + if (!(is == 0)) + result |= 8; + } + return result; +}]])], + [gl_cv_func_iswxdigit_works=yes], + [gl_cv_func_iswxdigit_works=no], + [:]) + fi + ]) + case "$gl_cv_func_iswxdigit_works" in + *yes) ;; + *) REPLACE_ISWXDIGIT=1 ;; + esac + fi +]) diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 index b17a526a..5eee8a71 100644 --- a/gl/m4/langinfo_h.m4 +++ b/gl/m4/langinfo_h.m4 @@ -1,5 +1,6 @@ -# langinfo_h.m4 serial 12 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# langinfo_h.m4 +# serial 12 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 7fb81b86..2f824089 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 @@ -1,16 +1,18 @@ +# largefile.m4 +# serial 1 +dnl Copyright 1992-1996, 1998-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. + # Enable large files on systems where this is not the default. # Enable support for files on Linux file systems with 64-bit inode numbers. -# Copyright 1992-1996, 1998-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - # The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: # It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this # setting of _LARGEFILE_SOURCE is needed so that declares fseeko # and ftello in C++ mode as well. -# Fixed in Autoconf 2.72, which has AC_SYS_YEAR2038. +# This problem occurs in Autoconf 2.71 and earlier, which lack AC_SYS_YEAR2038. AC_DEFUN([gl_SET_LARGEFILE_SOURCE], m4_ifndef([AC_SYS_YEAR2038], [[ AC_REQUIRE([AC_CANONICAL_HOST]) @@ -24,29 +26,20 @@ AC_DEFUN([gl_SET_LARGEFILE_SOURCE], ]]) ) -# Work around a problem in autoconf <= 2.69: -# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, -# or configures them incorrectly in some cases. -m4_version_prereq([2.70], [], [ - -# _AC_SYS_LARGEFILE_TEST_INCLUDES -# ------------------------------- -m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], -[#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]];[]dnl -]) -])# m4_version_prereq 2.70 +dnl Remove AC_SYS_YEAR2038_RECOMMENDED if unpatched Autoconf 2.72 or earlier. +dnl Autoconf 2.72 still uses -n32, which is not a C preprocessor option, +dnl and which was useful only on IRIX which is no longer supported. +dnl This should be fixed in Autoconf 2.73. +m4_ifdef([AC_SYS_YEAR2038_RECOMMENDED], + [m4_bmatch(m4_ifdef([_AC_SYS_LARGEFILE_OPTIONS], + [m4_defn([_AC_SYS_LARGEFILE_OPTIONS])], + ["-n32"]), + ["-n32"], + [m4_undefine([AC_SYS_YEAR2038_RECOMMENDED])])]) -# Support AC_SYS_YEAR2038, even if Autoconf 2.71 or earlier. -# This code is taken from Autoconf master. -m4_ifndef([AC_SYS_YEAR2038], [ +m4_ifndef([AC_SYS_YEAR2038_RECOMMENDED], [ +# Fix up AC_SYS_YEAR2038_RECOMMENDED and related macros, even if +# unpatched Autoconf 2.72 or earlier. This code is taken from Autoconf master. # _AC_SYS_YEAR2038_TEST_CODE # -------------------------- @@ -78,8 +71,8 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( dnl 32-bit MinGW (misconfiguration) )) -# _AC_SYS_YEAR2038_PROBE([IF-NOT-DETECTED]) -# ----------------------------------------- +# _AC_SYS_YEAR2038_PROBE +# ---------------------- # Subroutine of AC_SYS_YEAR2038. Probe for time_t that can represent # time points more than 2**31 - 1 seconds after the epoch (dates after # 2038-01-18, see above) and set the cache variable ac_cv_sys_year2038_opts @@ -92,13 +85,10 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( # AC_TRY_RUN. Note also that some systems only support large time_t # together with large off_t. # -# If support is not detected, the behavior depends on which of the -# top-level AC_SYS_YEAR2038 macros was used (see below). -# # If you change this macro you may also need to change # _AC_SYS_YEAR2038_OPTIONS. AC_DEFUN([_AC_SYS_YEAR2038_PROBE], -[AC_CACHE_CHECK([for $CC option to enable timestamps after Jan 2038], +[AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038], [ac_cv_sys_year2038_opts], [ac_save_CPPFLAGS="$CPPFLAGS" ac_opt_found=no @@ -117,40 +107,20 @@ ac_have_year2038=yes AS_CASE([$ac_cv_sys_year2038_opts], ["none needed"], [], ["support not detected"], - [ac_have_year2038=no - AS_CASE([$enable_year2038], - [yes], - [# If we're not cross compiling and 'touch' works with a large - # timestamp, then we can presume the system supports wider time_t - # *somehow* and we just weren't able to detect it. One common - # case that we deliberately *don't* probe for is a system that - # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers - # wide time_t. (It would be inappropriate for us to override an - # intentional use of -m32.) Error out, demanding use of - # --disable-year2038 if this is intentional. - AS_IF([test $cross_compiling = no], - [AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], - [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], - [*'Feb 7 2106'* | *'Feb 7 17:10'*], - [AC_MSG_FAILURE(m4_text_wrap( - [this system appears to support timestamps after January 2038, - but no mechanism for enabling wide 'time_t' was detected. - Did you mean to build a 64-bit binary? (e.g. 'CC="${CC} -m64"'.) - To proceed with 32-bit time_t, configure with '--disable-year2038'.], - [], [], [55]))])])])])], + [ac_have_year2038=no], ["-D_TIME_BITS=64"], [AC_DEFINE([_TIME_BITS], [64], [Number of bits in time_t, on hosts where this is settable.])], - ["-D__MINGW_USE_VC2005_COMPAT=1"], + ["-D__MINGW_USE_VC2005_COMPAT"], [AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], [Define to 1 on platforms where this makes time_t a 64-bit type.])], ["-U_USE_32_BIT_TIME_T"*], [AC_MSG_FAILURE(m4_text_wrap( [the 'time_t' type is currently forced to be 32-bit. - It will stop working after January 2038. + It will stop working after mid-January 2038. Remove _USE_32BIT_TIME_T from the compiler flags.], [], [], [55]))], @@ -160,12 +130,11 @@ AS_CASE([$ac_cv_sys_year2038_opts], # _AC_SYS_YEAR2038_ENABLE # ----------------------- -# Subroutine of AC_SYS_YEAR2038 and _AC_SYS_YEAR2038_OPT_IN. # Depending on which of the YEAR2038 macros was used, add either an -# --enable-year2038, or a --disable-year2038, or no option at all to -# the configure script. Note that this is expanded very late and +# --enable-year2038 or a --disable-year2038 to +# the configure script. This is expanded very late and # therefore there cannot be any code in the AC_ARG_ENABLE. The -# default value for enable_year2038 is emitted unconditionally +# default value for 'enable_year2038' is emitted unconditionally # because the generated code always looks at this variable. m4_define([_AC_SYS_YEAR2038_ENABLE], [m4_divert_text([DEFAULTS], @@ -175,50 +144,70 @@ m4_define([_AC_SYS_YEAR2038_ENABLE], [AC_ARG_ENABLE([year2038], m4_provide_if([AC_SYS_YEAR2038], [AS_HELP_STRING([--disable-year2038], - [do not support timestamps after 2038])], + [don't support timestamps after 2038])], [AS_HELP_STRING([--enable-year2038], [support timestamps after 2038])]))]) -# _AC_SYS_YEAR2038_OPT_IN -# ----------------------- -# If the --enable-year2038 option is given to configure, attempt to -# detect and activate support for large time_t on 32-bit systems. -# This macro is automatically invoked by AC_SYS_LARGEFILE when large -# *file* support is detected. It does not AC_REQUIRE AC_SYS_LARGEFILE -# to avoid a dependency loop, and is therefore unsafe to expose as a -# documented macro. -AC_DEFUN([_AC_SYS_YEAR2038_OPT_IN], -[m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl - AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) - AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) -])]) - # AC_SYS_YEAR2038 # --------------- # Attempt to detect and activate support for large time_t. # On systems where time_t is not always 64 bits, this probe can be # skipped by passing the --disable-year2038 option to configure. AC_DEFUN([AC_SYS_YEAR2038], -[AC_REQUIRE([AC_SYS_LARGEFILE])]dnl -[m4_provide_if([_AC_SYS_YEAR2038_PROBE], [], [dnl - AS_IF([test "$enable_year2038" != no], [_AC_SYS_YEAR2038_PROBE]) - AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE]) -])]) +[AC_REQUIRE([AC_SYS_LARGEFILE])dnl +AS_IF([test "$enable_year2038,$ac_have_year2038,$cross_compiling" = yes,no,no], + [# If we're not cross compiling and 'touch' works with a large + # timestamp, then we can presume the system supports wider time_t + # *somehow* and we just weren't able to detect it. One common + # case that we deliberately *don't* probe for is a system that + # supports both 32- and 64-bit ABIs but only the 64-bit ABI offers + # wide time_t. (It would be inappropriate for us to override an + # intentional use of -m32.) Error out, demanding use of + # --disable-year2038 if this is intentional. + AS_IF([TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null], + [AS_CASE([`TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null`], + [*'Feb 7 2106'* | *'Feb 7 17:10'*], + [AC_MSG_FAILURE(m4_text_wrap( + [this system appears to support timestamps after mid-January 2038, + but no mechanism for enabling wide 'time_t' was detected. + Did you mean to build a 64-bit binary? (E.g., 'CC="${CC} -m64"'.) + To proceed with 32-bit time_t, configure with '--disable-year2038'.], + [], [], [55]))])])])]) + +# AC_SYS_YEAR2038_RECOMMENDED +# --------------------------- +# Same as AC_SYS_YEAR2038, but recommend support for large time_t. +# If we cannot find any way to make time_t capable of representing +# values larger than 2**31 - 1, error out unless --disable-year2038 is given. +AC_DEFUN([AC_SYS_YEAR2038_RECOMMENDED], +[AC_REQUIRE([AC_SYS_YEAR2038])dnl +AS_IF([test "$enable_year2038,$ac_have_year2038" = yes,no], + [AC_MSG_FAILURE(m4_text_wrap( + [could not enable timestamps after mid-January 2038. + This package recommends support for these later timestamps. + However, to proceed with signed 32-bit time_t even though it + will fail then, configure with '--disable-year2038'.], + [], [], [55]))])]) # _AC_SYS_LARGEFILE_TEST_CODE # --------------------------- # C code used to probe for large file support. m4_define([_AC_SYS_LARGEFILE_TEST_CODE], [@%:@include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, +@%:@ifndef FTYPE +@%:@ define FTYPE off_t +@%:@endif + /* Check that FTYPE can represent 2**63 - 1 correctly. + We can't simply define LARGE_FTYPE to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -@%:@define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) - int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) +@%:@define LARGE_FTYPE (((FTYPE) 1 << 31 << 31) - 1 + ((FTYPE) 1 << 31 << 31)) + int FTYPE_is_large[[(LARGE_FTYPE % 2147483629 == 721 + && LARGE_FTYPE % 2147483647 == 1) ? 1 : -1]];[]dnl ]) +# Defined by Autoconf 2.71 and circa 2022 Gnulib unwisely depended on it. +m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], [_AC_SYS_LARGEFILE_TEST_CODE]) # _AC_SYS_LARGEFILE_OPTIONS # ------------------------- @@ -228,8 +217,7 @@ m4_define([_AC_SYS_LARGEFILE_TEST_CODE], m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( ["none needed"] dnl Most current systems ["-D_FILE_OFFSET_BITS=64"] dnl X/Open LFS spec - ["-D_LARGE_FILES=1"] dnl AIX (which versions?) - ["-n32"] dnl Irix 6.2 w/ SGI compiler + ["-D_LARGE_FILES=1"] dnl 32-bit AIX 4.2.1+, 32-bit z/OS )) # _AC_SYS_LARGEFILE_PROBE @@ -246,24 +234,43 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize( # If you change this macro you may also need to change # _AC_SYS_LARGEFILE_OPTIONS. AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], -[AC_CACHE_CHECK([for $CC option to enable large file support], +[AC_CACHE_CHECK([for $CPPFLAGS option for large files], [ac_cv_sys_largefile_opts], - [ac_save_CC="$CC" + [ac_save_CPPFLAGS=$CPPFLAGS ac_opt_found=no for ac_opt in _AC_SYS_LARGEFILE_OPTIONS; do AS_IF([test x"$ac_opt" != x"none needed"], - [CC="$ac_save_CC $ac_opt"]) + [CPPFLAGS="$ac_save_CPPFLAGS $ac_opt"]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_CODE])], - [ac_cv_sys_largefile_opts="$ac_opt" + [AS_IF([test x"$ac_opt" = x"none needed"], + [# GNU/Linux s390x and alpha need _FILE_OFFSET_BITS=64 for wide ino_t. + CPPFLAGS="$CPPFLAGS -DFTYPE=ino_t" + AC_COMPILE_IFELSE([], [], + [CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" + AC_COMPILE_IFELSE([], [ac_opt='-D_FILE_OFFSET_BITS=64'])])]) + ac_cv_sys_largefile_opts=$ac_opt ac_opt_found=yes]) test $ac_opt_found = no || break done - CC="$ac_save_CC" + CPPFLAGS=$ac_save_CPPFLAGS + dnl Gnulib implements large file support for native Windows, based on the + dnl variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE. + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $ac_opt_found != yes; then + AS_CASE([$host_os], + [mingw* | windows*], + [ac_cv_sys_largefile_opts="supported through gnulib" + ac_opt_found=yes] + ) + fi + ]) test $ac_opt_found = yes || ac_cv_sys_largefile_opts="support not detected"]) ac_have_largefile=yes AS_CASE([$ac_cv_sys_largefile_opts], ["none needed"], [], + ["supported through gnulib"], [], ["support not detected"], [ac_have_largefile=no], @@ -275,27 +282,12 @@ AS_CASE([$ac_cv_sys_largefile_opts], [AC_DEFINE([_LARGE_FILES], [1], [Define to 1 on platforms where this makes off_t a 64-bit type.])], - ["-n32"], - [CC="$CC -n32"], - [AC_MSG_ERROR( [internal error: bad value for \$ac_cv_sys_largefile_opts])]) -_AC_SYS_YEAR2038_OPT_IN -]) - -# _AC_SYS_LARGEFILE_ENABLE -# ------------------------ -# Subroutine of AC_SYS_LARGEFILE. Note that this -# is expanded very late and therefore there cannot be any code in the -# AC_ARG_ENABLE. The default value for enable_largefile is emitted -# unconditionally because the generated shell code always looks at -# this variable. -m4_define([_AC_SYS_LARGEFILE_ENABLE], -[m4_divert_text([DEFAULTS], - enable_largefile=yes)]dnl -[AC_ARG_ENABLE([largefile], - [AS_HELP_STRING([--disable-largefile], [omit support for large files])])]) +AS_IF([test "$enable_year2038" != no], + [_AC_SYS_YEAR2038_PROBE]) +AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) # AC_SYS_LARGEFILE # ---------------- @@ -306,14 +298,13 @@ m4_define([_AC_SYS_LARGEFILE_ENABLE], # Additionally, on Linux file systems with 64-bit inodes a file that happens # to have a 64-bit inode number cannot be accessed by 32-bit applications on # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. -# This macro allows configuration to continue if the system doesn't support -# large files. AC_DEFUN([AC_SYS_LARGEFILE], -[m4_provide_if([_AC_SYS_LARGEFILE_PROBE], [], [dnl - AS_IF([test "$enable_largefile" != no], [_AC_SYS_LARGEFILE_PROBE]) - AC_CONFIG_COMMANDS_PRE([_AC_SYS_LARGEFILE_ENABLE]) -])]) -])# m4_ifndef AC_SYS_YEAR2038 +[AC_ARG_ENABLE([largefile], + [AS_HELP_STRING([--disable-largefile], + [omit support for large files])])dnl +AS_IF([test "$enable_largefile,$enable_year2038" != no,no], + [_AC_SYS_LARGEFILE_PROBE])]) +])# m4_ifndef AC_SYS_YEAR2038_RECOMMENDED # Enable large files on systems where this is implemented by Gnulib, not by the # system headers. @@ -323,7 +314,7 @@ AC_DEFUN([gl_LARGEFILE], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in - mingw*) + mingw* | windows*) dnl Native Windows. dnl mingw64 defines off_t to a 64-bit type already, if dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4 index 5088fa16..1b619e1e 100644 --- a/gl/m4/limits-h.m4 +++ b/gl/m4/limits-h.m4 @@ -1,10 +1,12 @@ -dnl Check whether limits.h has needed features. - -dnl Copyright 2016-2023 Free Software Foundation, Inc. +# limits-h.m4 +# serial 1 +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 whether limits.h has needed features. + dnl From Paul Eggert. AC_DEFUN_ONCE([gl_LIMITS_H], @@ -23,14 +25,27 @@ AC_DEFUN_ONCE([gl_LIMITS_H], int wb = WORD_BIT; int ullw = ULLONG_WIDTH; int bw = BOOL_WIDTH; + int bm = BOOL_MAX; + int mblm = MB_LEN_MAX; ]])], [gl_cv_header_limits_width=yes], [gl_cv_header_limits_width=no])]) - if test "$gl_cv_header_limits_width" = yes; then - GL_GENERATE_LIMITS_H=false - else - GL_GENERATE_LIMITS_H=true - fi + GL_GENERATE_LIMITS_H=true + AS_IF([test "$gl_cv_header_limits_width" = yes], + [AC_CACHE_CHECK([whether limits.h has SSIZE_MAX], + [gl_cv_header_limits_ssize_max], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#include + #ifndef SSIZE_MAX + #error "SSIZE_MAX is not defined" + #endif + ]])], + [gl_cv_header_limits_ssize_max=yes], + [gl_cv_header_limits_ssize_max=no])]) + if test "$gl_cv_header_limits_ssize_max" = yes; then + GL_GENERATE_LIMITS_H=false + fi]) ]) dnl Unconditionally enables the replacement of . diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index 15b6b2a5..807a5eed 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 @@ -1,5 +1,6 @@ -# localcharset.m4 serial 8 -dnl Copyright (C) 2002, 2004, 2006, 2009-2023 Free Software Foundation, Inc. +# localcharset.m4 +# serial 8 +dnl Copyright (C) 2002, 2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index 8c41fadf..f8d7c543 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 @@ -1,5 +1,6 @@ -# locale-fr.m4 serial 20 -dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. +# locale-fr.m4 +# serial 23 +dnl Copyright (C) 2003, 2005-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. @@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a french locale with traditional encoding. -AC_DEFUN([gt_LOCALE_FR], +AC_DEFUN_ONCE([gt_LOCALE_FR], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) @@ -86,7 +87,7 @@ int main () { # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. - mingw*) + mingw* | windows*) # Test for the native Windows locale name. if (LC_ALL=French_France.1252 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=French_France.1252 @@ -116,7 +117,7 @@ int main () { if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr_FR.iso88591 else - # Test for the Solaris 7 locale name. + # Test for the Solaris 10 locale name. if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_fr=fr else @@ -133,15 +134,31 @@ int main () { rm -fr conftest* ]) LOCALE_FR=$gt_cv_locale_fr + case $LOCALE_FR in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_FR"; assuming "none"]) + LOCALE_FR=none;; + esac AC_SUBST([LOCALE_FR]) ]) dnl Determine the name of a french locale with UTF-8 encoding. -AC_DEFUN([gt_LOCALE_FR_UTF8], +AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) AC_CACHE_CHECK([for a french Unicode locale], [gt_cv_locale_fr_utf8], [ - AC_LANG_CONFTEST([AC_LANG_SOURCE([[ + 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_fr_utf8=fr_FR.UTF-8 + ;; + *) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ #include #include #if HAVE_LANGINFO_CODESET @@ -203,51 +220,82 @@ int main () { #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" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Test for the hypothetical native Windows locale name. - if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=French_France.65001 - else - # None found. - gt_cv_locale_fr_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 usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR.UTF-8 - else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr.UTF-8 + ]])]) + 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" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw* | windows*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=French_France.65001 else # None found. gt_cv_locale_fr_utf8=none fi - fi - fi - ;; - esac - fi - rm -fr conftest* + ;; + *) + # 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 usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 + else + # Test for the Solaris 10 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + ;; + esac ]) LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + case $LOCALE_FR_UTF8 in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_FR_UTF8"; assuming "none"]) + LOCALE_FR_UTF8=none;; + esac AC_SUBST([LOCALE_FR_UTF8]) + + dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they + dnl can rely on. + case "$host_os" in + *-musl* | midipix*) + dnl On musl libc, locale categories other than LC_CTYPE and LC_MESSAGES + dnl are effectively unimplemented. + LC_COLLATE_IMPLEMENTED=false + LC_NUMERIC_IMPLEMENTED=false + LC_TIME_IMPLEMENTED=false + LC_MONETARY_IMPLEMENTED=false + ;; + *) + LC_COLLATE_IMPLEMENTED=true + LC_NUMERIC_IMPLEMENTED=true + LC_TIME_IMPLEMENTED=true + LC_MONETARY_IMPLEMENTED=true + ;; + esac + AC_SUBST([LC_COLLATE_IMPLEMENTED]) + AC_SUBST([LC_NUMERIC_IMPLEMENTED]) + AC_SUBST([LC_TIME_IMPLEMENTED]) + AC_SUBST([LC_MONETARY_IMPLEMENTED]) ]) diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 25901730..8423bcb9 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 @@ -1,5 +1,6 @@ -# locale-ja.m4 serial 15 -dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. +# locale-ja.m4 +# serial 18 +dnl Copyright (C) 2003, 2005-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. @@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a japanese locale with EUC-JP encoding. -AC_DEFUN([gt_LOCALE_JA], +AC_DEFUN_ONCE([gt_LOCALE_JA], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) @@ -90,7 +91,7 @@ int main () # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. - mingw*) + mingw* | windows*) # Note that on native Windows, the Japanese locale is # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we # cannot use it here. @@ -117,7 +118,7 @@ int main () if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja_JP.EUC else - # Test for the Solaris 7 locale name. + # Test for the Solaris 10 locale name. if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_ja=ja else @@ -139,5 +140,11 @@ int main () rm -fr conftest* ]) LOCALE_JA=$gt_cv_locale_ja + case $LOCALE_JA in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_JA"; assuming "none"]) + LOCALE_JA=none;; + esac AC_SUBST([LOCALE_JA]) ]) diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index b9f9eef7..7f1a10be 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 @@ -1,5 +1,6 @@ -# locale-zh.m4 serial 15 -dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. +# locale-zh.m4 +# serial 18 +dnl Copyright (C) 2003, 2005-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. @@ -7,7 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. dnl Determine the name of a chinese locale with GB18030 encoding. -AC_DEFUN([gt_LOCALE_ZH_CN], +AC_DEFUN_ONCE([gt_LOCALE_ZH_CN], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AM_LANGINFO_CODESET]) @@ -91,7 +92,7 @@ int main () # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", # "ja" as "Japanese" or "Japanese_Japan.932", # and similar. - mingw*) + mingw* | windows*) # Test for the hypothetical native Windows locale name. if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then gt_cv_locale_zh_CN=Chinese_China.54936 @@ -133,5 +134,11 @@ int main () rm -fr conftest* ]) LOCALE_ZH_CN=$gt_cv_locale_zh_CN + case $LOCALE_ZH_CN in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_ZH_CN"; assuming "none"]) + LOCALE_ZH_CN=none;; + esac AC_SUBST([LOCALE_ZH_CN]) ]) diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 index a33a0a46..cd1c81ec 100644 --- a/gl/m4/locale_h.m4 +++ b/gl/m4/locale_h.m4 @@ -1,5 +1,6 @@ -# locale_h.m4 serial 28 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# locale_h.m4 +# serial 31 +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, dnl with or without modifications, as long as this notice is preserved. @@ -59,7 +60,9 @@ AC_DEFUN_ONCE([gl_LOCALE_H], dnl On native Windows with MSVC, merely define these member names as macros. dnl This avoids trouble in C++ mode. case "$host_os" in - mingw*) + windows*-msvc*) + ;; + mingw* | windows*) AC_EGREP_CPP([Special], [ #ifdef _MSC_VER Special @@ -152,7 +155,7 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], 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]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4 index ae225fed..77d5684f 100644 --- a/gl/m4/localeconv.m4 +++ b/gl/m4/localeconv.m4 @@ -1,5 +1,6 @@ -# localeconv.m4 serial 1 -dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. +# localeconv.m4 +# serial 3 +dnl Copyright (C) 2012-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. @@ -8,10 +9,45 @@ AC_DEFUN([gl_FUNC_LOCALECONV], [ AC_REQUIRE([gl_LOCALE_H_DEFAULTS]) AC_REQUIRE([gl_LOCALE_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles if test $REPLACE_STRUCT_LCONV = 1; then REPLACE_LOCALECONV=1 fi + if test $REPLACE_LOCALECONV = 0; then + dnl Test whether fields of type 'char' are filled correctly. + dnl This test fails on mingw 5.0.3. + AC_CACHE_CHECK([whether localeconv works], + [gl_cv_func_localeconv_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + int main () + { + struct lconv *l = localeconv (); + return l->frac_digits != CHAR_MAX && l->frac_digits < 0; + } + ]])], + [gl_cv_func_localeconv_works=yes], + [gl_cv_func_localeconv_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_localeconv_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_localeconv_works="guessing yes" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_localeconv_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_localeconv_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_localeconv_works" in + *yes) ;; + *) REPLACE_LOCALECONV=1 ;; + esac + fi ]) # Prerequisites of lib/localeconv.c. @@ -19,4 +55,6 @@ AC_DEFUN([gl_PREREQ_LOCALECONV], [ AC_CHECK_MEMBERS([struct lconv.decimal_point], [], [], [[#include ]]) + AC_CHECK_MEMBERS([struct lconv.int_p_cs_precedes], [], [], + [[#include ]]) ]) diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index 88cf5575..eb0fc6a1 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 @@ -1,5 +1,6 @@ -# lock.m4 serial 14 -dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. +# lock.m4 +# serial 14 +dnl Copyright (C) 2005-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. diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index fd4f1f27..0bc3d65e 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,5 +1,6 @@ -# lseek.m4 serial 12 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# lseek.m4 +# serial 15 +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, dnl with or without modifications, as long as this notice is preserved. @@ -13,13 +14,15 @@ AC_DEFUN([gl_FUNC_LSEEK], AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CACHE_CHECK([whether lseek detects pipes], [gl_cv_func_lseek_pipe], [case "$host_os" in - mingw*) + mingw* | windows*) dnl Native Windows. dnl The result of lseek (fd, (off_t)0, SEEK_CUR) or dnl SetFilePointer(handle, 0, NULL, FILE_CURRENT) - dnl for a pipe depends on the environment: In a Cygwin 1.5 - dnl environment it succeeds (wrong); in a Cygwin 1.7 environment - dnl it fails with a wrong errno value. + dnl for a pipe depends on the environment: + dnl In a Cygwin 1.5 environment it succeeds (wrong); + dnl in a Cygwin 1.7 environment it fails with a wrong errno value; + dnl in a Cygwin 2.9.0 environment it fails correctly; + dnl in a Cygwin 3.4.6 environment it succeeds again (wrong). gl_cv_func_lseek_pipe=no ;; *) @@ -70,9 +73,29 @@ AC_DEFUN([gl_FUNC_LSEEK], REPLACE_LSEEK=1 fi - dnl macOS SEEK_DATA is incompatible with other platforms. - case $host_os in - darwin*) - REPLACE_LSEEK=1;; - esac + AS_IF([test $REPLACE_LSEEK = 0], + [AC_CACHE_CHECK([whether SEEK_DATA works but is incompatible with GNU], + [gl_cv_func_lseek_works_but_incompatible], + [AC_PREPROC_IFELSE( + [AC_LANG_SOURCE( + dnl Use macOS "9999" to stand for a future fixed macOS version. + dnl See ../lib/unistd.in.h and . + [[#include + #if defined __APPLE__ && defined __MACH__ && defined SEEK_DATA + # ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ + # include + # endif + # if 99990000 <= MAC_OS_X_VERSION_MIN_REQUIRED + # define LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU + # endif + #endif + #ifndef LSEEK_WORKS_BUT_IS_INCOMPATIBLE_WITH_GNU + #error "No need to work around the bug" + #endif + ]])], + [gl_cv_func_lseek_works_but_incompatible=yes], + [gl_cv_func_lseek_works_but_incompatible=no])]) + if test "$gl_cv_func_lseek_works_but_incompatible" = yes; then + REPLACE_LSEEK=1 + fi]) ]) diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 55402924..41a46937 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 @@ -1,5 +1,6 @@ -# malloc.m4 serial 28 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# malloc.m4 +# serial 31 +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, dnl with or without modifications, as long as this notice is preserved. @@ -16,7 +17,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [[#include ]], [[void *p = malloc (0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ], @@ -25,8 +27,8 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | gnu* | *-musl* | midnightbsd* \ - | hpux* | solaris* | cygwin* | mingw* | msys* ) + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | 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" ;; @@ -128,7 +130,7 @@ AC_DEFUN([gl_CHECK_MALLOC_POSIX], 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*) + mingw* | windows*) gl_cv_func_malloc_posix=no ;; irix* | solaris*) dnl On IRIX 6.5, the three functions return NULL with errno unset diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4 index 1d777ebe..9e09d22c 100644 --- a/gl/m4/malloca.m4 +++ b/gl/m4/malloca.m4 @@ -1,5 +1,6 @@ -# malloca.m4 serial 2 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation, +# malloca.m4 +# serial 2 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index d2e90ff1..4b26c9e9 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 @@ -1,5 +1,6 @@ -# math_h.m4 serial 125 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# math_h.m4 +# serial 138 +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, dnl with or without modifications, as long as this notice is preserved. @@ -42,15 +43,21 @@ AC_DEFUN_ONCE([gl_MATH_H], cbrt cbrtf cbrtl ceilf ceill copysign copysignf copysignl cosf cosl coshf expf expl exp2 exp2f exp2l expm1 expm1f expm1l fabsf fabsl floorf floorl fma fmaf fmal - fmod fmodf fmodl frexpf frexpl hypotf hypotl + fmod fmodf fmodl frexpf frexpl + getpayload getpayloadf getpayloadl + hypotf hypotl ilogb ilogbf ilogbl ldexpf ldexpl log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l logb logbf logbl modf modff modfl powf remainder remainderf remainderl - rint rintf rintl round roundf roundl sinf sinl sinhf sqrtf sqrtl - tanf tanl tanhf trunc truncf truncl]) + rint rintf rintl round roundf roundl + setpayload setpayloadf setpayloadl + setpayloadsig setpayloadsigf setpayloadsigl + sinf sinl sinhf sqrtf sqrtl + tanf tanl tanhf totalorder totalorderf totalorderl totalordermag + totalordermagf totalordermagl trunc truncf truncl]) ]) # gl_MATH_MODULE_INDICATOR([modulename]) @@ -113,6 +120,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], 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_GETPAYLOAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAYLOADL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_HYPOTL]) @@ -125,6 +135,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], 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_LDEXP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LDEXPL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOG]) @@ -155,6 +166,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], 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_SETPAYLOAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIG]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) @@ -164,6 +181,12 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], 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_TOTALORDER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAG]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TOTALORDERMAGL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCL]) @@ -209,6 +232,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_FMODF=1; AC_SUBST([HAVE_FMODF]) HAVE_FMODL=1; AC_SUBST([HAVE_FMODL]) HAVE_FREXPF=1; AC_SUBST([HAVE_FREXPF]) + HAVE_GETPAYLOAD=1; AC_SUBST([HAVE_GETPAYLOAD]) + HAVE_GETPAYLOADF=1; AC_SUBST([HAVE_GETPAYLOADF]) + HAVE_GETPAYLOADL=1; AC_SUBST([HAVE_GETPAYLOADL]) HAVE_HYPOTF=1; AC_SUBST([HAVE_HYPOTF]) HAVE_HYPOTL=1; AC_SUBST([HAVE_HYPOTL]) HAVE_ILOGB=1; AC_SUBST([HAVE_ILOGB]) @@ -234,6 +260,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) HAVE_RINT=1; AC_SUBST([HAVE_RINT]) HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) + HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD]) + HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF]) + HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL]) + HAVE_SETPAYLOADSIG=1; AC_SUBST([HAVE_SETPAYLOADSIG]) + HAVE_SETPAYLOADSIGF=1; AC_SUBST([HAVE_SETPAYLOADSIGF]) + HAVE_SETPAYLOADSIGL=1; AC_SUBST([HAVE_SETPAYLOADSIGL]) HAVE_SINF=1; AC_SUBST([HAVE_SINF]) HAVE_SINL=1; AC_SUBST([HAVE_SINL]) HAVE_SINHF=1; AC_SUBST([HAVE_SINHF]) @@ -242,6 +274,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_TANF=1; AC_SUBST([HAVE_TANF]) HAVE_TANL=1; AC_SUBST([HAVE_TANL]) HAVE_TANHF=1; AC_SUBST([HAVE_TANHF]) + HAVE_TOTALORDER=1; AC_SUBST([HAVE_TOTALORDER]) + HAVE_TOTALORDERF=1; AC_SUBST([HAVE_TOTALORDERF]) + HAVE_TOTALORDERL=1; AC_SUBST([HAVE_TOTALORDERL]) + HAVE_TOTALORDERMAG=1; AC_SUBST([HAVE_TOTALORDERMAG]) + HAVE_TOTALORDERMAGF=1; AC_SUBST([HAVE_TOTALORDERMAGF]) + HAVE_TOTALORDERMAGL=1; AC_SUBST([HAVE_TOTALORDERMAGL]) HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) @@ -309,6 +347,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_FREXPF=0; AC_SUBST([REPLACE_FREXPF]) REPLACE_FREXP=0; AC_SUBST([REPLACE_FREXP]) REPLACE_FREXPL=0; AC_SUBST([REPLACE_FREXPL]) + REPLACE_GETPAYLOAD=0; AC_SUBST([REPLACE_GETPAYLOAD]) + REPLACE_GETPAYLOADF=0; AC_SUBST([REPLACE_GETPAYLOADF]) + REPLACE_GETPAYLOADL=0; AC_SUBST([REPLACE_GETPAYLOADL]) REPLACE_HUGE_VAL=0; AC_SUBST([REPLACE_HUGE_VAL]) REPLACE_HYPOT=0; AC_SUBST([REPLACE_HYPOT]) REPLACE_HYPOTF=0; AC_SUBST([REPLACE_HYPOTF]) @@ -319,6 +360,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_ISFINITE=0; AC_SUBST([REPLACE_ISFINITE]) REPLACE_ISINF=0; AC_SUBST([REPLACE_ISINF]) REPLACE_ISNAN=0; AC_SUBST([REPLACE_ISNAN]) + REPLACE_LDEXP=0; AC_SUBST([REPLACE_LDEXP]) REPLACE_LDEXPL=0; AC_SUBST([REPLACE_LDEXPL]) REPLACE_LOG=0; AC_SUBST([REPLACE_LOG]) REPLACE_LOGF=0; AC_SUBST([REPLACE_LOGF]) @@ -354,6 +396,12 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) REPLACE_TANHF=0; AC_SUBST([REPLACE_TANHF]) + REPLACE_TOTALORDER=0; AC_SUBST([REPLACE_TOTALORDER]) + REPLACE_TOTALORDERF=0; AC_SUBST([REPLACE_TOTALORDERF]) + REPLACE_TOTALORDERL=0; AC_SUBST([REPLACE_TOTALORDERL]) + REPLACE_TOTALORDERMAG=0; AC_SUBST([REPLACE_TOTALORDERMAG]) + REPLACE_TOTALORDERMAGF=0; AC_SUBST([REPLACE_TOTALORDERMAGF]) + REPLACE_TOTALORDERMAGL=0; AC_SUBST([REPLACE_TOTALORDERMAGL]) REPLACE_TRUNC=0; AC_SUBST([REPLACE_TRUNC]) REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) @@ -364,7 +412,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], # Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines # HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. # The currently known platforms where this is the case are: -# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. +# Linux/HPPA, NetBSD/sparc32, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], [ AC_CACHE_CHECK([whether long double and double are the same], diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index bb393041..62c4fdb3 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 @@ -1,5 +1,6 @@ -# mbrtowc.m4 serial 38 -*- coding: utf-8 -*- -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2023 Free Software Foundation, +# mbrtowc.m4 +# serial 44 -*- coding: utf-8 -*- +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -91,20 +92,25 @@ AC_DEFUN([gl_FUNC_MBRTOWC], fi if test $REPLACE_MBSTATE_T = 1; then case "$host_os" in - mingw*) LIB_MBRTOWC= ;; + mingw* | windows*) + MBRTOWC_LIB= + ;; *) gl_WEAK_SYMBOLS case "$gl_cv_have_weak" in - *yes) LIB_MBRTOWC= ;; - *) LIB_MBRTOWC="$LIBPTHREAD" ;; + *yes) MBRTOWC_LIB= ;; + *) MBRTOWC_LIB="$LIBPTHREAD" ;; esac ;; esac else - LIB_MBRTOWC= + MBRTOWC_LIB= fi - dnl LIB_MBRTOWC is expected to be '-pthread' or '-lpthread' on AIX + dnl MBRTOWC_LIB is expected to be '-pthread' or '-lpthread' on AIX dnl with gcc or xlc, and empty otherwise. + AC_SUBST([MBRTOWC_LIB]) + dnl For backward compatibility. + LIB_MBRTOWC="$MBRTOWC_LIB" AC_SUBST([LIB_MBRTOWC]) ]) @@ -114,7 +120,7 @@ dnl Result is REPLACE_MBSTATE_T. dnl When this is set to 1, we replace both mbsinit() and mbrtowc(), in order to dnl avoid inconsistencies. -AC_DEFUN([gl_MBSTATE_T_BROKEN], +AC_DEFUN_ONCE([gl_MBSTATE_T_BROKEN], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -126,7 +132,7 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], dnl to override it, even if - like on MSVC - mbsinit() is only defined as dnl an inline function, not as a global function. if case "$host_os" in - mingw*) true ;; + mingw* | windows*) true ;; *) test $ac_cv_func_mbsinit = yes ;; esac \ && test $ac_cv_func_mbrtowc = yes; then @@ -408,14 +414,16 @@ AC_DEFUN([gl_MBRTOWC_RETVAL], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on HP-UX, Solaris, native Windows. - hpux* | solaris* | mingw*) gl_cv_func_mbrtowc_retval="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_func_mbrtowc_retval="guessing yes" ;; + # Guess no on HP-UX, Solaris, native Windows. + hpux* | solaris* | mingw* | windows*) + gl_cv_func_mbrtowc_retval="guessing no" ;; + # Guess yes otherwise. + *) + gl_cv_func_mbrtowc_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ - || { case "$host_os" in mingw*) true;; *) false;; esac; }; then + || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -426,7 +434,8 @@ int main () int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; @@ -442,7 +451,8 @@ int main () found_some_locale = 1; } /* This fails on HP-UX 11.11. */ - if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + if (strcmp ("$LOCALE_JA", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_JA") != NULL) { char input[] = "B\217\253\344\217\251\316er"; /* "Büßer" */ mbstate_t state; @@ -577,13 +587,13 @@ AC_DEFUN([gl_MBRTOWC_STORES_INCOMPLETE], dnl is present. changequote(,)dnl case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; - *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; + *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; esac changequote([,])dnl case "$host_os" in - mingw*) + mingw* | windows*) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -677,31 +687,28 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT], AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc works on empty input], [gl_cv_func_mbrtowc_empty_input], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. -changequote(,)dnl - case "$host_os" in - # Guess no on AIX and glibc systems. - aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; - *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; - esac -changequote([,])dnl - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ - #include - static wchar_t wc; - static mbstate_t mbs; - int - main (void) - { - return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; - }]])], - [gl_cv_func_mbrtowc_empty_input=yes], - [gl_cv_func_mbrtowc_empty_input=no], - [:]) + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + static wchar_t wc; + static mbstate_t mbs; + int + main (void) + { + return mbrtowc (&wc, "", 0, &mbs) != (size_t) -2; + }]])], + [gl_cv_func_mbrtowc_empty_input=yes], + [gl_cv_func_mbrtowc_empty_input=no], + [case "$host_os" in + # Guess no on AIX and glibc systems. + aix* | *-gnu* | gnu*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + # Guess no on Android. + linux*-android*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_mbrtowc_empty_input="guessing no" ;; + *) gl_cv_func_mbrtowc_empty_input="guessing yes" ;; + esac + ]) ]) ]) @@ -709,18 +716,17 @@ dnl Test whether mbrtowc reports encoding errors in the C locale. dnl Although POSIX was never intended to allow this, the GNU C Library dnl and other implementations do it. See: dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 +dnl POSIX has now clarified it: +dnl +dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte +dnl values are valid characters." AC_DEFUN([gl_MBRTOWC_C_LOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether the C locale is free of encoding errors], [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. - gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" - - AC_RUN_IFELSE( + [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include @@ -741,13 +747,14 @@ AC_DEFUN([gl_MBRTOWC_C_LOCALE], } return 0; ]])], - [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], - [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], - [case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; - esac - ]) + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes], + [gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no], + [case "$host_os" in + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; + *) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; + esac + ]) ]) ]) diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index c388a8b9..10c86ba9 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 @@ -1,5 +1,6 @@ -# mbsinit.m4 serial 9 -dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. +# mbsinit.m4 +# serial 10 +dnl Copyright (C) 2008, 2010-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. @@ -32,7 +33,7 @@ AC_DEFUN([gl_FUNC_MBSINIT], dnl states produced by mbrtowc() for an incomplete multibyte character dnl in multibyte locales. case "$host_os" in - mingw*) REPLACE_MBSINIT=1 ;; + mingw* | windows*) REPLACE_MBSINIT=1 ;; esac fi fi diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index dcd66b96..66d65cd7 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 @@ -1,5 +1,6 @@ -# mbstate_t.m4 serial 14 -dnl Copyright (C) 2000-2002, 2008-2023 Free Software Foundation, Inc. +# mbstate_t.m4 +# serial 14 +dnl Copyright (C) 2000-2002, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4 index 7823be0e..603b0c1a 100644 --- a/gl/m4/mbtowc.m4 +++ b/gl/m4/mbtowc.m4 @@ -1,5 +1,6 @@ -# mbtowc.m4 serial 3 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# mbtowc.m4 +# serial 5 +dnl Copyright (C) 2011-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. @@ -8,9 +9,12 @@ AC_DEFUN([gl_FUNC_MBTOWC], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_CHECK_FUNCS([mbtowc]) + gl_CHECK_FUNCS_ANDROID([mbtowc], [[#include ]]) if test $ac_cv_func_mbtowc = no; then HAVE_MBTOWC=0 + case "$gl_cv_onwards_func_mbtowc" in + future*) REPLACE_MBTOWC=1 ;; + esac else if false; then REPLACE_MBTOWC=1 diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 4f1aed01..346a2882 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 @@ -1,5 +1,6 @@ -# memchr.m4 serial 18 -dnl Copyright (C) 2002-2004, 2009-2023 Free Software Foundation, Inc. +# memchr.m4 +# serial 19 +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. @@ -85,12 +86,12 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [gl_cv_func_memchr_works=yes], [gl_cv_func_memchr_works=no], [case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_memchr_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_memchr_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index fd09846f..bc7d0c34 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 @@ -1,5 +1,6 @@ -# minmax.m4 serial 4 -dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. +# minmax.m4 +# serial 4 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index e9d31f35..85c52454 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 @@ -1,6 +1,6 @@ -# serial 37 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation, -dnl Inc. +# mktime.m4 +# serial 39 +dnl Copyright (C) 2002-2003, 2005-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, dnl with or without modifications, as long as this notice is preserved. @@ -264,9 +264,9 @@ main () [gl_cv_func_working_mktime=yes], [gl_cv_func_working_mktime=no], [case "$host_os" in - # Guess no on native Windows. - mingw*) gl_cv_func_working_mktime="guessing no" ;; - *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_working_mktime="guessing no" ;; + *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; esac ]) fi @@ -280,7 +280,6 @@ AC_DEFUN([gl_FUNC_MKTIME], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) - REPLACE_MKTIME=0 if test "$gl_cv_func_working_mktime" != yes; then REPLACE_MKTIME=1 AC_DEFINE([NEED_MKTIME_WORKING], [1], @@ -288,7 +287,7 @@ AC_DEFUN([gl_FUNC_MKTIME], with the algorithmic workarounds.]) fi case "$host_os" in - mingw*) + mingw* | windows*) REPLACE_MKTIME=1 AC_DEFINE([NEED_MKTIME_WINDOWS], [1], [Define if the compilation of mktime.c should define 'mktime' diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index d07d26e4..61ca0120 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 @@ -1,5 +1,6 @@ -# mmap-anon.m4 serial 12 -dnl Copyright (C) 2005, 2007, 2009-2023 Free Software Foundation, Inc. +# mmap-anon.m4 +# serial 12 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 index 82197c02..0d5c2808 100644 --- a/gl/m4/mode_t.m4 +++ b/gl/m4/mode_t.m4 @@ -1,5 +1,6 @@ -# mode_t.m4 serial 2 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# mode_t.m4 +# serial 2 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index a9b4edb9..ff414e66 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 @@ -1,5 +1,6 @@ -# serial 15 -dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. +# mountlist.m4 +# serial 17 +dnl Copyright (C) 2002-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, dnl with or without modifications, as long as this notice is preserved. @@ -106,7 +107,18 @@ $ac_includes_default [Define if there is a function named getmntent for reading the list of mounted file systems, and that function takes a single argument. (4.3BSD, SunOS, HP-UX, Irix)]) - AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) + gl_CHECK_FUNCS_ANDROID([setmntent], + [[#include + #include + ]]) + gl_CHECK_FUNCS_ANDROID([endmntent], + [[#include + #include + ]]) + gl_CHECK_FUNCS_ANDROID([hasmntopt], + [[#include + #include + ]]) fi fi diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 index 8d9d21b5..7919ff12 100644 --- a/gl/m4/msvc-inval.m4 +++ b/gl/m4/msvc-inval.m4 @@ -1,5 +1,6 @@ -# msvc-inval.m4 serial 1 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# msvc-inval.m4 +# serial 1 +dnl Copyright (C) 2011-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. diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4 index 0263e490..007c7620 100644 --- a/gl/m4/msvc-nothrow.m4 +++ b/gl/m4/msvc-nothrow.m4 @@ -1,5 +1,6 @@ -# msvc-nothrow.m4 serial 1 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# msvc-nothrow.m4 +# serial 1 +dnl Copyright (C) 2011-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. diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 3ba5b0f7..3af29d39 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 @@ -1,5 +1,6 @@ -# multiarch.m4 serial 9 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# multiarch.m4 +# serial 9 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/musl.m4 b/gl/m4/musl.m4 new file mode 100644 index 00000000..0d4de892 --- /dev/null +++ b/gl/m4/musl.m4 @@ -0,0 +1,21 @@ +# musl.m4 +# serial 4 +dnl Copyright (C) 2019-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. + +# Test for musl libc, despite the musl libc authors don't like it +# +# . +# From Bruno Haible. + +AC_DEFUN_ONCE([gl_MUSL_LIBC], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + *-musl* | midipix*) + AC_DEFINE([MUSL_LIBC], [1], [Define to 1 on musl libc.]) + ;; + esac +]) diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index e6aa8925..d8c00217 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 @@ -1,5 +1,6 @@ -# netdb_h.m4 serial 15 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# netdb_h.m4 +# serial 15 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 71154191..926f7f95 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,5 +1,6 @@ -# netinet_in_h.m4 serial 6 -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# netinet_in_h.m4 +# serial 6 +dnl Copyright (C) 2006-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. diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 index 51e783ce..f38f11bb 100644 --- a/gl/m4/nl_langinfo.m4 +++ b/gl/m4/nl_langinfo.m4 @@ -1,5 +1,6 @@ -# nl_langinfo.m4 serial 8 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# nl_langinfo.m4 +# serial 11 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -8,7 +9,7 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], [ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) AC_REQUIRE([gl_LANGINFO_H]) - AC_CHECK_FUNCS_ONCE([nl_langinfo]) + gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include ]]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) AC_REQUIRE([gl_PTHREADLIB]) @@ -60,9 +61,12 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], fi else HAVE_NL_LANGINFO=0 + case "$gl_cv_onwards_func_nl_langinfo" in + future*) REPLACE_NL_LANGINFO=1 ;; + esac fi if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then - LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" + LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB" else LIB_NL_LANGINFO= fi diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index 6a766387..cbe8fe82 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 @@ -1,5 +1,6 @@ -# nocrash.m4 serial 5 -dnl Copyright (C) 2005, 2009-2023 Free Software Foundation, Inc. +# nocrash.m4 +# serial 5 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4 index 880f3472..db6035db 100644 --- a/gl/m4/off_t.m4 +++ b/gl/m4/off_t.m4 @@ -1,5 +1,6 @@ -# off_t.m4 serial 1 -dnl Copyright (C) 2012-2023 Free Software Foundation, Inc. +# off_t.m4 +# serial 1 +dnl Copyright (C) 2012-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. diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4 index fd572fcd..6defdfb4 100644 --- a/gl/m4/open-cloexec.m4 +++ b/gl/m4/open-cloexec.m4 @@ -1,10 +1,12 @@ -# Test whether O_CLOEXEC is defined. - -dnl Copyright 2017-2023 Free Software Foundation, Inc. +# open-cloexec.m4 +# serial 1 +dnl Copyright 2017-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. +# Test whether O_CLOEXEC is defined. + AC_DEFUN([gl_PREPROC_O_CLOEXEC], [ AC_CACHE_CHECK([for O_CLOEXEC], diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4 index 1f731f8a..03460e42 100644 --- a/gl/m4/open-slash.m4 +++ b/gl/m4/open-slash.m4 @@ -1,5 +1,6 @@ -# open-slash.m4 serial 2 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# open-slash.m4 +# serial 2 +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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 94fa2bb7..62a11a11 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 @@ -1,5 +1,6 @@ -# open.m4 serial 15 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# open.m4 +# serial 16 +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, dnl with or without modifications, as long as this notice is preserved. @@ -9,7 +10,7 @@ AC_DEFUN([gl_FUNC_OPEN], AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) case "$host_os" in - mingw* | pw*) + mingw* | windows* | pw*) REPLACE_OPEN=1 ;; *) diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 index 6d47d2c0..4280837f 100644 --- a/gl/m4/pathmax.m4 +++ b/gl/m4/pathmax.m4 @@ -1,5 +1,6 @@ -# pathmax.m4 serial 11 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2023 Free Software Foundation, +# pathmax.m4 +# serial 11 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4 index 0fd7d0a1..8bedcc6b 100644 --- a/gl/m4/pid_t.m4 +++ b/gl/m4/pid_t.m4 @@ -1,5 +1,6 @@ -# pid_t.m4 serial 4 -dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. +# pid_t.m4 +# serial 4 +dnl Copyright (C) 2020-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. diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 4e65abc6..0cb14d6f 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,5 +1,6 @@ -# printf.m4 serial 73 -dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. +# printf.m4 +# serial 91 +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. @@ -63,7 +64,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; + *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; @@ -86,7 +87,8 @@ changequote(,)dnl linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + windows*-msvc*) gl_cv_func_printf_sizes_c99="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif @@ -101,6 +103,92 @@ changequote([,])dnl ]) ]) +dnl Test whether the *printf family of functions supports the 'w8', 'w16', +dnl 'w32', 'w64', 'wf8', 'wf16', 'wf32', 'wf64' size specifiers. (ISO C23) +dnl Result is gl_cv_func_printf_sizes_c23. + +AC_DEFUN([gl_PRINTF_SIZES_C23], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_AC_HEADER_STDINT_H]) + AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports size specifiers as in C23], + [gl_cv_func_printf_sizes_c23], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +# include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif +static char buf[100]; +int main () +{ + int result = 0; + buf[0] = '\0'; + if (sprintf (buf, "%w8u %d", (uint8_t) 123, 33, 44, 55) < 0 + || strcmp (buf, "123 33") != 0) + result |= 1; + buf[0] = '\0'; + if (sprintf (buf, "%wf8u %d", (uint_fast8_t) 123, 33, 44, 55) < 0 + || strcmp (buf, "123 33") != 0) + result |= 1; + buf[0] = '\0'; + if (sprintf (buf, "%w16u %d", (uint16_t) 12345, 33, 44, 55) < 0 + || strcmp (buf, "12345 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%wf16u %d", (uint_fast16_t) 12345, 33, 44, 55) < 0 + || strcmp (buf, "12345 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%w32u %d", (uint32_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 4; + buf[0] = '\0'; + if (sprintf (buf, "%wf32u %d", (uint_fast32_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 4; +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%w64u %d", (uint64_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 8; + buf[0] = '\0'; + if (sprintf (buf, "%wf64u %d", (uint_fast64_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 8; +#else + result |= 8; +#endif + return result; +}]])], + [gl_cv_func_printf_sizes_c23=yes], + [gl_cv_func_printf_sizes_c23=no], + [ + case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_sizes_c23="guessing no";; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_printf_sizes_c23="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_sizes_c23="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_printf_sizes_c23="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_sizes_c23="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + dnl Test whether the *printf family of functions supports 'long double' dnl arguments together with the 'L' size specifier. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_long_double. @@ -137,20 +225,21 @@ int main () [gl_cv_func_printf_long_double=yes], [gl_cv_func_printf_long_double=no], [case "$host_os" in - # Guess no on BeOS. - beos*) gl_cv_func_printf_long_double="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_long_double="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + # Guess no on BeOS. + beos*) gl_cv_func_printf_long_double="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_long_double="guessing yes";; + # Guess yes on MSVC, no on mingw. + windows*-msvc*) gl_cv_func_printf_long_double="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif - ], - [gl_cv_func_printf_long_double="guessing yes"], - [gl_cv_func_printf_long_double="guessing no"]) - ;; - *) gl_cv_func_printf_long_double="guessing yes";; + ], + [gl_cv_func_printf_long_double="guessing yes"], + [gl_cv_func_printf_long_double="guessing no"]) + ;; + *) gl_cv_func_printf_long_double="guessing yes";; esac ]) ]) @@ -244,7 +333,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite="guessing yes";; + *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; @@ -268,7 +357,8 @@ changequote(,)dnl linux*-android*) gl_cv_func_printf_infinite="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + windows*-msvc*) gl_cv_func_printf_infinite="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif @@ -467,7 +557,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; + *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; @@ -482,7 +572,8 @@ changequote(,)dnl linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + windows*-msvc*) gl_cv_func_printf_infinite_long_double="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif @@ -591,11 +682,11 @@ int main () [gl_cv_func_printf_directive_a="guessing no"]) ;; # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_a="guessing yes";; + *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_a="guessing no";; # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_a="guessing no";; + mingw* | windows*) gl_cv_func_printf_directive_a="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; esac @@ -603,6 +694,116 @@ int main () ]) ]) +dnl Test whether the *printf family of functions supports the 'b' conversion +dnl specifier for binary output of integers. +dnl (ISO C23) +dnl Result is gl_cv_func_printf_directive_b. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_B], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'b' directive], + [gl_cv_func_printf_directive_b], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +static char buf[100]; +int main () +{ + int result = 0; + if (sprintf (buf, "%b %d", 12345, 33, 44, 55) < 0 + || strcmp (buf, "11000000111001 33") != 0) + result |= 1; + return result; +}]])], + [gl_cv_func_printf_directive_b=yes], + [gl_cv_func_printf_directive_b=no], + [ + case "$host_os" in + # Guess yes on glibc >= 2.35 systems. + *-gnu* | gnu*) + AC_EGREP_CPP([Lucky], [ + #include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + ], + [gl_cv_func_printf_directive_uppercase_b="guessing yes"], + [gl_cv_func_printf_directive_uppercase_b="guessing no"]) + ;; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_printf_directive_b="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_b="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_printf_directive_b="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_b="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports the 'B' conversion +dnl specifier for binary output of integers. +dnl (GNU, encouraged by ISO C23 § 7.23.6.1) +dnl Result is gl_cv_func_printf_directive_uppercase_b. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_UPPERCASE_B], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'B' directive], + [gl_cv_func_printf_directive_uppercase_b], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +static char buf[100]; +int main () +{ + int result = 0; + if (sprintf (buf, "%#B %d", 12345, 33, 44, 55) < 0 + || strcmp (buf, "0B11000000111001 33") != 0) + result |= 1; + return result; +}]])], + [gl_cv_func_printf_directive_uppercase_b=yes], + [gl_cv_func_printf_directive_uppercase_b=no], + [ + case "$host_os" in + # Guess yes on glibc >= 2.35 systems. + *-gnu* | gnu*) + AC_EGREP_CPP([Lucky], [ + #include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 35) || (__GLIBC__ > 2) + Lucky user + #endif + #endif + ], + [gl_cv_func_printf_directive_uppercase_b="guessing yes"], + [gl_cv_func_printf_directive_uppercase_b="guessing no"]) + ;; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_printf_directive_uppercase_b="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_uppercase_b="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_printf_directive_uppercase_b="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_uppercase_b="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + dnl Test whether the *printf family of functions supports the %F format dnl directive. (ISO C99, POSIX:2001) dnl Result is gl_cv_func_printf_directive_f. @@ -643,7 +844,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_f="guessing yes";; + *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";; # Guess yes on FreeBSD >= 6. freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; @@ -661,7 +862,8 @@ changequote(,)dnl linux*-android*) gl_cv_func_printf_directive_f="guessing no";; changequote([,])dnl # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + windows*-msvc*) gl_cv_func_printf_directive_f="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif @@ -689,6 +891,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ +#include #include #include #include @@ -706,6 +909,12 @@ invalid_parameter_handler (const wchar_t *expression, exit (1); } #endif +static void +abort_handler (int sig) +{ + (void) sig; + _exit (1); +} static char fmtstring[10]; static char buf[100]; int main () @@ -714,6 +923,7 @@ int main () #ifdef _MSC_VER _set_invalid_parameter_handler (invalid_parameter_handler); #endif + signal (SIGABRT, abort_handler); /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ @@ -727,21 +937,21 @@ int main () [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], [case "$host_os" in - # Guess no on glibc when _FORTIFY_SOURCE >= 2. - *-gnu* | gnu*) AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#if _FORTIFY_SOURCE >= 2 - error fail - #endif - ]])], - [gl_cv_func_printf_directive_n="guessing yes"], - [gl_cv_func_printf_directive_n="guessing no"]) - ;; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_n="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_n="guessing no";; - *) gl_cv_func_printf_directive_n="guessing yes";; + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if _FORTIFY_SOURCE >= 2 + error fail + #endif + ]])], + [gl_cv_func_printf_directive_n="guessing yes"], + [gl_cv_func_printf_directive_n="guessing no"]) + ;; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_n="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; esac ]) ]) @@ -811,18 +1021,64 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on OpenBSD >= 6.0. - openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; - openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_directive_ls="guessing yes";; - *) gl_cv_func_printf_directive_ls="guessing yes";; + # Guess yes on OpenBSD >= 6.0. + openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; + openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; + irix*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; + cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_printf_directive_ls="guessing yes";; + *) gl_cv_func_printf_directive_ls="guessing yes";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports the %lc format +dnl directive and in particular, when the argument is a null wide character, +dnl whether the functions produce a NUL byte, as specified in ISO C 23 +dnl after the issue GB-141 was fixed. +dnl Result is gl_cv_func_printf_directive_lc. + +AC_DEFUN([gl_PRINTF_DIRECTIVE_LC], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the 'lc' directive correctly], + [gl_cv_func_printf_directive_lc], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +int main () +{ + int result = 0; + char buf[100]; + /* This test fails on musl libc 1.2.4. */ + { + buf[0] = '\0'; + if (sprintf (buf, "%lc%lc%lc", (wint_t) 'a', (wint_t) 0, (wint_t) 'z') < 0 + || memcmp (buf, "a\0z", 4) != 0) + result |= 1; + } + return result; +}]])], + [gl_cv_func_printf_directive_lc=yes], + [gl_cv_func_printf_directive_lc=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no on musl libc. + *-musl* | midipix*) gl_cv_func_printf_directive_lc="guessing no";; + # Guess yes otherwise. + *) gl_cv_func_printf_directive_lc="guessing yes";; esac changequote([,])dnl ]) @@ -833,7 +1089,7 @@ dnl Test whether the *printf family of functions supports POSIX/XSI format dnl strings with positions. (POSIX:2001) dnl Result is gl_cv_func_printf_positions. -AC_DEFUN([gl_PRINTF_POSITIONS], +AC_DEFUN_ONCE([gl_PRINTF_POSITIONS], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -859,13 +1115,17 @@ int main () changequote(,)dnl case "$host_os" in netbsd[1-3]* | netbsdelf[1-3]* | netbsdaout[1-3]* | netbsdcoff[1-3]*) - gl_cv_func_printf_positions="guessing no";; - beos*) gl_cv_func_printf_positions="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_positions="guessing yes";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_positions="guessing no";; - *) gl_cv_func_printf_positions="guessing yes";; + gl_cv_func_printf_positions="guessing no";; + beos*) + gl_cv_func_printf_positions="guessing no";; + # Guess yes on Android. + linux*-android*) + gl_cv_func_printf_positions="guessing yes";; + # Guess no on native Windows. + mingw* | windows* | pw*) + gl_cv_func_printf_positions="guessing no";; + *) + gl_cv_func_printf_positions="guessing yes";; esac changequote([,])dnl ]) @@ -900,13 +1160,13 @@ int main () [ changequote(,)dnl case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on native Windows. + mingw* | windows* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; esac changequote([,])dnl ]) @@ -943,16 +1203,16 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on HP-UX 11. - hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess no on HP-UX 10 and older. - hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes otherwise. - *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; esac changequote([,])dnl ]) @@ -990,18 +1250,62 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_flag_zero="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_printf_flag_zero="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; + esac +changequote([,])dnl + ]) + ]) +]) + +dnl Test whether the *printf family of functions supports the # flag with a +dnl zero precision and a zero value in the 'x' and 'X' directives correctly. +dnl ISO C and POSIX specify that for the 'd', 'i', 'b', 'o', 'u', 'x', 'X' +dnl directives: "The result of converting a zero value with a precision of +dnl zero is no characters." But on Mac OS X 10.5, for the 'x', 'X' directives, +dnl when a # flag is present, the output is "0" instead of "". +dnl Result is gl_cv_func_printf_flag_alt_precision_zero. + +AC_DEFUN([gl_PRINTF_FLAG_ALT_PRECISION_ZERO], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether printf supports the alternative flag with a zero precision], + [gl_cv_func_printf_flag_alt_precision_zero], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +static char buf[10]; +int main () +{ + int result = 0; + if (sprintf (buf, "%#.0x %d", 0, 33, 44) > 0 + 3) + result |= 1; + return result; +}]])], + [gl_cv_func_printf_flag_alt_precision_zero=yes], + [gl_cv_func_printf_flag_alt_precision_zero=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess no only on macOS 10..12 systems. + darwin[0-9] | darwin[0-9].* | \ + darwin1[0-9] | darwin1[0-9].* | \ + darwin2[0-1] | darwin2[0-1].*) + gl_cv_func_printf_flag_alt_precision_zero="guessing no" ;; + darwin*) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; + *) gl_cv_func_printf_flag_alt_precision_zero="guessing yes" ;; esac changequote([,])dnl ]) @@ -1054,12 +1358,12 @@ int main () changequote(,)dnl case "$host_os" in # Guess no only on Solaris, native Windows, and BeOS systems. - solaris*) gl_cv_func_printf_precision="guessing no" ;; - mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; + solaris*) gl_cv_func_printf_precision="guessing no" ;; + mingw* | windows* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; esac changequote([,])dnl ]) @@ -1239,7 +1543,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; + *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; @@ -1275,7 +1579,7 @@ changequote(,)dnl # Guess yes on Android. linux*-android*) gl_cv_func_snprintf_truncation_c99="guessing yes";; # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_truncation_c99="guessing no";; + mingw* | windows*) gl_cv_func_snprintf_truncation_c99="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_truncation_c99="$gl_cross_guess_normal";; esac @@ -1344,7 +1648,7 @@ changequote(,)dnl # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; + *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; @@ -1372,7 +1676,8 @@ changequote(,)dnl linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; changequote([,])dnl # Guess yes on MSVC, no on mingw. - mingw*) AC_EGREP_CPP([Known], [ + windows*-msvc*) gl_cv_func_snprintf_retval_c99="guessing yes" ;; + mingw* | windows*) AC_EGREP_CPP([Known], [ #ifdef _MSC_VER Known #endif @@ -1401,6 +1706,7 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], [ AC_RUN_IFELSE( [AC_LANG_SOURCE([[ +#include #include #include #if HAVE_SNPRINTF @@ -1417,11 +1723,18 @@ static int my_snprintf (char *buf, int size, const char *format, ...) return ret; } #endif +static void +abort_handler (int sig) +{ + (void) sig; + _exit (1); +} static char fmtstring[10]; static char buf[100]; int main () { int count = -1; + signal (SIGABRT, abort_handler); /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) support %n in format strings in read-only memory but not in writable memory. */ @@ -1447,7 +1760,7 @@ int main () ;; changequote(,)dnl # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; + *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; @@ -1476,7 +1789,7 @@ changequote(,)dnl # Guess no on Android. linux*-android*) gl_cv_func_snprintf_directive_n="guessing no";; # Guess no on native Windows. - mingw*) gl_cv_func_snprintf_directive_n="guessing no";; + mingw* | windows*) gl_cv_func_snprintf_directive_n="guessing no";; # If we don't know, obey --enable-cross-guesses. *) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";; changequote([,])dnl @@ -1524,11 +1837,11 @@ int main() [gl_cv_func_snprintf_size1=yes], [gl_cv_func_snprintf_size1=no], [case "$host_os" in - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_snprintf_size1="guessing yes" ;; - *) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_size1="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_snprintf_size1="guessing yes" ;; + *) gl_cv_func_snprintf_size1="guessing yes" ;; esac ]) ]) @@ -1601,128 +1914,320 @@ int main() [ changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Cygwin. - cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Solaris >= 2.6. + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + midnightbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + darwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Cygwin. + cygwin*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Solaris >= 2.6. solaris2.[0-5] | solaris2.[0-5].*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on IRIX >= 6.5. - irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on NetBSD >= 3. + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + solaris*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on IRIX >= 6.5. + irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on NetBSD >= 3. netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_vsnprintf_zerosize_c99="guessing no";; - netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # Guess yes on native Windows. - mingw* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; + gl_cv_func_vsnprintf_zerosize_c99="guessing no";; + netbsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # Guess yes on native Windows. + mingw* | windows* | pw*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vsnprintf_zerosize_c99="$gl_cross_guess_normal";; esac changequote([,])dnl ]) ]) ]) +dnl Test whether the swprintf function works correctly when it produces output +dnl that contains null wide characters. +dnl Result is gl_cv_func_swprintf_works. + +AC_DEFUN([gl_SWPRINTF_WORKS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([swprintf]) + AC_CACHE_CHECK([whether swprintf works], + [gl_cv_func_swprintf_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif +#include +#include +int main() +{ + int result = 0; + { /* This test fails on musl libc 1.2.3, FreeBSD, NetBSD, OpenBSD, macOS, AIX. */ + wchar_t buf[5] = { 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF, 0xBEEF }; + int ret = swprintf (buf, 4, L"%cz", '\0'); + /* Expected result: + ret = 2, buf[0] = 0x0, buf[1] = 0x7a, buf[2] = 0x0, buf[3] = 0xbeef + musl libc 1.2.3: + ret = 2, buf[0] = 0x0, buf[1] = 0x0, buf[2] = 0x0, buf[3] = 0x0 + Reported at . + FreeBSD 13.1, NetBSD 9.0, OpenBSD 7.2, macOS 12.5, AIX 7.2: + ret = 2, buf[0] = 0x0, buf[1] = 0xbeef, buf[2] = 0xbeef, buf[3] = 0xbeef + */ + if (ret < 0 || buf[1] != 'z') + result |= 1; + } + { /* This test fails on mingw. */ + wchar_t buf[2]; + int ret = swprintf (buf, 2, L"%lc", (wint_t)0); + /* Expected: ret = 1 + mingw: ret = 0 + */ + if (ret != 1) + result |= 2; + } + return result; +}]])], + [gl_cv_func_swprintf_works=yes], + [gl_cv_func_swprintf_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_swprintf_works="guessing yes";; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_swprintf_works="guessing no";; + # Guess no on FreeBSD, NetBSD, OpenBSD, macOS, AIX. + freebsd* | midnightbsd* | netbsd* | openbsd* | darwin* | aix*) + gl_cv_func_swprintf_works="guessing no";; + # Guess no on native Windows. + mingw* | windows* | pw*) gl_cv_func_swprintf_works="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_swprintf_works="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + +dnl Test whether the *wprintf family of functions supports the 'a' and 'A' +dnl conversion specifier for hexadecimal output of 'long double' numbers. +dnl (ISO C99, POSIX:2001) +dnl Result is gl_cv_func_swprintf_directive_la. + +AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LA], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether swprintf supports the 'La' and 'LA' directives], + [gl_cv_func_swprintf_directive_la], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +static wchar_t buf[100]; +int main () +{ + int result = 0; + /* This catches a glibc 2.15, Haiku 2022, NetBSD 10.0 bug. */ + if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), + L"%La %d", 3.1416015625L, 33, 44, 55) < 0 + || (wcscmp (buf, L"0x1.922p+1 33") != 0 + && wcscmp (buf, L"0x3.244p+0 33") != 0 + && wcscmp (buf, L"0x6.488p-1 33") != 0 + && wcscmp (buf, L"0xc.91p-2 33") != 0)) + result |= 1; + return result; +}]])], + [gl_cv_func_swprintf_directive_la=yes], + [gl_cv_func_swprintf_directive_la=no], + [case "$host_os" in + # Guess yes on glibc >= 2.17 systems. + *-gnu* | gnu*) + AC_EGREP_CPP([Unlucky], [ + #include + #ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16) || (__GLIBC__ > 2)) && !defined __UCLIBC__ + Unlucky + #endif + #endif + ], + [gl_cv_func_swprintf_directive_la="guessing yes"], + [gl_cv_func_swprintf_directive_la="guessing no"]) + ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_swprintf_directive_la="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_swprintf_directive_la="guessing yes";; + # Guess no on NetBSD. + netbsd*) gl_cv_func_swprintf_directive_la="guessing no";; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_swprintf_directive_la="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_swprintf_directive_la="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + +dnl Test whether the *wprintf family of functions supports the 'lc' conversion +dnl specifier for all wide characters. +dnl (ISO C11, POSIX:2001) +dnl Result is gl_cv_func_swprintf_directive_lc. + +AC_DEFUN([gl_SWPRINTF_DIRECTIVE_LC], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether swprintf supports the 'lc' directive], + [gl_cv_func_swprintf_directive_lc], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +static wchar_t buf[100]; +static wint_t L_invalid = (wchar_t) 0x76543210; +int main () +{ + int result = 0; + /* This catches a musl libc 1.2.4, Android bug. + Reported at . */ + if (swprintf (buf, sizeof (buf) / sizeof (wchar_t), + L"%lc %d", L_invalid, 33, 44, 55) < 0) + result |= 1; + return result; +}]])], + [gl_cv_func_swprintf_directive_lc=yes], + [gl_cv_func_swprintf_directive_lc=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_swprintf_directive_lc="guessing yes";; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_swprintf_directive_lc="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_swprintf_directive_lc="guessing no";; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_swprintf_directive_lc="guessing yes";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_swprintf_directive_lc="$gl_cross_guess_normal";; + esac + ]) + ]) +]) + dnl The results of these tests on various platforms are: dnl dnl 1 = gl_PRINTF_SIZES_C99 -dnl 2 = gl_PRINTF_LONG_DOUBLE -dnl 3 = gl_PRINTF_INFINITE -dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE -dnl 5 = gl_PRINTF_DIRECTIVE_A -dnl 6 = gl_PRINTF_DIRECTIVE_F -dnl 7 = gl_PRINTF_DIRECTIVE_N -dnl 8 = gl_PRINTF_DIRECTIVE_LS -dnl 9 = gl_PRINTF_POSITIONS -dnl 10 = gl_PRINTF_FLAG_GROUPING -dnl 11 = gl_PRINTF_FLAG_LEFTADJUST -dnl 12 = gl_PRINTF_FLAG_ZERO -dnl 13 = gl_PRINTF_PRECISION -dnl 14 = gl_PRINTF_ENOMEM -dnl 15 = gl_SNPRINTF_PRESENCE -dnl 16 = gl_SNPRINTF_TRUNCATION_C99 -dnl 17 = gl_SNPRINTF_RETVAL_C99 -dnl 18 = gl_SNPRINTF_DIRECTIVE_N -dnl 19 = gl_SNPRINTF_SIZE1 -dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl 2 = gl_PRINTF_SIZES_C23 +dnl 3 = gl_PRINTF_LONG_DOUBLE +dnl 4 = gl_PRINTF_INFINITE +dnl 5 = gl_PRINTF_INFINITE_LONG_DOUBLE +dnl 6 = gl_PRINTF_DIRECTIVE_A +dnl 7 = gl_PRINTF_DIRECTIVE_B +dnl 8 = gl_PRINTF_DIRECTIVE_UPPERCASE_B +dnl 9 = gl_PRINTF_DIRECTIVE_F +dnl 10 = gl_PRINTF_DIRECTIVE_N +dnl 11 = gl_PRINTF_DIRECTIVE_LS +dnl 12 = gl_PRINTF_DIRECTIVE_LC +dnl 13 = gl_PRINTF_POSITIONS +dnl 14 = gl_PRINTF_FLAG_GROUPING +dnl 15 = gl_PRINTF_FLAG_LEFTADJUST +dnl 16 = gl_PRINTF_FLAG_ZERO +dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO +dnl 18 = gl_PRINTF_PRECISION +dnl 19 = gl_PRINTF_ENOMEM +dnl 20 = gl_SNPRINTF_PRESENCE +dnl 21 = gl_SNPRINTF_TRUNCATION_C99 +dnl 22 = gl_SNPRINTF_RETVAL_C99 +dnl 23 = gl_SNPRINTF_DIRECTIVE_N +dnl 24 = gl_SNPRINTF_SIZE1 +dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl 26 = gl_SWPRINTF_WORKS +dnl 27 = gl_SWPRINTF_DIRECTIVE_LA +dnl 28 = gl_SWPRINTF_DIRECTIVE_LC dnl dnl 1 = checking whether printf supports size specifiers as in C99... -dnl 2 = checking whether printf supports 'long double' arguments... -dnl 3 = checking whether printf supports infinite 'double' arguments... -dnl 4 = checking whether printf supports infinite 'long double' arguments... -dnl 5 = checking whether printf supports the 'a' and 'A' directives... -dnl 6 = checking whether printf supports the 'F' directive... -dnl 7 = checking whether printf supports the 'n' directive... -dnl 8 = checking whether printf supports the 'ls' directive... -dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... -dnl 10 = checking whether printf supports the grouping flag... -dnl 11 = checking whether printf supports the left-adjust flag correctly... -dnl 12 = checking whether printf supports the zero flag correctly... -dnl 13 = checking whether printf supports large precisions... -dnl 14 = checking whether printf survives out-of-memory conditions... -dnl 15 = checking for snprintf... -dnl 16 = checking whether snprintf truncates the result as in C99... -dnl 17 = checking whether snprintf returns a byte count as in C99... -dnl 18 = checking whether snprintf fully supports the 'n' directive... -dnl 19 = checking whether snprintf respects a size of 1... -dnl 20 = checking whether vsnprintf respects a zero size as in C99... +dnl 2 = checking whether printf supports size specifiers as in C23... +dnl 3 = checking whether printf supports 'long double' arguments... +dnl 4 = checking whether printf supports infinite 'double' arguments... +dnl 5 = checking whether printf supports infinite 'long double' arguments... +dnl 6 = checking whether printf supports the 'a' and 'A' directives... +dnl 7 = checking whether printf supports the 'b' directive... +dnl 8 = checking whether printf supports the 'B' directive... +dnl 9 = checking whether printf supports the 'F' directive... +dnl 10 = checking whether printf supports the 'n' directive... +dnl 11 = checking whether printf supports the 'ls' directive... +dnl 12 = checking whether printf supports the 'lc' directive correctly... +dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... +dnl 14 = checking whether printf supports the grouping flag... +dnl 15 = checking whether printf supports the left-adjust flag correctly... +dnl 16 = checking whether printf supports the zero flag correctly... +dnl 17 = checking whether printf supports the alternative flag with a zero precision... +dnl 18 = checking whether printf supports large precisions... +dnl 19 = checking whether printf survives out-of-memory conditions... +dnl 20 = checking for snprintf... +dnl 21 = checking whether snprintf truncates the result as in C99... +dnl 22 = checking whether snprintf returns a byte count as in C99... +dnl 23 = checking whether snprintf fully supports the 'n' directive... +dnl 24 = checking whether snprintf respects a size of 1... +dnl 25 = checking whether vsnprintf respects a zero size as in C99... +dnl 26 = checking whether swprintf works... +dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... +dnl 28 = checking whether swprintf supports the 'lc' directive... dnl dnl . = yes, # = no. dnl -dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . -dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . -dnl FreeBSD 13.0 . . . . # . . . . . . . . # . . . . . . -dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . -dnl Mac OS X 10.13.5 . . . # # . # . . . . . . . . . . # . . -dnl Mac OS X 10.5.8 . . . # # . . . . . . # . . . . . . . . -dnl Mac OS X 10.3.9 . . . . # . . . . . . # . # . . . . . . -dnl OpenBSD 6.0, 6.7 . . . . # . . . . . . . . # . . . . . . -dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . -dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . -dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . -dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . -dnl Solaris 11.4 . . # # # . . # . . . # . . . . . . . . -dnl Solaris 11.3 . . . . # . . # . . . . . . . . . . . . -dnl Solaris 11.0 . . # # # . . # . . . # . . . . . . . . -dnl Solaris 10 . . # # # . . # . . . # # . . . . . . . -dnl Solaris 2.6 ... 9 # . # # # # . # . . . # # . . . # . . . -dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # -dnl AIX 7.1 . . # # # . . . . . . # # . . . . . . . -dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . -dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . # . . . -dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . -dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # -dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # -dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . -dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # -dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # -dnl NetBSD 9.0 . . . . # . . . . . . . . . . . . . . . -dnl NetBSD 5.0 . . . # # . . . . . . # . # . . . . . . -dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? -dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . -dnl Haiku . . . # # # . # . . . . . ? . . ? . . . -dnl BeOS # # . # # # . ? # . ? . # ? . . ? . . . -dnl Android 4.3 . . # # # # # # . # . # . # . . . # . . -dnl old mingw / msvcrt # # # # # # . . # # . # # ? . # # # . . -dnl MSVC 9 # # # # # # # . # # . # # ? # # # # . . -dnl mingw 2009-2011 . # . # . . . . # # . . . ? . . . . . . -dnl mingw-w64 2011 # # # # # # . . # # . # # ? . # # # . . +dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 +dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # +dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . +dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . +dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . +dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # +dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # +dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? +dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? +dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? +dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? +dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # +dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? +dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? +dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? +dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? +dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . +dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . +dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? +dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . +dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? +dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? +dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . +dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? +dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? +dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? +dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? +dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? +dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? +dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? +dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? +dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # +dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? +dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? +dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? +dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . +dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? +dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? +dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? +dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? +dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? +dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4 index ae6a8853..b8b5b117 100644 --- a/gl/m4/pthread_rwlock_rdlock.m4 +++ b/gl/m4/pthread_rwlock_rdlock.m4 @@ -1,5 +1,6 @@ -# pthread_rwlock_rdlock.m4 serial 4 -dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. +# pthread_rwlock_rdlock.m4 +# serial 8 +dnl Copyright (C) 2017-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. @@ -34,11 +35,11 @@ dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [ - AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([gl_THREADLIB]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], [gl_cv_pthread_rwlock_rdlock_prefer_writer], - [save_LIBS="$LIBS" + [saved_LIBS="$LIBS" LIBS="$LIBS $LIBMULTITHREAD" AC_RUN_IFELSE( [AC_LANG_SOURCE([[ @@ -156,25 +157,25 @@ main () [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], [case "$host_os" in - # Guess no on glibc systems. - *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess no on musl systems. - *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess no on bionic systems. - *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; - # Guess yes on native Windows with the mingw-w64 winpthreads library. - # Guess no on native Windows with the gnulib windows-rwlock module. - mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" - else - gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" - fi - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw* | windows*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; esac ]) - LIBS="$save_LIBS" + LIBS="$saved_LIBS" ]) case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in *yes) diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index d22138fc..eb90d588 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 @@ -1,5 +1,6 @@ -# realloc.m4 serial 26 -dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. +# realloc.m4 +# serial 29 +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, dnl with or without modifications, as long as this notice is preserved. @@ -16,7 +17,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], [[#include ]], [[void *p = realloc (0, 0); - int result = !p; + void * volatile vp = p; + int result = !vp; free (p); return result;]]) ], @@ -25,8 +27,8 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF], [case "$host_os" in # Guess yes on platforms where we know the result. *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | gnu* | *-musl* | midnightbsd* \ - | hpux* | solaris* | cygwin* | mingw* | msys* ) + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | 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" ;; diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4 index 1607b7a9..958095e1 100644 --- a/gl/m4/reallocarray.m4 +++ b/gl/m4/reallocarray.m4 @@ -1,5 +1,6 @@ -# reallocarray.m4 serial 3 -dnl Copyright (C) 2017-2023 Free Software Foundation, Inc. +# reallocarray.m4 +# serial 5 +dnl Copyright (C) 2017-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. @@ -11,9 +12,12 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) - AC_CHECK_FUNCS([reallocarray]) + gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include ]]) if test "$ac_cv_func_reallocarray" = no; then HAVE_REALLOCARRAY=0 + case "$gl_cv_onwards_func_reallocarray" in + future*) REPLACE_REALLOCARRAY=1 ;; + esac elif test "$gl_cv_malloc_ptrdiff" = no; then REPLACE_REALLOCARRAY=1 fi diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index c89a1432..f0101fe6 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 @@ -1,10 +1,9 @@ -# serial 73 - -# Copyright (C) 1996-2001, 2003-2023 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# regex.m4 +# serial 75 +dnl Copyright (C) 1996-2001, 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 Initially derived from code in GNU grep. dnl Mostly written by Jim Meyering. @@ -15,7 +14,7 @@ AC_DEFUN([gl_REGEX], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_ARG_WITH([included-regex], - [AS_HELP_STRING([--without-included-regex], + [AS_HELP_STRING([[--without-included-regex]], [don't compile regex; this is the default on systems with recent-enough versions of the GNU C Library (use with caution on other systems).])]) @@ -327,10 +326,10 @@ AC_DEFUN([gl_REGEX], [gl_cv_func_re_compile_pattern_working=yes], [gl_cv_func_re_compile_pattern_working=no], [case "$host_os" in - # Guess no on native Windows. - mingw*) gl_cv_func_re_compile_pattern_working="guessing no" ;; - # Otherwise obey --enable-cross-guesses. - *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_re_compile_pattern_working="guessing no" ;; + # Otherwise obey --enable-cross-guesses. + *) gl_cv_func_re_compile_pattern_working="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 0f35b8b8..422003b4 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 @@ -1,5 +1,6 @@ -# servent.m4 serial 4 -dnl Copyright (C) 2008, 2010-2023 Free Software Foundation, Inc. +# servent.m4 +# serial 5 +dnl Copyright (C) 2008, 2010-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. @@ -28,7 +29,7 @@ AC_DEFUN([gl_SERVENT], AC_CACHE_CHECK([for getservbyname in winsock2.h and -lws2_32], [gl_cv_w32_getservbyname], [gl_cv_w32_getservbyname=no - gl_save_LIBS="$LIBS" + gl_saved_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -40,7 +41,7 @@ AC_DEFUN([gl_SERVENT], ]], [[getservbyname(NULL,NULL);]])], [gl_cv_w32_getservbyname=yes]) - LIBS="$gl_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test "$gl_cv_w32_getservbyname" = "yes"; then SERVENT_LIB="-lws2_32" diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index 16f9eb55..e7f00f39 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 @@ -1,5 +1,6 @@ -# setenv.m4 serial 30 -dnl Copyright (C) 2001-2004, 2006-2023 Free Software Foundation, Inc. +# setenv.m4 +# serial 33 +dnl Copyright (C) 2001-2004, 2006-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. @@ -35,12 +36,12 @@ AC_DEFUN([gl_FUNC_SETENV], ]])], [gl_cv_func_setenv_works=yes], [gl_cv_func_setenv_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_setenv_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_setenv_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_setenv_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_setenv_works="$gl_cross_guess_normal" ;; esac ])]) case "$gl_cv_func_setenv_works" in @@ -151,11 +152,10 @@ int unsetenv (const char *name); # Prerequisites of lib/setenv.c. AC_DEFUN([gl_PREREQ_SETENV], [ - AC_REQUIRE([AC_FUNC_ALLOCA]) AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS([search.h]) - AC_CHECK_FUNCS([tsearch]) + gl_CHECK_FUNCS_ANDROID([tsearch], [[#include ]]) ]) # Prerequisites of lib/unsetenv.c. diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 index 032119d0..e5b7d28b 100644 --- a/gl/m4/setlocale_null.m4 +++ b/gl/m4/setlocale_null.m4 @@ -1,5 +1,6 @@ -# setlocale_null.m4 serial 5 -dnl Copyright (C) 2019-2023 Free Software Foundation, Inc. +# setlocale_null.m4 +# serial 9 +dnl Copyright (C) 2019-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. @@ -13,11 +14,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe], [gl_cv_func_setlocale_null_all_mtsafe], [case "$host_os" in - # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. - *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku. + *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | openbsd* | aix* | haiku*) gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess no on Cygwin < 3.4.6. + cygwin*) + AC_EGREP_CPP([Lucky user], + [ +#if defined __CYGWIN__ + #include + #if CYGWIN_VERSION_DLL_COMBINED >= CYGWIN_VERSION_DLL_MAKE_COMBINED (3004, 6) + Lucky user + #endif +#endif + ], + [gl_cv_func_setlocale_null_all_mtsafe=yes], + [gl_cv_func_setlocale_null_all_mtsafe=no]) + ;; # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. - *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*) gl_cv_func_setlocale_null_all_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) @@ -26,7 +41,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], ]) dnl On platforms without multithreading, there is no issue. case "$host_os" in - mingw*) ;; + mingw* | windows*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_all_mtsafe="trivially yes" @@ -48,7 +63,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], openbsd* | aix*) gl_cv_func_setlocale_null_one_mtsafe=no ;; # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. - *-gnu* | gnu* | *-musl* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*) gl_cv_func_setlocale_null_one_mtsafe=yes ;; # If we don't know, obey --enable-cross-guesses. *) @@ -57,7 +72,7 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], ]) dnl On platforms without multithreading, there is no issue. case "$host_os" in - mingw*) ;; + mingw* | windows*) ;; *) if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then gl_cv_func_setlocale_null_one_mtsafe="trivially yes" @@ -74,20 +89,25 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL], dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c. if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then case "$host_os" in - mingw*) LIB_SETLOCALE_NULL= ;; + mingw* | windows*) + SETLOCALE_NULL_LIB= + ;; *) gl_WEAK_SYMBOLS case "$gl_cv_have_weak" in - *yes) LIB_SETLOCALE_NULL= ;; - *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + *yes) SETLOCALE_NULL_LIB= ;; + *) SETLOCALE_NULL_LIB="$LIBPTHREAD" ;; esac ;; esac else - LIB_SETLOCALE_NULL= + SETLOCALE_NULL_LIB= fi - dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX + dnl SETLOCALE_NULL_LIB is expected to be '-pthread' or '-lpthread' on AIX dnl with gcc or xlc, and empty otherwise. + AC_SUBST([SETLOCALE_NULL_LIB]) + dnl For backward compatibility. + LIB_SETLOCALE_NULL="$SETLOCALE_NULL_LIB" AC_SUBST([LIB_SETLOCALE_NULL]) ]) diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4 index 4d1d1dda..ad5596a4 100644 --- a/gl/m4/sha256.m4 +++ b/gl/m4/sha256.m4 @@ -1,5 +1,6 @@ -# sha256.m4 serial 8 -dnl Copyright (C) 2005, 2008-2023 Free Software Foundation, Inc. +# sha256.m4 +# serial 8 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index 0763366d..df91cf06 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 @@ -1,5 +1,6 @@ -# size_max.m4 serial 12 -dnl Copyright (C) 2003, 2005-2006, 2008-2023 Free Software Foundation, Inc. +# size_max.m4 +# serial 12 +dnl Copyright (C) 2003, 2005-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 4b5fbdbf..6dbe146f 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 @@ -1,5 +1,6 @@ -# snprintf.m4 serial 7 -dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. +# snprintf.m4 +# serial 7 +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index a556af1e..09f01161 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 @@ -1,5 +1,6 @@ -# socketlib.m4 serial 3 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# socketlib.m4 +# serial 4 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -18,7 +19,7 @@ AC_DEFUN([gl_SOCKETLIB], dnl defined through -lws2_32), we need to call it. AC_CACHE_CHECK([for WSAStartup], [gl_cv_func_wsastartup], [ - gl_save_LIBS="$LIBS" + gl_saved_LIBS="$LIBS" LIBS="$LIBS -lws2_32" AC_LINK_IFELSE( [AC_LANG_PROGRAM([[ @@ -33,7 +34,7 @@ AC_DEFUN([gl_SOCKETLIB], ], [gl_cv_func_wsastartup=yes], [gl_cv_func_wsastartup=no]) - LIBS="$gl_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test "$gl_cv_func_wsastartup" = "yes"; then AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.]) @@ -56,8 +57,8 @@ AC_DEFUN([gl_SOCKETLIB], #endif char setsockopt();]], [[setsockopt();]])], [], - [gl_save_LIBS="$LIBS" - LIBS="$gl_save_LIBS -lsocket" + [gl_saved_LIBS="$LIBS" + LIBS="$gl_saved_LIBS -lsocket" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" @@ -65,7 +66,7 @@ char setsockopt();]], [[setsockopt();]])], char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lsocket"]) if test -z "$gl_cv_lib_socket"; then - LIBS="$gl_save_LIBS -lnetwork" + LIBS="$gl_saved_LIBS -lnetwork" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" @@ -73,7 +74,7 @@ char setsockopt();]], [[setsockopt();]])], char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lnetwork"]) if test -z "$gl_cv_lib_socket"; then - LIBS="$gl_save_LIBS -lnet" + LIBS="$gl_saved_LIBS -lnet" AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern #ifdef __cplusplus "C" @@ -82,7 +83,7 @@ char setsockopt();]], [[setsockopt();]])], [gl_cv_lib_socket="-lnet"]) fi fi - LIBS="$gl_save_LIBS" + LIBS="$gl_saved_LIBS" ]) if test -z "$gl_cv_lib_socket"; then gl_cv_lib_socket="none needed" diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index ed9cb873..a3dfe92f 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 @@ -1,5 +1,6 @@ -# sockets.m4 serial 7 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# sockets.m4 +# serial 7 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 1c63a853..9ece0abb 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,5 +1,6 @@ -# socklen.m4 serial 11 -dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. +# socklen.m4 +# serial 11 +dnl Copyright (C) 2005-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index 6c6dc2f7..c68b3abb 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 @@ -1,5 +1,6 @@ -# sockpfaf.m4 serial 10 -dnl Copyright (C) 2004, 2006, 2009-2023 Free Software Foundation, Inc. +# sockpfaf.m4 +# serial 10 +dnl Copyright (C) 2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index 1c12c33e..c15f948a 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 @@ -1,23 +1,38 @@ -# ssize_t.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2001-2003, 2006, 2010-2023 Free Software Foundation, Inc. +# ssize_t.m4 +# serial 6 +dnl Copyright (C) 2001-2003, 2006, 2010-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 Test whether ssize_t is defined. +dnl Define ssize_t if it does not already exist. AC_DEFUN([gt_TYPE_SSIZE_T], [ - AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], + AC_CACHE_CHECK([for ssize_t], [gl_cv_ssize_t], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[int x = sizeof (ssize_t *) + sizeof (ssize_t); return !x;]])], - [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) - if test $gt_cv_ssize_t = no; then - AC_DEFINE([ssize_t], [int], - [Define as a signed type of the same size as size_t.]) + [gl_cv_ssize_t=yes], [gl_cv_ssize_t=no])]) + if test $gl_cv_ssize_t = no; then + dnl On 64-bit native Windows, ssize_t needs to be defined as 'long long', + dnl for consistency with the 64-bit size_t. + AC_CACHE_CHECK([whether size_t is wider than 'long'], [gl_cv_size_t_large], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + typedef int array [2 * (sizeof (size_t) > sizeof (long)) - 1]; + ]])], + [gl_cv_size_t_large=yes], [gl_cv_size_t_large=no])]) + if test $gl_cv_size_t_large = yes; then + gl_def_ssize_t='long long' + else + gl_def_ssize_t='long' + fi + AC_DEFINE_UNQUOTED([ssize_t], [$gl_def_ssize_t], + [Define as a signed type of the same size as size_t.]) fi ]) diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 index 40993d57..e8ee7d51 100644 --- a/gl/m4/stat-time.m4 +++ b/gl/m4/stat-time.m4 @@ -1,11 +1,11 @@ -# Checks for stat-related time functions. - -# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2023 Free Software -# Foundation, Inc. +# stat-time.m4 +# serial 1 +dnl Copyright (C) 1998-1999, 2001, 2003, 2005-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, +dnl with or without modifications, as long as this notice is preserved. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Checks for stat-related time functions. dnl From Paul Eggert. diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 index 4d241e27..fabd360c 100644 --- a/gl/m4/stat.m4 +++ b/gl/m4/stat.m4 @@ -1,10 +1,9 @@ -# serial 18 - -# Copyright (C) 2009-2023 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# stat.m4 +# serial 21 +dnl Copyright (C) 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, +dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_STAT], [ @@ -12,7 +11,7 @@ AC_DEFUN([gl_FUNC_STAT], AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([lstat]) case "$host_os" in - mingw*) + mingw* | windows*) dnl On this platform, the original stat() returns st_atime, st_mtime, dnl st_ctime values that are affected by the time zone. REPLACE_STAT=1 @@ -45,6 +44,8 @@ AC_DEFUN([gl_FUNC_STAT], [case "$host_os" in # Guess yes on Linux systems. linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on systems that emulate the Linux system calls. + midipix*) gl_cv_func_stat_file_slash="guessing yes" ;; # Guess yes on glibc systems. *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; # If we don't know, obey --enable-cross-guesses. @@ -59,8 +60,8 @@ AC_DEFUN([gl_FUNC_STAT], help when passed a file name with a trailing slash]);; esac case $host_os in - dnl Solaris stat can return a negative tv_nsec. - solaris*) + dnl macOS and Solaris stat can return a negative tv_nsec. + darwin* | solaris*) REPLACE_FSTAT=1 ;; esac ;; @@ -78,7 +79,7 @@ AC_DEFUN([gl_PREREQ_STAT], [ AC_DEFUN([gl_PREREQ_STAT_W32], [ AC_REQUIRE([AC_CANONICAL_HOST]) case "$host_os" in - mingw*) + mingw* | windows*) AC_CHECK_HEADERS([sdkddkver.h]) ;; esac diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4 index 4179470e..37324c15 100644 --- a/gl/m4/std-gnu11.m4 +++ b/gl/m4/std-gnu11.m4 @@ -1,3 +1,6 @@ +# std-gnu11.m4 +# serial 1 + # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 @@ -9,7 +12,7 @@ m4_version_prereq([2.70], [], [ -# Copyright (C) 2001-2023 Free Software Foundation, Inc. +# Copyright (C) 2001-2024 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4 index dc297175..2b4762f3 100644 --- a/gl/m4/stdalign.m4 +++ b/gl/m4/stdalign.m4 @@ -1,20 +1,24 @@ -# Check for alignas and alignof that conform to C23. - -dnl Copyright 2011-2023 Free Software Foundation, Inc. +# stdalign.m4 +# serial 1 +dnl Copyright 2011-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. +# Check for alignas and alignof that conform to C23. + +dnl Written by Paul Eggert and Bruno Haible. + # Prepare for substituting if it is not supported. -AC_DEFUN([gl_STDALIGN_H], +AC_DEFUN([gl_ALIGNASOF], [ AC_CACHE_CHECK([for alignas and alignof], [gl_cv_header_working_stdalign_h], - [gl_save_CFLAGS=$CFLAGS + [gl_saved_CFLAGS=$CFLAGS for gl_working in "yes, keywords" "yes, macros"; do AS_CASE([$gl_working], - [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"]) + [*stdalign.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_STDALIGN_H"]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include @@ -54,85 +58,151 @@ AC_DEFUN([gl_STDALIGN_H], [gl_cv_header_working_stdalign_h=$gl_working], [gl_cv_header_working_stdalign_h=no]) - CFLAGS=$gl_save_CFLAGS + CFLAGS=$gl_saved_CFLAGS test "$gl_cv_header_working_stdalign_h" != no && break done]) - GL_GENERATE_STDALIGN_H=false AS_CASE([$gl_cv_header_working_stdalign_h], - [no], - [GL_GENERATE_STDALIGN_H=true], [yes*keyword*], [AC_DEFINE([HAVE_C_ALIGNASOF], [1], [Define to 1 if the alignas and alignof keywords work.])]) - AC_CHECK_HEADERS_ONCE([stdalign.h]) - dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. AH_VERBATIM([zzalignas], -[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof -# if HAVE_STDALIGN_H +[#if !defined HAVE_C_ALIGNASOF \ + && !(defined __cplusplus && 201103 <= __cplusplus) \ + && !defined alignof +# if defined HAVE_STDALIGN_H # include -# else - /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */ -# ifndef _GL_STDALIGN_H -# define _GL_STDALIGN_H -# undef _Alignas -# undef _Alignof -# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ - || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ - && !defined __clang__) \ - || (defined __clang__ && __clang_major__ < 8)) -# ifdef __cplusplus -# if (201103 <= __cplusplus || defined _MSC_VER) -# define _Alignof(type) alignof (type) -# else - template struct __alignof_helper { char __a; __t __b; }; -# define _Alignof(type) offsetof (__alignof_helper, __b) -# define _GL_STDALIGN_NEEDS_STDDEF 1 -# endif +# endif + +/* ISO C23 alignas and alignof for platforms that lack it. + + References: + ISO C23 (latest free draft + ) + sections 6.5.3.4, 6.7.5, 7.15. + C++11 (latest free draft + ) + section 18.10. */ + +/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment + requirement of a structure member (i.e., slot or field) that is of + type TYPE, as an integer constant expression. + + This differs from GCC's and clang's __alignof__ operator, which can + yield a better-performing alignment for an object of that type. For + example, on x86 with GCC and on Linux/x86 with clang, + __alignof__ (double) and __alignof__ (long long) are 8, whereas + alignof (double) and alignof (long long) are 4 unless the option + '-malign-double' is used. + + The result cannot be used as a value for an 'enum' constant, if you + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ + +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 + . + clang versions < 8.0.0 have the same bug. */ +# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ + || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ + && !defined __clang__) \ + || (defined __clang__ && __clang_major__ < 8)) +# undef/**/_Alignof +# ifdef __cplusplus +# if (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignof(type) alignof (type) # else + template struct __alignof_helper { char __a; __t __b; }; # if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ -# define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) +# define _Alignof(type) __builtin_offsetof (__alignof_helper, __b) # else -# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) -# define _GL_STDALIGN_NEEDS_STDDEF 1 +# define _Alignof(type) offsetof (__alignof_helper, __b) # endif +# define _GL_STDALIGN_NEEDS_STDDEF 1 # endif -# endif -# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) -# define alignof _Alignof -# endif -# define __alignof_is_defined 1 -# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 -# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) -# define _Alignas(a) alignas (a) -# elif (!defined __attribute__ \ - && ((defined __APPLE__ && defined __MACH__ \ - ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ - : __GNUC__ && !defined __ibmxl__) \ - || (4 <= __clang_major__) \ - || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ - || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) -# define _Alignas(a) __attribute__ ((__aligned__ (a))) -# elif 1300 <= _MSC_VER -# define _Alignas(a) __declspec (align (a)) +# else +# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__ +# define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b) +# else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 # endif # endif -# if ((defined _Alignas \ - && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) -# define alignas _Alignas -# endif -# if (defined alignas \ - || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) -# define __alignas_is_defined 1 -# endif -# if _GL_STDALIGN_NEEDS_STDDEF -# include -# endif -# endif /* _GL_STDALIGN_H */ +# endif +# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) +# undef/**/alignof +# define alignof _Alignof +# endif + +/* alignas (A), also known as _Alignas (A), aligns a variable or type + to the alignment A, where A is an integer constant expression. For + example: + + int alignas (8) foo; + struct s { int a; int alignas (8) bar; }; + + aligns the address of FOO and the offset of BAR to be multiples of 8. + + A should be a power of two that is at least the type's alignment + and at most the implementation's alignment limit. This limit is + 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable + to MSVC through at least version 10.0, A should be an integer + constant, as MSVC does not support expressions such as 1 << 3. + To be portable to Sun C 5.11, do not align auto variables to + anything stricter than their default alignment. + + The following C23 requirements are not supported here: + + - If A is zero, alignas has no effect. + - alignas can be used multiple times; the strictest one wins. + - alignas (TYPE) is equivalent to alignas (alignof (TYPE)). + + */ +# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 +# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignas(a) alignas (a) +# elif (!defined __attribute__ \ + && ((defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__ && !defined __ibmxl__) \ + || (4 <= __clang_major__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +# elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +# endif +# endif +# if !defined HAVE_STDALIGN_H +# if ((defined _Alignas \ + && !(defined __cplusplus \ + && (201103 <= __cplusplus || defined _MSC_VER))) \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# define alignas _Alignas +# endif +# endif + +# if defined _GL_STDALIGN_NEEDS_STDDEF +# include # endif #endif]) ]) + +AC_DEFUN([gl_STDALIGN_H], +[ + AC_REQUIRE([gl_ALIGNASOF]) + if test "$gl_cv_header_working_stdalign_h" = no; then + GL_GENERATE_STDALIGN_H=true + else + GL_GENERATE_STDALIGN_H=false + fi + + gl_CHECK_NEXT_HEADERS([stdalign.h]) + if test $ac_cv_header_stdalign_h = yes; then + HAVE_STDALIGN_H=1 + else + HAVE_STDALIGN_H=0 + fi + AC_SUBST([HAVE_STDALIGN_H]) +]) diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index a2322ebb..84d3bae8 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 @@ -1,5 +1,6 @@ -# stddef_h.m4 serial 13 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# stddef_h.m4 +# serial 14 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -68,6 +69,21 @@ AC_DEFUN_ONCE([gl_STDDEF_H], GL_GENERATE_STDDEF_H=true fi + AC_CACHE_CHECK([for unreachable], + [gl_cv_func_unreachable], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[unreachable (); + ]])], + [gl_cv_func_unreachable=yes], + [gl_cv_func_unreachable=no]) + ]) + if test $gl_cv_func_unreachable = no; then + GL_GENERATE_STDDEF_H=true + fi + if $GL_GENERATE_STDDEF_H; then gl_NEXT_HEADERS([stddef.h]) fi diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index d6961b09..2dea8469 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,5 +1,6 @@ -# stdint.m4 serial 61 -dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. +# stdint.m4 +# serial 63 +dnl Copyright (C) 2001-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. @@ -150,7 +151,10 @@ intmax_t i = INTMAX_MAX; uintmax_t j = UINTMAX_MAX; /* Check that SIZE_MAX has the correct type, if possible. */ -#if 201112 <= __STDC_VERSION__ +/* ISO C 11 mandates _Generic, but GCC versions < 4.9 lack it. */ +#if 201112 <= __STDC_VERSION__ \ + && (!defined __GNUC__ || 4 < __GNUC__ + (9 <= __GNUC_MINOR__) \ + || defined __clang__) int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ || (0x5110 <= __SUNPRO_C && !__STDC__)) @@ -283,10 +287,10 @@ static const char *macro_values[] = [gl_cv_header_working_stdint_h=yes], [], [case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; - # In general, assume it works. - *) gl_cv_header_working_stdint_h="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; esac ]) ]) diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 70349f6c..29f42160 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 @@ -1,5 +1,6 @@ -# stdint_h.m4 serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2023 Free Software Foundation, Inc. +# stdint_h.m4 +# serial 9 +dnl Copyright (C) 1997-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 94271e11..8eb5816a 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,12 +1,23 @@ -# stdio_h.m4 serial 59 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# stdio_h.m4 +# serial 63 +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, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN_ONCE([gl_STDIO_H], +AC_DEFUN([gl_STDIO_H_EARLY], [ - AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + dnl Defining __USE_MINGW_ANSI_STDIO to 1 must be done early, because + dnl the results of several configure tests depend on it: The tests + dnl - checking whether snprintf returns a byte count as in C99... + dnl - checking whether snprintf truncates the result as in C99... + dnl - checking whether printf supports the 'F' directive... + dnl - checking whether printf supports the grouping flag... + dnl - checking whether printf supports the zero flag correctly... + dnl - checking whether printf supports infinite 'double' arguments... + dnl - checking whether printf supports large precisions... + dnl report 'yes' if __USE_MINGW_ANSI_STDIO is 1 but 'no' if + dnl __USE_MINGW_ANSI_STDIO is not set. AH_VERBATIM([MINGW_ANSI_STDIO], [/* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO @@ -14,6 +25,11 @@ AC_DEFUN_ONCE([gl_STDIO_H], #endif ]) AC_DEFINE([__USE_MINGW_ANSI_STDIO]) +]) + +AC_DEFUN_ONCE([gl_STDIO_H], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) gl_NEXT_HEADERS([stdio.h]) dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and @@ -40,6 +56,9 @@ AC_DEFUN_ONCE([gl_STDIO_H], attribute "__gnu_printf__" instead of "__printf__"]) fi + dnl For defining _PRINTF_NAN_LEN_MAX. + gl_MUSL_LIBC + dnl This ifdef is an optimization, to avoid performing a configure check whose dnl result is not used. But it does not make the test of dnl GNULIB_STDIO_H_NONBLOCKING or GNULIB_NONBLOCKING redundant. @@ -82,6 +101,16 @@ AC_DEFUN_ONCE([gl_STDIO_H], if test $ac_cv_have_decl_fcloseall = no; then HAVE_DECL_FCLOSEALL=0 fi + + AC_CHECK_DECLS_ONCE([getw]) + if test $ac_cv_have_decl_getw = no; then + HAVE_DECL_GETW=0 + fi + + AC_CHECK_DECLS_ONCE([putw]) + if test $ac_cv_have_decl_putw = no; then + HAVE_DECL_PUTW=0 + fi ]) # gl_STDIO_MODULE_INDICATOR([modulename]) @@ -178,7 +207,9 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + HAVE_DECL_GETW=1; AC_SUBST([HAVE_DECL_GETW]) HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) + HAVE_DECL_PUTW=1; AC_SUBST([HAVE_DECL_PUTW]) HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index e96be22f..a4662f29 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 @@ -1,5 +1,6 @@ -# stdlib_h.m4 serial 66 -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# stdlib_h.m4 +# serial 77 +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, dnl with or without modifications, as long as this notice is preserved. @@ -23,15 +24,58 @@ AC_DEFUN_ONCE([gl_STDLIB_H], # include #endif ]], [_Exit aligned_alloc atoll canonicalize_file_name free - getloadavg getsubopt grantpt - initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps - posix_memalign posix_openpt ptsname ptsname_r qsort_r + getloadavg getprogname getsubopt grantpt + initstate initstate_r mbstowcs mbtowc mkdtemp mkostemp mkostemps mkstemp + mkstemps posix_memalign posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray realpath rpmatch secure_getenv setenv setstate setstate_r srandom srandom_r strtod strtol strtold strtoll strtoul strtoull unlockpt unsetenv]) AC_REQUIRE([AC_C_RESTRICT]) + dnl Test whether MB_CUR_MAX needs to be overridden. + 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_CACHE_CHECK([whether MB_CUR_MAX is correct], + [gl_cv_macro_MB_CUR_MAX_good], + [ + dnl Initial guess, used when cross-compiling or when no suitable locale + 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" ;; + esac +changequote([,])dnl + if test $LOCALE_FR_UTF8 != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + if (MB_CUR_MAX < 4) + result |= 1; + } + return result; +}]])], + [gl_cv_macro_MB_CUR_MAX_good=yes], + [gl_cv_macro_MB_CUR_MAX_good=no], + [:]) + fi + ]) + case "$gl_cv_macro_MB_CUR_MAX_good" in + *yes) ;; + *) REPLACE_MB_CUR_MAX=1 ;; + esac + AC_CHECK_DECLS_ONCE([ecvt]) if test $ac_cv_have_decl_ecvt = no; then HAVE_DECL_ECVT=0 @@ -73,10 +117,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], 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_GETPROGNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOWCS]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBTOWC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDTEMP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKOSTEMP]) @@ -89,6 +135,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], 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_RAND]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) @@ -99,6 +146,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], 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_STRTOF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOLL]) @@ -130,6 +178,8 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT]) HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT]) HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG]) + HAVE_DECL_PROGRAM_INVOCATION_NAME=1; AC_SUBST([HAVE_DECL_PROGRAM_INVOCATION_NAME]) + HAVE_GETPROGNAME=1; AC_SUBST([HAVE_GETPROGNAME]) HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT]) HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT]) HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE]) @@ -157,6 +207,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SETSTATE=1; AC_SUBST([HAVE_SETSTATE]) HAVE_DECL_SETSTATE=1; AC_SUBST([HAVE_DECL_SETSTATE]) HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD]) + HAVE_STRTOF=1; AC_SUBST([HAVE_STRTOF]) HAVE_STRTOL=1; AC_SUBST([HAVE_STRTOL]) HAVE_STRTOLD=1; AC_SUBST([HAVE_STRTOLD]) HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL]) @@ -166,21 +217,31 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) + REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME]) REPLACE_FREE=0; AC_SUBST([REPLACE_FREE]) + REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG]) + REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME]) + REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT]) REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE]) REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU]) REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX]) + REPLACE_MB_CUR_MAX=0; AC_SUBST([REPLACE_MB_CUR_MAX]) + REPLACE_MBSTOWCS=0; AC_SUBST([REPLACE_MBSTOWCS]) REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC]) + REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP]) + REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS]) REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP]) REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN]) + REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT]) REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME]) REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R]) REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV]) REPLACE_QSORT_R=0; AC_SUBST([REPLACE_QSORT_R]) + REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU]) @@ -190,6 +251,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_SETENV=0; AC_SUBST([REPLACE_SETENV]) REPLACE_SETSTATE=0; AC_SUBST([REPLACE_SETSTATE]) REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD]) + REPLACE_STRTOF=0; AC_SUBST([REPLACE_STRTOF]) REPLACE_STRTOL=0; AC_SUBST([REPLACE_STRTOL]) REPLACE_STRTOLD=0; AC_SUBST([REPLACE_STRTOLD]) REPLACE_STRTOLL=0; AC_SUBST([REPLACE_STRTOLL]) diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 index 3cf740d2..63021733 100644 --- a/gl/m4/strcase.m4 +++ b/gl/m4/strcase.m4 @@ -1,5 +1,6 @@ -# strcase.m4 serial 12 -dnl Copyright (C) 2002, 2005-2023 Free Software Foundation, Inc. +# strcase.m4 +# serial 12 +dnl Copyright (C) 2002, 2005-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. diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 index 971e0b23..d2548716 100644 --- a/gl/m4/strcasestr.m4 +++ b/gl/m4/strcasestr.m4 @@ -1,5 +1,6 @@ -# strcasestr.m4 serial 28 -dnl Copyright (C) 2005, 2007-2023 Free Software Foundation, Inc. +# strcasestr.m4 +# serial 28 +dnl Copyright (C) 2005, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 8879eb08..0272c6f4 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 @@ -1,5 +1,6 @@ -# strerror.m4 serial 23 -dnl Copyright (C) 2002, 2007-2023 Free Software Foundation, Inc. +# strerror.m4 +# serial 25 +dnl Copyright (C) 2002, 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, dnl with or without modifications, as long as this notice is preserved. @@ -24,12 +25,12 @@ AC_DEFUN([gl_FUNC_STRERROR], [gl_cv_func_working_strerror=yes], [gl_cv_func_working_strerror=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_working_strerror="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; esac ]) ]) @@ -80,14 +81,14 @@ AC_DEFUN([gl_FUNC_STRERROR_0], [gl_cv_func_strerror_0_works=yes], [gl_cv_func_strerror_0_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index 5da3cc25..f31264ae 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 @@ -1,11 +1,11 @@ -# Configure a GNU-like replacement for . - -# Copyright (C) 2007-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# string_h.m4 +# serial 39 +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, +dnl with or without modifications, as long as this notice is preserved. -# serial 35 +# Configure a GNU-like replacement for . # Written by Paul Eggert. @@ -131,6 +131,9 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_MEMPCPY=0; AC_SUBST([REPLACE_MEMPCPY]) + REPLACE_MEMSET_EXPLICIT=0; AC_SUBST([REPLACE_MEMSET_EXPLICIT]) + REPLACE_STPCPY=0; AC_SUBST([REPLACE_STPCPY]) REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) @@ -144,5 +147,6 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) ]) diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index 4c41221b..aaafb559 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 @@ -1,10 +1,11 @@ -# Configure a replacement for . +# strings_h.m4 # serial 9 +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, +dnl with or without modifications, as long as this notice is preserved. -# Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Configure a replacement for . AC_DEFUN_ONCE([gl_STRINGS_H], [ diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4 index e0da09a3..cfde87a5 100644 --- a/gl/m4/strsep.m4 +++ b/gl/m4/strsep.m4 @@ -1,5 +1,6 @@ -# strsep.m4 serial 11 -dnl Copyright (C) 2002-2004, 2007, 2009-2023 Free Software Foundation, Inc. +# strsep.m4 +# serial 11 +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 index 7de203a7..957ed2e3 100644 --- a/gl/m4/strstr.m4 +++ b/gl/m4/strstr.m4 @@ -1,5 +1,6 @@ -# strstr.m4 serial 24 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# strstr.m4 +# serial 24 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 98a10416..3bf3cb47 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,5 +1,6 @@ -# sys_socket_h.m4 serial 29 -dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. +# sys_socket_h.m4 +# serial 29 +dnl Copyright (C) 2005-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. diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index ca57398a..3cc50ce6 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 @@ -1,5 +1,6 @@ -# sys_stat_h.m4 serial 42 -*- Autoconf -*- -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# sys_stat_h.m4 +# serial 42 -*- Autoconf -*- +dnl Copyright (C) 2006-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. diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 index 627671fb..00d2437b 100644 --- a/gl/m4/sys_types_h.m4 +++ b/gl/m4/sys_types_h.m4 @@ -1,5 +1,6 @@ -# sys_types_h.m4 serial 13 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# sys_types_h.m4 +# serial 13 +dnl Copyright (C) 2011-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. diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4 index 93a65d26..a471c720 100644 --- a/gl/m4/sys_uio_h.m4 +++ b/gl/m4/sys_uio_h.m4 @@ -1,5 +1,6 @@ -# sys_uio_h.m4 serial 3 -dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. +# sys_uio_h.m4 +# serial 3 +dnl Copyright (C) 2011-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. diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index b536b047..f5e81479 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 @@ -1,5 +1,6 @@ -# threadlib.m4 serial 32a -dnl Copyright (C) 2005-2023 Free Software Foundation, Inc. +# threadlib.m4 +# serial 42 +dnl Copyright (C) 2005-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. @@ -85,10 +86,11 @@ AC_DEFUN([gl_WEAK_SYMBOLS], AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], [case "$host_os" in - cygwin*) - dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but - dnl programs that use pthread_in_use() with weak symbol references - dnl crash miserably at runtime. + cygwin* | mingw* | windows*) + dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with + dnl gcc 11.3, the test below would succeed, but programs that use + dnl pthread_in_use() with weak symbol references crash miserably at + dnl runtime. gl_cv_have_weak="guessing no" ;; *) @@ -174,7 +176,7 @@ dnl Sets the variable LIBPMULTITHREAD, for programs that really need dnl multithread functionality. The difference between LIBPTHREAD and dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. -dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the +dnl Sets the variable SCHED_YIELD_LIB to the linker options needed to use the dnl sched_yield() function. dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for dnl multithread-safe programs. @@ -205,7 +207,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS + saved_LIBS="$LIBS" for gl_pthread in '' '-pthread'; do LIBS="$LIBS $gl_pthread" AC_LINK_IFELSE( @@ -219,7 +221,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], [gl_pthread_api=yes LIBPTHREAD=$gl_pthread LIBPMULTITHREAD=$gl_pthread]) - LIBS=$save_LIBS + LIBS="$saved_LIBS" test $gl_pthread_api = yes && break done echo "$as_me:__oline__: gl_pthread_api=$gl_pthread_api" >&AS_MESSAGE_LOG_FD @@ -268,6 +270,15 @@ changequote([,])dnl [Define if the pthread_in_use() detection is hard.]) esac fi + ], + [dnl This is needed on FreeBSD 5.2.1. + AC_CHECK_LIB([thr], [pthread_kill], + [if test $gl_pthread_in_glibc = yes; then + LIBPMULTITHREAD= + else + LIBPMULTITHREAD=-lthr + fi + ]) ]) elif test $gl_pthread_api != yes; then # Some library is needed. Try libpthread and libc_r. @@ -299,13 +310,16 @@ changequote([,])dnl [AC_LANG_PROGRAM( [[#include ]], [[sched_yield ();]])], - [LIB_SCHED_YIELD= + [SCHED_YIELD_LIB= ], [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. - AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], + AC_CHECK_LIB([rt], [sched_yield], [SCHED_YIELD_LIB=-lrt], [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. - AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) + AC_CHECK_LIB([posix4], [sched_yield], [SCHED_YIELD_LIB=-lposix4])]) ]) + AC_SUBST([SCHED_YIELD_LIB]) + dnl For backward compatibility. + LIB_SCHED_YIELD="$SCHED_YIELD_LIB" AC_SUBST([LIB_SCHED_YIELD]) gl_pthreadlib_body_done=done @@ -340,7 +354,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], AC_CHECK_HEADERS_ONCE([threads.h]) case "$host_os" in - mingw*) + mingw* | windows*) LIBSTDTHREAD= ;; *) @@ -351,7 +365,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in dnl libc. - AC_CHECK_FUNCS([thrd_create]) + gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include ]]) if test $ac_cv_func_thrd_create = yes; then LIBSTDTHREAD= else @@ -364,7 +378,7 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], fi else dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. - LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" fi ;; esac @@ -435,10 +449,12 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY], m4_ifdef([gl_THREADLIB_DEFAULT_NO], [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) - m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) + dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like + dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. + m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) AC_ARG_ENABLE([threads], -AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ -AS_HELP_STRING([--disable-threads], [build without multithread safety])]), +AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), [gl_use_threads=$enableval], [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" @@ -459,7 +475,7 @@ changequote(,)dnl esac ;; dnl Obey gl_AVOID_WINPTHREAD on mingw. - mingw*) + mingw* | windows*) case "$gl_use_winpthreads_default" in yes) gl_use_threads=posix ;; no) gl_use_threads=windows ;; @@ -558,7 +574,7 @@ AC_DEFUN([gl_THREADLIB_BODY], case "$gl_use_threads" in yes | windows | win32) # The 'win32' is for backward compatibility. if { case "$host_os" in - mingw*) true;; + mingw* | windows*) true;; *) false;; esac }; then @@ -569,6 +585,10 @@ AC_DEFUN([gl_THREADLIB_BODY], ;; esac fi + else + dnl "$gl_use_threads" is "no". + AC_DEFINE([AVOID_ANY_THREADS], [1], + [Define if no multithread safety and no multithreading is desired.]) fi AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) @@ -601,7 +621,8 @@ dnl ------------------- dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. dnl The user can still override it at installation time, by using the -dnl configure option '--enable-threads'. +dnl configure option '--enable-threads=posix'. +dnl As of 2023, this is now the default. AC_DEFUN([gl_AVOID_WINPTHREAD], [ m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index f6bf3a4f..d2f3c970 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -1,12 +1,11 @@ -# Configure a more-standard replacement for . - -# Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc. - -# serial 20 +# time_h.m4 +# serial 25 +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, +dnl with or without modifications, as long as this notice is preserved. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# Configure a more-standard replacement for . # Written by Paul Eggert and Jim Meyering. @@ -23,7 +22,10 @@ AC_DEFUN_ONCE([gl_TIME_H], dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ #include - ]], [asctime_r ctime_r]) + ]], [ + asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime + nanosleep strftime strptime time timegm timespec_get timespec_getres tzset + ]) AC_REQUIRE([AC_C_RESTRICT]) @@ -137,6 +139,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], 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_TIME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) @@ -161,23 +164,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) dnl Even GNU libc does not have timezone_t yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) - dnl If another module says to replace or to not replace, do that. - dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; - dnl this lets maintainers check for portability. - REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) - REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) - REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) - REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) - REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) - REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) - REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) - - dnl Hack so that the time module doesn't depend on the sys_time module. - dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. - : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) - dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME - dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier - dnl is no longer a big deal. + 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_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) + REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) + REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) + REPLACE_TIMEGM=0; AC_SUBST([REPLACE_TIMEGM]) + REPLACE_TIMESPEC_GET=0; AC_SUBST([REPLACE_TIMESPEC_GET]) + REPLACE_TIMESPEC_GETRES=0; AC_SUBST([REPLACE_TIMESPEC_GETRES]) + REPLACE_TZSET=0; AC_SUBST([REPLACE_TZSET]) ]) diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index adce438a..3675390e 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 @@ -1,10 +1,12 @@ -dnl Reentrant time functions: localtime_r, gmtime_r. - -dnl Copyright (C) 2003, 2006-2023 Free Software Foundation, Inc. +# time_r.m4 +# serial 1 +dnl Copyright (C) 2003, 2006-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 Reentrant time functions: localtime_r, gmtime_r. + dnl Written by Paul Eggert. AC_DEFUN([gl_TIME_R], @@ -57,9 +59,7 @@ AC_DEFUN([gl_TIME_R], [gl_cv_time_r_posix=yes], [gl_cv_time_r_posix=no]) ]) - if test $gl_cv_time_r_posix = yes; then - REPLACE_LOCALTIME_R=0 - else + if test $gl_cv_time_r_posix != yes; then REPLACE_LOCALTIME_R=1 fi else diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index 6079f1a3..c1ff2677 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 @@ -1,5 +1,6 @@ -# timegm.m4 serial 13 -dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. +# timegm.m4 +# serial 16 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -8,8 +9,7 @@ AC_DEFUN([gl_FUNC_TIMEGM], [ AC_REQUIRE([gl_TIME_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MKTIME_WORKS]) - REPLACE_TIMEGM=0 - AC_CHECK_FUNCS_ONCE([timegm]) + gl_CHECK_FUNCS_ANDROID([timegm], [[#include ]]) if test $ac_cv_func_timegm = yes; then if test "$gl_cv_func_working_mktime" != yes; then # Assume that timegm is buggy if mktime is. @@ -17,6 +17,9 @@ AC_DEFUN([gl_FUNC_TIMEGM], fi else HAVE_TIMEGM=0 + case "$gl_cv_onwards_func_timegm" in + future*) REPLACE_TIMEGM=1 ;; + esac fi ]) diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index 8977a346..42f7ec32 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 @@ -1,5 +1,6 @@ -# ungetc.m4 serial 10 -dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. +# ungetc.m4 +# serial 12 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -42,16 +43,16 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], ]])], [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no], [case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_ungetc_works="guessing yes" ;; - # Guess yes on bionic systems. - *-android*) gl_cv_func_ungetc_works="guessing yes" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_ungetc_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_ungetc_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_ungetc_works="guessing yes" ;; + # Guess yes on bionic systems. + *-android*) gl_cv_func_ungetc_works="guessing yes" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_ungetc_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_ungetc_works="$gl_cross_guess_normal" ;; esac ]) ]) diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index f4384027..81d1b9f6 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,5 +1,6 @@ -# unistd_h.m4 serial 90 -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +# unistd_h.m4 +# serial 95 +dnl Copyright (C) 2006-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. @@ -225,6 +226,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE]) REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_DUP3=0; AC_SUBST([REPLACE_DUP3]) REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) @@ -233,11 +235,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) + REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR]) REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) + REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC]) REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) + REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) @@ -248,12 +253,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_PIPE2=0; AC_SUBST([REPLACE_PIPE2]) REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) REPLACE_READ=0; AC_SUBST([REPLACE_READ]) REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) + REPLACE_SETHOSTNAME=0; AC_SUBST([REPLACE_SETHOSTNAME]) REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4 index 407c0bac..e96cf5f8 100644 --- a/gl/m4/unlocked-io.m4 +++ b/gl/m4/unlocked-io.m4 @@ -1,10 +1,9 @@ -# unlocked-io.m4 serial 16 - -# Copyright (C) 1998-2006, 2009-2023 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# unlocked-io.m4 +# serial 16 +dnl Copyright (C) 1998-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, +dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. dnl diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 index fd6230c2..9211f69d 100644 --- a/gl/m4/vararrays.m4 +++ b/gl/m4/vararrays.m4 @@ -1,13 +1,13 @@ -# Check for variable-length arrays. - +# vararrays.m4 # serial 6 +dnl Copyright (C) 2001, 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, +dnl with or without modifications, as long as this notice is preserved. -# From Paul Eggert +# Check for variable-length arrays. -# Copyright (C) 2001, 2009-2023 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# From Paul Eggert m4_version_prereq([2.70], [], [ diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 6361c843..1ea2055e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,5 +1,6 @@ -# vasnprintf.m4 serial 38 -dnl Copyright (C) 2002-2004, 2006-2023 Free Software Foundation, Inc. +# vasnprintf.m4 +# serial 52 +dnl Copyright (C) 2002-2004, 2006-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. @@ -29,6 +30,15 @@ AC_DEFUN([gl_REPLACE_VASNPRINTF], gl_PREREQ_ASNPRINTF ]) +AC_DEFUN([gl_FUNC_VASNWPRINTF], +[ + AC_LIBOBJ([printf-args]) + gl_PREREQ_PRINTF_ARGS + gl_PREREQ_PRINTF_PARSE + gl_PREREQ_VASNWPRINTF + gl_PREREQ_ASNPRINTF +]) + # Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ @@ -37,6 +47,7 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], ]) # Prerequisites of lib/printf-parse.h, lib/printf-parse.c. +# Prerequisites of lib/wprintf-parse.h, lib/wprintf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([gl_FEATURES_H]) @@ -50,19 +61,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) ]) -# Prerequisites of lib/vasnprintf.c. +# Prerequisites of lib/vasnprintf.c if !WIDE_CHAR_VERSION. AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], [ - AC_REQUIRE([AC_FUNC_ALLOCA]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) - AC_REQUIRE([gt_TYPE_WINT_T]) - AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) + AC_CHECK_FUNCS([snprintf strnlen wcrtomb]) dnl Use the _snprintf function only if it is declared (because on NetBSD it dnl is defined as a weak alias of snprintf; we prefer to use the latter). AC_CHECK_DECLS([_snprintf], , , [[#include ]]) - dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization - dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. - AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) dnl We can avoid a lot of code by assuming that snprintf's return value dnl conforms to ISO C99. So check that. AC_REQUIRE([gl_SNPRINTF_RETVAL_C99]) @@ -84,6 +89,108 @@ AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], terminated.]) ;; esac + gl_PREREQ_VASNXPRINTF +]) + +# Prerequisites of lib/vasnwprintf.c. +AC_DEFUN_ONCE([gl_PREREQ_VASNWPRINTF], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_FUNCS_ONCE([swprintf wcsnlen mbrtowc]) + AC_CHECK_DECLS([_snwprintf], , , [[#include ]]) + AC_CHECK_DECLS([wcsnlen], , , [[#include ]]) + gl_SWPRINTF_WORKS + case "$gl_cv_func_swprintf_works" in + *yes) + AC_DEFINE([HAVE_WORKING_SWPRINTF], [1], + [Define if the swprintf function works correctly when it produces output + that contains null wide characters.]) + ;; + esac + gl_MBRTOWC_C_LOCALE + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in + *yes) + AC_CACHE_CHECK([whether swprintf in the C locale is free of encoding errors], + [gl_cv_func_swprintf_C_locale_sans_EILSEQ], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif +#include +#include +int main() +{ + int result = 0; + { /* This test fails on glibc 2.35, musl libc 1.2.4, FreeBSD 13.2, NetBSD 9.3, + OpenBSD 7.2, Cygwin 2.9.0. + Reported at . */ + wchar_t buf[12]; + int ret = swprintf (buf, 12, L"%c", '\377'); + if (ret < 0) + result |= 1; + } + return result; +}]])], + [gl_cv_func_swprintf_C_locale_sans_EILSEQ=yes], + [gl_cv_func_swprintf_C_locale_sans_EILSEQ=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing yes";; + # Guess no on musl systems. + *-musl* | midipix*) gl_cv_func_swprintf_C_locale_sans_EILSEQ="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_swprintf_C_locale_sans_EILSEQ="$gl_cross_guess_normal";; + esac + ]) + ]) + ;; + esac + if case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in + *yes) false ;; + *) true ;; + esac \ + || case "$gl_cv_func_swprintf_C_locale_sans_EILSEQ" in + *yes) false ;; + *) true ;; + esac; then + AC_DEFINE([NEED_WPRINTF_DIRECTIVE_C], [1], + [Define if the vasnwprintf implementation needs special code for + the 'c' directive.]) + fi + gl_SWPRINTF_DIRECTIVE_LA + case "$gl_cv_func_swprintf_directive_la" in + *yes) ;; + *) + AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LA], [1], + [Define if the vasnwprintf implementation needs special code for + the 'a' directive with 'long double' arguments.]) + ;; + esac + gl_SWPRINTF_DIRECTIVE_LC + case "$gl_cv_func_swprintf_directive_lc" in + *yes) ;; + *) + AC_DEFINE([NEED_WPRINTF_DIRECTIVE_LC], [1], + [Define if the vasnwprintf implementation needs special code for + the 'lc' directive.]) + ;; + esac + gl_MUSL_LIBC + gl_PREREQ_VASNXPRINTF +]) + +# Common prerequisites of lib/vasnprintf.c and lib/vasnwprintf.c. +AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], +[ + AC_REQUIRE([AC_FUNC_ALLOCA]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + AC_REQUIRE([gt_TYPE_WINT_T]) + AC_CHECK_FUNCS([wcslen]) + dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization + dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE. + AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION]) ]) # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' @@ -152,7 +259,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1], [Define if the vasnprintf implementation needs special code for the 'a' and 'A' directives.]) - AC_CHECK_FUNCS([nl_langinfo]) + gl_CHECK_FUNCS_ANDROID([nl_langinfo], [[#include ]]) + ;; + esac +]) + +# Extra prerequisites of lib/vasnprintf.c for supporting the 'b' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_B], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_B]) + case "$gl_cv_func_printf_directive_b" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_B], [1], + [Define if the vasnprintf implementation needs special code for + the 'b' directive.]) ;; esac ]) @@ -187,6 +309,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], esac ]) +# Extra prerequisites of lib/vasnprintf.c for supporting the 'lc' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_LC]) + case "$gl_cv_func_printf_directive_lc" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_LC], [1], + [Define if the vasnprintf implementation needs special code for + the 'lc' directive.]) + ;; + esac +]) + # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], [ @@ -232,6 +369,22 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], esac ]) +# Extra prerequisites of lib/vasnprintf.c for supporting the # flag with a +# zero precision and a zero value in the 'x' and 'X' directives. +AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO], +[ + AC_REQUIRE([gl_PRINTF_FLAG_ALT_PRECISION_ZERO]) + case "$gl_cv_func_printf_flag_alt_precision_zero" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_ALT_PRECISION_ZERO], [1], + [Define if the vasnprintf implementation needs special code for the + # flag with a zero precision and a zero value in the 'x' and 'X' directives.]) + ;; + esac +]) + # Extra prerequisites of lib/vasnprintf.c for supporting large precisions. AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], [ @@ -276,23 +429,53 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], ]) # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. -AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS], [ AC_REQUIRE([gl_PREREQ_VASNPRINTF]) gl_PREREQ_VASNPRINTF_LONG_DOUBLE gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE gl_PREREQ_VASNPRINTF_DIRECTIVE_A + gl_PREREQ_VASNPRINTF_DIRECTIVE_B gl_PREREQ_VASNPRINTF_DIRECTIVE_F gl_PREREQ_VASNPRINTF_DIRECTIVE_LS + gl_PREREQ_VASNPRINTF_DIRECTIVE_LC gl_PREREQ_VASNPRINTF_FLAG_GROUPING gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST gl_PREREQ_VASNPRINTF_FLAG_ZERO + gl_PREREQ_VASNPRINTF_FLAG_ALT_PRECISION_ZERO gl_PREREQ_VASNPRINTF_PRECISION gl_PREREQ_VASNPRINTF_ENOMEM ]) +# Extra prerequisites of lib/vasnprintf.c for supporting the 'B' directive. +AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B], +[ + AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B]) + case "$gl_cv_func_printf_directive_uppercase_b" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_DIRECTIVE_UPPERCASE_B], [1], + [Define if the vasnprintf implementation needs special code for + the 'B' directive.]) + ;; + esac +]) + +# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance +# and GNU compatibility. +AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS], +[ + gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS + AC_DEFINE([SUPPORT_GNU_PRINTF_DIRECTIVES], [1], + [Define if the vasnprintf implementation should support GNU compatible + printf directives.]) + gl_PREREQ_VASNPRINTF_DIRECTIVE_UPPERCASE_B +]) + # Prerequisites of lib/asnprintf.c. +# Prerequisites of lib/asnwprintf.c. AC_DEFUN([gl_PREREQ_ASNPRINTF], [ ]) diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 6e6156a7..73f7b807 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 @@ -1,5 +1,6 @@ -# vasprintf.m4 serial 6 -dnl Copyright (C) 2002-2003, 2006-2007, 2009-2023 Free Software Foundation, +# vasprintf.m4 +# serial 6 +dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index f0468e89..ecf09686 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 @@ -1,5 +1,6 @@ -# visibility.m4 serial 8 -dnl Copyright (C) 2005, 2008, 2010-2023 Free Software Foundation, Inc. +# visibility.m4 +# serial 9 +dnl Copyright (C) 2005, 2008, 2010-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. @@ -31,18 +32,18 @@ AC_DEFUN([gl_VISIBILITY], dnl user has put into $CC $CFLAGS $CPPFLAGS. AC_CACHE_CHECK([whether the -Werror option is usable], [gl_cv_cc_vis_werror], - [gl_save_CFLAGS="$CFLAGS" + [gl_saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[]], [[]])], [gl_cv_cc_vis_werror=yes], [gl_cv_cc_vis_werror=no]) - CFLAGS="$gl_save_CFLAGS" + CFLAGS="$gl_saved_CFLAGS" ]) dnl Now check whether visibility declarations are supported. AC_CACHE_CHECK([for simple visibility declarations], [gl_cv_cc_visibility], - [gl_save_CFLAGS="$CFLAGS" + [gl_saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden" dnl We use the option -Werror and a function dummyfunc, because on some dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning @@ -68,7 +69,7 @@ AC_DEFUN([gl_VISIBILITY], [[]])], [gl_cv_cc_visibility=yes], [gl_cv_cc_visibility=no]) - CFLAGS="$gl_save_CFLAGS" + CFLAGS="$gl_saved_CFLAGS" ]) if test $gl_cv_cc_visibility = yes; then CFLAG_VISIBILITY="-fvisibility=hidden" diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 7fbb11c4..9f321f3f 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 @@ -1,5 +1,6 @@ -# vsnprintf.m4 serial 7 -dnl Copyright (C) 2002-2004, 2007-2023 Free Software Foundation, Inc. +# vsnprintf.m4 +# serial 7 +dnl Copyright (C) 2002-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index 10649c5c..6c8c76b8 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 @@ -1,5 +1,6 @@ -# warn-on-use.m4 serial 10 -dnl Copyright (C) 2010-2023 Free Software Foundation, Inc. +# warn-on-use.m4 +# serial 11 +dnl Copyright (C) 2010-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. @@ -36,7 +37,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], dnl clang (e.g. strndup), reference ac_compile_for_check_decl instead dnl of ac_compile. If, for whatever reason, the override of AC_PROG_CC dnl in zzgnulib.m4 is inactive, use the original ac_compile. - ac_save_ac_compile="$ac_compile" + ac_saved_ac_compile="$ac_compile" if test -n "$ac_compile_for_check_decl"; then ac_compile="$ac_compile_for_check_decl" fi @@ -46,7 +47,7 @@ AC_DEFUN([gl_WARN_ON_USE_PREPARE], [[#undef $gl_func (void) $gl_func;]])], [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) - ac_compile="$ac_save_ac_compile" + ac_compile="$ac_saved_ac_compile" AS_VAR_IF([gl_Symbol], [yes], [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) dnl Shortcut for an AC_CHECK_DECL invocation that may come later: diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index 8ec66193..995bdc65 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 @@ -1,13 +1,13 @@ -dnl A placeholder for ISO C99 , for platforms that have issues. - -dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. +# wchar_h.m4 +# serial 64 +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, dnl with or without modifications, as long as this notice is preserved. -dnl Written by Eric Blake. +dnl A placeholder for ISO C99 , for platforms that have issues. -# wchar_h.m4 serial 55 +dnl Written by Eric Blake. AC_DEFUN_ONCE([gl_WCHAR_H], [ @@ -86,8 +86,8 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], dnl z/OS when using the XPLINK object format (due to duplicate dnl CSECT names). Instead, temporarily redefine $ac_compile so dnl that the object file has the latter name from the start. - save_ac_compile="$ac_compile" - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/` + saved_ac_compile="$ac_compile" + ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest1/` if echo '#include "conftest.c"' >conftest1.c \ && AC_TRY_EVAL([ac_compile]); then AC_LANG_CONFTEST([ @@ -97,7 +97,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], int zero (void) { return 0; } ]])]) dnl See note above about renaming object files. - ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/` + ac_compile=`echo "$saved_ac_compile" | sed s/conftest/conftest2/` if echo '#include "conftest.c"' >conftest2.c \ && AC_TRY_EVAL([ac_compile]); then if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then @@ -107,7 +107,7 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK], fi fi fi - ac_compile="$save_ac_compile" + ac_compile="$saved_ac_compile" rm -f conftest[12].c conftest[12].$ac_objext conftest$ac_exeext ;; esac @@ -147,6 +147,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_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_MBSZERO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOWC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOWCS]) @@ -185,6 +186,7 @@ AC_DEFUN([gl_WCHAR_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSTOK]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSWIDTH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCSFTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WGETCWD]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WCSDUP], [1]) ]) @@ -253,5 +255,10 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) + REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) + REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) + REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) + REPLACE_WMEMCMP=0; AC_SUBST([REPLACE_WMEMCMP]) + REPLACE_WMEMPCPY=0; AC_SUBST([REPLACE_WMEMPCPY]) ]) diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 index 50bde08a..968832cb 100644 --- a/gl/m4/wchar_t.m4 +++ b/gl/m4/wchar_t.m4 @@ -1,5 +1,6 @@ -# wchar_t.m4 serial 4 (gettext-0.18.2) -dnl Copyright (C) 2002-2003, 2008-2023 Free Software Foundation, Inc. +# wchar_t.m4 +# serial 4 (gettext-0.18.2) +dnl Copyright (C) 2002-2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index d51b36e1..35dff6f0 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 @@ -1,5 +1,6 @@ -# wcrtomb.m4 serial 17 -dnl Copyright (C) 2008-2023 Free Software Foundation, Inc. +# wcrtomb.m4 +# serial 19 +dnl Copyright (C) 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, dnl with or without modifications, as long as this notice is preserved. @@ -82,9 +83,11 @@ int main () changequote(,)dnl case "$host_os" in # Guess no on AIX 4, OSF/1, Solaris, native Windows. - aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; + aix4* | osf* | solaris* | mingw* | windows*) + gl_cv_func_wcrtomb_retval="guessing no" ;; # Guess yes otherwise. - *) gl_cv_func_wcrtomb_retval="guessing yes" ;; + *) + gl_cv_func_wcrtomb_retval="guessing yes" ;; esac changequote([,])dnl if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then @@ -97,12 +100,14 @@ changequote([,])dnl int main () { int result = 0; - if (setlocale (LC_ALL, "$LOCALE_FR") != NULL) + if (strcmp ("$LOCALE_FR", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 1; } - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; @@ -113,12 +118,14 @@ int main () result |= 2; } } - if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) + if (strcmp ("$LOCALE_JA", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_JA") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 4; } - if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 8; diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4 new file mode 100644 index 00000000..e5d70740 --- /dev/null +++ b/gl/m4/wctype.m4 @@ -0,0 +1,52 @@ +# wctype.m4 +# serial 6 +dnl Copyright (C) 2011-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. + +AC_DEFUN_ONCE([gl_FUNC_WCTYPE], +[ + AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) + AC_REQUIRE([gl_WCTYPE_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + HAVE_WCTYPE=$HAVE_WCTYPE_T + if test $HAVE_WCTYPE = 1; then + AC_CACHE_CHECK([whether wctype supports the "blank" and "punct" character classes], + [gl_cv_func_wctype_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + #include + int main () + { + /* This test fails on mingw. */ + if (wctype ("blank") == (wctype_t)0) + return 1; + /* This test fails on MSVC 14. */ + if ((! iswctype ('\t', wctype ("blank"))) != (! iswblank ('\t'))) + return 2; + /* This test fails on Android 11. */ + if ((! iswctype ('\`', wctype ("punct"))) != (! ispunct ('\`'))) + return 4; + return 0; + } + ]])], + [gl_cv_func_wctype_works=yes], [gl_cv_func_wctype_works=no], + [case "$host_os" in + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_wctype_works="guessing no" ;; + # Guess no on Android. + android*) gl_cv_func_wctype_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_wctype_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_wctype_works" in + *yes) ;; + *) REPLACE_WCTYPE=1 ;; + esac + fi +]) diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index 6856a735..a3b07c2a 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 @@ -1,8 +1,9 @@ -# wctype_h.m4 serial 30 +# wctype_h.m4 +# serial 33 dnl A placeholder for ISO C99 , for platforms that lack it. -dnl Copyright (C) 2006-2023 Free Software Foundation, Inc. +dnl Copyright (C) 2006-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. @@ -178,6 +179,7 @@ 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_ISWPUNCT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWXDIGIT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WCTYPE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISWCTYPE]) @@ -196,5 +198,8 @@ AC_DEFUN([gl_WCTYPE_H_DEFAULTS], HAVE_WCTRANS_T=1; AC_SUBST([HAVE_WCTRANS_T]) REPLACE_ISWBLANK=0; AC_SUBST([REPLACE_ISWBLANK]) REPLACE_ISWDIGIT=0; AC_SUBST([REPLACE_ISWDIGIT]) + REPLACE_ISWPUNCT=0; AC_SUBST([REPLACE_ISWPUNCT]) REPLACE_ISWXDIGIT=0; AC_SUBST([REPLACE_ISWXDIGIT]) + REPLACE_WCTRANS=0; AC_SUBST([REPLACE_WCTRANS]) + REPLACE_WCTYPE=0; AC_SUBST([REPLACE_WCTYPE]) ]) diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index dfd743b3..883fac28 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,5 +1,6 @@ -# wint_t.m4 serial 11 -dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. +# wint_t.m4 +# serial 11 +dnl Copyright (C) 2003, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index fc56f59a..d44d0f08 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 @@ -1,5 +1,6 @@ -# xalloc.m4 serial 18 -dnl Copyright (C) 2002-2006, 2009-2023 Free Software Foundation, Inc. +# xalloc.m4 +# serial 18 +dnl Copyright (C) 2002-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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index 649db9c5..e5784973 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 @@ -1,5 +1,6 @@ -# xsize.m4 serial 5 -dnl Copyright (C) 2003-2004, 2008-2023 Free Software Foundation, Inc. +# xsize.m4 +# serial 5 +dnl Copyright (C) 2003-2004, 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, dnl with or without modifications, as long as this notice is preserved. diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4 index 362102b6..710fba4e 100644 --- a/gl/m4/zzgnulib.m4 +++ b/gl/m4/zzgnulib.m4 @@ -1,5 +1,6 @@ -# zzgnulib.m4 serial 1 -dnl Copyright (C) 2020-2023 Free Software Foundation, Inc. +# zzgnulib.m4 +# serial 1 +dnl Copyright (C) 2020-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. -- cgit v1.2.3-74-g34f1