From b0afb8fe0ff1d87165af9df61501197a06240dda Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:13:40 +0100 Subject: Sync with Gnulib stable-202507 code (a8ac9f9ce5) --- gl/m4/00gnulib.m4 | 3 +- gl/m4/__inline.m4 | 3 +- gl/m4/absolute-header.m4 | 3 +- gl/m4/af_alg.m4 | 3 +- gl/m4/alloca.m4 | 3 +- gl/m4/arpa_inet_h.m4 | 9 +- gl/m4/assert_h.m4 | 76 +++--- gl/m4/base64.m4 | 3 +- gl/m4/btowc.m4 | 13 +- gl/m4/build-to-host.m4 | 274 ++++++++++++++++++++++ gl/m4/builtin-expect.m4 | 10 +- gl/m4/byteswap.m4 | 34 ++- gl/m4/c-bool.m4 | 20 +- gl/m4/c32rtomb.m4 | 187 +++++++++++++++ gl/m4/calloc.m4 | 73 +++--- gl/m4/close.m4 | 3 +- gl/m4/codeset.m4 | 3 +- gl/m4/double-slash-root.m4 | 3 +- gl/m4/dup2.m4 | 3 +- gl/m4/eealloc.m4 | 32 --- gl/m4/environ.m4 | 3 +- gl/m4/errno_h.m4 | 13 +- gl/m4/error.m4 | 4 +- gl/m4/error_h.m4 | 20 +- gl/m4/exponentd.m4 | 7 +- gl/m4/extensions-aix.m4 | 26 +++ gl/m4/extensions.m4 | 3 +- gl/m4/extern-inline.m4 | 3 +- gl/m4/fclose.m4 | 3 +- gl/m4/fcntl-o.m4 | 97 +++++--- gl/m4/fcntl.m4 | 3 +- gl/m4/fcntl_h.m4 | 3 +- gl/m4/fflush.m4 | 14 +- gl/m4/float_h.m4 | 30 ++- gl/m4/floorf.m4 | 3 +- gl/m4/fopen.m4 | 3 +- gl/m4/fpurge.m4 | 94 ++++---- gl/m4/freading.m4 | 3 +- gl/m4/free.m4 | 3 +- gl/m4/fseek.m4 | 3 +- gl/m4/fseeko.m4 | 9 +- gl/m4/fseterr.m4 | 15 ++ gl/m4/fstat.m4 | 3 +- gl/m4/fstypename.m4 | 3 +- gl/m4/fsusage.m4 | 4 +- gl/m4/ftell.m4 | 3 +- gl/m4/ftello.m4 | 9 +- gl/m4/getaddrinfo.m4 | 46 +++- gl/m4/getdelim.m4 | 3 +- gl/m4/getdtablesize.m4 | 3 +- gl/m4/gethostname.m4 | 3 +- gl/m4/getline.m4 | 3 +- gl/m4/getloadavg.m4 | 5 +- gl/m4/getopt.m4 | 16 +- gl/m4/getprogname.m4 | 3 +- gl/m4/gl-openssl.m4 | 3 +- gl/m4/gnulib-cache.m4 | 2 +- gl/m4/gnulib-common.m4 | 457 +++++++++++++++++++++++++++++++----- gl/m4/gnulib-comp.m4 | 517 ++++++++++++++++++++++++++++++++++++----- gl/m4/gnulib-i18n.m4 | 61 +++++ gl/m4/gnulib-tool.m4 | 8 +- gl/m4/hostent.m4 | 3 +- gl/m4/idpriv.m4 | 3 +- gl/m4/include_next.m4 | 3 +- gl/m4/inet_ntop.m4 | 3 +- gl/m4/inet_pton.m4 | 72 ++++++ gl/m4/intmax_t.m4 | 3 +- gl/m4/inttypes.m4 | 3 +- gl/m4/inttypes_h.m4 | 3 +- gl/m4/iswblank.m4 | 3 +- gl/m4/iswctype.m4 | 3 +- gl/m4/iswdigit.m4 | 21 +- gl/m4/iswpunct.m4 | 3 +- gl/m4/iswxdigit.m4 | 21 +- gl/m4/langinfo_h.m4 | 20 +- gl/m4/largefile.m4 | 11 +- gl/m4/libunistring-base.m4 | 204 ++++++++++++++++ gl/m4/limits-h.m4 | 3 +- gl/m4/localcharset.m4 | 3 +- gl/m4/locale-en.m4 | 138 +++++++++++ gl/m4/locale-fr.m4 | 25 +- gl/m4/locale-ja.m4 | 10 +- gl/m4/locale-zh.m4 | 24 +- gl/m4/locale_h.m4 | 52 ++++- gl/m4/localeconv.m4 | 3 +- gl/m4/lock.m4 | 3 +- gl/m4/lseek.m4 | 3 +- gl/m4/lstat.m4 | 82 +++++++ gl/m4/malloc.m4 | 139 +++++++---- gl/m4/malloca.m4 | 7 +- gl/m4/math_h.m4 | 14 +- gl/m4/mbchar.m4 | 15 ++ gl/m4/mbiter.m4 | 16 ++ gl/m4/mbrtoc32.m4 | 326 ++++++++++++++++++++++++++ gl/m4/mbrtowc.m4 | 37 +-- gl/m4/mbsinit.m4 | 3 +- gl/m4/mbstate_t.m4 | 3 +- gl/m4/mbtowc.m4 | 3 +- gl/m4/memchr.m4 | 7 +- gl/m4/minmax.m4 | 3 +- gl/m4/mktime.m4 | 6 +- gl/m4/mmap-anon.m4 | 3 +- gl/m4/mode_t.m4 | 3 +- gl/m4/mountlist.m4 | 18 +- gl/m4/msvc-inval.m4 | 3 +- gl/m4/msvc-nothrow.m4 | 3 +- gl/m4/multiarch.m4 | 3 +- gl/m4/musl.m4 | 3 +- gl/m4/netdb_h.m4 | 3 +- gl/m4/netinet_in_h.m4 | 3 +- gl/m4/nl_langinfo.m4 | 13 +- gl/m4/nocrash.m4 | 3 +- gl/m4/off64_t.m4 | 32 +++ gl/m4/off_t.m4 | 3 +- gl/m4/once.m4 | 14 ++ gl/m4/open-cloexec.m4 | 3 +- gl/m4/open-slash.m4 | 3 +- gl/m4/open.m4 | 8 +- gl/m4/pathmax.m4 | 3 +- gl/m4/pid_t.m4 | 3 +- gl/m4/printf.m4 | 288 ++++++++++++++++------- gl/m4/pthread-once.m4 | 83 +++++++ gl/m4/pthread-spin.m4 | 72 ++++++ gl/m4/pthread_h.m4 | 293 +++++++++++++++++++++++ gl/m4/pthread_rwlock_rdlock.m4 | 3 +- gl/m4/realloc.m4 | 153 ++++++++---- gl/m4/reallocarray.m4 | 16 +- gl/m4/regex.m4 | 26 ++- gl/m4/sched_h.m4 | 102 ++++++++ gl/m4/servent.m4 | 3 +- gl/m4/setenv.m4 | 7 +- gl/m4/setlocale_null.m4 | 7 +- gl/m4/sha256.m4 | 3 +- gl/m4/size_max.m4 | 3 +- gl/m4/snprintf.m4 | 3 +- gl/m4/socketlib.m4 | 3 +- gl/m4/sockets.m4 | 3 +- gl/m4/socklen.m4 | 3 +- gl/m4/sockpfaf.m4 | 15 +- gl/m4/ssize_t.m4 | 3 +- gl/m4/stat-time.m4 | 4 +- gl/m4/stat.m4 | 3 +- gl/m4/std-gnu11.m4 | 27 ++- gl/m4/stdalign.m4 | 18 +- gl/m4/stdckdint_h.m4 | 136 +++++++++++ gl/m4/stddef_h.m4 | 63 +++-- gl/m4/stdint.m4 | 7 +- gl/m4/stdint_h.m4 | 3 +- gl/m4/stdio_h.m4 | 17 +- gl/m4/stdlib_h.m4 | 66 +++--- gl/m4/strcase.m4 | 46 ---- gl/m4/strcasecmp.m4 | 67 ++++++ gl/m4/strcasestr.m4 | 7 +- gl/m4/strerror.m4 | 3 +- gl/m4/string_h.m4 | 19 +- gl/m4/strings_h.m4 | 18 +- gl/m4/strncasecmp.m4 | 32 +++ gl/m4/strncpy.m4 | 94 ++++++++ gl/m4/strsep.m4 | 3 +- gl/m4/strstr.m4 | 7 +- gl/m4/sys_cdefs_h.m4 | 26 +++ gl/m4/sys_socket_h.m4 | 48 ++-- gl/m4/sys_stat_h.m4 | 3 +- gl/m4/sys_types_h.m4 | 16 +- gl/m4/sys_uio_h.m4 | 3 +- gl/m4/threadlib.m4 | 376 +++++++++++++++--------------- gl/m4/time_h.m4 | 12 +- gl/m4/time_r.m4 | 3 +- gl/m4/timegm.m4 | 3 +- gl/m4/uchar_h.m4 | 279 ++++++++++++++++++++++ gl/m4/ungetc.m4 | 3 +- gl/m4/unicase_h.m4 | 45 ++++ gl/m4/unictype_h.m4 | 179 ++++++++++++++ gl/m4/uninorm_h.m4 | 47 ++++ gl/m4/unistd_h.m4 | 7 +- gl/m4/unitypes_h.m4 | 26 +++ gl/m4/unlocked-io.m4 | 3 +- gl/m4/vararrays.m4 | 3 +- gl/m4/vasnprintf.m4 | 74 +++++- gl/m4/vasprintf.m4 | 3 +- gl/m4/visibility.m4 | 3 +- gl/m4/vsnprintf.m4 | 3 +- gl/m4/warn-on-use.m4 | 3 +- gl/m4/wchar_h.m4 | 6 +- gl/m4/wchar_t.m4 | 25 -- gl/m4/wcrtomb.m4 | 13 +- gl/m4/wctype.m4 | 3 +- gl/m4/wctype_h.m4 | 3 +- gl/m4/wcwidth.m4 | 116 +++++++++ gl/m4/wint_t.m4 | 3 +- gl/m4/xalloc.m4 | 3 +- gl/m4/xsize.m4 | 3 +- gl/m4/zzgnulib.m4 | 3 +- 193 files changed, 5655 insertions(+), 1123 deletions(-) create mode 100644 gl/m4/build-to-host.m4 create mode 100644 gl/m4/c32rtomb.m4 delete mode 100644 gl/m4/eealloc.m4 create mode 100644 gl/m4/extensions-aix.m4 create mode 100644 gl/m4/fseterr.m4 create mode 100644 gl/m4/gnulib-i18n.m4 create mode 100644 gl/m4/inet_pton.m4 create mode 100644 gl/m4/libunistring-base.m4 create mode 100644 gl/m4/locale-en.m4 create mode 100644 gl/m4/lstat.m4 create mode 100644 gl/m4/mbchar.m4 create mode 100644 gl/m4/mbiter.m4 create mode 100644 gl/m4/mbrtoc32.m4 create mode 100644 gl/m4/off64_t.m4 create mode 100644 gl/m4/once.m4 create mode 100644 gl/m4/pthread-once.m4 create mode 100644 gl/m4/pthread-spin.m4 create mode 100644 gl/m4/pthread_h.m4 create mode 100644 gl/m4/sched_h.m4 create mode 100644 gl/m4/stdckdint_h.m4 delete mode 100644 gl/m4/strcase.m4 create mode 100644 gl/m4/strcasecmp.m4 create mode 100644 gl/m4/strncasecmp.m4 create mode 100644 gl/m4/strncpy.m4 create mode 100644 gl/m4/sys_cdefs_h.m4 create mode 100644 gl/m4/uchar_h.m4 create mode 100644 gl/m4/unicase_h.m4 create mode 100644 gl/m4/unictype_h.m4 create mode 100644 gl/m4/uninorm_h.m4 create mode 100644 gl/m4/unitypes_h.m4 delete mode 100644 gl/m4/wchar_t.m4 create mode 100644 gl/m4/wcwidth.m4 (limited to 'gl/m4') diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 index cd167718..2b205b35 100644 --- a/gl/m4/00gnulib.m4 +++ b/gl/m4/00gnulib.m4 @@ -1,9 +1,10 @@ # 00gnulib.m4 # serial 9 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl This file must be named something that sorts before all other dnl gnulib-provided .m4 files. It is needed until the clang fix has diff --git a/gl/m4/__inline.m4 b/gl/m4/__inline.m4 index 20baf164..d1b8257b 100644 --- a/gl/m4/__inline.m4 +++ b/gl/m4/__inline.m4 @@ -1,9 +1,10 @@ # __inline.m4 # serial 1 -dnl Copyright 2017-2024 Free Software Foundation, Inc. +dnl Copyright 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test for __inline keyword diff --git a/gl/m4/absolute-header.m4 b/gl/m4/absolute-header.m4 index 0abd6d90..5501b07b 100644 --- a/gl/m4/absolute-header.m4 +++ b/gl/m4/absolute-header.m4 @@ -1,9 +1,10 @@ # absolute-header.m4 # serial 18 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Derek Price. diff --git a/gl/m4/af_alg.m4 b/gl/m4/af_alg.m4 index 33b74945..38575b6d 100644 --- a/gl/m4/af_alg.m4 +++ b/gl/m4/af_alg.m4 @@ -1,9 +1,10 @@ # af_alg.m4 # serial 6 -dnl Copyright 2018-2024 Free Software Foundation, Inc. +dnl Copyright 2018-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Matteo Croce. diff --git a/gl/m4/alloca.m4 b/gl/m4/alloca.m4 index dc78dc19..68fc6211 100644 --- a/gl/m4/alloca.m4 +++ b/gl/m4/alloca.m4 @@ -1,10 +1,11 @@ # alloca.m4 # serial 21 -dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ALLOCA], [ diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4 index 9eac86d7..5dae6f72 100644 --- a/gl/m4/arpa_inet_h.m4 +++ b/gl/m4/arpa_inet_h.m4 @@ -1,9 +1,10 @@ # arpa_inet_h.m4 -# serial 17 -dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Simon Josefsson and Bruno Haible @@ -68,8 +69,12 @@ AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_HTONL=1; AC_SUBST([HAVE_DECL_HTONL]) + HAVE_DECL_HTONS=1; AC_SUBST([HAVE_DECL_HTONS]) HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) + HAVE_DECL_NTOHL=1; AC_SUBST([HAVE_DECL_NTOHL]) + HAVE_DECL_NTOHS=1; AC_SUBST([HAVE_DECL_NTOHS]) REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) ]) diff --git a/gl/m4/assert_h.m4 b/gl/m4/assert_h.m4 index b90d0f19..e77524ca 100644 --- a/gl/m4/assert_h.m4 +++ b/gl/m4/assert_h.m4 @@ -1,9 +1,10 @@ # assert_h.m4 -# serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. @@ -12,30 +13,31 @@ AC_DEFUN([gl_ASSERT_H], AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], [gl_saved_CFLAGS=$CFLAGS for gl_working in "yes, a keyword" "yes, an macro"; do - AS_CASE([$gl_working], - [*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++1z-extensions" - #endif - #ifdef INCLUDE_ASSERT_H - #include - #endif - static_assert (2 + 2 == 4, "arithmetic does not work"); - static_assert (2 + 2 == 4); - ]], - [[ - static_assert (sizeof (char) == 1, "sizeof does not work"); - static_assert (sizeof (char) == 1); - ]])], - [gl_cv_static_assert=$gl_working], - [gl_cv_static_assert=no]) - CFLAGS=$gl_saved_CFLAGS - test "$gl_cv_static_assert" != no && break - done]) + AS_CASE([$gl_working], + [*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++1z-extensions" + #endif + #ifdef INCLUDE_ASSERT_H + #include + #endif + static_assert (2 + 2 == 4, "arithmetic does not work"); + static_assert (2 + 2 == 4); + ]], + [[ + static_assert (sizeof (char) == 1, "sizeof does not work"); + static_assert (sizeof (char) == 1); + ]]) + ], + [gl_cv_static_assert=$gl_working], + [gl_cv_static_assert=no]) + CFLAGS=$gl_saved_CFLAGS + test "$gl_cv_static_assert" != no && break + done + ]) GL_GENERATE_ASSERT_H=false AS_CASE([$gl_cv_static_assert], @@ -48,6 +50,10 @@ AC_DEFUN([gl_ASSERT_H], dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. + dnl Hardcode the known configuration results for GCC and clang, so that + dnl a configuration made with the C compiler works also with the C++ compiler + dnl and vice versa. + dnl The seemingly redundant parentheses are necessary for MSVC 14. 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 @@ -55,7 +61,18 @@ AC_DEFUN([gl_ASSERT_H], 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 \ +[#if (!(defined __clang__ \ + ? (defined __cplusplus \ + ? __cplusplus >= 201703L \ + : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \ + && !defined __sun) \ + : (defined __GNUC__ \ + ? (defined __cplusplus \ + ? __cplusplus >= 201103L && __GNUG__ >= 6 \ + : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ + && !defined __sun) \ + : defined HAVE_C_STATIC_ASSERT)) \ + && !defined assert \ && (!defined __cplusplus \ || (__cpp_static_assert < 201411 \ && __GNUG__ < 6 && __clang_major__ < 6))) @@ -65,8 +82,9 @@ AC_DEFUN([gl_ASSERT_H], #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 + We need it also to be invocable with a single argument. + Haiku 2022 does not define static_assert at all. */ + #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus #undef/**/static_assert #define static_assert _Static_assert #endif diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4 index 26f2af41..785d31c0 100644 --- a/gl/m4/base64.m4 +++ b/gl/m4/base64.m4 @@ -1,9 +1,10 @@ # base64.m4 # serial 4 -dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_BASE64], [ diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index d9dd7036..59d52be6 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 @@ -1,13 +1,15 @@ # btowc.m4 -# serial 14 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_BTOWC], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WINT_T]) dnl Check whether is usable at all, first. Otherwise the test dnl program below may lead to an endless loop. See @@ -133,6 +135,13 @@ int main () ]) ]) + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + dnl On mingw/ucrt, we override the return type of btowc(). + dnl While the original wint_t (= unsigned short) and the overridden wint_t + dnl (= unsigned int) are equivalent in function parameters, this is not + dnl the case for function return types. + REPLACE_BTOWC=1 + fi case "$gl_cv_func_btowc_nul" in *yes) ;; *) REPLACE_BTOWC=1 ;; diff --git a/gl/m4/build-to-host.m4 b/gl/m4/build-to-host.m4 new file mode 100644 index 00000000..01bff8f3 --- /dev/null +++ b/gl/m4/build-to-host.m4 @@ -0,0 +1,274 @@ +# build-to-host.m4 +# serial 5 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Bruno Haible. + +dnl When the build environment ($build_os) is different from the target runtime +dnl environment ($host_os), file names may need to be converted from the build +dnl environment syntax to the target runtime environment syntax. This is +dnl because the Makefiles are executed (mostly) by build environment tools and +dnl therefore expect file names in build environment syntax, whereas the runtime +dnl expects file names in target runtime environment syntax. +dnl +dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need +dnl be converted from Cygwin syntax to native Windows syntax: +dnl /cygdrive/c/foo/bar -> C:\foo\bar +dnl /usr/local/share -> C:\cygwin64\usr\local\share +dnl +dnl gl_BUILD_TO_HOST([somedir]) +dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must +dnl already have its final value assigned, and produces two additional +dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the +dnl same file name value, just in different syntax: +dnl - somedir_c is the file name in target runtime environment syntax, +dnl as a C string (starting and ending with a double-quote, +dnl and with escaped backslashes and double-quotes in +dnl between). +dnl - somedir_c_make is the same thing, escaped for use in a Makefile. + +AC_DEFUN([gl_BUILD_TO_HOST], +[ + AC_REQUIRE([AC_CANONICAL_BUILD]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) + + dnl Define somedir_c. + gl_final_[$1]="$[$1]" + dnl Translate it from build syntax to host syntax. + case "$build_os" in + cygwin*) + case "$host_os" in + mingw* | windows*) + gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; + esac + ;; + esac + dnl Convert it to C string syntax. + [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"` + [$1]_c='"'"$[$1]_c"'"' + AC_SUBST([$1_c]) + + dnl Define somedir_c_make. + [$1]_c_make=`printf '%s\n' "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2" | tr -d "$gl_tr_cr"` + dnl Use the substituted somedir variable, when possible, so that the user + dnl may adjust somedir a posteriori when there are no special characters. + if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then + [$1]_c_make='\"$([$1])\"' + fi + AC_SUBST([$1_c_make]) +]) + +dnl Some initializations for gl_BUILD_TO_HOST. +AC_DEFUN([gl_BUILD_TO_HOST_INIT], +[ + gl_sed_double_backslashes='s/\\/\\\\/g' + gl_sed_escape_doublequotes='s/"/\\"/g' +changequote(,)dnl + gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" +changequote([,])dnl + gl_sed_escape_for_make_2='s,\$,\\$$,g' + dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr + dnl does not understand '\r'. + case `echo r | tr -d '\r'` in + '') gl_tr_cr='\015' ;; + *) gl_tr_cr='\r' ;; + esac +]) + + +dnl The following macros are convenience invocations of gl_BUILD_TO_HOST +dnl for some of the variables that are defined by Autoconf. +dnl To do so for _all_ the possible variables, use the module 'configmake'. + +dnl Defines bindir_c and bindir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR], +[ + dnl Find the final value of bindir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_bindir="${bindir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval bindir="$bindir" + gl_BUILD_TO_HOST([bindir]) + bindir="${gl_saved_bindir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines datadir_c and datadir_c_make, +dnl where datadir = $(datarootdir) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR], +[ + dnl Find the final value of datadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + gl_BUILD_TO_HOST([datadir]) + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libdir_c and libdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR], +[ + dnl Find the final value of libdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + gl_BUILD_TO_HOST([libdir]) + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines libexecdir_c and libexecdir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR], +[ + dnl Find the final value of libexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + gl_BUILD_TO_HOST([libexecdir]) + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines localedir_c and localedir_c_make. +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR], +[ + dnl Find the final value of localedir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_localedir="${localedir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + gl_BUILD_TO_HOST([localedir]) + localedir="${gl_saved_localedir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkgdatadir_c and pkgdatadir_c_make, +dnl where pkgdatadir = $(datadir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR], +[ + dnl Find the final value of pkgdatadir. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_datadir="${datadir}" + gl_saved_pkgdatadir="${pkgdatadir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval datadir="$datadir" + eval pkgdatadir="$pkgdatadir" + gl_BUILD_TO_HOST([pkgdatadir]) + pkgdatadir="${gl_saved_pkgdatadir}" + datadir="${gl_saved_datadir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibdir_c and pkglibdir_c_make, +dnl where pkglibdir = $(libdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR], +[ + dnl Find the final value of pkglibdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libdir="${libdir}" + gl_saved_pkglibdir="${pkglibdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libdir="$libdir" + eval pkglibdir="$pkglibdir" + gl_BUILD_TO_HOST([pkglibdir]) + pkglibdir="${gl_saved_pkglibdir}" + libdir="${gl_saved_libdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) + +dnl Defines pkglibexecdir_c and pkglibexecdir_c_make, +dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE) +AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR], +[ + dnl Find the final value of pkglibexecdir. + gl_saved_prefix="${prefix}" + gl_saved_exec_prefix="${exec_prefix}" + gl_saved_libexecdir="${libexecdir}" + gl_saved_pkglibexecdir="${pkglibexecdir}" + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + exec_prefix='${prefix}' + fi + eval exec_prefix="$exec_prefix" + eval libexecdir="$libexecdir" + eval pkglibexecdir="$pkglibexecdir" + gl_BUILD_TO_HOST([pkglibexecdir]) + pkglibexecdir="${gl_saved_pkglibexecdir}" + libexecdir="${gl_saved_libexecdir}" + exec_prefix="${gl_saved_exec_prefix}" + prefix="${gl_saved_prefix}" +]) diff --git a/gl/m4/builtin-expect.m4 b/gl/m4/builtin-expect.m4 index c7af926b..76d32867 100644 --- a/gl/m4/builtin-expect.m4 +++ b/gl/m4/builtin-expect.m4 @@ -1,11 +1,12 @@ # builtin-expect.m4 -# serial 1 -dnl Copyright 2016-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -dnl Check for __builtin_expect. +dnl Provide a GCC-compatible __builtin_expect macro in . dnl Written by Paul Eggert. @@ -47,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT], #elif HAVE___BUILTIN_EXPECT == 2 # include #endif - ]) -]) +])]) diff --git a/gl/m4/byteswap.m4 b/gl/m4/byteswap.m4 index 0c76fe93..b53cb4d0 100644 --- a/gl/m4/byteswap.m4 +++ b/gl/m4/byteswap.m4 @@ -1,18 +1,42 @@ # byteswap.m4 -# serial 5 -dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. +# serial 7 +dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Oskar Liljeblad. AC_DEFUN([gl_BYTESWAP], [ dnl Prerequisites of lib/byteswap.in.h. - AC_CHECK_HEADERS([byteswap.h], [ + AC_CHECK_HEADERS_ONCE([byteswap.h]) + if test $ac_cv_header_byteswap_h = yes; then + AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64], + [gl_cv_header_working_byteswap_h], + [gl_cv_header_working_byteswap_h=no + dnl Check that floating point arguments work. + dnl This also checks C libraries with implementations like + dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))' + dnl that mistakenly evaluate their arguments multiple times. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[int value_16 = bswap_16 (0.0); + int value_32 = bswap_32 (0.0); + int value_64 = bswap_64 (0.0); + return !(value_16 + value_32 + value_64); + ]]) + ], + [gl_cv_header_working_byteswap_h=yes], + [gl_cv_header_working_byteswap_h=no]) + ]) + fi + if test "$gl_cv_header_working_byteswap_h" = yes; then GL_GENERATE_BYTESWAP_H=false - ], [ + else GL_GENERATE_BYTESWAP_H=true - ]) + fi ]) diff --git a/gl/m4/c-bool.m4 b/gl/m4/c-bool.m4 index 0fb0de3b..8fa8bfc8 100644 --- a/gl/m4/c-bool.m4 +++ b/gl/m4/c-bool.m4 @@ -1,9 +1,10 @@ # c-bool.m4 -# serial 1 -dnl Copyright 2022-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2022-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for bool that conforms to C2023. @@ -29,12 +30,23 @@ AC_DEFUN([gl_C_BOOL], dnl The "zz" puts this toward config.h's end, to avoid potential dnl collisions with other definitions. dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. - dnl In C, this means including if it is not already included. + dnl Hardcode the known configuration results for GCC and clang, so that + dnl a configuration made with the C compiler works also with the C++ compiler + dnl and vice versa. + dnl The seemingly redundant parentheses are necessary for MSVC 14. + dnl "Arrange for them to work", in C, means including if it is + dnl not already included. dnl However, if the preprocessor mistakenly treats 'true' as 0, dnl define it to a bool expression equal to 1; this is needed in dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. AH_VERBATIM([zzbool], -[#ifndef HAVE_C_BOOL +[#if !(defined __cplusplus \ + ? 1 \ + : (defined __clang__ \ + ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \ + : (defined __GNUC__ \ + ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \ + : defined HAVE_C_BOOL))) # if !defined __cplusplus && !defined __bool_true_false_are_defined # if HAVE_STDBOOL_H # include diff --git a/gl/m4/c32rtomb.m4 b/gl/m4/c32rtomb.m4 new file mode 100644 index 00000000..ce26a31e --- /dev/null +++ b/gl/m4/c32rtomb.m4 @@ -0,0 +1,187 @@ +# c32rtomb.m4 +# serial 8 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_C32RTOMB], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + + AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) + if test $gl_cv_func_c32rtomb = no; then + HAVE_C32RTOMB=0 + else + dnl When we override mbrtoc32, redefining the meaning of the char32_t + dnl values, we need to override c32rtomb as well, for consistency. + if test $HAVE_WORKING_MBRTOC32 = 0; then + REPLACE_C32RTOMB=1 + fi + AC_CACHE_CHECK([whether c32rtomb return value is correct], + [gl_cv_func_c32rtomb_retval], + [ + dnl Initial guess, used when cross-compiling. +changequote(,)dnl + case "$host_os" in + # Guess no on AIX. + aix*) gl_cv_func_c32rtomb_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_c32rtomb_retval="guessing yes" ;; + esac +changequote([,])dnl + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + if (c32rtomb (NULL, 0, NULL) != 1) + result |= 1; + return result; +}]])], + [gl_cv_func_c32rtomb_retval=yes], + [gl_cv_func_c32rtomb_retval=no], + [:]) + ]) + case "$gl_cv_func_c32rtomb_retval" in + *yes) ;; + *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1], + [Define if the c32rtomb function has an incorrect return value.]) + REPLACE_C32RTOMB=1 ;; + esac + if test $HAVE_WORKING_C32RTOMB = 0; then + REPLACE_C32RTOMB=1 + fi + fi +]) + +AC_DEFUN([gl_CHECK_FUNC_C32RTOMB], +[ + dnl Cf. gl_CHECK_FUNCS_ANDROID + AC_CHECK_DECL([c32rtomb], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) + if test $ac_cv_have_decl_c32rtomb = yes; then + dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a + dnl static inline function on Haiku 2020. + AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], + [[char buf[8]; + return c32rtomb (buf, 0, NULL) == 0; + ]]) + ], + [gl_cv_func_c32rtomb=yes], + [gl_cv_func_c32rtomb=no]) + ]) + else + gl_cv_func_c32rtomb=no + fi +]) + +dnl Test whether c32rtomb works not worse than wcrtomb. +dnl Result is HAVE_WORKING_C32RTOMB. + +AC_DEFUN([gl_C32RTOMB_SANITYCHECK], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb = no; then + HAVE_WORKING_C32RTOMB=0 + else + AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb], + [gl_cv_func_c32rtomb_sanitycheck], + [ + 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 derivatives. + solaris*) + if test -f /etc/release && grep 'Oracle Solaris' /etc/release >/dev/null; then + gl_cv_func_c32rtomb_sanitycheck="guessing yes" + else + gl_cv_func_c32rtomb_sanitycheck="guessing no" + fi + ;; + # Guess yes otherwise. + *) + gl_cv_func_c32rtomb_sanitycheck="guessing yes" + ;; + esac +changequote([,])dnl + if test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + /* This fails on Solaris 11 OmniOS: + c32rtomb returns (size_t)-1. + wcrtomb returns 4 (correct). */ + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + char buf[16]; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4 + && wcrtomb (buf, wc, NULL) == 4 + && memcmp (buf, "\201\060\211\070", 4) == 0) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4 + && c32rtomb (buf, c32, NULL) != 4) + result |= 1; + } + } + return result; +}]])], + [gl_cv_func_c32rtomb_sanitycheck=yes], + [gl_cv_func_c32rtomb_sanitycheck=no], + [:]) + fi + ]) + case "$gl_cv_func_c32rtomb_sanitycheck" in + *yes) + HAVE_WORKING_C32RTOMB=1 + AC_DEFINE([HAVE_WORKING_C32RTOMB], [1], + [Define if the c32rtomb function basically works.]) + ;; + *) HAVE_WORKING_C32RTOMB=0 ;; + esac + fi + AC_SUBST([HAVE_WORKING_C32RTOMB]) +]) diff --git a/gl/m4/calloc.m4 b/gl/m4/calloc.m4 index 550cf5cc..ac7d08d4 100644 --- a/gl/m4/calloc.m4 +++ b/gl/m4/calloc.m4 @@ -1,9 +1,10 @@ # calloc.m4 -# serial 31 -dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. +# serial 36 +dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Written by Jim Meyering. @@ -12,42 +13,35 @@ dnl with or without modifications, as long as this notice is preserved. # If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc # and arrange to use a calloc wrapper function that does work in that case. -# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) -# ------------------------------------- +# gl_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) +# --------------------------------------- # If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. -AC_DEFUN([_AC_FUNC_CALLOC_IF], +AC_DEFUN([gl_FUNC_CALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], - [ac_cv_func_calloc_0_nonnull], - [if test $cross_compiling != yes; then - ac_cv_func_calloc_0_nonnull=yes - AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [AC_INCLUDES_DEFAULT], - [[int result = 0; - char * volatile p = calloc (0, 0); - if (!p) - result |= 1; - free (p); - return result; - ]])], - [], - [ac_cv_func_calloc_0_nonnull=no]) - else - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; - # Guess yes on musl systems. - *-musl* | 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 - ]) - AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) + [gl_cv_func_calloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + /* Use pcalloc to test; "volatile" prevents the compiler + from optimizing the calloc call away. */ + void *(*volatile pcalloc) (size_t, size_t) = calloc;]], + [[void *p = pcalloc (0, 0); + int result = !p; + free (p); + return result;]])], + [gl_cv_func_calloc_0_nonnull=yes], + [gl_cv_func_calloc_0_nonnull=no], + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], + [gl_cv_func_calloc_0_nonnull="guessing yes"], + [# If we don't know, obey --enable-cross-guesses. + gl_cv_func_calloc_0_nonnull="$gl_cross_guess_normal"])])]) + AS_CASE([$gl_cv_func_calloc_0_nonnull], [*yes], [$1], [$2]) ]) @@ -58,9 +52,14 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This helps + dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. + REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then - _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) + gl_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) fi ])# gl_FUNC_CALLOC_GNU @@ -73,9 +72,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then - REPLACE_CALLOC_FOR_CALLOC_POSIX=1 - fi + REPLACE_CALLOC_FOR_CALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX dnl Although in theory we should also test for size_t overflow, dnl in practice testing for ptrdiff_t overflow suffices dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. diff --git a/gl/m4/close.m4 b/gl/m4/close.m4 index 88c37fab..314e321e 100644 --- a/gl/m4/close.m4 +++ b/gl/m4/close.m4 @@ -1,9 +1,10 @@ # close.m4 # serial 10 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_CLOSE], [ diff --git a/gl/m4/codeset.m4 b/gl/m4/codeset.m4 index e69b7402..6bed9dee 100644 --- a/gl/m4/codeset.m4 +++ b/gl/m4/codeset.m4 @@ -1,10 +1,11 @@ # codeset.m4 # serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software +dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2025 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 This file is offered as-is, without any warranty. dnl From Bruno Haible. diff --git a/gl/m4/double-slash-root.m4 b/gl/m4/double-slash-root.m4 index 3437c699..5c40b73c 100644 --- a/gl/m4/double-slash-root.m4 +++ b/gl/m4/double-slash-root.m4 @@ -1,9 +1,10 @@ # double-slash-root.m4 # serial 4 -*- Autoconf -*- -dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_DOUBLE_SLASH_ROOT], [ diff --git a/gl/m4/dup2.m4 b/gl/m4/dup2.m4 index 786121fd..5da3a0b9 100644 --- a/gl/m4/dup2.m4 +++ b/gl/m4/dup2.m4 @@ -1,9 +1,10 @@ # dup2.m4 # serial 28 -dnl Copyright (C) 2002, 2005, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_DUP2], [ diff --git a/gl/m4/eealloc.m4 b/gl/m4/eealloc.m4 deleted file mode 100644 index 8a15e705..00000000 --- a/gl/m4/eealloc.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# 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. - -AC_DEFUN([gl_EEALLOC], -[ - AC_REQUIRE([gl_EEMALLOC]) - AC_REQUIRE([gl_EEREALLOC]) -]) - -AC_DEFUN([gl_EEMALLOC], -[ - _AC_FUNC_MALLOC_IF( - [gl_cv_func_malloc_0_nonnull=1], - [gl_cv_func_malloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], - [If malloc(0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) - -AC_DEFUN([gl_EEREALLOC], -[ - _AC_FUNC_REALLOC_IF( - [gl_cv_func_realloc_0_nonnull=1], - [gl_cv_func_realloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], - [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) diff --git a/gl/m4/environ.m4 b/gl/m4/environ.m4 index 107960b2..e0690e54 100644 --- a/gl/m4/environ.m4 +++ b/gl/m4/environ.m4 @@ -1,9 +1,10 @@ # environ.m4 # serial 8 -dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_ENVIRON], [ diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index b6050e5d..420d5bb3 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 @@ -1,15 +1,21 @@ # errno_h.m4 -# serial 14 -dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.61]) AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], [ AC_REQUIRE([AC_PROG_CC]) + + dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT + dnl gets defined already before this macro gets invoked. This persuades + dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST. + AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_EGREP_CPP([booboo],[ #include @@ -63,6 +69,9 @@ booboo #endif #if !defined EILSEQ booboo +#endif +#if !defined ESOCKTNOSUPPORT +booboo #endif ], [gl_cv_header_errno_h_complete=no], diff --git a/gl/m4/error.m4 b/gl/m4/error.m4 index 273b636b..1572250a 100644 --- a/gl/m4/error.m4 +++ b/gl/m4/error.m4 @@ -1,9 +1,11 @@ # error.m4 # serial 16 -dnl Copyright (C) 1996-1998, 2001-2004, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1996-1998, 2001-2004, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_ERROR], [ diff --git a/gl/m4/error_h.m4 b/gl/m4/error_h.m4 index 050a410c..4ef5cbff 100644 --- a/gl/m4/error_h.m4 +++ b/gl/m4/error_h.m4 @@ -1,9 +1,10 @@ # error_h.m4 -# serial 4 -dnl Copyright (C) 1996-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 1996-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Provide a working . @@ -111,12 +112,15 @@ AC_DEFUN_ONCE([gl_ERROR_H], 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 + m4_ifdef([gl_HAVE_MODULE_VERROR], + [COMPILE_ERROR_C=1], + [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]) diff --git a/gl/m4/exponentd.m4 b/gl/m4/exponentd.m4 index db597afc..08e93397 100644 --- a/gl/m4/exponentd.m4 +++ b/gl/m4/exponentd.m4 @@ -1,9 +1,10 @@ # exponentd.m4 -# serial 4 -dnl Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], [ AC_CACHE_CHECK([where to find the exponent in a 'double'], @@ -84,7 +85,7 @@ int main () dnl The newer VFP instructions assume little-endian order dnl consistently. AC_EGREP_CPP([mixed_endianness], [ -#if defined arm || defined __arm || defined __arm__ +#if defined __arm__ mixed_endianness #endif ], diff --git a/gl/m4/extensions-aix.m4 b/gl/m4/extensions-aix.m4 new file mode 100644 index 00000000..08b703b4 --- /dev/null +++ b/gl/m4/extensions-aix.m4 @@ -0,0 +1,26 @@ +# extensions-aix.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +# On AIX, most extensions are already enabled through the _ALL_SOURCE macro, +# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally +# activates more GNU and Linux-like behaviours, affecting +# - the time_t type, +# - errno values in : ENOTEMPTY +# - functions in : malloc calloc realloc valloc +# +# - functions in : strerror_r (returns 'char *', like glibc) +# - functions in : scandir, alphasort, readdir_r +# - functions in : gethostbyname_r gethostbyaddr_r +# - declarations in : sbrk +# and a couple of secondary header files. + +AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS], +[ + AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], + [Define so that AIX headers are more compatible with GNU/Linux.]) +]) diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 1fb68956..76516bce 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 @@ -1,9 +1,10 @@ # extensions.m4 # serial 25 -*- Autoconf -*- -dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Enable extensions on systems that normally disable them. diff --git a/gl/m4/extern-inline.m4 b/gl/m4/extern-inline.m4 index 547da82a..d4fe6d82 100644 --- a/gl/m4/extern-inline.m4 +++ b/gl/m4/extern-inline.m4 @@ -1,9 +1,10 @@ # extern-inline.m4 # serial 1 -dnl Copyright 2012-2024 Free Software Foundation, Inc. +dnl Copyright 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl 'extern inline' a la ISO C99. diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4 index 0c1358ed..cfb92e28 100644 --- a/gl/m4/fclose.m4 +++ b/gl/m4/fclose.m4 @@ -1,9 +1,10 @@ # fclose.m4 # serial 12 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_FCLOSE], [ diff --git a/gl/m4/fcntl-o.m4 b/gl/m4/fcntl-o.m4 index 43aa1325..8020c481 100644 --- a/gl/m4/fcntl-o.m4 +++ b/gl/m4/fcntl-o.m4 @@ -1,15 +1,17 @@ # fcntl-o.m4 -# serial 8 -dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc. +# serial 12 +dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Paul Eggert. AC_PREREQ([2.60]) -# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. +# Test whether the flags O_DIRECTORY, O_NOATIME and O_NOFOLLOW actually work. +# Define HAVE_WORKING_O_DIRECTORY to 1 if O_DIRECTORY works, or to 0 otherwise. # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. AC_DEFUN([gl_FCNTL_O_FLAGS], @@ -30,16 +32,23 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], #else /* on Windows with MSVC */ # include # include - # defined sleep(n) _sleep ((n) * 1000) + # define sleep(n) _sleep ((n) * 1000) #endif + #include #include ]GL_MDA_DEFINES[ + #ifndef O_DIRECTORY + #define O_DIRECTORY 0 + #endif #ifndef O_NOATIME #define O_NOATIME 0 #endif #ifndef O_NOFOLLOW #define O_NOFOLLOW 0 #endif + #ifndef O_SEARCH + #define O_SEARCH O_RDONLY + #endif static int const constants[] = { O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, @@ -52,30 +61,37 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], { static char const sym[] = "conftest.sym"; if (symlink ("/dev/null", sym) != 0) - result |= 2; + result |= 1; else { int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); if (fd >= 0) { close (fd); - result |= 4; + result |= 3; } } if (unlink (sym) != 0 || symlink (".", sym) != 0) - result |= 2; + result |= 1; else { int fd = open (sym, O_RDONLY | O_NOFOLLOW); if (fd >= 0) { close (fd); - result |= 4; + result |= 3; } } unlink (sym); } #endif + { + int fd = open ("confdefs.h", O_SEARCH | O_DIRECTORY); + if (!(fd < 0 && errno == ENOTDIR)) + result |= 4; + if (0 <= fd) + close (fd); + } { static char const file[] = "confdefs.h"; int fd = open (file, O_RDONLY | O_NOATIME); @@ -111,31 +127,46 @@ AC_DEFUN([gl_FCNTL_O_FLAGS], } return result;]])], [gl_cv_header_working_fcntl_h=yes], - [case $? in #( - 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( - 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( - 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( - *) gl_cv_header_working_fcntl_h='no';; - esac], - [case "$host_os" in - # Guess 'no' on native Windows. - mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; - *) gl_cv_header_working_fcntl_h=cross-compiling ;; - esac - ]) - ]) + [AS_CASE([$?], + dnl We cannot catch exit code 1 or 2 here, because + dnl - exit code 1 can occur through a compilation error on mingw (e.g. + dnl when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when + dnl result = 1, whereas + dnl - exit code 2 can occur through a compilation error on MSVC (e.g. + dnl again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when + dnl result = 2. + [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"], + [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"], + [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"], + [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"], + [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"], + [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"], + [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"], + [gl_cv_header_working_fcntl_h="no"])], + [AS_CASE([$host_os,$gl_cross_guess_normal], + # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007) + # (see ) + # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009). + # Guess it fails on Mac OS X 10.4.x and earlier. + [darwin[[0-8]].*yes], + [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"], + # Known to be "no" on native MS-Windows. + [mingw* | windows*], + [gl_cv_header_working_fcntl_h=no], + [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])]) + + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val], + [Define to 1 if O_DIRECTORY works, 0 otherwise.]) - case $gl_cv_header_working_fcntl_h in #( - *O_NOATIME* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], - [Define to 1 if O_NOATIME works.]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_NOATIME* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val], + [Define to 1 if O_NOATIME works, 0 otherwise.]) - case $gl_cv_header_working_fcntl_h in #( - *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( - *) ac_val=1;; - esac - AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], - [Define to 1 if O_NOFOLLOW works.]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1]) + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val], + [Define to 1 if O_NOFOLLOW works, 0 otherwise.]) ]) diff --git a/gl/m4/fcntl.m4 b/gl/m4/fcntl.m4 index f6d0f377..08ab936f 100644 --- a/gl/m4/fcntl.m4 +++ b/gl/m4/fcntl.m4 @@ -1,9 +1,10 @@ # fcntl.m4 # serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # For now, this module ensures that fcntl() # - supports F_DUPFD correctly diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index b69f7a0c..1c9f9cce 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 @@ -1,9 +1,10 @@ # fcntl_h.m4 # serial 20 -dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure fcntl.h. diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4 index 43fc3bf3..399065b6 100644 --- a/gl/m4/fflush.m4 +++ b/gl/m4/fflush.m4 @@ -1,9 +1,10 @@ # fflush.m4 -# serial 19 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Eric Blake @@ -79,8 +80,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* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; + # Guess no on NetBSD, OpenBSD, native Windows. + netbsd* | openbsd* | mingw* | windows*) + gl_cv_func_fflush_stdin="guessing no" ;; *) gl_cv_func_fflush_stdin=cross ;; esac ]) @@ -92,8 +94,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN], *) gl_func_fflush_stdin='(-1)' ;; esac AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], - [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, - 0 if fflush is known to not work, -1 if unknown.]) + [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008 + or later, 0 if fflush is known to not work, -1 if unknown.]) ]) # Prerequisites of lib/fflush.c. diff --git a/gl/m4/float_h.m4 b/gl/m4/float_h.m4 index c95d4171..8580c9c9 100644 --- a/gl/m4/float_h.m4 +++ b/gl/m4/float_h.m4 @@ -1,9 +1,10 @@ # float_h.m4 -# serial 14 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FLOAT_H], [ @@ -54,6 +55,31 @@ changequote([,])dnl ;; esac + dnl Test for completeness w.r.t. ISO C 23. + REPLACE_FLOAT_SNAN=0 + AC_CACHE_CHECK([whether float.h conforms to ISO C23], + [gl_cv_header_float_h_isoc23], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG }; + float maxf = FLT_NORM_MAX; + double maxd = DBL_NORM_MAX; + long double maxl = LDBL_NORM_MAX; + ]], + [[float sf = FLT_SNAN; + double sd = DBL_SNAN; + long double sl = LDBL_SNAN; + return (sf != 0) + (sd != 0) + (sl != 0); + ]])], + [gl_cv_header_float_h_isoc23=yes], + [gl_cv_header_float_h_isoc23=no]) + ]) + if test $gl_cv_header_float_h_isoc23 != yes; then + GL_GENERATE_FLOAT_H=true + REPLACE_FLOAT_SNAN=1 + fi + dnl Test against glibc-2.7 Linux/SPARC64 bug. REPLACE_ITOLD=0 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index 2572c848..cb75fce9 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 @@ -1,9 +1,10 @@ # floorf.m4 # serial 21 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FLOORF], [ diff --git a/gl/m4/fopen.m4 b/gl/m4/fopen.m4 index f3b7aadd..e27b3270 100644 --- a/gl/m4/fopen.m4 +++ b/gl/m4/fopen.m4 @@ -1,9 +1,10 @@ # fopen.m4 # serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FOPEN_ITSELF], [ diff --git a/gl/m4/fpurge.m4 b/gl/m4/fpurge.m4 index a77f5b96..408a2579 100644 --- a/gl/m4/fpurge.m4 +++ b/gl/m4/fpurge.m4 @@ -1,65 +1,65 @@ # fpurge.m4 -# serial 14 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 16 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FPURGE], [ AC_REQUIRE([gl_STDIO_H_DEFAULTS]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_HEADERS_ONCE([stdio_ext.h]) 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 + if test $ac_cv_func_fpurge = yes; then HAVE_FPURGE=1 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include -]], - [[FILE *f = fopen ("conftest.txt", "w+"); - if (!f) - return 1; - if (fputc ('a', f) != 'a') - { fclose (f); return 2; } - rewind (f); - if (fgetc (f) != 'a') - { fclose (f); return 3; } - if (fgetc (f) != EOF) - { fclose (f); return 4; } - if (fpurge (f) != 0) - { fclose (f); return 5; } - if (putc ('b', f) != 'b') - { fclose (f); return 6; } - if (fclose (f) != 0) - return 7; - if ((f = fopen ("conftest.txt", "r")) == NULL) - return 8; - if (fgetc (f) != 'a') - { fclose (f); return 9; } - if (fgetc (f) != 'b') - { fclose (f); return 10; } - if (fgetc (f) != EOF) - { fclose (f); return 11; } - if (fclose (f) != 0) - return 12; - if (remove ("conftest.txt") != 0) - return 13; - return 0; - ]])], - [gl_cv_func_fpurge_works=yes], - [gl_cv_func_fpurge_works=no], - [case "$host_os" in - # 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 - ]) + [if test $ac_cv_have_decl_fpurge = yes; then + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[FILE *f = fopen ("conftest.txt", "w+"); + if (!f) + return 1; + if (fputc ('a', f) != 'a') + { fclose (f); return 2; } + rewind (f); + if (fgetc (f) != 'a') + { fclose (f); return 3; } + if (fgetc (f) != EOF) + { fclose (f); return 4; } + if (fpurge (f) != 0) + { fclose (f); return 5; } + if (putc ('b', f) != 'b') + { fclose (f); return 6; } + if (fclose (f) != 0) + return 7; + if ((f = fopen ("conftest.txt", "r")) == NULL) + return 8; + if (fgetc (f) != 'a') + { fclose (f); return 9; } + if (fgetc (f) != 'b') + { fclose (f); return 10; } + if (fgetc (f) != EOF) + { fclose (f); return 11; } + if (fclose (f) != 0) + return 12; + if (remove ("conftest.txt") != 0) + return 13; + return 0; + ]])], + [gl_cv_func_fpurge_works=yes], + [gl_cv_func_fpurge_works=no], + [# Obey --enable-cross-guesses. + gl_cv_func_fpurge_works="$gl_cross_guess_normal" + ]) + else + gl_cv_func_fpurge_works=no + fi ]) case "$gl_cv_func_fpurge_works" in *yes) ;; diff --git a/gl/m4/freading.m4 b/gl/m4/freading.m4 index be899456..373d2bff 100644 --- a/gl/m4/freading.m4 +++ b/gl/m4/freading.m4 @@ -1,9 +1,10 @@ # freading.m4 # serial 3 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FREADING], [ diff --git a/gl/m4/free.m4 b/gl/m4/free.m4 index a2b596d6..485d8243 100644 --- a/gl/m4/free.m4 +++ b/gl/m4/free.m4 @@ -1,9 +1,10 @@ # free.m4 # serial 6 -dnl Copyright (C) 2003-2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Written by Paul Eggert and Bruno Haible. diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4 index fb220a1f..ce728f60 100644 --- a/gl/m4/fseek.m4 +++ b/gl/m4/fseek.m4 @@ -1,9 +1,10 @@ # fseek.m4 # serial 4 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSEEK], [ diff --git a/gl/m4/fseeko.m4 b/gl/m4/fseeko.m4 index 5682a1f2..c093d399 100644 --- a/gl/m4/fseeko.m4 +++ b/gl/m4/fseeko.m4 @@ -1,9 +1,10 @@ # fseeko.m4 -# serial 20 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 21 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSEEKO], [ @@ -69,6 +70,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET], # Prerequisites of lib/fseeko.c. AC_DEFUN([gl_PREREQ_FSEEKO], [ + if test $gl_cv_func_fseeko != no; then + AC_DEFINE([HAVE_FSEEKO], [1], + [Define to 1 if the system has the fseeko function.]) + fi dnl Native Windows has the function _fseeki64. mingw hides it in some dnl circumstances, but mingw64 makes it usable again. AC_CHECK_FUNCS([_fseeki64]) diff --git a/gl/m4/fseterr.m4 b/gl/m4/fseterr.m4 new file mode 100644 index 00000000..3a94c288 --- /dev/null +++ b/gl/m4/fseterr.m4 @@ -0,0 +1,15 @@ +# fseterr.m4 +# serial 2 +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_FSETERR], +[ + gl_CHECK_FUNCS_ANDROID([__fseterr], + [[#include + #include + ]]) +]) diff --git a/gl/m4/fstat.m4 b/gl/m4/fstat.m4 index 47777b0c..e89bbc32 100644 --- a/gl/m4/fstat.m4 +++ b/gl/m4/fstat.m4 @@ -1,9 +1,10 @@ # fstat.m4 # serial 10 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FSTAT], [ diff --git a/gl/m4/fstypename.m4 b/gl/m4/fstypename.m4 index 05a68805..4407b765 100644 --- a/gl/m4/fstypename.m4 +++ b/gl/m4/fstypename.m4 @@ -1,10 +1,11 @@ # fstypename.m4 # serial 6 -dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software +dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2025 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 This file is offered as-is, without any warranty. dnl From Jim Meyering. dnl diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 1ce90660..bb7b6e43 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 @@ -1,9 +1,11 @@ # fsusage.m4 # serial 35 -dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-1998, 2000-2001, 2003-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Obtaining file system usage information. diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4 index ab10736b..d5610b70 100644 --- a/gl/m4/ftell.m4 +++ b/gl/m4/ftell.m4 @@ -1,9 +1,10 @@ # ftell.m4 # serial 3 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FTELL], [ diff --git a/gl/m4/ftello.m4 b/gl/m4/ftello.m4 index 0eb8fa0d..35d30f98 100644 --- a/gl/m4/ftello.m4 +++ b/gl/m4/ftello.m4 @@ -1,9 +1,10 @@ # ftello.m4 -# serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 17 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_FTELLO], [ @@ -157,6 +158,10 @@ main (void) # Prerequisites of lib/ftello.c. AC_DEFUN([gl_PREREQ_FTELLO], [ + if test $gl_cv_func_ftello != no; then + AC_DEFINE([HAVE_FTELLO], [1], + [Define to 1 if the system has the ftello function.]) + fi dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 dnl makes it usable again. AC_CHECK_FUNCS([_ftelli64]) diff --git a/gl/m4/getaddrinfo.m4 b/gl/m4/getaddrinfo.m4 index 8e209177..2931d526 100644 --- a/gl/m4/getaddrinfo.m4 +++ b/gl/m4/getaddrinfo.m4 @@ -1,14 +1,16 @@ # getaddrinfo.m4 -# serial 35 -dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. +# serial 38 +dnl Copyright (C) 2004-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_GETADDRINFO], [ AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H + AC_REQUIRE([AC_CANONICAL_HOST]) GETADDRINFO_LIB= gai_saved_LIBS="$LIBS" @@ -87,6 +89,46 @@ int getaddrinfo (const char *, const char *, const struct addrinfo *, struct add HAVE_GETADDRINFO=0 fi fi + if test $HAVE_GETADDRINFO != 0; then + AC_CACHE_CHECK([whether getaddrinfo supports AI_NUMERICSERV], + [gl_cv_func_getaddrinfo_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +#include +#include + ]], [[ + struct addrinfo hints; + struct addrinfo *ai; + memset (&hints, 0, sizeof (hints)); + hints.ai_flags = AI_NUMERICSERV; + return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME; + ]]) + ], + [gl_cv_func_getaddrinfo_works=yes], + [gl_cv_func_getaddrinfo_works=no], + [case "$host_os" in + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_getaddrinfo_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_getaddrinfo_works" in + *yes) ;; + *) REPLACE_GETADDRINFO=1 ;; + esac + fi AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4 index 61139039..63d88306 100644 --- a/gl/m4/getdelim.m4 +++ b/gl/m4/getdelim.m4 @@ -1,11 +1,12 @@ # getdelim.m4 # serial 19 -dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2025 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, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.59]) diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4 index aaefe9b2..112c1c4d 100644 --- a/gl/m4/getdtablesize.m4 +++ b/gl/m4/getdtablesize.m4 @@ -1,9 +1,10 @@ # getdtablesize.m4 # serial 8 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_GETDTABLESIZE], [ diff --git a/gl/m4/gethostname.m4 b/gl/m4/gethostname.m4 index 2f743b7d..be71ff78 100644 --- a/gl/m4/gethostname.m4 +++ b/gl/m4/gethostname.m4 @@ -1,9 +1,10 @@ # gethostname.m4 # serial 16 -dnl Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Ensure # - the gethostname() function, diff --git a/gl/m4/getline.m4 b/gl/m4/getline.m4 index 36513cd4..b97b8011 100644 --- a/gl/m4/getline.m4 +++ b/gl/m4/getline.m4 @@ -1,12 +1,13 @@ # getline.m4 # serial 33 -dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 1998-2003, 2005-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.59]) diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4 index 0918bcd2..8ab613db 100644 --- a/gl/m4/getloadavg.m4 +++ b/gl/m4/getloadavg.m4 @@ -1,10 +1,11 @@ # getloadavg.m4 # serial 13 -dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software -dnl Foundation, Inc. +dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2025 Free +dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for getloadavg. diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4 index 297722ea..cb344c15 100644 --- a/gl/m4/getopt.m4 +++ b/gl/m4/getopt.m4 @@ -1,9 +1,10 @@ # getopt.m4 -# serial 49 -dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. +# serial 50 +dnl Copyright (C) 2002-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Request a POSIX compliant getopt function. AC_DEFUN([gl_FUNC_GETOPT_POSIX], @@ -77,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS], fi dnl POSIX 2008 does not specify leading '+' behavior, but see - dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on + dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on dnl the next version of POSIX. For now, we only guarantee leading '+' dnl behavior with getopt-gnu. if test -z "$gl_replace_getopt"; then @@ -366,14 +367,7 @@ dnl is ambiguous with environment values that contain newlines. AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], [ - AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) - if test $ac_cv_header_sys_cdefs_h = yes; then - HAVE_SYS_CDEFS_H=1 - else - HAVE_SYS_CDEFS_H=0 - fi - AC_SUBST([HAVE_SYS_CDEFS_H]) - + gl_CHECK_HEADER_SYS_CDEFS_H AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], [Define to rpl_ if the getopt replacement functions and variables should be used.]) diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4 index b24f4480..90f34c74 100644 --- a/gl/m4/getprogname.m4 +++ b/gl/m4/getprogname.m4 @@ -1,9 +1,10 @@ # getprogname.m4 # serial 8 -dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for getprogname or replacements for it diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4 index c5e1f7ba..3cfea50f 100644 --- a/gl/m4/gl-openssl.m4 +++ b/gl/m4/gl-openssl.m4 @@ -1,9 +1,10 @@ # gl-openssl.m4 # serial 7 -dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2013-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], [ diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index fcf84226..6a6e8593 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 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 cb730449..034dae69 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 @@ -1,9 +1,10 @@ # gnulib-common.m4 -# serial 93 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 113 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.62]) @@ -19,44 +20,62 @@ AC_DEFUN([gl_COMMON_BODY], [ AH_VERBATIM([0witness], [/* Witness that has been included. */ #define _GL_CONFIG_H_INCLUDED 1 +]) + dnl Avoid warnings from gcc -Wtrailing-whitespace. + dnl This is a temporary workaround until Autoconf fixes it. + dnl Test case: + dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...]) + dnl should produce "#define FOO /**/", not "#define FOO ". + AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wtrailing-whitespace" +#endif +]) + AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__ +# pragma GCC diagnostic pop +#endif ]) AH_VERBATIM([_GL_GNUC_PREREQ], -[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ -#if defined __GNUC__ && defined __GNUC_MINOR__ +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. + Except that + - clang groks GNU C 4.2, even on Windows, where it does not define + __GNUC__. + - The OpenMandriva-modified clang compiler pretends that it groks + GNU C version 13.1, but it doesn't: It does not support + __attribute__ ((__malloc__ (f, i))), nor does it support + __attribute__ ((__warning__ (message))) on a function redeclaration. + - Users can make clang lie as well, through the -fgnuc-version option. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__ # define _GL_GNUC_PREREQ(major, minor) \ ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#elif defined __clang__ + /* clang really only groks GNU C 4.2. */ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < 4 + ((minor) <= 2)) #else # define _GL_GNUC_PREREQ(major, minor) 0 #endif ]) AH_VERBATIM([_Noreturn], -[/* The _Noreturn keyword of C11. */ +[/* The _Noreturn keyword of C11. + Do not use [[noreturn]], because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would be valid only with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. So even though C23 deprecates _Noreturn, + it is currently more portable to prefer it to [[noreturn]]. + + Also, do not try to work around LLVM bug 59792 (clang 15 or earlier). + This rare bug can be worked around by compiling with 'clang -D_Noreturn=', + though the workaround may generate many false-alarm warnings. */ #ifndef _Noreturn -# if (defined __cplusplus \ - && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ - || (defined _MSC_VER && 1900 <= _MSC_VER)) \ - && 0) - /* [[noreturn]] is not practically usable, because with it the syntax - extern _Noreturn void func (...); - would not be valid; such a declaration would only be valid with 'extern' - and '_Noreturn' swapped, or without the 'extern' keyword. However, some - AIX system header files and several gnulib header files use precisely - this syntax with 'extern'. */ -# define _Noreturn [[noreturn]] -# elif (defined __clang__ && __clang_major__ < 16 \ - && defined _GL_WORK_AROUND_LLVM_BUG_59792) - /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around - that rare LLVM bug, though you may get many false-alarm warnings. */ -# define _Noreturn -# elif ((!defined __cplusplus || defined __clang__) \ - && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ - || (!defined __STRICT_ANSI__ \ - && (_GL_GNUC_PREREQ (4, 7) \ - || (defined __apple_build_version__ \ - ? 6000000 <= __apple_build_version__ \ - : 3 < __clang_major__ + (5 <= __clang_minor__)))))) +# if ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0))) /* _Noreturn works as-is. */ # elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C + /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the + latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */ # define _Noreturn __attribute__ ((__noreturn__)) # elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) # define _Noreturn __declspec (noreturn) @@ -90,6 +109,9 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) # else # define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +/* The following lines list the first GCC version that supports the attribute. + Although the lines are not used in GCC 5 and later (as GCC 5 introduced + __has_attribute support), list GCC versions 5+ anyway for completeness. */ # 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) @@ -110,12 +132,15 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif # define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) # define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1) # 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_reproducible _GL_GNUC_PREREQ (15, 1) # define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) # define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1) # define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) # define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) # endif @@ -131,6 +156,23 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAVE___HAS_C_ATTRIBUTE 0 #endif +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in function declarations. There are two problems here. + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration + in any order. + =========================== foo.c = foo.cc =========================== + __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int); + [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int); + ====================================================================== + This gives a syntax error + - in C mode with gcc + , and + - in C++ mode with clang++ version < 16, and + - in C++ mode, inside extern "C" {}, still in newer clang++ versions + . + */ /* 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 @@ -145,6 +187,176 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_BRACKET_BEFORE_ATTRIBUTE 1 # endif #endif +/* + 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration + - without 'extern', in C as well as in C++, + - with 'extern', in C, + - with 'extern "C"', in C++ + in the same position. That is, we don't want to be forced to use a + macro which arranges for the attribute to come before 'extern' in + one case and after 'extern' in the other case, because such a macro + would make the source code of .h files pretty ugly. + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define ND [[__nodiscard__]] + #define WUR __attribute__((__warn_unused_result__)) + + #ifdef __cplusplus + extern "C" { + #endif + // gcc clang g++ clang++ + + ND int foo (int); + int ND foo (int); // warn error warn error + int foo ND (int); + int foo (int) ND; // warn error warn error + + WUR int foo (int); + int WUR foo (int); + int fo1 WUR (int); // error error error error + int foo (int) WUR; + + #ifdef __cplusplus + } + #endif + + // gcc clang g++ clang++ + + ND extern CC int foo (int); // error error + extern CC ND int foo (int); // error error + extern CC int ND foo (int); // warn error warn error + extern CC int foo ND (int); + extern CC int foo (int) ND; // warn error warn error + + WUR extern CC int foo (int); // warn + extern CC WUR int foo (int); + extern CC int WUR foo (int); + extern CC int foo WUR (int); // error error error error + extern CC int foo (int) WUR; + + ND EXTERN_C_FUNC int foo (int); // error error + EXTERN_C_FUNC ND int foo (int); + EXTERN_C_FUNC int ND foo (int); // warn error warn error + EXTERN_C_FUNC int foo ND (int); + EXTERN_C_FUNC int foo (int) ND; // warn error warn error + + WUR EXTERN_C_FUNC int foo (int); // warn + EXTERN_C_FUNC WUR int foo (int); + EXTERN_C_FUNC int WUR foo (int); + EXTERN_C_FUNC int fo2 WUR (int); // error error error error + EXTERN_C_FUNC int foo (int) WUR; + ====================================================================== + So, if we insist on using the 'extern' keyword ('extern CC' idiom): + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there is one available position: + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is no available position: + it would need to come before 'extern' in C but after 'extern "C"' + in C++. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally + omits the 'extern' keyword: + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] + in both C and C++, there are two available positions: + - before the return type, + - between the function name and the parameter list. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax + in both C and C++, there are several available positions: + - before the return type, + - between return type and function name, + - at the end of the declaration. + * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to + __attribute__((...)) syntax in C++, there is one available position: + - before the return type. + * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and + to bracket syntax [[...]] in C++, there is one available position: + - before the return type. + The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and + put the attributes before the return type. This works regardless + to what the _GL_ATTRIBUTE_* macros expand. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in static/inline function definitions. + + There are similar constraints as for function declarations. However, here, + we cannot omit the storage-class specifier. Therefore, the following rule + applies: + * The macros + _GL_ATTRIBUTE_CONST + _GL_ATTRIBUTE_DEPRECATED + _GL_ATTRIBUTE_MAYBE_UNUSED + _GL_ATTRIBUTE_NODISCARD + _GL_ATTRIBUTE_PURE + _GL_ATTRIBUTE_REPRODUCIBLE + _GL_ATTRIBUTE_UNSEQUENCED + which may expand to bracket syntax [[...]], must come first, before the + storage-class specifier. + * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax, + are better placed between the storage-class specifier and the return + type. + */ + +/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...)) + syntax, in variable declarations. + + At which position can they be placed? + (Last tested with gcc/g++ 14 and clang/clang++ 18.) + + =========================== foo.c = foo.cc =========================== + #ifdef __cplusplus + # define CC "C" + #else + # define CC + #endif + + #define BD [[__deprecated__]] + #define AD __attribute__ ((__deprecated__)) + + // gcc clang g++ clang++ + + BD extern CC int var; // error error + extern CC BD int var; // error error + extern CC int BD var; // warn error warn error + extern CC int var BD; + + AD extern CC int var; // warn + extern CC AD int var; + extern CC int AD var; + extern CC int var AD; + + BD extern CC int z[]; // error error + extern CC BD int z[]; // error error + extern CC int BD z[]; // warn error warn error + extern CC int z1 BD []; + extern CC int z[] BD; // warn error error + + AD extern CC int z[]; // warn + extern CC AD int z[]; + extern CC int AD z[]; + extern CC int z2 AD []; // error error error error + extern CC int z[] AD; + ====================================================================== + + * For non-array variables, the only good position is after the variable name, + that is, at the end of the declaration. + * For array variables, you will need to distinguish C and C++: + - In C, before the 'extern' keyword. + - In C++, between the 'extern "C"' and the variable's type. + */ ]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. [ /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function @@ -152,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [ _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied by the Nth argument of the function is the size of the returned memory block. */ -/* Applies to: function, pointer to function, function types. */ +/* Applies to: functions, pointer to functions, function types. */ #ifndef _GL_ATTRIBUTE_ALLOC_SIZE # if _GL_HAS_ATTRIBUTE (alloc_size) # define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) @@ -163,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the function and report an error if it cannot do so. */ -/* Applies to: function. */ +/* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_ALWAYS_INLINE # if _GL_HAS_ATTRIBUTE (always_inline) # define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) @@ -175,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [ /* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show in stack traces when debugging. The compiler should omit the function from stack traces. */ -/* Applies to: function. */ +/* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_ARTIFICIAL # if _GL_HAS_ATTRIBUTE (artificial) # define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) @@ -201,18 +413,23 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif -/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate - calls to the function with the same arguments. - This attribute is safe for a function that neither depends on nor affects - observable state, and always returns exactly once - e.g., does not loop - forever, and does not call longjmp. - (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ +/* _GL_ATTRIBUTE_CONST declares: + It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used. + This attribute is safe for a function that neither depends on + nor affects state, and always returns exactly once - + e.g., does not raise an exception, call longjmp, or loop forever. + (This attribute is stricter than _GL_ATTRIBUTE_PURE because the + function cannot observe state. It is stricter than + _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly + once and cannot depend on state addressed by its arguments.) */ /* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_CONST # if _GL_HAS_ATTRIBUTE (const) # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) # else -# define _GL_ATTRIBUTE_CONST +# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED # endif #endif @@ -460,6 +677,17 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif +/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP + (a pointer) must not be NULL if the argument NI (an integer) is != 0. */ +/* Applies to: functions. */ +#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO +# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero) +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni))) +# else +# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) +# endif +#endif + /* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is not meant to be NUL-terminated. */ /* Applies to: struct/union members and variables that are arrays of element @@ -481,7 +709,7 @@ AC_DEFUN([gl_COMMON_BODY], [ other attributes. */ #ifndef _GL_ATTRIBUTE_NOTHROW # if defined __cplusplus -# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 +# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4 # if __cplusplus >= 201103L # define _GL_ATTRIBUTE_NOTHROW noexcept (true) # else @@ -505,9 +733,9 @@ AC_DEFUN([gl_COMMON_BODY], [ minimizing the memory required. */ /* Applies to: struct members, struct, union, in C++ also: class. */ +#ifndef _GL_ATTRIBUTE_PACKED /* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite __has_attribute OK. */ -#ifndef _GL_ATTRIBUTE_PACKED # if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C # define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) # else @@ -515,18 +743,51 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif -/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate - calls to the function with the same arguments if observable state is not - changed between calls. - This attribute is safe for a function that does not affect - observable state, and always returns exactly once. - (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ +/* _GL_ATTRIBUTE_PURE declares: + It is OK for a compiler to move calls to the function and to omit + calls to the function if another call has the same arguments or the + result is not used, and if observable state is the same. + This attribute is safe for a function that does not affect observable state + and always returns exactly once. + (This attribute is looser than _GL_ATTRIBUTE_CONST because the function + can depend on observable state. It is stricter than + _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly + once and cannot affect state addressed by its arguments.) */ /* Applies to: functions. */ #ifndef _GL_ATTRIBUTE_PURE # if _GL_HAS_ATTRIBUTE (pure) # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define _GL_ATTRIBUTE_PURE +# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE +# endif +#endif + +/* _GL_ATTRIBUTE_REPRODUCIBLE declares: + It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same and is updated in time for + the rest of the program. + This attribute is safe for a function that is effectless and idempotent; see + ISO C 23 § 6.7.12.7 for a definition of these terms. + (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because + the function need not be stateless and idempotent. It is looser + than _GL_ATTRIBUTE_PURE because the function need not return + exactly once and can affect state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function types. */ +#ifndef _GL_ATTRIBUTE_REPRODUCIBLE +/* This may be revisited when gcc and clang support [[reproducible]] or possibly + __attribute__ ((__reproducible__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (reproducible) +# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_REPRODUCIBLE +# define _GL_ATTRIBUTE_REPRODUCIBLE # endif #endif @@ -554,6 +815,35 @@ AC_DEFUN([gl_COMMON_BODY], [ # endif #endif +/* _GL_ATTRIBUTE_UNSEQUENCED declares: + It is OK for a compiler to move calls to the function and to omit duplicate + calls to the function with the same arguments, so long as the state + addressed by its arguments is the same. + This attribute is safe for a function that is effectless, idempotent, + stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of + these terms. + (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because + the function must be stateless and independent. It is looser than + _GL_ATTRIBUTE_CONST because the function need not return exactly + once and can depend on state addressed by its arguments.) + See also and + . + ATTENTION! Efforts are underway to change the meaning of this attribute. + See . */ +/* Applies to: functions, pointer to functions, function types. */ +#ifndef _GL_ATTRIBUTE_UNSEQUENCED +/* This may be revisited when gcc and clang support [[unsequenced]] or possibly + __attribute__ ((__unsequenced__)). */ +# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE +# if _GL_HAS_ATTRIBUTE (unsequenced) +# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]] +# endif +# endif +# ifndef _GL_ATTRIBUTE_UNSEQUENCED +# define _GL_ATTRIBUTE_UNSEQUENCED +# endif +#endif + /* A helper macro. Don't use it directly. */ #ifndef _GL_ATTRIBUTE_UNUSED # if _GL_HAS_ATTRIBUTE (unused) @@ -578,6 +868,35 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_UNUSED_LABEL # endif #endif + +/* The following attributes enable detection of multithread-safety problems + and resource leaks at compile-time, by clang ≥ 15, when the warning option + -Wthread-safety is enabled. For usage, see + . */ +#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \ + __attribute__ ((__capability__ (concept))) +# else +# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) +# endif +#endif +#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \ + __attribute__ ((__acquire_capability__ (resource))) +# else +# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) +# endif +#endif +#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY +# if __clang_major__ >= 15 +# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \ + __attribute__ ((__release_capability__ (resource))) +# else +# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) +# endif +#endif ]) AH_VERBATIM([c_linkage], [/* In C++, there is the concept of "language linkage", that encompasses @@ -628,8 +947,8 @@ AC_DEFUN([gl_COMMON_BODY], [ -1 if n1 < n2 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional jump with nearly all GCC versions up to GCC 10. - This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many - GCC versions up to GCC 9. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with + many GCC versions up to GCC 9. The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 avoids conditional jumps in all GCC versions >= 3.4. */ #define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) @@ -1006,7 +1325,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS], AC_REQUIRE([AC_PROG_CC]) AC_CACHE_CHECK([for C compiler option to allow warnings], [gl_cv_cc_wallow], - [rm -f conftest* + [rm -fr conftest* echo 'int dummy;' > conftest.c AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null @@ -1019,7 +1338,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS], else gl_cv_cc_wallow=none fi - rm -f conftest* + rm -fr conftest* ]) case "$gl_cv_cc_wallow" in none) GL_CFLAG_ALLOW_WARNINGS='' ;; @@ -1037,7 +1356,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS], if test -n "$CXX" && test "$CXX" != no; then AC_CACHE_CHECK([for C++ compiler option to allow warnings], [gl_cv_cxx_wallow], - [rm -f conftest* + [rm -fr conftest* echo 'int dummy;' > conftest.cc AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null @@ -1050,7 +1369,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS], else gl_cv_cxx_wallow=none fi - rm -f conftest* + rm -fr conftest* ]) case "$gl_cv_cxx_wallow" in none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; @@ -1087,11 +1406,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], dnl -Wno-type-limits >= 4.3 >= 3.9 dnl -Wno-undef >= 3 >= 3.9 dnl -Wno-unsuffixed-float-constants >= 4.5 + dnl -Wno-unused-const-variable >= 4.4 >= 3.9 dnl -Wno-unused-function >= 3 >= 3.9 dnl -Wno-unused-parameter >= 3 >= 3.9 dnl cat > conftest.c <<\EOF - #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-cast-qual -Wno-conversion -Wno-float-equal @@ -1100,23 +1420,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS], -Wno-unused-function -Wno-unused-parameter #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-float-conversion #endif - #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wimplicit-fallthrough #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-pedantic #endif #if 3 < __clang_major__ + (9 <= __clang_minor__) -Wno-tautological-constant-out-of-range-compare #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) + #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) -Wno-sign-conversion -Wno-type-limits #endif - #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 + #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3) + -Wno-unused-const-variable + #endif + #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__) -Wno-unsuffixed-float-constants #endif EOF @@ -1240,13 +1563,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS], if test $[ac_cv_func_][$1] = yes; then [gl_cv_onwards_func_][$1]=yes else + dnl This is a bit complicated, because here we need the behaviour + dnl of AC_CHECK_DECL before the + dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26). + [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]" unset [ac_cv_have_decl_][$1] + ac_c_future_darwin_options_saved="$ac_c_future_darwin_options" + ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options" + ac_c_future_darwin_options= + ac_cxx_future_darwin_options= AC_CHECK_DECL([$1], , , [$2]) + ac_c_future_darwin_options="$ac_c_future_darwin_options_saved" + ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved" 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 + [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]" + unset [ac_cv_have_decl_][$1][_saved] fi else AC_CHECK_FUNC([$1]) @@ -1299,7 +1634,7 @@ 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 first variable allows distinguishing 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 @@ -1352,7 +1687,7 @@ 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 first variable allows distinguishing 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 diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 83a0f727..50e98454 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-2024 Free Software Foundation, Inc. +# Copyright (C) 2002-2025 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 @@ -45,14 +45,30 @@ AC_DEFUN([gl_EARLY], # Code from module absolute-header: # Code from module alignasof: # Code from module alloca-opt: - # Code from module arpa_inet: + # Code from module arpa_inet-h: # Code from module assert-h: # Code from module attribute: # Code from module base64: # Code from module basename-lgpl: + # Code from module bool: # Code from module btowc: # Code from module builtin-expect: # Code from module byteswap: + # Code from module c-ctype: + # Code from module c32isalnum: + # Code from module c32isalpha: + # Code from module c32isblank: + # Code from module c32iscntrl: + # Code from module c32isdigit: + # Code from module c32isgraph: + # Code from module c32islower: + # Code from module c32isprint: + # Code from module c32ispunct: + # Code from module c32isspace: + # Code from module c32isupper: + # Code from module c32isxdigit: + # Code from module c32tolower: + # Code from module c32width: # Code from module c99: # Code from module calloc-gnu: # Code from module calloc-posix: @@ -66,11 +82,15 @@ AC_DEFUN([gl_EARLY], # Code from module double-slash-root: # Code from module dup2: # Code from module environ: - # Code from module errno: + # Code from module errno-h: # Code from module error: # Code from module error-h: # Code from module exitfail: # Code from module extensions: + # This is actually already done in the pre-early phase. + # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module extensions-aix: + AC_REQUIRE([gl_USE_AIX_EXTENSIONS]) # Code from module extern-inline: # Code from module fcntl: # Code from module fcntl-h: @@ -78,7 +98,7 @@ AC_DEFUN([gl_EARLY], # Code from module fflush: AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) # Code from module filename: - # Code from module float: + # Code from module float-h: # Code from module floorf: # Code from module fopen: # Code from module fopen-gnu: @@ -88,6 +108,7 @@ AC_DEFUN([gl_EARLY], # Code from module fseek: # Code from module fseeko: AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) + # Code from module fseterr: # Code from module fstat: # Code from module fsusage: # Code from module ftell: @@ -105,6 +126,7 @@ AC_DEFUN([gl_EARLY], # Code from module getprogname: # Code from module gettext-h: # Code from module glibc-internal/dynarray: + # Code from module gnulib-i18n: # Code from module hard-locale: # Code from module hostent: # Code from module ialloc: @@ -112,29 +134,35 @@ AC_DEFUN([gl_EARLY], # Code from module idx: # Code from module include_next: # Code from module inet_ntop: + # Code from module inet_pton: # Code from module intprops: - # Code from module inttypes-incomplete: + # Code from module inttypes-h-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 langinfo-h: # Code from module largefile: AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module libc-config: # Code from module limits-h: # Code from module localcharset: - # Code from module locale: + # Code from module locale-h: # Code from module localeconv: # Code from module lock: # Code from module lseek: + # Code from module lstat: # Code from module malloc-gnu: # Code from module malloc-posix: # Code from module malloca: - # Code from module math: + # Code from module math-h: + # Code from module mbchar: + # Code from module mbiterf: + # Code from module mbrtoc32: # Code from module mbrtowc: # Code from module mbsinit: + # Code from module mbsnlen: # Code from module mbszero: # Code from module mbtowc: # Code from module memchr: @@ -145,16 +173,20 @@ AC_DEFUN([gl_EARLY], # Code from module msvc-inval: # Code from module msvc-nothrow: # Code from module multiarch: - # Code from module netdb: - # Code from module netinet_in: + # Code from module netdb-h: + # Code from module netinet_in-h: # Code from module nl_langinfo: # Code from module nocrash: + # Code from module once: # Code from module open: # Code from module pathmax: - # Code from module realloc-gnu: + # Code from module pthread-h: + gl_ANYTHREADLIB_EARLY + # Code from module pthread-once: # Code from module realloc-posix: # Code from module reallocarray: # Code from module regex: + # Code from module sched-h: # Code from module servent: # Code from module setenv: # Code from module setlocale-null: @@ -172,33 +204,56 @@ AC_DEFUN([gl_EARLY], # Code from module stat: # Code from module stat-time: # Code from module std-gnu11: - # Code from module stdbool: - # Code from module stdckdint: - # Code from module stddef: - # Code from module stdint: - # Code from module stdio: + # Code from module stdckdint-h: + # Code from module stddef-h: + # Code from module stdint-h: + # Code from module stdio-h: gl_STDIO_H_EARLY - # Code from module stdlib: + # Code from module stdlib-h: # Code from module strcase: + # Code from module strcasecmp: # Code from module strcasestr: # Code from module strcasestr-simple: # Code from module streq: # Code from module strerror: # Code from module strerror-override: - # Code from module string: - # Code from module strings: + # Code from module string-h: + # Code from module strings-h: + # Code from module strncasecmp: + # Code from module strncpy: # Code from module strsep: # Code from module strstr-simple: - # Code from module sys_socket: - # Code from module sys_stat: - # Code from module sys_types: - # Code from module sys_uio: + # Code from module sys_socket-h: + # Code from module sys_stat-h: + # Code from module sys_types-h: + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + # Code from module sys_uio-h: # Code from module threadlib: gl_THREADLIB_EARLY # Code from module time-h: # Code from module time_r: # Code from module timegm: - # Code from module unistd: + # Code from module uchar-h: + # Code from module unicase/base: + # Code from module unicase/tolower: + # Code from module unictype/base: + # Code from module unictype/ctype-alnum: + # Code from module unictype/ctype-alpha: + # Code from module unictype/ctype-blank: + # Code from module unictype/ctype-cntrl: + # Code from module unictype/ctype-digit: + # Code from module unictype/ctype-graph: + # Code from module unictype/ctype-lower: + # Code from module unictype/ctype-print: + # Code from module unictype/ctype-punct: + # Code from module unictype/ctype-space: + # Code from module unictype/ctype-upper: + # Code from module unictype/ctype-xdigit: + # Code from module uninorm/base: + # Code from module unistd-h: + # Code from module unitypes-h: + # Code from module uniwidth/base: + # Code from module uniwidth/width: # Code from module unlocked-io-internal: # Code from module unsetenv: # Code from module vararrays: @@ -206,10 +261,12 @@ AC_DEFUN([gl_EARLY], # Code from module vasprintf: # Code from module verify: # Code from module vsnprintf: - # Code from module wchar: + # Code from module vsnzprintf: + # Code from module wchar-h: # Code from module wcrtomb: # Code from module wctype: # Code from module wctype-h: + # Code from module wcwidth: # Code from module windows-mutex: # Code from module windows-once: # Code from module windows-recmutex: @@ -250,6 +307,7 @@ AC_DEFUN([gl_INIT], gl_CONDITIONAL_HEADER([assert.h]) AC_PROG_MKDIR_P gl_FUNC_BASE64 + gl_C_BOOL gl_FUNC_BTOWC gl_CONDITIONAL([GL_COND_OBJ_BTOWC], [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) @@ -261,6 +319,104 @@ AC_DEFUN([gl_INIT], gl_BYTESWAP gl_CONDITIONAL_HEADER([byteswap.h]) AC_PROG_MKDIR_P + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isalnum]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isalpha]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isblank]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32iscntrl]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isdigit]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isgraph]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32islower]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isprint]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32ispunct]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isspace]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isupper]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32isxdigit]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32tolower]) + AC_REQUIRE([gl_UCHAR_H]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how mbrtoc32 is implemented. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + gl_UCHAR_MODULE_INDICATOR([c32width]) gl_FUNC_CALLOC_GNU if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then AC_LIBOBJ([calloc]) @@ -275,6 +431,7 @@ AC_DEFUN([gl_INIT], gl_FUNC_CLOSE gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) gl_UNISTD_MODULE_INDICATOR([close]) + gl_MODULE_INDICATOR([close]) gl_AF_ALG AC_REQUIRE([AC_C_RESTRICT]) gl_SHA256 @@ -320,8 +477,11 @@ AC_DEFUN([gl_INIT], gl_FLOAT_H gl_CONDITIONAL_HEADER([float.h]) AC_PROG_MKDIR_P - gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) + gl_CONDITIONAL([GL_COND_OBJ_FLOAT], + [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1]) gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) + dnl Prerequisites of lib/float.c. + AC_REQUIRE([gl_BIGENDIAN]) gl_FUNC_FLOORF gl_CONDITIONAL([GL_COND_OBJ_FLOORF], [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) @@ -360,6 +520,8 @@ AC_DEFUN([gl_INIT], gl_PREREQ_FSEEKO ]) gl_STDIO_MODULE_INDICATOR([fseeko]) + gl_FUNC_FSETERR + gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no]) gl_FUNC_FSTAT gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) AM_COND_IF([GL_COND_OBJ_FSTAT], [ @@ -371,6 +533,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_FSTAT ]) gl_SYS_STAT_MODULE_INDICATOR([fstat]) + gl_MODULE_INDICATOR([fstat]) gl_FSUSAGE gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ @@ -412,6 +575,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_GETHOSTNAME ]) gl_UNISTD_MODULE_INDICATOR([gethostname]) + gl_MODULE_INDICATOR([gethostname]) gl_FUNC_GETLINE gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) AM_COND_IF([GL_COND_OBJ_GETLINE], [ @@ -441,6 +605,8 @@ AC_DEFUN([gl_INIT], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) ]) gl_UNISTD_MODULE_INDICATOR([getopt-posix]) + gl_MUSL_LIBC + AC_REQUIRE([AC_CANONICAL_HOST]) gl_FUNC_GETPROGNAME gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) @@ -451,6 +617,7 @@ AC_DEFUN([gl_INIT], AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_PROG_MKDIR_P + GNULIB_I18N AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" AC_SUBST([HARD_LOCALE_LIB]) @@ -466,6 +633,13 @@ AC_DEFUN([gl_INIT], gl_PREREQ_INET_NTOP ]) gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) + gl_FUNC_INET_PTON + gl_CONDITIONAL([GL_COND_OBJ_INET_PTON], + [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1]) + AM_COND_IF([GL_COND_OBJ_INET_PTON], [ + gl_PREREQ_INET_PTON + ]) + gl_ARPA_INET_MODULE_INDICATOR([inet_pton]) gl_INTTYPES_INCOMPLETE gl_INTTYPES_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P @@ -510,11 +684,19 @@ AC_DEFUN([gl_INIT], gl_PREREQ_LOCALECONV ]) gl_LOCALE_MODULE_INDICATOR([localeconv]) + gl_MODULE_INDICATOR([localeconv]) gl_LOCK gl_MODULE_INDICATOR([lock]) gl_FUNC_LSEEK gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) gl_UNISTD_MODULE_INDICATOR([lseek]) + gl_FUNC_LSTAT + gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1]) + AM_COND_IF([GL_COND_OBJ_LSTAT], [ + gl_PREREQ_LSTAT + ]) + gl_SYS_STAT_MODULE_INDICATOR([lstat]) + gl_MODULE_INDICATOR([lstat]) gl_FUNC_MALLOC_GNU if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then AC_LIBOBJ([malloc]) @@ -529,6 +711,20 @@ AC_DEFUN([gl_INIT], gl_MATH_H gl_MATH_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_MBCHAR + gl_MBITER + gl_FUNC_MBRTOC32 + gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32], + [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1]) + AM_COND_IF([GL_COND_OBJ_MBRTOC32], [ + if test $REPLACE_MBSTATE_T = 1; then + AC_LIBOBJ([lc-charset-dispatch]) + AC_LIBOBJ([mbtowc-lock]) + gl_PREREQ_MBTOWC_LOCK + fi + gl_PREREQ_MBRTOC32 + ]) + gl_UCHAR_MODULE_INDICATOR([mbrtoc32]) gl_FUNC_MBRTOWC gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) @@ -548,6 +744,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_MBSINIT ]) gl_WCHAR_MODULE_INDICATOR([mbsinit]) + gl_STRING_MODULE_INDICATOR([mbsnlen]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) gl_MBSTATE_T_BROKEN gl_MUSL_LIBC @@ -578,10 +775,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_MKTIME fi gl_MOUNTLIST - gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) - AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [ - gl_PREREQ_MOUNTLIST_EXTRA - ]) + gl_PREREQ_MOUNTLIST_EXTRA AC_REQUIRE([gl_MSVC_INVAL]) gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) @@ -605,6 +799,7 @@ AC_DEFUN([gl_INIT], gl_PREREQ_NL_LANGINFO_LOCK fi gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) + gl_ONCE gl_FUNC_OPEN gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) AM_COND_IF([GL_COND_OBJ_OPEN], [ @@ -612,15 +807,17 @@ AC_DEFUN([gl_INIT], ]) gl_FCNTL_MODULE_INDICATOR([open]) gl_PATHMAX - gl_FUNC_REALLOC_GNU - if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then - AC_LIBOBJ([realloc]) - fi - gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) + gl_PTHREAD_H + gl_PTHREAD_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_PTHREAD_ONCE + gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE], + [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1]) + gl_PTHREAD_MODULE_INDICATOR([pthread-once]) gl_FUNC_REALLOC_POSIX - if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then - AC_LIBOBJ([realloc]) - fi + gl_FUNC_REALLOC_0_NONNULL + gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX], + [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0]) gl_STDLIB_MODULE_INDICATOR([realloc-posix]) gl_FUNC_REALLOCARRAY gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], @@ -635,6 +832,9 @@ AC_DEFUN([gl_INIT], AM_COND_IF([GL_COND_OBJ_REGEX], [ gl_PREREQ_REGEX ]) + gl_SCHED_H + gl_SCHED_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_SERVENT gl_FUNC_SETENV gl_CONDITIONAL([GL_COND_OBJ_SETENV], @@ -666,15 +866,10 @@ AC_DEFUN([gl_INIT], gl_PREREQ_STAT ]) gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_MODULE_INDICATOR([stat]) gl_STAT_TIME gl_STAT_BIRTHTIME - gl_C_BOOL - AC_CHECK_HEADERS_ONCE([stdckdint.h]) - if test $ac_cv_header_stdckdint_h = yes; then - GL_GENERATE_STDCKDINT_H=false - else - GL_GENERATE_STDCKDINT_H=true - fi + gl_STDCKDINT_H gl_CONDITIONAL_HEADER([stdckdint.h]) AC_PROG_MKDIR_P gl_STDDEF_H @@ -689,6 +884,19 @@ AC_DEFUN([gl_INIT], gl_STDIO_H gl_STDIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + USES_MSVCRT=0 + case "$host_os" in + mingw* | windows*) + AC_EGREP_CPP([Special], [ + #ifndef _UCRT + Special + #endif + ], + [USES_MSVCRT=1]) + ;; + esac + gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) + AC_CHECK_FUNCS([vasprintf]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) dnl No need to create extra modules for these functions. Everyone who uses @@ -717,15 +925,13 @@ AC_DEFUN([gl_INIT], gl_STDLIB_H gl_STDLIB_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - gl_STRCASE - gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) + gl_FUNC_STRCASECMP + gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], + [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1]) AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ gl_PREREQ_STRCASECMP ]) - gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) - AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ - gl_PREREQ_STRNCASECMP - ]) + gl_STRINGS_MODULE_INDICATOR([strcasecmp]) gl_FUNC_STRCASESTR if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then AC_LIBOBJ([strcasestr]) @@ -754,6 +960,19 @@ AC_DEFUN([gl_INIT], gl_STRINGS_H gl_STRINGS_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_FUNC_STRNCASECMP + gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], + [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1]) + AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [ + gl_PREREQ_STRNCASECMP + ]) + gl_STRINGS_MODULE_INDICATOR([strncasecmp]) + gl_FUNC_STRNCPY + gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1]) + AM_COND_IF([GL_COND_OBJ_STRNCPY], [ + gl_PREREQ_STRNCPY + ]) + gl_STRING_MODULE_INDICATOR([strncpy]) gl_FUNC_STRSEP gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) AM_COND_IF([GL_COND_OBJ_STRSEP], [ @@ -795,9 +1014,55 @@ AC_DEFUN([gl_INIT], gl_PREREQ_TIMEGM ]) gl_TIME_MODULE_INDICATOR([timegm]) + gl_UCHAR_H + gl_UCHAR_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h]) + gl_UNICASE_H + gl_UNICASE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([1.3], [unicase/tolower]) + gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h]) + gl_UNICTYPE_H + gl_UNICTYPE_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alnum]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alpha]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-cntrl]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-graph]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-lower]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-print]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-punct]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-upper]) + AC_REQUIRE([AC_C_INLINE]) + gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit]) + gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h]) + gl_UNINORM_H + gl_UNINORM_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P gl_UNISTD_H gl_UNISTD_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h]) + AC_PROG_MKDIR_P + gl_UNITYPES_H + gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h]) + AC_PROG_MKDIR_P + gl_LIBUNISTRING_MODULE([1.3], [uniwidth/width]) gl_FUNC_GLIBC_UNLOCKED_IO gl_FUNC_UNSETENV gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], @@ -816,6 +1081,7 @@ AC_DEFUN([gl_INIT], AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) gl_FUNC_VSNPRINTF gl_STDIO_MODULE_INDICATOR([vsnprintf]) + gl_STDIO_MODULE_INDICATOR([vsnzprintf]) gl_WCHAR_H gl_WCHAR_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P @@ -832,6 +1098,13 @@ AC_DEFUN([gl_INIT], gl_WCTYPE_H gl_WCTYPE_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P + gl_FUNC_WCWIDTH + gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH], + [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1]) + AM_COND_IF([GL_COND_OBJ_WCWIDTH], [ + gl_PREREQ_WCWIDTH + ]) + gl_WCHAR_MODULE_INDICATOR([wcwidth]) AC_REQUIRE([AC_CANONICAL_HOST]) gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) @@ -871,27 +1144,35 @@ AC_DEFUN([gl_INIT], gl_libobjs= gl_ltlibobjs= gl_libobjdeps= + gl_libgnu_libobjs= + gl_libgnu_ltlibobjs= + gl_libgnu_libobjdeps= if test -n "$gl_LIBOBJS"; then # Remove the extension. changequote(,)dnl sed_drop_objext='s/\.o$//;s/\.obj$//' sed_dirname1='s,//*,/,g' sed_dirname2='s,\(.\)/$,\1,' - sed_dirname3='s,^[^/]*$,.,' - sed_dirname4='s,\(.\)/[^/]*$,\1,' + sed_dirname3='s,[^/]*$,,' sed_basename1='s,.*/,,' changequote([, ])dnl for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gl_libobjs="$gl_libobjs $i.$ac_objext" gl_ltlibobjs="$gl_ltlibobjs $i.lo" - i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` + i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` i_base=`echo "$i" | sed -e "$sed_basename1"` - gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" + gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" + gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" + gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" + gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" done fi AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) + AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs]) + AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs]) + AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps]) ]) gltests_libdeps= gltests_ltlibdeps= @@ -934,27 +1215,35 @@ changequote([, ])dnl gltests_libobjs= gltests_ltlibobjs= gltests_libobjdeps= + gltests_libgnu_libobjs= + gltests_libgnu_ltlibobjs= + gltests_libgnu_libobjdeps= if test -n "$gltests_LIBOBJS"; then # Remove the extension. changequote(,)dnl sed_drop_objext='s/\.o$//;s/\.obj$//' sed_dirname1='s,//*,/,g' sed_dirname2='s,\(.\)/$,\1,' - sed_dirname3='s,^[^/]*$,.,' - sed_dirname4='s,\(.\)/[^/]*$,\1,' + sed_dirname3='s,[^/]*$,,' sed_basename1='s,.*/,,' changequote([, ])dnl for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do gltests_libobjs="$gltests_libobjs $i.$ac_objext" gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" - i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` + i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"` i_base=`echo "$i" | sed -e "$sed_basename1"` - gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" + gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext" + gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo" + gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po" + gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po" done fi AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) + AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs]) + AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs]) + AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps]) ]) AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) LIBGNU_LIBDEPS="$gl_libdeps" @@ -1025,6 +1314,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/af_alg.h lib/alloca.in.h lib/arg-nonnull.h + lib/arpa_inet.c lib/arpa_inet.in.h lib/asnprintf.c lib/asprintf.c @@ -1036,8 +1326,27 @@ AC_DEFUN([gl_FILE_LIST], [ lib/basename-lgpl.h lib/basename.c lib/btowc.c + lib/byteswap.c lib/byteswap.in.h lib/c++defs.h + lib/c-ctype.c + lib/c-ctype.h + lib/c32is-impl.h + lib/c32isalnum.c + lib/c32isalpha.c + lib/c32isblank.c + lib/c32iscntrl.c + lib/c32isdigit.c + lib/c32isgraph.c + lib/c32islower.c + lib/c32isprint.c + lib/c32ispunct.c + lib/c32isspace.c + lib/c32isupper.c + lib/c32isxdigit.c + lib/c32to-impl.h + lib/c32tolower.c + lib/c32width.c lib/calloc.c lib/cdefs.h lib/cloexec.c @@ -1071,6 +1380,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/free.c lib/fseek.c lib/fseeko.c + lib/fseterr.c + lib/fseterr.h lib/fstat.c lib/fsusage.c lib/fsusage.h @@ -1098,6 +1409,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/gl_openssl.h lib/glthread/lock.c lib/glthread/lock.h + lib/glthread/once.c + lib/glthread/once.h lib/glthread/threadlib.c lib/hard-locale.c lib/hard-locale.h @@ -1107,6 +1420,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/idpriv.h lib/idx.h lib/inet_ntop.c + lib/inet_pton.c lib/intprops-internal.h lib/intprops.h lib/inttypes.in.h @@ -1127,6 +1441,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/locale.in.h lib/localeconv.c lib/lseek.c + lib/lstat.c lib/malloc.c lib/malloc/dynarray-skeleton.c lib/malloc/dynarray.h @@ -1139,10 +1454,16 @@ AC_DEFUN([gl_FILE_LIST], [ lib/malloca.h lib/math.c lib/math.in.h + lib/mbchar.c + lib/mbchar.h + lib/mbiterf.c + lib/mbiterf.h + lib/mbrtoc32.c lib/mbrtowc-impl-utf8.h lib/mbrtowc-impl.h lib/mbrtowc.c lib/mbsinit.c + lib/mbsnlen.c lib/mbszero.c lib/mbtowc-impl.h lib/mbtowc-lock.c @@ -1169,6 +1490,8 @@ AC_DEFUN([gl_FILE_LIST], [ lib/printf-args.h lib/printf-parse.c lib/printf-parse.h + lib/pthread-once.c + lib/pthread.in.h lib/realloc.c lib/reallocarray.c lib/regcomp.c @@ -1177,6 +1500,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/regex_internal.c lib/regex_internal.h lib/regexec.c + lib/sched.in.h lib/setenv.c lib/setlocale-lock.c lib/setlocale_null-unlocked.c @@ -1197,10 +1521,12 @@ AC_DEFUN([gl_FILE_LIST], [ lib/stdckdint.in.h lib/stddef.in.h lib/stdint.in.h + lib/stdio-consolesafe.c lib/stdio-impl.h lib/stdio-read.c lib/stdio-write.c lib/stdio.in.h + lib/stdlib.c lib/stdlib.in.h lib/str-two-way.h lib/strcasecmp.c @@ -1213,6 +1539,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/strings.in.h lib/stripslash.c lib/strncasecmp.c + lib/strncpy.c lib/strsep.c lib/strstr.c lib/sys-limits.h @@ -1224,8 +1551,46 @@ AC_DEFUN([gl_FILE_LIST], [ lib/time.in.h lib/time_r.c lib/timegm.c + lib/uchar.in.h + lib/unicase.in.h + lib/unicase/simple-mapping.h + lib/unicase/tolower.c + lib/unicase/tolower.h + lib/unictype.in.h + lib/unictype/bitmap.h + lib/unictype/ctype_alnum.c + lib/unictype/ctype_alnum.h + lib/unictype/ctype_alpha.c + lib/unictype/ctype_alpha.h + lib/unictype/ctype_blank.c + lib/unictype/ctype_blank.h + lib/unictype/ctype_cntrl.c + lib/unictype/ctype_cntrl.h + lib/unictype/ctype_digit.c + lib/unictype/ctype_digit.h + lib/unictype/ctype_graph.c + lib/unictype/ctype_graph.h + lib/unictype/ctype_lower.c + lib/unictype/ctype_lower.h + lib/unictype/ctype_print.c + lib/unictype/ctype_print.h + lib/unictype/ctype_punct.c + lib/unictype/ctype_punct.h + lib/unictype/ctype_space.c + lib/unictype/ctype_space.h + lib/unictype/ctype_upper.c + lib/unictype/ctype_upper.h + lib/unictype/ctype_xdigit.c + lib/unictype/ctype_xdigit.h + lib/uninorm.in.h lib/unistd.c lib/unistd.in.h + lib/unitypes.in.h + lib/uniwidth.in.h + lib/uniwidth/cjk.h + lib/uniwidth/width.c + lib/uniwidth/width0.h + lib/uniwidth/width2.h lib/unlocked-io.h lib/unsetenv.c lib/vasnprintf.c @@ -1233,6 +1598,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/vasprintf.c lib/verify.h lib/vsnprintf.c + lib/vsnzprintf.c lib/w32sock.h lib/warn-on-use.h lib/wchar.in.h @@ -1241,6 +1607,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/wctype-impl.h lib/wctype.c lib/wctype.in.h + lib/wcwidth.c lib/windows-initguard.h lib/windows-mutex.c lib/windows-mutex.h @@ -1265,20 +1632,22 @@ AC_DEFUN([gl_FILE_LIST], [ m4/assert_h.m4 m4/base64.m4 m4/btowc.m4 + m4/build-to-host.m4 m4/builtin-expect.m4 m4/byteswap.m4 m4/c-bool.m4 + m4/c32rtomb.m4 m4/calloc.m4 m4/close.m4 m4/codeset.m4 m4/double-slash-root.m4 m4/dup2.m4 - m4/eealloc.m4 m4/environ.m4 m4/errno_h.m4 m4/error.m4 m4/error_h.m4 m4/exponentd.m4 + m4/extensions-aix.m4 m4/extensions.m4 m4/extern-inline.m4 m4/fclose.m4 @@ -1294,6 +1663,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/free.m4 m4/fseek.m4 m4/fseeko.m4 + m4/fseterr.m4 m4/fstat.m4 m4/fstypename.m4 m4/fsusage.m4 @@ -1309,10 +1679,12 @@ AC_DEFUN([gl_FILE_LIST], [ m4/getprogname.m4 m4/gl-openssl.m4 m4/gnulib-common.m4 + m4/gnulib-i18n.m4 m4/hostent.m4 m4/idpriv.m4 m4/include_next.m4 m4/inet_ntop.m4 + m4/inet_pton.m4 m4/intmax_t.m4 m4/inttypes.m4 m4/inttypes_h.m4 @@ -1323,8 +1695,10 @@ AC_DEFUN([gl_FILE_LIST], [ m4/iswxdigit.m4 m4/langinfo_h.m4 m4/largefile.m4 + m4/libunistring-base.m4 m4/limits-h.m4 m4/localcharset.m4 + m4/locale-en.m4 m4/locale-fr.m4 m4/locale-ja.m4 m4/locale-zh.m4 @@ -1332,9 +1706,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/localeconv.m4 m4/lock.m4 m4/lseek.m4 + m4/lstat.m4 m4/malloc.m4 m4/malloca.m4 m4/math_h.m4 + m4/mbchar.m4 + m4/mbiter.m4 + m4/mbrtoc32.m4 m4/mbrtowc.m4 m4/mbsinit.m4 m4/mbstate_t.m4 @@ -1353,17 +1731,23 @@ AC_DEFUN([gl_FILE_LIST], [ m4/netinet_in_h.m4 m4/nl_langinfo.m4 m4/nocrash.m4 + m4/off64_t.m4 m4/off_t.m4 + m4/once.m4 m4/open-cloexec.m4 m4/open-slash.m4 m4/open.m4 m4/pathmax.m4 m4/pid_t.m4 m4/printf.m4 + m4/pthread-once.m4 + m4/pthread-spin.m4 + m4/pthread_h.m4 m4/pthread_rwlock_rdlock.m4 m4/realloc.m4 m4/reallocarray.m4 m4/regex.m4 + m4/sched_h.m4 m4/servent.m4 m4/setenv.m4 m4/setlocale_null.m4 @@ -1379,18 +1763,22 @@ AC_DEFUN([gl_FILE_LIST], [ m4/stat.m4 m4/std-gnu11.m4 m4/stdalign.m4 + m4/stdckdint_h.m4 m4/stddef_h.m4 m4/stdint.m4 m4/stdint_h.m4 m4/stdio_h.m4 m4/stdlib_h.m4 - m4/strcase.m4 + m4/strcasecmp.m4 m4/strcasestr.m4 m4/strerror.m4 m4/string_h.m4 m4/strings_h.m4 + m4/strncasecmp.m4 + m4/strncpy.m4 m4/strsep.m4 m4/strstr.m4 + m4/sys_cdefs_h.m4 m4/sys_socket_h.m4 m4/sys_stat_h.m4 m4/sys_types_h.m4 @@ -1399,8 +1787,13 @@ AC_DEFUN([gl_FILE_LIST], [ m4/time_h.m4 m4/time_r.m4 m4/timegm.m4 + m4/uchar_h.m4 m4/ungetc.m4 + m4/unicase_h.m4 + m4/unictype_h.m4 + m4/uninorm_h.m4 m4/unistd_h.m4 + m4/unitypes_h.m4 m4/unlocked-io.m4 m4/vararrays.m4 m4/vasnprintf.m4 @@ -1409,10 +1802,10 @@ AC_DEFUN([gl_FILE_LIST], [ m4/vsnprintf.m4 m4/warn-on-use.m4 m4/wchar_h.m4 - m4/wchar_t.m4 m4/wcrtomb.m4 m4/wctype.m4 m4/wctype_h.m4 + m4/wcwidth.m4 m4/wint_t.m4 m4/xalloc.m4 m4/xsize.m4 diff --git a/gl/m4/gnulib-i18n.m4 b/gl/m4/gnulib-i18n.m4 new file mode 100644 index 00000000..868043e7 --- /dev/null +++ b/gl/m4/gnulib-i18n.m4 @@ -0,0 +1,61 @@ +# gnulib-i18n.m4 +# serial 1 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl Support for internationalization of Gnulib code. + +dnl GNULIB_I18N +dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files. +dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to +dnl the corresponding C string. +AC_DEFUN([GNULIB_I18N], +[ + dnl It is best to not test "$USE_NLS" here, because: It would be empty + dnl in case the package is internationalized but this macro is used before + dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since + dnl this module is used as a dependency of many packages, such a warning is + dnl not welcome. + + dnl Determine gnulib's localedir. + dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate + dnl where to find gnulib's runtime data. + dnl Usually ${prefix}/share/locale, but can be influenced by the configure + dnl options --datarootdir and --localedir. + GNULIB_LOCALEDIR="${localedir}" + AC_ARG_WITH([gnulib-prefix], + [[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]], + [if test "X$withval" != "X" && test "X$withval" != "Xno"; then + GNULIB_LOCALEDIR="$withval/share/locale" + fi + ]) + AC_SUBST([GNULIB_LOCALEDIR]) + + dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make. + dnl Find the final value of GNULIB_LOCALEDIR. + gl_saved_prefix="${prefix}" + gl_saved_datarootdir="${datarootdir}" + gl_saved_localedir="${localedir}" + gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR" + gl_BUILD_TO_HOST([GNULIB_LOCALEDIR]) + GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}" + localedir="${gl_saved_localedir}" + datarootdir="${gl_saved_datarootdir}" + prefix="${gl_saved_prefix}" + + AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}], + [Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.]) +]) diff --git a/gl/m4/gnulib-tool.m4 b/gl/m4/gnulib-tool.m4 index ef45f51f..8634a6e9 100644 --- a/gl/m4/gnulib-tool.m4 +++ b/gl/m4/gnulib-tool.m4 @@ -1,9 +1,10 @@ # gnulib-tool.m4 -# serial 4 -dnl Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc. +# serial 5 +dnl Copyright (C) 2004-2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl The following macros need not be invoked explicitly. dnl Invoking them does nothing except to declare default arguments @@ -42,6 +43,9 @@ AC_DEFUN([gl_LIB], []) dnl Usage: gl_LGPL or gl_LGPL([VERSION]) AC_DEFUN([gl_LGPL], []) +dnl Usage: gl_GPL([VERSION]) +AC_DEFUN([gl_GPL], []) + dnl Usage: gl_MAKEFILE_NAME([FILENAME]) AC_DEFUN([gl_MAKEFILE_NAME], []) diff --git a/gl/m4/hostent.m4 b/gl/m4/hostent.m4 index 36dc636e..9278285c 100644 --- a/gl/m4/hostent.m4 +++ b/gl/m4/hostent.m4 @@ -1,9 +1,10 @@ # hostent.m4 # serial 5 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_HOSTENT], [ diff --git a/gl/m4/idpriv.m4 b/gl/m4/idpriv.m4 index 53693527..6e855e9a 100644 --- a/gl/m4/idpriv.m4 +++ b/gl/m4/idpriv.m4 @@ -1,9 +1,10 @@ # idpriv.m4 # serial 1 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_IDPRIV], [ diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 03e85251..80de991e 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 @@ -1,9 +1,10 @@ # include_next.m4 # serial 27 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert and Derek Price. diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 168e17e0..693bd51b 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 @@ -1,9 +1,10 @@ # inet_ntop.m4 # serial 22 -dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_INET_NTOP], [ diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4 new file mode 100644 index 00000000..b6e59a25 --- /dev/null +++ b/gl/m4/inet_pton.m4 @@ -0,0 +1,72 @@ +# inet_pton.m4 +# serial 20 +dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_INET_PTON], +[ + AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS]) + + dnl Persuade Solaris to declare inet_pton. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl Most platforms that provide inet_pton define it in libc. + dnl Solaris 8..10 provide inet_pton in libnsl instead. + dnl Solaris 2.6..7 provide inet_pton in libresolv instead. + dnl Haiku provides it in -lnetwork. + dnl Native Windows provides it in -lws2_32 instead, with a declaration in + dnl , and it uses stdcall calling convention, not cdecl + dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). + HAVE_INET_PTON=1 + INET_PTON_LIB= + gl_PREREQ_SYS_H_WINSOCK2 + if test $HAVE_WINSOCK2_H = 1; then + dnl It needs to be overridden, because the stdcall calling convention + dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid + dnl a name conflict at the linker level, even though the header file + dnl declares inet_pton only if _WIN32_WINNT >= 0x0600. + REPLACE_INET_PTON=1 + AC_CHECK_DECLS([inet_pton],,, [[#include ]]) + if test $ac_cv_have_decl_inet_pton = yes; then + INET_PTON_LIB="-lws2_32" + else + HAVE_DECL_INET_PTON=0 + fi + else + gl_saved_LIBS=$LIBS + AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [], + [AC_CHECK_FUNCS([inet_pton]) + if test $ac_cv_func_inet_pton = no; then + HAVE_INET_PTON=0 + fi + ]) + LIBS=$gl_saved_LIBS + + if test "$ac_cv_search_inet_pton" != "no" \ + && test "$ac_cv_search_inet_pton" != "none required"; then + INET_PTON_LIB="$ac_cv_search_inet_pton" + fi + + AC_CHECK_HEADERS_ONCE([netdb.h]) + AC_CHECK_DECLS([inet_pton],,, + [[#include + #if HAVE_NETDB_H + # include + #endif + ]]) + if test $ac_cv_have_decl_inet_pton = no; then + HAVE_DECL_INET_PTON=0 + fi + fi + AC_SUBST([INET_PTON_LIB]) +]) + +# Prerequisites of lib/inet_pton.c. +AC_DEFUN([gl_PREREQ_INET_PTON], [ + AC_REQUIRE([gl_SOCKET_FAMILIES]) +]) diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4 index 72858ea8..c1df7b27 100644 --- a/gl/m4/intmax_t.m4 +++ b/gl/m4/intmax_t.m4 @@ -1,10 +1,11 @@ # intmax_t.m4 # serial 9 -dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 1997-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. diff --git a/gl/m4/inttypes.m4 b/gl/m4/inttypes.m4 index c43cd162..63c82c61 100644 --- a/gl/m4/inttypes.m4 +++ b/gl/m4/inttypes.m4 @@ -1,9 +1,10 @@ # inttypes.m4 # serial 37 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Derek Price, Bruno Haible. dnl Test whether is supported or must be substituted. diff --git a/gl/m4/inttypes_h.m4 b/gl/m4/inttypes_h.m4 index 3b9da5b0..ad939a53 100644 --- a/gl/m4/inttypes_h.m4 +++ b/gl/m4/inttypes_h.m4 @@ -1,9 +1,10 @@ # inttypes_h.m4 # serial 10 -dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. diff --git a/gl/m4/iswblank.m4 b/gl/m4/iswblank.m4 index 4dc12d9a..d06b16a2 100644 --- a/gl/m4/iswblank.m4 +++ b/gl/m4/iswblank.m4 @@ -1,9 +1,10 @@ # iswblank.m4 # serial 7 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWBLANK], [ diff --git a/gl/m4/iswctype.m4 b/gl/m4/iswctype.m4 index 16031be4..f5a3b760 100644 --- a/gl/m4/iswctype.m4 +++ b/gl/m4/iswctype.m4 @@ -1,9 +1,10 @@ # iswctype.m4 # serial 3 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWCTYPE], [ diff --git a/gl/m4/iswdigit.m4 b/gl/m4/iswdigit.m4 index 999acd28..4582f598 100644 --- a/gl/m4/iswdigit.m4 +++ b/gl/m4/iswdigit.m4 @@ -1,9 +1,10 @@ # iswdigit.m4 -# serial 7 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +# serial 9 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWDIGIT], [ @@ -11,7 +12,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT], 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_EN_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -26,14 +27,14 @@ AC_DEFUN([gl_FUNC_ISWDIGIT], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on FreeBSD, NetBSD, Solaris, native Windows. - freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. + freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) 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 + if test $LOCALE_FR != none || test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -83,15 +84,15 @@ main (int argc, char *argv[]) if (!(is == 0)) result |= 2; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { - /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ + /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* 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. */ + /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* U+FF11 FULLWIDTH DIGIT ONE */ is = for_character ("\357\274\221", 3); if (!(is == 0)) diff --git a/gl/m4/iswpunct.m4 b/gl/m4/iswpunct.m4 index 1edf58aa..d8e8d712 100644 --- a/gl/m4/iswpunct.m4 +++ b/gl/m4/iswpunct.m4 @@ -1,9 +1,10 @@ # iswpunct.m4 # serial 2 -dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_ISWPUNCT], [ diff --git a/gl/m4/iswxdigit.m4 b/gl/m4/iswxdigit.m4 index 6085bf6b..95226fc4 100644 --- a/gl/m4/iswxdigit.m4 +++ b/gl/m4/iswxdigit.m4 @@ -1,16 +1,17 @@ # iswxdigit.m4 -# serial 7 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +# serial 9 +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. 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_EN_UTF8]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) @@ -25,14 +26,14 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT], dnl is present. changequote(,)dnl case "$host_os" in - # Guess no on FreeBSD, NetBSD, Solaris, native Windows. - freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) + # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android. + freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*) 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 + if test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -73,15 +74,15 @@ main (int argc, char *argv[]) if (!(is == 0)) result |= 1; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { - /* This fails on FreeBSD 13.0. */ + /* This fails on FreeBSD 13.0, Haiku, Android. */ /* 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. */ + /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */ /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ is = for_character ("\357\274\241", 3); if (!(is == 0)) diff --git a/gl/m4/langinfo_h.m4 b/gl/m4/langinfo_h.m4 index 5eee8a71..69f936f0 100644 --- a/gl/m4/langinfo_h.m4 +++ b/gl/m4/langinfo_h.m4 @@ -1,9 +1,10 @@ # langinfo_h.m4 -# serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 13 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_LANGINFO_H], [ @@ -19,6 +20,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], HAVE_LANGINFO_CODESET=0 HAVE_LANGINFO_T_FMT_AMPM=0 HAVE_LANGINFO_ALTMON=0 + HAVE_LANGINFO_ABALTMON=0 HAVE_LANGINFO_ERA=0 HAVE_LANGINFO_YESEXPR=0 AC_CHECK_HEADERS_ONCE([langinfo.h]) @@ -29,6 +31,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H], dnl ERA etc. are missing on OpenBSD 6.7. dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. dnl ALTMON_* are missing on glibc 2.26 and many other systems. + dnl ABALTMON_* are missing on glibc 2.41 and many other systems. AC_CACHE_CHECK([whether langinfo.h defines CODESET], [gl_cv_header_langinfo_codeset], [AC_COMPILE_IFELSE( @@ -65,6 +68,18 @@ int a = ALTMON_1; if test $gl_cv_header_langinfo_altmon = yes; then HAVE_LANGINFO_ALTMON=1 fi + AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1], + [gl_cv_header_langinfo_abaltmon], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include +int a = ABALTMON_1; +]])], + [gl_cv_header_langinfo_abaltmon=yes], + [gl_cv_header_langinfo_abaltmon=no]) + ]) + if test $gl_cv_header_langinfo_abaltmon = yes; then + HAVE_LANGINFO_ABALTMON=1 + fi AC_CACHE_CHECK([whether langinfo.h defines ERA], [gl_cv_header_langinfo_era], [AC_COMPILE_IFELSE( @@ -96,6 +111,7 @@ int a = YESEXPR; AC_SUBST([HAVE_LANGINFO_CODESET]) AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) AC_SUBST([HAVE_LANGINFO_ALTMON]) + AC_SUBST([HAVE_LANGINFO_ABALTMON]) AC_SUBST([HAVE_LANGINFO_ERA]) AC_SUBST([HAVE_LANGINFO_YESEXPR]) diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4 index 2f824089..b24f657d 100644 --- a/gl/m4/largefile.m4 +++ b/gl/m4/largefile.m4 @@ -1,9 +1,10 @@ # largefile.m4 -# serial 1 -dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. +# serial 2 +dnl Copyright 1992-1996, 1998-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Enable large files on systems where this is not the default. # Enable support for files on Linux file systems with 64-bit inode numbers. @@ -88,7 +89,7 @@ m4_define([_AC_SYS_YEAR2038_OPTIONS], m4_normalize( # 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 $CPPFLAGS option for timestamps after 2038], +[AC_CACHE_CHECK([for $CC option to support timestamps after 2038], [ac_cv_sys_year2038_opts], [ac_save_CPPFLAGS="$CPPFLAGS" ac_opt_found=no @@ -234,7 +235,7 @@ 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 $CPPFLAGS option for large files], +[AC_CACHE_CHECK([for $CC option to support large files], [ac_cv_sys_largefile_opts], [ac_save_CPPFLAGS=$CPPFLAGS ac_opt_found=no @@ -294,7 +295,7 @@ AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])]) # By default, many hosts won't let programs access large files; # one must use special compiler options to get large-file access to work. # For more details about this brain damage please see: -# http://www.unix.org/version2/whatsnew/lfs20mar.html +# https://www.unix.org/version2/whatsnew/lfs20mar.html # Additionally, on Linux file systems with 64-bit inodes a file that happens # to have a 64-bit inode number cannot be accessed by 32-bit applications on # Linux x86/x86_64. This can occur with file systems such as XFS and NFS. diff --git a/gl/m4/libunistring-base.m4 b/gl/m4/libunistring-base.m4 new file mode 100644 index 00000000..9b5795ed --- /dev/null +++ b/gl/m4/libunistring-base.m4 @@ -0,0 +1,204 @@ +# libunistring-base.m4 +# serial 10 +dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Paolo Bonzini and Bruno Haible. + +dnl gl_LIBUNISTRING_MODULE([VERSION], [Module]) +dnl Declares that the source files of Module should be compiled, unless we +dnl are linking with libunistring and its version is >= the given VERSION. +dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is +dnl true if the source files of Module should be compiled. +dnl This macro is to be used for public libunistring API, not for +dnl undocumented API. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a change that affects the behaviour of the +dnl functions defined in Module (even if the sources of Module itself do not +dnl change). +dnl +dnl This macro invocation must not occur in macros that are AC_REQUIREd. + +AC_DEFUN([gl_LIBUNISTRING_MODULE], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]), + [gl_LIBUNISTRING_VERSION_CMP([$1])]) +]) + +dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module]) +dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also +dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE. +dnl What's the expansion of this autoconf variable? +dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE. +dnl (This is necessary because this token must be present in the .h files +dnl when the .h files get installed.) +dnl - When building gnulib or application code it expands to +dnl - LIBUNISTRING_DLL_VARIABLE by default, +dnl - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates +dnl to true: the value of +dnl ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME +dnl (which usually is empty, unless explicitly set in configure.ac). +dnl (This is necessary because when the conditional evaluates to false, +dnl the application code expects to use the declared variable from the +dnl installed libunistring; it's in this case that the +dnl LIBUNISTRING_DLL_VARIABLE macro from the installed +dnl must be used.) +dnl +dnl This macro invocation must not occur in macros that are AC_REQUIREd. + +AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE], +[ + gl_LIBUNISTRING_MODULE([$1], [$2]) + m4_ifndef([gl_IN_LIBUNISTRING], + [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then + GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME + fi + ]) +]) + +dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile]) +dnl Declares that HeaderFile should be created, unless we are linking +dnl with libunistring and its version is >= the given VERSION. +dnl HeaderFile should be relative to the lib directory and end in '.h'. +dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty). +dnl +dnl When we are linking with the already installed libunistring and its version +dnl is < VERSION, we create HeaderFile here, because we may compile functions +dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed +dnl version. +dnl When we are linking with the already installed libunistring and its version +dnl is > VERSION, we don't create HeaderFile here: it could cause compilation +dnl errors in other libunistring header files if some types are missing. +dnl +dnl You have to bump the VERSION argument to the next projected version +dnl number each time you make a non-comment change to the HeaderFile. + +AC_DEFUN([gl_LIBUNISTRING_LIBHEADER], +[ + AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE]) + dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from + dnl gl_LIBUNISTRING_CORE if that macro has been run. + if gl_LIBUNISTRING_VERSION_CMP([$1]); then + dnl It is OK to use a .h file in lib/ from within tests/, but not vice + dnl versa. + if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then + LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2" + fi + else + LIBUNISTRING_[]AS_TR_CPP([$2])= + fi + AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2])) +]) + +dnl Miscellaneous preparations/initializations. + +AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE], +[ + dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point. + m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])]) + + AC_REQUIRE([AC_PROG_AWK]) + +dnl Sed expressions to extract the parts of a version number. +changequote(,) +gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +changequote([,]) + + if test "$HAVE_LIBUNISTRING" = yes; then + LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"` + LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"` + LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"` + fi + + dnl Determine whether from an installed libunistring + dnl is available. + m4_ifdef([gl_IN_LIBUNISTRING], + [dnl In libunistring, all .h files that declare variables need to + dnl #include . This references the file + dnl unistring/woe32dll.h in libunistring. + HAVE_UNISTRING_WOE32DLL_H=1 + ], + [dnl In gnulib or in applications, we need a #include + dnl if and only if an installed libunistring is available. + if test "$HAVE_LIBUNISTRING" = yes; then + AC_CHECK_HEADERS([unistring/woe32dll.h], + [HAVE_UNISTRING_WOE32DLL_H=1], + [HAVE_UNISTRING_WOE32DLL_H=0]) + else + HAVE_UNISTRING_WOE32DLL_H=0 + fi + ]) + AC_SUBST([HAVE_UNISTRING_WOE32DLL_H]) +]) + +dnl gl_LIBUNISTRING_VERSION_CMP([VERSION]) +dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION +dnl is less than the VERSION argument. +AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP], +[dnl VERSION = 999.9 means to evaluates to true always, i.e. to ignore +dnl the installed libunistring regardless of its version. +m4_if([$1], [999.9], +[true], +[ { test "$HAVE_LIBUNISTRING" != yes \ + || { + dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least. + AS_LITERAL_IF([$1], + [dnl This is the optimized variant, that assumes the argument is a literal: + m4_pushdef([requested_version_major], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])]) + m4_pushdef([requested_version_minor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + m4_pushdef([requested_version_subminor], + [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])]) + test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor + } + } + } + m4_popdef([requested_version_subminor]) + m4_popdef([requested_version_minor]) + m4_popdef([requested_version_major]) + ], + [dnl This is the unoptimized variant: + requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"` + requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"` + requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"` + test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \ + || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \ + && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \ + || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \ + && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor + } + } + } + ]) + } + }])]) + +dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the +dnl same as ORIG, otherwise to 0. +m4_define([gl_LIBUNISTRING_ARG_OR_ZERO], [m4_if([$1], [$2], [0], [$1])]) diff --git a/gl/m4/limits-h.m4 b/gl/m4/limits-h.m4 index 1b619e1e..202df492 100644 --- a/gl/m4/limits-h.m4 +++ b/gl/m4/limits-h.m4 @@ -1,9 +1,10 @@ # limits-h.m4 # serial 1 -dnl Copyright 2016-2024 Free Software Foundation, Inc. +dnl Copyright 2016-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check whether limits.h has needed features. diff --git a/gl/m4/localcharset.m4 b/gl/m4/localcharset.m4 index 807a5eed..374a48f1 100644 --- a/gl/m4/localcharset.m4 +++ b/gl/m4/localcharset.m4 @@ -1,9 +1,10 @@ # localcharset.m4 # serial 8 -dnl Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_LOCALCHARSET], [ diff --git a/gl/m4/locale-en.m4 b/gl/m4/locale-en.m4 new file mode 100644 index 00000000..4151428a --- /dev/null +++ b/gl/m4/locale-en.m4 @@ -0,0 +1,138 @@ +# locale-en.m4 +# serial 1 +dnl Copyright (C) 2003-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +dnl Determine the name of an English (or American English) locale with +dnl UTF-8 encoding. +AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AM_LANGINFO_CODESET]) + AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [ + case "$host_os" in + *-musl* | midipix*) + dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without + dnl any locale file on disk. But they are effectively equivalent to the + dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) + dnl for which localizations (.mo files) have been installed. + gt_cv_locale_en_utf8=en_US.UTF-8 + ;; + *) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0 + || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0)) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check the third month name. */ + t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24; + if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0) + return 1; +#endif +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a dot. */ + if (localeconv () ->decimal_point[0] != '.') return 1; +#endif + return 0; +} + ]])]) + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw* | windows*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8='English_United States.65001' + else + # None found. + gt_cv_locale_en_utf8=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name with explicit encoding suffix first + # (this is necessary on Haiku). + if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US.UTF-8 + else + # Test for the locale name without encoding suffix. + if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en_US + else + # Test for the Solaris 10 locale name. + if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_en_utf8=en.UTF-8 + else + # None found. + gt_cv_locale_en_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + ;; + esac + ]) + LOCALE_EN_UTF8="$gt_cv_locale_en_utf8" + case "$LOCALE_EN_UTF8" in #( + '' | *[[\"\$\'*@<:@]]*) + dnl The empty value occurs when the conftest.c program above could not + dnl be compiled. The other values might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"]) + LOCALE_EN_UTF8=none;; + esac + AC_SUBST([LOCALE_EN_UTF8]) +]) diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index f8d7c543..f504d5b5 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 @@ -1,9 +1,10 @@ # locale-fr.m4 -# serial 23 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 24 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -71,8 +72,9 @@ int main () { if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; # if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale + and on Haiku in the fr_FR.UTF-8 locale, + localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; # endif return 0; @@ -82,10 +84,11 @@ int main () { 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", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # Test for the native Windows locale name. @@ -214,8 +217,9 @@ int main () { #endif #if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale + and on Haiku in the fr_FR.UTF-8 locale, + localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */ if (localeconv () ->decimal_point[0] != ',') return 1; #endif return 0; @@ -224,10 +228,11 @@ int main () { 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", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # Test for the hypothetical native Windows locale name. diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index 8423bcb9..1c813b89 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 @@ -1,9 +1,10 @@ # locale-ja.m4 -# serial 18 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 19 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -86,10 +87,11 @@ int main () 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", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # Note that on native Windows, the Japanese locale is diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index 7f1a10be..6f9374d2 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 @@ -1,9 +1,10 @@ # locale-zh.m4 -# serial 18 -dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -22,6 +23,7 @@ AC_DEFUN_ONCE([gt_LOCALE_ZH_CN], #endif #include #include +#include struct tm t; char buf[16]; int main () @@ -80,6 +82,19 @@ int main () single wide character. This excludes the GB2312 and GBK encodings. */ if (mblen ("\203\062\332\066", 5) != 4) return 1; + /* Check whether mbrtowc accept this character one byte at a time. + This excludes NetBSD 10.0. */ + if (sizeof (wchar_t) > 2) + { + wchar_t wc; + mbstate_t state; + memset (&state, 0, sizeof (state)); + if (!(mbrtowc (&wc, "\203", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\062", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\332", 1, &state) == (size_t)(-2) + && mbrtowc (&wc, "\066", 1, &state) == 1)) + return 1; + } return 0; #endif } @@ -87,10 +102,11 @@ int main () 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", + # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "en" or "eng" as "English" or "English_United States.1252", # "fr" or "fra" as "French" or "French_France.1252", # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", + # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932", # and similar. mingw* | windows*) # Test for the hypothetical native Windows locale name. diff --git a/gl/m4/locale_h.m4 b/gl/m4/locale_h.m4 index cd1c81ec..e1afbc16 100644 --- a/gl/m4/locale_h.m4 +++ b/gl/m4/locale_h.m4 @@ -1,9 +1,10 @@ # locale_h.m4 -# serial 31 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 37 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_LOCALE_H], [ @@ -19,6 +20,26 @@ AC_DEFUN_ONCE([gl_LOCALE_H], AC_REQUIRE([gl_STDDEF_H]) AC_REQUIRE([gl_LOCALE_T]) + dnl On native Windows, there is a type '_locale_t' that can be used to + dnl define locale_t. + AC_CACHE_CHECK([whether locale.h defines _locale_t], + [gl_cv_header_locale_has_windows_locale_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + _locale_t x;]], + [[]])], + [gl_cv_header_locale_has_windows_locale_t=yes], + [gl_cv_header_locale_has_windows_locale_t=no]) + ]) + if test $gl_cv_header_locale_has_windows_locale_t = yes; then + HAVE_WINDOWS_LOCALE_T=1 + AC_DEFINE([HAVE_WINDOWS_LOCALE_T], [1], + [Define to 1 if defines the _locale_t type.]) + else + HAVE_WINDOWS_LOCALE_T=0 + fi + AC_SUBST([HAVE_WINDOWS_LOCALE_T]) dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' dnl only if _LCONV_C99 is defined. @@ -86,7 +107,7 @@ AC_DEFUN_ONCE([gl_LOCALE_H], # include #endif ]], - [setlocale newlocale duplocale freelocale]) + [setlocale newlocale duplocale freelocale getlocalename_l]) ]) dnl Checks to determine whether the system has the locale_t type, @@ -130,6 +151,7 @@ AC_DEFUN([gl_LOCALE_T], fi fi AC_SUBST([HAVE_XLOCALE_H]) + AC_SUBST([HAVE_LOCALE_T]) ]) # gl_LOCALE_MODULE_INDICATOR([modulename]) @@ -154,7 +176,11 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NEWLOCALE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREELOCALE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L_UNSAFE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) @@ -164,14 +190,16 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_LOCALE_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. - HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) - HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) - HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) - REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) - REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) - REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) - REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) - REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) - REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) + HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) + HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) + HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) + HAVE_GETLOCALENAME_L=1; AC_SUBST([HAVE_GETLOCALENAME_L]) + REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) + REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) + REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) + REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) + REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) + REPLACE_GETLOCALENAME_L=0; AC_SUBST([REPLACE_GETLOCALENAME_L]) + REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) ]) diff --git a/gl/m4/localeconv.m4 b/gl/m4/localeconv.m4 index 77d5684f..55a669d0 100644 --- a/gl/m4/localeconv.m4 +++ b/gl/m4/localeconv.m4 @@ -1,9 +1,10 @@ # localeconv.m4 # serial 3 -dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_LOCALECONV], [ diff --git a/gl/m4/lock.m4 b/gl/m4/lock.m4 index eb0fc6a1..b1d3f435 100644 --- a/gl/m4/lock.m4 +++ b/gl/m4/lock.m4 @@ -1,9 +1,10 @@ # lock.m4 # serial 14 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4 index 0bc3d65e..ddfadd38 100644 --- a/gl/m4/lseek.m4 +++ b/gl/m4/lseek.m4 @@ -1,9 +1,10 @@ # lseek.m4 # serial 15 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_LSEEK], [ diff --git a/gl/m4/lstat.m4 b/gl/m4/lstat.m4 new file mode 100644 index 00000000..efae2485 --- /dev/null +++ b/gl/m4/lstat.m4 @@ -0,0 +1,82 @@ +# lstat.m4 +# serial 36 +dnl Copyright (C) 1997-2001, 2003-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Jim Meyering. + +AC_DEFUN([gl_FUNC_LSTAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + dnl If lstat does not exist, the replacement does + dnl "#define lstat stat", and lstat.c is a no-op. + AC_CHECK_FUNCS_ONCE([lstat]) + if test $ac_cv_func_lstat = yes; then + AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK]) + case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in + darwin* | solaris* | *no) + REPLACE_LSTAT=1 + ;; + esac + else + HAVE_LSTAT=0 + fi +]) + +# Prerequisites of lib/lstat.c. +AC_DEFUN([gl_PREREQ_LSTAT], [:]) + +AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], +[ + dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it + dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether lstat correctly handles trailing slash], + [gl_cv_func_lstat_dereferences_slashed_symlink], + [rm -f conftest.sym conftest.file + echo >conftest.file + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [AC_INCLUDES_DEFAULT], + [[struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + ]])], + [gl_cv_func_lstat_dereferences_slashed_symlink=yes], + [gl_cv_func_lstat_dereferences_slashed_symlink=no], + [case "$host_os" in + linux-* | linux) + # Guess yes on Linux systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + midipix*) + # Guess yes on systems that emulate the Linux system calls. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *-gnu* | gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + mingw* | windows*) + # Guess no on native Windows. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.sym conftest.file + ]) + case "$gl_cv_func_lstat_dereferences_slashed_symlink" in + *yes) + AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1], + [Define to 1 if 'lstat' dereferences a symlink specified + with a trailing slash.]) + ;; + esac +]) diff --git a/gl/m4/malloc.m4 b/gl/m4/malloc.m4 index 41a46937..547b4e4d 100644 --- a/gl/m4/malloc.m4 +++ b/gl/m4/malloc.m4 @@ -1,12 +1,24 @@ # malloc.m4 -# serial 31 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 43.1 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -# This is adapted with modifications from upstream Autoconf here: -# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 +m4_version_prereq([2.73], [], [ +# Modules that use this macro directly or indirectly should depend +# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined +# before this macro gets invoked. This helps on AIX 7.2 and earlier +# if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise. +# +# This is copied from upstream Autoconf here: +# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=1f38316f6af7bf63e5e7dd187ff6456e07ad743e#n971 +# _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT[, UNKNOWN-ASSUME]) +# ------------------------------------------------------ +# If 'malloc (0)' returns nonnull, run IF-WORKS, otherwise, IF-NOT. +# If it is not known whether it works, assume the shell word UNKNOWN-ASSUME, +# which should end in "yes" or in something else (the latter is the default). AC_DEFUN([_AC_FUNC_MALLOC_IF], [ AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles @@ -15,56 +27,81 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include - ]], - [[void *p = malloc (0); - void * volatile vp = p; - int result = !vp; + /* Use pmalloc to test; 'volatile' prevents the compiler + from optimizing the malloc call away. */ + void *(*volatile pmalloc) (size_t) = malloc;]], + [[void *p = pmalloc (0); + int result = !p; free (p); - return result;]]) - ], + return result;]])], [ac_cv_func_malloc_0_nonnull=yes], [ac_cv_func_malloc_0_nonnull=no], - [case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | 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" ;; - esac - ]) - ]) + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | gnu* | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin* | mingw* | windows* | msys*], + [ac_cv_func_malloc_0_nonnull="guessing yes"], + [# Guess as follows if we don't know. + ac_cv_func_malloc_0_nonnull=m4_default([$3], ["guessing no"])])])]) AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) ])# _AC_FUNC_MALLOC_IF +]) + +# gl_FUNC_MALLOC_0_NONNULL +# ------------------------ +# If 'malloc (0)' returns nonnull define HAVE_MALLOC_0_NONNULL. +# Also, set ac_cv_func_malloc_0_nonnull to a string that ends in +# "yes", otherwise set it to something else. If unknown whether +# malloc (0) works, guess as normal for cross-builds. +AC_DEFUN([gl_FUNC_MALLOC_0_NONNULL], +[ + _AC_FUNC_MALLOC_IF( + [AC_DEFINE([HAVE_MALLOC_0_NONNULL], [1], + [Define to 1 if malloc (0) returns nonnull.])], + [], + ["$gl_cross_guess_normal"]) +]) # gl_FUNC_MALLOC_GNU # ------------------ -# Replace malloc if it is not compatible with GNU libc. +# Test whether malloc (0) is compatible with GNU libc. +# Replace malloc if not. +# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon +# out-of-memory). +# Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds +# PTRDIFF_MAX. AC_DEFUN([gl_FUNC_MALLOC_GNU], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" - if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then - _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) - fi + AC_REQUIRE([gl_FUNC_MALLOC_0_NONNULL]) + + AS_CASE([$ac_cv_func_malloc_0_nonnull], + [*yes], + [REPLACE_MALLOC_FOR_MALLOC_GNU=$REPLACE_MALLOC_FOR_MALLOC_POSIX], + [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) ]) # gl_FUNC_MALLOC_PTRDIFF # ---------------------- -# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, -# and replace malloc otherwise. +# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX. +# Define HAVE_MALLOC_PTRDIFF if yes. +# Replace malloc if not. AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) - test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 + AS_IF([test "$gl_cv_malloc_ptrdiff" = yes], + [AC_DEFINE([HAVE_MALLOC_PTRDIFF], 1, + [Define to 1 if malloc-like functions do not allocate objects + larger than PTRDIFF_MAX bytes.])], + [REPLACE_MALLOC_FOR_MALLOC_POSIX=1]) ]) -# Test whether malloc, realloc, calloc refuse to create objects +# Test whether malloc, calloc refuse to create objects # larger than what can be expressed in ptrdiff_t. -# Set gl_cv_func_malloc_gnu to yes or no accordingly. +# Set gl_cv_func_malloc_gnu. AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], [ AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], @@ -108,30 +145,48 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) - if test "$gl_cv_func_malloc_posix" = yes; then - AC_DEFINE([HAVE_MALLOC_POSIX], [1], - [Define if malloc, realloc, and calloc set errno on allocation failure.]) - else - REPLACE_MALLOC_FOR_MALLOC_POSIX=1 - fi + case "$gl_cv_func_malloc_posix" in + *yes) + AC_DEFINE([HAVE_MALLOC_POSIX], [1], + [Define if malloc and calloc set errno on allocation failure.]) + ;; + *) + REPLACE_MALLOC_FOR_MALLOC_POSIX=1 + ;; + esac ]) -# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. -# Set gl_cv_func_malloc_posix to yes or no accordingly. +# Test whether malloc, calloc set errno to ENOMEM on failure. +# Set gl_cv_func_malloc_posix to *yes or *no accordingly. AC_DEFUN([gl_CHECK_MALLOC_POSIX], [ AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], + AC_CACHE_CHECK([whether malloc, calloc set errno on failure], [gl_cv_func_malloc_posix], [ dnl It is too dangerous to try to allocate a large amount of memory: dnl some systems go to their knees when you do that. So assume that dnl all Unix implementations of the function set errno on failure, dnl except on those platforms where we have seen 'test-malloc-gnu', - dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. + dnl 'test-realloc-posix', 'test-calloc-gnu' fail. For platforms + dnl where only 'test-realloc-posix', see realloc.m4. case "$host_os" in mingw* | windows*) - gl_cv_func_malloc_posix=no ;; + dnl Old MSVCRT from 2001 did not set errno=ENOMEM when malloc failed. + dnl More recent MSVCRT from 2019 does so. + dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifndef _UCRT + msvcrt yuck + #endif + ]], + [[]]) + ], + [gl_cv_func_malloc_posix="guessing yes"], + [gl_cv_func_malloc_posix="guessing no"]) + ;; irix* | solaris*) dnl On IRIX 6.5, the three functions return NULL with errno unset dnl when the argument is larger than PTRDIFF_MAX. diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4 index 9e09d22c..cabe5fe7 100644 --- a/gl/m4/malloca.m4 +++ b/gl/m4/malloca.m4 @@ -1,15 +1,16 @@ # malloca.m4 -# serial 2 -dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, +# serial 3 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MALLOCA], [ dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables dnl @ALLOCA@ and @LTALLOCA@. dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. - AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([gl_FUNC_MALLOC_GNU]) ]) diff --git a/gl/m4/math_h.m4 b/gl/m4/math_h.m4 index 4b26c9e9..8c27503b 100644 --- a/gl/m4/math_h.m4 +++ b/gl/m4/math_h.m4 @@ -1,9 +1,10 @@ # math_h.m4 -# serial 138 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 140.1 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_MATH_H], [ @@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_MATH_H], ilogb ilogbf ilogbl ldexpf ldexpl log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l - logb logbf logbl + logb logbf logbl logp1 log1pf logp1l modf modff modfl powf remainder remainderf remainderl rint rintf rintl round roundf roundl @@ -153,6 +154,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) @@ -253,6 +257,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) + HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1]) + HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F]) + HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L]) HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) HAVE_POWF=1; AC_SUBST([HAVE_POWF]) @@ -392,6 +399,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS], REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) + REPLACE_SINL=0; AC_SUBST([REPLACE_SINL]) REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) diff --git a/gl/m4/mbchar.m4 b/gl/m4/mbchar.m4 new file mode 100644 index 00000000..b76f1d7b --- /dev/null +++ b/gl/m4/mbchar.m4 @@ -0,0 +1,15 @@ +# mbchar.m4 +# serial 9 +dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl autoconf tests required for use of mbchar.m4 +dnl From Bruno Haible. + +AC_DEFUN([gl_MBCHAR], +[ + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) +]) diff --git a/gl/m4/mbiter.m4 b/gl/m4/mbiter.m4 new file mode 100644 index 00000000..b51242e6 --- /dev/null +++ b/gl/m4/mbiter.m4 @@ -0,0 +1,16 @@ +# mbiter.m4 +# serial 7 +dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl autoconf tests required for use of mbiter.h +dnl From Bruno Haible. + +AC_DEFUN([gl_MBITER], +[ + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + : +]) diff --git a/gl/m4/mbrtoc32.m4 b/gl/m4/mbrtoc32.m4 new file mode 100644 index 00000000..1991529c --- /dev/null +++ b/gl/m4/mbrtoc32.m4 @@ -0,0 +1,326 @@ +# mbrtoc32.m4 +# serial 21 +dnl Copyright (C) 2014-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_MBRTOC32], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + + AC_REQUIRE([AC_TYPE_MBSTATE_T]) + dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is + dnl determined. It describes how our overridden mbrtowc is implemented. + dnl We then implement mbrtoc32 accordingly. + AC_REQUIRE([gl_MBSTATE_T_BROKEN]) + + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_MBRTOC32_SANITYCHECK]) + + AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) + if test $gl_cv_func_mbrtoc32 = no; then + HAVE_MBRTOC32=0 + else + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then + REPLACE_MBRTOC32=1 + else + gl_MBRTOC32_EMPTY_INPUT + gl_MBRTOC32_C_LOCALE + gl_MBRTOC32_UTF8_LOCALE + case "$gl_cv_func_mbrtoc32_empty_input" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1], + [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.]) + REPLACE_MBRTOC32=1 + ;; + esac + case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1], + [Define if the mbrtoc32 function may signal encoding errors in the C locale.]) + REPLACE_MBRTOC32=1 + ;; + esac + case "$gl_cv_func_mbrtoc32_utf8_locale_works" in + *yes) ;; + *) AC_DEFINE([MBRTOC32_MULTIBYTE_LOCALE_BUG], [1], + [Define if the mbrtoc32 function does not accept the input bytes one-by-one.]) + REPLACE_MBRTOC32=1 + dnl Our replacement mbrtoc32 can handle UTF-8, but not GB18030. + LOCALE_ZH_CN=none + ;; + esac + fi + if test $HAVE_WORKING_MBRTOC32 = 0; then + REPLACE_MBRTOC32=1 + fi + fi +]) + +AC_DEFUN([gl_CHECK_FUNC_MBRTOC32], +[ + dnl Cf. gl_CHECK_FUNCS_ANDROID + AC_CHECK_DECL([mbrtoc32], , , + [[#ifdef __HAIKU__ + #include + #endif + #include + ]]) + if test $ac_cv_have_decl_mbrtoc32 = yes; then + dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a + dnl static inline function on Haiku 2020. + AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], + [[char32_t c; + return mbrtoc32 (&c, "", 1, NULL) == 0; + ]]) + ], + [gl_cv_func_mbrtoc32=yes], + [gl_cv_func_mbrtoc32=no]) + ]) + else + gl_cv_func_mbrtoc32=no + fi +]) + +dnl Test whether mbrtoc32 returns the correct value on empty input. + +AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtoc32 works on empty input], + [gl_cv_func_mbrtoc32_empty_input], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #ifdef __HAIKU__ + #include + #endif + #include + static char32_t wc; + static mbstate_t mbs; + int + main (void) + { + return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2; + }]])], + [gl_cv_func_mbrtoc32_empty_input=yes], + [gl_cv_func_mbrtoc32_empty_input=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + # Guess no on Android. + linux*-android*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + # Guess no on native Windows. + mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;; + *) gl_cv_func_mbrtoc32_empty_input="guessing yes" ;; + esac + ]) + ]) +]) + +dnl +dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error +dnl cannot occur since all byte values are valid characters." It is reasonable +dnl to expect mbrtoc32 to behave in the same way. + +AC_DEFUN([gl_MBRTOC32_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_mbrtoc32_C_locale_sans_EILSEQ], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #ifdef __HAIKU__ + #include + #endif + #include + ]], [[ + int i; + char *locale = setlocale (LC_ALL, "C"); + if (! locale) + return 2; + for (i = CHAR_MIN; i <= CHAR_MAX; i++) + { + char c = i; + char32_t wc; + mbstate_t mbs = { 0, }; + size_t ss = mbrtoc32 (&wc, &c, 1, &mbs); + if (1 < ss) + return 3; + } + return 0; + ]])], + [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes], + [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no], + [case "$host_os" in + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;; + *) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;; + esac + ]) + ]) +]) + +dnl Test whether mbrtoc32 works when it's fed the bytes one-by-one in an UTF-8 +dnl locale. + +AC_DEFUN([gl_MBRTOC32_UTF8_LOCALE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether mbrtoc32 works in an UTF-8 locale], + [gl_cv_func_mbrtoc32_utf8_locale_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #ifdef __HAIKU__ + #include + #endif + #include + ]], [[ + char *locale = setlocale (LC_ALL, "en_US.UTF-8"); + if (locale) + { + /* This test fails on Cygwin 3.5.3. */ + mbstate_t state = { 0, }; + char32_t uc = 0xDEADBEEF; + /* \360\237\220\203 = U+0001F403 */ + if (mbrtoc32 (&uc, "\360", 1, &state) != (size_t)-2) + return 1; + if (mbrtoc32 (&uc, "\237", 1, &state) != (size_t)-2) + return 2; + if (mbrtoc32 (&uc, "\220", 1, &state) != (size_t)-2) + return 3; + if (mbrtoc32 (&uc, "\203", 1, &state) != 1) + return 4; + if (uc != 0x0001F403) + return 5; + } + return 0; + ]])], + [gl_cv_func_mbrtoc32_utf8_locale_works=yes], + [gl_cv_func_mbrtoc32_utf8_locale_works=no], + [case "$host_os" in + # Guess no on Cygwin. + cygwin*) gl_cv_func_mbrtoc32_utf8_locale_works="guessing no" ;; + *) gl_cv_func_mbrtoc32_utf8_locale_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) +]) + +dnl Test whether mbrtoc32 works not worse than mbrtowc. +dnl Result is HAVE_WORKING_MBRTOC32. + +AC_DEFUN([gl_MBRTOC32_SANITYCHECK], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([gl_TYPE_CHAR32_T]) + AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32]) + AC_REQUIRE([gt_LOCALE_FR]) + AC_REQUIRE([gt_LOCALE_ZH_CN]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then + HAVE_WORKING_MBRTOC32=0 + else + AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc], + [gl_cv_func_mbrtoc32_sanitycheck], + [ + 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, Solaris, native Windows. + freebsd* | midnightbsd* | solaris* | mingw* | windows*) + gl_cv_func_mbrtoc32_sanitycheck="guessing no" + ;; + # Guess yes otherwise. + *) + gl_cv_func_mbrtoc32_sanitycheck="guessing yes" + ;; + esac +changequote([,])dnl + if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +#ifdef __HAIKU__ + #include +#endif +#include +int main () +{ + int result = 0; + /* This fails on native Windows: + mbrtoc32 returns (size_t)-1. + mbrtowc returns 1 (correct). */ + if (strcmp ("$LOCALE_FR", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_FR") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\374", 1, &state) == 1) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\374", 1, &state) != 1) + result |= 1; + } + } + /* This fails on FreeBSD 13.0 and Solaris 11.4: + mbrtoc32 returns (size_t)-2 or (size_t)-1. + mbrtowc returns 4 (correct). */ + if (strcmp ("$LOCALE_ZH_CN", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) + { + mbstate_t state; + wchar_t wc = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4) + { + char32_t c32 = (wchar_t) 0xBADFACE; + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4) + result |= 2; + } + } + return result; +}]])], + [gl_cv_func_mbrtoc32_sanitycheck=yes], + [gl_cv_func_mbrtoc32_sanitycheck=no], + [:]) + fi + ]) + case "$gl_cv_func_mbrtoc32_sanitycheck" in + *yes) + HAVE_WORKING_MBRTOC32=1 + AC_DEFINE([HAVE_WORKING_MBRTOC32], [1], + [Define if the mbrtoc32 function basically works.]) + ;; + *) HAVE_WORKING_MBRTOC32=0 ;; + esac + fi + AC_SUBST([HAVE_WORKING_MBRTOC32]) +]) + +# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c. +AC_DEFUN([gl_PREREQ_MBRTOC32], [ + AC_REQUIRE([gl_C32RTOMB_SANITYCHECK]) + : +]) diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index 62c4fdb3..cc09a5fb 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 @@ -1,10 +1,11 @@ # mbrtowc.m4 -# serial 44 -*- coding: utf-8 -*- -dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, +# serial 46 +dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBRTOWC], [ @@ -160,7 +161,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE], [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_JA]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], [gl_cv_func_mbrtowc_incomplete_state], @@ -200,7 +201,7 @@ int main () [gl_cv_func_mbrtowc_incomplete_state=no], [:]) else - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -208,7 +209,7 @@ int main () #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { const char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; @@ -288,7 +289,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1. AC_DEFUN([gl_MBRTOWC_NULL_ARG1], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], [gl_cv_func_mbrtowc_null_arg1], @@ -303,7 +304,7 @@ changequote(,)dnl *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -314,7 +315,7 @@ int main () { int result = 0; - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { char input[] = "\303\237er"; mbstate_t state; @@ -351,7 +352,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg2. AC_DEFUN([gl_MBRTOWC_NULL_ARG2], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], [gl_cv_func_mbrtowc_null_arg2], @@ -366,7 +367,7 @@ changequote(,)dnl *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none; then + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -374,7 +375,7 @@ changequote([,])dnl #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { mbstate_t state; wchar_t wc; @@ -404,7 +405,7 @@ dnl Result is gl_cv_func_mbrtowc_retval. AC_DEFUN([gl_MBRTOWC_RETVAL], [ AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether mbrtowc has a correct return value], @@ -422,7 +423,7 @@ changequote(,)dnl gl_cv_func_mbrtowc_retval="guessing yes" ;; esac changequote([,])dnl - if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ + if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \ || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ @@ -434,8 +435,8 @@ int main () int result = 0; int found_some_locale = 0; /* This fails on Solaris. */ - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { char input[] = "B\303\274\303\237er"; /* "Büßer" */ mbstate_t state; @@ -649,8 +650,8 @@ int main () [:]) ;; *) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) - if test $LOCALE_FR_UTF8 != none; then + AC_REQUIRE([gt_LOCALE_EN_UTF8]) + if test "$LOCALE_EN_UTF8" != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -658,7 +659,7 @@ int main () #include int main () { - if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { wchar_t wc = (wchar_t) 0xBADFACE; mbstate_t state; diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4 index 10c86ba9..69cfa574 100644 --- a/gl/m4/mbsinit.m4 +++ b/gl/m4/mbsinit.m4 @@ -1,9 +1,10 @@ # mbsinit.m4 # serial 10 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBSINIT], [ diff --git a/gl/m4/mbstate_t.m4 b/gl/m4/mbstate_t.m4 index 66d65cd7..59df1e2e 100644 --- a/gl/m4/mbstate_t.m4 +++ b/gl/m4/mbstate_t.m4 @@ -1,9 +1,10 @@ # mbstate_t.m4 # serial 14 -dnl Copyright (C) 2000-2002, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2000-2002, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # From Paul Eggert. diff --git a/gl/m4/mbtowc.m4 b/gl/m4/mbtowc.m4 index 603b0c1a..3e3f6ce0 100644 --- a/gl/m4/mbtowc.m4 +++ b/gl/m4/mbtowc.m4 @@ -1,9 +1,10 @@ # mbtowc.m4 # serial 5 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_MBTOWC], [ diff --git a/gl/m4/memchr.m4 b/gl/m4/memchr.m4 index 346a2882..1c2ecf1d 100644 --- a/gl/m4/memchr.m4 +++ b/gl/m4/memchr.m4 @@ -1,9 +1,10 @@ # memchr.m4 -# serial 19 -dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. +# serial 20 +dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_MEMCHR], [ @@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR], if (fd >= 0) # endif { - int pagesize = getpagesize (); + long int pagesize = sysconf (_SC_PAGESIZE); char *two_pages = (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, flags, fd, 0); diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4 index bc7d0c34..69c8a89f 100644 --- a/gl/m4/minmax.m4 +++ b/gl/m4/minmax.m4 @@ -1,9 +1,10 @@ # minmax.m4 # serial 4 -dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_PREREQ([2.53]) diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index 85c52454..eca6c4d8 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 @@ -1,9 +1,11 @@ # mktime.m4 -# serial 39 -dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. +# serial 42 +dnl Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4 index 61ca0120..3f7a6656 100644 --- a/gl/m4/mmap-anon.m4 +++ b/gl/m4/mmap-anon.m4 @@ -1,9 +1,10 @@ # mmap-anon.m4 # serial 12 -dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Detect how mmap can be used to create anonymous (not file-backed) memory # mappings. diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4 index 0d5c2808..7dae201b 100644 --- a/gl/m4/mode_t.m4 +++ b/gl/m4/mode_t.m4 @@ -1,9 +1,10 @@ # mode_t.m4 # serial 2 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # For using mode_t, it's sufficient to use AC_TYPE_MODE_T and # include . diff --git a/gl/m4/mountlist.m4 b/gl/m4/mountlist.m4 index ff414e66..e7eac2e9 100644 --- a/gl/m4/mountlist.m4 +++ b/gl/m4/mountlist.m4 @@ -1,9 +1,10 @@ # mountlist.m4 -# serial 17 -dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. +# serial 18 +dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. @@ -318,12 +319,17 @@ int getmntinfo (struct statfs **, int); fi if test -z "$ac_list_mounted_fs"; then - AC_MSG_ERROR([could not determine how to read list of mounted file systems]) - # FIXME -- no need to abort building the whole package - # Can't build mountlist.c or anything that needs its functions + case "$host_os" in + mingw* | windows*) ac_list_mounted_fs=found ;; + esac + fi + + if test -z "$ac_list_mounted_fs"; then + AC_DEFINE([MOUNTED_NOT_PORTED], [1], + [Define if we don't know how to determine the list of mounted file systems.]) fi - if test $ac_list_mounted_fs = found; then + if test "$ac_list_mounted_fs" = found; then gl_cv_list_mounted_fs=yes else gl_cv_list_mounted_fs=no diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4 index 7919ff12..bfbb983b 100644 --- a/gl/m4/msvc-inval.m4 +++ b/gl/m4/msvc-inval.m4 @@ -1,9 +1,10 @@ # msvc-inval.m4 # serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MSVC_INVAL], [ diff --git a/gl/m4/msvc-nothrow.m4 b/gl/m4/msvc-nothrow.m4 index 007c7620..6a470971 100644 --- a/gl/m4/msvc-nothrow.m4 +++ b/gl/m4/msvc-nothrow.m4 @@ -1,9 +1,10 @@ # msvc-nothrow.m4 # serial 1 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_MSVC_NOTHROW], [ diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 3af29d39..817f01f1 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 @@ -1,9 +1,10 @@ # multiarch.m4 # serial 9 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Determine whether the compiler is or may be producing universal binaries. # diff --git a/gl/m4/musl.m4 b/gl/m4/musl.m4 index 0d4de892..6ff778cb 100644 --- a/gl/m4/musl.m4 +++ b/gl/m4/musl.m4 @@ -1,9 +1,10 @@ # musl.m4 # serial 4 -dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test for musl libc, despite the musl libc authors don't like it # diff --git a/gl/m4/netdb_h.m4 b/gl/m4/netdb_h.m4 index d8c00217..88512546 100644 --- a/gl/m4/netdb_h.m4 +++ b/gl/m4/netdb_h.m4 @@ -1,9 +1,10 @@ # netdb_h.m4 # serial 15 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_NETDB_H], [ diff --git a/gl/m4/netinet_in_h.m4 b/gl/m4/netinet_in_h.m4 index 926f7f95..b56e354c 100644 --- a/gl/m4/netinet_in_h.m4 +++ b/gl/m4/netinet_in_h.m4 @@ -1,9 +1,10 @@ # netinet_in_h.m4 # serial 6 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_HEADER_NETINET_IN], [ diff --git a/gl/m4/nl_langinfo.m4 b/gl/m4/nl_langinfo.m4 index f38f11bb..9b1e0f32 100644 --- a/gl/m4/nl_langinfo.m4 +++ b/gl/m4/nl_langinfo.m4 @@ -1,9 +1,10 @@ # nl_langinfo.m4 -# serial 11 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 12.1 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_NL_LANGINFO], [ @@ -40,16 +41,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO], AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], [$FUNC_NL_LANGINFO_YESEXPR_WORKS], [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) - # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. + # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not + # multithread-safe. case "$host_os" in - solaris*) NL_LANGINFO_MTSAFE=0 ;; - *) NL_LANGINFO_MTSAFE=1 ;; + darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;; + *) NL_LANGINFO_MTSAFE=1 ;; esac AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], [Define to 1 if nl_langinfo is multithread-safe.]) if test $HAVE_LANGINFO_CODESET = 1 \ && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ && test $HAVE_LANGINFO_ALTMON = 1 \ + && test $HAVE_LANGINFO_ABALTMON = 1 \ && test $HAVE_LANGINFO_ERA = 1 \ && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ && test $NL_LANGINFO_MTSAFE = 1; then diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4 index cbe8fe82..662fb049 100644 --- a/gl/m4/nocrash.m4 +++ b/gl/m4/nocrash.m4 @@ -1,9 +1,10 @@ # nocrash.m4 # serial 5 -dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. diff --git a/gl/m4/off64_t.m4 b/gl/m4/off64_t.m4 new file mode 100644 index 00000000..963d53e9 --- /dev/null +++ b/gl/m4/off64_t.m4 @@ -0,0 +1,32 @@ +# off64_t.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Check whether defines the 'off64_t' type. +dnl Set HAVE_OFF64_T. + +AC_DEFUN([gl_TYPE_OFF64_T], +[ + dnl Persuade glibc , , , , + dnl to define off64_t. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[int x = sizeof (off64_t *) + sizeof (off64_t); + return !x;]])], + [gl_cv_off64_t=yes], [gl_cv_off64_t=no])]) + + if test $gl_cv_off64_t != no; then + HAVE_OFF64_T=1 + else + HAVE_OFF64_T=0 + fi + AC_SUBST([HAVE_OFF64_T]) +]) diff --git a/gl/m4/off_t.m4 b/gl/m4/off_t.m4 index db6035db..f4f4bbf6 100644 --- a/gl/m4/off_t.m4 +++ b/gl/m4/off_t.m4 @@ -1,9 +1,10 @@ # off_t.m4 # serial 1 -dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2012-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check whether to override the 'off_t' type. dnl Set WINDOWS_64_BIT_OFF_T. diff --git a/gl/m4/once.m4 b/gl/m4/once.m4 new file mode 100644 index 00000000..7876a8fe --- /dev/null +++ b/gl/m4/once.m4 @@ -0,0 +1,14 @@ +# once.m4 +# serial 1 +dnl Copyright (C) 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. + +AC_DEFUN([gl_ONCE], +[ + AC_REQUIRE([gl_THREADLIB]) +]) diff --git a/gl/m4/open-cloexec.m4 b/gl/m4/open-cloexec.m4 index 6defdfb4..860541b0 100644 --- a/gl/m4/open-cloexec.m4 +++ b/gl/m4/open-cloexec.m4 @@ -1,9 +1,10 @@ # open-cloexec.m4 # serial 1 -dnl Copyright 2017-2024 Free Software Foundation, Inc. +dnl Copyright 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Test whether O_CLOEXEC is defined. diff --git a/gl/m4/open-slash.m4 b/gl/m4/open-slash.m4 index 03460e42..2cba48fe 100644 --- a/gl/m4/open-slash.m4 +++ b/gl/m4/open-slash.m4 @@ -1,9 +1,10 @@ # open-slash.m4 # serial 2 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Tests whether open() and creat() recognize a trailing slash. dnl Sets gl_cv_func_open_slash. diff --git a/gl/m4/open.m4 b/gl/m4/open.m4 index 62a11a11..dd3a805f 100644 --- a/gl/m4/open.m4 +++ b/gl/m4/open.m4 @@ -1,14 +1,18 @@ # open.m4 -# serial 16 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 17 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_OPEN], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) + AS_CASE([$gl_cv_header_working_fcntl_h], + [*O_DIRECTORY* | *no], [REPLACE_OPEN=1]) case "$host_os" in mingw* | windows* | pw*) REPLACE_OPEN=1 diff --git a/gl/m4/pathmax.m4 b/gl/m4/pathmax.m4 index 4280837f..0c3925df 100644 --- a/gl/m4/pathmax.m4 +++ b/gl/m4/pathmax.m4 @@ -1,10 +1,11 @@ # pathmax.m4 # serial 11 -dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_PATHMAX], [ diff --git a/gl/m4/pid_t.m4 b/gl/m4/pid_t.m4 index 8bedcc6b..a8bdabc2 100644 --- a/gl/m4/pid_t.m4 +++ b/gl/m4/pid_t.m4 @@ -1,9 +1,10 @@ # pid_t.m4 # serial 4 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # The following implementation works around a problem in autoconf <= 2.69. m4_version_prereq([2.70], [], [ diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 0cb14d6f..4619a402 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 @@ -1,9 +1,10 @@ # printf.m4 -# serial 91 -dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. +# serial 96 +dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Test whether the *printf family of functions supports the 'j', 'z', 't', dnl 'L' size specifiers. (ISO C99, POSIX:2001) @@ -616,6 +617,7 @@ static double zero = 0.0; int main () { int result = 0; + /* This fails on FreeBSD 5.2.1, Solaris 11.4. */ if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 || (strcmp (buf, "0x1.922p+1 33") != 0 && strcmp (buf, "0x3.244p+0 33") != 0 @@ -627,27 +629,29 @@ int main () && strcmp (buf, "-0X3.244P+0 33") != 0 && strcmp (buf, "-0X6.488P-1 33") != 0 && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 13.0 bug: it doesn't round. */ + result |= 1; + /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug: + it doesn't round. */ if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x1.83p+0 33") != 0 && strcmp (buf, "0x3.05p-1 33") != 0 && strcmp (buf, "0x6.0ap-2 33") != 0 && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ + result |= 2; + /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3, + Solaris 11.4 bug: it doesn't round. */ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 || (strcmp (buf, "0x2p+0 33") != 0 && strcmp (buf, "0x3p-1 33") != 0 && strcmp (buf, "0x6p-2 33") != 0 && strcmp (buf, "0xcp-3 33") != 0)) result |= 4; - /* This catches a FreeBSD 6.1 bug. See + /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See */ if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 || buf[0] == '0') result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */ if (sprintf (buf, "%.1a", 1.999) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -655,7 +659,8 @@ int main () && strcmp (buf, "0x8.0p-2") != 0)) result |= 16; /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug . */ + glibc 2.4 bug + and a FreeBSD 6.4, NetBSD 10.0 bug. */ if (sprintf (buf, "%.1La", 1.999L) < 0 || (strcmp (buf, "0x1.0p+1") != 0 && strcmp (buf, "0x2.0p+0") != 0 @@ -893,9 +898,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N], [AC_LANG_SOURCE([[ #include #include -#include #include +#if defined _WIN32 && !defined __CYGWIN__ +# include +#else +# include +#endif #ifdef _MSC_VER +#include #include /* See page about "Parameter Validation" on msdn.microsoft.com. @@ -922,6 +932,9 @@ int main () int count = -1; #ifdef _MSC_VER _set_invalid_parameter_handler (invalid_parameter_handler); + /* Also avoid an Abort/Retry/Ignore dialog in debug builds. + */ + _CrtSetReportMode (_CRT_ASSERT, 0); #endif signal (SIGABRT, abort_handler); /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) @@ -1173,6 +1186,112 @@ changequote([,])dnl ]) ]) +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with the ' flag for grouping of decimal digits on integers, +dnl together with a precision. +dnl Result is gl_cv_func_printf_flag_grouping_int_precision. + +AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether printf supports grouping on integers with a precision], + [gl_cv_func_printf_flag_grouping_int_precision], + [ + dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku. + freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*) + gl_cv_func_printf_flag_grouping_int_precision="guessing no";; + *) + gl_cv_func_printf_flag_grouping_int_precision="guessing yes";; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +static char buf[100]; +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL + || setlocale (LC_ALL, "fr_FR") != NULL + || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL + || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) + { + if (sprintf (buf, "%'.10d", 1000) < 0) + return 1; + if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0) + /* The sprintf implementation has produced fewer than 10 digits. */ + return 2; + else + return 0; + } + return 3; +}]])], + [gl_cv_func_printf_flag_grouping_int_precision=yes], + [if test $? = 2; then + gl_cv_func_printf_flag_grouping_int_precision=no + fi + ], + [:]) + ]) +]) + +dnl Test whether the *printf family of functions supports POSIX/XSI format +dnl strings with the ' flag for grouping of decimal digits, when the thousands +dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8 +dnl locale). +dnl Result is gl_cv_func_printf_flag_grouping_multibyte. + +AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator], + [gl_cv_func_printf_flag_grouping_multibyte], + [ + dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + # Guess no on NetBSD and Solaris 11 OpenIndiana. + netbsd* | solaris*) + gl_cv_func_printf_flag_grouping_multibyte="guessing no";; + *) + gl_cv_func_printf_flag_grouping_multibyte="guessing yes";; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +static char buf[100]; +int main () +{ + if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL) + return 0; + if (sprintf (buf, "%'.0f", 1000.0) < 0) + return 1; + if (strlen (localeconv ()->thousands_sep) > 1) + { + if (strlen (buf) <= 4 + 1) + return 2; + else + return 3; + } + return 0; +}]])], + [:], + [case $? in + 2) gl_cv_func_printf_flag_grouping_multibyte=no ;; + 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;; + esac + ], + [:]) + ]) +]) + dnl Test whether the *printf family of functions supports the - flag correctly. dnl (ISO C99.) See dnl @@ -1709,6 +1828,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N], #include #include #include +#if defined _WIN32 && !defined __CYGWIN__ +# include +#else +# include +#endif #if HAVE_SNPRINTF # define my_snprintf snprintf #else @@ -2143,20 +2267,22 @@ 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 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION +dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE +dnl 17 = gl_PRINTF_FLAG_LEFTADJUST +dnl 18 = gl_PRINTF_FLAG_ZERO +dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO +dnl 20 = gl_PRINTF_PRECISION +dnl 21 = gl_PRINTF_ENOMEM +dnl 22 = gl_SNPRINTF_PRESENCE +dnl 23 = gl_SNPRINTF_TRUNCATION_C99 +dnl 24 = gl_SNPRINTF_RETVAL_C99 +dnl 25 = gl_SNPRINTF_DIRECTIVE_N +dnl 26 = gl_SNPRINTF_SIZE1 +dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99 +dnl 28 = gl_SWPRINTF_WORKS +dnl 29 = gl_SWPRINTF_DIRECTIVE_LA +dnl 30 = gl_SWPRINTF_DIRECTIVE_LC dnl dnl 1 = checking whether printf supports size specifiers as in C99... dnl 2 = checking whether printf supports size specifiers as in C23... @@ -2172,62 +2298,64 @@ 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 15 = checking whether printf supports grouping on integers with a precision... +dnl 16 = checking whether printf supports grouping with a multibyte separator... +dnl 17 = checking whether printf supports the left-adjust flag correctly... +dnl 18 = checking whether printf supports the zero flag correctly... +dnl 19 = checking whether printf supports the alternative flag with a zero precision... +dnl 20 = checking whether printf supports large precisions... +dnl 21 = checking whether printf survives out-of-memory conditions... +dnl 22 = checking for snprintf... +dnl 23 = checking whether snprintf truncates the result as in C99... +dnl 24 = checking whether snprintf returns a byte count as in C99... +dnl 25 = checking whether snprintf fully supports the 'n' directive... +dnl 26 = checking whether snprintf respects a size of 1... +dnl 27 = checking whether vsnprintf respects a zero size as in C99... +dnl 28 = checking whether swprintf works... +dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives... +dnl 30 = 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 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 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? +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 29 30 +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-once.m4 b/gl/m4/pthread-once.m4 new file mode 100644 index 00000000..85549254 --- /dev/null +++ b/gl/m4/pthread-once.m4 @@ -0,0 +1,83 @@ +# pthread-once.m4 +# serial 6 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_PTHREAD_ONCE], +[ + AC_REQUIRE([gl_PTHREAD_H]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_PTHREAD_ONCE=1 + PTHREAD_ONCE_LIB= + else + if test $HAVE_PTHREAD_H = 0; then + HAVE_PTHREAD_ONCE=0 + PTHREAD_ONCE_LIB= + else + dnl Work around Cygwin 3.5.3 bug. + AC_CACHE_CHECK([whether pthread_once works], + [gl_cv_func_pthread_once_works], + [case "$host_os" in + cygwin*) gl_cv_func_pthread_once_works="guessing no" ;; + *) gl_cv_func_pthread_once_works="yes" ;; + esac + ]) + case "$gl_cv_func_pthread_once_works" in + *yes) ;; + *) REPLACE_PTHREAD_ONCE=1 ;; + esac + dnl Determine whether linking requires $(LIBPMULTITHREAD) or only + dnl $(LIBPTHREAD). + if test -z "$LIBPTHREAD" && test -n "$LIBPMULTITHREAD"; then + AC_CACHE_CHECK([whether pthread_once can be used without linking with libpthread], + [gl_cv_func_pthread_once_no_lib], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + static pthread_once_t a_once = PTHREAD_ONCE_INIT; + static int a; + static void a_init (void) { a = 8647; } + ]], + [[if (pthread_once (&a_once, a_init)) return 1; + if (a != 8647) return 2; + return 0; + ]])], + [gl_cv_func_pthread_once_no_lib=yes], + [gl_cv_func_pthread_once_no_lib=no], + [case "$host_os" in + # Guess no on glibc. + *-gnu* | gnu*) + gl_cv_func_pthread_once_no_lib="guessing no" ;; + # Guess no on FreeBSD. + freebsd* | dragonfly* | midnightbsd*) + gl_cv_func_pthread_once_no_lib="guessing no" ;; + # Guess yes otherwise. + *) + gl_cv_func_pthread_once_no_lib="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_pthread_once_no_lib" in + *yes) PTHREAD_ONCE_LIB="$LIBPTHREAD" ;; + *) PTHREAD_ONCE_LIB="$LIBPMULTITHREAD" ;; + esac + dnl Expected result: + dnl PTHREAD_ONCE_LIB is $(LIBPMULTITHREAD) on glibc < 2.34, FreeBSD. + dnl PTHREAD_ONCE_LIB is $(LIBPTHREAD) in particular on + dnl musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android. + else + PTHREAD_ONCE_LIB="$LIBPTHREAD" + fi + fi + fi + AC_SUBST([PTHREAD_ONCE_LIB]) +]) diff --git a/gl/m4/pthread-spin.m4 b/gl/m4/pthread-spin.m4 new file mode 100644 index 00000000..aae2fb3b --- /dev/null +++ b/gl/m4/pthread-spin.m4 @@ -0,0 +1,72 @@ +# pthread-spin.m4 +# serial 8 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_PTHREAD_SPIN], +[ + AC_REQUIRE([gl_PTHREAD_H_PART1]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + dnl Choose function names that don't conflict with the mingw-w64 winpthreads + dnl library. + REPLACE_PTHREAD_SPIN_INIT=1 + REPLACE_PTHREAD_SPIN_LOCK=1 + REPLACE_PTHREAD_SPIN_TRYLOCK=1 + REPLACE_PTHREAD_SPIN_UNLOCK=1 + REPLACE_PTHREAD_SPIN_DESTROY=1 + else + if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then + HAVE_PTHREAD_SPIN_INIT=0 + HAVE_PTHREAD_SPIN_LOCK=0 + HAVE_PTHREAD_SPIN_TRYLOCK=0 + HAVE_PTHREAD_SPIN_UNLOCK=0 + HAVE_PTHREAD_SPIN_DESTROY=0 + else + dnl Test whether the gnulib module 'threadlib' is in use. + dnl Some packages like Emacs use --avoid=threadlib. + dnl Write the symbol in such a way that it does not cause 'aclocal' to pick + dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) + dnl Test whether the functions actually exist. + dnl FreeBSD 5.2.1 declares them but does not define them. + AC_CACHE_CHECK([for pthread_spin_init], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD], + [gl_saved_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[pthread_spinlock_t lock; + return pthread_spin_init (&lock, 0); + ]]) + ], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=yes], + [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=no]) + LIBS="$gl_saved_LIBS" + ]) + if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then + HAVE_PTHREAD_SPIN_INIT=0 + REPLACE_PTHREAD_SPIN_INIT=1 + HAVE_PTHREAD_SPIN_LOCK=0 + REPLACE_PTHREAD_SPIN_LOCK=1 + HAVE_PTHREAD_SPIN_TRYLOCK=0 + REPLACE_PTHREAD_SPIN_TRYLOCK=1 + HAVE_PTHREAD_SPIN_UNLOCK=0 + REPLACE_PTHREAD_SPIN_UNLOCK=1 + HAVE_PTHREAD_SPIN_DESTROY=0 + REPLACE_PTHREAD_SPIN_DESTROY=1 + fi + ], [ + : + ]) + fi + fi +]) diff --git a/gl/m4/pthread_h.m4 b/gl/m4/pthread_h.m4 new file mode 100644 index 00000000..bb921386 --- /dev/null +++ b/gl/m4/pthread_h.m4 @@ -0,0 +1,293 @@ +# pthread_h.m4 +# serial 11 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_PTHREAD_H_PART1], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PTHREADLIB]) + + gl_CHECK_NEXT_HEADERS([pthread.h]) + if test $ac_cv_header_pthread_h = yes; then + HAVE_PTHREAD_H=1 + dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used, + dnl ignore the from the mingw-w64 winpthreads library. + m4_ifdef([gl_][THREADLIB], [ + AC_REQUIRE([gl_][THREADLIB]) + if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \ + && test $gl_threads_api = windows; then + HAVE_PTHREAD_H=0 + fi + ]) + else + HAVE_PTHREAD_H=0 + fi + AC_SUBST([HAVE_PTHREAD_H]) + + AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [], + [AC_INCLUDES_DEFAULT[ + #if HAVE_PTHREAD_H + #include + #endif]]) + if test $ac_cv_type_pthread_t != yes; then + HAVE_PTHREAD_T=0 + fi + if test $ac_cv_type_pthread_spinlock_t != yes; then + HAVE_PTHREAD_SPINLOCK_T=0 + fi +]) + +AC_DEFUN([gl_PTHREAD_H], +[ + AC_REQUIRE([gl_PTHREAD_H_PART1]) + + dnl Set HAVE_PTHREAD_SPIN_INIT, REPLACE_PTHREAD_SPIN_INIT. + gl_PTHREAD_SPIN + + dnl Constants may be defined as C preprocessor macros or as enum items. + + AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED], + [gl_cv_const_PTHREAD_CREATE_DETACHED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_CREATE_DETACHED; + ]], + [[]])], + [gl_cv_const_PTHREAD_CREATE_DETACHED=yes], + [gl_cv_const_PTHREAD_CREATE_DETACHED=no]) + ]) + if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then + HAVE_PTHREAD_CREATE_DETACHED=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_MUTEX_RECURSIVE; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes], + [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then + HAVE_PTHREAD_MUTEX_RECURSIVE=0 + fi + + AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST], + [gl_cv_const_PTHREAD_MUTEX_ROBUST], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_MUTEX_ROBUST; + ]], + [[]])], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes], + [gl_cv_const_PTHREAD_MUTEX_ROBUST=no]) + ]) + if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then + HAVE_PTHREAD_MUTEX_ROBUST=0 + fi + + AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED], + [gl_cv_const_PTHREAD_PROCESS_SHARED], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int x = PTHREAD_PROCESS_SHARED; + ]], + [[]])], + [gl_cv_const_PTHREAD_PROCESS_SHARED=yes], + [gl_cv_const_PTHREAD_PROCESS_SHARED=no]) + ]) + if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then + HAVE_PTHREAD_PROCESS_SHARED=0 + fi + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include + ]], [ + pthread_create pthread_attr_init pthread_attr_getdetachstate + pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal + pthread_detach pthread_join pthread_exit + pthread_once + pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype + pthread_mutexattr_settype pthread_mutexattr_getrobust + pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock + pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock + pthread_mutex_destroy + pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy + pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock + pthread_rwlock_trywrlock pthread_rwlock_timedrdlock + pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy + pthread_cond_init pthread_condattr_init pthread_condattr_destroy + pthread_cond_wait pthread_cond_timedwait pthread_cond_signal + pthread_cond_broadcast pthread_cond_destroy + pthread_key_create pthread_setspecific pthread_getspecific + pthread_key_delete + pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock + pthread_spin_destroy]) + + AC_REQUIRE([AC_C_RESTRICT]) + + dnl For backward compatibility with gnulib versions <= 2019-07. + LIB_PTHREAD="$LIBPMULTITHREAD" + AC_SUBST([LIB_PTHREAD]) +]) + +# gl_PTHREAD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_PTHREAD_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_PTHREAD_H_DEFAULTS]) +]) + +AC_DEFUN([gl_PTHREAD_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T]) + HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T]) + HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED]) + HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE]) + HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST]) + HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED]) + HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE]) + HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT]) + HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE]) + HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE]) + HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY]) + HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF]) + HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL]) + HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH]) + HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN]) + HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT]) + HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE]) + HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT]) + HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT]) + HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE]) + HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE]) + HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST]) + HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST]) + HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY]) + HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK]) + HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK]) + HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK]) + HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK]) + HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY]) + HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT]) + HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT]) + HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY]) + HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK]) + HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK]) + HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK]) + HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK]) + HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY]) + HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT]) + HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT]) + HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY]) + HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT]) + HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT]) + HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL]) + HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST]) + HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY]) + HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE]) + HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC]) + HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC]) + HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE]) + HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT]) + HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK]) + HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK]) + HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK]) + HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY]) + REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE]) + REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT]) + REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE]) + REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY]) + REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF]) + REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL]) + REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH]) + REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN]) + REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT]) + REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE]) + REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT]) + REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT]) + REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE]) + REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST]) + REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY]) + REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK]) + REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK]) + REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK]) + REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK]) + REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY]) + REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT]) + REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY]) + REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK]) + REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK]) + REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK]) + REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK]) + REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY]) + REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT]) + REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT]) + REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY]) + REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT]) + REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT]) + REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL]) + REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST]) + REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY]) + REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE]) + REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC]) + REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC]) + REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE]) + REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT]) + REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK]) + REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK]) + REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK]) + REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY]) +]) diff --git a/gl/m4/pthread_rwlock_rdlock.m4 b/gl/m4/pthread_rwlock_rdlock.m4 index b8b5b117..aec9f076 100644 --- a/gl/m4/pthread_rwlock_rdlock.m4 +++ b/gl/m4/pthread_rwlock_rdlock.m4 @@ -1,9 +1,10 @@ # pthread_rwlock_rdlock.m4 # serial 8 -dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Inspired by diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4 index eb90d588..67c1476b 100644 --- a/gl/m4/realloc.m4 +++ b/gl/m4/realloc.m4 @@ -1,54 +1,22 @@ # realloc.m4 -# serial 29 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 39.1 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -# This is adapted with modifications from upstream Autoconf here: -# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 -AC_DEFUN([_AC_FUNC_REALLOC_IF], +# An an experimental option, the user can request a sanitized realloc() +# implementation, i.e. one that aborts upon undefined behaviour, +# by setting +# gl_cv_func_realloc_sanitize=yes +# at configure time. +AC_DEFUN([gl_FUNC_REALLOC_SANITIZED], [ - AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles - AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], - [ac_cv_func_realloc_0_nonnull], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], - [[void *p = realloc (0, 0); - void * volatile vp = p; - int result = !vp; - free (p); - return result;]]) - ], - [ac_cv_func_realloc_0_nonnull=yes], - [ac_cv_func_realloc_0_nonnull=no], - [case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ - | gnu* | *-musl* | 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" ;; - esac - ]) - ]) - AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2]) -])# AC_FUNC_REALLOC - -# gl_FUNC_REALLOC_GNU -# ------------------- -# Replace realloc if it is not compatible with GNU libc. -AC_DEFUN([gl_FUNC_REALLOC_GNU], -[ - AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) - if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then - _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) - fi -])# gl_FUNC_REALLOC_GNU + AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour], + [gl_cv_func_realloc_sanitize], + [test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no]) +]) # gl_FUNC_REALLOC_POSIX # --------------------- @@ -59,7 +27,100 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX], [ AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) - if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether realloc sets errno on failure], + [gl_cv_func_realloc_posix], + [ + dnl FreeBSD 15.0 realloc() does not set errno when asked for more than + dnl 0x7000000000000000 bytes. + case "$host_os" in + darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*) + AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + #include + int main (int argc, char **argv) + { + void *p; + errno = 1729; + p = realloc (malloc (1), (size_t)(-1) / 100 * 49); + return (!p && errno == 1729); + } + ]]) + ], + [gl_cv_func_realloc_posix=yes], + [gl_cv_func_realloc_posix=no], + [case "$host_os" in + freebsd*) gl_cv_func_realloc_posix="guessing no" ;; + *) gl_cv_func_realloc_posix="guessing yes" ;; + esac + ]) + ;; + *) + gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix" + ;; + esac + ]) + case "$gl_cv_func_realloc_posix" in + *yes) + AC_DEFINE([HAVE_REALLOC_POSIX], [1], + [Define if realloc sets errno on allocation failure.]) + ;; + *) + REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + ;; + esac + AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED]) + if test "$gl_cv_func_realloc_sanitize" != no; then REPLACE_REALLOC_FOR_REALLOC_POSIX=1 + AC_DEFINE([NEED_SANITIZED_REALLOC], [1], + [Define to 1 if realloc should abort upon undefined behaviour.]) fi ]) + +# gl_FUNC_REALLOC_0_NONNULL +# ------------------------- +# Replace realloc if realloc (..., 0) returns null. +# Modules that use this macro directly or indirectly should depend +# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined +# before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC), +# and doesn't hurt otherwise. +AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL], +[ + AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles + AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) + AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull], + [gl_cv_func_realloc_0_nonnull], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + /* Use prealloc to test; "volatile" prevents the compiler + from optimizing the realloc call away. */ + void *(*volatile prealloc) (void *, size_t) = realloc;]], + [[void *p = prealloc (0, 0); + int result = !p; + p = prealloc (p, 0); + result |= !p; + free (p); + return result;]])], + [gl_cv_func_realloc_0_nonnull=yes], + [gl_cv_func_realloc_0_nonnull=no], + [AS_CASE([$host_os], + [# Guess yes on platforms where we know the result. + freebsd* | netbsd* | openbsd* | darwin* | bitrig* \ + | *-musl* | midipix* | midnightbsd* \ + | hpux* | solaris* | cygwin*], + [gl_cv_func_realloc_0_nonnull="guessing yes"], + [# Guess as follows if we don't know. + gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])]) + AS_CASE([$gl_cv_func_realloc_0_nonnull], + [*yes], + [AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1], + [Define to 1 if realloc (..., 0) returns nonnull.])], + [AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host], + [yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*], + [REPLACE_REALLOC_FOR_REALLOC_POSIX=1], + [# Optimize for common case of glibc 2.1.1+ and compatibles. + REPLACE_REALLOC_FOR_REALLOC_POSIX=2])]) +]) diff --git a/gl/m4/reallocarray.m4 b/gl/m4/reallocarray.m4 index 958095e1..3970d9e1 100644 --- a/gl/m4/reallocarray.m4 +++ b/gl/m4/reallocarray.m4 @@ -1,9 +1,10 @@ # reallocarray.m4 -# serial 5 -dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. +# serial 7 +dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_REALLOCARRAY], [ @@ -12,14 +13,21 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) + AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL]) 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 + else + if test "$gl_cv_malloc_ptrdiff" = no; then + REPLACE_REALLOCARRAY=1 + fi + case "$gl_cv_func_realloc_0_nonnull" in + *yes) ;; + *) REPLACE_REALLOCARRAY=1 ;; + esac fi ]) diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index f0101fe6..49a8059f 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 @@ -1,9 +1,10 @@ # regex.m4 -# serial 75 -dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. +# serial 81 +dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Initially derived from code in GNU grep. dnl Mostly written by Jim Meyering. @@ -39,19 +40,24 @@ AC_DEFUN([gl_REGEX], #include #include - #if defined M_CHECK_ACTION || HAVE_DECL_ALARM - # include - # include + #if HAVE_MALLOC_H + # include /* defines M_CHECK_ACTION on glibc */ #endif - #if HAVE_MALLOC_H - # include + #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM + # include + # include #endif - #ifdef M_CHECK_ACTION + #if defined __HAIKU__ || defined M_CHECK_ACTION /* Exit with distinguishable exit code. */ static void sigabrt_no_core (int sig) { raise (SIGTERM); } #endif + + /* There is no need to check whether RE_SYNTAX_EMACS is + (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to + Emacs 21 (2001) and later, because Gnulib's lib/regex.h + is always used and has this value. */ ]], [[int result = 0; static struct re_pattern_buffer regex; @@ -67,6 +73,9 @@ AC_DEFUN([gl_REGEX], signal (SIGALRM, SIG_DFL); alarm (2); #endif +#ifdef __HAIKU__ + signal (SIGABRT, sigabrt_no_core); +#endif #ifdef M_CHECK_ACTION signal (SIGABRT, sigabrt_no_core); mallopt (M_CHECK_ACTION, 2); @@ -388,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([AC_TYPE_MBSTATE_T]) - AC_REQUIRE([gl_EEMALLOC]) AC_CHECK_HEADERS([libintl.h]) AC_CHECK_FUNCS_ONCE([isblank iswctype]) AC_CHECK_DECLS([isblank], [], [], [[#include ]]) diff --git a/gl/m4/sched_h.m4 b/gl/m4/sched_h.m4 new file mode 100644 index 00000000..1ffd465f --- /dev/null +++ b/gl/m4/sched_h.m4 @@ -0,0 +1,102 @@ +# sched_h.m4 +# serial 16 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Bruno Haible. + +AC_DEFUN_ONCE([gl_SCHED_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) + + AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H]) + + AC_CHECK_HEADERS([sched.h], [], [], + [[#if HAVE_SYS_CDEFS_H + #include + #endif + ]]) + gl_NEXT_HEADERS([sched.h]) + + if test "$ac_cv_header_sched_h" = yes; then + HAVE_SCHED_H=1 + else + HAVE_SCHED_H=0 + fi + AC_SUBST([HAVE_SCHED_H]) + + if test "$HAVE_SCHED_H" = 1; then + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0], + [[#if HAVE_SYS_CDEFS_H + #include + #endif + #include + ]]) + else + HAVE_STRUCT_SCHED_PARAM=0 + case "$host_os" in + os2*) + dnl On OS/2 kLIBC, struct sched_param is in spawn.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include ]) + ;; + vms) + dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h. + AC_CHECK_TYPE([struct sched_param], + [HAVE_STRUCT_SCHED_PARAM=1], [], + [#include ]) + ;; + esac + fi + AC_SUBST([HAVE_STRUCT_SCHED_PARAM]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include + ]], [sched_yield]) +]) + +# gl_SCHED_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SCHED_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SCHED_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SCHED_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SCHED_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD]) + REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD]) +]) diff --git a/gl/m4/servent.m4 b/gl/m4/servent.m4 index 422003b4..ba6ebd1d 100644 --- a/gl/m4/servent.m4 +++ b/gl/m4/servent.m4 @@ -1,9 +1,10 @@ # servent.m4 # serial 5 -dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SERVENT], [ diff --git a/gl/m4/setenv.m4 b/gl/m4/setenv.m4 index e7f00f39..727e35af 100644 --- a/gl/m4/setenv.m4 +++ b/gl/m4/setenv.m4 @@ -1,9 +1,10 @@ # setenv.m4 -# serial 33 -dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. +# serial 35 +dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_SETENV], [ @@ -155,6 +156,7 @@ AC_DEFUN([gl_PREREQ_SETENV], AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) AC_CHECK_HEADERS([search.h]) + AC_CHECK_DECLS_ONCE([_putenv]) gl_CHECK_FUNCS_ANDROID([tsearch], [[#include ]]) ]) @@ -163,4 +165,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV], [ AC_REQUIRE([gl_ENVIRON]) AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_DECLS_ONCE([_putenv]) ]) diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4 index e5b7d28b..3c8b693e 100644 --- a/gl/m4/setlocale_null.m4 +++ b/gl/m4/setlocale_null.m4 @@ -1,11 +1,12 @@ # setlocale_null.m4 -# serial 9 -dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. +# serial 10 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. -AC_DEFUN([gl_FUNC_SETLOCALE_NULL], +AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PTHREADLIB]) diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4 index ad5596a4..30e8deeb 100644 --- a/gl/m4/sha256.m4 +++ b/gl/m4/sha256.m4 @@ -1,9 +1,10 @@ # sha256.m4 # serial 8 -dnl Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SHA256], [ diff --git a/gl/m4/size_max.m4 b/gl/m4/size_max.m4 index df91cf06..b0460d45 100644 --- a/gl/m4/size_max.m4 +++ b/gl/m4/size_max.m4 @@ -1,9 +1,10 @@ # size_max.m4 # serial 12 -dnl Copyright (C) 2003, 2005-2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2005-2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. diff --git a/gl/m4/snprintf.m4 b/gl/m4/snprintf.m4 index 6dbe146f..2c50cee9 100644 --- a/gl/m4/snprintf.m4 +++ b/gl/m4/snprintf.m4 @@ -1,9 +1,10 @@ # snprintf.m4 # serial 7 -dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, dnl but defers to any gnulib snprintf replacements. Therefore, gnulib diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4 index 09f01161..e3509f81 100644 --- a/gl/m4/socketlib.m4 +++ b/gl/m4/socketlib.m4 @@ -1,9 +1,10 @@ # socketlib.m4 # serial 4 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl gl_SOCKETLIB dnl Determines the library to use for socket functions. diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4 index a3dfe92f..54f4dc79 100644 --- a/gl/m4/sockets.m4 +++ b/gl/m4/sockets.m4 @@ -1,9 +1,10 @@ # sockets.m4 # serial 7 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_SOCKETS], [ diff --git a/gl/m4/socklen.m4 b/gl/m4/socklen.m4 index 9ece0abb..a8ac25b1 100644 --- a/gl/m4/socklen.m4 +++ b/gl/m4/socklen.m4 @@ -1,9 +1,10 @@ # socklen.m4 # serial 11 -dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Albert Chin, Windows fixes from Simon Josefsson. diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4 index c68b3abb..08ce843d 100644 --- a/gl/m4/sockpfaf.m4 +++ b/gl/m4/sockpfaf.m4 @@ -1,9 +1,10 @@ # sockpfaf.m4 -# serial 10 -dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. +# serial 11 +dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) dnl and some common address families (AF_INET, AF_INET6, ...). @@ -64,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], AC_REQUIRE([gl_SYS_SOCKET_H]) AC_CHECK_HEADERS_ONCE([sys/un.h]) + dnl Windows versions released after 2017 may have support for AF_UNIX. + dnl Including it requires types from to be defined. + dnl . + if test "$ac_cv_header_winsock2_h" = yes; then + AC_CHECK_HEADERS([afunix.h], [], [], [#include ]) + fi + AC_CACHE_CHECK([for UNIX domain sockets], [gl_cv_socket_unix], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -75,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX], #endif #ifdef HAVE_WINSOCK2_H #include +#endif +#ifdef HAVE_AFUNIX_H +#include #endif]], [[int x = AF_UNIX; struct sockaddr_un y; if (&x && &y) return 0;]])], diff --git a/gl/m4/ssize_t.m4 b/gl/m4/ssize_t.m4 index c15f948a..a2ffd6fc 100644 --- a/gl/m4/ssize_t.m4 +++ b/gl/m4/ssize_t.m4 @@ -1,9 +1,10 @@ # ssize_t.m4 # serial 6 -dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2003, 2006, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Define ssize_t if it does not already exist. diff --git a/gl/m4/stat-time.m4 b/gl/m4/stat-time.m4 index e8ee7d51..4aa24e7f 100644 --- a/gl/m4/stat-time.m4 +++ b/gl/m4/stat-time.m4 @@ -1,9 +1,11 @@ # stat-time.m4 # serial 1 -dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2025 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 This file is offered as-is, without any warranty. # Checks for stat-related time functions. diff --git a/gl/m4/stat.m4 b/gl/m4/stat.m4 index fabd360c..66876305 100644 --- a/gl/m4/stat.m4 +++ b/gl/m4/stat.m4 @@ -1,9 +1,10 @@ # stat.m4 # serial 21 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STAT], [ diff --git a/gl/m4/std-gnu11.m4 b/gl/m4/std-gnu11.m4 index 37324c15..762764e0 100644 --- a/gl/m4/std-gnu11.m4 +++ b/gl/m4/std-gnu11.m4 @@ -1,22 +1,27 @@ # std-gnu11.m4 -# serial 1 +# serial 3 # Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- +# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us. +m4_ifndef([_AC_C_C23_OPTIONS], [ + # This implementation is taken from GNU Autoconf lib/autoconf/c.m4 # commit 017d5ddd82854911f0119691d91ea8a1438824d6 # dated Sun Apr 3 13:57:17 2016 -0700 +# with minor changes to commentary. # This implementation will be obsolete once we can assume Autoconf 2.70 # or later is installed everywhere a Gnulib program might be developed. m4_version_prereq([2.70], [], [ -# Copyright (C) 2001-2024 Free Software Foundation, Inc. +# Copyright (C) 2001-2025 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 -# the Free Software Foundation, either version 3 of the License, or +# This file is part of Autoconf. 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 the +# Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -24,8 +29,15 @@ m4_version_prereq([2.70], [], [ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # +# Under Section 7 of GPL version 3, you are granted additional +# permissions described in the Autoconf Configure Script Exception, +# version 3.0, as published by the Free Software Foundation. +# # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# and a copy of the Autoconf Configure Script Exception along with +# this program; see the files COPYINGv3 and COPYING.EXCEPTION +# respectively. If not, see and +# . # Written by David MacKenzie, with help from # Akim Demaille, Paul Eggert, @@ -38,7 +50,7 @@ m4_version_prereq([2.70], [], [ # COMPILER ... is a space separated list of C compilers to search for. # This just gives the user an opportunity to specify an alternative # search list for the C compiler. -AC_DEFUN_ONCE([AC_PROG_CC], +AC_DEFUN([AC_PROG_CC], [AC_LANG_PUSH(C)dnl AC_ARG_VAR([CC], [C compiler command])dnl AC_ARG_VAR([CFLAGS], [C compiler flags])dnl @@ -830,3 +842,4 @@ dnl with extended modes being tried first. ])# m4_version_prereq +])# !_AC_C_C23_OPTIONS diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4 index 2b4762f3..885feafd 100644 --- a/gl/m4/stdalign.m4 +++ b/gl/m4/stdalign.m4 @@ -1,9 +1,10 @@ # stdalign.m4 -# serial 1 -dnl Copyright 2011-2024 Free Software Foundation, Inc. +# serial 3 +dnl Copyright 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for alignas and alignof that conform to C23. @@ -81,10 +82,10 @@ AC_DEFUN([gl_ALIGNASOF], 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 @@ -103,11 +104,13 @@ AC_DEFUN([gl_ALIGNASOF], /* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 . - clang versions < 8.0.0 have the same bug. */ + clang versions < 8.0.0 have the same bug. + IBM XL C V16.1.0 cc (non-clang) has the same bug. */ # if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ && !defined __clang__) \ - || (defined __clang__ && __clang_major__ < 8)) + || (defined __clang__ && __clang_major__ < 8) \ + || defined __xlC__) # undef/**/_Alignof # ifdef __cplusplus # if (201103 <= __cplusplus || defined _MSC_VER) @@ -178,7 +181,8 @@ AC_DEFUN([gl_ALIGNASOF], # if ((defined _Alignas \ && !(defined __cplusplus \ && (201103 <= __cplusplus || defined _MSC_VER))) \ - || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \ + && !defined __xlC__)) # define alignas _Alignas # endif # endif diff --git a/gl/m4/stdckdint_h.m4 b/gl/m4/stdckdint_h.m4 new file mode 100644 index 00000000..d269faa5 --- /dev/null +++ b/gl/m4/stdckdint_h.m4 @@ -0,0 +1,136 @@ +# stdckdint_h.m4 +# serial 1 +dnl Copyright 2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Collin Funk. + +AC_DEFUN_ONCE([gl_STDCKDINT_H], +[ + gl_CHECK_NEXT_HEADERS([stdckdint.h]) + if test $ac_cv_header_stdckdint_h = yes; then + HAVE_STDCKDINT_H=1 + else + HAVE_STDCKDINT_H=0 + fi + AC_SUBST([HAVE_STDCKDINT_H]) + + if test $HAVE_STDCKDINT_H = 1; then + AC_CACHE_CHECK([whether stdckdint.h can be included in C], + [gl_cv_header_c_stdckdint_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]])], + [gl_cv_header_c_stdckdint_h=yes], + [gl_cv_header_c_stdckdint_h=no])]) + if test $gl_cv_header_c_stdckdint_h = yes; then + HAVE_C_STDCKDINT_H=1 + AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C], + [gl_cv_header_c_stdckdint_h_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[int r; + int a = 1; + int b = 1; + return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) + || ckd_mul (&r, a, b)); + ]])], + [gl_cv_header_c_stdckdint_h_works=yes], + [gl_cv_header_c_stdckdint_h_works=no])]) + if test $gl_cv_header_c_stdckdint_h_works = yes; then + HAVE_WORKING_C_STDCKDINT_H=1 + else + HAVE_WORKING_C_STDCKDINT_H=0 + fi + else + HAVE_C_STDCKDINT_H=0 + HAVE_WORKING_C_STDCKDINT_H=0 + fi + if test "$CXX" != no; then + AC_CACHE_CHECK([whether stdckdint.h can be included in C++], + [gl_cv_header_cxx_stdckdint_h], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_header_cxx_stdckdint_h=yes + else + gl_cv_header_cxx_stdckdint_h=no + fi + rm -fr conftest* + ]) + if test $gl_cv_header_cxx_stdckdint_h = yes; then + HAVE_CXX_STDCKDINT_H=1 + AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++], + [gl_cv_header_cxx_stdckdint_h_works], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +int +main (void) +{ + int r; + int a = 1; + int b = 1; + return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b)); +} +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_header_cxx_stdckdint_h_works=yes + else + gl_cv_header_cxx_stdckdint_h_works=no + fi + rm -fr conftest* + ]) + if test $gl_cv_header_cxx_stdckdint_h_works = yes; then + HAVE_WORKING_CXX_STDCKDINT_H=1 + else + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + else + HAVE_CXX_STDCKDINT_H=0 + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + fi + else + HAVE_C_STDCKDINT_H=0 + HAVE_WORKING_C_STDCKDINT_H=0 + HAVE_CXX_STDCKDINT_H=0 + HAVE_WORKING_CXX_STDCKDINT_H=0 + fi + AC_SUBST([HAVE_C_STDCKDINT_H]) + AC_SUBST([HAVE_WORKING_C_STDCKDINT_H]) + AC_SUBST([HAVE_CXX_STDCKDINT_H]) + AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H]) + + if test "$CXX" != no; then + dnl We might need the header for C or C++. + if test $HAVE_C_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_C_STDCKDINT_H = 1 \ + && test $HAVE_CXX_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then + GL_GENERATE_STDCKDINT_H=false + else + GL_GENERATE_STDCKDINT_H=true + fi + else + dnl We don't care about C++ here. + if test $HAVE_C_STDCKDINT_H = 1 \ + && test $HAVE_WORKING_C_STDCKDINT_H = 1; then + GL_GENERATE_STDCKDINT_H=false + else + GL_GENERATE_STDCKDINT_H=true + fi + fi +]) diff --git a/gl/m4/stddef_h.m4 b/gl/m4/stddef_h.m4 index 84d3bae8..127ec05b 100644 --- a/gl/m4/stddef_h.m4 +++ b/gl/m4/stddef_h.m4 @@ -1,16 +1,16 @@ # stddef_h.m4 -# serial 14 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +# serial 23 +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl A placeholder for , for platforms that have issues. AC_DEFUN_ONCE([gl_STDDEF_H], [ AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) dnl Persuade OpenBSD to declare max_align_t. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -52,11 +52,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H], GL_GENERATE_STDDEF_H=true fi - if test $gt_cv_c_wchar_t = no; then - HAVE_WCHAR_T=0 - GL_GENERATE_STDDEF_H=true - fi - AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], [gl_cv_decl_null_works], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include @@ -69,21 +64,60 @@ AC_DEFUN_ONCE([gl_STDDEF_H], GL_GENERATE_STDDEF_H=true fi - AC_CACHE_CHECK([for unreachable], - [gl_cv_func_unreachable], + AC_CACHE_CHECK([for unreachable in C], + [gl_cv_c_func_unreachable], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[unreachable (); ]])], - [gl_cv_func_unreachable=yes], - [gl_cv_func_unreachable=no]) + [gl_cv_c_func_unreachable=yes], + [gl_cv_c_func_unreachable=no]) ]) - if test $gl_cv_func_unreachable = no; then + if test $gl_cv_c_func_unreachable = no; then + GL_GENERATE_STDDEF_H=true + HAVE_C_UNREACHABLE=0 + else + HAVE_C_UNREACHABLE=1 + fi + AC_SUBST([HAVE_C_UNREACHABLE]) + dnl Provide gl_unreachable() unconditionally. + GL_GENERATE_STDDEF_H=true + + dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869 + AC_CACHE_CHECK([whether nullptr_t needs ], + [gl_cv_nullptr_t_needs_stddef], + [AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[nullptr_t x;]], + [gl_cv_nullptr_t_needs_stddef=no], + [gl_cv_nullptr_t_needs_stddef=yes])]) + if test "$gl_cv_nullptr_t_needs_stddef" = no; then + NULLPTR_T_NEEDS_STDDEF=0 GL_GENERATE_STDDEF_H=true fi + dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 + dnl affects GCC 13.3 and 14.2. + AC_CACHE_CHECK([whether is idempotent], + [gl_cv_stddef_idempotent], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE( + [[ + #if \ + ((__GNUC__ == 13 && __GNUC_MINOR__ <= 3) \ + || (__GNUC__ == 14 && __GNUC_MINOR__ <= 2)) + #error "bug 114870 is present" + #endif + ]])], + [gl_cv_stddef_idempotent="guessing yes"], + [gl_cv_stddef_idempotent="guessing no"]) + ]) + case "$gl_cv_stddef_idempotent" in + *yes) ;; + *) STDDEF_NOT_IDEMPOTENT=1 + GL_GENERATE_STDDEF_H=true + ;; + esac + if $GL_GENERATE_STDDEF_H; then gl_NEXT_HEADERS([stddef.h]) fi @@ -114,7 +148,8 @@ AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], AC_DEFUN([gl_STDDEF_H_DEFAULTS], [ dnl Assume proper GNU behavior unless another module says otherwise. + NULLPTR_T_NEEDS_STDDEF=1; AC_SUBST([NULLPTR_T_NEEDS_STDDEF]) + STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT]) REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) - HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) ]) diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index 2dea8469..2d69088b 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 @@ -1,9 +1,10 @@ # stdint.m4 -# serial 63 -dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. +# serial 64 +dnl Copyright (C) 2001-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert and Bruno Haible. dnl Test whether is supported or must be substituted. @@ -157,7 +158,7 @@ uintmax_t j = UINTMAX_MAX; || defined __clang__) int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) + || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER) extern size_t k; extern __typeof__ (SIZE_MAX) k; #endif diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4 index 29f42160..d4f1acdd 100644 --- a/gl/m4/stdint_h.m4 +++ b/gl/m4/stdint_h.m4 @@ -1,9 +1,10 @@ # stdint_h.m4 # serial 9 -dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Paul Eggert. diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 8eb5816a..71d86180 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 @@ -1,9 +1,10 @@ # stdio_h.m4 -# serial 63 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 75 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_STDIO_H_EARLY], [ @@ -133,6 +134,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) @@ -153,12 +155,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) @@ -172,20 +176,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index a4662f29..2d25da37 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 @@ -1,9 +1,10 @@ # stdlib_h.m4 -# serial 77 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 84 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_STDLIB_H], [ @@ -37,44 +38,51 @@ AC_DEFUN_ONCE([gl_STDLIB_H], dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_CACHE_CHECK([whether MB_CUR_MAX is correct], [gl_cv_macro_MB_CUR_MAX_good], - [ - 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([[ + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include + ]], + [[return !!MB_CUR_MAX;]]) + ], + [dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. + # Guess no on Solaris and Haiku, yes otherwise. + AS_CASE([$host_os], + [solaris* | haiku*], + [gl_cv_macro_MB_CUR_MAX_good="guessing no"], + [gl_cv_macro_MB_CUR_MAX_good="guessing yes"]) + if test "$LOCALE_EN_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 (setlocale (LC_ALL, "$LOCALE_EN_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 + [gl_cv_macro_MB_CUR_MAX_good=yes], + [gl_cv_macro_MB_CUR_MAX_good=no], + [:]) + fi + ], + [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"]) ]) - case "$gl_cv_macro_MB_CUR_MAX_good" in - *yes) ;; - *) REPLACE_MB_CUR_MAX=1 ;; - esac + AS_CASE([$gl_cv_macro_MB_CUR_MAX_good], + [*yes], + [], + ["link failed - so no"], + [# 4 suffices as a workaround in Android NDK 16, + # the only known platform with the bug. + REPLACE_MB_CUR_MAX=4], + [REPLACE_MB_CUR_MAX="(-1)"]) AC_CHECK_DECLS_ONCE([ecvt]) if test $ac_cv_have_decl_ecvt = no; then @@ -110,6 +118,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ABORT_DEBUG]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) @@ -139,12 +148,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) - gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) @@ -218,6 +227,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) + REPLACE_ABORT=0; AC_SUBST([REPLACE_ABORT]) 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]) @@ -244,7 +254,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], 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]) REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) @@ -259,4 +268,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS], REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) + CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE]) ]) diff --git a/gl/m4/strcase.m4 b/gl/m4/strcase.m4 deleted file mode 100644 index 63021733..00000000 --- a/gl/m4/strcase.m4 +++ /dev/null @@ -1,46 +0,0 @@ -# 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. - -AC_DEFUN([gl_STRCASE], -[ - gl_FUNC_STRCASECMP - gl_FUNC_STRNCASECMP -]) - -AC_DEFUN([gl_FUNC_STRCASECMP], -[ - AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strcasecmp]) - if test $ac_cv_func_strcasecmp = no; then - HAVE_STRCASECMP=0 - fi -]) - -AC_DEFUN([gl_FUNC_STRNCASECMP], -[ - AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) - AC_CHECK_FUNCS([strncasecmp]) - if test $ac_cv_func_strncasecmp = yes; then - HAVE_STRNCASECMP=1 - else - HAVE_STRNCASECMP=0 - fi - AC_CHECK_DECLS([strncasecmp]) - if test $ac_cv_have_decl_strncasecmp = no; then - HAVE_DECL_STRNCASECMP=0 - fi -]) - -# Prerequisites of lib/strcasecmp.c. -AC_DEFUN([gl_PREREQ_STRCASECMP], [ - : -]) - -# Prerequisites of lib/strncasecmp.c. -AC_DEFUN([gl_PREREQ_STRNCASECMP], [ - : -]) diff --git a/gl/m4/strcasecmp.m4 b/gl/m4/strcasecmp.m4 new file mode 100644 index 00000000..eb4345d9 --- /dev/null +++ b/gl/m4/strcasecmp.m4 @@ -0,0 +1,67 @@ +# strcasecmp.m4 +# serial 3 +dnl Copyright (C) 2002-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_STRCASECMP], +[ + AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) + AC_CHECK_FUNCS([strcasecmp]) + if test $ac_cv_func_strcasecmp = yes; then + gl_STRCASECMP_WORKS + case "$gl_cv_func_strcasecmp_works" in + *yes) ;; + *) REPLACE_STRCASECMP=1 ;; + esac + else + HAVE_STRCASECMP=0 + fi +]) + +AC_DEFUN([gl_STRCASECMP_WORKS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether strcasecmp works], + [gl_cv_func_strcasecmp_works], + [dnl Prepare a guess, used when cross-compiling or when specific locales + dnl are not available. + case "$host_os" in + solaris* | cygwin*) + gl_cv_func_strcasecmp_works="guessing no" ;; + *) + gl_cv_func_strcasecmp_works="guessing yes" ;; + esac + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL + || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL) + { + int c1 = (unsigned char) '\311'; + int c2 = (unsigned char) '\351'; + if (tolower (c1) == c2 && toupper (c2) == c1) + return strcasecmp ("Fej\311r", "Fej\351r") != 0; + } + return 2; +}]])], + [gl_cv_func_strcasecmp_works=yes], + [if test $? = 1; then + gl_cv_func_strcasecmp_works=no + fi + ], + [:]) + ]) +]) + +# Prerequisites of lib/strcasecmp.c. +AC_DEFUN([gl_PREREQ_STRCASECMP], [ + : +]) diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 index d2548716..eb2862f1 100644 --- a/gl/m4/strcasestr.m4 +++ b/gl/m4/strcasestr.m4 @@ -1,9 +1,10 @@ # strcasestr.m4 -# serial 28 -dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. +# serial 29 +dnl Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check that strcasestr is present and works. AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], @@ -98,7 +99,7 @@ static void quit (int sig) { _exit (sig + 128); } char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also lack strcasestr. */ + since all such platforms (mingw, MSVC) also lack strcasestr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ diff --git a/gl/m4/strerror.m4 b/gl/m4/strerror.m4 index 0272c6f4..c8b3b207 100644 --- a/gl/m4/strerror.m4 +++ b/gl/m4/strerror.m4 @@ -1,9 +1,10 @@ # strerror.m4 # serial 25 -dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STRERROR], [ diff --git a/gl/m4/string_h.m4 b/gl/m4/string_h.m4 index f31264ae..fc73603a 100644 --- a/gl/m4/string_h.m4 +++ b/gl/m4/string_h.m4 @@ -1,9 +1,10 @@ # string_h.m4 -# serial 39 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 44.1 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a GNU-like replacement for . @@ -23,8 +24,9 @@ AC_DEFUN_ONCE([gl_STRING_H], ]], [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit rawmemchr stpcpy stpncpy strchrnul - strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r - strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) + strdup strncat strncpy strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_l strerror_r strerrorname_np + sigabbrev_np sigdescr_np strsignal strverscmp]) AC_REQUIRE([AC_C_RESTRICT]) ]) @@ -62,6 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) @@ -69,6 +72,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) @@ -83,8 +88,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) @@ -123,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) + HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L]) HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) @@ -138,6 +147,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY]) REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) @@ -145,6 +155,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS], REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) + REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L]) REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4 index aaafb559..18f30d4a 100644 --- a/gl/m4/strings_h.m4 +++ b/gl/m4/strings_h.m4 @@ -1,9 +1,10 @@ # strings_h.m4 -# serial 9 -dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. +# serial 14 +dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a replacement for . @@ -28,7 +29,7 @@ AC_DEFUN_ONCE([gl_STRINGS_H], . */ #include #include - ]], [ffs strcasecmp strncasecmp]) + ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l]) ]) # gl_STRINGS_MODULE_INDICATOR([modulename]) @@ -49,6 +50,10 @@ AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS], [ m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L]) ]) m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) @@ -59,5 +64,12 @@ AC_DEFUN([gl_STRINGS_H_DEFAULTS], dnl Assume proper GNU behavior unless another module says otherwise. HAVE_FFS=1; AC_SUBST([HAVE_FFS]) HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) + HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L]) + HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP]) + HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L]) HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) + REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP]) + REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L]) + REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP]) + REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L]) ]) diff --git a/gl/m4/strncasecmp.m4 b/gl/m4/strncasecmp.m4 new file mode 100644 index 00000000..c7c8b240 --- /dev/null +++ b/gl/m4/strncasecmp.m4 @@ -0,0 +1,32 @@ +# strncasecmp.m4 +# serial 2 +dnl Copyright (C) 2002-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_STRNCASECMP], +[ + AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) + AC_CHECK_FUNCS([strncasecmp]) + if test $ac_cv_func_strncasecmp = yes; then + dnl Assume that strncasecmp and strcasecmp share the same bugs. + gl_STRCASECMP_WORKS + case "$gl_cv_func_strcasecmp_works" in + *yes) ;; + *) REPLACE_STRNCASECMP=1 ;; + esac + else + HAVE_STRNCASECMP=0 + fi + AC_CHECK_DECLS([strncasecmp]) + if test $ac_cv_have_decl_strncasecmp = no; then + HAVE_DECL_STRNCASECMP=0 + fi +]) + +# Prerequisites of lib/strncasecmp.c. +AC_DEFUN([gl_PREREQ_STRNCASECMP], [ + : +]) diff --git a/gl/m4/strncpy.m4 b/gl/m4/strncpy.m4 new file mode 100644 index 00000000..57876171 --- /dev/null +++ b/gl/m4/strncpy.m4 @@ -0,0 +1,94 @@ +# strncpy.m4 +# serial 1 +dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_FUNC_STRNCPY], +[ + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Check for prerequisites for memory fence checks. + gl_FUNC_MMAP_ANON + AC_CHECK_HEADERS_ONCE([sys/mman.h]) + AC_CHECK_FUNCS_ONCE([mprotect]) + + dnl Detect bug in FreeBSD 15.0 on x86_64: + dnl strncpy should not dereference more than n bytes, but always dereferences + dnl n+1 bytes if the first n bytes don't contain a NUL byte. + dnl Assume that strncpy works on platforms that lack mprotect. + AC_CACHE_CHECK([whether strncpy works], [gl_cv_func_strncpy_works], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#if HAVE_SYS_MMAN_H +# include +# include +# include +# include +#endif +]GL_MDA_DEFINES], +[[ + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT + { + long int pagesize = sysconf (_SC_PAGESIZE); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + char dest[8]; + + dest[0] = 'a'; + dest[1] = 'b'; + dest[2] = 'c'; + dest[3] = 'd'; + dest[4] = 'e'; + dest[5] = 'f'; + dest[6] = 'g'; + + *(fence - 3) = '7'; + *(fence - 2) = '2'; + *(fence - 1) = '9'; + + if (strncpy (dest + 1, fence - 3, 3) != dest + 1) + return 1; + if (dest[0] != 'a') + return 2; + if (dest[1] != '7' || dest[2] != '2' || dest[3] != '9') + return 3; + if (dest[4] != 'e') + return 4; + } + return 0; +]])], [gl_cv_func_strncpy_works=yes], [gl_cv_func_strncpy_works=no], + [ + case "$host_os" in + # Guess no on FreeBSD. + freebsd* | dragonfly*) gl_cv_func_strncpy_works="guessing no" ;; + # Guess yes on native Windows. + mingw* | windows*) gl_cv_func_strncpy_works="guessing yes" ;; + # Guess yes otherwise. + *) gl_cv_func_strncpy_works="guessing yes" ;; + esac + ]) + ]) + case "$gl_cv_func_strncpy_works" in + *yes) ;; + *) REPLACE_STRNCPY=1 ;; + esac +]) + +# Prerequisites of lib/strncpy.c. +AC_DEFUN([gl_PREREQ_STRNCPY], [ + : +]) diff --git a/gl/m4/strsep.m4 b/gl/m4/strsep.m4 index cfde87a5..b018ff88 100644 --- a/gl/m4/strsep.m4 +++ b/gl/m4/strsep.m4 @@ -1,9 +1,10 @@ # strsep.m4 # serial 11 -dnl Copyright (C) 2002-2004, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_STRSEP], [ diff --git a/gl/m4/strstr.m4 b/gl/m4/strstr.m4 index 957ed2e3..1b5ef6c1 100644 --- a/gl/m4/strstr.m4 +++ b/gl/m4/strstr.m4 @@ -1,9 +1,10 @@ # strstr.m4 -# serial 24 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 25 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Check that strstr works. AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], @@ -95,7 +96,7 @@ static void quit (int sig) { _exit (sig + 128); } char *haystack = (char *) malloc (2 * m + 2); char *needle = (char *) malloc (m + 2); /* Failure to compile this test due to missing alarm is okay, - since all such platforms (mingw) also have quadratic strstr. */ + since all such platforms (mingw, MSVC) also have quadratic strstr. */ signal (SIGALRM, quit); alarm (5); /* Check for quadratic performance. */ diff --git a/gl/m4/sys_cdefs_h.m4 b/gl/m4/sys_cdefs_h.m4 new file mode 100644 index 00000000..d72796ca --- /dev/null +++ b/gl/m4/sys_cdefs_h.m4 @@ -0,0 +1,26 @@ +# sys_cdefs_h.m4 - Is compatible enough with glibc? +# serial 2 +dnl Copyright 2024-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl Written by Paul Eggert. + +AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H], + [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h], + [gl_cv_header_sys_cdefs_h], + [AC_COMPILE_IFELSE( + [AC_LANG_DEFINES_PROVIDED + [#include + enum { foo = __GNUC_PREREQ (14, 1) } bar; + ]], + [gl_cv_header_sys_cdefs_h=yes], + [gl_cv_header_sys_cdefs_h=no])]) + if test "$gl_cv_header_sys_cdefs_h" = yes; then + HAVE_SYS_CDEFS_H=1 + else + HAVE_SYS_CDEFS_H=0 + fi + AC_SUBST([HAVE_SYS_CDEFS_H])]) diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 3bf3cb47..fb69209b 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 @@ -1,9 +1,10 @@ # sys_socket_h.m4 -# serial 29 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +# serial 31 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Simon Josefsson. @@ -52,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H], fi # We need to check for ws2tcpip.h now. gl_PREREQ_SYS_H_SOCKET - AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ - /* sys/types.h is not needed according to POSIX, but the - sys/socket.h in i386-unknown-freebsd4.10 and - powerpc-apple-darwin5.5 required it. */ -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif -]) + gl_PREREQ_SYS_SA_FAMILY if test $ac_cv_type_struct_sockaddr_storage = no; then HAVE_STRUCT_SOCKADDR_STORAGE=0 fi - if test $ac_cv_type_sa_family_t = no; then - HAVE_SA_FAMILY_T=0 - fi if test $ac_cv_type_struct_sockaddr_storage != no; then AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], [], @@ -158,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], AC_SUBST([HAVE_WS2TCPIP_H]) ]) +# Common prerequisites of the replacement and of the +# replacement. +# Sets and substitutes HAVE_SA_FAMILY_T. +AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY], +[ + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +]) + if test $ac_cv_type_sa_family_t = yes; then + HAVE_SA_FAMILY_T=1 + else + HAVE_SA_FAMILY_T=0 + fi + AC_SUBST([HAVE_SA_FAMILY_T]) +]) + # gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) # sets the shell variable that indicates the presence of the given module # to a C preprocessor expression that will evaluate to 1. @@ -202,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) - HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) ]) diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4 index 3cc50ce6..fdcc8954 100644 --- a/gl/m4/sys_stat_h.m4 +++ b/gl/m4/sys_stat_h.m4 @@ -1,9 +1,10 @@ # sys_stat_h.m4 # serial 42 -*- Autoconf -*- -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Eric Blake. dnl Provide a GNU-like . diff --git a/gl/m4/sys_types_h.m4 b/gl/m4/sys_types_h.m4 index 00d2437b..e99fdcc6 100644 --- a/gl/m4/sys_types_h.m4 +++ b/gl/m4/sys_types_h.m4 @@ -1,9 +1,10 @@ # sys_types_h.m4 -# serial 13 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +# serial 15 +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_SYS_TYPES_H], [ @@ -23,6 +24,9 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], dnl Whether to override the 'off_t' type. AC_REQUIRE([gl_TYPE_OFF_T]) + dnl Whether to define the 'off64_t' type. + AC_REQUIRE([gl_TYPE_OFF64_T]) + dnl Whether to override the 'dev_t' and 'ino_t' types. m4_ifdef([gl_WINDOWS_STAT_INODES], [ AC_REQUIRE([gl_WINDOWS_STAT_INODES]) @@ -30,6 +34,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H], WINDOWS_STAT_INODES=0 ]) AC_SUBST([WINDOWS_STAT_INODES]) + + dnl Test whether the 'blksize_t' type is defined. + AC_CHECK_TYPE([blksize_t], [HAVE_BLKSIZE_T=1], [HAVE_BLKSIZE_T=0]) + AC_SUBST([HAVE_BLKSIZE_T]) + + dnl Test whether the 'blkcnt_t' type is defined. + AC_CHECK_TYPE([blkcnt_t], [HAVE_BLKCNT_T=1], [HAVE_BLKCNT_T=0]) + AC_SUBST([HAVE_BLKCNT_T]) ]) # Initializes the default values for AC_SUBSTed shell variables. diff --git a/gl/m4/sys_uio_h.m4 b/gl/m4/sys_uio_h.m4 index a471c720..eb0e8424 100644 --- a/gl/m4/sys_uio_h.m4 +++ b/gl/m4/sys_uio_h.m4 @@ -1,9 +1,10 @@ # sys_uio_h.m4 # serial 3 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_SYS_UIO_H], [ diff --git a/gl/m4/threadlib.m4 b/gl/m4/threadlib.m4 index f5e81479..333c8fe0 100644 --- a/gl/m4/threadlib.m4 +++ b/gl/m4/threadlib.m4 @@ -1,9 +1,10 @@ # threadlib.m4 -# serial 42 -dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. +# serial 45.1 +dnl Copyright (C) 2005-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. @@ -56,24 +57,22 @@ AC_DEFUN([gl_ANYTHREADLIB_EARLY], [ AC_REQUIRE([AC_CANONICAL_HOST]) if test -z "$gl_anythreadlib_early_done"; then - case "$host_os" in - osf*) - # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + AS_CASE([$host_os], + [osf*], + [# On OSF/1, the compiler needs the flag -D_REENTRANT so that it # groks . cc also understands the flag -pthread, but - # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # we do not use it because 1. gcc-2.95 does not understand -pthread, # 2. putting a flag into CPPFLAGS that has an effect on the linker # causes the AC_LINK_IFELSE test below to succeed unexpectedly, # leading to wrong values of LIBTHREAD and LTLIBTHREAD. CPPFLAGS="$CPPFLAGS -D_REENTRANT" - ;; - esac + ]) # Some systems optimize for single-threaded programs by default, and # need special flags to disable these optimizations. For example, the - # definition of 'errno' in . - case "$host_os" in - aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; - solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; - esac + # definition of errno in . + AS_CASE([$host_os], + [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"], + [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"]) gl_anythreadlib_early_done=done fi ]) @@ -85,24 +84,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS], AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], - [case "$host_os" in - cygwin* | mingw* | windows*) + [AS_CASE([$host_os], + [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" - ;; - *) + ], + [ gl_cv_have_weak=no dnl First, test whether the compiler accepts it syntactically. AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[extern void xyzzy (); -#pragma weak xyzzy]], +#pragma weak xyzzy + ]], [[xyzzy();]])], [gl_cv_have_weak=maybe]) - if test $gl_cv_have_weak = maybe; then + AS_IF([test $gl_cv_have_weak = maybe], [ dnl Second, test whether it actually works. On Cygwin 1.7.2, with dnl gcc 4.3, symbols declared weak always evaluate to the address 0. AC_RUN_IFELSE( @@ -125,20 +126,19 @@ int main () [gl_cv_have_weak="guessing yes"], [gl_cv_have_weak="guessing no"]) ]) - fi - ;; - esac - dnl But when linking statically, weak symbols don't work. - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac + ]) + ]) + dnl But when linking statically, weak symbols do not work. + AS_CASE([" $LDFLAGS "], + [*" -static "*], [gl_cv_have_weak=no]) dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak dnl symbol and linking against a shared library that has a dependency on dnl the shared library that defines the symbol. - case "$gl_cv_have_weak" in - *yes) - case "$host_os" in - freebsd* | dragonfly* | midnightbsd*) + AS_CASE([$gl_cv_have_weak], + [*yes], + [AS_CASE([$host_os], + [freebsd* | dragonfly* | midnightbsd*], + [ : > conftest1.c $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 cat < conftest2.c @@ -152,17 +152,15 @@ EOF $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ || gl_cv_have_weak=no rm -f conftest1.c libempty.so conftest2.c conftest - ;; - esac - ;; - esac + ]) + ]) ]) - case "$gl_cv_have_weak" in - *yes) + AS_CASE([$gl_cv_have_weak], + [*yes], + [ AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], [Define to 1 if the compiler and linker support weak declarations of symbols.]) - ;; - esac + ]) ]) dnl ============================================================================ @@ -188,15 +186,15 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. AC_DEFUN([gl_PTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) - if test -z "$gl_pthreadlib_body_done"; then + AS_IF([test -z "$gl_pthreadlib_body_done"], [ gl_pthread_api=no LIBPTHREAD= LIBPMULTITHREAD= # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + # it groks . It is added above, in gl_ANYTHREADLIB_EARLY. AC_CHECK_HEADER([pthread.h], [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) - if test "$gl_have_pthread_h" = yes; then + AS_IF([test "$gl_have_pthread_h" = yes], [ # Other possible tests: # -lpthreads (FSU threads, PCthreads) # -lgthreads @@ -208,7 +206,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # needs -pthread for some reason. See: # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html saved_LIBS="$LIBS" - for gl_pthread in '' '-pthread'; do + for gl_pthread in "" "-pthread"; do LIBS="$LIBS $gl_pthread" AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -230,8 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY], gl_pthread_in_glibc=no # On Linux with glibc >= 2.34, libc contains the fully functional # pthread functions. - case "$host_os" in - linux*) + AS_CASE([$host_os], + [linux*], + [ AC_EGREP_CPP([Lucky user], [#include #ifdef __GNU_LIBRARY__ @@ -242,19 +241,18 @@ AC_DEFUN([gl_PTHREADLIB_BODY], ], [gl_pthread_in_glibc=yes], []) - ;; - esac + ]) echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD # Test for libpthread by looking for pthread_kill. (Not pthread_self, # since it is defined as a macro on OSF/1.) - if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [ # The program links fine without libpthread. But it may actually # need to link with libpthread in order to create multiple threads. AC_CHECK_LIB([pthread], [pthread_kill], - [if test $gl_pthread_in_glibc = yes; then + [AS_IF([test $gl_pthread_in_glibc = yes], [ LIBPMULTITHREAD= - else + ], [ LIBPMULTITHREAD=-lpthread # On Solaris and HP-UX, most pthread functions exist also in libc. # Therefore pthread_in_use() needs to actually try to create a @@ -262,14 +260,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY], # pthread_create will actually create a thread. # On Solaris 10 or newer, this test is no longer needed, because # libc contains the fully functional pthread functions. - case "$host_os" in -changequote(,)dnl - solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) -changequote([,])dnl - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - esac - fi + AS_CASE([$host_os], + [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]], + [ + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + ]) + ]) ], [dnl This is needed on FreeBSD 5.2.1. AC_CHECK_LIB([thr], [pthread_kill], @@ -280,35 +277,36 @@ changequote([,])dnl fi ]) ]) - elif test $gl_pthread_api != yes; then + ], [test $gl_pthread_api != yes], [ # Some library is needed. Try libpthread and libc_r. AC_CHECK_LIB([pthread], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lpthread LIBPMULTITHREAD=-lpthread]) - if test $gl_pthread_api != yes; then + AS_IF([test $gl_pthread_api != yes], [ # For FreeBSD 4. AC_CHECK_LIB([c_r], [pthread_kill], [gl_pthread_api=yes LIBPTHREAD=-lc_r LIBPMULTITHREAD=-lc_r]) - fi - fi + ]) + ]) echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD - fi + ]) AC_MSG_CHECKING([whether POSIX threads API is available]) AC_MSG_RESULT([$gl_pthread_api]) AC_SUBST([LIBPTHREAD]) AC_SUBST([LIBPMULTITHREAD]) - if test $gl_pthread_api = yes; then + AS_IF([test $gl_pthread_api = yes], [ AC_DEFINE([HAVE_PTHREAD_API], [1], [Define if you have the header and the POSIX threads API.]) - fi + ]) dnl On some systems, sched_yield is in librt, rather than in libpthread. AC_LINK_IFELSE( [AC_LANG_PROGRAM( - [[#include ]], + [[#include + ]], [[sched_yield ();]])], [SCHED_YIELD_LIB= ], @@ -323,7 +321,7 @@ changequote([,])dnl AC_SUBST([LIB_SCHED_YIELD]) gl_pthreadlib_body_done=done - fi + ]) ]) AC_DEFUN([gl_PTHREADLIB], @@ -350,44 +348,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY], [ AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) AC_REQUIRE([AC_CANONICAL_HOST]) - if test -z "$gl_stdthreadlib_body_done"; then + AS_IF([test -z "$gl_stdthreadlib_body_done"], [ AC_CHECK_HEADERS_ONCE([threads.h]) - case "$host_os" in - mingw* | windows*) + AS_CASE([$host_os], + [mingw* | windows*], + [ LIBSTDTHREAD= - ;; - *) + ], + [ gl_PTHREADLIB_BODY - if test $ac_cv_header_threads_h = yes; then + AS_IF([test $ac_cv_header_threads_h = yes], [ dnl glibc >= 2.29 has thrd_create in libpthread. dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends - dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). + dnl 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. - gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include ]]) - if test $ac_cv_func_thrd_create = yes; then + gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include + ]]) + AS_IF([test $ac_cv_func_thrd_create = yes], [ LIBSTDTHREAD= - else + ], [ AC_CHECK_LIB([stdthreads], [thrd_create], [ - LIBSTDTHREAD='-lstdthreads -lpthread' + LIBSTDTHREAD="-lstdthreads -lpthread" ], [ dnl Guess that thrd_create is in libpthread. LIBSTDTHREAD="$LIBPMULTITHREAD" ]) - fi - else + ]) + ], [ dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" - fi - ;; - esac + ]) + ]) AC_SUBST([LIBSTDTHREAD]) AC_MSG_CHECKING([whether ISO C threads API is available]) AC_MSG_RESULT([$ac_cv_header_threads_h]) gl_stdthreadlib_body_done=done - fi + ]) ]) AC_DEFUN([gl_STDTHREADLIB], @@ -404,7 +403,7 @@ dnl ------------ dnl Tests for a multithreading library to be used. dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the -dnl default is 'no', otherwise it is system dependent. In both cases, the user +dnl default is "no", otherwise it is system dependent. In both cases, the user dnl can change the choice through the options --enable-threads=choice or dnl --disable-threads. dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, @@ -449,7 +448,7 @@ 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=])]) - dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like + 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], @@ -459,41 +458,35 @@ AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), [if test -n "$gl_use_threads_default"; then gl_use_threads="$gl_use_threads_default" else -changequote(,)dnl - case "$host_os" in + AS_CASE([$host_os], dnl Disable multithreading by default on OSF/1, because it interferes dnl with fork()/exec(): When msgexec is linked with -lpthread, its dnl child process gets an endless segmentation fault inside execvp(). - osf*) gl_use_threads=no ;; + [osf*], [gl_use_threads=no], dnl Disable multithreading by default on Cygwin 1.5.x, because it has dnl bugs that lead to endless loops or crashes. See dnl . - cygwin*) - case `uname -r` in - 1.[0-5].*) gl_use_threads=no ;; - *) gl_use_threads=yes ;; - esac - ;; + [cygwin*], + [AS_CASE([$(uname -r)], + [[1.[0-5].*]], [gl_use_threads=no], + [gl_use_threads=yes]) + ], dnl Obey gl_AVOID_WINPTHREAD on mingw. - mingw* | windows*) - case "$gl_use_winpthreads_default" in - yes) gl_use_threads=posix ;; - no) gl_use_threads=windows ;; - *) gl_use_threads=yes ;; - esac - ;; - *) gl_use_threads=yes ;; - esac -changequote([,])dnl + [mingw* | windows*], + [AS_CASE([$gl_use_winpthreads_default], + [yes], [gl_use_threads=posix], + [no], [gl_use_threads=windows], + [gl_use_threads=yes]) + ], + [gl_use_threads=yes]) fi ]) - if test "$gl_use_threads" = yes \ - || test "$gl_use_threads" = isoc \ - || test "$gl_use_threads" = posix \ - || test "$gl_use_threads" = isoc+posix; then - # For using or : - gl_ANYTHREADLIB_EARLY - fi + AS_CASE([$gl_use_threads], + [yes | isoc | posix | isoc+posix], + [ + # For using or : + gl_ANYTHREADLIB_EARLY + ]) ]) dnl The guts of gl_THREADLIB. Needs to be expanded only once. @@ -506,90 +499,95 @@ AC_DEFUN([gl_THREADLIB_BODY], LTLIBTHREAD= LIBMULTITHREAD= LTLIBMULTITHREAD= - if test "$gl_use_threads" != no; then + AS_IF([test "$gl_use_threads" = no], + [AC_DEFINE([AVOID_ANY_THREADS], [1], + [Define if no multithread safety and no multithreading is desired.])], + [ dnl Check whether the compiler and linker support weak declarations. gl_WEAK_SYMBOLS - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - dnl If we use weak symbols to implement pthread_in_use / pth_in_use / - dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create - dnl facility is in use. - AC_CHECK_HEADERS_ONCE([threads.h]) - : - fi - if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then - AC_CHECK_HEADERS_ONCE([threads.h]) - gl_have_isoc_threads="$ac_cv_header_threads_h" - fi - if test "$gl_use_threads" = yes \ - || test "$gl_use_threads" = posix \ - || test "$gl_use_threads" = isoc+posix; then - gl_PTHREADLIB_BODY - LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD - LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD - if test $gl_pthread_api = yes; then - if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then - gl_threads_api='isoc+posix' - AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], - [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) - LIBTHREAD= LTLIBTHREAD= - else - gl_threads_api=posix - AC_DEFINE([USE_POSIX_THREADS], [1], - [Define if the POSIX multithreading library can be used.]) - if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then - AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], - [Define if references to the POSIX multithreading library are satisfied by libc.]) - else - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], - [Define if references to the POSIX multithreading library should be made weak.]) - LIBTHREAD= LTLIBTHREAD= - else - case "$host_os" in - freebsd* | dragonfly* | midnightbsd*) - if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then - dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() - dnl etc. will succeed, we need a runtime test. - AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], - [Define if the pthread_in_use() detection is hard.]) - fi - ;; - esac - fi - fi - fi - fi - fi - if test $gl_threads_api = none; then - if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + AS_CASE([$gl_cv_have_weak], + [*yes], + [ + dnl If we use weak symbols to implement pthread_in_use / pth_in_use / + dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create + dnl facility is in use. + AC_CHECK_HEADERS_ONCE([threads.h]) + : + ]) + AS_CASE([$gl_use_threads], + [isoc | isoc+posix], + [ + AC_CHECK_HEADERS_ONCE([threads.h]) + gl_have_isoc_threads="$ac_cv_header_threads_h" + ]) + AS_CASE([$gl_use_threads], + [yes | posix | isoc+posix], + [ + gl_PTHREADLIB_BODY + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + AS_IF([test $gl_pthread_api = yes], [ + AS_IF([test "$gl_use_threads" = isoc+posix && + test "$gl_have_isoc_threads" = yes], [ + gl_threads_api="isoc+posix" + AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], + [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) + LIBTHREAD= LTLIBTHREAD= + ], [ + gl_threads_api=posix + AC_DEFINE([USE_POSIX_THREADS], [1], + [Define if the POSIX multithreading library can be used.]) + AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [ + AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], + [Define if references to the POSIX multithreading library are satisfied by libc.]) + ], [ + AS_CASE([$gl_cv_have_weak], + [*yes], + [ + AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], + [Define if references to the POSIX multithreading library should be made weak.]) + LIBTHREAD= LTLIBTHREAD= + ], + [AS_CASE([$host_os], + [freebsd* | dragonfly* | midnightbsd*], + [ + AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [ + dnl If weak symbols cannot tell whether + dnl pthread_create(), dnl pthread_key_create() + dnl etc. will succeed, we need a runtime test. + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + ]) + ]) + ]) + ]) + ]) + ]) + ]) + AS_IF([test $gl_threads_api = none], [ + AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [ gl_STDTHREADLIB_BODY LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD gl_threads_api=isoc AC_DEFINE([USE_ISOC_THREADS], [1], [Define if the ISO C multithreading library can be used.]) - fi - fi - if test $gl_threads_api = none; then - case "$gl_use_threads" in - yes | windows | win32) # The 'win32' is for backward compatibility. - if { case "$host_os" in - mingw* | windows*) true;; - *) false;; - esac - }; then - gl_threads_api=windows - AC_DEFINE([USE_WINDOWS_THREADS], [1], - [Define if the native Windows multithreading API can be used.]) - fi - ;; - 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 + ]) + ]) + AS_IF([test $gl_threads_api = none], [ + # The "win32" is for backward compatibility. + AS_CASE([$gl_use_threads], + [yes | windows | win32], + [AS_CASE([$host_os], + [mingw* | windows*], + [ + gl_threads_api=windows + AC_DEFINE([USE_WINDOWS_THREADS], [1], + [Define if the native Windows multithreading API can be used.]) + ]) + ]) + ]) + ]) AC_MSG_CHECKING([for multithread API to use]) AC_MSG_RESULT([$gl_threads_api]) AC_SUBST([LIBTHREAD]) @@ -609,7 +607,7 @@ dnl gl_DISABLE_THREADS dnl ------------------ dnl Sets the gl_THREADLIB default so that threads are not used by default. dnl The user can still override it at installation time, by using the -dnl configure option '--enable-threads'. +dnl configure option "--enable-threads". AC_DEFUN([gl_DISABLE_THREADS], [ m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) @@ -621,7 +619,7 @@ 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=posix'. +dnl configure option "--enable-threads=posix". dnl As of 2023, this is now the default. AC_DEFUN([gl_AVOID_WINPTHREAD], [ diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4 index d2f3c970..f4d8e20f 100644 --- a/gl/m4/time_h.m4 +++ b/gl/m4/time_h.m4 @@ -1,9 +1,11 @@ # time_h.m4 -# serial 25 -dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. +# serial 27 +dnl Copyright (C) 2000-2001, 2003-2007, 2009-2025 Free Software Foundation, +dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Configure a more-standard replacement for . @@ -145,6 +147,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME]) gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) dnl Support Microsoft deprecated alias function names by default. gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) @@ -162,13 +165,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS], HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) - dnl Even GNU libc does not have timezone_t yet. + dnl Even GNU libc does not have timezone_t and tzalloc() yet. HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) + HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC]) REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ]) REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) + REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z]) REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) diff --git a/gl/m4/time_r.m4 b/gl/m4/time_r.m4 index 3675390e..96f5c5b5 100644 --- a/gl/m4/time_r.m4 +++ b/gl/m4/time_r.m4 @@ -1,9 +1,10 @@ # time_r.m4 # serial 1 -dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Reentrant time functions: localtime_r, gmtime_r. diff --git a/gl/m4/timegm.m4 b/gl/m4/timegm.m4 index c1ff2677..cb6da6da 100644 --- a/gl/m4/timegm.m4 +++ b/gl/m4/timegm.m4 @@ -1,9 +1,10 @@ # timegm.m4 # serial 16 -dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_TIMEGM], [ diff --git a/gl/m4/uchar_h.m4 b/gl/m4/uchar_h.m4 new file mode 100644 index 00000000..b2309385 --- /dev/null +++ b/gl/m4/uchar_h.m4 @@ -0,0 +1,279 @@ +# uchar_h.m4 +# serial 32 +dnl Copyright (C) 2019-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +dnl From Bruno Haible. +dnl Prepare the overridden . + +AC_DEFUN_ONCE([gl_UCHAR_H], +[ + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([uchar.h]) + if test $ac_cv_header_uchar_h = yes; then + HAVE_UCHAR_H=1 + else + HAVE_UCHAR_H=0 + fi + AC_SUBST([HAVE_UCHAR_H]) + + dnl On macOS 15, in C mode, does not exist. But in C++ mode, + dnl it exists, and we need to #include_next it, otherwise we get an error + dnl " tried including but didn't find libc++'s + dnl header." + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + CXX_HAVE_UCHAR_H=0 + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler has ], + [gl_cv_cxx_have_uchar_h], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_have_uchar_h=yes + else + gl_cv_cxx_have_uchar_h=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_have_uchar_h = yes; then + CXX_HAVE_UCHAR_H=1 + fi + fi + AC_SUBST([CXX_HAVE_UCHAR_H]) + + gl_TYPE_CHAR8_T + gl_TYPE_CHAR16_T + gl_TYPE_CHAR32_T + + dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types + dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many + dnl header files (, , , , + dnl and others) on some platforms (e.g. Mac OS X 10.13). + dnl The same thing may also happen for 'char8_t'; so, be prepared for it. + m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])]) + CXX_HAS_UCHAR_TYPES=0 + if test $HAVE_UCHAR_H = 0; then + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler predefines the types], + [gl_cv_cxx_has_uchar_types], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +char16_t a; +char32_t b; +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_has_uchar_types=yes + else + gl_cv_cxx_has_uchar_types=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_has_uchar_types = yes; then + CXX_HAS_UCHAR_TYPES=1 + fi + fi + fi + AC_SUBST([CXX_HAS_UCHAR_TYPES]) + CXX_HAS_CHAR8_TYPE=0 + if test $HAVE_UCHAR_H = 0; then + if test "$CXX" != no; then + AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t type], + [gl_cv_cxx_has_char8_type], + [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to + dnl an autoconf bug . + cat > conftest.cpp <<\EOF +#include +char8_t a; +EOF + gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp" + if AC_TRY_EVAL([gl_command]); then + gl_cv_cxx_has_char8_type=yes + else + gl_cv_cxx_has_char8_type=no + fi + rm -fr conftest* + ]) + if test $gl_cv_cxx_has_char8_type = yes; then + CXX_HAS_CHAR8_TYPE=1 + fi + fi + fi + AC_SUBST([CXX_HAS_CHAR8_TYPE]) + + dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'. + gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES]) + if test $BITSIZEOF_WCHAR_T -lt 32; then + SMALL_WCHAR_T=1 + else + SMALL_WCHAR_T=0 + fi + dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows. + AC_SUBST([SMALL_WCHAR_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C11. + gl_WARN_ON_USE_PREPARE([[ + #ifdef __HAIKU__ + #include + #endif + #include + ]], [c32rtomb mbrtoc16 mbrtoc32]) +]) + +AC_DEFUN_ONCE([gl_TYPE_CHAR8_T], +[ + dnl Determine whether gnulib's would, if present, override char8_t. + AC_CACHE_CHECK([whether char8_t is correctly defined], + [gl_cv_type_char8_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char8_t_works=yes], + [gl_cv_type_char8_t_works=no]) + ]) + if test $gl_cv_type_char8_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR8_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR8_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T]) +]) + +dnl On Haiku 2020, char16_t and char32_t are incorrectly defined. +dnl See . +AC_DEFUN_ONCE([gl_TYPE_CHAR16_T], +[ + dnl Determine whether gnulib's would, if present, override char16_t. + AC_CACHE_CHECK([whether char16_t is correctly defined], + [gl_cv_type_char16_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + /* For simplicity, assume that uint16_least_t is equivalent to + 'unsigned short'. */ + int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char16_t_works=yes], + [gl_cv_type_char16_t_works=no]) + ]) + if test $gl_cv_type_char16_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR16_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR16_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T]) +]) +AC_DEFUN_ONCE([gl_TYPE_CHAR32_T], +[ + dnl Determine whether gnulib's would, if present, override char32_t. + AC_CACHE_CHECK([whether char32_t is correctly defined], + [gl_cv_type_char32_t_works], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __HAIKU__ + #include + #endif + #include + /* For simplicity, assume that uint32_least_t is equivalent to + 'unsigned int'. */ + int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1]; + ]]) + ], + [gl_cv_type_char32_t_works=yes], + [gl_cv_type_char32_t_works=no]) + ]) + if test $gl_cv_type_char32_t_works = no; then + GNULIBHEADERS_OVERRIDE_CHAR32_T=1 + else + GNULIBHEADERS_OVERRIDE_CHAR32_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T]) +]) + +# gl_UCHAR_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UCHAR_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UCHAR_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UCHAR_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UCHAR_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB]) + HAVE_MBRTOC16=1; AC_SUBST([HAVE_MBRTOC16]) + HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32]) + REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB]) + REPLACE_MBRTOC16=0; AC_SUBST([REPLACE_MBRTOC16]) + REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32]) +]) diff --git a/gl/m4/ungetc.m4 b/gl/m4/ungetc.m4 index 42f7ec32..969b60e8 100644 --- a/gl/m4/ungetc.m4 +++ b/gl/m4/ungetc.m4 @@ -1,9 +1,10 @@ # ungetc.m4 # serial 12 -dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], [ diff --git a/gl/m4/unicase_h.m4 b/gl/m4/unicase_h.m4 new file mode 100644 index 00000000..bf5d4c2e --- /dev/null +++ b/gl/m4/unicase_h.m4 @@ -0,0 +1,45 @@ +# unicase_h.m4 +# serial 1 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNICASE_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) +]) + +# gl_UNICASE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNICASE_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNICASE_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNICASE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNICASE_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) diff --git a/gl/m4/unictype_h.m4 b/gl/m4/unictype_h.m4 new file mode 100644 index 00000000..68ddaf6c --- /dev/null +++ b/gl/m4/unictype_h.m4 @@ -0,0 +1,179 @@ +# unictype_h.m4 +# serial 4 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNICTYPE_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) +]) + +# gl_UNICTYPE_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNICTYPE_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNICTYPE_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) diff --git a/gl/m4/uninorm_h.m4 b/gl/m4/uninorm_h.m4 new file mode 100644 index 00000000..d416f73b --- /dev/null +++ b/gl/m4/uninorm_h.m4 @@ -0,0 +1,47 @@ +# uninorm_h.m4 +# serial 1 +dnl Copyright (C) 2023-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNINORM_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) +]) + +# gl_UNINORM_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNINORM_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNINORM_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE']) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNINORM_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNINORM_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. +]) diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index 81d1b9f6..6ec16286 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 @@ -1,9 +1,10 @@ # unistd_h.m4 -# serial 95 -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +# serial 97 +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Simon Josefsson, Bruno Haible. @@ -243,11 +244,13 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) + REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN]) REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) + REPLACE_GETUSERSHELL=0; AC_SUBST([REPLACE_GETUSERSHELL]) REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) diff --git a/gl/m4/unitypes_h.m4 b/gl/m4/unitypes_h.m4 new file mode 100644 index 00000000..264e61be --- /dev/null +++ b/gl/m4/unitypes_h.m4 @@ -0,0 +1,26 @@ +# unitypes_h.m4 +# serial 1 +dnl Copyright (C) 2021-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN_ONCE([gl_UNITYPES_H], +[ + AH_VERBATIM([unitypes_restrict], [ +/* This definition is a duplicate of the one in unitypes.h. + It is here so that we can cope with an older version of unitypes.h + that does not contain this definition and that is pre-installed among + the public header files. */ +# if defined __restrict \ + || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \ + || __clang_major__ >= 3 +# define _UC_RESTRICT __restrict +# elif 199901L <= __STDC_VERSION__ || defined restrict +# define _UC_RESTRICT restrict +# else +# define _UC_RESTRICT +# endif +]) +]) diff --git a/gl/m4/unlocked-io.m4 b/gl/m4/unlocked-io.m4 index e96cf5f8..97f43f4b 100644 --- a/gl/m4/unlocked-io.m4 +++ b/gl/m4/unlocked-io.m4 @@ -1,9 +1,10 @@ # unlocked-io.m4 # serial 16 -dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 1998-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Jim Meyering. dnl diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4 index 9211f69d..086e409f 100644 --- a/gl/m4/vararrays.m4 +++ b/gl/m4/vararrays.m4 @@ -1,9 +1,10 @@ # vararrays.m4 # serial 6 -dnl Copyright (C) 2001, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2001, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # Check for variable-length arrays. diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 1ea2055e..1d040d6e 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 @@ -1,14 +1,47 @@ # vasnprintf.m4 -# serial 52 -dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. +# serial 56 +dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_VASNPRINTF], [ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles AC_CHECK_FUNCS_ONCE([vasnprintf]) - if test $ac_cv_func_vasnprintf = no; then + if test $ac_cv_func_vasnprintf = yes; then + dnl On Cygwin, in directives with a huge width, the width is ignored, and + dnl the function returns a wrong result. + AC_CACHE_CHECK([whether vasnprintf works], + [gl_cv_func_vasnprintf_works], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + ]], + [[size_t len; + char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17); + /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */ + return (res != NULL && len < 10); + ]]) + ], + [gl_cv_func_vasnprintf_works=yes], + [gl_cv_func_vasnprintf_works=no], + [case "$host_os" in + # Guess no on Cygwin. + cygwin*) gl_cv_func_vasnprintf_works="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";; + esac + ]) + ]) + fi + if test $ac_cv_func_vasnprintf != yes \ + || case "$gl_cv_func_vasnprintf_works" in + *yes) false;; + *) true;; + esac + then gl_REPLACE_VASNPRINTF fi ]) @@ -42,7 +75,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF], # Prerequisites of lib/printf-args.h, lib/printf-args.c. AC_DEFUN([gl_PREREQ_PRINTF_ARGS], [ - AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) ]) @@ -51,7 +83,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ AC_REQUIRE([gl_FEATURES_H]) - AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) AC_REQUIRE([AC_TYPE_SIZE_T]) AC_CHECK_TYPE([ptrdiff_t], , @@ -185,7 +216,6 @@ int main() 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 @@ -327,15 +357,39 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC], # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], [ + AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) - case "$gl_cv_func_printf_flag_grouping" in - *yes) - ;; - *) + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION]) + AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE]) + case "$host_os" in + mingw* | windows*) + dnl MSVC does not support the ' flag at all. + dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined. + dnl mingw also has other bugs regarding the ' flag. AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], [Define if the vasnprintf implementation needs special code for the ' flag.]) ;; + *) + case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in + *yes,*yes) + case "$gl_cv_func_printf_flag_grouping_int_precision" in + *yes) + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1], + [Define if the vasnprintf implementation needs special code for the + ' flag, for integer directives only.]) + ;; + esac + ;; + *) + AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], + [Define if the vasnprintf implementation needs special code for the + ' flag.]) + ;; + esac + ;; esac ]) diff --git a/gl/m4/vasprintf.m4 b/gl/m4/vasprintf.m4 index 73f7b807..6ea602bd 100644 --- a/gl/m4/vasprintf.m4 +++ b/gl/m4/vasprintf.m4 @@ -1,10 +1,11 @@ # vasprintf.m4 # serial 6 -dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, +dnl Copyright (C) 2002-2003, 2006-2007, 2009-2025 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_VASPRINTF], [ diff --git a/gl/m4/visibility.m4 b/gl/m4/visibility.m4 index ecf09686..c2cd38d0 100644 --- a/gl/m4/visibility.m4 +++ b/gl/m4/visibility.m4 @@ -1,9 +1,10 @@ # visibility.m4 # serial 9 -dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2005, 2008, 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. diff --git a/gl/m4/vsnprintf.m4 b/gl/m4/vsnprintf.m4 index 9f321f3f..68ab757d 100644 --- a/gl/m4/vsnprintf.m4 +++ b/gl/m4/vsnprintf.m4 @@ -1,9 +1,10 @@ # vsnprintf.m4 # serial 7 -dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib diff --git a/gl/m4/warn-on-use.m4 b/gl/m4/warn-on-use.m4 index 6c8c76b8..73cf16fb 100644 --- a/gl/m4/warn-on-use.m4 +++ b/gl/m4/warn-on-use.m4 @@ -1,9 +1,10 @@ # warn-on-use.m4 # serial 11 -dnl Copyright (C) 2010-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2010-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. # gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) # --------------------------------------- diff --git a/gl/m4/wchar_h.m4 b/gl/m4/wchar_h.m4 index 995bdc65..722fcfc2 100644 --- a/gl/m4/wchar_h.m4 +++ b/gl/m4/wchar_h.m4 @@ -1,9 +1,10 @@ # wchar_h.m4 -# serial 64 -dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. +# serial 65 +dnl Copyright (C) 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl A placeholder for ISO C99 , for platforms that have issues. @@ -256,6 +257,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) + REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT]) REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) diff --git a/gl/m4/wchar_t.m4 b/gl/m4/wchar_t.m4 deleted file mode 100644 index 968832cb..00000000 --- a/gl/m4/wchar_t.m4 +++ /dev/null @@ -1,25 +0,0 @@ -# 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. - -dnl From Bruno Haible. -dnl Test whether has the 'wchar_t' type. -dnl Prerequisite: AC_PROG_CC - -AC_DEFUN([gt_TYPE_WCHAR_T], -[ - AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - wchar_t foo = (wchar_t)'\0';]], - [[]])], - [gt_cv_c_wchar_t=yes], - [gt_cv_c_wchar_t=no])]) - if test $gt_cv_c_wchar_t = yes; then - AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) - fi -]) diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index 35dff6f0..91530176 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 @@ -1,9 +1,10 @@ # wcrtomb.m4 -# serial 19 -dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. +# serial 21 +dnl Copyright (C) 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_FUNC_WCRTOMB], [ @@ -36,7 +37,7 @@ AC_DEFUN([gl_FUNC_WCRTOMB], dnl sometimes returns 0 instead of 1. AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([gt_LOCALE_FR]) - AC_REQUIRE([gt_LOCALE_FR_UTF8]) + AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_REQUIRE([gt_LOCALE_JA]) AC_REQUIRE([gt_LOCALE_ZH_CN]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles @@ -90,7 +91,7 @@ changequote(,)dnl 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 + if test $LOCALE_FR != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then AC_RUN_IFELSE( [AC_LANG_SOURCE([[ #include @@ -106,8 +107,8 @@ int main () if (wcrtomb (NULL, 0, NULL) != 1) result |= 1; } - if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 - && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + if (strcmp ("$LOCALE_EN_UTF8", "none") != 0 + && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL) { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; diff --git a/gl/m4/wctype.m4 b/gl/m4/wctype.m4 index e5d70740..56593cd5 100644 --- a/gl/m4/wctype.m4 +++ b/gl/m4/wctype.m4 @@ -1,9 +1,10 @@ # wctype.m4 # serial 6 -dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2011-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN_ONCE([gl_FUNC_WCTYPE], [ diff --git a/gl/m4/wctype_h.m4 b/gl/m4/wctype_h.m4 index a3b07c2a..8e54678d 100644 --- a/gl/m4/wctype_h.m4 +++ b/gl/m4/wctype_h.m4 @@ -3,10 +3,11 @@ dnl A placeholder for ISO C99 , for platforms that lack it. -dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl Written by Paul Eggert. diff --git a/gl/m4/wcwidth.m4 b/gl/m4/wcwidth.m4 new file mode 100644 index 00000000..2cc6ebb1 --- /dev/null +++ b/gl/m4/wcwidth.m4 @@ -0,0 +1,116 @@ +# wcwidth.m4 +# serial 38 +dnl Copyright (C) 2006-2025 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. + +AC_DEFUN([gl_FUNC_WCWIDTH], +[ + AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + dnl Persuade glibc to declare wcwidth(). + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([gt_TYPE_WINT_T]) + + AC_CHECK_HEADERS_ONCE([wchar.h]) + AC_CHECK_FUNCS_ONCE([wcwidth]) + + AC_CHECK_DECLS([wcwidth], [], [], [[ + #include + ]]) + if test $ac_cv_have_decl_wcwidth != yes; then + HAVE_DECL_WCWIDTH=0 + fi + + if test $ac_cv_func_wcwidth != yes; then + AC_CACHE_CHECK([whether wcwidth is a macro], + [gl_cv_func_wcwidth_macro], + [AC_EGREP_CPP([wchar_header_defines_wcwidth], [ +#include +#ifdef wcwidth + wchar_header_defines_wcwidth +#endif], + [gl_cv_func_wcwidth_macro=yes], + [gl_cv_func_wcwidth_macro=no]) + ]) + fi + + if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then + HAVE_WCWIDTH=1 + dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. + dnl On macOS 12.5, NetBSD 9.3, OpenBSD 5.0, MidnightBSD 1.1, + dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1. + dnl On macOS 12.5, NetBSD 9.3, MidnightBSD 1.1, OSF/1 5.1, + dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. + dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0. + dnl This leads to bugs in 'ls' (coreutils). + dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2, + dnl even in Western locales. + AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales], + [gl_cv_func_wcwidth_works], + [ + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#if !HAVE_DECL_WCWIDTH +extern +# ifdef __cplusplus +"C" +# endif +int wcwidth (int); +#endif +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "en_US.UTF-8") != NULL) + { + if (wcwidth (0x0301) > 0) + result |= 1; + if (wcwidth (0x05B0) > 0) + result |= 2; + if (wcwidth (0x200B) > 0) + result |= 4; + if (wcwidth (0xFF1A) == 0) + result |= 8; + if (wcwidth (0x2202) > 1) + result |= 16; + } + return result; +}]])], + [gl_cv_func_wcwidth_works=yes], + [gl_cv_func_wcwidth_works=no], + [ +changequote(,)dnl + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on musl systems. + *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";; + # Guess yes on AIX 7 systems. + aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";; + *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";; + esac +changequote([,])dnl + ]) + ]) + case "$gl_cv_func_wcwidth_works" in + *yes) ;; + *no) REPLACE_WCWIDTH=1 ;; + esac + else + HAVE_WCWIDTH=0 + fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. +]) + +# Prerequisites of lib/wcwidth.c. +AC_DEFUN([gl_PREREQ_WCWIDTH], [ + AC_REQUIRE([AC_C_INLINE]) + : +]) diff --git a/gl/m4/wint_t.m4 b/gl/m4/wint_t.m4 index 883fac28..8a3c7944 100644 --- a/gl/m4/wint_t.m4 +++ b/gl/m4/wint_t.m4 @@ -1,9 +1,10 @@ # wint_t.m4 # serial 11 -dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl From Bruno Haible. dnl Test whether has the 'wint_t' type and whether gnulib's diff --git a/gl/m4/xalloc.m4 b/gl/m4/xalloc.m4 index d44d0f08..c10c4189 100644 --- a/gl/m4/xalloc.m4 +++ b/gl/m4/xalloc.m4 @@ -1,8 +1,9 @@ # xalloc.m4 # serial 18 -dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_XALLOC], [:]) diff --git a/gl/m4/xsize.m4 b/gl/m4/xsize.m4 index e5784973..157d635c 100644 --- a/gl/m4/xsize.m4 +++ b/gl/m4/xsize.m4 @@ -1,9 +1,10 @@ # xsize.m4 # serial 5 -dnl Copyright (C) 2003-2004, 2008-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2003-2004, 2008-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. AC_DEFUN([gl_XSIZE], [ diff --git a/gl/m4/zzgnulib.m4 b/gl/m4/zzgnulib.m4 index 710fba4e..343bda5c 100644 --- a/gl/m4/zzgnulib.m4 +++ b/gl/m4/zzgnulib.m4 @@ -1,9 +1,10 @@ # zzgnulib.m4 # serial 1 -dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. +dnl Copyright (C) 2020-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. +dnl This file is offered as-is, without any warranty. dnl This file must be named something that sorts after all other dnl package- or gnulib-provided .m4 files - at least for those packages -- cgit v1.2.3-74-g34f1