summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-12-28 12:13:40 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-12-28 12:13:40 +0100
commitb0afb8fe0ff1d87165af9df61501197a06240dda (patch)
tree274ac6a96c53ef4c19ab4974ce24a06a233128c5 /gl/m4
parent68fc05381ee5fa0aee1413118fbb3d81ca888b09 (diff)
downloadmonitoring-plugins-b0afb8fe0ff1d87165af9df61501197a06240dda.tar.gz
Sync with Gnulib stable-202507 code (a8ac9f9ce5)
Diffstat (limited to 'gl/m4')
-rw-r--r--gl/m4/00gnulib.m43
-rw-r--r--gl/m4/__inline.m43
-rw-r--r--gl/m4/absolute-header.m43
-rw-r--r--gl/m4/af_alg.m43
-rw-r--r--gl/m4/alloca.m43
-rw-r--r--gl/m4/arpa_inet_h.m49
-rw-r--r--gl/m4/assert_h.m476
-rw-r--r--gl/m4/base64.m43
-rw-r--r--gl/m4/btowc.m413
-rw-r--r--gl/m4/build-to-host.m4274
-rw-r--r--gl/m4/builtin-expect.m410
-rw-r--r--gl/m4/byteswap.m434
-rw-r--r--gl/m4/c-bool.m420
-rw-r--r--gl/m4/c32rtomb.m4187
-rw-r--r--gl/m4/calloc.m473
-rw-r--r--gl/m4/close.m43
-rw-r--r--gl/m4/codeset.m43
-rw-r--r--gl/m4/double-slash-root.m43
-rw-r--r--gl/m4/dup2.m43
-rw-r--r--gl/m4/eealloc.m432
-rw-r--r--gl/m4/environ.m43
-rw-r--r--gl/m4/errno_h.m413
-rw-r--r--gl/m4/error.m44
-rw-r--r--gl/m4/error_h.m420
-rw-r--r--gl/m4/exponentd.m47
-rw-r--r--gl/m4/extensions-aix.m426
-rw-r--r--gl/m4/extensions.m43
-rw-r--r--gl/m4/extern-inline.m43
-rw-r--r--gl/m4/fclose.m43
-rw-r--r--gl/m4/fcntl-o.m497
-rw-r--r--gl/m4/fcntl.m43
-rw-r--r--gl/m4/fcntl_h.m43
-rw-r--r--gl/m4/fflush.m414
-rw-r--r--gl/m4/float_h.m430
-rw-r--r--gl/m4/floorf.m43
-rw-r--r--gl/m4/fopen.m43
-rw-r--r--gl/m4/fpurge.m494
-rw-r--r--gl/m4/freading.m43
-rw-r--r--gl/m4/free.m43
-rw-r--r--gl/m4/fseek.m43
-rw-r--r--gl/m4/fseeko.m49
-rw-r--r--gl/m4/fseterr.m415
-rw-r--r--gl/m4/fstat.m43
-rw-r--r--gl/m4/fstypename.m43
-rw-r--r--gl/m4/fsusage.m44
-rw-r--r--gl/m4/ftell.m43
-rw-r--r--gl/m4/ftello.m49
-rw-r--r--gl/m4/getaddrinfo.m446
-rw-r--r--gl/m4/getdelim.m43
-rw-r--r--gl/m4/getdtablesize.m43
-rw-r--r--gl/m4/gethostname.m43
-rw-r--r--gl/m4/getline.m43
-rw-r--r--gl/m4/getloadavg.m45
-rw-r--r--gl/m4/getopt.m416
-rw-r--r--gl/m4/getprogname.m43
-rw-r--r--gl/m4/gl-openssl.m43
-rw-r--r--gl/m4/gnulib-cache.m42
-rw-r--r--gl/m4/gnulib-common.m4457
-rw-r--r--gl/m4/gnulib-comp.m4517
-rw-r--r--gl/m4/gnulib-i18n.m461
-rw-r--r--gl/m4/gnulib-tool.m48
-rw-r--r--gl/m4/hostent.m43
-rw-r--r--gl/m4/idpriv.m43
-rw-r--r--gl/m4/include_next.m43
-rw-r--r--gl/m4/inet_ntop.m43
-rw-r--r--gl/m4/inet_pton.m472
-rw-r--r--gl/m4/intmax_t.m43
-rw-r--r--gl/m4/inttypes.m43
-rw-r--r--gl/m4/inttypes_h.m43
-rw-r--r--gl/m4/iswblank.m43
-rw-r--r--gl/m4/iswctype.m43
-rw-r--r--gl/m4/iswdigit.m421
-rw-r--r--gl/m4/iswpunct.m43
-rw-r--r--gl/m4/iswxdigit.m421
-rw-r--r--gl/m4/langinfo_h.m420
-rw-r--r--gl/m4/largefile.m411
-rw-r--r--gl/m4/libunistring-base.m4204
-rw-r--r--gl/m4/limits-h.m43
-rw-r--r--gl/m4/localcharset.m43
-rw-r--r--gl/m4/locale-en.m4138
-rw-r--r--gl/m4/locale-fr.m425
-rw-r--r--gl/m4/locale-ja.m410
-rw-r--r--gl/m4/locale-zh.m424
-rw-r--r--gl/m4/locale_h.m452
-rw-r--r--gl/m4/localeconv.m43
-rw-r--r--gl/m4/lock.m43
-rw-r--r--gl/m4/lseek.m43
-rw-r--r--gl/m4/lstat.m482
-rw-r--r--gl/m4/malloc.m4139
-rw-r--r--gl/m4/malloca.m47
-rw-r--r--gl/m4/math_h.m414
-rw-r--r--gl/m4/mbchar.m415
-rw-r--r--gl/m4/mbiter.m416
-rw-r--r--gl/m4/mbrtoc32.m4326
-rw-r--r--gl/m4/mbrtowc.m437
-rw-r--r--gl/m4/mbsinit.m43
-rw-r--r--gl/m4/mbstate_t.m43
-rw-r--r--gl/m4/mbtowc.m43
-rw-r--r--gl/m4/memchr.m47
-rw-r--r--gl/m4/minmax.m43
-rw-r--r--gl/m4/mktime.m46
-rw-r--r--gl/m4/mmap-anon.m43
-rw-r--r--gl/m4/mode_t.m43
-rw-r--r--gl/m4/mountlist.m418
-rw-r--r--gl/m4/msvc-inval.m43
-rw-r--r--gl/m4/msvc-nothrow.m43
-rw-r--r--gl/m4/multiarch.m43
-rw-r--r--gl/m4/musl.m43
-rw-r--r--gl/m4/netdb_h.m43
-rw-r--r--gl/m4/netinet_in_h.m43
-rw-r--r--gl/m4/nl_langinfo.m413
-rw-r--r--gl/m4/nocrash.m43
-rw-r--r--gl/m4/off64_t.m432
-rw-r--r--gl/m4/off_t.m43
-rw-r--r--gl/m4/once.m414
-rw-r--r--gl/m4/open-cloexec.m43
-rw-r--r--gl/m4/open-slash.m43
-rw-r--r--gl/m4/open.m48
-rw-r--r--gl/m4/pathmax.m43
-rw-r--r--gl/m4/pid_t.m43
-rw-r--r--gl/m4/printf.m4288
-rw-r--r--gl/m4/pthread-once.m483
-rw-r--r--gl/m4/pthread-spin.m472
-rw-r--r--gl/m4/pthread_h.m4293
-rw-r--r--gl/m4/pthread_rwlock_rdlock.m43
-rw-r--r--gl/m4/realloc.m4153
-rw-r--r--gl/m4/reallocarray.m416
-rw-r--r--gl/m4/regex.m426
-rw-r--r--gl/m4/sched_h.m4102
-rw-r--r--gl/m4/servent.m43
-rw-r--r--gl/m4/setenv.m47
-rw-r--r--gl/m4/setlocale_null.m47
-rw-r--r--gl/m4/sha256.m43
-rw-r--r--gl/m4/size_max.m43
-rw-r--r--gl/m4/snprintf.m43
-rw-r--r--gl/m4/socketlib.m43
-rw-r--r--gl/m4/sockets.m43
-rw-r--r--gl/m4/socklen.m43
-rw-r--r--gl/m4/sockpfaf.m415
-rw-r--r--gl/m4/ssize_t.m43
-rw-r--r--gl/m4/stat-time.m44
-rw-r--r--gl/m4/stat.m43
-rw-r--r--gl/m4/std-gnu11.m427
-rw-r--r--gl/m4/stdalign.m418
-rw-r--r--gl/m4/stdckdint_h.m4136
-rw-r--r--gl/m4/stddef_h.m463
-rw-r--r--gl/m4/stdint.m47
-rw-r--r--gl/m4/stdint_h.m43
-rw-r--r--gl/m4/stdio_h.m417
-rw-r--r--gl/m4/stdlib_h.m466
-rw-r--r--gl/m4/strcasecmp.m467
-rw-r--r--gl/m4/strcasestr.m47
-rw-r--r--gl/m4/strerror.m43
-rw-r--r--gl/m4/string_h.m419
-rw-r--r--gl/m4/strings_h.m418
-rw-r--r--gl/m4/strncasecmp.m4 (renamed from gl/m4/strcase.m4)34
-rw-r--r--gl/m4/strncpy.m494
-rw-r--r--gl/m4/strsep.m43
-rw-r--r--gl/m4/strstr.m47
-rw-r--r--gl/m4/sys_cdefs_h.m426
-rw-r--r--gl/m4/sys_socket_h.m448
-rw-r--r--gl/m4/sys_stat_h.m43
-rw-r--r--gl/m4/sys_types_h.m416
-rw-r--r--gl/m4/sys_uio_h.m43
-rw-r--r--gl/m4/threadlib.m4376
-rw-r--r--gl/m4/time_h.m412
-rw-r--r--gl/m4/time_r.m43
-rw-r--r--gl/m4/timegm.m43
-rw-r--r--gl/m4/uchar_h.m4279
-rw-r--r--gl/m4/ungetc.m43
-rw-r--r--gl/m4/unicase_h.m445
-rw-r--r--gl/m4/unictype_h.m4179
-rw-r--r--gl/m4/uninorm_h.m447
-rw-r--r--gl/m4/unistd_h.m47
-rw-r--r--gl/m4/unitypes_h.m426
-rw-r--r--gl/m4/unlocked-io.m43
-rw-r--r--gl/m4/vararrays.m43
-rw-r--r--gl/m4/vasnprintf.m474
-rw-r--r--gl/m4/vasprintf.m43
-rw-r--r--gl/m4/visibility.m43
-rw-r--r--gl/m4/vsnprintf.m43
-rw-r--r--gl/m4/warn-on-use.m43
-rw-r--r--gl/m4/wchar_h.m46
-rw-r--r--gl/m4/wchar_t.m425
-rw-r--r--gl/m4/wcrtomb.m413
-rw-r--r--gl/m4/wctype.m43
-rw-r--r--gl/m4/wctype_h.m43
-rw-r--r--gl/m4/wcwidth.m4116
-rw-r--r--gl/m4/wint_t.m43
-rw-r--r--gl/m4/xalloc.m43
-rw-r--r--gl/m4/xsize.m43
-rw-r--r--gl/m4/zzgnulib.m43
192 files changed, 5633 insertions, 1101 deletions
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 @@
1# 00gnulib.m4 1# 00gnulib.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl This file must be named something that sorts before all other 9dnl This file must be named something that sorts before all other
9dnl gnulib-provided .m4 files. It is needed until the clang fix has 10dnl 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 @@
1# __inline.m4 1# __inline.m4
2# serial 1 2# serial 1
3dnl Copyright 2017-2024 Free Software Foundation, Inc. 3dnl Copyright 2017-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test for __inline keyword 9# Test for __inline keyword
9 10
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 @@
1# absolute-header.m4 1# absolute-header.m4
2# serial 18 2# serial 18
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Derek Price. 9dnl From Derek Price.
9 10
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 @@
1# af_alg.m4 1# af_alg.m4
2# serial 6 2# serial 6
3dnl Copyright 2018-2024 Free Software Foundation, Inc. 3dnl Copyright 2018-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Matteo Croce. 9dnl From Matteo Croce.
9 10
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 @@
1# alloca.m4 1# alloca.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2002-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2004, 2006-2007, 2009-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_ALLOCA], 10AC_DEFUN([gl_FUNC_ALLOCA],
10[ 11[
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 @@
1# arpa_inet_h.m4 1# arpa_inet_h.m4
2# serial 17 2# serial 18
3dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Simon Josefsson and Bruno Haible 9dnl Written by Simon Josefsson and Bruno Haible
9 10
@@ -68,8 +69,12 @@ AC_DEFUN([gl_ARPA_INET_H_REQUIRE_DEFAULTS],
68AC_DEFUN([gl_ARPA_INET_H_DEFAULTS], 69AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
69[ 70[
70 dnl Assume proper GNU behavior unless another module says otherwise. 71 dnl Assume proper GNU behavior unless another module says otherwise.
72 HAVE_DECL_HTONL=1; AC_SUBST([HAVE_DECL_HTONL])
73 HAVE_DECL_HTONS=1; AC_SUBST([HAVE_DECL_HTONS])
71 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP]) 74 HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
72 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON]) 75 HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
76 HAVE_DECL_NTOHL=1; AC_SUBST([HAVE_DECL_NTOHL])
77 HAVE_DECL_NTOHS=1; AC_SUBST([HAVE_DECL_NTOHS])
73 REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP]) 78 REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
74 REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON]) 79 REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
75]) 80])
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 @@
1# assert_h.m4 1# assert_h.m4
2# serial 1 2# serial 5
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
@@ -12,30 +13,31 @@ AC_DEFUN([gl_ASSERT_H],
12 AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], 13 AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert],
13 [gl_saved_CFLAGS=$CFLAGS 14 [gl_saved_CFLAGS=$CFLAGS
14 for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do 15 for gl_working in "yes, a keyword" "yes, an <assert.h> macro"; do
15 AS_CASE([$gl_working], 16 AS_CASE([$gl_working],
16 [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"]) 17 [*assert.h*], [CFLAGS="$gl_saved_CFLAGS -DINCLUDE_ASSERT_H"])
17 18 AC_COMPILE_IFELSE(
18 AC_COMPILE_IFELSE( 19 [AC_LANG_PROGRAM(
19 [AC_LANG_PROGRAM( 20 [[#if defined __clang__ && __STDC_VERSION__ < 202311
20 [[#if defined __clang__ && __STDC_VERSION__ < 202311 21 #pragma clang diagnostic error "-Wc2x-extensions"
21 #pragma clang diagnostic error "-Wc2x-extensions" 22 #pragma clang diagnostic error "-Wc++1z-extensions"
22 #pragma clang diagnostic error "-Wc++1z-extensions" 23 #endif
23 #endif 24 #ifdef INCLUDE_ASSERT_H
24 #ifdef INCLUDE_ASSERT_H 25 #include <assert.h>
25 #include <assert.h> 26 #endif
26 #endif 27 static_assert (2 + 2 == 4, "arithmetic does not work");
27 static_assert (2 + 2 == 4, "arithmetic does not work"); 28 static_assert (2 + 2 == 4);
28 static_assert (2 + 2 == 4); 29 ]],
29 ]], 30 [[
30 [[ 31 static_assert (sizeof (char) == 1, "sizeof does not work");
31 static_assert (sizeof (char) == 1, "sizeof does not work"); 32 static_assert (sizeof (char) == 1);
32 static_assert (sizeof (char) == 1); 33 ]])
33 ]])], 34 ],
34 [gl_cv_static_assert=$gl_working], 35 [gl_cv_static_assert=$gl_working],
35 [gl_cv_static_assert=no]) 36 [gl_cv_static_assert=no])
36 CFLAGS=$gl_saved_CFLAGS 37 CFLAGS=$gl_saved_CFLAGS
37 test "$gl_cv_static_assert" != no && break 38 test "$gl_cv_static_assert" != no && break
38 done]) 39 done
40 ])
39 41
40 GL_GENERATE_ASSERT_H=false 42 GL_GENERATE_ASSERT_H=false
41 AS_CASE([$gl_cv_static_assert], 43 AS_CASE([$gl_cv_static_assert],
@@ -48,6 +50,10 @@ AC_DEFUN([gl_ASSERT_H],
48 50
49 dnl The "zz" puts this toward config.h's end, to avoid potential 51 dnl The "zz" puts this toward config.h's end, to avoid potential
50 dnl collisions with other definitions. 52 dnl collisions with other definitions.
53 dnl Hardcode the known configuration results for GCC and clang, so that
54 dnl a configuration made with the C compiler works also with the C++ compiler
55 dnl and vice versa.
56 dnl The seemingly redundant parentheses are necessary for MSVC 14.
51 dnl #undef assert so that programs are not tempted to use it without 57 dnl #undef assert so that programs are not tempted to use it without
52 dnl specifically including assert.h. 58 dnl specifically including assert.h.
53 dnl #undef __ASSERT_H__ so that on IRIX, when programs later include 59 dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
@@ -55,7 +61,18 @@ AC_DEFUN([gl_ASSERT_H],
55 dnl Break the #undef_s apart with a comment so that 'configure' does 61 dnl Break the #undef_s apart with a comment so that 'configure' does
56 dnl not comment them out. 62 dnl not comment them out.
57 AH_VERBATIM([zzstatic_assert], 63 AH_VERBATIM([zzstatic_assert],
58[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ 64[#if (!(defined __clang__ \
65 ? (defined __cplusplus \
66 ? __cplusplus >= 201703L \
67 : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
68 && !defined __sun) \
69 : (defined __GNUC__ \
70 ? (defined __cplusplus \
71 ? __cplusplus >= 201103L && __GNUG__ >= 6 \
72 : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
73 && !defined __sun) \
74 : defined HAVE_C_STATIC_ASSERT)) \
75 && !defined assert \
59 && (!defined __cplusplus \ 76 && (!defined __cplusplus \
60 || (__cpp_static_assert < 201411 \ 77 || (__cpp_static_assert < 201411 \
61 && __GNUG__ < 6 && __clang_major__ < 6))) 78 && __GNUG__ < 6 && __clang_major__ < 6)))
@@ -65,8 +82,9 @@ AC_DEFUN([gl_ASSERT_H],
65 #undef/**/__ASSERT_H__ 82 #undef/**/__ASSERT_H__
66 #endif 83 #endif
67 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. 84 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
68 We need it also to be invocable with a single argument. */ 85 We need it also to be invocable with a single argument.
69 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus 86 Haiku 2022 <assert.h> does not define static_assert at all. */
87 #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
70 #undef/**/static_assert 88 #undef/**/static_assert
71 #define static_assert _Static_assert 89 #define static_assert _Static_assert
72 #endif 90 #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 @@
1# base64.m4 1# base64.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_BASE64], 9AC_DEFUN([gl_FUNC_BASE64],
9[ 10[
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 @@
1# btowc.m4 1# btowc.m4
2# serial 14 2# serial 15
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_BTOWC], 9AC_DEFUN([gl_FUNC_BTOWC],
9[ 10[
10 AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) 11 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
12 AC_REQUIRE([gt_TYPE_WINT_T])
11 13
12 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test 14 dnl Check whether <wchar.h> is usable at all, first. Otherwise the test
13 dnl program below may lead to an endless loop. See 15 dnl program below may lead to an endless loop. See
@@ -133,6 +135,13 @@ int main ()
133 ]) 135 ])
134 ]) 136 ])
135 137
138 if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
139 dnl On mingw/ucrt, we override the return type of btowc().
140 dnl While the original wint_t (= unsigned short) and the overridden wint_t
141 dnl (= unsigned int) are equivalent in function parameters, this is not
142 dnl the case for function return types.
143 REPLACE_BTOWC=1
144 fi
136 case "$gl_cv_func_btowc_nul" in 145 case "$gl_cv_func_btowc_nul" in
137 *yes) ;; 146 *yes) ;;
138 *) REPLACE_BTOWC=1 ;; 147 *) 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 @@
1# build-to-host.m4
2# serial 5
3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Bruno Haible.
10
11dnl When the build environment ($build_os) is different from the target runtime
12dnl environment ($host_os), file names may need to be converted from the build
13dnl environment syntax to the target runtime environment syntax. This is
14dnl because the Makefiles are executed (mostly) by build environment tools and
15dnl therefore expect file names in build environment syntax, whereas the runtime
16dnl expects file names in target runtime environment syntax.
17dnl
18dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need
19dnl be converted from Cygwin syntax to native Windows syntax:
20dnl /cygdrive/c/foo/bar -> C:\foo\bar
21dnl /usr/local/share -> C:\cygwin64\usr\local\share
22dnl
23dnl gl_BUILD_TO_HOST([somedir])
24dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must
25dnl already have its final value assigned, and produces two additional
26dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the
27dnl same file name value, just in different syntax:
28dnl - somedir_c is the file name in target runtime environment syntax,
29dnl as a C string (starting and ending with a double-quote,
30dnl and with escaped backslashes and double-quotes in
31dnl between).
32dnl - somedir_c_make is the same thing, escaped for use in a Makefile.
33
34AC_DEFUN([gl_BUILD_TO_HOST],
35[
36 AC_REQUIRE([AC_CANONICAL_BUILD])
37 AC_REQUIRE([AC_CANONICAL_HOST])
38 AC_REQUIRE([gl_BUILD_TO_HOST_INIT])
39
40 dnl Define somedir_c.
41 gl_final_[$1]="$[$1]"
42 dnl Translate it from build syntax to host syntax.
43 case "$build_os" in
44 cygwin*)
45 case "$host_os" in
46 mingw* | windows*)
47 gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;;
48 esac
49 ;;
50 esac
51 dnl Convert it to C string syntax.
52 [$1]_c=`printf '%s\n' "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes" | tr -d "$gl_tr_cr"`
53 [$1]_c='"'"$[$1]_c"'"'
54 AC_SUBST([$1_c])
55
56 dnl Define somedir_c_make.
57 [$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"`
58 dnl Use the substituted somedir variable, when possible, so that the user
59 dnl may adjust somedir a posteriori when there are no special characters.
60 if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then
61 [$1]_c_make='\"$([$1])\"'
62 fi
63 AC_SUBST([$1_c_make])
64])
65
66dnl Some initializations for gl_BUILD_TO_HOST.
67AC_DEFUN([gl_BUILD_TO_HOST_INIT],
68[
69 gl_sed_double_backslashes='s/\\/\\\\/g'
70 gl_sed_escape_doublequotes='s/"/\\"/g'
71changequote(,)dnl
72 gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g"
73changequote([,])dnl
74 gl_sed_escape_for_make_2='s,\$,\\$$,g'
75 dnl Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
76 dnl does not understand '\r'.
77 case `echo r | tr -d '\r'` in
78 '') gl_tr_cr='\015' ;;
79 *) gl_tr_cr='\r' ;;
80 esac
81])
82
83
84dnl The following macros are convenience invocations of gl_BUILD_TO_HOST
85dnl for some of the variables that are defined by Autoconf.
86dnl To do so for _all_ the possible variables, use the module 'configmake'.
87
88dnl Defines bindir_c and bindir_c_make.
89AC_DEFUN_ONCE([gl_BUILD_TO_HOST_BINDIR],
90[
91 dnl Find the final value of bindir.
92 gl_saved_prefix="${prefix}"
93 gl_saved_exec_prefix="${exec_prefix}"
94 gl_saved_bindir="${bindir}"
95 dnl Unfortunately, prefix and exec_prefix get only finally determined
96 dnl at the end of configure.
97 if test "X$prefix" = "XNONE"; then
98 prefix="$ac_default_prefix"
99 fi
100 if test "X$exec_prefix" = "XNONE"; then
101 exec_prefix='${prefix}'
102 fi
103 eval exec_prefix="$exec_prefix"
104 eval bindir="$bindir"
105 gl_BUILD_TO_HOST([bindir])
106 bindir="${gl_saved_bindir}"
107 exec_prefix="${gl_saved_exec_prefix}"
108 prefix="${gl_saved_prefix}"
109])
110
111dnl Defines datadir_c and datadir_c_make,
112dnl where datadir = $(datarootdir)
113AC_DEFUN_ONCE([gl_BUILD_TO_HOST_DATADIR],
114[
115 dnl Find the final value of datadir.
116 gl_saved_prefix="${prefix}"
117 gl_saved_datarootdir="${datarootdir}"
118 gl_saved_datadir="${datadir}"
119 dnl Unfortunately, prefix gets only finally determined at the end of
120 dnl configure.
121 if test "X$prefix" = "XNONE"; then
122 prefix="$ac_default_prefix"
123 fi
124 eval datarootdir="$datarootdir"
125 eval datadir="$datadir"
126 gl_BUILD_TO_HOST([datadir])
127 datadir="${gl_saved_datadir}"
128 datarootdir="${gl_saved_datarootdir}"
129 prefix="${gl_saved_prefix}"
130])
131
132dnl Defines libdir_c and libdir_c_make.
133AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBDIR],
134[
135 dnl Find the final value of libdir.
136 gl_saved_prefix="${prefix}"
137 gl_saved_exec_prefix="${exec_prefix}"
138 gl_saved_libdir="${libdir}"
139 dnl Unfortunately, prefix and exec_prefix get only finally determined
140 dnl at the end of configure.
141 if test "X$prefix" = "XNONE"; then
142 prefix="$ac_default_prefix"
143 fi
144 if test "X$exec_prefix" = "XNONE"; then
145 exec_prefix='${prefix}'
146 fi
147 eval exec_prefix="$exec_prefix"
148 eval libdir="$libdir"
149 gl_BUILD_TO_HOST([libdir])
150 libdir="${gl_saved_libdir}"
151 exec_prefix="${gl_saved_exec_prefix}"
152 prefix="${gl_saved_prefix}"
153])
154
155dnl Defines libexecdir_c and libexecdir_c_make.
156AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LIBEXECDIR],
157[
158 dnl Find the final value of libexecdir.
159 gl_saved_prefix="${prefix}"
160 gl_saved_exec_prefix="${exec_prefix}"
161 gl_saved_libexecdir="${libexecdir}"
162 dnl Unfortunately, prefix and exec_prefix get only finally determined
163 dnl at the end of configure.
164 if test "X$prefix" = "XNONE"; then
165 prefix="$ac_default_prefix"
166 fi
167 if test "X$exec_prefix" = "XNONE"; then
168 exec_prefix='${prefix}'
169 fi
170 eval exec_prefix="$exec_prefix"
171 eval libexecdir="$libexecdir"
172 gl_BUILD_TO_HOST([libexecdir])
173 libexecdir="${gl_saved_libexecdir}"
174 exec_prefix="${gl_saved_exec_prefix}"
175 prefix="${gl_saved_prefix}"
176])
177
178dnl Defines localedir_c and localedir_c_make.
179AC_DEFUN_ONCE([gl_BUILD_TO_HOST_LOCALEDIR],
180[
181 dnl Find the final value of localedir.
182 gl_saved_prefix="${prefix}"
183 gl_saved_datarootdir="${datarootdir}"
184 gl_saved_localedir="${localedir}"
185 dnl Unfortunately, prefix gets only finally determined at the end of
186 dnl configure.
187 if test "X$prefix" = "XNONE"; then
188 prefix="$ac_default_prefix"
189 fi
190 eval datarootdir="$datarootdir"
191 eval localedir="$localedir"
192 gl_BUILD_TO_HOST([localedir])
193 localedir="${gl_saved_localedir}"
194 datarootdir="${gl_saved_datarootdir}"
195 prefix="${gl_saved_prefix}"
196])
197
198dnl Defines pkgdatadir_c and pkgdatadir_c_make,
199dnl where pkgdatadir = $(datadir)/$(PACKAGE)
200AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGDATADIR],
201[
202 dnl Find the final value of pkgdatadir.
203 gl_saved_prefix="${prefix}"
204 gl_saved_datarootdir="${datarootdir}"
205 gl_saved_datadir="${datadir}"
206 gl_saved_pkgdatadir="${pkgdatadir}"
207 dnl Unfortunately, prefix gets only finally determined at the end of
208 dnl configure.
209 if test "X$prefix" = "XNONE"; then
210 prefix="$ac_default_prefix"
211 fi
212 eval datarootdir="$datarootdir"
213 eval datadir="$datadir"
214 eval pkgdatadir="$pkgdatadir"
215 gl_BUILD_TO_HOST([pkgdatadir])
216 pkgdatadir="${gl_saved_pkgdatadir}"
217 datadir="${gl_saved_datadir}"
218 datarootdir="${gl_saved_datarootdir}"
219 prefix="${gl_saved_prefix}"
220])
221
222dnl Defines pkglibdir_c and pkglibdir_c_make,
223dnl where pkglibdir = $(libdir)/$(PACKAGE)
224AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBDIR],
225[
226 dnl Find the final value of pkglibdir.
227 gl_saved_prefix="${prefix}"
228 gl_saved_exec_prefix="${exec_prefix}"
229 gl_saved_libdir="${libdir}"
230 gl_saved_pkglibdir="${pkglibdir}"
231 dnl Unfortunately, prefix and exec_prefix get only finally determined
232 dnl at the end of configure.
233 if test "X$prefix" = "XNONE"; then
234 prefix="$ac_default_prefix"
235 fi
236 if test "X$exec_prefix" = "XNONE"; then
237 exec_prefix='${prefix}'
238 fi
239 eval exec_prefix="$exec_prefix"
240 eval libdir="$libdir"
241 eval pkglibdir="$pkglibdir"
242 gl_BUILD_TO_HOST([pkglibdir])
243 pkglibdir="${gl_saved_pkglibdir}"
244 libdir="${gl_saved_libdir}"
245 exec_prefix="${gl_saved_exec_prefix}"
246 prefix="${gl_saved_prefix}"
247])
248
249dnl Defines pkglibexecdir_c and pkglibexecdir_c_make,
250dnl where pkglibexecdir = $(libexecdir)/$(PACKAGE)
251AC_DEFUN_ONCE([gl_BUILD_TO_HOST_PKGLIBEXECDIR],
252[
253 dnl Find the final value of pkglibexecdir.
254 gl_saved_prefix="${prefix}"
255 gl_saved_exec_prefix="${exec_prefix}"
256 gl_saved_libexecdir="${libexecdir}"
257 gl_saved_pkglibexecdir="${pkglibexecdir}"
258 dnl Unfortunately, prefix and exec_prefix get only finally determined
259 dnl at the end of configure.
260 if test "X$prefix" = "XNONE"; then
261 prefix="$ac_default_prefix"
262 fi
263 if test "X$exec_prefix" = "XNONE"; then
264 exec_prefix='${prefix}'
265 fi
266 eval exec_prefix="$exec_prefix"
267 eval libexecdir="$libexecdir"
268 eval pkglibexecdir="$pkglibexecdir"
269 gl_BUILD_TO_HOST([pkglibexecdir])
270 pkglibexecdir="${gl_saved_pkglibexecdir}"
271 libexecdir="${gl_saved_libexecdir}"
272 exec_prefix="${gl_saved_exec_prefix}"
273 prefix="${gl_saved_prefix}"
274])
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 @@
1# builtin-expect.m4 1# builtin-expect.m4
2# serial 1 2# serial 3
3dnl Copyright 2016-2024 Free Software Foundation, Inc. 3dnl Copyright 2016-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check for __builtin_expect. 9dnl Provide a GCC-compatible __builtin_expect macro in <config.h>.
9 10
10dnl Written by Paul Eggert. 11dnl Written by Paul Eggert.
11 12
@@ -47,5 +48,4 @@ AC_DEFUN([gl___BUILTIN_EXPECT],
47#elif HAVE___BUILTIN_EXPECT == 2 48#elif HAVE___BUILTIN_EXPECT == 2
48# include <builtins.h> 49# include <builtins.h>
49#endif 50#endif
50 ]) 51])])
51])
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 @@
1# byteswap.m4 1# byteswap.m4
2# serial 5 2# serial 7
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Oskar Liljeblad. 9dnl Written by Oskar Liljeblad.
9 10
10AC_DEFUN([gl_BYTESWAP], 11AC_DEFUN([gl_BYTESWAP],
11[ 12[
12 dnl Prerequisites of lib/byteswap.in.h. 13 dnl Prerequisites of lib/byteswap.in.h.
13 AC_CHECK_HEADERS([byteswap.h], [ 14 AC_CHECK_HEADERS_ONCE([byteswap.h])
15 if test $ac_cv_header_byteswap_h = yes; then
16 AC_CACHE_CHECK([for working bswap_16, bswap_32, bswap_64],
17 [gl_cv_header_working_byteswap_h],
18 [gl_cv_header_working_byteswap_h=no
19 dnl Check that floating point arguments work.
20 dnl This also checks C libraries with implementations like
21 dnl '#define bswap_16(x) (((x) >> 8 & 0xff) | (((x) & 0xff) << 8))'
22 dnl that mistakenly evaluate their arguments multiple times.
23 AC_COMPILE_IFELSE(
24 [AC_LANG_PROGRAM(
25 [[#include <byteswap.h>
26 ]],
27 [[int value_16 = bswap_16 (0.0);
28 int value_32 = bswap_32 (0.0);
29 int value_64 = bswap_64 (0.0);
30 return !(value_16 + value_32 + value_64);
31 ]])
32 ],
33 [gl_cv_header_working_byteswap_h=yes],
34 [gl_cv_header_working_byteswap_h=no])
35 ])
36 fi
37 if test "$gl_cv_header_working_byteswap_h" = yes; then
14 GL_GENERATE_BYTESWAP_H=false 38 GL_GENERATE_BYTESWAP_H=false
15 ], [ 39 else
16 GL_GENERATE_BYTESWAP_H=true 40 GL_GENERATE_BYTESWAP_H=true
17 ]) 41 fi
18]) 42])
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 @@
1# c-bool.m4 1# c-bool.m4
2# serial 1 2# serial 3
3dnl Copyright 2022-2024 Free Software Foundation, Inc. 3dnl Copyright 2022-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for bool that conforms to C2023. 9# Check for bool that conforms to C2023.
9 10
@@ -29,12 +30,23 @@ AC_DEFUN([gl_C_BOOL],
29 dnl The "zz" puts this toward config.h's end, to avoid potential 30 dnl The "zz" puts this toward config.h's end, to avoid potential
30 dnl collisions with other definitions. 31 dnl collisions with other definitions.
31 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. 32 dnl If 'bool', 'true' and 'false' do not work, arrange for them to work.
32 dnl In C, this means including <stdbool.h> if it is not already included. 33 dnl Hardcode the known configuration results for GCC and clang, so that
34 dnl a configuration made with the C compiler works also with the C++ compiler
35 dnl and vice versa.
36 dnl The seemingly redundant parentheses are necessary for MSVC 14.
37 dnl "Arrange for them to work", in C, means including <stdbool.h> if it is
38 dnl not already included.
33 dnl However, if the preprocessor mistakenly treats 'true' as 0, 39 dnl However, if the preprocessor mistakenly treats 'true' as 0,
34 dnl define it to a bool expression equal to 1; this is needed in 40 dnl define it to a bool expression equal to 1; this is needed in
35 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. 41 dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older.
36 AH_VERBATIM([zzbool], 42 AH_VERBATIM([zzbool],
37[#ifndef HAVE_C_BOOL 43[#if !(defined __cplusplus \
44 ? 1 \
45 : (defined __clang__ \
46 ? __STDC_VERSION__ >= 202000L && __clang_major__ >= 15 \
47 : (defined __GNUC__ \
48 ? __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
49 : defined HAVE_C_BOOL)))
38# if !defined __cplusplus && !defined __bool_true_false_are_defined 50# if !defined __cplusplus && !defined __bool_true_false_are_defined
39# if HAVE_STDBOOL_H 51# if HAVE_STDBOOL_H
40# include <stdbool.h> 52# include <stdbool.h>
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 @@
1# c32rtomb.m4
2# serial 8
3dnl Copyright (C) 2020-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_C32RTOMB],
10[
11 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13
14 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
15 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
16
17 AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
18 if test $gl_cv_func_c32rtomb = no; then
19 HAVE_C32RTOMB=0
20 else
21 dnl When we override mbrtoc32, redefining the meaning of the char32_t
22 dnl values, we need to override c32rtomb as well, for consistency.
23 if test $HAVE_WORKING_MBRTOC32 = 0; then
24 REPLACE_C32RTOMB=1
25 fi
26 AC_CACHE_CHECK([whether c32rtomb return value is correct],
27 [gl_cv_func_c32rtomb_retval],
28 [
29 dnl Initial guess, used when cross-compiling.
30changequote(,)dnl
31 case "$host_os" in
32 # Guess no on AIX.
33 aix*) gl_cv_func_c32rtomb_retval="guessing no" ;;
34 # Guess yes otherwise.
35 *) gl_cv_func_c32rtomb_retval="guessing yes" ;;
36 esac
37changequote([,])dnl
38 AC_RUN_IFELSE(
39 [AC_LANG_SOURCE([[
40#include <stddef.h>
41#ifdef __HAIKU__
42 #include <stdint.h>
43#endif
44#include <uchar.h>
45int main ()
46{
47 int result = 0;
48 if (c32rtomb (NULL, 0, NULL) != 1)
49 result |= 1;
50 return result;
51}]])],
52 [gl_cv_func_c32rtomb_retval=yes],
53 [gl_cv_func_c32rtomb_retval=no],
54 [:])
55 ])
56 case "$gl_cv_func_c32rtomb_retval" in
57 *yes) ;;
58 *) AC_DEFINE([C32RTOMB_RETVAL_BUG], [1],
59 [Define if the c32rtomb function has an incorrect return value.])
60 REPLACE_C32RTOMB=1 ;;
61 esac
62 if test $HAVE_WORKING_C32RTOMB = 0; then
63 REPLACE_C32RTOMB=1
64 fi
65 fi
66])
67
68AC_DEFUN([gl_CHECK_FUNC_C32RTOMB],
69[
70 dnl Cf. gl_CHECK_FUNCS_ANDROID
71 AC_CHECK_DECL([c32rtomb], , ,
72 [[#ifdef __HAIKU__
73 #include <stdint.h>
74 #endif
75 #include <uchar.h>
76 ]])
77 if test $ac_cv_have_decl_c32rtomb = yes; then
78 dnl We can't use AC_CHECK_FUNC here, because c32rtomb() is defined as a
79 dnl static inline function on Haiku 2020.
80 AC_CACHE_CHECK([for c32rtomb], [gl_cv_func_c32rtomb],
81 [AC_LINK_IFELSE(
82 [AC_LANG_PROGRAM(
83 [[#include <stdlib.h>
84 #ifdef __HAIKU__
85 #include <stdint.h>
86 #endif
87 #include <uchar.h>
88 ]],
89 [[char buf[8];
90 return c32rtomb (buf, 0, NULL) == 0;
91 ]])
92 ],
93 [gl_cv_func_c32rtomb=yes],
94 [gl_cv_func_c32rtomb=no])
95 ])
96 else
97 gl_cv_func_c32rtomb=no
98 fi
99])
100
101dnl Test whether c32rtomb works not worse than wcrtomb.
102dnl Result is HAVE_WORKING_C32RTOMB.
103
104AC_DEFUN([gl_C32RTOMB_SANITYCHECK],
105[
106 AC_REQUIRE([AC_PROG_CC])
107 AC_REQUIRE([gl_TYPE_CHAR32_T])
108 AC_REQUIRE([gl_CHECK_FUNC_C32RTOMB])
109 AC_REQUIRE([gt_LOCALE_ZH_CN])
110 AC_REQUIRE([AC_CANONICAL_HOST])
111 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_c32rtomb = no; then
112 HAVE_WORKING_C32RTOMB=0
113 else
114 AC_CACHE_CHECK([whether c32rtomb works as well as wcrtomb],
115 [gl_cv_func_c32rtomb_sanitycheck],
116 [
117 dnl Initial guess, used when cross-compiling or when no suitable locale
118 dnl is present.
119changequote(,)dnl
120 case "$host_os" in
121 # Guess no on Solaris derivatives.
122 solaris*)
123 if test -f /etc/release && grep 'Oracle Solaris' /etc/release >/dev/null; then
124 gl_cv_func_c32rtomb_sanitycheck="guessing yes"
125 else
126 gl_cv_func_c32rtomb_sanitycheck="guessing no"
127 fi
128 ;;
129 # Guess yes otherwise.
130 *)
131 gl_cv_func_c32rtomb_sanitycheck="guessing yes"
132 ;;
133 esac
134changequote([,])dnl
135 if test $LOCALE_ZH_CN != none; then
136 AC_RUN_IFELSE(
137 [AC_LANG_SOURCE([[
138#include <locale.h>
139#include <stdlib.h>
140#include <string.h>
141#include <wchar.h>
142#ifdef __HAIKU__
143 #include <stdint.h>
144#endif
145#include <uchar.h>
146int main ()
147{
148 int result = 0;
149 /* This fails on Solaris 11 OmniOS:
150 c32rtomb returns (size_t)-1.
151 wcrtomb returns 4 (correct). */
152 if (strcmp ("$LOCALE_ZH_CN", "none") != 0
153 && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
154 {
155 mbstate_t state;
156 wchar_t wc = (wchar_t) 0xBADFACE;
157 char buf[16];
158 memset (&state, '\0', sizeof (mbstate_t));
159 if (mbrtowc (&wc, "\201\060\211\070", 4, &state) == 4
160 && wcrtomb (buf, wc, NULL) == 4
161 && memcmp (buf, "\201\060\211\070", 4) == 0)
162 {
163 char32_t c32 = (wchar_t) 0xBADFACE;
164 memset (&state, '\0', sizeof (mbstate_t));
165 if (mbrtoc32 (&c32, "\201\060\211\070", 4, &state) == 4
166 && c32rtomb (buf, c32, NULL) != 4)
167 result |= 1;
168 }
169 }
170 return result;
171}]])],
172 [gl_cv_func_c32rtomb_sanitycheck=yes],
173 [gl_cv_func_c32rtomb_sanitycheck=no],
174 [:])
175 fi
176 ])
177 case "$gl_cv_func_c32rtomb_sanitycheck" in
178 *yes)
179 HAVE_WORKING_C32RTOMB=1
180 AC_DEFINE([HAVE_WORKING_C32RTOMB], [1],
181 [Define if the c32rtomb function basically works.])
182 ;;
183 *) HAVE_WORKING_C32RTOMB=0 ;;
184 esac
185 fi
186 AC_SUBST([HAVE_WORKING_C32RTOMB])
187])
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 @@
1# calloc.m4 1# calloc.m4
2# serial 31 2# serial 36
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Written by Jim Meyering. 9# Written by Jim Meyering.
9 10
@@ -12,42 +13,35 @@ dnl with or without modifications, as long as this notice is preserved.
12# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc 13# If so, define HAVE_CALLOC. Otherwise, define calloc to rpl_calloc
13# and arrange to use a calloc wrapper function that does work in that case. 14# and arrange to use a calloc wrapper function that does work in that case.
14 15
15# _AC_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT]) 16# gl_FUNC_CALLOC_IF([IF-WORKS], [IF-NOT])
16# ------------------------------------- 17# ---------------------------------------
17# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT. 18# If calloc is compatible with GNU calloc, run IF-WORKS, otherwise, IF-NOT.
18AC_DEFUN([_AC_FUNC_CALLOC_IF], 19AC_DEFUN([gl_FUNC_CALLOC_IF],
19[ 20[
20 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 21 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
21 AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull], 22 AC_CACHE_CHECK([whether calloc (0, n) and calloc (n, 0) return nonnull],
22 [ac_cv_func_calloc_0_nonnull], 23 [gl_cv_func_calloc_0_nonnull],
23 [if test $cross_compiling != yes; then 24 [AC_RUN_IFELSE(
24 ac_cv_func_calloc_0_nonnull=yes 25 [AC_LANG_PROGRAM(
25 AC_RUN_IFELSE( 26 [[#include <stdlib.h>
26 [AC_LANG_PROGRAM( 27 /* Use pcalloc to test; "volatile" prevents the compiler
27 [AC_INCLUDES_DEFAULT], 28 from optimizing the calloc call away. */
28 [[int result = 0; 29 void *(*volatile pcalloc) (size_t, size_t) = calloc;]],
29 char * volatile p = calloc (0, 0); 30 [[void *p = pcalloc (0, 0);
30 if (!p) 31 int result = !p;
31 result |= 1; 32 free (p);
32 free (p); 33 return result;]])],
33 return result; 34 [gl_cv_func_calloc_0_nonnull=yes],
34 ]])], 35 [gl_cv_func_calloc_0_nonnull=no],
35 [], 36 [AS_CASE([$host_os],
36 [ac_cv_func_calloc_0_nonnull=no]) 37 [# Guess yes on platforms where we know the result.
37 else 38 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
38 case "$host_os" in 39 | gnu* | *-musl* | midipix* | midnightbsd* \
39 # Guess yes on glibc systems. 40 | hpux* | solaris* | cygwin* | mingw* | windows* | msys*],
40 *-gnu* | gnu*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; 41 [gl_cv_func_calloc_0_nonnull="guessing yes"],
41 # Guess yes on musl systems. 42 [# If we don't know, obey --enable-cross-guesses.
42 *-musl* | midipix*) ac_cv_func_calloc_0_nonnull="guessing yes" ;; 43 gl_cv_func_calloc_0_nonnull="$gl_cross_guess_normal"])])])
43 # Guess yes on native Windows. 44 AS_CASE([$gl_cv_func_calloc_0_nonnull], [*yes], [$1], [$2])
44 mingw* | windows*) ac_cv_func_calloc_0_nonnull="guessing yes" ;;
45 # If we don't know, obey --enable-cross-guesses.
46 *) ac_cv_func_calloc_0_nonnull="$gl_cross_guess_normal" ;;
47 esac
48 fi
49 ])
50 AS_CASE([$ac_cv_func_calloc_0_nonnull], [*yes], [$1], [$2])
51]) 45])
52 46
53 47
@@ -58,9 +52,14 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
58[ 52[
59 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 53 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
60 AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) 54 AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
55
56 dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
57 dnl gets defined already before this macro gets invoked. This helps
58 dnl if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
59
61 REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" 60 REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
62 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then 61 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
63 _AC_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1]) 62 gl_FUNC_CALLOC_IF([], [REPLACE_CALLOC_FOR_CALLOC_GNU=1])
64 fi 63 fi
65])# gl_FUNC_CALLOC_GNU 64])# gl_FUNC_CALLOC_GNU
66 65
@@ -73,9 +72,7 @@ AC_DEFUN([gl_FUNC_CALLOC_POSIX],
73[ 72[
74 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 73 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
75 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 74 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
76 if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then 75 REPLACE_CALLOC_FOR_CALLOC_POSIX=$REPLACE_MALLOC_FOR_MALLOC_POSIX
77 REPLACE_CALLOC_FOR_CALLOC_POSIX=1
78 fi
79 dnl Although in theory we should also test for size_t overflow, 76 dnl Although in theory we should also test for size_t overflow,
80 dnl in practice testing for ptrdiff_t overflow suffices 77 dnl in practice testing for ptrdiff_t overflow suffices
81 dnl since PTRDIFF_MAX <= SIZE_MAX on all known Gnulib porting targets. 78 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 @@
1# close.m4 1# close.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_CLOSE], 9AC_DEFUN_ONCE([gl_FUNC_CLOSE],
9[ 10[
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 @@
1# codeset.m4 1# codeset.m4
2# serial 5 (gettext-0.18.2) 2# serial 5 (gettext-0.18.2)
3dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2024 Free Software 3dnl Copyright (C) 2000-2002, 2006, 2008-2014, 2016, 2019-2025 Free Software
4dnl Foundation, Inc. 4dnl Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Bruno Haible. 10dnl From Bruno Haible.
10 11
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 @@
1# double-slash-root.m4 1# double-slash-root.m4
2# serial 4 -*- Autoconf -*- 2# serial 4 -*- Autoconf -*-
3dnl Copyright (C) 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_DOUBLE_SLASH_ROOT], 9AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
9[ 10[
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 @@
1# dup2.m4 1# dup2.m4
2# serial 28 2# serial 28
3dnl Copyright (C) 2002, 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2005, 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_DUP2], 9AC_DEFUN([gl_FUNC_DUP2],
9[ 10[
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 @@
1# eealloc.m4
2# serial 3
3dnl Copyright (C) 2003, 2009-2024 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8AC_DEFUN([gl_EEALLOC],
9[
10 AC_REQUIRE([gl_EEMALLOC])
11 AC_REQUIRE([gl_EEREALLOC])
12])
13
14AC_DEFUN([gl_EEMALLOC],
15[
16 _AC_FUNC_MALLOC_IF(
17 [gl_cv_func_malloc_0_nonnull=1],
18 [gl_cv_func_malloc_0_nonnull=0])
19 AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull],
20 [If malloc(0) is != NULL, define this to 1. Otherwise define this
21 to 0.])
22])
23
24AC_DEFUN([gl_EEREALLOC],
25[
26 _AC_FUNC_REALLOC_IF(
27 [gl_cv_func_realloc_0_nonnull=1],
28 [gl_cv_func_realloc_0_nonnull=0])
29 AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull],
30 [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this
31 to 0.])
32])
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 @@
1# environ.m4 1# environ.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_ENVIRON], 9AC_DEFUN_ONCE([gl_ENVIRON],
9[ 10[
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 @@
1# errno_h.m4 1# errno_h.m4
2# serial 14 2# serial 18
3dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.61]) 9AC_PREREQ([2.61])
9 10
10AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], 11AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
11[ 12[
12 AC_REQUIRE([AC_PROG_CC]) 13 AC_REQUIRE([AC_PROG_CC])
14
15 dnl Through the dependency on module extensions-aix, _LINUX_SOURCE_COMPAT
16 dnl gets defined already before this macro gets invoked. This persuades
17 dnl AIX 7.3 errno.h to assign ENOTEMPTY a value different than EEXIST.
18
13 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ 19 AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
14 AC_EGREP_CPP([booboo],[ 20 AC_EGREP_CPP([booboo],[
15#include <errno.h> 21#include <errno.h>
@@ -64,6 +70,9 @@ booboo
64#if !defined EILSEQ 70#if !defined EILSEQ
65booboo 71booboo
66#endif 72#endif
73#if !defined ESOCKTNOSUPPORT
74booboo
75#endif
67 ], 76 ],
68 [gl_cv_header_errno_h_complete=no], 77 [gl_cv_header_errno_h_complete=no],
69 [gl_cv_header_errno_h_complete=yes]) 78 [gl_cv_header_errno_h_complete=yes])
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 @@
1# error.m4 1# error.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 1996-1998, 2001-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-1998, 2001-2004, 2009-2025 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8AC_DEFUN([gl_ERROR], 10AC_DEFUN([gl_ERROR],
9[ 11[
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 @@
1# error_h.m4 1# error_h.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 1996-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Provide a working <error.h>. 10dnl Provide a working <error.h>.
@@ -111,12 +112,15 @@ AC_DEFUN_ONCE([gl_ERROR_H],
111 esac 112 esac
112 fi 113 fi
113 114
114 if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \ 115 m4_ifdef([gl_HAVE_MODULE_VERROR],
115 || test $HAVE_ERROR_AT_LINE = 0 || test $REPLACE_ERROR_AT_LINE = 1; then 116 [COMPILE_ERROR_C=1],
116 COMPILE_ERROR_C=1 117 [if test $HAVE_ERROR = 0 || test $REPLACE_ERROR = 1 \
117 else 118 || test $HAVE_ERROR_AT_LINE = 0 \
118 COMPILE_ERROR_C=0 119 || test $REPLACE_ERROR_AT_LINE = 1; then
119 fi 120 COMPILE_ERROR_C=1
121 else
122 COMPILE_ERROR_C=0
123 fi])
120 124
121 AC_SUBST([HAVE_ERROR]) 125 AC_SUBST([HAVE_ERROR])
122 AC_SUBST([HAVE_ERROR_AT_LINE]) 126 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 @@
1# exponentd.m4 1# exponentd.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 2007-2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION], 8AC_DEFUN_ONCE([gl_DOUBLE_EXPONENT_LOCATION],
8[ 9[
9 AC_CACHE_CHECK([where to find the exponent in a 'double'], 10 AC_CACHE_CHECK([where to find the exponent in a 'double'],
@@ -84,7 +85,7 @@ int main ()
84 dnl The newer VFP instructions assume little-endian order 85 dnl The newer VFP instructions assume little-endian order
85 dnl consistently. 86 dnl consistently.
86 AC_EGREP_CPP([mixed_endianness], [ 87 AC_EGREP_CPP([mixed_endianness], [
87#if defined arm || defined __arm || defined __arm__ 88#if defined __arm__
88 mixed_endianness 89 mixed_endianness
89#endif 90#endif
90 ], 91 ],
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 @@
1# extensions-aix.m4
2# serial 1
3dnl Copyright (C) 2024-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9# On AIX, most extensions are already enabled through the _ALL_SOURCE macro,
10# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally
11# activates more GNU and Linux-like behaviours, affecting
12# - the time_t type,
13# - errno values in <errno.h>: ENOTEMPTY
14# - functions in <stdlib.h>: malloc calloc realloc valloc
15# <https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine>
16# - functions in <string.h>: strerror_r (returns 'char *', like glibc)
17# - functions in <dirent.h>: scandir, alphasort, readdir_r
18# - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r
19# - declarations in <unistd.h>: sbrk
20# and a couple of secondary <sys/*> header files.
21
22AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS],
23[
24 AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
25 [Define so that AIX headers are more compatible with GNU/Linux.])
26])
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 @@
1# extensions.m4 1# extensions.m4
2# serial 25 -*- Autoconf -*- 2# serial 25 -*- Autoconf -*-
3dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Enable extensions on systems that normally disable them. 9# Enable extensions on systems that normally disable them.
9 10
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 @@
1# extern-inline.m4 1# extern-inline.m4
2# serial 1 2# serial 1
3dnl Copyright 2012-2024 Free Software Foundation, Inc. 3dnl Copyright 2012-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl 'extern inline' a la ISO C99. 9dnl 'extern inline' a la ISO C99.
9 10
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 @@
1# fclose.m4 1# fclose.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_FCLOSE], 9AC_DEFUN_ONCE([gl_FUNC_FCLOSE],
9[ 10[
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 @@
1# fcntl-o.m4 1# fcntl-o.m4
2# serial 8 2# serial 12
3dnl Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Paul Eggert. 9dnl Written by Paul Eggert.
9 10
10AC_PREREQ([2.60]) 11AC_PREREQ([2.60])
11 12
12# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. 13# Test whether the flags O_DIRECTORY, O_NOATIME and O_NOFOLLOW actually work.
14# Define HAVE_WORKING_O_DIRECTORY to 1 if O_DIRECTORY works, or to 0 otherwise.
13# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. 15# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
14# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. 16# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
15AC_DEFUN([gl_FCNTL_O_FLAGS], 17AC_DEFUN([gl_FCNTL_O_FLAGS],
@@ -30,16 +32,23 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
30 #else /* on Windows with MSVC */ 32 #else /* on Windows with MSVC */
31 # include <io.h> 33 # include <io.h>
32 # include <stdlib.h> 34 # include <stdlib.h>
33 # defined sleep(n) _sleep ((n) * 1000) 35 # define sleep(n) _sleep ((n) * 1000)
34 #endif 36 #endif
37 #include <errno.h>
35 #include <fcntl.h> 38 #include <fcntl.h>
36 ]GL_MDA_DEFINES[ 39 ]GL_MDA_DEFINES[
40 #ifndef O_DIRECTORY
41 #define O_DIRECTORY 0
42 #endif
37 #ifndef O_NOATIME 43 #ifndef O_NOATIME
38 #define O_NOATIME 0 44 #define O_NOATIME 0
39 #endif 45 #endif
40 #ifndef O_NOFOLLOW 46 #ifndef O_NOFOLLOW
41 #define O_NOFOLLOW 0 47 #define O_NOFOLLOW 0
42 #endif 48 #endif
49 #ifndef O_SEARCH
50 #define O_SEARCH O_RDONLY
51 #endif
43 static int const constants[] = 52 static int const constants[] =
44 { 53 {
45 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, 54 O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
@@ -52,31 +61,38 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
52 { 61 {
53 static char const sym[] = "conftest.sym"; 62 static char const sym[] = "conftest.sym";
54 if (symlink ("/dev/null", sym) != 0) 63 if (symlink ("/dev/null", sym) != 0)
55 result |= 2; 64 result |= 1;
56 else 65 else
57 { 66 {
58 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); 67 int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0);
59 if (fd >= 0) 68 if (fd >= 0)
60 { 69 {
61 close (fd); 70 close (fd);
62 result |= 4; 71 result |= 3;
63 } 72 }
64 } 73 }
65 if (unlink (sym) != 0 || symlink (".", sym) != 0) 74 if (unlink (sym) != 0 || symlink (".", sym) != 0)
66 result |= 2; 75 result |= 1;
67 else 76 else
68 { 77 {
69 int fd = open (sym, O_RDONLY | O_NOFOLLOW); 78 int fd = open (sym, O_RDONLY | O_NOFOLLOW);
70 if (fd >= 0) 79 if (fd >= 0)
71 { 80 {
72 close (fd); 81 close (fd);
73 result |= 4; 82 result |= 3;
74 } 83 }
75 } 84 }
76 unlink (sym); 85 unlink (sym);
77 } 86 }
78 #endif 87 #endif
79 { 88 {
89 int fd = open ("confdefs.h", O_SEARCH | O_DIRECTORY);
90 if (!(fd < 0 && errno == ENOTDIR))
91 result |= 4;
92 if (0 <= fd)
93 close (fd);
94 }
95 {
80 static char const file[] = "confdefs.h"; 96 static char const file[] = "confdefs.h";
81 int fd = open (file, O_RDONLY | O_NOATIME); 97 int fd = open (file, O_RDONLY | O_NOATIME);
82 if (fd < 0) 98 if (fd < 0)
@@ -111,31 +127,46 @@ AC_DEFUN([gl_FCNTL_O_FLAGS],
111 } 127 }
112 return result;]])], 128 return result;]])],
113 [gl_cv_header_working_fcntl_h=yes], 129 [gl_cv_header_working_fcntl_h=yes],
114 [case $? in #( 130 [AS_CASE([$?],
115 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( 131 dnl We cannot catch exit code 1 or 2 here, because
116 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( 132 dnl - exit code 1 can occur through a compilation error on mingw (e.g.
117 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( 133 dnl when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
118 *) gl_cv_header_working_fcntl_h='no';; 134 dnl result = 1, whereas
119 esac], 135 dnl - exit code 2 can occur through a compilation error on MSVC (e.g.
120 [case "$host_os" in 136 dnl again when O_NOCTTY, O_NONBLOCK, O_SYNC are not defined) or when
121 # Guess 'no' on native Windows. 137 dnl result = 2.
122 mingw* | windows*) gl_cv_header_working_fcntl_h='no' ;; 138 [ 3], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW)"],
123 *) gl_cv_header_working_fcntl_h=cross-compiling ;; 139 [ 4], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY)"],
124 esac 140 [ 7], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY)"],
125 ]) 141 [64], [gl_cv_header_working_fcntl_h="no (bad O_NOATIME)"],
126 ]) 142 [67], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_NOATIME)"],
143 [68], [gl_cv_header_working_fcntl_h="no (bad O_DIRECTORY, O_NOATIME)"],
144 [71], [gl_cv_header_working_fcntl_h="no (bad O_NOFOLLOW, O_DIRECTORY, O_NOATIME)"],
145 [gl_cv_header_working_fcntl_h="no"])],
146 [AS_CASE([$host_os,$gl_cross_guess_normal],
147 # The O_DIRECTORY test is known to fail on Mac OS X 10.4.11 (2007)
148 # (see <https://bugs.gnu.org/78509#95>)
149 # and to succeed on Mac OS X 10.5.8 [darwin9.8.0] (2009).
150 # Guess it fails on Mac OS X 10.4.x and earlier.
151 [darwin[[0-8]].*yes],
152 [gl_cv_header_working_fcntl_h="guessing no (bad O_DIRECTORY)"],
153 # Known to be "no" on native MS-Windows.
154 [mingw* | windows*],
155 [gl_cv_header_working_fcntl_h=no],
156 [gl_cv_header_working_fcntl_h=$gl_cross_guess_normal])])])
157
158 AS_CASE([$gl_cv_header_working_fcntl_h],
159 [*O_DIRECTORY* | *no], [gl_val=0], [gl_val=1])
160 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_DIRECTORY], [$gl_val],
161 [Define to 1 if O_DIRECTORY works, 0 otherwise.])
127 162
128 case $gl_cv_header_working_fcntl_h in #( 163 AS_CASE([$gl_cv_header_working_fcntl_h],
129 *O_NOATIME* | no | cross-compiling) ac_val=0;; #( 164 [*O_NOATIME* | *no], [gl_val=0], [gl_val=1])
130 *) ac_val=1;; 165 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$gl_val],
131 esac 166 [Define to 1 if O_NOATIME works, 0 otherwise.])
132 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
133 [Define to 1 if O_NOATIME works.])
134 167
135 case $gl_cv_header_working_fcntl_h in #( 168 AS_CASE([$gl_cv_header_working_fcntl_h],
136 *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( 169 [*O_NOFOLLOW* | *no], [gl_val=0], [gl_val=1])
137 *) ac_val=1;; 170 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$gl_val],
138 esac 171 [Define to 1 if O_NOFOLLOW works, 0 otherwise.])
139 AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
140 [Define to 1 if O_NOFOLLOW works.])
141]) 172])
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 @@
1# fcntl.m4 1# fcntl.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# For now, this module ensures that fcntl() 9# For now, this module ensures that fcntl()
9# - supports F_DUPFD correctly 10# - 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 @@
1# fcntl_h.m4 1# fcntl_h.m4
2# serial 20 2# serial 20
3dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure fcntl.h. 9# Configure fcntl.h.
9 10
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 @@
1# fflush.m4 1# fflush.m4
2# serial 19 2# serial 20
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Eric Blake 9dnl From Eric Blake
9 10
@@ -79,8 +80,9 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
79 [gl_cv_func_fflush_stdin=yes], 80 [gl_cv_func_fflush_stdin=yes],
80 [gl_cv_func_fflush_stdin=no], 81 [gl_cv_func_fflush_stdin=no],
81 [case "$host_os" in 82 [case "$host_os" in
82 # Guess no on native Windows. 83 # Guess no on NetBSD, OpenBSD, native Windows.
83 mingw* | windows*) gl_cv_func_fflush_stdin="guessing no" ;; 84 netbsd* | openbsd* | mingw* | windows*)
85 gl_cv_func_fflush_stdin="guessing no" ;;
84 *) gl_cv_func_fflush_stdin=cross ;; 86 *) gl_cv_func_fflush_stdin=cross ;;
85 esac 87 esac
86 ]) 88 ])
@@ -92,8 +94,8 @@ AC_DEFUN([gl_FUNC_FFLUSH_STDIN],
92 *) gl_func_fflush_stdin='(-1)' ;; 94 *) gl_func_fflush_stdin='(-1)' ;;
93 esac 95 esac
94 AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin], 96 AC_DEFINE_UNQUOTED([FUNC_FFLUSH_STDIN], [$gl_func_fflush_stdin],
95 [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008, 97 [Define to 1 if fflush is known to work on stdin as per POSIX.1-2008
96 0 if fflush is known to not work, -1 if unknown.]) 98 or later, 0 if fflush is known to not work, -1 if unknown.])
97]) 99])
98 100
99# Prerequisites of lib/fflush.c. 101# 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 @@
1# float_h.m4 1# float_h.m4
2# serial 14 2# serial 15
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FLOAT_H], 9AC_DEFUN([gl_FLOAT_H],
9[ 10[
@@ -54,6 +55,31 @@ changequote([,])dnl
54 ;; 55 ;;
55 esac 56 esac
56 57
58 dnl Test for completeness w.r.t. ISO C 23.
59 REPLACE_FLOAT_SNAN=0
60 AC_CACHE_CHECK([whether float.h conforms to ISO C23],
61 [gl_cv_header_float_h_isoc23],
62 [AC_COMPILE_IFELSE(
63 [AC_LANG_PROGRAM(
64 [[#include <float.h>
65 int x[] = { FLT_DECIMAL_DIG, DBL_DECIMAL_DIG, LDBL_DECIMAL_DIG };
66 float maxf = FLT_NORM_MAX;
67 double maxd = DBL_NORM_MAX;
68 long double maxl = LDBL_NORM_MAX;
69 ]],
70 [[float sf = FLT_SNAN;
71 double sd = DBL_SNAN;
72 long double sl = LDBL_SNAN;
73 return (sf != 0) + (sd != 0) + (sl != 0);
74 ]])],
75 [gl_cv_header_float_h_isoc23=yes],
76 [gl_cv_header_float_h_isoc23=no])
77 ])
78 if test $gl_cv_header_float_h_isoc23 != yes; then
79 GL_GENERATE_FLOAT_H=true
80 REPLACE_FLOAT_SNAN=1
81 fi
82
57 dnl Test against glibc-2.7 Linux/SPARC64 bug. 83 dnl Test against glibc-2.7 Linux/SPARC64 bug.
58 REPLACE_ITOLD=0 84 REPLACE_ITOLD=0
59 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], 85 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 @@
1# floorf.m4 1# floorf.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FLOORF], 9AC_DEFUN([gl_FUNC_FLOORF],
9[ 10[
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 @@
1# fopen.m4 1# fopen.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FOPEN_ITSELF], 9AC_DEFUN([gl_FUNC_FOPEN_ITSELF],
9[ 10[
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 @@
1# fpurge.m4 1# fpurge.m4
2# serial 14 2# serial 16
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FPURGE], 9AC_DEFUN([gl_FUNC_FPURGE],
9[ 10[
10 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) 11 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
12 AC_CHECK_HEADERS_ONCE([stdio_ext.h]) 12 AC_CHECK_HEADERS_ONCE([stdio_ext.h])
13 AC_CHECK_FUNCS_ONCE([fpurge]) 13 AC_CHECK_FUNCS_ONCE([fpurge])
14 gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]]) 14 gl_CHECK_FUNCS_ANDROID([__fpurge], [[#include <stdio_ext.h>]])
15 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]]) 15 AC_CHECK_DECLS([fpurge], , , [[#include <stdio.h>]])
16 if test "x$ac_cv_func_fpurge" = xyes; then 16 if test $ac_cv_func_fpurge = yes; then
17 HAVE_FPURGE=1 17 HAVE_FPURGE=1
18 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune. 18 # Detect BSD bug. Only cygwin 1.7 and musl are known to be immune.
19 AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works], 19 AC_CACHE_CHECK([whether fpurge works], [gl_cv_func_fpurge_works],
20 [AC_RUN_IFELSE( 20 [if test $ac_cv_have_decl_fpurge = yes; then
21 [AC_LANG_PROGRAM( 21 AC_RUN_IFELSE(
22 [[#include <stdio.h> 22 [AC_LANG_PROGRAM(
23]], 23 [[#include <stdio.h>
24 [[FILE *f = fopen ("conftest.txt", "w+"); 24 ]],
25 if (!f) 25 [[FILE *f = fopen ("conftest.txt", "w+");
26 return 1; 26 if (!f)
27 if (fputc ('a', f) != 'a') 27 return 1;
28 { fclose (f); return 2; } 28 if (fputc ('a', f) != 'a')
29 rewind (f); 29 { fclose (f); return 2; }
30 if (fgetc (f) != 'a') 30 rewind (f);
31 { fclose (f); return 3; } 31 if (fgetc (f) != 'a')
32 if (fgetc (f) != EOF) 32 { fclose (f); return 3; }
33 { fclose (f); return 4; } 33 if (fgetc (f) != EOF)
34 if (fpurge (f) != 0) 34 { fclose (f); return 4; }
35 { fclose (f); return 5; } 35 if (fpurge (f) != 0)
36 if (putc ('b', f) != 'b') 36 { fclose (f); return 5; }
37 { fclose (f); return 6; } 37 if (putc ('b', f) != 'b')
38 if (fclose (f) != 0) 38 { fclose (f); return 6; }
39 return 7; 39 if (fclose (f) != 0)
40 if ((f = fopen ("conftest.txt", "r")) == NULL) 40 return 7;
41 return 8; 41 if ((f = fopen ("conftest.txt", "r")) == NULL)
42 if (fgetc (f) != 'a') 42 return 8;
43 { fclose (f); return 9; } 43 if (fgetc (f) != 'a')
44 if (fgetc (f) != 'b') 44 { fclose (f); return 9; }
45 { fclose (f); return 10; } 45 if (fgetc (f) != 'b')
46 if (fgetc (f) != EOF) 46 { fclose (f); return 10; }
47 { fclose (f); return 11; } 47 if (fgetc (f) != EOF)
48 if (fclose (f) != 0) 48 { fclose (f); return 11; }
49 return 12; 49 if (fclose (f) != 0)
50 if (remove ("conftest.txt") != 0) 50 return 12;
51 return 13; 51 if (remove ("conftest.txt") != 0)
52 return 0; 52 return 13;
53 ]])], 53 return 0;
54 [gl_cv_func_fpurge_works=yes], 54 ]])],
55 [gl_cv_func_fpurge_works=no], 55 [gl_cv_func_fpurge_works=yes],
56 [case "$host_os" in 56 [gl_cv_func_fpurge_works=no],
57 # Guess yes on musl systems. 57 [# Obey --enable-cross-guesses.
58 *-musl* | midipix*) gl_cv_func_fpurge_works="guessing yes" ;; 58 gl_cv_func_fpurge_works="$gl_cross_guess_normal"
59 # Otherwise obey --enable-cross-guesses. 59 ])
60 *) gl_cv_func_fpurge_works="$gl_cross_guess_normal" ;; 60 else
61 esac 61 gl_cv_func_fpurge_works=no
62 ]) 62 fi
63 ]) 63 ])
64 case "$gl_cv_func_fpurge_works" in 64 case "$gl_cv_func_fpurge_works" in
65 *yes) ;; 65 *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 @@
1# freading.m4 1# freading.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FREADING], 9AC_DEFUN([gl_FUNC_FREADING],
9[ 10[
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 @@
1# free.m4 1# free.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2003-2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003-2005, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Written by Paul Eggert and Bruno Haible. 9# Written by Paul Eggert and Bruno Haible.
9 10
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 @@
1# fseek.m4 1# fseek.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSEEK], 9AC_DEFUN([gl_FUNC_FSEEK],
9[ 10[
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 @@
1# fseeko.m4 1# fseeko.m4
2# serial 20 2# serial 21
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSEEKO], 9AC_DEFUN([gl_FUNC_FSEEKO],
9[ 10[
@@ -69,6 +70,10 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
69# Prerequisites of lib/fseeko.c. 70# Prerequisites of lib/fseeko.c.
70AC_DEFUN([gl_PREREQ_FSEEKO], 71AC_DEFUN([gl_PREREQ_FSEEKO],
71[ 72[
73 if test $gl_cv_func_fseeko != no; then
74 AC_DEFINE([HAVE_FSEEKO], [1],
75 [Define to 1 if the system has the fseeko function.])
76 fi
72 dnl Native Windows has the function _fseeki64. mingw hides it in some 77 dnl Native Windows has the function _fseeki64. mingw hides it in some
73 dnl circumstances, but mingw64 makes it usable again. 78 dnl circumstances, but mingw64 makes it usable again.
74 AC_CHECK_FUNCS([_fseeki64]) 79 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 @@
1# fseterr.m4
2# serial 2
3dnl Copyright (C) 2012-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_FSETERR],
10[
11 gl_CHECK_FUNCS_ANDROID([__fseterr],
12 [[#include <stdio.h>
13 #include <stdio_ext.h>
14 ]])
15])
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 @@
1# fstat.m4 1# fstat.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FSTAT], 9AC_DEFUN([gl_FUNC_FSTAT],
9[ 10[
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 @@
1# fstypename.m4 1# fstypename.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2024 Free Software 3dnl Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2025 Free Software
4dnl Foundation, Inc. 4dnl Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Jim Meyering. 10dnl From Jim Meyering.
10dnl 11dnl
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 @@
1# fsusage.m4 1# fsusage.m4
2# serial 35 2# serial 35
3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2025 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Obtaining file system usage information. 10# Obtaining file system usage information.
9 11
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 @@
1# ftell.m4 1# ftell.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FTELL], 9AC_DEFUN([gl_FUNC_FTELL],
9[ 10[
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 @@
1# ftello.m4 1# ftello.m4
2# serial 16 2# serial 17
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_FTELLO], 9AC_DEFUN([gl_FUNC_FTELLO],
9[ 10[
@@ -157,6 +158,10 @@ main (void)
157# Prerequisites of lib/ftello.c. 158# Prerequisites of lib/ftello.c.
158AC_DEFUN([gl_PREREQ_FTELLO], 159AC_DEFUN([gl_PREREQ_FTELLO],
159[ 160[
161 if test $gl_cv_func_ftello != no; then
162 AC_DEFINE([HAVE_FTELLO], [1],
163 [Define to 1 if the system has the ftello function.])
164 fi
160 dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64 165 dnl Native Windows has the function _ftelli64. mingw hides it, but mingw64
161 dnl makes it usable again. 166 dnl makes it usable again.
162 AC_CHECK_FUNCS([_ftelli64]) 167 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 @@
1# getaddrinfo.m4 1# getaddrinfo.m4
2# serial 35 2# serial 38
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_GETADDRINFO], 9AC_DEFUN([gl_GETADDRINFO],
9[ 10[
10 AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H 11 AC_REQUIRE([gl_SYS_SOCKET_H])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
11 AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H 12 AC_REQUIRE([gl_NETDB_H])dnl for HAVE_NETDB_H
13 AC_REQUIRE([AC_CANONICAL_HOST])
12 GETADDRINFO_LIB= 14 GETADDRINFO_LIB=
13 gai_saved_LIBS="$LIBS" 15 gai_saved_LIBS="$LIBS"
14 16
@@ -87,6 +89,46 @@ int getaddrinfo (const char *, const char *, const struct addrinfo *, struct add
87 HAVE_GETADDRINFO=0 89 HAVE_GETADDRINFO=0
88 fi 90 fi
89 fi 91 fi
92 if test $HAVE_GETADDRINFO != 0; then
93 AC_CACHE_CHECK([whether getaddrinfo supports AI_NUMERICSERV],
94 [gl_cv_func_getaddrinfo_works],
95 [AC_RUN_IFELSE(
96 [AC_LANG_PROGRAM([[
97#include <sys/types.h>
98#ifdef HAVE_SYS_SOCKET_H
99#include <sys/socket.h>
100#endif
101#ifdef HAVE_NETDB_H
102#include <netdb.h>
103#endif
104#ifdef HAVE_WS2TCPIP_H
105#include <ws2tcpip.h>
106#endif
107#include <stddef.h>
108#include <string.h>
109 ]], [[
110 struct addrinfo hints;
111 struct addrinfo *ai;
112 memset (&hints, 0, sizeof (hints));
113 hints.ai_flags = AI_NUMERICSERV;
114 return getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME;
115 ]])
116 ],
117 [gl_cv_func_getaddrinfo_works=yes],
118 [gl_cv_func_getaddrinfo_works=no],
119 [case "$host_os" in
120 # Guess no on native Windows.
121 mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;;
122 # Guess yes otherwise.
123 *) gl_cv_func_getaddrinfo_works="guessing yes" ;;
124 esac
125 ])
126 ])
127 case "$gl_cv_func_getaddrinfo_works" in
128 *yes) ;;
129 *) REPLACE_GETADDRINFO=1 ;;
130 esac
131 fi
90 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], 132 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO],
91 [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) 133 [Define to 1 if getaddrinfo exists, or to 0 otherwise.])
92 134
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 @@
1# getdelim.m4 1# getdelim.m4
2# serial 19 2# serial 19
3 3
4dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 4dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc.
5dnl 5dnl
6dnl This file is free software; the Free Software Foundation 6dnl This file is free software; the Free Software Foundation
7dnl gives unlimited permission to copy and/or distribute it, 7dnl gives unlimited permission to copy and/or distribute it,
8dnl with or without modifications, as long as this notice is preserved. 8dnl with or without modifications, as long as this notice is preserved.
9dnl This file is offered as-is, without any warranty.
9 10
10AC_PREREQ([2.59]) 11AC_PREREQ([2.59])
11 12
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 @@
1# getdtablesize.m4 1# getdtablesize.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_GETDTABLESIZE], 9AC_DEFUN([gl_FUNC_GETDTABLESIZE],
9[ 10[
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 @@
1# gethostname.m4 1# gethostname.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2002, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Ensure 9# Ensure
9# - the gethostname() function, 10# - 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 @@
1# getline.m4 1# getline.m4
2# serial 33 2# serial 33
3 3
4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, 4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2025 Free Software Foundation,
5dnl Inc. 5dnl Inc.
6dnl 6dnl
7dnl This file is free software; the Free Software Foundation 7dnl This file is free software; the Free Software Foundation
8dnl gives unlimited permission to copy and/or distribute it, 8dnl gives unlimited permission to copy and/or distribute it,
9dnl with or without modifications, as long as this notice is preserved. 9dnl with or without modifications, as long as this notice is preserved.
10dnl This file is offered as-is, without any warranty.
10 11
11AC_PREREQ([2.59]) 12AC_PREREQ([2.59])
12 13
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 @@
1# getloadavg.m4 1# getloadavg.m4
2# serial 13 2# serial 13
3dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2024 Free Software 3dnl Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2025 Free
4dnl Foundation, Inc. 4dnl Software Foundation, Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9# Check for getloadavg. 10# Check for getloadavg.
10 11
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 @@
1# getopt.m4 1# getopt.m4
2# serial 49 2# serial 50
3dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Request a POSIX compliant getopt function. 9# Request a POSIX compliant getopt function.
9AC_DEFUN([gl_FUNC_GETOPT_POSIX], 10AC_DEFUN([gl_FUNC_GETOPT_POSIX],
@@ -77,7 +78,7 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
77 fi 78 fi
78 79
79 dnl POSIX 2008 does not specify leading '+' behavior, but see 80 dnl POSIX 2008 does not specify leading '+' behavior, but see
80 dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on 81 dnl https://austingroupbugs.net/view.php?id=191 for a recommendation on
81 dnl the next version of POSIX. For now, we only guarantee leading '+' 82 dnl the next version of POSIX. For now, we only guarantee leading '+'
82 dnl behavior with getopt-gnu. 83 dnl behavior with getopt-gnu.
83 if test -z "$gl_replace_getopt"; then 84 if test -z "$gl_replace_getopt"; then
@@ -366,14 +367,7 @@ dnl is ambiguous with environment values that contain newlines.
366 367
367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 368AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
368[ 369[
369 AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) 370 gl_CHECK_HEADER_SYS_CDEFS_H
370 if test $ac_cv_header_sys_cdefs_h = yes; then
371 HAVE_SYS_CDEFS_H=1
372 else
373 HAVE_SYS_CDEFS_H=0
374 fi
375 AC_SUBST([HAVE_SYS_CDEFS_H])
376
377 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], 371 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
378 [Define to rpl_ if the getopt replacement functions and variables 372 [Define to rpl_ if the getopt replacement functions and variables
379 should be used.]) 373 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 @@
1# getprogname.m4 1# getprogname.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2016-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for getprogname or replacements for it 9# Check for getprogname or replacements for it
9 10
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 @@
1# gl-openssl.m4 1# gl-openssl.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2013-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT], 9AC_DEFUN([gl_SET_CRYPTO_CHECK_DEFAULT],
9[ 10[
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 @@
1# Copyright (C) 2002-2024 Free Software Foundation, Inc. 1# Copyright (C) 2002-2025 Free Software Foundation, Inc.
2# 2#
3# This file is free software; you can redistribute it and/or modify 3# This file is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by 4# 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 @@
1# gnulib-common.m4 1# gnulib-common.m4
2# serial 93 2# serial 113
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.62]) 9AC_PREREQ([2.62])
9 10
@@ -20,43 +21,61 @@ AC_DEFUN([gl_COMMON_BODY], [
20[/* Witness that <config.h> has been included. */ 21[/* Witness that <config.h> has been included. */
21#define _GL_CONFIG_H_INCLUDED 1 22#define _GL_CONFIG_H_INCLUDED 1
22]) 23])
24 dnl Avoid warnings from gcc -Wtrailing-whitespace.
25 dnl This is a temporary workaround until Autoconf fixes it.
26 dnl Test case:
27 dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
28 dnl should produce "#define FOO /**/", not "#define FOO ".
29 AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
30# pragma GCC diagnostic push
31# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
32#endif
33])
34 AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
35# pragma GCC diagnostic pop
36#endif
37])
23 AH_VERBATIM([_GL_GNUC_PREREQ], 38 AH_VERBATIM([_GL_GNUC_PREREQ],
24[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ 39[/* True if the compiler says it groks GNU C version MAJOR.MINOR.
25#if defined __GNUC__ && defined __GNUC_MINOR__ 40 Except that
41 - clang groks GNU C 4.2, even on Windows, where it does not define
42 __GNUC__.
43 - The OpenMandriva-modified clang compiler pretends that it groks
44 GNU C version 13.1, but it doesn't: It does not support
45 __attribute__ ((__malloc__ (f, i))), nor does it support
46 __attribute__ ((__warning__ (message))) on a function redeclaration.
47 - Users can make clang lie as well, through the -fgnuc-version option. */
48#if defined __GNUC__ && defined __GNUC_MINOR__ && !defined __clang__
26# define _GL_GNUC_PREREQ(major, minor) \ 49# define _GL_GNUC_PREREQ(major, minor) \
27 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) 50 ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__))
51#elif defined __clang__
52 /* clang really only groks GNU C 4.2. */
53# define _GL_GNUC_PREREQ(major, minor) \
54 ((major) < 4 + ((minor) <= 2))
28#else 55#else
29# define _GL_GNUC_PREREQ(major, minor) 0 56# define _GL_GNUC_PREREQ(major, minor) 0
30#endif 57#endif
31]) 58])
32 AH_VERBATIM([_Noreturn], 59 AH_VERBATIM([_Noreturn],
33[/* The _Noreturn keyword of C11. */ 60[/* The _Noreturn keyword of C11.
61 Do not use [[noreturn]], because with it the syntax
62 extern _Noreturn void func (...);
63 would not be valid; such a declaration would be valid only with 'extern'
64 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
65 AIX system header files and several gnulib header files use precisely
66 this syntax with 'extern'. So even though C23 deprecates _Noreturn,
67 it is currently more portable to prefer it to [[noreturn]].
68
69 Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
70 This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
71 though the workaround may generate many false-alarm warnings. */
34#ifndef _Noreturn 72#ifndef _Noreturn
35# if (defined __cplusplus \ 73# if ((!defined __cplusplus || defined __clang__) \
36 && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ 74 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)))
37 || (defined _MSC_VER && 1900 <= _MSC_VER)) \
38 && 0)
39 /* [[noreturn]] is not practically usable, because with it the syntax
40 extern _Noreturn void func (...);
41 would not be valid; such a declaration would only be valid with 'extern'
42 and '_Noreturn' swapped, or without the 'extern' keyword. However, some
43 AIX system header files and several gnulib header files use precisely
44 this syntax with 'extern'. */
45# define _Noreturn [[noreturn]]
46# elif (defined __clang__ && __clang_major__ < 16 \
47 && defined _GL_WORK_AROUND_LLVM_BUG_59792)
48 /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
49 that rare LLVM bug, though you may get many false-alarm warnings. */
50# define _Noreturn
51# elif ((!defined __cplusplus || defined __clang__) \
52 && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
53 || (!defined __STRICT_ANSI__ \
54 && (_GL_GNUC_PREREQ (4, 7) \
55 || (defined __apple_build_version__ \
56 ? 6000000 <= __apple_build_version__ \
57 : 3 < __clang_major__ + (5 <= __clang_minor__))))))
58 /* _Noreturn works as-is. */ 75 /* _Noreturn works as-is. */
59# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C 76# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
77 /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
78 latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
60# define _Noreturn __attribute__ ((__noreturn__)) 79# define _Noreturn __attribute__ ((__noreturn__))
61# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) 80# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
62# define _Noreturn __declspec (noreturn) 81# define _Noreturn __declspec (noreturn)
@@ -90,6 +109,9 @@ AC_DEFUN([gl_COMMON_BODY], [
90# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) 109# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
91# else 110# else
92# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr 111# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
112/* The following lines list the first GCC version that supports the attribute.
113 Although the lines are not used in GCC 5 and later (as GCC 5 introduced
114 __has_attribute support), list GCC versions 5+ anyway for completeness. */
93# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) 115# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3)
94# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) 116# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2)
95# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) 117# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3)
@@ -110,12 +132,15 @@ AC_DEFUN([gl_COMMON_BODY], [
110# endif 132# endif
111# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) 133# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1)
112# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) 134# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3)
135# define _GL_ATTR_nonnull_if_nonzero _GL_GNUC_PREREQ (15, 1)
113# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) 136# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0)
114# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) 137# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3)
115# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) 138# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7)
116# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) 139# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96)
140# define _GL_ATTR_reproducible _GL_GNUC_PREREQ (15, 1)
117# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) 141# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9)
118# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) 142# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0)
143# define _GL_ATTR_unsequenced _GL_GNUC_PREREQ (15, 1)
119# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) 144# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7)
120# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) 145# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
121# endif 146# endif
@@ -131,6 +156,23 @@ AC_DEFUN([gl_COMMON_BODY], [
131# define _GL_HAVE___HAS_C_ATTRIBUTE 0 156# define _GL_HAVE___HAS_C_ATTRIBUTE 0
132#endif 157#endif
133 158
159/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
160 syntax, in function declarations. There are two problems here.
161 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
162
163 1) We want that the _GL_ATTRIBUTE_* can be cumulated on the same declaration
164 in any order.
165 =========================== foo.c = foo.cc ===========================
166 __attribute__ ((__deprecated__)) [[__nodiscard__]] int bar1 (int);
167 [[__nodiscard__]] __attribute__ ((__deprecated__)) int bar2 (int);
168 ======================================================================
169 This gives a syntax error
170 - in C mode with gcc
171 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108796>, and
172 - in C++ mode with clang++ version < 16, and
173 - in C++ mode, inside extern "C" {}, still in newer clang++ versions
174 <https://github.com/llvm/llvm-project/issues/101990>.
175 */
134/* Define if, in a function declaration, the attributes in bracket syntax 176/* Define if, in a function declaration, the attributes in bracket syntax
135 [[...]] must come before the attributes in __attribute__((...)) syntax. 177 [[...]] must come before the attributes in __attribute__((...)) syntax.
136 If this is defined, it is best to avoid the bracket syntax, so that the 178 If this is defined, it is best to avoid the bracket syntax, so that the
@@ -145,6 +187,176 @@ AC_DEFUN([gl_COMMON_BODY], [
145# define _GL_BRACKET_BEFORE_ATTRIBUTE 1 187# define _GL_BRACKET_BEFORE_ATTRIBUTE 1
146# endif 188# endif
147#endif 189#endif
190/*
191 2) We want that the _GL_ATTRIBUTE_* can be placed in a declaration
192 - without 'extern', in C as well as in C++,
193 - with 'extern', in C,
194 - with 'extern "C"', in C++
195 in the same position. That is, we don't want to be forced to use a
196 macro which arranges for the attribute to come before 'extern' in
197 one case and after 'extern' in the other case, because such a macro
198 would make the source code of .h files pretty ugly.
199 =========================== foo.c = foo.cc ===========================
200 #ifdef __cplusplus
201 # define CC "C"
202 #else
203 # define CC
204 #endif
205
206 #define ND [[__nodiscard__]]
207 #define WUR __attribute__((__warn_unused_result__))
208
209 #ifdef __cplusplus
210 extern "C" {
211 #endif
212 // gcc clang g++ clang++
213
214 ND int foo (int);
215 int ND foo (int); // warn error warn error
216 int foo ND (int);
217 int foo (int) ND; // warn error warn error
218
219 WUR int foo (int);
220 int WUR foo (int);
221 int fo1 WUR (int); // error error error error
222 int foo (int) WUR;
223
224 #ifdef __cplusplus
225 }
226 #endif
227
228 // gcc clang g++ clang++
229
230 ND extern CC int foo (int); // error error
231 extern CC ND int foo (int); // error error
232 extern CC int ND foo (int); // warn error warn error
233 extern CC int foo ND (int);
234 extern CC int foo (int) ND; // warn error warn error
235
236 WUR extern CC int foo (int); // warn
237 extern CC WUR int foo (int);
238 extern CC int WUR foo (int);
239 extern CC int foo WUR (int); // error error error error
240 extern CC int foo (int) WUR;
241
242 ND EXTERN_C_FUNC int foo (int); // error error
243 EXTERN_C_FUNC ND int foo (int);
244 EXTERN_C_FUNC int ND foo (int); // warn error warn error
245 EXTERN_C_FUNC int foo ND (int);
246 EXTERN_C_FUNC int foo (int) ND; // warn error warn error
247
248 WUR EXTERN_C_FUNC int foo (int); // warn
249 EXTERN_C_FUNC WUR int foo (int);
250 EXTERN_C_FUNC int WUR foo (int);
251 EXTERN_C_FUNC int fo2 WUR (int); // error error error error
252 EXTERN_C_FUNC int foo (int) WUR;
253 ======================================================================
254 So, if we insist on using the 'extern' keyword ('extern CC' idiom):
255 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
256 in both C and C++, there is one available position:
257 - between the function name and the parameter list.
258 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
259 in both C and C++, there are several available positions:
260 - before the return type,
261 - between return type and function name,
262 - at the end of the declaration.
263 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
264 __attribute__((...)) syntax in C++, there is no available position:
265 it would need to come before 'extern' in C but after 'extern "C"'
266 in C++.
267 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
268 to bracket syntax [[...]] in C++, there is one available position:
269 - before the return type.
270 Whereas, if we use the 'EXTERN_C_FUNC' idiom, which conditionally
271 omits the 'extern' keyword:
272 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]]
273 in both C and C++, there are two available positions:
274 - before the return type,
275 - between the function name and the parameter list.
276 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax
277 in both C and C++, there are several available positions:
278 - before the return type,
279 - between return type and function name,
280 - at the end of the declaration.
281 * If _GL_ATTRIBUTE_* expands to bracket syntax [[...]] in C and to
282 __attribute__((...)) syntax in C++, there is one available position:
283 - before the return type.
284 * If _GL_ATTRIBUTE_* expands to __attribute__((...)) syntax in C and
285 to bracket syntax [[...]] in C++, there is one available position:
286 - before the return type.
287 The best choice is therefore to use the 'EXTERN_C_FUNC' idiom and
288 put the attributes before the return type. This works regardless
289 to what the _GL_ATTRIBUTE_* macros expand.
290 */
291
292/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
293 syntax, in static/inline function definitions.
294
295 There are similar constraints as for function declarations. However, here,
296 we cannot omit the storage-class specifier. Therefore, the following rule
297 applies:
298 * The macros
299 _GL_ATTRIBUTE_CONST
300 _GL_ATTRIBUTE_DEPRECATED
301 _GL_ATTRIBUTE_MAYBE_UNUSED
302 _GL_ATTRIBUTE_NODISCARD
303 _GL_ATTRIBUTE_PURE
304 _GL_ATTRIBUTE_REPRODUCIBLE
305 _GL_ATTRIBUTE_UNSEQUENCED
306 which may expand to bracket syntax [[...]], must come first, before the
307 storage-class specifier.
308 * Other _GL_ATTRIBUTE_* macros, that expand to __attribute__((...)) syntax,
309 are better placed between the storage-class specifier and the return
310 type.
311 */
312
313/* Attributes in bracket syntax [[...]] vs. attributes in __attribute__((...))
314 syntax, in variable declarations.
315
316 At which position can they be placed?
317 (Last tested with gcc/g++ 14 and clang/clang++ 18.)
318
319 =========================== foo.c = foo.cc ===========================
320 #ifdef __cplusplus
321 # define CC "C"
322 #else
323 # define CC
324 #endif
325
326 #define BD [[__deprecated__]]
327 #define AD __attribute__ ((__deprecated__))
328
329 // gcc clang g++ clang++
330
331 BD extern CC int var; // error error
332 extern CC BD int var; // error error
333 extern CC int BD var; // warn error warn error
334 extern CC int var BD;
335
336 AD extern CC int var; // warn
337 extern CC AD int var;
338 extern CC int AD var;
339 extern CC int var AD;
340
341 BD extern CC int z[]; // error error
342 extern CC BD int z[]; // error error
343 extern CC int BD z[]; // warn error warn error
344 extern CC int z1 BD [];
345 extern CC int z[] BD; // warn error error
346
347 AD extern CC int z[]; // warn
348 extern CC AD int z[];
349 extern CC int AD z[];
350 extern CC int z2 AD []; // error error error error
351 extern CC int z[] AD;
352 ======================================================================
353
354 * For non-array variables, the only good position is after the variable name,
355 that is, at the end of the declaration.
356 * For array variables, you will need to distinguish C and C++:
357 - In C, before the 'extern' keyword.
358 - In C++, between the 'extern "C"' and the variable's type.
359 */
148]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. 360]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
149[ 361[
150/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function 362/* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function
@@ -152,7 +364,7 @@ AC_DEFUN([gl_COMMON_BODY], [
152 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied 364 _GL_ATTRIBUTE_ALLOC_SIZE ((M, N)) declares that the Mth argument multiplied
153 by the Nth argument of the function is the size of the returned memory block. 365 by the Nth argument of the function is the size of the returned memory block.
154 */ 366 */
155/* Applies to: function, pointer to function, function types. */ 367/* Applies to: functions, pointer to functions, function types. */
156#ifndef _GL_ATTRIBUTE_ALLOC_SIZE 368#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
157# if _GL_HAS_ATTRIBUTE (alloc_size) 369# if _GL_HAS_ATTRIBUTE (alloc_size)
158# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) 370# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
@@ -163,7 +375,7 @@ AC_DEFUN([gl_COMMON_BODY], [
163 375
164/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the 376/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
165 function and report an error if it cannot do so. */ 377 function and report an error if it cannot do so. */
166/* Applies to: function. */ 378/* Applies to: functions. */
167#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE 379#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
168# if _GL_HAS_ATTRIBUTE (always_inline) 380# if _GL_HAS_ATTRIBUTE (always_inline)
169# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) 381# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
@@ -175,7 +387,7 @@ AC_DEFUN([gl_COMMON_BODY], [
175/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show 387/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
176 in stack traces when debugging. The compiler should omit the function from 388 in stack traces when debugging. The compiler should omit the function from
177 stack traces. */ 389 stack traces. */
178/* Applies to: function. */ 390/* Applies to: functions. */
179#ifndef _GL_ATTRIBUTE_ARTIFICIAL 391#ifndef _GL_ATTRIBUTE_ARTIFICIAL
180# if _GL_HAS_ATTRIBUTE (artificial) 392# if _GL_HAS_ATTRIBUTE (artificial)
181# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) 393# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
@@ -201,18 +413,23 @@ AC_DEFUN([gl_COMMON_BODY], [
201# endif 413# endif
202#endif 414#endif
203 415
204/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate 416/* _GL_ATTRIBUTE_CONST declares:
205 calls to the function with the same arguments. 417 It is OK for a compiler to move calls to the function and to omit
206 This attribute is safe for a function that neither depends on nor affects 418 calls to the function if another call has the same arguments or the
207 observable state, and always returns exactly once - e.g., does not loop 419 result is not used.
208 forever, and does not call longjmp. 420 This attribute is safe for a function that neither depends on
209 (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ 421 nor affects state, and always returns exactly once -
422 e.g., does not raise an exception, call longjmp, or loop forever.
423 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
424 function cannot observe state. It is stricter than
425 _GL_ATTRIBUTE_UNSEQUENCED because the function must return exactly
426 once and cannot depend on state addressed by its arguments.) */
210/* Applies to: functions. */ 427/* Applies to: functions. */
211#ifndef _GL_ATTRIBUTE_CONST 428#ifndef _GL_ATTRIBUTE_CONST
212# if _GL_HAS_ATTRIBUTE (const) 429# if _GL_HAS_ATTRIBUTE (const)
213# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) 430# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
214# else 431# else
215# define _GL_ATTRIBUTE_CONST 432# define _GL_ATTRIBUTE_CONST _GL_ATTRIBUTE_UNSEQUENCED
216# endif 433# endif
217#endif 434#endif
218 435
@@ -460,6 +677,17 @@ AC_DEFUN([gl_COMMON_BODY], [
460# endif 677# endif
461#endif 678#endif
462 679
680/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
681 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
682/* Applies to: functions. */
683#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
684# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero)
685# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
686# else
687# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
688# endif
689#endif
690
463/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is 691/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
464 not meant to be NUL-terminated. */ 692 not meant to be NUL-terminated. */
465/* Applies to: struct/union members and variables that are arrays of element 693/* Applies to: struct/union members and variables that are arrays of element
@@ -481,7 +709,7 @@ AC_DEFUN([gl_COMMON_BODY], [
481 other attributes. */ 709 other attributes. */
482#ifndef _GL_ATTRIBUTE_NOTHROW 710#ifndef _GL_ATTRIBUTE_NOTHROW
483# if defined __cplusplus 711# if defined __cplusplus
484# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 712# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
485# if __cplusplus >= 201103L 713# if __cplusplus >= 201103L
486# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 714# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
487# else 715# else
@@ -505,9 +733,9 @@ AC_DEFUN([gl_COMMON_BODY], [
505 minimizing the memory required. */ 733 minimizing the memory required. */
506/* Applies to: struct members, struct, union, 734/* Applies to: struct members, struct, union,
507 in C++ also: class. */ 735 in C++ also: class. */
736#ifndef _GL_ATTRIBUTE_PACKED
508/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite 737/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
509 __has_attribute OK. */ 738 __has_attribute OK. */
510#ifndef _GL_ATTRIBUTE_PACKED
511# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C 739# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
512# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) 740# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
513# else 741# else
@@ -515,18 +743,51 @@ AC_DEFUN([gl_COMMON_BODY], [
515# endif 743# endif
516#endif 744#endif
517 745
518/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate 746/* _GL_ATTRIBUTE_PURE declares:
519 calls to the function with the same arguments if observable state is not 747 It is OK for a compiler to move calls to the function and to omit
520 changed between calls. 748 calls to the function if another call has the same arguments or the
521 This attribute is safe for a function that does not affect 749 result is not used, and if observable state is the same.
522 observable state, and always returns exactly once. 750 This attribute is safe for a function that does not affect observable state
523 (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ 751 and always returns exactly once.
752 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
753 can depend on observable state. It is stricter than
754 _GL_ATTRIBUTE_REPRODUCIBLE because the function must return exactly
755 once and cannot affect state addressed by its arguments.) */
524/* Applies to: functions. */ 756/* Applies to: functions. */
525#ifndef _GL_ATTRIBUTE_PURE 757#ifndef _GL_ATTRIBUTE_PURE
526# if _GL_HAS_ATTRIBUTE (pure) 758# if _GL_HAS_ATTRIBUTE (pure)
527# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) 759# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
528# else 760# else
529# define _GL_ATTRIBUTE_PURE 761# define _GL_ATTRIBUTE_PURE _GL_ATTRIBUTE_REPRODUCIBLE
762# endif
763#endif
764
765/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
766 It is OK for a compiler to move calls to the function and to omit duplicate
767 calls to the function with the same arguments, so long as the state
768 addressed by its arguments is the same and is updated in time for
769 the rest of the program.
770 This attribute is safe for a function that is effectless and idempotent; see
771 ISO C 23 § 6.7.12.7 for a definition of these terms.
772 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
773 the function need not be stateless and idempotent. It is looser
774 than _GL_ATTRIBUTE_PURE because the function need not return
775 exactly once and can affect state addressed by its arguments.)
776 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
777 <https://stackoverflow.com/questions/76847905/>.
778 ATTENTION! Efforts are underway to change the meaning of this attribute.
779 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
780/* Applies to: functions, pointer to functions, function types. */
781#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
782/* This may be revisited when gcc and clang support [[reproducible]] or possibly
783 __attribute__ ((__reproducible__)). */
784# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
785# if _GL_HAS_ATTRIBUTE (reproducible)
786# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
787# endif
788# endif
789# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
790# define _GL_ATTRIBUTE_REPRODUCIBLE
530# endif 791# endif
531#endif 792#endif
532 793
@@ -554,6 +815,35 @@ AC_DEFUN([gl_COMMON_BODY], [
554# endif 815# endif
555#endif 816#endif
556 817
818/* _GL_ATTRIBUTE_UNSEQUENCED declares:
819 It is OK for a compiler to move calls to the function and to omit duplicate
820 calls to the function with the same arguments, so long as the state
821 addressed by its arguments is the same.
822 This attribute is safe for a function that is effectless, idempotent,
823 stateless, and independent; see ISO C 23 § 6.7.12.7 for a definition of
824 these terms.
825 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
826 the function must be stateless and independent. It is looser than
827 _GL_ATTRIBUTE_CONST because the function need not return exactly
828 once and can depend on state addressed by its arguments.)
829 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
830 <https://stackoverflow.com/questions/76847905/>.
831 ATTENTION! Efforts are underway to change the meaning of this attribute.
832 See <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3424.htm>. */
833/* Applies to: functions, pointer to functions, function types. */
834#ifndef _GL_ATTRIBUTE_UNSEQUENCED
835/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
836 __attribute__ ((__unsequenced__)). */
837# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
838# if _GL_HAS_ATTRIBUTE (unsequenced)
839# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
840# endif
841# endif
842# ifndef _GL_ATTRIBUTE_UNSEQUENCED
843# define _GL_ATTRIBUTE_UNSEQUENCED
844# endif
845#endif
846
557/* A helper macro. Don't use it directly. */ 847/* A helper macro. Don't use it directly. */
558#ifndef _GL_ATTRIBUTE_UNUSED 848#ifndef _GL_ATTRIBUTE_UNUSED
559# if _GL_HAS_ATTRIBUTE (unused) 849# if _GL_HAS_ATTRIBUTE (unused)
@@ -578,6 +868,35 @@ AC_DEFUN([gl_COMMON_BODY], [
578# define _GL_UNUSED_LABEL 868# define _GL_UNUSED_LABEL
579# endif 869# endif
580#endif 870#endif
871
872/* The following attributes enable detection of multithread-safety problems
873 and resource leaks at compile-time, by clang ≥ 15, when the warning option
874 -Wthread-safety is enabled. For usage, see
875 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
876#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
877# if __clang_major__ >= 15
878# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
879 __attribute__ ((__capability__ (concept)))
880# else
881# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
882# endif
883#endif
884#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
885# if __clang_major__ >= 15
886# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
887 __attribute__ ((__acquire_capability__ (resource)))
888# else
889# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
890# endif
891#endif
892#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
893# if __clang_major__ >= 15
894# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
895 __attribute__ ((__release_capability__ (resource)))
896# else
897# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
898# endif
899#endif
581]) 900])
582 AH_VERBATIM([c_linkage], 901 AH_VERBATIM([c_linkage],
583[/* In C++, there is the concept of "language linkage", that encompasses 902[/* In C++, there is the concept of "language linkage", that encompasses
@@ -628,8 +947,8 @@ AC_DEFUN([gl_COMMON_BODY], [
628 -1 if n1 < n2 947 -1 if n1 < n2
629 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional 948 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
630 jump with nearly all GCC versions up to GCC 10. 949 jump with nearly all GCC versions up to GCC 10.
631 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many 950 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
632 GCC versions up to GCC 9. 951 many GCC versions up to GCC 9.
633 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 952 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
634 avoids conditional jumps in all GCC versions >= 3.4. */ 953 avoids conditional jumps in all GCC versions >= 3.4. */
635#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) 954#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1006,7 +1325,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1006 AC_REQUIRE([AC_PROG_CC]) 1325 AC_REQUIRE([AC_PROG_CC])
1007 AC_CACHE_CHECK([for C compiler option to allow warnings], 1326 AC_CACHE_CHECK([for C compiler option to allow warnings],
1008 [gl_cv_cc_wallow], 1327 [gl_cv_cc_wallow],
1009 [rm -f conftest* 1328 [rm -fr conftest*
1010 echo 'int dummy;' > conftest.c 1329 echo 'int dummy;' > conftest.c
1011 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1330 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
1012 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null 1331 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],
1019 else 1338 else
1020 gl_cv_cc_wallow=none 1339 gl_cv_cc_wallow=none
1021 fi 1340 fi
1022 rm -f conftest* 1341 rm -fr conftest*
1023 ]) 1342 ])
1024 case "$gl_cv_cc_wallow" in 1343 case "$gl_cv_cc_wallow" in
1025 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1344 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1037,7 +1356,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1037 if test -n "$CXX" && test "$CXX" != no; then 1356 if test -n "$CXX" && test "$CXX" != no; then
1038 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1357 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1039 [gl_cv_cxx_wallow], 1358 [gl_cv_cxx_wallow],
1040 [rm -f conftest* 1359 [rm -fr conftest*
1041 echo 'int dummy;' > conftest.cc 1360 echo 'int dummy;' > conftest.cc
1042 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1361 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
1043 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null 1362 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],
1050 else 1369 else
1051 gl_cv_cxx_wallow=none 1370 gl_cv_cxx_wallow=none
1052 fi 1371 fi
1053 rm -f conftest* 1372 rm -fr conftest*
1054 ]) 1373 ])
1055 case "$gl_cv_cxx_wallow" in 1374 case "$gl_cv_cxx_wallow" in
1056 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1375 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
@@ -1087,11 +1406,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1087 dnl -Wno-type-limits >= 4.3 >= 3.9 1406 dnl -Wno-type-limits >= 4.3 >= 3.9
1088 dnl -Wno-undef >= 3 >= 3.9 1407 dnl -Wno-undef >= 3 >= 3.9
1089 dnl -Wno-unsuffixed-float-constants >= 4.5 1408 dnl -Wno-unsuffixed-float-constants >= 4.5
1409 dnl -Wno-unused-const-variable >= 4.4 >= 3.9
1090 dnl -Wno-unused-function >= 3 >= 3.9 1410 dnl -Wno-unused-function >= 3 >= 3.9
1091 dnl -Wno-unused-parameter >= 3 >= 3.9 1411 dnl -Wno-unused-parameter >= 3 >= 3.9
1092 dnl 1412 dnl
1093 cat > conftest.c <<\EOF 1413 cat > conftest.c <<\EOF
1094 #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1414 #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1095 -Wno-cast-qual 1415 -Wno-cast-qual
1096 -Wno-conversion 1416 -Wno-conversion
1097 -Wno-float-equal 1417 -Wno-float-equal
@@ -1100,23 +1420,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1100 -Wno-unused-function 1420 -Wno-unused-function
1101 -Wno-unused-parameter 1421 -Wno-unused-parameter
1102 #endif 1422 #endif
1103 #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1423 #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1104 -Wno-float-conversion 1424 -Wno-float-conversion
1105 #endif 1425 #endif
1106 #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1426 #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1107 -Wimplicit-fallthrough 1427 -Wimplicit-fallthrough
1108 #endif 1428 #endif
1109 #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1429 #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1110 -Wno-pedantic 1430 -Wno-pedantic
1111 #endif 1431 #endif
1112 #if 3 < __clang_major__ + (9 <= __clang_minor__) 1432 #if 3 < __clang_major__ + (9 <= __clang_minor__)
1113 -Wno-tautological-constant-out-of-range-compare 1433 -Wno-tautological-constant-out-of-range-compare
1114 #endif 1434 #endif
1115 #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1435 #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1116 -Wno-sign-conversion 1436 -Wno-sign-conversion
1117 -Wno-type-limits 1437 -Wno-type-limits
1118 #endif 1438 #endif
1119 #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 1439 #if (__GNUC__ + (__GNUC_MINOR__ >= 4) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1440 -Wno-unused-const-variable
1441 #endif
1442 #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
1120 -Wno-unsuffixed-float-constants 1443 -Wno-unsuffixed-float-constants
1121 #endif 1444 #endif
1122EOF 1445EOF
@@ -1240,13 +1563,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1240 if test $[ac_cv_func_][$1] = yes; then 1563 if test $[ac_cv_func_][$1] = yes; then
1241 [gl_cv_onwards_func_][$1]=yes 1564 [gl_cv_onwards_func_][$1]=yes
1242 else 1565 else
1566 dnl This is a bit complicated, because here we need the behaviour
1567 dnl of AC_CHECK_DECL before the
1568 dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
1569 [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
1243 unset [ac_cv_have_decl_][$1] 1570 unset [ac_cv_have_decl_][$1]
1571 ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
1572 ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
1573 ac_c_future_darwin_options=
1574 ac_cxx_future_darwin_options=
1244 AC_CHECK_DECL([$1], , , [$2]) 1575 AC_CHECK_DECL([$1], , , [$2])
1576 ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
1577 ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
1245 if test $[ac_cv_have_decl_][$1] = yes; then 1578 if test $[ac_cv_have_decl_][$1] = yes; then
1246 [gl_cv_onwards_func_][$1]='future OS version' 1579 [gl_cv_onwards_func_][$1]='future OS version'
1247 else 1580 else
1248 [gl_cv_onwards_func_][$1]=no 1581 [gl_cv_onwards_func_][$1]=no
1249 fi 1582 fi
1583 [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
1584 unset [ac_cv_have_decl_][$1][_saved]
1250 fi 1585 fi
1251 else 1586 else
1252 AC_CHECK_FUNC([$1]) 1587 AC_CHECK_FUNC([$1])
@@ -1299,7 +1634,7 @@ dnl
1299dnl This macro sets two variables: 1634dnl This macro sets two variables:
1300dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1635dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1301dnl - ac_cv_func_<func> to yes / no / no 1636dnl - ac_cv_func_<func> to yes / no / no
1302dnl The first variable allows to distinguish all three cases. 1637dnl The first variable allows distinguishing all three cases.
1303dnl The second variable is set, so that an invocation 1638dnl The second variable is set, so that an invocation
1304dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1639dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1305dnl can be used as a drop-in replacement for 1640dnl can be used as a drop-in replacement for
@@ -1352,7 +1687,7 @@ dnl
1352dnl This macro sets two variables: 1687dnl This macro sets two variables:
1353dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1688dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1354dnl - ac_cv_func_<func> to yes / no / no 1689dnl - ac_cv_func_<func> to yes / no / no
1355dnl The first variable allows to distinguish all three cases. 1690dnl The first variable allows distinguishing all three cases.
1356dnl The second variable is set, so that an invocation 1691dnl The second variable is set, so that an invocation
1357dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) 1692dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1358dnl can be used as a drop-in replacement for 1693dnl 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 @@
1# DO NOT EDIT! GENERATED AUTOMATICALLY! 1# DO NOT EDIT! GENERATED AUTOMATICALLY!
2# Copyright (C) 2002-2024 Free Software Foundation, Inc. 2# Copyright (C) 2002-2025 Free Software Foundation, Inc.
3# 3#
4# This file is free software; you can redistribute it and/or modify 4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -45,14 +45,30 @@ AC_DEFUN([gl_EARLY],
45 # Code from module absolute-header: 45 # Code from module absolute-header:
46 # Code from module alignasof: 46 # Code from module alignasof:
47 # Code from module alloca-opt: 47 # Code from module alloca-opt:
48 # Code from module arpa_inet: 48 # Code from module arpa_inet-h:
49 # Code from module assert-h: 49 # Code from module assert-h:
50 # Code from module attribute: 50 # Code from module attribute:
51 # Code from module base64: 51 # Code from module base64:
52 # Code from module basename-lgpl: 52 # Code from module basename-lgpl:
53 # Code from module bool:
53 # Code from module btowc: 54 # Code from module btowc:
54 # Code from module builtin-expect: 55 # Code from module builtin-expect:
55 # Code from module byteswap: 56 # Code from module byteswap:
57 # Code from module c-ctype:
58 # Code from module c32isalnum:
59 # Code from module c32isalpha:
60 # Code from module c32isblank:
61 # Code from module c32iscntrl:
62 # Code from module c32isdigit:
63 # Code from module c32isgraph:
64 # Code from module c32islower:
65 # Code from module c32isprint:
66 # Code from module c32ispunct:
67 # Code from module c32isspace:
68 # Code from module c32isupper:
69 # Code from module c32isxdigit:
70 # Code from module c32tolower:
71 # Code from module c32width:
56 # Code from module c99: 72 # Code from module c99:
57 # Code from module calloc-gnu: 73 # Code from module calloc-gnu:
58 # Code from module calloc-posix: 74 # Code from module calloc-posix:
@@ -66,11 +82,15 @@ AC_DEFUN([gl_EARLY],
66 # Code from module double-slash-root: 82 # Code from module double-slash-root:
67 # Code from module dup2: 83 # Code from module dup2:
68 # Code from module environ: 84 # Code from module environ:
69 # Code from module errno: 85 # Code from module errno-h:
70 # Code from module error: 86 # Code from module error:
71 # Code from module error-h: 87 # Code from module error-h:
72 # Code from module exitfail: 88 # Code from module exitfail:
73 # Code from module extensions: 89 # Code from module extensions:
90 # This is actually already done in the pre-early phase.
91 # AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
92 # Code from module extensions-aix:
93 AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
74 # Code from module extern-inline: 94 # Code from module extern-inline:
75 # Code from module fcntl: 95 # Code from module fcntl:
76 # Code from module fcntl-h: 96 # Code from module fcntl-h:
@@ -78,7 +98,7 @@ AC_DEFUN([gl_EARLY],
78 # Code from module fflush: 98 # Code from module fflush:
79 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) 99 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE])
80 # Code from module filename: 100 # Code from module filename:
81 # Code from module float: 101 # Code from module float-h:
82 # Code from module floorf: 102 # Code from module floorf:
83 # Code from module fopen: 103 # Code from module fopen:
84 # Code from module fopen-gnu: 104 # Code from module fopen-gnu:
@@ -88,6 +108,7 @@ AC_DEFUN([gl_EARLY],
88 # Code from module fseek: 108 # Code from module fseek:
89 # Code from module fseeko: 109 # Code from module fseeko:
90 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE]) 110 AC_REQUIRE([gl_SET_LARGEFILE_SOURCE])
111 # Code from module fseterr:
91 # Code from module fstat: 112 # Code from module fstat:
92 # Code from module fsusage: 113 # Code from module fsusage:
93 # Code from module ftell: 114 # Code from module ftell:
@@ -105,6 +126,7 @@ AC_DEFUN([gl_EARLY],
105 # Code from module getprogname: 126 # Code from module getprogname:
106 # Code from module gettext-h: 127 # Code from module gettext-h:
107 # Code from module glibc-internal/dynarray: 128 # Code from module glibc-internal/dynarray:
129 # Code from module gnulib-i18n:
108 # Code from module hard-locale: 130 # Code from module hard-locale:
109 # Code from module hostent: 131 # Code from module hostent:
110 # Code from module ialloc: 132 # Code from module ialloc:
@@ -112,29 +134,35 @@ AC_DEFUN([gl_EARLY],
112 # Code from module idx: 134 # Code from module idx:
113 # Code from module include_next: 135 # Code from module include_next:
114 # Code from module inet_ntop: 136 # Code from module inet_ntop:
137 # Code from module inet_pton:
115 # Code from module intprops: 138 # Code from module intprops:
116 # Code from module inttypes-incomplete: 139 # Code from module inttypes-h-incomplete:
117 # Code from module iswblank: 140 # Code from module iswblank:
118 # Code from module iswctype: 141 # Code from module iswctype:
119 # Code from module iswdigit: 142 # Code from module iswdigit:
120 # Code from module iswpunct: 143 # Code from module iswpunct:
121 # Code from module iswxdigit: 144 # Code from module iswxdigit:
122 # Code from module langinfo: 145 # Code from module langinfo-h:
123 # Code from module largefile: 146 # Code from module largefile:
124 AC_REQUIRE([AC_SYS_LARGEFILE]) 147 AC_REQUIRE([AC_SYS_LARGEFILE])
125 # Code from module libc-config: 148 # Code from module libc-config:
126 # Code from module limits-h: 149 # Code from module limits-h:
127 # Code from module localcharset: 150 # Code from module localcharset:
128 # Code from module locale: 151 # Code from module locale-h:
129 # Code from module localeconv: 152 # Code from module localeconv:
130 # Code from module lock: 153 # Code from module lock:
131 # Code from module lseek: 154 # Code from module lseek:
155 # Code from module lstat:
132 # Code from module malloc-gnu: 156 # Code from module malloc-gnu:
133 # Code from module malloc-posix: 157 # Code from module malloc-posix:
134 # Code from module malloca: 158 # Code from module malloca:
135 # Code from module math: 159 # Code from module math-h:
160 # Code from module mbchar:
161 # Code from module mbiterf:
162 # Code from module mbrtoc32:
136 # Code from module mbrtowc: 163 # Code from module mbrtowc:
137 # Code from module mbsinit: 164 # Code from module mbsinit:
165 # Code from module mbsnlen:
138 # Code from module mbszero: 166 # Code from module mbszero:
139 # Code from module mbtowc: 167 # Code from module mbtowc:
140 # Code from module memchr: 168 # Code from module memchr:
@@ -145,16 +173,20 @@ AC_DEFUN([gl_EARLY],
145 # Code from module msvc-inval: 173 # Code from module msvc-inval:
146 # Code from module msvc-nothrow: 174 # Code from module msvc-nothrow:
147 # Code from module multiarch: 175 # Code from module multiarch:
148 # Code from module netdb: 176 # Code from module netdb-h:
149 # Code from module netinet_in: 177 # Code from module netinet_in-h:
150 # Code from module nl_langinfo: 178 # Code from module nl_langinfo:
151 # Code from module nocrash: 179 # Code from module nocrash:
180 # Code from module once:
152 # Code from module open: 181 # Code from module open:
153 # Code from module pathmax: 182 # Code from module pathmax:
154 # Code from module realloc-gnu: 183 # Code from module pthread-h:
184 gl_ANYTHREADLIB_EARLY
185 # Code from module pthread-once:
155 # Code from module realloc-posix: 186 # Code from module realloc-posix:
156 # Code from module reallocarray: 187 # Code from module reallocarray:
157 # Code from module regex: 188 # Code from module regex:
189 # Code from module sched-h:
158 # Code from module servent: 190 # Code from module servent:
159 # Code from module setenv: 191 # Code from module setenv:
160 # Code from module setlocale-null: 192 # Code from module setlocale-null:
@@ -172,33 +204,56 @@ AC_DEFUN([gl_EARLY],
172 # Code from module stat: 204 # Code from module stat:
173 # Code from module stat-time: 205 # Code from module stat-time:
174 # Code from module std-gnu11: 206 # Code from module std-gnu11:
175 # Code from module stdbool: 207 # Code from module stdckdint-h:
176 # Code from module stdckdint: 208 # Code from module stddef-h:
177 # Code from module stddef: 209 # Code from module stdint-h:
178 # Code from module stdint: 210 # Code from module stdio-h:
179 # Code from module stdio:
180 gl_STDIO_H_EARLY 211 gl_STDIO_H_EARLY
181 # Code from module stdlib: 212 # Code from module stdlib-h:
182 # Code from module strcase: 213 # Code from module strcase:
214 # Code from module strcasecmp:
183 # Code from module strcasestr: 215 # Code from module strcasestr:
184 # Code from module strcasestr-simple: 216 # Code from module strcasestr-simple:
185 # Code from module streq: 217 # Code from module streq:
186 # Code from module strerror: 218 # Code from module strerror:
187 # Code from module strerror-override: 219 # Code from module strerror-override:
188 # Code from module string: 220 # Code from module string-h:
189 # Code from module strings: 221 # Code from module strings-h:
222 # Code from module strncasecmp:
223 # Code from module strncpy:
190 # Code from module strsep: 224 # Code from module strsep:
191 # Code from module strstr-simple: 225 # Code from module strstr-simple:
192 # Code from module sys_socket: 226 # Code from module sys_socket-h:
193 # Code from module sys_stat: 227 # Code from module sys_stat-h:
194 # Code from module sys_types: 228 # Code from module sys_types-h:
195 # Code from module sys_uio: 229 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
230 # Code from module sys_uio-h:
196 # Code from module threadlib: 231 # Code from module threadlib:
197 gl_THREADLIB_EARLY 232 gl_THREADLIB_EARLY
198 # Code from module time-h: 233 # Code from module time-h:
199 # Code from module time_r: 234 # Code from module time_r:
200 # Code from module timegm: 235 # Code from module timegm:
201 # Code from module unistd: 236 # Code from module uchar-h:
237 # Code from module unicase/base:
238 # Code from module unicase/tolower:
239 # Code from module unictype/base:
240 # Code from module unictype/ctype-alnum:
241 # Code from module unictype/ctype-alpha:
242 # Code from module unictype/ctype-blank:
243 # Code from module unictype/ctype-cntrl:
244 # Code from module unictype/ctype-digit:
245 # Code from module unictype/ctype-graph:
246 # Code from module unictype/ctype-lower:
247 # Code from module unictype/ctype-print:
248 # Code from module unictype/ctype-punct:
249 # Code from module unictype/ctype-space:
250 # Code from module unictype/ctype-upper:
251 # Code from module unictype/ctype-xdigit:
252 # Code from module uninorm/base:
253 # Code from module unistd-h:
254 # Code from module unitypes-h:
255 # Code from module uniwidth/base:
256 # Code from module uniwidth/width:
202 # Code from module unlocked-io-internal: 257 # Code from module unlocked-io-internal:
203 # Code from module unsetenv: 258 # Code from module unsetenv:
204 # Code from module vararrays: 259 # Code from module vararrays:
@@ -206,10 +261,12 @@ AC_DEFUN([gl_EARLY],
206 # Code from module vasprintf: 261 # Code from module vasprintf:
207 # Code from module verify: 262 # Code from module verify:
208 # Code from module vsnprintf: 263 # Code from module vsnprintf:
209 # Code from module wchar: 264 # Code from module vsnzprintf:
265 # Code from module wchar-h:
210 # Code from module wcrtomb: 266 # Code from module wcrtomb:
211 # Code from module wctype: 267 # Code from module wctype:
212 # Code from module wctype-h: 268 # Code from module wctype-h:
269 # Code from module wcwidth:
213 # Code from module windows-mutex: 270 # Code from module windows-mutex:
214 # Code from module windows-once: 271 # Code from module windows-once:
215 # Code from module windows-recmutex: 272 # Code from module windows-recmutex:
@@ -250,6 +307,7 @@ AC_DEFUN([gl_INIT],
250 gl_CONDITIONAL_HEADER([assert.h]) 307 gl_CONDITIONAL_HEADER([assert.h])
251 AC_PROG_MKDIR_P 308 AC_PROG_MKDIR_P
252 gl_FUNC_BASE64 309 gl_FUNC_BASE64
310 gl_C_BOOL
253 gl_FUNC_BTOWC 311 gl_FUNC_BTOWC
254 gl_CONDITIONAL([GL_COND_OBJ_BTOWC], 312 gl_CONDITIONAL([GL_COND_OBJ_BTOWC],
255 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) 313 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1])
@@ -261,6 +319,104 @@ AC_DEFUN([gl_INIT],
261 gl_BYTESWAP 319 gl_BYTESWAP
262 gl_CONDITIONAL_HEADER([byteswap.h]) 320 gl_CONDITIONAL_HEADER([byteswap.h])
263 AC_PROG_MKDIR_P 321 AC_PROG_MKDIR_P
322 AC_REQUIRE([gl_UCHAR_H])
323 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
324 dnl determined. It describes how mbrtoc32 is implemented.
325 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
326 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
327 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
328 gl_UCHAR_MODULE_INDICATOR([c32isalnum])
329 AC_REQUIRE([gl_UCHAR_H])
330 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
331 dnl determined. It describes how mbrtoc32 is implemented.
332 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
333 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
334 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
335 gl_UCHAR_MODULE_INDICATOR([c32isalpha])
336 AC_REQUIRE([gl_UCHAR_H])
337 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
338 dnl determined. It describes how mbrtoc32 is implemented.
339 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
340 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
341 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
342 gl_UCHAR_MODULE_INDICATOR([c32isblank])
343 AC_REQUIRE([gl_UCHAR_H])
344 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
345 dnl determined. It describes how mbrtoc32 is implemented.
346 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
347 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
348 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
349 gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
350 AC_REQUIRE([gl_UCHAR_H])
351 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
352 dnl determined. It describes how mbrtoc32 is implemented.
353 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
354 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
355 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
356 gl_UCHAR_MODULE_INDICATOR([c32isdigit])
357 AC_REQUIRE([gl_UCHAR_H])
358 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
359 dnl determined. It describes how mbrtoc32 is implemented.
360 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
361 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
362 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
363 gl_UCHAR_MODULE_INDICATOR([c32isgraph])
364 AC_REQUIRE([gl_UCHAR_H])
365 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
366 dnl determined. It describes how mbrtoc32 is implemented.
367 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
368 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
369 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
370 gl_UCHAR_MODULE_INDICATOR([c32islower])
371 AC_REQUIRE([gl_UCHAR_H])
372 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
373 dnl determined. It describes how mbrtoc32 is implemented.
374 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
375 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
376 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
377 gl_UCHAR_MODULE_INDICATOR([c32isprint])
378 AC_REQUIRE([gl_UCHAR_H])
379 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
380 dnl determined. It describes how mbrtoc32 is implemented.
381 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
382 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
383 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
384 gl_UCHAR_MODULE_INDICATOR([c32ispunct])
385 AC_REQUIRE([gl_UCHAR_H])
386 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
387 dnl determined. It describes how mbrtoc32 is implemented.
388 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
389 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
390 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
391 gl_UCHAR_MODULE_INDICATOR([c32isspace])
392 AC_REQUIRE([gl_UCHAR_H])
393 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
394 dnl determined. It describes how mbrtoc32 is implemented.
395 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
396 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
397 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
398 gl_UCHAR_MODULE_INDICATOR([c32isupper])
399 AC_REQUIRE([gl_UCHAR_H])
400 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
401 dnl determined. It describes how mbrtoc32 is implemented.
402 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
403 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
404 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
405 gl_UCHAR_MODULE_INDICATOR([c32isxdigit])
406 AC_REQUIRE([gl_UCHAR_H])
407 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
408 dnl determined. It describes how mbrtoc32 is implemented.
409 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
410 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
411 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
412 gl_UCHAR_MODULE_INDICATOR([c32tolower])
413 AC_REQUIRE([gl_UCHAR_H])
414 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
415 dnl determined. It describes how mbrtoc32 is implemented.
416 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
417 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
418 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
419 gl_UCHAR_MODULE_INDICATOR([c32width])
264 gl_FUNC_CALLOC_GNU 420 gl_FUNC_CALLOC_GNU
265 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then 421 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
266 AC_LIBOBJ([calloc]) 422 AC_LIBOBJ([calloc])
@@ -275,6 +431,7 @@ AC_DEFUN([gl_INIT],
275 gl_FUNC_CLOSE 431 gl_FUNC_CLOSE
276 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) 432 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1])
277 gl_UNISTD_MODULE_INDICATOR([close]) 433 gl_UNISTD_MODULE_INDICATOR([close])
434 gl_MODULE_INDICATOR([close])
278 gl_AF_ALG 435 gl_AF_ALG
279 AC_REQUIRE([AC_C_RESTRICT]) 436 AC_REQUIRE([AC_C_RESTRICT])
280 gl_SHA256 437 gl_SHA256
@@ -320,8 +477,11 @@ AC_DEFUN([gl_INIT],
320 gl_FLOAT_H 477 gl_FLOAT_H
321 gl_CONDITIONAL_HEADER([float.h]) 478 gl_CONDITIONAL_HEADER([float.h])
322 AC_PROG_MKDIR_P 479 AC_PROG_MKDIR_P
323 gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) 480 gl_CONDITIONAL([GL_COND_OBJ_FLOAT],
481 [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1])
324 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) 482 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1])
483 dnl Prerequisites of lib/float.c.
484 AC_REQUIRE([gl_BIGENDIAN])
325 gl_FUNC_FLOORF 485 gl_FUNC_FLOORF
326 gl_CONDITIONAL([GL_COND_OBJ_FLOORF], 486 gl_CONDITIONAL([GL_COND_OBJ_FLOORF],
327 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) 487 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1])
@@ -360,6 +520,8 @@ AC_DEFUN([gl_INIT],
360 gl_PREREQ_FSEEKO 520 gl_PREREQ_FSEEKO
361 ]) 521 ])
362 gl_STDIO_MODULE_INDICATOR([fseeko]) 522 gl_STDIO_MODULE_INDICATOR([fseeko])
523 gl_FUNC_FSETERR
524 gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no])
363 gl_FUNC_FSTAT 525 gl_FUNC_FSTAT
364 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) 526 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1])
365 AM_COND_IF([GL_COND_OBJ_FSTAT], [ 527 AM_COND_IF([GL_COND_OBJ_FSTAT], [
@@ -371,6 +533,7 @@ AC_DEFUN([gl_INIT],
371 gl_PREREQ_FSTAT 533 gl_PREREQ_FSTAT
372 ]) 534 ])
373 gl_SYS_STAT_MODULE_INDICATOR([fstat]) 535 gl_SYS_STAT_MODULE_INDICATOR([fstat])
536 gl_MODULE_INDICATOR([fstat])
374 gl_FSUSAGE 537 gl_FSUSAGE
375 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) 538 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes])
376 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ 539 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [
@@ -412,6 +575,7 @@ AC_DEFUN([gl_INIT],
412 gl_PREREQ_GETHOSTNAME 575 gl_PREREQ_GETHOSTNAME
413 ]) 576 ])
414 gl_UNISTD_MODULE_INDICATOR([gethostname]) 577 gl_UNISTD_MODULE_INDICATOR([gethostname])
578 gl_MODULE_INDICATOR([gethostname])
415 gl_FUNC_GETLINE 579 gl_FUNC_GETLINE
416 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) 580 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1])
417 AM_COND_IF([GL_COND_OBJ_GETLINE], [ 581 AM_COND_IF([GL_COND_OBJ_GETLINE], [
@@ -441,6 +605,8 @@ AC_DEFUN([gl_INIT],
441 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) 605 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1])
442 ]) 606 ])
443 gl_UNISTD_MODULE_INDICATOR([getopt-posix]) 607 gl_UNISTD_MODULE_INDICATOR([getopt-posix])
608 gl_MUSL_LIBC
609 AC_REQUIRE([AC_CANONICAL_HOST])
444 gl_FUNC_GETPROGNAME 610 gl_FUNC_GETPROGNAME
445 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], 611 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME],
446 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) 612 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1])
@@ -451,6 +617,7 @@ AC_DEFUN([gl_INIT],
451 AC_SUBST([LIBINTL]) 617 AC_SUBST([LIBINTL])
452 AC_SUBST([LTLIBINTL]) 618 AC_SUBST([LTLIBINTL])
453 AC_PROG_MKDIR_P 619 AC_PROG_MKDIR_P
620 GNULIB_I18N
454 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) 621 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
455 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" 622 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB"
456 AC_SUBST([HARD_LOCALE_LIB]) 623 AC_SUBST([HARD_LOCALE_LIB])
@@ -466,6 +633,13 @@ AC_DEFUN([gl_INIT],
466 gl_PREREQ_INET_NTOP 633 gl_PREREQ_INET_NTOP
467 ]) 634 ])
468 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 635 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
636 gl_FUNC_INET_PTON
637 gl_CONDITIONAL([GL_COND_OBJ_INET_PTON],
638 [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1])
639 AM_COND_IF([GL_COND_OBJ_INET_PTON], [
640 gl_PREREQ_INET_PTON
641 ])
642 gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
469 gl_INTTYPES_INCOMPLETE 643 gl_INTTYPES_INCOMPLETE
470 gl_INTTYPES_H_REQUIRE_DEFAULTS 644 gl_INTTYPES_H_REQUIRE_DEFAULTS
471 AC_PROG_MKDIR_P 645 AC_PROG_MKDIR_P
@@ -510,11 +684,19 @@ AC_DEFUN([gl_INIT],
510 gl_PREREQ_LOCALECONV 684 gl_PREREQ_LOCALECONV
511 ]) 685 ])
512 gl_LOCALE_MODULE_INDICATOR([localeconv]) 686 gl_LOCALE_MODULE_INDICATOR([localeconv])
687 gl_MODULE_INDICATOR([localeconv])
513 gl_LOCK 688 gl_LOCK
514 gl_MODULE_INDICATOR([lock]) 689 gl_MODULE_INDICATOR([lock])
515 gl_FUNC_LSEEK 690 gl_FUNC_LSEEK
516 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) 691 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1])
517 gl_UNISTD_MODULE_INDICATOR([lseek]) 692 gl_UNISTD_MODULE_INDICATOR([lseek])
693 gl_FUNC_LSTAT
694 gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1])
695 AM_COND_IF([GL_COND_OBJ_LSTAT], [
696 gl_PREREQ_LSTAT
697 ])
698 gl_SYS_STAT_MODULE_INDICATOR([lstat])
699 gl_MODULE_INDICATOR([lstat])
518 gl_FUNC_MALLOC_GNU 700 gl_FUNC_MALLOC_GNU
519 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then 701 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
520 AC_LIBOBJ([malloc]) 702 AC_LIBOBJ([malloc])
@@ -529,6 +711,20 @@ AC_DEFUN([gl_INIT],
529 gl_MATH_H 711 gl_MATH_H
530 gl_MATH_H_REQUIRE_DEFAULTS 712 gl_MATH_H_REQUIRE_DEFAULTS
531 AC_PROG_MKDIR_P 713 AC_PROG_MKDIR_P
714 gl_MBCHAR
715 gl_MBITER
716 gl_FUNC_MBRTOC32
717 gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32],
718 [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1])
719 AM_COND_IF([GL_COND_OBJ_MBRTOC32], [
720 if test $REPLACE_MBSTATE_T = 1; then
721 AC_LIBOBJ([lc-charset-dispatch])
722 AC_LIBOBJ([mbtowc-lock])
723 gl_PREREQ_MBTOWC_LOCK
724 fi
725 gl_PREREQ_MBRTOC32
726 ])
727 gl_UCHAR_MODULE_INDICATOR([mbrtoc32])
532 gl_FUNC_MBRTOWC 728 gl_FUNC_MBRTOWC
533 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], 729 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC],
534 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) 730 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1])
@@ -548,6 +744,7 @@ AC_DEFUN([gl_INIT],
548 gl_PREREQ_MBSINIT 744 gl_PREREQ_MBSINIT
549 ]) 745 ])
550 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 746 gl_WCHAR_MODULE_INDICATOR([mbsinit])
747 gl_STRING_MODULE_INDICATOR([mbsnlen])
551 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 748 AC_REQUIRE([AC_TYPE_MBSTATE_T])
552 gl_MBSTATE_T_BROKEN 749 gl_MBSTATE_T_BROKEN
553 gl_MUSL_LIBC 750 gl_MUSL_LIBC
@@ -578,10 +775,7 @@ AC_DEFUN([gl_INIT],
578 gl_PREREQ_MKTIME 775 gl_PREREQ_MKTIME
579 fi 776 fi
580 gl_MOUNTLIST 777 gl_MOUNTLIST
581 gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) 778 gl_PREREQ_MOUNTLIST_EXTRA
582 AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [
583 gl_PREREQ_MOUNTLIST_EXTRA
584 ])
585 AC_REQUIRE([gl_MSVC_INVAL]) 779 AC_REQUIRE([gl_MSVC_INVAL])
586 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], 780 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL],
587 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) 781 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1])
@@ -605,6 +799,7 @@ AC_DEFUN([gl_INIT],
605 gl_PREREQ_NL_LANGINFO_LOCK 799 gl_PREREQ_NL_LANGINFO_LOCK
606 fi 800 fi
607 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) 801 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
802 gl_ONCE
608 gl_FUNC_OPEN 803 gl_FUNC_OPEN
609 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) 804 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1])
610 AM_COND_IF([GL_COND_OBJ_OPEN], [ 805 AM_COND_IF([GL_COND_OBJ_OPEN], [
@@ -612,15 +807,17 @@ AC_DEFUN([gl_INIT],
612 ]) 807 ])
613 gl_FCNTL_MODULE_INDICATOR([open]) 808 gl_FCNTL_MODULE_INDICATOR([open])
614 gl_PATHMAX 809 gl_PATHMAX
615 gl_FUNC_REALLOC_GNU 810 gl_PTHREAD_H
616 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then 811 gl_PTHREAD_H_REQUIRE_DEFAULTS
617 AC_LIBOBJ([realloc]) 812 AC_PROG_MKDIR_P
618 fi 813 gl_PTHREAD_ONCE
619 gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) 814 gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE],
815 [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1])
816 gl_PTHREAD_MODULE_INDICATOR([pthread-once])
620 gl_FUNC_REALLOC_POSIX 817 gl_FUNC_REALLOC_POSIX
621 if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then 818 gl_FUNC_REALLOC_0_NONNULL
622 AC_LIBOBJ([realloc]) 819 gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX],
623 fi 820 [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0])
624 gl_STDLIB_MODULE_INDICATOR([realloc-posix]) 821 gl_STDLIB_MODULE_INDICATOR([realloc-posix])
625 gl_FUNC_REALLOCARRAY 822 gl_FUNC_REALLOCARRAY
626 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], 823 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY],
@@ -635,6 +832,9 @@ AC_DEFUN([gl_INIT],
635 AM_COND_IF([GL_COND_OBJ_REGEX], [ 832 AM_COND_IF([GL_COND_OBJ_REGEX], [
636 gl_PREREQ_REGEX 833 gl_PREREQ_REGEX
637 ]) 834 ])
835 gl_SCHED_H
836 gl_SCHED_H_REQUIRE_DEFAULTS
837 AC_PROG_MKDIR_P
638 gl_SERVENT 838 gl_SERVENT
639 gl_FUNC_SETENV 839 gl_FUNC_SETENV
640 gl_CONDITIONAL([GL_COND_OBJ_SETENV], 840 gl_CONDITIONAL([GL_COND_OBJ_SETENV],
@@ -666,15 +866,10 @@ AC_DEFUN([gl_INIT],
666 gl_PREREQ_STAT 866 gl_PREREQ_STAT
667 ]) 867 ])
668 gl_SYS_STAT_MODULE_INDICATOR([stat]) 868 gl_SYS_STAT_MODULE_INDICATOR([stat])
869 gl_MODULE_INDICATOR([stat])
669 gl_STAT_TIME 870 gl_STAT_TIME
670 gl_STAT_BIRTHTIME 871 gl_STAT_BIRTHTIME
671 gl_C_BOOL 872 gl_STDCKDINT_H
672 AC_CHECK_HEADERS_ONCE([stdckdint.h])
673 if test $ac_cv_header_stdckdint_h = yes; then
674 GL_GENERATE_STDCKDINT_H=false
675 else
676 GL_GENERATE_STDCKDINT_H=true
677 fi
678 gl_CONDITIONAL_HEADER([stdckdint.h]) 873 gl_CONDITIONAL_HEADER([stdckdint.h])
679 AC_PROG_MKDIR_P 874 AC_PROG_MKDIR_P
680 gl_STDDEF_H 875 gl_STDDEF_H
@@ -689,6 +884,19 @@ AC_DEFUN([gl_INIT],
689 gl_STDIO_H 884 gl_STDIO_H
690 gl_STDIO_H_REQUIRE_DEFAULTS 885 gl_STDIO_H_REQUIRE_DEFAULTS
691 AC_PROG_MKDIR_P 886 AC_PROG_MKDIR_P
887 USES_MSVCRT=0
888 case "$host_os" in
889 mingw* | windows*)
890 AC_EGREP_CPP([Special], [
891 #ifndef _UCRT
892 Special
893 #endif
894 ],
895 [USES_MSVCRT=1])
896 ;;
897 esac
898 gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
899 AC_CHECK_FUNCS([vasprintf])
692 gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) 900 gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1])
693 gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) 901 gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1])
694 dnl No need to create extra modules for these functions. Everyone who uses 902 dnl No need to create extra modules for these functions. Everyone who uses
@@ -717,15 +925,13 @@ AC_DEFUN([gl_INIT],
717 gl_STDLIB_H 925 gl_STDLIB_H
718 gl_STDLIB_H_REQUIRE_DEFAULTS 926 gl_STDLIB_H_REQUIRE_DEFAULTS
719 AC_PROG_MKDIR_P 927 AC_PROG_MKDIR_P
720 gl_STRCASE 928 gl_FUNC_STRCASECMP
721 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) 929 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP],
930 [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1])
722 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ 931 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
723 gl_PREREQ_STRCASECMP 932 gl_PREREQ_STRCASECMP
724 ]) 933 ])
725 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) 934 gl_STRINGS_MODULE_INDICATOR([strcasecmp])
726 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
727 gl_PREREQ_STRNCASECMP
728 ])
729 gl_FUNC_STRCASESTR 935 gl_FUNC_STRCASESTR
730 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then 936 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then
731 AC_LIBOBJ([strcasestr]) 937 AC_LIBOBJ([strcasestr])
@@ -754,6 +960,19 @@ AC_DEFUN([gl_INIT],
754 gl_STRINGS_H 960 gl_STRINGS_H
755 gl_STRINGS_H_REQUIRE_DEFAULTS 961 gl_STRINGS_H_REQUIRE_DEFAULTS
756 AC_PROG_MKDIR_P 962 AC_PROG_MKDIR_P
963 gl_FUNC_STRNCASECMP
964 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP],
965 [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1])
966 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
967 gl_PREREQ_STRNCASECMP
968 ])
969 gl_STRINGS_MODULE_INDICATOR([strncasecmp])
970 gl_FUNC_STRNCPY
971 gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1])
972 AM_COND_IF([GL_COND_OBJ_STRNCPY], [
973 gl_PREREQ_STRNCPY
974 ])
975 gl_STRING_MODULE_INDICATOR([strncpy])
757 gl_FUNC_STRSEP 976 gl_FUNC_STRSEP
758 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) 977 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0])
759 AM_COND_IF([GL_COND_OBJ_STRSEP], [ 978 AM_COND_IF([GL_COND_OBJ_STRSEP], [
@@ -795,9 +1014,55 @@ AC_DEFUN([gl_INIT],
795 gl_PREREQ_TIMEGM 1014 gl_PREREQ_TIMEGM
796 ]) 1015 ])
797 gl_TIME_MODULE_INDICATOR([timegm]) 1016 gl_TIME_MODULE_INDICATOR([timegm])
1017 gl_UCHAR_H
1018 gl_UCHAR_H_REQUIRE_DEFAULTS
1019 AC_PROG_MKDIR_P
1020 gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h])
1021 gl_UNICASE_H
1022 gl_UNICASE_H_REQUIRE_DEFAULTS
1023 AC_PROG_MKDIR_P
1024 gl_LIBUNISTRING_MODULE([1.3], [unicase/tolower])
1025 gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h])
1026 gl_UNICTYPE_H
1027 gl_UNICTYPE_H_REQUIRE_DEFAULTS
1028 AC_PROG_MKDIR_P
1029 AC_REQUIRE([AC_C_INLINE])
1030 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alnum])
1031 AC_REQUIRE([AC_C_INLINE])
1032 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-alpha])
1033 AC_REQUIRE([AC_C_INLINE])
1034 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-blank])
1035 AC_REQUIRE([AC_C_INLINE])
1036 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-cntrl])
1037 AC_REQUIRE([AC_C_INLINE])
1038 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-digit])
1039 AC_REQUIRE([AC_C_INLINE])
1040 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-graph])
1041 AC_REQUIRE([AC_C_INLINE])
1042 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-lower])
1043 AC_REQUIRE([AC_C_INLINE])
1044 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-print])
1045 AC_REQUIRE([AC_C_INLINE])
1046 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-punct])
1047 AC_REQUIRE([AC_C_INLINE])
1048 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-space])
1049 AC_REQUIRE([AC_C_INLINE])
1050 gl_LIBUNISTRING_MODULE([1.3], [unictype/ctype-upper])
1051 AC_REQUIRE([AC_C_INLINE])
1052 gl_LIBUNISTRING_MODULE([0.9.8], [unictype/ctype-xdigit])
1053 gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h])
1054 gl_UNINORM_H
1055 gl_UNINORM_H_REQUIRE_DEFAULTS
1056 AC_PROG_MKDIR_P
798 gl_UNISTD_H 1057 gl_UNISTD_H
799 gl_UNISTD_H_REQUIRE_DEFAULTS 1058 gl_UNISTD_H_REQUIRE_DEFAULTS
800 AC_PROG_MKDIR_P 1059 AC_PROG_MKDIR_P
1060 gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h])
1061 AC_PROG_MKDIR_P
1062 gl_UNITYPES_H
1063 gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h])
1064 AC_PROG_MKDIR_P
1065 gl_LIBUNISTRING_MODULE([1.3], [uniwidth/width])
801 gl_FUNC_GLIBC_UNLOCKED_IO 1066 gl_FUNC_GLIBC_UNLOCKED_IO
802 gl_FUNC_UNSETENV 1067 gl_FUNC_UNSETENV
803 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], 1068 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV],
@@ -816,6 +1081,7 @@ AC_DEFUN([gl_INIT],
816 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 1081 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
817 gl_FUNC_VSNPRINTF 1082 gl_FUNC_VSNPRINTF
818 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 1083 gl_STDIO_MODULE_INDICATOR([vsnprintf])
1084 gl_STDIO_MODULE_INDICATOR([vsnzprintf])
819 gl_WCHAR_H 1085 gl_WCHAR_H
820 gl_WCHAR_H_REQUIRE_DEFAULTS 1086 gl_WCHAR_H_REQUIRE_DEFAULTS
821 AC_PROG_MKDIR_P 1087 AC_PROG_MKDIR_P
@@ -832,6 +1098,13 @@ AC_DEFUN([gl_INIT],
832 gl_WCTYPE_H 1098 gl_WCTYPE_H
833 gl_WCTYPE_H_REQUIRE_DEFAULTS 1099 gl_WCTYPE_H_REQUIRE_DEFAULTS
834 AC_PROG_MKDIR_P 1100 AC_PROG_MKDIR_P
1101 gl_FUNC_WCWIDTH
1102 gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH],
1103 [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1])
1104 AM_COND_IF([GL_COND_OBJ_WCWIDTH], [
1105 gl_PREREQ_WCWIDTH
1106 ])
1107 gl_WCHAR_MODULE_INDICATOR([wcwidth])
835 AC_REQUIRE([AC_CANONICAL_HOST]) 1108 AC_REQUIRE([AC_CANONICAL_HOST])
836 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], 1109 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX],
837 [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) 1110 [case "$host_os" in mingw* | windows*) true;; *) false;; esac])
@@ -871,27 +1144,35 @@ AC_DEFUN([gl_INIT],
871 gl_libobjs= 1144 gl_libobjs=
872 gl_ltlibobjs= 1145 gl_ltlibobjs=
873 gl_libobjdeps= 1146 gl_libobjdeps=
1147 gl_libgnu_libobjs=
1148 gl_libgnu_ltlibobjs=
1149 gl_libgnu_libobjdeps=
874 if test -n "$gl_LIBOBJS"; then 1150 if test -n "$gl_LIBOBJS"; then
875 # Remove the extension. 1151 # Remove the extension.
876changequote(,)dnl 1152changequote(,)dnl
877 sed_drop_objext='s/\.o$//;s/\.obj$//' 1153 sed_drop_objext='s/\.o$//;s/\.obj$//'
878 sed_dirname1='s,//*,/,g' 1154 sed_dirname1='s,//*,/,g'
879 sed_dirname2='s,\(.\)/$,\1,' 1155 sed_dirname2='s,\(.\)/$,\1,'
880 sed_dirname3='s,^[^/]*$,.,' 1156 sed_dirname3='s,[^/]*$,,'
881 sed_dirname4='s,\(.\)/[^/]*$,\1,'
882 sed_basename1='s,.*/,,' 1157 sed_basename1='s,.*/,,'
883changequote([, ])dnl 1158changequote([, ])dnl
884 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1159 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
885 gl_libobjs="$gl_libobjs $i.$ac_objext" 1160 gl_libobjs="$gl_libobjs $i.$ac_objext"
886 gl_ltlibobjs="$gl_ltlibobjs $i.lo" 1161 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
887 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1162 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
888 i_base=`echo "$i" | sed -e "$sed_basename1"` 1163 i_base=`echo "$i" | sed -e "$sed_basename1"`
889 gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1164 gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1165 gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1166 gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1167 gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
890 done 1168 done
891 fi 1169 fi
892 AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) 1170 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
893 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) 1171 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
894 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) 1172 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps])
1173 AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs])
1174 AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs])
1175 AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps])
895 ]) 1176 ])
896 gltests_libdeps= 1177 gltests_libdeps=
897 gltests_ltlibdeps= 1178 gltests_ltlibdeps=
@@ -934,27 +1215,35 @@ changequote([, ])dnl
934 gltests_libobjs= 1215 gltests_libobjs=
935 gltests_ltlibobjs= 1216 gltests_ltlibobjs=
936 gltests_libobjdeps= 1217 gltests_libobjdeps=
1218 gltests_libgnu_libobjs=
1219 gltests_libgnu_ltlibobjs=
1220 gltests_libgnu_libobjdeps=
937 if test -n "$gltests_LIBOBJS"; then 1221 if test -n "$gltests_LIBOBJS"; then
938 # Remove the extension. 1222 # Remove the extension.
939changequote(,)dnl 1223changequote(,)dnl
940 sed_drop_objext='s/\.o$//;s/\.obj$//' 1224 sed_drop_objext='s/\.o$//;s/\.obj$//'
941 sed_dirname1='s,//*,/,g' 1225 sed_dirname1='s,//*,/,g'
942 sed_dirname2='s,\(.\)/$,\1,' 1226 sed_dirname2='s,\(.\)/$,\1,'
943 sed_dirname3='s,^[^/]*$,.,' 1227 sed_dirname3='s,[^/]*$,,'
944 sed_dirname4='s,\(.\)/[^/]*$,\1,'
945 sed_basename1='s,.*/,,' 1228 sed_basename1='s,.*/,,'
946changequote([, ])dnl 1229changequote([, ])dnl
947 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1230 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
948 gltests_libobjs="$gltests_libobjs $i.$ac_objext" 1231 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
949 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" 1232 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
950 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1233 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
951 i_base=`echo "$i" | sed -e "$sed_basename1"` 1234 i_base=`echo "$i" | sed -e "$sed_basename1"`
952 gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1235 gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1236 gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1237 gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1238 gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
953 done 1239 done
954 fi 1240 fi
955 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) 1241 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
956 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) 1242 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
957 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) 1243 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps])
1244 AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs])
1245 AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs])
1246 AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps])
958 ]) 1247 ])
959 AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) 1248 AC_REQUIRE([gl_CC_GNULIB_WARNINGS])
960 LIBGNU_LIBDEPS="$gl_libdeps" 1249 LIBGNU_LIBDEPS="$gl_libdeps"
@@ -1025,6 +1314,7 @@ AC_DEFUN([gl_FILE_LIST], [
1025 lib/af_alg.h 1314 lib/af_alg.h
1026 lib/alloca.in.h 1315 lib/alloca.in.h
1027 lib/arg-nonnull.h 1316 lib/arg-nonnull.h
1317 lib/arpa_inet.c
1028 lib/arpa_inet.in.h 1318 lib/arpa_inet.in.h
1029 lib/asnprintf.c 1319 lib/asnprintf.c
1030 lib/asprintf.c 1320 lib/asprintf.c
@@ -1036,8 +1326,27 @@ AC_DEFUN([gl_FILE_LIST], [
1036 lib/basename-lgpl.h 1326 lib/basename-lgpl.h
1037 lib/basename.c 1327 lib/basename.c
1038 lib/btowc.c 1328 lib/btowc.c
1329 lib/byteswap.c
1039 lib/byteswap.in.h 1330 lib/byteswap.in.h
1040 lib/c++defs.h 1331 lib/c++defs.h
1332 lib/c-ctype.c
1333 lib/c-ctype.h
1334 lib/c32is-impl.h
1335 lib/c32isalnum.c
1336 lib/c32isalpha.c
1337 lib/c32isblank.c
1338 lib/c32iscntrl.c
1339 lib/c32isdigit.c
1340 lib/c32isgraph.c
1341 lib/c32islower.c
1342 lib/c32isprint.c
1343 lib/c32ispunct.c
1344 lib/c32isspace.c
1345 lib/c32isupper.c
1346 lib/c32isxdigit.c
1347 lib/c32to-impl.h
1348 lib/c32tolower.c
1349 lib/c32width.c
1041 lib/calloc.c 1350 lib/calloc.c
1042 lib/cdefs.h 1351 lib/cdefs.h
1043 lib/cloexec.c 1352 lib/cloexec.c
@@ -1071,6 +1380,8 @@ AC_DEFUN([gl_FILE_LIST], [
1071 lib/free.c 1380 lib/free.c
1072 lib/fseek.c 1381 lib/fseek.c
1073 lib/fseeko.c 1382 lib/fseeko.c
1383 lib/fseterr.c
1384 lib/fseterr.h
1074 lib/fstat.c 1385 lib/fstat.c
1075 lib/fsusage.c 1386 lib/fsusage.c
1076 lib/fsusage.h 1387 lib/fsusage.h
@@ -1098,6 +1409,8 @@ AC_DEFUN([gl_FILE_LIST], [
1098 lib/gl_openssl.h 1409 lib/gl_openssl.h
1099 lib/glthread/lock.c 1410 lib/glthread/lock.c
1100 lib/glthread/lock.h 1411 lib/glthread/lock.h
1412 lib/glthread/once.c
1413 lib/glthread/once.h
1101 lib/glthread/threadlib.c 1414 lib/glthread/threadlib.c
1102 lib/hard-locale.c 1415 lib/hard-locale.c
1103 lib/hard-locale.h 1416 lib/hard-locale.h
@@ -1107,6 +1420,7 @@ AC_DEFUN([gl_FILE_LIST], [
1107 lib/idpriv.h 1420 lib/idpriv.h
1108 lib/idx.h 1421 lib/idx.h
1109 lib/inet_ntop.c 1422 lib/inet_ntop.c
1423 lib/inet_pton.c
1110 lib/intprops-internal.h 1424 lib/intprops-internal.h
1111 lib/intprops.h 1425 lib/intprops.h
1112 lib/inttypes.in.h 1426 lib/inttypes.in.h
@@ -1127,6 +1441,7 @@ AC_DEFUN([gl_FILE_LIST], [
1127 lib/locale.in.h 1441 lib/locale.in.h
1128 lib/localeconv.c 1442 lib/localeconv.c
1129 lib/lseek.c 1443 lib/lseek.c
1444 lib/lstat.c
1130 lib/malloc.c 1445 lib/malloc.c
1131 lib/malloc/dynarray-skeleton.c 1446 lib/malloc/dynarray-skeleton.c
1132 lib/malloc/dynarray.h 1447 lib/malloc/dynarray.h
@@ -1139,10 +1454,16 @@ AC_DEFUN([gl_FILE_LIST], [
1139 lib/malloca.h 1454 lib/malloca.h
1140 lib/math.c 1455 lib/math.c
1141 lib/math.in.h 1456 lib/math.in.h
1457 lib/mbchar.c
1458 lib/mbchar.h
1459 lib/mbiterf.c
1460 lib/mbiterf.h
1461 lib/mbrtoc32.c
1142 lib/mbrtowc-impl-utf8.h 1462 lib/mbrtowc-impl-utf8.h
1143 lib/mbrtowc-impl.h 1463 lib/mbrtowc-impl.h
1144 lib/mbrtowc.c 1464 lib/mbrtowc.c
1145 lib/mbsinit.c 1465 lib/mbsinit.c
1466 lib/mbsnlen.c
1146 lib/mbszero.c 1467 lib/mbszero.c
1147 lib/mbtowc-impl.h 1468 lib/mbtowc-impl.h
1148 lib/mbtowc-lock.c 1469 lib/mbtowc-lock.c
@@ -1169,6 +1490,8 @@ AC_DEFUN([gl_FILE_LIST], [
1169 lib/printf-args.h 1490 lib/printf-args.h
1170 lib/printf-parse.c 1491 lib/printf-parse.c
1171 lib/printf-parse.h 1492 lib/printf-parse.h
1493 lib/pthread-once.c
1494 lib/pthread.in.h
1172 lib/realloc.c 1495 lib/realloc.c
1173 lib/reallocarray.c 1496 lib/reallocarray.c
1174 lib/regcomp.c 1497 lib/regcomp.c
@@ -1177,6 +1500,7 @@ AC_DEFUN([gl_FILE_LIST], [
1177 lib/regex_internal.c 1500 lib/regex_internal.c
1178 lib/regex_internal.h 1501 lib/regex_internal.h
1179 lib/regexec.c 1502 lib/regexec.c
1503 lib/sched.in.h
1180 lib/setenv.c 1504 lib/setenv.c
1181 lib/setlocale-lock.c 1505 lib/setlocale-lock.c
1182 lib/setlocale_null-unlocked.c 1506 lib/setlocale_null-unlocked.c
@@ -1197,10 +1521,12 @@ AC_DEFUN([gl_FILE_LIST], [
1197 lib/stdckdint.in.h 1521 lib/stdckdint.in.h
1198 lib/stddef.in.h 1522 lib/stddef.in.h
1199 lib/stdint.in.h 1523 lib/stdint.in.h
1524 lib/stdio-consolesafe.c
1200 lib/stdio-impl.h 1525 lib/stdio-impl.h
1201 lib/stdio-read.c 1526 lib/stdio-read.c
1202 lib/stdio-write.c 1527 lib/stdio-write.c
1203 lib/stdio.in.h 1528 lib/stdio.in.h
1529 lib/stdlib.c
1204 lib/stdlib.in.h 1530 lib/stdlib.in.h
1205 lib/str-two-way.h 1531 lib/str-two-way.h
1206 lib/strcasecmp.c 1532 lib/strcasecmp.c
@@ -1213,6 +1539,7 @@ AC_DEFUN([gl_FILE_LIST], [
1213 lib/strings.in.h 1539 lib/strings.in.h
1214 lib/stripslash.c 1540 lib/stripslash.c
1215 lib/strncasecmp.c 1541 lib/strncasecmp.c
1542 lib/strncpy.c
1216 lib/strsep.c 1543 lib/strsep.c
1217 lib/strstr.c 1544 lib/strstr.c
1218 lib/sys-limits.h 1545 lib/sys-limits.h
@@ -1224,8 +1551,46 @@ AC_DEFUN([gl_FILE_LIST], [
1224 lib/time.in.h 1551 lib/time.in.h
1225 lib/time_r.c 1552 lib/time_r.c
1226 lib/timegm.c 1553 lib/timegm.c
1554 lib/uchar.in.h
1555 lib/unicase.in.h
1556 lib/unicase/simple-mapping.h
1557 lib/unicase/tolower.c
1558 lib/unicase/tolower.h
1559 lib/unictype.in.h
1560 lib/unictype/bitmap.h
1561 lib/unictype/ctype_alnum.c
1562 lib/unictype/ctype_alnum.h
1563 lib/unictype/ctype_alpha.c
1564 lib/unictype/ctype_alpha.h
1565 lib/unictype/ctype_blank.c
1566 lib/unictype/ctype_blank.h
1567 lib/unictype/ctype_cntrl.c
1568 lib/unictype/ctype_cntrl.h
1569 lib/unictype/ctype_digit.c
1570 lib/unictype/ctype_digit.h
1571 lib/unictype/ctype_graph.c
1572 lib/unictype/ctype_graph.h
1573 lib/unictype/ctype_lower.c
1574 lib/unictype/ctype_lower.h
1575 lib/unictype/ctype_print.c
1576 lib/unictype/ctype_print.h
1577 lib/unictype/ctype_punct.c
1578 lib/unictype/ctype_punct.h
1579 lib/unictype/ctype_space.c
1580 lib/unictype/ctype_space.h
1581 lib/unictype/ctype_upper.c
1582 lib/unictype/ctype_upper.h
1583 lib/unictype/ctype_xdigit.c
1584 lib/unictype/ctype_xdigit.h
1585 lib/uninorm.in.h
1227 lib/unistd.c 1586 lib/unistd.c
1228 lib/unistd.in.h 1587 lib/unistd.in.h
1588 lib/unitypes.in.h
1589 lib/uniwidth.in.h
1590 lib/uniwidth/cjk.h
1591 lib/uniwidth/width.c
1592 lib/uniwidth/width0.h
1593 lib/uniwidth/width2.h
1229 lib/unlocked-io.h 1594 lib/unlocked-io.h
1230 lib/unsetenv.c 1595 lib/unsetenv.c
1231 lib/vasnprintf.c 1596 lib/vasnprintf.c
@@ -1233,6 +1598,7 @@ AC_DEFUN([gl_FILE_LIST], [
1233 lib/vasprintf.c 1598 lib/vasprintf.c
1234 lib/verify.h 1599 lib/verify.h
1235 lib/vsnprintf.c 1600 lib/vsnprintf.c
1601 lib/vsnzprintf.c
1236 lib/w32sock.h 1602 lib/w32sock.h
1237 lib/warn-on-use.h 1603 lib/warn-on-use.h
1238 lib/wchar.in.h 1604 lib/wchar.in.h
@@ -1241,6 +1607,7 @@ AC_DEFUN([gl_FILE_LIST], [
1241 lib/wctype-impl.h 1607 lib/wctype-impl.h
1242 lib/wctype.c 1608 lib/wctype.c
1243 lib/wctype.in.h 1609 lib/wctype.in.h
1610 lib/wcwidth.c
1244 lib/windows-initguard.h 1611 lib/windows-initguard.h
1245 lib/windows-mutex.c 1612 lib/windows-mutex.c
1246 lib/windows-mutex.h 1613 lib/windows-mutex.h
@@ -1265,20 +1632,22 @@ AC_DEFUN([gl_FILE_LIST], [
1265 m4/assert_h.m4 1632 m4/assert_h.m4
1266 m4/base64.m4 1633 m4/base64.m4
1267 m4/btowc.m4 1634 m4/btowc.m4
1635 m4/build-to-host.m4
1268 m4/builtin-expect.m4 1636 m4/builtin-expect.m4
1269 m4/byteswap.m4 1637 m4/byteswap.m4
1270 m4/c-bool.m4 1638 m4/c-bool.m4
1639 m4/c32rtomb.m4
1271 m4/calloc.m4 1640 m4/calloc.m4
1272 m4/close.m4 1641 m4/close.m4
1273 m4/codeset.m4 1642 m4/codeset.m4
1274 m4/double-slash-root.m4 1643 m4/double-slash-root.m4
1275 m4/dup2.m4 1644 m4/dup2.m4
1276 m4/eealloc.m4
1277 m4/environ.m4 1645 m4/environ.m4
1278 m4/errno_h.m4 1646 m4/errno_h.m4
1279 m4/error.m4 1647 m4/error.m4
1280 m4/error_h.m4 1648 m4/error_h.m4
1281 m4/exponentd.m4 1649 m4/exponentd.m4
1650 m4/extensions-aix.m4
1282 m4/extensions.m4 1651 m4/extensions.m4
1283 m4/extern-inline.m4 1652 m4/extern-inline.m4
1284 m4/fclose.m4 1653 m4/fclose.m4
@@ -1294,6 +1663,7 @@ AC_DEFUN([gl_FILE_LIST], [
1294 m4/free.m4 1663 m4/free.m4
1295 m4/fseek.m4 1664 m4/fseek.m4
1296 m4/fseeko.m4 1665 m4/fseeko.m4
1666 m4/fseterr.m4
1297 m4/fstat.m4 1667 m4/fstat.m4
1298 m4/fstypename.m4 1668 m4/fstypename.m4
1299 m4/fsusage.m4 1669 m4/fsusage.m4
@@ -1309,10 +1679,12 @@ AC_DEFUN([gl_FILE_LIST], [
1309 m4/getprogname.m4 1679 m4/getprogname.m4
1310 m4/gl-openssl.m4 1680 m4/gl-openssl.m4
1311 m4/gnulib-common.m4 1681 m4/gnulib-common.m4
1682 m4/gnulib-i18n.m4
1312 m4/hostent.m4 1683 m4/hostent.m4
1313 m4/idpriv.m4 1684 m4/idpriv.m4
1314 m4/include_next.m4 1685 m4/include_next.m4
1315 m4/inet_ntop.m4 1686 m4/inet_ntop.m4
1687 m4/inet_pton.m4
1316 m4/intmax_t.m4 1688 m4/intmax_t.m4
1317 m4/inttypes.m4 1689 m4/inttypes.m4
1318 m4/inttypes_h.m4 1690 m4/inttypes_h.m4
@@ -1323,8 +1695,10 @@ AC_DEFUN([gl_FILE_LIST], [
1323 m4/iswxdigit.m4 1695 m4/iswxdigit.m4
1324 m4/langinfo_h.m4 1696 m4/langinfo_h.m4
1325 m4/largefile.m4 1697 m4/largefile.m4
1698 m4/libunistring-base.m4
1326 m4/limits-h.m4 1699 m4/limits-h.m4
1327 m4/localcharset.m4 1700 m4/localcharset.m4
1701 m4/locale-en.m4
1328 m4/locale-fr.m4 1702 m4/locale-fr.m4
1329 m4/locale-ja.m4 1703 m4/locale-ja.m4
1330 m4/locale-zh.m4 1704 m4/locale-zh.m4
@@ -1332,9 +1706,13 @@ AC_DEFUN([gl_FILE_LIST], [
1332 m4/localeconv.m4 1706 m4/localeconv.m4
1333 m4/lock.m4 1707 m4/lock.m4
1334 m4/lseek.m4 1708 m4/lseek.m4
1709 m4/lstat.m4
1335 m4/malloc.m4 1710 m4/malloc.m4
1336 m4/malloca.m4 1711 m4/malloca.m4
1337 m4/math_h.m4 1712 m4/math_h.m4
1713 m4/mbchar.m4
1714 m4/mbiter.m4
1715 m4/mbrtoc32.m4
1338 m4/mbrtowc.m4 1716 m4/mbrtowc.m4
1339 m4/mbsinit.m4 1717 m4/mbsinit.m4
1340 m4/mbstate_t.m4 1718 m4/mbstate_t.m4
@@ -1353,17 +1731,23 @@ AC_DEFUN([gl_FILE_LIST], [
1353 m4/netinet_in_h.m4 1731 m4/netinet_in_h.m4
1354 m4/nl_langinfo.m4 1732 m4/nl_langinfo.m4
1355 m4/nocrash.m4 1733 m4/nocrash.m4
1734 m4/off64_t.m4
1356 m4/off_t.m4 1735 m4/off_t.m4
1736 m4/once.m4
1357 m4/open-cloexec.m4 1737 m4/open-cloexec.m4
1358 m4/open-slash.m4 1738 m4/open-slash.m4
1359 m4/open.m4 1739 m4/open.m4
1360 m4/pathmax.m4 1740 m4/pathmax.m4
1361 m4/pid_t.m4 1741 m4/pid_t.m4
1362 m4/printf.m4 1742 m4/printf.m4
1743 m4/pthread-once.m4
1744 m4/pthread-spin.m4
1745 m4/pthread_h.m4
1363 m4/pthread_rwlock_rdlock.m4 1746 m4/pthread_rwlock_rdlock.m4
1364 m4/realloc.m4 1747 m4/realloc.m4
1365 m4/reallocarray.m4 1748 m4/reallocarray.m4
1366 m4/regex.m4 1749 m4/regex.m4
1750 m4/sched_h.m4
1367 m4/servent.m4 1751 m4/servent.m4
1368 m4/setenv.m4 1752 m4/setenv.m4
1369 m4/setlocale_null.m4 1753 m4/setlocale_null.m4
@@ -1379,18 +1763,22 @@ AC_DEFUN([gl_FILE_LIST], [
1379 m4/stat.m4 1763 m4/stat.m4
1380 m4/std-gnu11.m4 1764 m4/std-gnu11.m4
1381 m4/stdalign.m4 1765 m4/stdalign.m4
1766 m4/stdckdint_h.m4
1382 m4/stddef_h.m4 1767 m4/stddef_h.m4
1383 m4/stdint.m4 1768 m4/stdint.m4
1384 m4/stdint_h.m4 1769 m4/stdint_h.m4
1385 m4/stdio_h.m4 1770 m4/stdio_h.m4
1386 m4/stdlib_h.m4 1771 m4/stdlib_h.m4
1387 m4/strcase.m4 1772 m4/strcasecmp.m4
1388 m4/strcasestr.m4 1773 m4/strcasestr.m4
1389 m4/strerror.m4 1774 m4/strerror.m4
1390 m4/string_h.m4 1775 m4/string_h.m4
1391 m4/strings_h.m4 1776 m4/strings_h.m4
1777 m4/strncasecmp.m4
1778 m4/strncpy.m4
1392 m4/strsep.m4 1779 m4/strsep.m4
1393 m4/strstr.m4 1780 m4/strstr.m4
1781 m4/sys_cdefs_h.m4
1394 m4/sys_socket_h.m4 1782 m4/sys_socket_h.m4
1395 m4/sys_stat_h.m4 1783 m4/sys_stat_h.m4
1396 m4/sys_types_h.m4 1784 m4/sys_types_h.m4
@@ -1399,8 +1787,13 @@ AC_DEFUN([gl_FILE_LIST], [
1399 m4/time_h.m4 1787 m4/time_h.m4
1400 m4/time_r.m4 1788 m4/time_r.m4
1401 m4/timegm.m4 1789 m4/timegm.m4
1790 m4/uchar_h.m4
1402 m4/ungetc.m4 1791 m4/ungetc.m4
1792 m4/unicase_h.m4
1793 m4/unictype_h.m4
1794 m4/uninorm_h.m4
1403 m4/unistd_h.m4 1795 m4/unistd_h.m4
1796 m4/unitypes_h.m4
1404 m4/unlocked-io.m4 1797 m4/unlocked-io.m4
1405 m4/vararrays.m4 1798 m4/vararrays.m4
1406 m4/vasnprintf.m4 1799 m4/vasnprintf.m4
@@ -1409,10 +1802,10 @@ AC_DEFUN([gl_FILE_LIST], [
1409 m4/vsnprintf.m4 1802 m4/vsnprintf.m4
1410 m4/warn-on-use.m4 1803 m4/warn-on-use.m4
1411 m4/wchar_h.m4 1804 m4/wchar_h.m4
1412 m4/wchar_t.m4
1413 m4/wcrtomb.m4 1805 m4/wcrtomb.m4
1414 m4/wctype.m4 1806 m4/wctype.m4
1415 m4/wctype_h.m4 1807 m4/wctype_h.m4
1808 m4/wcwidth.m4
1416 m4/wint_t.m4 1809 m4/wint_t.m4
1417 m4/xalloc.m4 1810 m4/xalloc.m4
1418 m4/xsize.m4 1811 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 @@
1# gnulib-i18n.m4
2# serial 1
3dnl Copyright (C) 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11dnl Support for internationalization of Gnulib code.
12
13dnl GNULIB_I18N
14dnl Sets GNULIB_LOCALEDIR to indicate where to find the gnulib.mo files.
15dnl Also it defines GNULIB_LOCALEDIR as macro in config.h, that expands to
16dnl the corresponding C string.
17AC_DEFUN([GNULIB_I18N],
18[
19 dnl It is best to not test "$USE_NLS" here, because: It would be empty
20 dnl in case the package is internationalized but this macro is used before
21 dnl AM_GNU_GETTEXT. We would need to warn about this situation. But since
22 dnl this module is used as a dependency of many packages, such a warning is
23 dnl not welcome.
24
25 dnl Determine gnulib's localedir.
26 dnl Generally, accept an option --with-gnulib-prefix=PREFIX to indicate
27 dnl where to find gnulib's runtime data.
28 dnl Usually ${prefix}/share/locale, but can be influenced by the configure
29 dnl options --datarootdir and --localedir.
30 GNULIB_LOCALEDIR="${localedir}"
31 AC_ARG_WITH([gnulib-prefix],
32 [[ --with-gnulib-prefix=DIR search for gnulib's runtime data in DIR/share]],
33 [if test "X$withval" != "X" && test "X$withval" != "Xno"; then
34 GNULIB_LOCALEDIR="$withval/share/locale"
35 fi
36 ])
37 AC_SUBST([GNULIB_LOCALEDIR])
38
39 dnl Define GNULIB_LOCALEDIR_c and GNULIB_LOCALEDIR_c_make.
40 dnl Find the final value of GNULIB_LOCALEDIR.
41 gl_saved_prefix="${prefix}"
42 gl_saved_datarootdir="${datarootdir}"
43 gl_saved_localedir="${localedir}"
44 gl_saved_gnuliblocaledir="${GNULIB_LOCALEDIR}"
45 dnl Unfortunately, prefix gets only finally determined at the end of
46 dnl configure.
47 if test "X$prefix" = "XNONE"; then
48 prefix="$ac_default_prefix"
49 fi
50 eval datarootdir="$datarootdir"
51 eval localedir="$localedir"
52 eval GNULIB_LOCALEDIR="$GNULIB_LOCALEDIR"
53 gl_BUILD_TO_HOST([GNULIB_LOCALEDIR])
54 GNULIB_LOCALEDIR="${gl_saved_gnuliblocaledir}"
55 localedir="${gl_saved_localedir}"
56 datarootdir="${gl_saved_datarootdir}"
57 prefix="${gl_saved_prefix}"
58
59 AC_DEFINE_UNQUOTED([GNULIB_LOCALEDIR], [${GNULIB_LOCALEDIR_c}],
60 [Define to the directory where to find the localizations of the translation domain 'gnulib', as a C string.])
61])
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 @@
1# gnulib-tool.m4 1# gnulib-tool.m4
2# serial 4 2# serial 5
3dnl Copyright (C) 2004-2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2005, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl The following macros need not be invoked explicitly. 9dnl The following macros need not be invoked explicitly.
9dnl Invoking them does nothing except to declare default arguments 10dnl Invoking them does nothing except to declare default arguments
@@ -42,6 +43,9 @@ AC_DEFUN([gl_LIB], [])
42dnl Usage: gl_LGPL or gl_LGPL([VERSION]) 43dnl Usage: gl_LGPL or gl_LGPL([VERSION])
43AC_DEFUN([gl_LGPL], []) 44AC_DEFUN([gl_LGPL], [])
44 45
46dnl Usage: gl_GPL([VERSION])
47AC_DEFUN([gl_GPL], [])
48
45dnl Usage: gl_MAKEFILE_NAME([FILENAME]) 49dnl Usage: gl_MAKEFILE_NAME([FILENAME])
46AC_DEFUN([gl_MAKEFILE_NAME], []) 50AC_DEFUN([gl_MAKEFILE_NAME], [])
47 51
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 @@
1# hostent.m4 1# hostent.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_HOSTENT], 9AC_DEFUN([gl_HOSTENT],
9[ 10[
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 @@
1# idpriv.m4 1# idpriv.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_IDPRIV], 9AC_DEFUN([gl_IDPRIV],
9[ 10[
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 @@
1# include_next.m4 1# include_next.m4
2# serial 27 2# serial 27
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert and Derek Price. 9dnl From Paul Eggert and Derek Price.
9 10
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 @@
1# inet_ntop.m4 1# inet_ntop.m4
2# serial 22 2# serial 22
3dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_INET_NTOP], 9AC_DEFUN([gl_FUNC_INET_NTOP],
9[ 10[
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 @@
1# inet_pton.m4
2# serial 20
3dnl Copyright (C) 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_INET_PTON],
10[
11 AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
12
13 dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15
16 AC_REQUIRE([AC_C_RESTRICT])
17
18 dnl Most platforms that provide inet_pton define it in libc.
19 dnl Solaris 8..10 provide inet_pton in libnsl instead.
20 dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
21 dnl Haiku provides it in -lnetwork.
22 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
23 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
24 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
25 HAVE_INET_PTON=1
26 INET_PTON_LIB=
27 gl_PREREQ_SYS_H_WINSOCK2
28 if test $HAVE_WINSOCK2_H = 1; then
29 dnl It needs to be overridden, because the stdcall calling convention
30 dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid
31 dnl a name conflict at the linker level, even though the header file
32 dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
33 REPLACE_INET_PTON=1
34 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
35 if test $ac_cv_have_decl_inet_pton = yes; then
36 INET_PTON_LIB="-lws2_32"
37 else
38 HAVE_DECL_INET_PTON=0
39 fi
40 else
41 gl_saved_LIBS=$LIBS
42 AC_SEARCH_LIBS([inet_pton], [nsl resolv network], [],
43 [AC_CHECK_FUNCS([inet_pton])
44 if test $ac_cv_func_inet_pton = no; then
45 HAVE_INET_PTON=0
46 fi
47 ])
48 LIBS=$gl_saved_LIBS
49
50 if test "$ac_cv_search_inet_pton" != "no" \
51 && test "$ac_cv_search_inet_pton" != "none required"; then
52 INET_PTON_LIB="$ac_cv_search_inet_pton"
53 fi
54
55 AC_CHECK_HEADERS_ONCE([netdb.h])
56 AC_CHECK_DECLS([inet_pton],,,
57 [[#include <arpa/inet.h>
58 #if HAVE_NETDB_H
59 # include <netdb.h>
60 #endif
61 ]])
62 if test $ac_cv_have_decl_inet_pton = no; then
63 HAVE_DECL_INET_PTON=0
64 fi
65 fi
66 AC_SUBST([INET_PTON_LIB])
67])
68
69# Prerequisites of lib/inet_pton.c.
70AC_DEFUN([gl_PREREQ_INET_PTON], [
71 AC_REQUIRE([gl_SOCKET_FAMILIES])
72])
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 @@
1# intmax_t.m4 1# intmax_t.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 1997-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 1997-2004, 2006-2007, 2009-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9dnl From Paul Eggert. 10dnl From Paul Eggert.
10 11
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 @@
1# inttypes.m4 1# inttypes.m4
2# serial 37 2# serial 37
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Derek Price, Bruno Haible. 9dnl From Derek Price, Bruno Haible.
9dnl Test whether <inttypes.h> is supported or must be substituted. 10dnl Test whether <inttypes.h> 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 @@
1# inttypes_h.m4 1# inttypes_h.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
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 @@
1# iswblank.m4 1# iswblank.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWBLANK], 9AC_DEFUN([gl_FUNC_ISWBLANK],
9[ 10[
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 @@
1# iswctype.m4 1# iswctype.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWCTYPE], 9AC_DEFUN([gl_FUNC_ISWCTYPE],
9[ 10[
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 @@
1# iswdigit.m4 1# iswdigit.m4
2# serial 7 2# serial 9
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWDIGIT], 9AC_DEFUN([gl_FUNC_ISWDIGIT],
9[ 10[
@@ -11,7 +12,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT],
11 AC_REQUIRE([gl_WCTYPE_H]) 12 AC_REQUIRE([gl_WCTYPE_H])
12 AC_REQUIRE([gt_LOCALE_FR]) 13 AC_REQUIRE([gt_LOCALE_FR])
13 AC_REQUIRE([gt_LOCALE_JA]) 14 AC_REQUIRE([gt_LOCALE_JA])
14 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 15 AC_REQUIRE([gt_LOCALE_EN_UTF8])
15 AC_REQUIRE([gt_LOCALE_ZH_CN]) 16 AC_REQUIRE([gt_LOCALE_ZH_CN])
16 AC_REQUIRE([AC_CANONICAL_HOST]) 17 AC_REQUIRE([AC_CANONICAL_HOST])
17 18
@@ -26,14 +27,14 @@ AC_DEFUN([gl_FUNC_ISWDIGIT],
26 dnl is present. 27 dnl is present.
27changequote(,)dnl 28changequote(,)dnl
28 case "$host_os" in 29 case "$host_os" in
29 # Guess no on FreeBSD, NetBSD, Solaris, native Windows. 30 # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
30 freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) 31 freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
31 gl_cv_func_iswdigit_works="guessing no" ;; 32 gl_cv_func_iswdigit_works="guessing no" ;;
32 # Guess yes otherwise. 33 # Guess yes otherwise.
33 *) gl_cv_func_iswdigit_works="guessing yes" ;; 34 *) gl_cv_func_iswdigit_works="guessing yes" ;;
34 esac 35 esac
35changequote([,])dnl 36changequote([,])dnl
36 if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then 37 if test $LOCALE_FR != none || test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then
37 AC_RUN_IFELSE( 38 AC_RUN_IFELSE(
38 [AC_LANG_SOURCE([[ 39 [AC_LANG_SOURCE([[
39#include <locale.h> 40#include <locale.h>
@@ -83,15 +84,15 @@ main (int argc, char *argv[])
83 if (!(is == 0)) 84 if (!(is == 0))
84 result |= 2; 85 result |= 2;
85 } 86 }
86 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 87 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
87 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 88 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
88 { 89 {
89 /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ 90 /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
90 /* U+0663 ARABIC-INDIC DIGIT THREE */ 91 /* U+0663 ARABIC-INDIC DIGIT THREE */
91 is = for_character ("\331\243", 2); 92 is = for_character ("\331\243", 2);
92 if (!(is == 0)) 93 if (!(is == 0))
93 result |= 4; 94 result |= 4;
94 /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14. */ 95 /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
95 /* U+FF11 FULLWIDTH DIGIT ONE */ 96 /* U+FF11 FULLWIDTH DIGIT ONE */
96 is = for_character ("\357\274\221", 3); 97 is = for_character ("\357\274\221", 3);
97 if (!(is == 0)) 98 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 @@
1# iswpunct.m4 1# iswpunct.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2023-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWPUNCT], 9AC_DEFUN([gl_FUNC_ISWPUNCT],
9[ 10[
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 @@
1# iswxdigit.m4 1# iswxdigit.m4
2# serial 7 2# serial 9
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_ISWXDIGIT], 9AC_DEFUN([gl_FUNC_ISWXDIGIT],
9[ 10[
10 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS]) 11 AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
11 AC_REQUIRE([gl_WCTYPE_H]) 12 AC_REQUIRE([gl_WCTYPE_H])
12 AC_REQUIRE([gt_LOCALE_JA]) 13 AC_REQUIRE([gt_LOCALE_JA])
13 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 14 AC_REQUIRE([gt_LOCALE_EN_UTF8])
14 AC_REQUIRE([gt_LOCALE_ZH_CN]) 15 AC_REQUIRE([gt_LOCALE_ZH_CN])
15 AC_REQUIRE([AC_CANONICAL_HOST]) 16 AC_REQUIRE([AC_CANONICAL_HOST])
16 17
@@ -25,14 +26,14 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT],
25 dnl is present. 26 dnl is present.
26changequote(,)dnl 27changequote(,)dnl
27 case "$host_os" in 28 case "$host_os" in
28 # Guess no on FreeBSD, NetBSD, Solaris, native Windows. 29 # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
29 freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*) 30 freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
30 gl_cv_func_iswxdigit_works="guessing no" ;; 31 gl_cv_func_iswxdigit_works="guessing no" ;;
31 # Guess yes otherwise. 32 # Guess yes otherwise.
32 *) gl_cv_func_iswxdigit_works="guessing yes" ;; 33 *) gl_cv_func_iswxdigit_works="guessing yes" ;;
33 esac 34 esac
34changequote([,])dnl 35changequote([,])dnl
35 if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then 36 if test $LOCALE_JA != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_ZH_CN != none; then
36 AC_RUN_IFELSE( 37 AC_RUN_IFELSE(
37 [AC_LANG_SOURCE([[ 38 [AC_LANG_SOURCE([[
38#include <locale.h> 39#include <locale.h>
@@ -73,15 +74,15 @@ main (int argc, char *argv[])
73 if (!(is == 0)) 74 if (!(is == 0))
74 result |= 1; 75 result |= 1;
75 } 76 }
76 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 77 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
77 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 78 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
78 { 79 {
79 /* This fails on FreeBSD 13.0. */ 80 /* This fails on FreeBSD 13.0, Haiku, Android. */
80 /* U+0663 ARABIC-INDIC DIGIT THREE */ 81 /* U+0663 ARABIC-INDIC DIGIT THREE */
81 is = for_character ("\331\243", 2); 82 is = for_character ("\331\243", 2);
82 if (!(is == 0)) 83 if (!(is == 0))
83 result |= 2; 84 result |= 2;
84 /* This fails on NetBSD 10.0, MSVC 14. */ 85 /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android. */
85 /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */ 86 /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
86 is = for_character ("\357\274\241", 3); 87 is = for_character ("\357\274\241", 3);
87 if (!(is == 0)) 88 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 @@
1# langinfo_h.m4 1# langinfo_h.m4
2# serial 12 2# serial 13
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_LANGINFO_H], 9AC_DEFUN_ONCE([gl_LANGINFO_H],
9[ 10[
@@ -19,6 +20,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
19 HAVE_LANGINFO_CODESET=0 20 HAVE_LANGINFO_CODESET=0
20 HAVE_LANGINFO_T_FMT_AMPM=0 21 HAVE_LANGINFO_T_FMT_AMPM=0
21 HAVE_LANGINFO_ALTMON=0 22 HAVE_LANGINFO_ALTMON=0
23 HAVE_LANGINFO_ABALTMON=0
22 HAVE_LANGINFO_ERA=0 24 HAVE_LANGINFO_ERA=0
23 HAVE_LANGINFO_YESEXPR=0 25 HAVE_LANGINFO_YESEXPR=0
24 AC_CHECK_HEADERS_ONCE([langinfo.h]) 26 AC_CHECK_HEADERS_ONCE([langinfo.h])
@@ -29,6 +31,7 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
29 dnl ERA etc. are missing on OpenBSD 6.7. 31 dnl ERA etc. are missing on OpenBSD 6.7.
30 dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3. 32 dnl T_FMT_AMPM and YESEXPR, NOEXPR are missing on IRIX 5.3.
31 dnl ALTMON_* are missing on glibc 2.26 and many other systems. 33 dnl ALTMON_* are missing on glibc 2.26 and many other systems.
34 dnl ABALTMON_* are missing on glibc 2.41 and many other systems.
32 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 35 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
33 [gl_cv_header_langinfo_codeset], 36 [gl_cv_header_langinfo_codeset],
34 [AC_COMPILE_IFELSE( 37 [AC_COMPILE_IFELSE(
@@ -65,6 +68,18 @@ int a = ALTMON_1;
65 if test $gl_cv_header_langinfo_altmon = yes; then 68 if test $gl_cv_header_langinfo_altmon = yes; then
66 HAVE_LANGINFO_ALTMON=1 69 HAVE_LANGINFO_ALTMON=1
67 fi 70 fi
71 AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1],
72 [gl_cv_header_langinfo_abaltmon],
73 [AC_COMPILE_IFELSE(
74 [AC_LANG_PROGRAM([[#include <langinfo.h>
75int a = ABALTMON_1;
76]])],
77 [gl_cv_header_langinfo_abaltmon=yes],
78 [gl_cv_header_langinfo_abaltmon=no])
79 ])
80 if test $gl_cv_header_langinfo_abaltmon = yes; then
81 HAVE_LANGINFO_ABALTMON=1
82 fi
68 AC_CACHE_CHECK([whether langinfo.h defines ERA], 83 AC_CACHE_CHECK([whether langinfo.h defines ERA],
69 [gl_cv_header_langinfo_era], 84 [gl_cv_header_langinfo_era],
70 [AC_COMPILE_IFELSE( 85 [AC_COMPILE_IFELSE(
@@ -96,6 +111,7 @@ int a = YESEXPR;
96 AC_SUBST([HAVE_LANGINFO_CODESET]) 111 AC_SUBST([HAVE_LANGINFO_CODESET])
97 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM]) 112 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
98 AC_SUBST([HAVE_LANGINFO_ALTMON]) 113 AC_SUBST([HAVE_LANGINFO_ALTMON])
114 AC_SUBST([HAVE_LANGINFO_ABALTMON])
99 AC_SUBST([HAVE_LANGINFO_ERA]) 115 AC_SUBST([HAVE_LANGINFO_ERA])
100 AC_SUBST([HAVE_LANGINFO_YESEXPR]) 116 AC_SUBST([HAVE_LANGINFO_YESEXPR])
101 117
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 @@
1# largefile.m4 1# largefile.m4
2# serial 1 2# serial 2
3dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. 3dnl Copyright 1992-1996, 1998-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Enable large files on systems where this is not the default. 9# Enable large files on systems where this is not the default.
9# Enable support for files on Linux file systems with 64-bit inode numbers. 10# 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(
88# If you change this macro you may also need to change 89# If you change this macro you may also need to change
89# _AC_SYS_YEAR2038_OPTIONS. 90# _AC_SYS_YEAR2038_OPTIONS.
90AC_DEFUN([_AC_SYS_YEAR2038_PROBE], 91AC_DEFUN([_AC_SYS_YEAR2038_PROBE],
91[AC_CACHE_CHECK([for $CPPFLAGS option for timestamps after 2038], 92[AC_CACHE_CHECK([for $CC option to support timestamps after 2038],
92 [ac_cv_sys_year2038_opts], 93 [ac_cv_sys_year2038_opts],
93 [ac_save_CPPFLAGS="$CPPFLAGS" 94 [ac_save_CPPFLAGS="$CPPFLAGS"
94 ac_opt_found=no 95 ac_opt_found=no
@@ -234,7 +235,7 @@ m4_define([_AC_SYS_LARGEFILE_OPTIONS], m4_normalize(
234# If you change this macro you may also need to change 235# If you change this macro you may also need to change
235# _AC_SYS_LARGEFILE_OPTIONS. 236# _AC_SYS_LARGEFILE_OPTIONS.
236AC_DEFUN([_AC_SYS_LARGEFILE_PROBE], 237AC_DEFUN([_AC_SYS_LARGEFILE_PROBE],
237[AC_CACHE_CHECK([for $CPPFLAGS option for large files], 238[AC_CACHE_CHECK([for $CC option to support large files],
238 [ac_cv_sys_largefile_opts], 239 [ac_cv_sys_largefile_opts],
239 [ac_save_CPPFLAGS=$CPPFLAGS 240 [ac_save_CPPFLAGS=$CPPFLAGS
240 ac_opt_found=no 241 ac_opt_found=no
@@ -294,7 +295,7 @@ AC_CONFIG_COMMANDS_PRE([_AC_SYS_YEAR2038_ENABLE])])
294# By default, many hosts won't let programs access large files; 295# By default, many hosts won't let programs access large files;
295# one must use special compiler options to get large-file access to work. 296# one must use special compiler options to get large-file access to work.
296# For more details about this brain damage please see: 297# For more details about this brain damage please see:
297# http://www.unix.org/version2/whatsnew/lfs20mar.html 298# https://www.unix.org/version2/whatsnew/lfs20mar.html
298# Additionally, on Linux file systems with 64-bit inodes a file that happens 299# Additionally, on Linux file systems with 64-bit inodes a file that happens
299# to have a 64-bit inode number cannot be accessed by 32-bit applications on 300# to have a 64-bit inode number cannot be accessed by 32-bit applications on
300# Linux x86/x86_64. This can occur with file systems such as XFS and NFS. 301# 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 @@
1# libunistring-base.m4
2# serial 10
3dnl Copyright (C) 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Paolo Bonzini and Bruno Haible.
10
11dnl gl_LIBUNISTRING_MODULE([VERSION], [Module])
12dnl Declares that the source files of Module should be compiled, unless we
13dnl are linking with libunistring and its version is >= the given VERSION.
14dnl Defines an automake conditional LIBUNISTRING_COMPILE_$MODULE that is
15dnl true if the source files of Module should be compiled.
16dnl This macro is to be used for public libunistring API, not for
17dnl undocumented API.
18dnl
19dnl You have to bump the VERSION argument to the next projected version
20dnl number each time you make a change that affects the behaviour of the
21dnl functions defined in Module (even if the sources of Module itself do not
22dnl change).
23dnl
24dnl This macro invocation must not occur in macros that are AC_REQUIREd.
25
26AC_DEFUN([gl_LIBUNISTRING_MODULE],
27[
28 AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
29 dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
30 dnl gl_LIBUNISTRING_CORE if that macro has been run.
31 gl_CONDITIONAL(AS_TR_CPP([LIBUNISTRING_COMPILE_$2]),
32 [gl_LIBUNISTRING_VERSION_CMP([$1])])
33])
34
35dnl gl_LIBUNISTRING_MODULE_WITH_VARIABLE([VERSION], [Module])
36dnl is like gl_LIBUNISTRING_MODULE([VERSION], [Module]), except that it also
37dnl defines an AC_SUBSTed autoconf variable GNULIB_$MODULE_DLL_VARIABLE.
38dnl What's the expansion of this autoconf variable?
39dnl - When building libunistring, it expands to LIBUNISTRING_DLL_VARIABLE.
40dnl (This is necessary because this token must be present in the .h files
41dnl when the .h files get installed.)
42dnl - When building gnulib or application code it expands to
43dnl - LIBUNISTRING_DLL_VARIABLE by default,
44dnl - if the automake conditional LIBUNISTRING_COMPILE_$MODULE evaluates
45dnl to true: the value of
46dnl ${module_indicator_prefix}_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
47dnl (which usually is empty, unless explicitly set in configure.ac).
48dnl (This is necessary because when the conditional evaluates to false,
49dnl the application code expects to use the declared variable from the
50dnl installed libunistring; it's in this case that the
51dnl LIBUNISTRING_DLL_VARIABLE macro from the installed
52dnl <unistring/woe32dll.h> must be used.)
53dnl
54dnl This macro invocation must not occur in macros that are AC_REQUIREd.
55
56AC_DEFUN([gl_LIBUNISTRING_MODULE_WITH_VARIABLE],
57[
58 gl_LIBUNISTRING_MODULE([$1], [$2])
59 m4_ifndef([gl_IN_LIBUNISTRING],
60 [if test -z "${AS_TR_CPP([LIBUNISTRING_COMPILE_$2])_TRUE}"; then
61 GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]AS_TR_CPP([$2_DLL_VARIABLE])=$GL_MODULE_INDICATOR_PREFIX[]_GNULIB_LIBUNISTRING_DLL_VARIABLE_NAME
62 fi
63 ])
64])
65
66dnl gl_LIBUNISTRING_LIBHEADER([VERSION], [HeaderFile])
67dnl Declares that HeaderFile should be created, unless we are linking
68dnl with libunistring and its version is >= the given VERSION.
69dnl HeaderFile should be relative to the lib directory and end in '.h'.
70dnl Prepares for substituting LIBUNISTRING_HEADERFILE (to HeaderFile or empty).
71dnl
72dnl When we are linking with the already installed libunistring and its version
73dnl is < VERSION, we create HeaderFile here, because we may compile functions
74dnl (via gl_LIBUNISTRING_MODULE above) that are not contained in the installed
75dnl version.
76dnl When we are linking with the already installed libunistring and its version
77dnl is > VERSION, we don't create HeaderFile here: it could cause compilation
78dnl errors in other libunistring header files if some types are missing.
79dnl
80dnl You have to bump the VERSION argument to the next projected version
81dnl number each time you make a non-comment change to the HeaderFile.
82
83AC_DEFUN([gl_LIBUNISTRING_LIBHEADER],
84[
85 AC_REQUIRE([gl_LIBUNISTRING_LIB_PREPARE])
86 dnl Use the variables HAVE_LIBUNISTRING, LIBUNISTRING_VERSION from
87 dnl gl_LIBUNISTRING_CORE if that macro has been run.
88 if gl_LIBUNISTRING_VERSION_CMP([$1]); then
89 dnl It is OK to use a .h file in lib/ from within tests/, but not vice
90 dnl versa.
91 if test -z "$LIBUNISTRING_[]AS_TR_CPP([$2])"; then
92 LIBUNISTRING_[]AS_TR_CPP([$2])="${gl_source_base_prefix}$2"
93 fi
94 else
95 LIBUNISTRING_[]AS_TR_CPP([$2])=
96 fi
97 AC_SUBST([LIBUNISTRING_]AS_TR_CPP([$2]))
98])
99
100dnl Miscellaneous preparations/initializations.
101
102AC_DEFUN([gl_LIBUNISTRING_LIB_PREPARE],
103[
104 dnl Ensure that HAVE_LIBUNISTRING is fully determined at this point.
105 m4_ifdef([gl_LIBUNISTRING], [AC_REQUIRE([gl_LIBUNISTRING])])
106
107 AC_REQUIRE([AC_PROG_AWK])
108
109dnl Sed expressions to extract the parts of a version number.
110changequote(,)
111gl_libunistring_sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;}
112i\
1130
114q
115'
116gl_libunistring_sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;}
117i\
1180
119q
120'
121gl_libunistring_sed_extract_subminor='/^[0-9][0-9]*[.][0-9][0-9]*[.][0-9]/{s/^[0-9]*[.][0-9]*[.]\([0-9]*\).*/\1/p;q;}
122i\
1230
124q
125'
126changequote([,])
127
128 if test "$HAVE_LIBUNISTRING" = yes; then
129 LIBUNISTRING_VERSION_MAJOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_major"`
130 LIBUNISTRING_VERSION_MINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_minor"`
131 LIBUNISTRING_VERSION_SUBMINOR=`echo "$LIBUNISTRING_VERSION" | sed -n -e "$gl_libunistring_sed_extract_subminor"`
132 fi
133
134 dnl Determine whether <unistring/woe32dll.h> from an installed libunistring
135 dnl is available.
136 m4_ifdef([gl_IN_LIBUNISTRING],
137 [dnl In libunistring, all .h files that declare variables need to
138 dnl #include <unistring/woe32dll.h>. This references the file
139 dnl unistring/woe32dll.h in libunistring.
140 HAVE_UNISTRING_WOE32DLL_H=1
141 ],
142 [dnl In gnulib or in applications, we need a #include <unistring/woe32dll.h>
143 dnl if and only if an installed libunistring is available.
144 if test "$HAVE_LIBUNISTRING" = yes; then
145 AC_CHECK_HEADERS([unistring/woe32dll.h],
146 [HAVE_UNISTRING_WOE32DLL_H=1],
147 [HAVE_UNISTRING_WOE32DLL_H=0])
148 else
149 HAVE_UNISTRING_WOE32DLL_H=0
150 fi
151 ])
152 AC_SUBST([HAVE_UNISTRING_WOE32DLL_H])
153])
154
155dnl gl_LIBUNISTRING_VERSION_CMP([VERSION])
156dnl Expands to a shell statement that evaluates to true if LIBUNISTRING_VERSION
157dnl is less than the VERSION argument.
158AC_DEFUN([gl_LIBUNISTRING_VERSION_CMP],
159[dnl VERSION = 999.9 means to evaluates to true always, i.e. to ignore
160dnl the installed libunistring regardless of its version.
161m4_if([$1], [999.9],
162[true],
163[ { test "$HAVE_LIBUNISTRING" != yes \
164 || {
165 dnl AS_LITERAL_IF exists and works fine since autoconf-2.59 at least.
166 AS_LITERAL_IF([$1],
167 [dnl This is the optimized variant, that assumes the argument is a literal:
168 m4_pushdef([requested_version_major],
169 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^\([0-9]*\).*], [\1]), [])])
170 m4_pushdef([requested_version_minor],
171 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
172 m4_pushdef([requested_version_subminor],
173 [gl_LIBUNISTRING_ARG_OR_ZERO(m4_bpatsubst([$1], [^[0-9]*[.][0-9]*[.]\([0-9]*\).*], [\1]), [$1])])
174 test $LIBUNISTRING_VERSION_MAJOR -lt requested_version_major \
175 || { test $LIBUNISTRING_VERSION_MAJOR -eq requested_version_major \
176 && { test $LIBUNISTRING_VERSION_MINOR -lt requested_version_minor \
177 || { test $LIBUNISTRING_VERSION_MINOR -eq requested_version_minor \
178 && test $LIBUNISTRING_VERSION_SUBMINOR -lt requested_version_subminor
179 }
180 }
181 }
182 m4_popdef([requested_version_subminor])
183 m4_popdef([requested_version_minor])
184 m4_popdef([requested_version_major])
185 ],
186 [dnl This is the unoptimized variant:
187 requested_version_major=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_major"`
188 requested_version_minor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_minor"`
189 requested_version_subminor=`echo '$1' | sed -n -e "$gl_libunistring_sed_extract_subminor"`
190 test $LIBUNISTRING_VERSION_MAJOR -lt $requested_version_major \
191 || { test $LIBUNISTRING_VERSION_MAJOR -eq $requested_version_major \
192 && { test $LIBUNISTRING_VERSION_MINOR -lt $requested_version_minor \
193 || { test $LIBUNISTRING_VERSION_MINOR -eq $requested_version_minor \
194 && test $LIBUNISTRING_VERSION_SUBMINOR -lt $requested_version_subminor
195 }
196 }
197 }
198 ])
199 }
200 }])])
201
202dnl gl_LIBUNISTRING_ARG_OR_ZERO([ARG], [ORIG]) expands to ARG if it is not the
203dnl same as ORIG, otherwise to 0.
204m4_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 @@
1# limits-h.m4 1# limits-h.m4
2# serial 1 2# serial 1
3dnl Copyright 2016-2024 Free Software Foundation, Inc. 3dnl Copyright 2016-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check whether limits.h has needed features. 9dnl Check whether limits.h has needed features.
9 10
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 @@
1# localcharset.m4 1# localcharset.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2002, 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2004, 2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_LOCALCHARSET], 9AC_DEFUN([gl_LOCALCHARSET],
9[ 10[
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 @@
1# locale-en.m4
2# serial 1
3dnl Copyright (C) 2003-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11dnl Determine the name of an English (or American English) locale with
12dnl UTF-8 encoding.
13AC_DEFUN_ONCE([gt_LOCALE_EN_UTF8],
14[
15 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_REQUIRE([AM_LANGINFO_CODESET])
17 AC_CACHE_CHECK([for an english Unicode locale], [gt_cv_locale_en_utf8], [
18 case "$host_os" in
19 *-musl* | midipix*)
20 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
21 dnl any locale file on disk. But they are effectively equivalent to the
22 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES)
23 dnl for which localizations (.mo files) have been installed.
24 gt_cv_locale_en_utf8=en_US.UTF-8
25 ;;
26 *)
27 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
28#include <locale.h>
29#include <time.h>
30#if HAVE_LANGINFO_CODESET
31# include <langinfo.h>
32#endif
33#include <stdlib.h>
34#include <string.h>
35struct tm t;
36char buf[16];
37int main () {
38 /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl
39 imitates locale dependent behaviour by looking at the environment
40 variables, and all locales use the UTF-8 encoding. */
41#if !(defined __BEOS__ || defined __HAIKU__)
42 /* Check whether the given locale name is recognized by the system. */
43# if defined _WIN32 && !defined __CYGWIN__
44 /* On native Windows, setlocale(category, "") looks at the system settings,
45 not at the environment variables. Also, when an encoding suffix such
46 as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE
47 category of the locale to "C". */
48 if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL
49 || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0)
50 return 1;
51# else
52 if (setlocale (LC_ALL, "") == NULL) return 1;
53# endif
54 /* Check whether nl_langinfo(CODESET) is "UTF-8" or equivalent. */
55# if HAVE_LANGINFO_CODESET
56 {
57 const char *cs = nl_langinfo (CODESET);
58 if (!(strcmp (cs, "UTF-8") == 0 || strcmp (cs, "UTF8") == 0
59 || strcmp (cs, "utf-8") == 0 || strcmp (cs, "utf8") == 0))
60 return 1;
61 }
62# endif
63# ifdef __CYGWIN__
64 /* On Cygwin, avoid locale names without encoding suffix, because the
65 locale_charset() function relies on the encoding suffix. Note that
66 LC_ALL is set on the command line. */
67 if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1;
68# endif
69 /* Check the third month name. */
70 t.tm_year = 1975 - 1900; t.tm_mon = 3 - 1; t.tm_mday = 24;
71 if (strftime (buf, sizeof (buf), "%B", &t) < 5 || strcmp (buf, "March") != 0)
72 return 1;
73#endif
74#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
75 /* Check whether the decimal separator is a dot. */
76 if (localeconv () ->decimal_point[0] != '.') return 1;
77#endif
78 return 0;
79}
80 ]])])
81 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
82 case "$host_os" in
83 # Handle native Windows specially, because there setlocale() interprets
84 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
85 # "en" or "eng" as "English" or "English_United States.1252",
86 # "fr" or "fra" as "French" or "French_France.1252",
87 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
88 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
89 # and similar.
90 mingw* | windows*)
91 # Test for the hypothetical native Windows locale name.
92 if (LC_ALL='English_United States.65001' LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
93 gt_cv_locale_en_utf8='English_United States.65001'
94 else
95 # None found.
96 gt_cv_locale_en_utf8=none
97 fi
98 ;;
99 *)
100 # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because
101 # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the
102 # configure script would override the LC_ALL setting. Likewise for
103 # LC_CTYPE, which is also set at the beginning of the configure script.
104 # Test for the locale name with explicit encoding suffix first
105 # (this is necessary on Haiku).
106 if (LC_ALL=en_US.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
107 gt_cv_locale_en_utf8=en_US.UTF-8
108 else
109 # Test for the locale name without encoding suffix.
110 if (LC_ALL=en_US LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
111 gt_cv_locale_en_utf8=en_US
112 else
113 # Test for the Solaris 10 locale name.
114 if (LC_ALL=en.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_en_utf8=en.UTF-8
116 else
117 # None found.
118 gt_cv_locale_en_utf8=none
119 fi
120 fi
121 fi
122 ;;
123 esac
124 fi
125 rm -fr conftest*
126 ;;
127 esac
128 ])
129 LOCALE_EN_UTF8="$gt_cv_locale_en_utf8"
130 case "$LOCALE_EN_UTF8" in #(
131 '' | *[[\"\$\'*@<:@]]*)
132 dnl The empty value occurs when the conftest.c program above could not
133 dnl be compiled. The other values might cause trouble with sh or make.
134 AC_MSG_WARN([invalid locale "$LOCALE_EN_UTF8"; assuming "none"])
135 LOCALE_EN_UTF8=none;;
136 esac
137 AC_SUBST([LOCALE_EN_UTF8])
138])
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 @@
1# locale-fr.m4 1# locale-fr.m4
2# serial 23 2# serial 24
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -71,8 +72,9 @@ int main () {
71 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1; 72 if (strftime (buf, sizeof (buf), "%b", &t) < 3 || buf[2] != 'v') return 1;
72# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ 73# if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
73 /* Check whether the decimal separator is a comma. 74 /* Check whether the decimal separator is a comma.
74 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 75 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale
75 are nl_langinfo(RADIXCHAR) are both ".". */ 76 and on Haiku in the fr_FR.UTF-8 locale,
77 localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */
76 if (localeconv () ->decimal_point[0] != ',') return 1; 78 if (localeconv () ->decimal_point[0] != ',') return 1;
77# endif 79# endif
78 return 0; 80 return 0;
@@ -82,10 +84,11 @@ int main () {
82 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 84 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
83 case "$host_os" in 85 case "$host_os" in
84 # Handle native Windows specially, because there setlocale() interprets 86 # Handle native Windows specially, because there setlocale() interprets
85 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 87 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
88 # "en" or "eng" as "English" or "English_United States.1252",
86 # "fr" or "fra" as "French" or "French_France.1252", 89 # "fr" or "fra" as "French" or "French_France.1252",
87 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 90 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
88 # "ja" as "Japanese" or "Japanese_Japan.932", 91 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
89 # and similar. 92 # and similar.
90 mingw* | windows*) 93 mingw* | windows*)
91 # Test for the native Windows locale name. 94 # Test for the native Windows locale name.
@@ -214,8 +217,9 @@ int main () {
214#endif 217#endif
215#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ 218#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */
216 /* Check whether the decimal separator is a comma. 219 /* Check whether the decimal separator is a comma.
217 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point 220 On NetBSD 3.0 in the fr_FR.ISO8859-1 locale
218 are nl_langinfo(RADIXCHAR) are both ".". */ 221 and on Haiku in the fr_FR.UTF-8 locale,
222 localeconv()->decimal_point are nl_langinfo(RADIXCHAR) are both ".". */
219 if (localeconv () ->decimal_point[0] != ',') return 1; 223 if (localeconv () ->decimal_point[0] != ',') return 1;
220#endif 224#endif
221 return 0; 225 return 0;
@@ -224,10 +228,11 @@ int main () {
224 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 228 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
225 case "$host_os" in 229 case "$host_os" in
226 # Handle native Windows specially, because there setlocale() interprets 230 # Handle native Windows specially, because there setlocale() interprets
227 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 231 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
232 # "en" or "eng" as "English" or "English_United States.1252",
228 # "fr" or "fra" as "French" or "French_France.1252", 233 # "fr" or "fra" as "French" or "French_France.1252",
229 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 234 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
230 # "ja" as "Japanese" or "Japanese_Japan.932", 235 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
231 # and similar. 236 # and similar.
232 mingw* | windows*) 237 mingw* | windows*)
233 # Test for the hypothetical native Windows locale name. 238 # 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 @@
1# locale-ja.m4 1# locale-ja.m4
2# serial 18 2# serial 19
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -86,10 +87,11 @@ int main ()
86 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 87 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
87 case "$host_os" in 88 case "$host_os" in
88 # Handle native Windows specially, because there setlocale() interprets 89 # Handle native Windows specially, because there setlocale() interprets
89 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 90 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
91 # "en" or "eng" as "English" or "English_United States.1252",
90 # "fr" or "fra" as "French" or "French_France.1252", 92 # "fr" or "fra" as "French" or "French_France.1252",
91 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 93 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
92 # "ja" as "Japanese" or "Japanese_Japan.932", 94 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
93 # and similar. 95 # and similar.
94 mingw* | windows*) 96 mingw* | windows*)
95 # Note that on native Windows, the Japanese locale is 97 # 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 @@
1# locale-zh.m4 1# locale-zh.m4
2# serial 18 2# serial 20
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -22,6 +23,7 @@ AC_DEFUN_ONCE([gt_LOCALE_ZH_CN],
22#endif 23#endif
23#include <stdlib.h> 24#include <stdlib.h>
24#include <string.h> 25#include <string.h>
26#include <wchar.h>
25struct tm t; 27struct tm t;
26char buf[16]; 28char buf[16];
27int main () 29int main ()
@@ -80,6 +82,19 @@ int main ()
80 single wide character. This excludes the GB2312 and GBK encodings. */ 82 single wide character. This excludes the GB2312 and GBK encodings. */
81 if (mblen ("\203\062\332\066", 5) != 4) 83 if (mblen ("\203\062\332\066", 5) != 4)
82 return 1; 84 return 1;
85 /* Check whether mbrtowc accept this character one byte at a time.
86 This excludes NetBSD 10.0. */
87 if (sizeof (wchar_t) > 2)
88 {
89 wchar_t wc;
90 mbstate_t state;
91 memset (&state, 0, sizeof (state));
92 if (!(mbrtowc (&wc, "\203", 1, &state) == (size_t)(-2)
93 && mbrtowc (&wc, "\062", 1, &state) == (size_t)(-2)
94 && mbrtowc (&wc, "\332", 1, &state) == (size_t)(-2)
95 && mbrtowc (&wc, "\066", 1, &state) == 1))
96 return 1;
97 }
83 return 0; 98 return 0;
84#endif 99#endif
85} 100}
@@ -87,10 +102,11 @@ int main ()
87 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then 102 if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then
88 case "$host_os" in 103 case "$host_os" in
89 # Handle native Windows specially, because there setlocale() interprets 104 # Handle native Windows specially, because there setlocale() interprets
90 # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", 105 # "ar" or "ara" as "Arabic" or "Arabic_Saudi Arabia.1256",
106 # "en" or "eng" as "English" or "English_United States.1252",
91 # "fr" or "fra" as "French" or "French_France.1252", 107 # "fr" or "fra" as "French" or "French_France.1252",
92 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", 108 # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252",
93 # "ja" as "Japanese" or "Japanese_Japan.932", 109 # "ja" or "jpn" as "Japanese" or "Japanese_Japan.932",
94 # and similar. 110 # and similar.
95 mingw* | windows*) 111 mingw* | windows*)
96 # Test for the hypothetical native Windows locale name. 112 # 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 @@
1# locale_h.m4 1# locale_h.m4
2# serial 31 2# serial 37
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_LOCALE_H], 9AC_DEFUN_ONCE([gl_LOCALE_H],
9[ 10[
@@ -19,6 +20,26 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
19 AC_REQUIRE([gl_STDDEF_H]) 20 AC_REQUIRE([gl_STDDEF_H])
20 21
21 AC_REQUIRE([gl_LOCALE_T]) 22 AC_REQUIRE([gl_LOCALE_T])
23 dnl On native Windows, there is a type '_locale_t' that can be used to
24 dnl define locale_t.
25 AC_CACHE_CHECK([whether locale.h defines _locale_t],
26 [gl_cv_header_locale_has_windows_locale_t],
27 [AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM(
29 [[#include <locale.h>
30 _locale_t x;]],
31 [[]])],
32 [gl_cv_header_locale_has_windows_locale_t=yes],
33 [gl_cv_header_locale_has_windows_locale_t=no])
34 ])
35 if test $gl_cv_header_locale_has_windows_locale_t = yes; then
36 HAVE_WINDOWS_LOCALE_T=1
37 AC_DEFINE([HAVE_WINDOWS_LOCALE_T], [1],
38 [Define to 1 if <locale.h> defines the _locale_t type.])
39 else
40 HAVE_WINDOWS_LOCALE_T=0
41 fi
42 AC_SUBST([HAVE_WINDOWS_LOCALE_T])
22 43
23 dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv' 44 dnl Solaris 11.0 defines the int_p_*, int_n_* members of 'struct lconv'
24 dnl only if _LCONV_C99 is defined. 45 dnl only if _LCONV_C99 is defined.
@@ -86,7 +107,7 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
86# include <xlocale.h> 107# include <xlocale.h>
87#endif 108#endif
88 ]], 109 ]],
89 [setlocale newlocale duplocale freelocale]) 110 [setlocale newlocale duplocale freelocale getlocalename_l])
90]) 111])
91 112
92dnl Checks to determine whether the system has the locale_t type, 113dnl Checks to determine whether the system has the locale_t type,
@@ -130,6 +151,7 @@ AC_DEFUN([gl_LOCALE_T],
130 fi 151 fi
131 fi 152 fi
132 AC_SUBST([HAVE_XLOCALE_H]) 153 AC_SUBST([HAVE_XLOCALE_H])
154 AC_SUBST([HAVE_LOCALE_T])
133]) 155])
134 156
135# gl_LOCALE_MODULE_INDICATOR([modulename]) 157# gl_LOCALE_MODULE_INDICATOR([modulename])
@@ -154,7 +176,11 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV]) 176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALECONV])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE]) 177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL]) 178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETLOCALE_NULL])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NEWLOCALE])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUPLOCALE])
181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREELOCALE])
182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOCALENAME_L_UNSAFE])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALENAME_UNSAFE])
159 ]) 185 ])
160 m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS]) 186 m4_require(GL_MODULE_INDICATOR_PREFIX[_LOCALE_H_MODULE_INDICATOR_DEFAULTS])
@@ -164,14 +190,16 @@ AC_DEFUN([gl_LOCALE_H_REQUIRE_DEFAULTS],
164AC_DEFUN([gl_LOCALE_H_DEFAULTS], 190AC_DEFUN([gl_LOCALE_H_DEFAULTS],
165[ 191[
166 dnl Assume proper GNU behavior unless another module says otherwise. 192 dnl Assume proper GNU behavior unless another module says otherwise.
167 HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE]) 193 HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE])
168 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE]) 194 HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
169 HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE]) 195 HAVE_FREELOCALE=1; AC_SUBST([HAVE_FREELOCALE])
170 REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV]) 196 HAVE_GETLOCALENAME_L=1; AC_SUBST([HAVE_GETLOCALENAME_L])
171 REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE]) 197 REPLACE_LOCALECONV=0; AC_SUBST([REPLACE_LOCALECONV])
172 REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE]) 198 REPLACE_SETLOCALE=0; AC_SUBST([REPLACE_SETLOCALE])
173 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE]) 199 REPLACE_NEWLOCALE=0; AC_SUBST([REPLACE_NEWLOCALE])
174 REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE]) 200 REPLACE_DUPLOCALE=0; AC_SUBST([REPLACE_DUPLOCALE])
175 REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV]) 201 REPLACE_FREELOCALE=0; AC_SUBST([REPLACE_FREELOCALE])
202 REPLACE_GETLOCALENAME_L=0; AC_SUBST([REPLACE_GETLOCALENAME_L])
203 REPLACE_STRUCT_LCONV=0; AC_SUBST([REPLACE_STRUCT_LCONV])
176 LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS]) 204 LOCALENAME_ENHANCE_LOCALE_FUNCS=0; AC_SUBST([LOCALENAME_ENHANCE_LOCALE_FUNCS])
177]) 205])
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 @@
1# localeconv.m4 1# localeconv.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2012-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_LOCALECONV], 9AC_DEFUN([gl_FUNC_LOCALECONV],
9[ 10[
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 @@
1# lock.m4 1# lock.m4
2# serial 14 2# serial 14
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
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 @@
1# lseek.m4 1# lseek.m4
2# serial 15 2# serial 15
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_LSEEK], 9AC_DEFUN([gl_FUNC_LSEEK],
9[ 10[
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 @@
1# lstat.m4
2# serial 36
3dnl Copyright (C) 1997-2001, 2003-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Jim Meyering.
10
11AC_DEFUN([gl_FUNC_LSTAT],
12[
13 AC_REQUIRE([AC_CANONICAL_HOST])
14 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
15 dnl If lstat does not exist, the replacement <sys/stat.h> does
16 dnl "#define lstat stat", and lstat.c is a no-op.
17 AC_CHECK_FUNCS_ONCE([lstat])
18 if test $ac_cv_func_lstat = yes; then
19 AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
20 case $host_os,$gl_cv_func_lstat_dereferences_slashed_symlink in
21 darwin* | solaris* | *no)
22 REPLACE_LSTAT=1
23 ;;
24 esac
25 else
26 HAVE_LSTAT=0
27 fi
28])
29
30# Prerequisites of lib/lstat.c.
31AC_DEFUN([gl_PREREQ_LSTAT], [:])
32
33AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
34[
35 dnl We don't use AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK any more, because it
36 dnl is no longer maintained in Autoconf and because it invokes AC_LIBOBJ.
37 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
38 AC_CACHE_CHECK([whether lstat correctly handles trailing slash],
39 [gl_cv_func_lstat_dereferences_slashed_symlink],
40 [rm -f conftest.sym conftest.file
41 echo >conftest.file
42 AC_RUN_IFELSE(
43 [AC_LANG_PROGRAM(
44 [AC_INCLUDES_DEFAULT],
45 [[struct stat sbuf;
46 if (symlink ("conftest.file", "conftest.sym") != 0)
47 return 1;
48 /* Linux will dereference the symlink and fail, as required by
49 POSIX. That is better in the sense that it means we will not
50 have to compile and use the lstat wrapper. */
51 return lstat ("conftest.sym/", &sbuf) == 0;
52 ]])],
53 [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
54 [gl_cv_func_lstat_dereferences_slashed_symlink=no],
55 [case "$host_os" in
56 linux-* | linux)
57 # Guess yes on Linux systems.
58 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
59 midipix*)
60 # Guess yes on systems that emulate the Linux system calls.
61 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
62 *-gnu* | gnu*)
63 # Guess yes on glibc systems.
64 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
65 mingw* | windows*)
66 # Guess no on native Windows.
67 gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
68 *)
69 # If we don't know, obey --enable-cross-guesses.
70 gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;;
71 esac
72 ])
73 rm -f conftest.sym conftest.file
74 ])
75 case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
76 *yes)
77 AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
78 [Define to 1 if 'lstat' dereferences a symlink specified
79 with a trailing slash.])
80 ;;
81 esac
82])
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 @@
1# malloc.m4 1# malloc.m4
2# serial 31 2# serial 43.1
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# This is adapted with modifications from upstream Autoconf here: 9m4_version_prereq([2.73], [], [
9# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n949 10# Modules that use this macro directly or indirectly should depend
11# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined
12# before this macro gets invoked. This helps on AIX 7.2 and earlier
13# if !(__VEC__ || __AIXVEC), and doesn't hurt otherwise.
14#
15# This is copied from upstream Autoconf here:
16# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=1f38316f6af7bf63e5e7dd187ff6456e07ad743e#n971
17# _AC_FUNC_MALLOC_IF(IF-WORKS, IF-NOT[, UNKNOWN-ASSUME])
18# ------------------------------------------------------
19# If 'malloc (0)' returns nonnull, run IF-WORKS, otherwise, IF-NOT.
20# If it is not known whether it works, assume the shell word UNKNOWN-ASSUME,
21# which should end in "yes" or in something else (the latter is the default).
10AC_DEFUN([_AC_FUNC_MALLOC_IF], 22AC_DEFUN([_AC_FUNC_MALLOC_IF],
11[ 23[
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles 24 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
@@ -15,56 +27,81 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
15 [AC_RUN_IFELSE( 27 [AC_RUN_IFELSE(
16 [AC_LANG_PROGRAM( 28 [AC_LANG_PROGRAM(
17 [[#include <stdlib.h> 29 [[#include <stdlib.h>
18 ]], 30 /* Use pmalloc to test; 'volatile' prevents the compiler
19 [[void *p = malloc (0); 31 from optimizing the malloc call away. */
20 void * volatile vp = p; 32 void *(*volatile pmalloc) (size_t) = malloc;]],
21 int result = !vp; 33 [[void *p = pmalloc (0);
34 int result = !p;
22 free (p); 35 free (p);
23 return result;]]) 36 return result;]])],
24 ],
25 [ac_cv_func_malloc_0_nonnull=yes], 37 [ac_cv_func_malloc_0_nonnull=yes],
26 [ac_cv_func_malloc_0_nonnull=no], 38 [ac_cv_func_malloc_0_nonnull=no],
27 [case "$host_os" in 39 [AS_CASE([$host_os],
28 # Guess yes on platforms where we know the result. 40 [# Guess yes on platforms where we know the result.
29 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ 41 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
30 | gnu* | *-musl* | midipix* | midnightbsd* \ 42 | gnu* | *-musl* | midipix* | midnightbsd* \
31 | hpux* | solaris* | cygwin* | mingw* | windows* | msys* ) 43 | hpux* | solaris* | cygwin* | mingw* | windows* | msys*],
32 ac_cv_func_malloc_0_nonnull="guessing yes" ;; 44 [ac_cv_func_malloc_0_nonnull="guessing yes"],
33 # If we don't know, obey --enable-cross-guesses. 45 [# Guess as follows if we don't know.
34 *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; 46 ac_cv_func_malloc_0_nonnull=m4_default([$3], ["guessing no"])])])])
35 esac
36 ])
37 ])
38 AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2]) 47 AS_CASE([$ac_cv_func_malloc_0_nonnull], [*yes], [$1], [$2])
39])# _AC_FUNC_MALLOC_IF 48])# _AC_FUNC_MALLOC_IF
49])
50
51# gl_FUNC_MALLOC_0_NONNULL
52# ------------------------
53# If 'malloc (0)' returns nonnull define HAVE_MALLOC_0_NONNULL.
54# Also, set ac_cv_func_malloc_0_nonnull to a string that ends in
55# "yes", otherwise set it to something else. If unknown whether
56# malloc (0) works, guess as normal for cross-builds.
57AC_DEFUN([gl_FUNC_MALLOC_0_NONNULL],
58[
59 _AC_FUNC_MALLOC_IF(
60 [AC_DEFINE([HAVE_MALLOC_0_NONNULL], [1],
61 [Define to 1 if malloc (0) returns nonnull.])],
62 [],
63 ["$gl_cross_guess_normal"])
64])
40 65
41# gl_FUNC_MALLOC_GNU 66# gl_FUNC_MALLOC_GNU
42# ------------------ 67# ------------------
43# Replace malloc if it is not compatible with GNU libc. 68# Test whether malloc (0) is compatible with GNU libc.
69# Replace malloc if not.
70# Define HAVE_MALLOC_0_NONNULL if malloc (0) returns nonnull (except upon
71# out-of-memory).
72# Define HAVE_MALLOC_PTRDIFF if malloc (N) reliably fails when N exceeds
73# PTRDIFF_MAX.
44AC_DEFUN([gl_FUNC_MALLOC_GNU], 74AC_DEFUN([gl_FUNC_MALLOC_GNU],
45[ 75[
46 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 76 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
47 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 77 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
48 REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" 78 AC_REQUIRE([gl_FUNC_MALLOC_0_NONNULL])
49 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then 79
50 _AC_FUNC_MALLOC_IF([], [REPLACE_MALLOC_FOR_MALLOC_GNU=1]) 80 AS_CASE([$ac_cv_func_malloc_0_nonnull],
51 fi 81 [*yes],
82 [REPLACE_MALLOC_FOR_MALLOC_GNU=$REPLACE_MALLOC_FOR_MALLOC_POSIX],
83 [REPLACE_MALLOC_FOR_MALLOC_GNU=1])
52]) 84])
53 85
54# gl_FUNC_MALLOC_PTRDIFF 86# gl_FUNC_MALLOC_PTRDIFF
55# ---------------------- 87# ----------------------
56# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX, 88# Test whether malloc (N) reliably fails when N exceeds PTRDIFF_MAX.
57# and replace malloc otherwise. 89# Define HAVE_MALLOC_PTRDIFF if yes.
90# Replace malloc if not.
58AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF], 91AC_DEFUN([gl_FUNC_MALLOC_PTRDIFF],
59[ 92[
60 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 93 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
61 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) 94 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
62 test "$gl_cv_malloc_ptrdiff" = yes || REPLACE_MALLOC_FOR_MALLOC_POSIX=1 95 AS_IF([test "$gl_cv_malloc_ptrdiff" = yes],
96 [AC_DEFINE([HAVE_MALLOC_PTRDIFF], 1,
97 [Define to 1 if malloc-like functions do not allocate objects
98 larger than PTRDIFF_MAX bytes.])],
99 [REPLACE_MALLOC_FOR_MALLOC_POSIX=1])
63]) 100])
64 101
65# Test whether malloc, realloc, calloc refuse to create objects 102# Test whether malloc, calloc refuse to create objects
66# larger than what can be expressed in ptrdiff_t. 103# larger than what can be expressed in ptrdiff_t.
67# Set gl_cv_func_malloc_gnu to yes or no accordingly. 104# Set gl_cv_func_malloc_gnu.
68AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF], 105AC_DEFUN([gl_CHECK_MALLOC_PTRDIFF],
69[ 106[
70 AC_CACHE_CHECK([whether malloc is ptrdiff_t safe], 107 AC_CACHE_CHECK([whether malloc is ptrdiff_t safe],
@@ -108,30 +145,48 @@ AC_DEFUN([gl_FUNC_MALLOC_POSIX],
108 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 145 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
109 AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF]) 146 AC_REQUIRE([gl_FUNC_MALLOC_PTRDIFF])
110 AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) 147 AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
111 if test "$gl_cv_func_malloc_posix" = yes; then 148 case "$gl_cv_func_malloc_posix" in
112 AC_DEFINE([HAVE_MALLOC_POSIX], [1], 149 *yes)
113 [Define if malloc, realloc, and calloc set errno on allocation failure.]) 150 AC_DEFINE([HAVE_MALLOC_POSIX], [1],
114 else 151 [Define if malloc and calloc set errno on allocation failure.])
115 REPLACE_MALLOC_FOR_MALLOC_POSIX=1 152 ;;
116 fi 153 *)
154 REPLACE_MALLOC_FOR_MALLOC_POSIX=1
155 ;;
156 esac
117]) 157])
118 158
119# Test whether malloc, realloc, calloc set errno to ENOMEM on failure. 159# Test whether malloc, calloc set errno to ENOMEM on failure.
120# Set gl_cv_func_malloc_posix to yes or no accordingly. 160# Set gl_cv_func_malloc_posix to *yes or *no accordingly.
121AC_DEFUN([gl_CHECK_MALLOC_POSIX], 161AC_DEFUN([gl_CHECK_MALLOC_POSIX],
122[ 162[
123 AC_REQUIRE([AC_CANONICAL_HOST]) 163 AC_REQUIRE([AC_CANONICAL_HOST])
124 AC_CACHE_CHECK([whether malloc, realloc, calloc set errno on failure], 164 AC_CACHE_CHECK([whether malloc, calloc set errno on failure],
125 [gl_cv_func_malloc_posix], 165 [gl_cv_func_malloc_posix],
126 [ 166 [
127 dnl It is too dangerous to try to allocate a large amount of memory: 167 dnl It is too dangerous to try to allocate a large amount of memory:
128 dnl some systems go to their knees when you do that. So assume that 168 dnl some systems go to their knees when you do that. So assume that
129 dnl all Unix implementations of the function set errno on failure, 169 dnl all Unix implementations of the function set errno on failure,
130 dnl except on those platforms where we have seen 'test-malloc-gnu', 170 dnl except on those platforms where we have seen 'test-malloc-gnu',
131 dnl 'test-realloc-gnu', 'test-calloc-gnu' fail. 171 dnl 'test-realloc-posix', 'test-calloc-gnu' fail. For platforms
172 dnl where only 'test-realloc-posix', see realloc.m4.
132 case "$host_os" in 173 case "$host_os" in
133 mingw* | windows*) 174 mingw* | windows*)
134 gl_cv_func_malloc_posix=no ;; 175 dnl Old MSVCRT from 2001 did not set errno=ENOMEM when malloc failed.
176 dnl More recent MSVCRT from 2019 does so.
177 dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well.
178 AC_COMPILE_IFELSE(
179 [AC_LANG_PROGRAM(
180 [[#include <stdio.h>
181 #ifndef _UCRT
182 msvcrt yuck
183 #endif
184 ]],
185 [[]])
186 ],
187 [gl_cv_func_malloc_posix="guessing yes"],
188 [gl_cv_func_malloc_posix="guessing no"])
189 ;;
135 irix* | solaris*) 190 irix* | solaris*)
136 dnl On IRIX 6.5, the three functions return NULL with errno unset 191 dnl On IRIX 6.5, the three functions return NULL with errno unset
137 dnl when the argument is larger than PTRDIFF_MAX. 192 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 @@
1# malloca.m4 1# malloca.m4
2# serial 2 2# serial 3
3dnl Copyright (C) 2003-2004, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2003-2004, 2006-2007, 2009-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_MALLOCA], 10AC_DEFUN([gl_MALLOCA],
10[ 11[
11 dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables 12 dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables
12 dnl @ALLOCA@ and @LTALLOCA@. 13 dnl @ALLOCA@ and @LTALLOCA@.
13 dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. 14 dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies.
14 AC_REQUIRE([gl_EEMALLOC]) 15 AC_REQUIRE([gl_FUNC_MALLOC_GNU])
15]) 16])
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 @@
1# math_h.m4 1# math_h.m4
2# serial 138 2# serial 140.1
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_MATH_H], 9AC_DEFUN_ONCE([gl_MATH_H],
9[ 10[
@@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_MATH_H],
49 ilogb ilogbf ilogbl 50 ilogb ilogbf ilogbl
50 ldexpf ldexpl 51 ldexpf ldexpl
51 log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l 52 log logf logl log10 log10f log10l log1p log1pf log1pl log2 log2f log2l
52 logb logbf logbl 53 logb logbf logbl logp1 log1pf logp1l
53 modf modff modfl powf 54 modf modff modfl powf
54 remainder remainderf remainderl 55 remainder remainderf remainderl
55 rint rintf rintl round roundf roundl 56 rint rintf rintl round roundf roundl
@@ -153,6 +154,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) 154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) 156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) 160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) 161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) 162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -253,6 +257,9 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
253 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) 257 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
254 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) 258 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
255 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) 259 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
260 HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1])
261 HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F])
262 HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L])
256 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) 263 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
257 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) 264 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
258 HAVE_POWF=1; AC_SUBST([HAVE_POWF]) 265 HAVE_POWF=1; AC_SUBST([HAVE_POWF])
@@ -392,6 +399,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
392 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) 399 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS])
393 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) 400 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF])
394 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) 401 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF])
402 REPLACE_SINL=0; AC_SUBST([REPLACE_SINL])
395 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) 403 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF])
396 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) 404 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
397 REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) 405 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 @@
1# mbchar.m4
2# serial 9
3dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl autoconf tests required for use of mbchar.m4
10dnl From Bruno Haible.
11
12AC_DEFUN([gl_MBCHAR],
13[
14 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
15])
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 @@
1# mbiter.m4
2# serial 7
3dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl autoconf tests required for use of mbiter.h
10dnl From Bruno Haible.
11
12AC_DEFUN([gl_MBITER],
13[
14 AC_REQUIRE([AC_TYPE_MBSTATE_T])
15 :
16])
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 @@
1# mbrtoc32.m4
2# serial 21
3dnl Copyright (C) 2014-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_MBRTOC32],
10[
11 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
12
13 AC_REQUIRE([AC_TYPE_MBSTATE_T])
14 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
15 dnl determined. It describes how our overridden mbrtowc is implemented.
16 dnl We then implement mbrtoc32 accordingly.
17 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
18
19 AC_REQUIRE([gl_TYPE_CHAR32_T])
20 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
21
22 AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
23 if test $gl_cv_func_mbrtoc32 = no; then
24 HAVE_MBRTOC32=0
25 else
26 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $REPLACE_MBSTATE_T = 1; then
27 REPLACE_MBRTOC32=1
28 else
29 gl_MBRTOC32_EMPTY_INPUT
30 gl_MBRTOC32_C_LOCALE
31 gl_MBRTOC32_UTF8_LOCALE
32 case "$gl_cv_func_mbrtoc32_empty_input" in
33 *yes) ;;
34 *) AC_DEFINE([MBRTOC32_EMPTY_INPUT_BUG], [1],
35 [Define if the mbrtoc32 function does not return (size_t) -2 for empty input.])
36 REPLACE_MBRTOC32=1
37 ;;
38 esac
39 case "$gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ" in
40 *yes) ;;
41 *) AC_DEFINE([MBRTOC32_IN_C_LOCALE_MAYBE_EILSEQ], [1],
42 [Define if the mbrtoc32 function may signal encoding errors in the C locale.])
43 REPLACE_MBRTOC32=1
44 ;;
45 esac
46 case "$gl_cv_func_mbrtoc32_utf8_locale_works" in
47 *yes) ;;
48 *) AC_DEFINE([MBRTOC32_MULTIBYTE_LOCALE_BUG], [1],
49 [Define if the mbrtoc32 function does not accept the input bytes one-by-one.])
50 REPLACE_MBRTOC32=1
51 dnl Our replacement mbrtoc32 can handle UTF-8, but not GB18030.
52 LOCALE_ZH_CN=none
53 ;;
54 esac
55 fi
56 if test $HAVE_WORKING_MBRTOC32 = 0; then
57 REPLACE_MBRTOC32=1
58 fi
59 fi
60])
61
62AC_DEFUN([gl_CHECK_FUNC_MBRTOC32],
63[
64 dnl Cf. gl_CHECK_FUNCS_ANDROID
65 AC_CHECK_DECL([mbrtoc32], , ,
66 [[#ifdef __HAIKU__
67 #include <stdint.h>
68 #endif
69 #include <uchar.h>
70 ]])
71 if test $ac_cv_have_decl_mbrtoc32 = yes; then
72 dnl We can't use AC_CHECK_FUNC here, because mbrtoc32() is defined as a
73 dnl static inline function on Haiku 2020.
74 AC_CACHE_CHECK([for mbrtoc32], [gl_cv_func_mbrtoc32],
75 [AC_LINK_IFELSE(
76 [AC_LANG_PROGRAM(
77 [[#include <stdlib.h>
78 #ifdef __HAIKU__
79 #include <stdint.h>
80 #endif
81 #include <uchar.h>
82 ]],
83 [[char32_t c;
84 return mbrtoc32 (&c, "", 1, NULL) == 0;
85 ]])
86 ],
87 [gl_cv_func_mbrtoc32=yes],
88 [gl_cv_func_mbrtoc32=no])
89 ])
90 else
91 gl_cv_func_mbrtoc32=no
92 fi
93])
94
95dnl Test whether mbrtoc32 returns the correct value on empty input.
96
97AC_DEFUN([gl_MBRTOC32_EMPTY_INPUT],
98[
99 AC_REQUIRE([AC_PROG_CC])
100 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
101 AC_CACHE_CHECK([whether mbrtoc32 works on empty input],
102 [gl_cv_func_mbrtoc32_empty_input],
103 [
104 AC_RUN_IFELSE(
105 [AC_LANG_SOURCE([[
106 #ifdef __HAIKU__
107 #include <stdint.h>
108 #endif
109 #include <uchar.h>
110 static char32_t wc;
111 static mbstate_t mbs;
112 int
113 main (void)
114 {
115 return mbrtoc32 (&wc, "", 0, &mbs) != (size_t) -2;
116 }]])],
117 [gl_cv_func_mbrtoc32_empty_input=yes],
118 [gl_cv_func_mbrtoc32_empty_input=no],
119 [case "$host_os" in
120 # Guess no on glibc systems.
121 *-gnu* | gnu*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
122 # Guess no on Android.
123 linux*-android*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
124 # Guess no on native Windows.
125 mingw* | windows*) gl_cv_func_mbrtoc32_empty_input="guessing no" ;;
126 *) gl_cv_func_mbrtoc32_empty_input="guessing yes" ;;
127 esac
128 ])
129 ])
130])
131
132dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
133dnl POSIX:2018 says regarding mbrtowc: "In the POSIX locale an [EILSEQ] error
134dnl cannot occur since all byte values are valid characters." It is reasonable
135dnl to expect mbrtoc32 to behave in the same way.
136
137AC_DEFUN([gl_MBRTOC32_C_LOCALE],
138[
139 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
140 AC_CACHE_CHECK([whether the C locale is free of encoding errors],
141 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ],
142 [AC_RUN_IFELSE(
143 [AC_LANG_PROGRAM(
144 [[#include <limits.h>
145 #include <locale.h>
146 #ifdef __HAIKU__
147 #include <stdint.h>
148 #endif
149 #include <uchar.h>
150 ]], [[
151 int i;
152 char *locale = setlocale (LC_ALL, "C");
153 if (! locale)
154 return 2;
155 for (i = CHAR_MIN; i <= CHAR_MAX; i++)
156 {
157 char c = i;
158 char32_t wc;
159 mbstate_t mbs = { 0, };
160 size_t ss = mbrtoc32 (&wc, &c, 1, &mbs);
161 if (1 < ss)
162 return 3;
163 }
164 return 0;
165 ]])],
166 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=yes],
167 [gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ=no],
168 [case "$host_os" in
169 # Guess yes on native Windows.
170 mingw* | windows*) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="guessing yes" ;;
171 *) gl_cv_func_mbrtoc32_C_locale_sans_EILSEQ="$gl_cross_guess_normal" ;;
172 esac
173 ])
174 ])
175])
176
177dnl Test whether mbrtoc32 works when it's fed the bytes one-by-one in an UTF-8
178dnl locale.
179
180AC_DEFUN([gl_MBRTOC32_UTF8_LOCALE],
181[
182 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
183 AC_CACHE_CHECK([whether mbrtoc32 works in an UTF-8 locale],
184 [gl_cv_func_mbrtoc32_utf8_locale_works],
185 [AC_RUN_IFELSE(
186 [AC_LANG_PROGRAM(
187 [[#include <locale.h>
188 #ifdef __HAIKU__
189 #include <stdint.h>
190 #endif
191 #include <uchar.h>
192 ]], [[
193 char *locale = setlocale (LC_ALL, "en_US.UTF-8");
194 if (locale)
195 {
196 /* This test fails on Cygwin 3.5.3. */
197 mbstate_t state = { 0, };
198 char32_t uc = 0xDEADBEEF;
199 /* \360\237\220\203 = U+0001F403 */
200 if (mbrtoc32 (&uc, "\360", 1, &state) != (size_t)-2)
201 return 1;
202 if (mbrtoc32 (&uc, "\237", 1, &state) != (size_t)-2)
203 return 2;
204 if (mbrtoc32 (&uc, "\220", 1, &state) != (size_t)-2)
205 return 3;
206 if (mbrtoc32 (&uc, "\203", 1, &state) != 1)
207 return 4;
208 if (uc != 0x0001F403)
209 return 5;
210 }
211 return 0;
212 ]])],
213 [gl_cv_func_mbrtoc32_utf8_locale_works=yes],
214 [gl_cv_func_mbrtoc32_utf8_locale_works=no],
215 [case "$host_os" in
216 # Guess no on Cygwin.
217 cygwin*) gl_cv_func_mbrtoc32_utf8_locale_works="guessing no" ;;
218 *) gl_cv_func_mbrtoc32_utf8_locale_works="$gl_cross_guess_normal" ;;
219 esac
220 ])
221 ])
222])
223
224dnl Test whether mbrtoc32 works not worse than mbrtowc.
225dnl Result is HAVE_WORKING_MBRTOC32.
226
227AC_DEFUN([gl_MBRTOC32_SANITYCHECK],
228[
229 AC_REQUIRE([AC_PROG_CC])
230 AC_REQUIRE([gl_TYPE_CHAR32_T])
231 AC_REQUIRE([gl_CHECK_FUNC_MBRTOC32])
232 AC_REQUIRE([gt_LOCALE_FR])
233 AC_REQUIRE([gt_LOCALE_ZH_CN])
234 AC_REQUIRE([AC_CANONICAL_HOST])
235 if test $GNULIBHEADERS_OVERRIDE_CHAR32_T = 1 || test $gl_cv_func_mbrtoc32 = no; then
236 HAVE_WORKING_MBRTOC32=0
237 else
238 AC_CACHE_CHECK([whether mbrtoc32 works as well as mbrtowc],
239 [gl_cv_func_mbrtoc32_sanitycheck],
240 [
241 dnl Initial guess, used when cross-compiling or when no suitable locale
242 dnl is present.
243changequote(,)dnl
244 case "$host_os" in
245 # Guess no on FreeBSD, Solaris, native Windows.
246 freebsd* | midnightbsd* | solaris* | mingw* | windows*)
247 gl_cv_func_mbrtoc32_sanitycheck="guessing no"
248 ;;
249 # Guess yes otherwise.
250 *)
251 gl_cv_func_mbrtoc32_sanitycheck="guessing yes"
252 ;;
253 esac
254changequote([,])dnl
255 if test $LOCALE_FR != none || test $LOCALE_ZH_CN != none; then
256 AC_RUN_IFELSE(
257 [AC_LANG_SOURCE([[
258#include <locale.h>
259#include <stdlib.h>
260#include <string.h>
261#include <wchar.h>
262#ifdef __HAIKU__
263 #include <stdint.h>
264#endif
265#include <uchar.h>
266int main ()
267{
268 int result = 0;
269 /* This fails on native Windows:
270 mbrtoc32 returns (size_t)-1.
271 mbrtowc returns 1 (correct). */
272 if (strcmp ("$LOCALE_FR", "none") != 0
273 && setlocale (LC_ALL, "$LOCALE_FR") != NULL)
274 {
275 mbstate_t state;
276 wchar_t wc = (wchar_t) 0xBADFACE;
277 memset (&state, '\0', sizeof (mbstate_t));
278 if (mbrtowc (&wc, "\374", 1, &state) == 1)
279 {
280 char32_t c32 = (wchar_t) 0xBADFACE;
281 memset (&state, '\0', sizeof (mbstate_t));
282 if (mbrtoc32 (&c32, "\374", 1, &state) != 1)
283 result |= 1;
284 }
285 }
286 /* This fails on FreeBSD 13.0 and Solaris 11.4:
287 mbrtoc32 returns (size_t)-2 or (size_t)-1.
288 mbrtowc returns 4 (correct). */
289 if (strcmp ("$LOCALE_ZH_CN", "none") != 0
290 && setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL)
291 {
292 mbstate_t state;
293 wchar_t wc = (wchar_t) 0xBADFACE;
294 memset (&state, '\0', sizeof (mbstate_t));
295 if (mbrtowc (&wc, "\224\071\375\067", 4, &state) == 4)
296 {
297 char32_t c32 = (wchar_t) 0xBADFACE;
298 memset (&state, '\0', sizeof (mbstate_t));
299 if (mbrtoc32 (&c32, "\224\071\375\067", 4, &state) != 4)
300 result |= 2;
301 }
302 }
303 return result;
304}]])],
305 [gl_cv_func_mbrtoc32_sanitycheck=yes],
306 [gl_cv_func_mbrtoc32_sanitycheck=no],
307 [:])
308 fi
309 ])
310 case "$gl_cv_func_mbrtoc32_sanitycheck" in
311 *yes)
312 HAVE_WORKING_MBRTOC32=1
313 AC_DEFINE([HAVE_WORKING_MBRTOC32], [1],
314 [Define if the mbrtoc32 function basically works.])
315 ;;
316 *) HAVE_WORKING_MBRTOC32=0 ;;
317 esac
318 fi
319 AC_SUBST([HAVE_WORKING_MBRTOC32])
320])
321
322# Prerequisites of lib/mbrtoc32.c and lib/lc-charset-dispatch.c.
323AC_DEFUN([gl_PREREQ_MBRTOC32], [
324 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
325 :
326])
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 @@
1# mbrtowc.m4 1# mbrtowc.m4
2# serial 44 -*- coding: utf-8 -*- 2# serial 46
3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, 3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_MBRTOWC], 10AC_DEFUN([gl_FUNC_MBRTOWC],
10[ 11[
@@ -160,7 +161,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
160[ 161[
161 AC_REQUIRE([AC_PROG_CC]) 162 AC_REQUIRE([AC_PROG_CC])
162 AC_REQUIRE([gt_LOCALE_JA]) 163 AC_REQUIRE([gt_LOCALE_JA])
163 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 164 AC_REQUIRE([gt_LOCALE_EN_UTF8])
164 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 165 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
165 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], 166 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
166 [gl_cv_func_mbrtowc_incomplete_state], 167 [gl_cv_func_mbrtowc_incomplete_state],
@@ -200,7 +201,7 @@ int main ()
200 [gl_cv_func_mbrtowc_incomplete_state=no], 201 [gl_cv_func_mbrtowc_incomplete_state=no],
201 [:]) 202 [:])
202 else 203 else
203 if test $LOCALE_FR_UTF8 != none; then 204 if test "$LOCALE_EN_UTF8" != none; then
204 AC_RUN_IFELSE( 205 AC_RUN_IFELSE(
205 [AC_LANG_SOURCE([[ 206 [AC_LANG_SOURCE([[
206#include <locale.h> 207#include <locale.h>
@@ -208,7 +209,7 @@ int main ()
208#include <wchar.h> 209#include <wchar.h>
209int main () 210int main ()
210{ 211{
211 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 212 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
212 { 213 {
213 const char input[] = "B\303\274\303\237er"; /* "Büßer" */ 214 const char input[] = "B\303\274\303\237er"; /* "Büßer" */
214 mbstate_t state; 215 mbstate_t state;
@@ -288,7 +289,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1.
288AC_DEFUN([gl_MBRTOWC_NULL_ARG1], 289AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
289[ 290[
290 AC_REQUIRE([AC_PROG_CC]) 291 AC_REQUIRE([AC_PROG_CC])
291 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 292 AC_REQUIRE([gt_LOCALE_EN_UTF8])
292 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 293 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
293 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], 294 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
294 [gl_cv_func_mbrtowc_null_arg1], 295 [gl_cv_func_mbrtowc_null_arg1],
@@ -303,7 +304,7 @@ changequote(,)dnl
303 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; 304 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
304 esac 305 esac
305changequote([,])dnl 306changequote([,])dnl
306 if test $LOCALE_FR_UTF8 != none; then 307 if test "$LOCALE_EN_UTF8" != none; then
307 AC_RUN_IFELSE( 308 AC_RUN_IFELSE(
308 [AC_LANG_SOURCE([[ 309 [AC_LANG_SOURCE([[
309#include <locale.h> 310#include <locale.h>
@@ -314,7 +315,7 @@ int main ()
314{ 315{
315 int result = 0; 316 int result = 0;
316 317
317 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 318 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
318 { 319 {
319 char input[] = "\303\237er"; 320 char input[] = "\303\237er";
320 mbstate_t state; 321 mbstate_t state;
@@ -351,7 +352,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg2.
351AC_DEFUN([gl_MBRTOWC_NULL_ARG2], 352AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
352[ 353[
353 AC_REQUIRE([AC_PROG_CC]) 354 AC_REQUIRE([AC_PROG_CC])
354 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 355 AC_REQUIRE([gt_LOCALE_EN_UTF8])
355 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 356 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
356 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument], 357 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
357 [gl_cv_func_mbrtowc_null_arg2], 358 [gl_cv_func_mbrtowc_null_arg2],
@@ -366,7 +367,7 @@ changequote(,)dnl
366 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;; 367 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
367 esac 368 esac
368changequote([,])dnl 369changequote([,])dnl
369 if test $LOCALE_FR_UTF8 != none; then 370 if test "$LOCALE_EN_UTF8" != none; then
370 AC_RUN_IFELSE( 371 AC_RUN_IFELSE(
371 [AC_LANG_SOURCE([[ 372 [AC_LANG_SOURCE([[
372#include <locale.h> 373#include <locale.h>
@@ -374,7 +375,7 @@ changequote([,])dnl
374#include <wchar.h> 375#include <wchar.h>
375int main () 376int main ()
376{ 377{
377 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 378 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
378 { 379 {
379 mbstate_t state; 380 mbstate_t state;
380 wchar_t wc; 381 wchar_t wc;
@@ -404,7 +405,7 @@ dnl Result is gl_cv_func_mbrtowc_retval.
404AC_DEFUN([gl_MBRTOWC_RETVAL], 405AC_DEFUN([gl_MBRTOWC_RETVAL],
405[ 406[
406 AC_REQUIRE([AC_PROG_CC]) 407 AC_REQUIRE([AC_PROG_CC])
407 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 408 AC_REQUIRE([gt_LOCALE_EN_UTF8])
408 AC_REQUIRE([gt_LOCALE_JA]) 409 AC_REQUIRE([gt_LOCALE_JA])
409 AC_REQUIRE([AC_CANONICAL_HOST]) 410 AC_REQUIRE([AC_CANONICAL_HOST])
410 AC_CACHE_CHECK([whether mbrtowc has a correct return value], 411 AC_CACHE_CHECK([whether mbrtowc has a correct return value],
@@ -422,7 +423,7 @@ changequote(,)dnl
422 gl_cv_func_mbrtowc_retval="guessing yes" ;; 423 gl_cv_func_mbrtowc_retval="guessing yes" ;;
423 esac 424 esac
424changequote([,])dnl 425changequote([,])dnl
425 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ 426 if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \
426 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then 427 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then
427 AC_RUN_IFELSE( 428 AC_RUN_IFELSE(
428 [AC_LANG_SOURCE([[ 429 [AC_LANG_SOURCE([[
@@ -434,8 +435,8 @@ int main ()
434 int result = 0; 435 int result = 0;
435 int found_some_locale = 0; 436 int found_some_locale = 0;
436 /* This fails on Solaris. */ 437 /* This fails on Solaris. */
437 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 438 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
438 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 439 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
439 { 440 {
440 char input[] = "B\303\274\303\237er"; /* "Büßer" */ 441 char input[] = "B\303\274\303\237er"; /* "Büßer" */
441 mbstate_t state; 442 mbstate_t state;
@@ -649,8 +650,8 @@ int main ()
649 [:]) 650 [:])
650 ;; 651 ;;
651 *) 652 *)
652 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 653 AC_REQUIRE([gt_LOCALE_EN_UTF8])
653 if test $LOCALE_FR_UTF8 != none; then 654 if test "$LOCALE_EN_UTF8" != none; then
654 AC_RUN_IFELSE( 655 AC_RUN_IFELSE(
655 [AC_LANG_SOURCE([[ 656 [AC_LANG_SOURCE([[
656#include <locale.h> 657#include <locale.h>
@@ -658,7 +659,7 @@ int main ()
658#include <wchar.h> 659#include <wchar.h>
659int main () 660int main ()
660{ 661{
661 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 662 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
662 { 663 {
663 wchar_t wc = (wchar_t) 0xBADFACE; 664 wchar_t wc = (wchar_t) 0xBADFACE;
664 mbstate_t state; 665 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 @@
1# mbsinit.m4 1# mbsinit.m4
2# serial 10 2# serial 10
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_MBSINIT], 9AC_DEFUN([gl_FUNC_MBSINIT],
9[ 10[
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 @@
1# mbstate_t.m4 1# mbstate_t.m4
2# serial 14 2# serial 14
3dnl Copyright (C) 2000-2002, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2000-2002, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# From Paul Eggert. 9# From Paul Eggert.
9 10
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 @@
1# mbtowc.m4 1# mbtowc.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_MBTOWC], 9AC_DEFUN([gl_FUNC_MBTOWC],
9[ 10[
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 @@
1# memchr.m4 1# memchr.m4
2# serial 19 2# serial 20
3dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_MEMCHR], 9AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
9[ 10[
@@ -49,7 +50,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
49 if (fd >= 0) 50 if (fd >= 0)
50# endif 51# endif
51 { 52 {
52 int pagesize = getpagesize (); 53 long int pagesize = sysconf (_SC_PAGESIZE);
53 char *two_pages = 54 char *two_pages =
54 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, 55 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
55 flags, fd, 0); 56 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 @@
1# minmax.m4 1# minmax.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_PREREQ([2.53]) 9AC_PREREQ([2.53])
9 10
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 @@
1# mktime.m4 1# mktime.m4
2# serial 39 2# serial 42
3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2025 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8dnl From Jim Meyering. 10dnl From Jim Meyering.
9 11
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 @@
1# mmap-anon.m4 1# mmap-anon.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Detect how mmap can be used to create anonymous (not file-backed) memory 9# Detect how mmap can be used to create anonymous (not file-backed) memory
9# mappings. 10# 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 @@
1# mode_t.m4 1# mode_t.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and 9# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and
9# include <sys/types.h>. 10# include <sys/types.h>.
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 @@
1# mountlist.m4 1# mountlist.m4
2# serial 17 2# serial 18
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Jim Meyering. 9dnl From Jim Meyering.
9 10
@@ -318,12 +319,17 @@ int getmntinfo (struct statfs **, int);
318 fi 319 fi
319 320
320 if test -z "$ac_list_mounted_fs"; then 321 if test -z "$ac_list_mounted_fs"; then
321 AC_MSG_ERROR([could not determine how to read list of mounted file systems]) 322 case "$host_os" in
322 # FIXME -- no need to abort building the whole package 323 mingw* | windows*) ac_list_mounted_fs=found ;;
323 # Can't build mountlist.c or anything that needs its functions 324 esac
325 fi
326
327 if test -z "$ac_list_mounted_fs"; then
328 AC_DEFINE([MOUNTED_NOT_PORTED], [1],
329 [Define if we don't know how to determine the list of mounted file systems.])
324 fi 330 fi
325 331
326 if test $ac_list_mounted_fs = found; then 332 if test "$ac_list_mounted_fs" = found; then
327 gl_cv_list_mounted_fs=yes 333 gl_cv_list_mounted_fs=yes
328 else 334 else
329 gl_cv_list_mounted_fs=no 335 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 @@
1# msvc-inval.m4 1# msvc-inval.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_MSVC_INVAL], 9AC_DEFUN([gl_MSVC_INVAL],
9[ 10[
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 @@
1# msvc-nothrow.m4 1# msvc-nothrow.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_MSVC_NOTHROW], 9AC_DEFUN([gl_MSVC_NOTHROW],
9[ 10[
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 @@
1# multiarch.m4 1# multiarch.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Determine whether the compiler is or may be producing universal binaries. 9# Determine whether the compiler is or may be producing universal binaries.
9# 10#
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 @@
1# musl.m4 1# musl.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test for musl libc, despite the musl libc authors don't like it 9# Test for musl libc, despite the musl libc authors don't like it
9# <https://wiki.musl-libc.org/faq.html> 10# <https://wiki.musl-libc.org/faq.html>
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 @@
1# netdb_h.m4 1# netdb_h.m4
2# serial 15 2# serial 15
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_NETDB_H], 9AC_DEFUN_ONCE([gl_NETDB_H],
9[ 10[
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 @@
1# netinet_in_h.m4 1# netinet_in_h.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_HEADER_NETINET_IN], 9AC_DEFUN([gl_HEADER_NETINET_IN],
9[ 10[
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 @@
1# nl_langinfo.m4 1# nl_langinfo.m4
2# serial 11 2# serial 12.1
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_NL_LANGINFO], 9AC_DEFUN([gl_FUNC_NL_LANGINFO],
9[ 10[
@@ -40,16 +41,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
40 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], 41 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
41 [$FUNC_NL_LANGINFO_YESEXPR_WORKS], 42 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
42 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) 43 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
43 # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe. 44 # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not
45 # multithread-safe.
44 case "$host_os" in 46 case "$host_os" in
45 solaris*) NL_LANGINFO_MTSAFE=0 ;; 47 darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;;
46 *) NL_LANGINFO_MTSAFE=1 ;; 48 *) NL_LANGINFO_MTSAFE=1 ;;
47 esac 49 esac
48 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], 50 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
49 [Define to 1 if nl_langinfo is multithread-safe.]) 51 [Define to 1 if nl_langinfo is multithread-safe.])
50 if test $HAVE_LANGINFO_CODESET = 1 \ 52 if test $HAVE_LANGINFO_CODESET = 1 \
51 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \ 53 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
52 && test $HAVE_LANGINFO_ALTMON = 1 \ 54 && test $HAVE_LANGINFO_ALTMON = 1 \
55 && test $HAVE_LANGINFO_ABALTMON = 1 \
53 && test $HAVE_LANGINFO_ERA = 1 \ 56 && test $HAVE_LANGINFO_ERA = 1 \
54 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \ 57 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
55 && test $NL_LANGINFO_MTSAFE = 1; then 58 && 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 @@
1# nocrash.m4 1# nocrash.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2005, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. 9dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini.
9 10
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 @@
1# off64_t.m4
2# serial 1
3dnl Copyright (C) 2024-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Check whether <sys/types.h> defines the 'off64_t' type.
10dnl Set HAVE_OFF64_T.
11
12AC_DEFUN([gl_TYPE_OFF64_T],
13[
14 dnl Persuade glibc <sys/types.h>, <stdio.h>, <fcntl.h>, <unistd.h>, <aio.h>
15 dnl to define off64_t.
16 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
17
18 AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t],
19 [AC_COMPILE_IFELSE(
20 [AC_LANG_PROGRAM(
21 [[#include <sys/types.h>]],
22 [[int x = sizeof (off64_t *) + sizeof (off64_t);
23 return !x;]])],
24 [gl_cv_off64_t=yes], [gl_cv_off64_t=no])])
25
26 if test $gl_cv_off64_t != no; then
27 HAVE_OFF64_T=1
28 else
29 HAVE_OFF64_T=0
30 fi
31 AC_SUBST([HAVE_OFF64_T])
32])
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 @@
1# off_t.m4 1# off_t.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2012-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2012-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check whether to override the 'off_t' type. 9dnl Check whether to override the 'off_t' type.
9dnl Set WINDOWS_64_BIT_OFF_T. 10dnl 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 @@
1# once.m4
2# serial 1
3dnl Copyright (C) 2024-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10
11AC_DEFUN([gl_ONCE],
12[
13 AC_REQUIRE([gl_THREADLIB])
14])
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 @@
1# open-cloexec.m4 1# open-cloexec.m4
2# serial 1 2# serial 1
3dnl Copyright 2017-2024 Free Software Foundation, Inc. 3dnl Copyright 2017-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Test whether O_CLOEXEC is defined. 9# Test whether O_CLOEXEC is defined.
9 10
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 @@
1# open-slash.m4 1# open-slash.m4
2# serial 2 2# serial 2
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Tests whether open() and creat() recognize a trailing slash. 9dnl Tests whether open() and creat() recognize a trailing slash.
9dnl Sets gl_cv_func_open_slash. 10dnl 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 @@
1# open.m4 1# open.m4
2# serial 16 2# serial 17
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_OPEN], 9AC_DEFUN([gl_FUNC_OPEN],
9[ 10[
10 AC_REQUIRE([AC_CANONICAL_HOST]) 11 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) 12 AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
13 AC_REQUIRE([gl_FCNTL_O_FLAGS])
14 AS_CASE([$gl_cv_header_working_fcntl_h],
15 [*O_DIRECTORY* | *no], [REPLACE_OPEN=1])
12 case "$host_os" in 16 case "$host_os" in
13 mingw* | windows* | pw*) 17 mingw* | windows* | pw*)
14 REPLACE_OPEN=1 18 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 @@
1# pathmax.m4 1# pathmax.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2002-2003, 2005-2006, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2003, 2005-2006, 2009-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_PATHMAX], 10AC_DEFUN([gl_PATHMAX],
10[ 11[
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 @@
1# pid_t.m4 1# pid_t.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# The following implementation works around a problem in autoconf <= 2.69. 9# The following implementation works around a problem in autoconf <= 2.69.
9m4_version_prereq([2.70], [], [ 10m4_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 @@
1# printf.m4 1# printf.m4
2# serial 91 2# serial 96
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Test whether the *printf family of functions supports the 'j', 'z', 't', 9dnl Test whether the *printf family of functions supports the 'j', 'z', 't',
9dnl 'L' size specifiers. (ISO C99, POSIX:2001) 10dnl 'L' size specifiers. (ISO C99, POSIX:2001)
@@ -616,6 +617,7 @@ static double zero = 0.0;
616int main () 617int main ()
617{ 618{
618 int result = 0; 619 int result = 0;
620 /* This fails on FreeBSD 5.2.1, Solaris 11.4. */
619 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 621 if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0
620 || (strcmp (buf, "0x1.922p+1 33") != 0 622 || (strcmp (buf, "0x1.922p+1 33") != 0
621 && strcmp (buf, "0x3.244p+0 33") != 0 623 && strcmp (buf, "0x3.244p+0 33") != 0
@@ -627,27 +629,29 @@ int main ()
627 && strcmp (buf, "-0X3.244P+0 33") != 0 629 && strcmp (buf, "-0X3.244P+0 33") != 0
628 && strcmp (buf, "-0X6.488P-1 33") != 0 630 && strcmp (buf, "-0X6.488P-1 33") != 0
629 && strcmp (buf, "-0XC.91P-2 33") != 0)) 631 && strcmp (buf, "-0XC.91P-2 33") != 0))
630 result |= 2; 632 result |= 1;
631 /* This catches a FreeBSD 13.0 bug: it doesn't round. */ 633 /* This catches a Mac OS X 10.5, FreeBSD 6.4, NetBSD 10.0 bug:
634 it doesn't round. */
632 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 635 if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0
633 || (strcmp (buf, "0x1.83p+0 33") != 0 636 || (strcmp (buf, "0x1.83p+0 33") != 0
634 && strcmp (buf, "0x3.05p-1 33") != 0 637 && strcmp (buf, "0x3.05p-1 33") != 0
635 && strcmp (buf, "0x6.0ap-2 33") != 0 638 && strcmp (buf, "0x6.0ap-2 33") != 0
636 && strcmp (buf, "0xc.14p-3 33") != 0)) 639 && strcmp (buf, "0xc.14p-3 33") != 0))
637 result |= 4; 640 result |= 2;
638 /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ 641 /* This catches a macOS 14 (Darwin 23), FreeBSD 14.0, OpenBSD 7.5, AIX 7.3,
642 Solaris 11.4 bug: it doesn't round. */
639 if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 643 if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
640 || (strcmp (buf, "0x2p+0 33") != 0 644 || (strcmp (buf, "0x2p+0 33") != 0
641 && strcmp (buf, "0x3p-1 33") != 0 645 && strcmp (buf, "0x3p-1 33") != 0
642 && strcmp (buf, "0x6p-2 33") != 0 646 && strcmp (buf, "0x6p-2 33") != 0
643 && strcmp (buf, "0xcp-3 33") != 0)) 647 && strcmp (buf, "0xcp-3 33") != 0))
644 result |= 4; 648 result |= 4;
645 /* This catches a FreeBSD 6.1 bug. See 649 /* This catches a Mac OS X 10.5, FreeBSD 6.4 bug. See
646 <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */ 650 <https://lists.gnu.org/r/bug-gnulib/2007-04/msg00107.html> */
647 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 651 if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0
648 || buf[0] == '0') 652 || buf[0] == '0')
649 result |= 8; 653 result |= 8;
650 /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ 654 /* This catches a Mac OS X 10.3.9 (Darwin 7.9), FreeBSD 6.4 bug. */
651 if (sprintf (buf, "%.1a", 1.999) < 0 655 if (sprintf (buf, "%.1a", 1.999) < 0
652 || (strcmp (buf, "0x1.0p+1") != 0 656 || (strcmp (buf, "0x1.0p+1") != 0
653 && strcmp (buf, "0x2.0p+0") != 0 657 && strcmp (buf, "0x2.0p+0") != 0
@@ -655,7 +659,8 @@ int main ()
655 && strcmp (buf, "0x8.0p-2") != 0)) 659 && strcmp (buf, "0x8.0p-2") != 0))
656 result |= 16; 660 result |= 16;
657 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a 661 /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a
658 glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>. */ 662 glibc 2.4 bug <https://sourceware.org/bugzilla/show_bug.cgi?id=2908>
663 and a FreeBSD 6.4, NetBSD 10.0 bug. */
659 if (sprintf (buf, "%.1La", 1.999L) < 0 664 if (sprintf (buf, "%.1La", 1.999L) < 0
660 || (strcmp (buf, "0x1.0p+1") != 0 665 || (strcmp (buf, "0x1.0p+1") != 0
661 && strcmp (buf, "0x2.0p+0") != 0 666 && strcmp (buf, "0x2.0p+0") != 0
@@ -893,9 +898,14 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
893 [AC_LANG_SOURCE([[ 898 [AC_LANG_SOURCE([[
894#include <signal.h> 899#include <signal.h>
895#include <stdio.h> 900#include <stdio.h>
896#include <stdlib.h>
897#include <string.h> 901#include <string.h>
902#if defined _WIN32 && !defined __CYGWIN__
903# include <stdlib.h>
904#else
905# include <unistd.h>
906#endif
898#ifdef _MSC_VER 907#ifdef _MSC_VER
908#include <crtdbg.h>
899#include <inttypes.h> 909#include <inttypes.h>
900/* See page about "Parameter Validation" on msdn.microsoft.com. 910/* See page about "Parameter Validation" on msdn.microsoft.com.
901 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation> 911 <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation>
@@ -922,6 +932,9 @@ int main ()
922 int count = -1; 932 int count = -1;
923#ifdef _MSC_VER 933#ifdef _MSC_VER
924 _set_invalid_parameter_handler (invalid_parameter_handler); 934 _set_invalid_parameter_handler (invalid_parameter_handler);
935 /* Also avoid an Abort/Retry/Ignore dialog in debug builds.
936 <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode> */
937 _CrtSetReportMode (_CRT_ASSERT, 0);
925#endif 938#endif
926 signal (SIGABRT, abort_handler); 939 signal (SIGABRT, abort_handler);
927 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) 940 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2)
@@ -1173,6 +1186,112 @@ changequote([,])dnl
1173 ]) 1186 ])
1174]) 1187])
1175 1188
1189dnl Test whether the *printf family of functions supports POSIX/XSI format
1190dnl strings with the ' flag for grouping of decimal digits on integers,
1191dnl together with a precision.
1192dnl Result is gl_cv_func_printf_flag_grouping_int_precision.
1193
1194AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION],
1195[
1196 AC_REQUIRE([AC_PROG_CC])
1197 AC_REQUIRE([AC_CANONICAL_HOST])
1198 AC_CACHE_CHECK([whether printf supports grouping on integers with a precision],
1199 [gl_cv_func_printf_flag_grouping_int_precision],
1200 [
1201 dnl Prepare a guess, used when cross-compiling or when specific locales
1202 dnl are not available.
1203 case "$host_os" in
1204 # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku.
1205 freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*)
1206 gl_cv_func_printf_flag_grouping_int_precision="guessing no";;
1207 *)
1208 gl_cv_func_printf_flag_grouping_int_precision="guessing yes";;
1209 esac
1210 AC_RUN_IFELSE(
1211 [AC_LANG_SOURCE([[
1212#include <locale.h>
1213#include <stdio.h>
1214#include <string.h>
1215static char buf[100];
1216int main ()
1217{
1218 if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
1219 || setlocale (LC_ALL, "fr_FR") != NULL
1220 || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
1221 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
1222 {
1223 if (sprintf (buf, "%'.10d", 1000) < 0)
1224 return 1;
1225 if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0)
1226 /* The sprintf implementation has produced fewer than 10 digits. */
1227 return 2;
1228 else
1229 return 0;
1230 }
1231 return 3;
1232}]])],
1233 [gl_cv_func_printf_flag_grouping_int_precision=yes],
1234 [if test $? = 2; then
1235 gl_cv_func_printf_flag_grouping_int_precision=no
1236 fi
1237 ],
1238 [:])
1239 ])
1240])
1241
1242dnl Test whether the *printf family of functions supports POSIX/XSI format
1243dnl strings with the ' flag for grouping of decimal digits, when the thousands
1244dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8
1245dnl locale).
1246dnl Result is gl_cv_func_printf_flag_grouping_multibyte.
1247
1248AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE],
1249[
1250 AC_REQUIRE([AC_PROG_CC])
1251 AC_REQUIRE([AC_CANONICAL_HOST])
1252 AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator],
1253 [gl_cv_func_printf_flag_grouping_multibyte],
1254 [
1255 dnl Prepare a guess, used when cross-compiling or when specific locales
1256 dnl are not available.
1257 case "$host_os" in
1258 # Guess no on NetBSD and Solaris 11 OpenIndiana.
1259 netbsd* | solaris*)
1260 gl_cv_func_printf_flag_grouping_multibyte="guessing no";;
1261 *)
1262 gl_cv_func_printf_flag_grouping_multibyte="guessing yes";;
1263 esac
1264 AC_RUN_IFELSE(
1265 [AC_LANG_SOURCE([[
1266#include <locale.h>
1267#include <stdio.h>
1268#include <string.h>
1269static char buf[100];
1270int main ()
1271{
1272 if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL)
1273 return 0;
1274 if (sprintf (buf, "%'.0f", 1000.0) < 0)
1275 return 1;
1276 if (strlen (localeconv ()->thousands_sep) > 1)
1277 {
1278 if (strlen (buf) <= 4 + 1)
1279 return 2;
1280 else
1281 return 3;
1282 }
1283 return 0;
1284}]])],
1285 [:],
1286 [case $? in
1287 2) gl_cv_func_printf_flag_grouping_multibyte=no ;;
1288 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;;
1289 esac
1290 ],
1291 [:])
1292 ])
1293])
1294
1176dnl Test whether the *printf family of functions supports the - flag correctly. 1295dnl Test whether the *printf family of functions supports the - flag correctly.
1177dnl (ISO C99.) See 1296dnl (ISO C99.) See
1178dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> 1297dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
@@ -1709,6 +1828,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1709#include <signal.h> 1828#include <signal.h>
1710#include <stdio.h> 1829#include <stdio.h>
1711#include <string.h> 1830#include <string.h>
1831#if defined _WIN32 && !defined __CYGWIN__
1832# include <stdlib.h>
1833#else
1834# include <unistd.h>
1835#endif
1712#if HAVE_SNPRINTF 1836#if HAVE_SNPRINTF
1713# define my_snprintf snprintf 1837# define my_snprintf snprintf
1714#else 1838#else
@@ -2143,20 +2267,22 @@ dnl 11 = gl_PRINTF_DIRECTIVE_LS
2143dnl 12 = gl_PRINTF_DIRECTIVE_LC 2267dnl 12 = gl_PRINTF_DIRECTIVE_LC
2144dnl 13 = gl_PRINTF_POSITIONS 2268dnl 13 = gl_PRINTF_POSITIONS
2145dnl 14 = gl_PRINTF_FLAG_GROUPING 2269dnl 14 = gl_PRINTF_FLAG_GROUPING
2146dnl 15 = gl_PRINTF_FLAG_LEFTADJUST 2270dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION
2147dnl 16 = gl_PRINTF_FLAG_ZERO 2271dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE
2148dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO 2272dnl 17 = gl_PRINTF_FLAG_LEFTADJUST
2149dnl 18 = gl_PRINTF_PRECISION 2273dnl 18 = gl_PRINTF_FLAG_ZERO
2150dnl 19 = gl_PRINTF_ENOMEM 2274dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
2151dnl 20 = gl_SNPRINTF_PRESENCE 2275dnl 20 = gl_PRINTF_PRECISION
2152dnl 21 = gl_SNPRINTF_TRUNCATION_C99 2276dnl 21 = gl_PRINTF_ENOMEM
2153dnl 22 = gl_SNPRINTF_RETVAL_C99 2277dnl 22 = gl_SNPRINTF_PRESENCE
2154dnl 23 = gl_SNPRINTF_DIRECTIVE_N 2278dnl 23 = gl_SNPRINTF_TRUNCATION_C99
2155dnl 24 = gl_SNPRINTF_SIZE1 2279dnl 24 = gl_SNPRINTF_RETVAL_C99
2156dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 2280dnl 25 = gl_SNPRINTF_DIRECTIVE_N
2157dnl 26 = gl_SWPRINTF_WORKS 2281dnl 26 = gl_SNPRINTF_SIZE1
2158dnl 27 = gl_SWPRINTF_DIRECTIVE_LA 2282dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99
2159dnl 28 = gl_SWPRINTF_DIRECTIVE_LC 2283dnl 28 = gl_SWPRINTF_WORKS
2284dnl 29 = gl_SWPRINTF_DIRECTIVE_LA
2285dnl 30 = gl_SWPRINTF_DIRECTIVE_LC
2160dnl 2286dnl
2161dnl 1 = checking whether printf supports size specifiers as in C99... 2287dnl 1 = checking whether printf supports size specifiers as in C99...
2162dnl 2 = checking whether printf supports size specifiers as in C23... 2288dnl 2 = checking whether printf supports size specifiers as in C23...
@@ -2172,62 +2298,64 @@ dnl 11 = checking whether printf supports the 'ls' directive...
2172dnl 12 = checking whether printf supports the 'lc' directive correctly... 2298dnl 12 = checking whether printf supports the 'lc' directive correctly...
2173dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... 2299dnl 13 = checking whether printf supports POSIX/XSI format strings with positions...
2174dnl 14 = checking whether printf supports the grouping flag... 2300dnl 14 = checking whether printf supports the grouping flag...
2175dnl 15 = checking whether printf supports the left-adjust flag correctly... 2301dnl 15 = checking whether printf supports grouping on integers with a precision...
2176dnl 16 = checking whether printf supports the zero flag correctly... 2302dnl 16 = checking whether printf supports grouping with a multibyte separator...
2177dnl 17 = checking whether printf supports the alternative flag with a zero precision... 2303dnl 17 = checking whether printf supports the left-adjust flag correctly...
2178dnl 18 = checking whether printf supports large precisions... 2304dnl 18 = checking whether printf supports the zero flag correctly...
2179dnl 19 = checking whether printf survives out-of-memory conditions... 2305dnl 19 = checking whether printf supports the alternative flag with a zero precision...
2180dnl 20 = checking for snprintf... 2306dnl 20 = checking whether printf supports large precisions...
2181dnl 21 = checking whether snprintf truncates the result as in C99... 2307dnl 21 = checking whether printf survives out-of-memory conditions...
2182dnl 22 = checking whether snprintf returns a byte count as in C99... 2308dnl 22 = checking for snprintf...
2183dnl 23 = checking whether snprintf fully supports the 'n' directive... 2309dnl 23 = checking whether snprintf truncates the result as in C99...
2184dnl 24 = checking whether snprintf respects a size of 1... 2310dnl 24 = checking whether snprintf returns a byte count as in C99...
2185dnl 25 = checking whether vsnprintf respects a zero size as in C99... 2311dnl 25 = checking whether snprintf fully supports the 'n' directive...
2186dnl 26 = checking whether swprintf works... 2312dnl 26 = checking whether snprintf respects a size of 1...
2187dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... 2313dnl 27 = checking whether vsnprintf respects a zero size as in C99...
2188dnl 28 = checking whether swprintf supports the 'lc' directive... 2314dnl 28 = checking whether swprintf works...
2315dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives...
2316dnl 30 = checking whether swprintf supports the 'lc' directive...
2189dnl 2317dnl
2190dnl . = yes, # = no. 2318dnl . = yes, # = no.
2191dnl 2319dnl
2192dnl 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 2320dnl 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
2193dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # 2321dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . #
2194dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . 2322dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . .
2195dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . 2323dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # .
2196dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . 2324dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # .
2197dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # 2325dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . #
2198dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2326dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . #
2199dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? 2327dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ?
2200dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? 2328dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ?
2201dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? 2329dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ?
2202dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? 2330dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ?
2203dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2331dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . #
2204dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? 2332dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ?
2205dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? 2333dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ?
2206dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? 2334dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ?
2207dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? 2335dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ?
2208dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . 2336dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # .
2209dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . 2337dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # .
2210dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? 2338dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ?
2211dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . 2339dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # .
2212dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? 2340dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ?
2213dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? 2341dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ?
2214dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . 2342dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . .
2215dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? 2343dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ?
2216dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? 2344dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ?
2217dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? 2345dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ?
2218dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? 2346dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ?
2219dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? 2347dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ?
2220dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? 2348dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ?
2221dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? 2349dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ?
2222dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? 2350dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ?
2223dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # 2351dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . #
2224dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? 2352dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ?
2225dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? 2353dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ?
2226dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? 2354dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ?
2227dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . 2355dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # .
2228dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? 2356dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ?
2229dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? 2357dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ?
2230dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2358dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
2231dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? 2359dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ?
2232dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? 2360dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ?
2233dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2361dnl 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 @@
1# pthread-once.m4
2# serial 6
3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_PTHREAD_ONCE],
10[
11 AC_REQUIRE([gl_PTHREAD_H])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13 AC_REQUIRE([gl_PTHREADLIB])
14
15 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
16 && test $gl_threads_api = windows; then
17 dnl Choose function names that don't conflict with the mingw-w64 winpthreads
18 dnl library.
19 REPLACE_PTHREAD_ONCE=1
20 PTHREAD_ONCE_LIB=
21 else
22 if test $HAVE_PTHREAD_H = 0; then
23 HAVE_PTHREAD_ONCE=0
24 PTHREAD_ONCE_LIB=
25 else
26 dnl Work around Cygwin 3.5.3 bug.
27 AC_CACHE_CHECK([whether pthread_once works],
28 [gl_cv_func_pthread_once_works],
29 [case "$host_os" in
30 cygwin*) gl_cv_func_pthread_once_works="guessing no" ;;
31 *) gl_cv_func_pthread_once_works="yes" ;;
32 esac
33 ])
34 case "$gl_cv_func_pthread_once_works" in
35 *yes) ;;
36 *) REPLACE_PTHREAD_ONCE=1 ;;
37 esac
38 dnl Determine whether linking requires $(LIBPMULTITHREAD) or only
39 dnl $(LIBPTHREAD).
40 if test -z "$LIBPTHREAD" && test -n "$LIBPMULTITHREAD"; then
41 AC_CACHE_CHECK([whether pthread_once can be used without linking with libpthread],
42 [gl_cv_func_pthread_once_no_lib],
43 [AC_RUN_IFELSE(
44 [AC_LANG_PROGRAM(
45 [[#include <pthread.h>
46 static pthread_once_t a_once = PTHREAD_ONCE_INIT;
47 static int a;
48 static void a_init (void) { a = 8647; }
49 ]],
50 [[if (pthread_once (&a_once, a_init)) return 1;
51 if (a != 8647) return 2;
52 return 0;
53 ]])],
54 [gl_cv_func_pthread_once_no_lib=yes],
55 [gl_cv_func_pthread_once_no_lib=no],
56 [case "$host_os" in
57 # Guess no on glibc.
58 *-gnu* | gnu*)
59 gl_cv_func_pthread_once_no_lib="guessing no" ;;
60 # Guess no on FreeBSD.
61 freebsd* | dragonfly* | midnightbsd*)
62 gl_cv_func_pthread_once_no_lib="guessing no" ;;
63 # Guess yes otherwise.
64 *)
65 gl_cv_func_pthread_once_no_lib="guessing yes" ;;
66 esac
67 ])
68 ])
69 case "$gl_cv_func_pthread_once_no_lib" in
70 *yes) PTHREAD_ONCE_LIB="$LIBPTHREAD" ;;
71 *) PTHREAD_ONCE_LIB="$LIBPMULTITHREAD" ;;
72 esac
73 dnl Expected result:
74 dnl PTHREAD_ONCE_LIB is $(LIBPMULTITHREAD) on glibc < 2.34, FreeBSD.
75 dnl PTHREAD_ONCE_LIB is $(LIBPTHREAD) in particular on
76 dnl musl libc, macOS, NetBSD, Solaris, Cygwin, Haiku, Android.
77 else
78 PTHREAD_ONCE_LIB="$LIBPTHREAD"
79 fi
80 fi
81 fi
82 AC_SUBST([PTHREAD_ONCE_LIB])
83])
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 @@
1# pthread-spin.m4
2# serial 8
3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_PTHREAD_SPIN],
10[
11 AC_REQUIRE([gl_PTHREAD_H_PART1])
12 AC_REQUIRE([AC_CANONICAL_HOST])
13
14 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
15 && test $gl_threads_api = windows; then
16 dnl Choose function names that don't conflict with the mingw-w64 winpthreads
17 dnl library.
18 REPLACE_PTHREAD_SPIN_INIT=1
19 REPLACE_PTHREAD_SPIN_LOCK=1
20 REPLACE_PTHREAD_SPIN_TRYLOCK=1
21 REPLACE_PTHREAD_SPIN_UNLOCK=1
22 REPLACE_PTHREAD_SPIN_DESTROY=1
23 else
24 if test $HAVE_PTHREAD_H = 0 || test $HAVE_PTHREAD_SPINLOCK_T = 0; then
25 HAVE_PTHREAD_SPIN_INIT=0
26 HAVE_PTHREAD_SPIN_LOCK=0
27 HAVE_PTHREAD_SPIN_TRYLOCK=0
28 HAVE_PTHREAD_SPIN_UNLOCK=0
29 HAVE_PTHREAD_SPIN_DESTROY=0
30 else
31 dnl Test whether the gnulib module 'threadlib' is in use.
32 dnl Some packages like Emacs use --avoid=threadlib.
33 dnl Write the symbol in such a way that it does not cause 'aclocal' to pick
34 dnl the threadlib.m4 file that is installed in $PREFIX/share/aclocal/.
35 m4_ifdef([gl_][THREADLIB], [
36 AC_REQUIRE([gl_][THREADLIB])
37 dnl Test whether the functions actually exist.
38 dnl FreeBSD 5.2.1 declares them but does not define them.
39 AC_CACHE_CHECK([for pthread_spin_init],
40 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD],
41 [gl_saved_LIBS="$LIBS"
42 LIBS="$LIBS $LIBMULTITHREAD"
43 AC_LINK_IFELSE(
44 [AC_LANG_PROGRAM(
45 [[#include <pthread.h>
46 ]],
47 [[pthread_spinlock_t lock;
48 return pthread_spin_init (&lock, 0);
49 ]])
50 ],
51 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=yes],
52 [gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD=no])
53 LIBS="$gl_saved_LIBS"
54 ])
55 if test $gl_cv_func_pthread_spin_init_in_LIBMULTITHREAD != yes; then
56 HAVE_PTHREAD_SPIN_INIT=0
57 REPLACE_PTHREAD_SPIN_INIT=1
58 HAVE_PTHREAD_SPIN_LOCK=0
59 REPLACE_PTHREAD_SPIN_LOCK=1
60 HAVE_PTHREAD_SPIN_TRYLOCK=0
61 REPLACE_PTHREAD_SPIN_TRYLOCK=1
62 HAVE_PTHREAD_SPIN_UNLOCK=0
63 REPLACE_PTHREAD_SPIN_UNLOCK=1
64 HAVE_PTHREAD_SPIN_DESTROY=0
65 REPLACE_PTHREAD_SPIN_DESTROY=1
66 fi
67 ], [
68 :
69 ])
70 fi
71 fi
72])
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 @@
1# pthread_h.m4
2# serial 11
3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_PTHREAD_H_PART1],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
14
15 AC_REQUIRE([AC_CANONICAL_HOST])
16 AC_REQUIRE([gl_PTHREADLIB])
17
18 gl_CHECK_NEXT_HEADERS([pthread.h])
19 if test $ac_cv_header_pthread_h = yes; then
20 HAVE_PTHREAD_H=1
21 dnl On mingw, if --enable-threads=windows or gl_AVOID_WINPTHREAD is used,
22 dnl ignore the <pthread.h> from the mingw-w64 winpthreads library.
23 m4_ifdef([gl_][THREADLIB], [
24 AC_REQUIRE([gl_][THREADLIB])
25 if { case "$host_os" in mingw* | windows*) true;; *) false;; esac; } \
26 && test $gl_threads_api = windows; then
27 HAVE_PTHREAD_H=0
28 fi
29 ])
30 else
31 HAVE_PTHREAD_H=0
32 fi
33 AC_SUBST([HAVE_PTHREAD_H])
34
35 AC_CHECK_TYPES([pthread_t, pthread_spinlock_t], [], [],
36 [AC_INCLUDES_DEFAULT[
37 #if HAVE_PTHREAD_H
38 #include <pthread.h>
39 #endif]])
40 if test $ac_cv_type_pthread_t != yes; then
41 HAVE_PTHREAD_T=0
42 fi
43 if test $ac_cv_type_pthread_spinlock_t != yes; then
44 HAVE_PTHREAD_SPINLOCK_T=0
45 fi
46])
47
48AC_DEFUN([gl_PTHREAD_H],
49[
50 AC_REQUIRE([gl_PTHREAD_H_PART1])
51
52 dnl Set HAVE_PTHREAD_SPIN_INIT, REPLACE_PTHREAD_SPIN_INIT.
53 gl_PTHREAD_SPIN
54
55 dnl Constants may be defined as C preprocessor macros or as enum items.
56
57 AC_CACHE_CHECK([for PTHREAD_CREATE_DETACHED],
58 [gl_cv_const_PTHREAD_CREATE_DETACHED],
59 [AC_COMPILE_IFELSE(
60 [AC_LANG_PROGRAM(
61 [[#include <pthread.h>
62 int x = PTHREAD_CREATE_DETACHED;
63 ]],
64 [[]])],
65 [gl_cv_const_PTHREAD_CREATE_DETACHED=yes],
66 [gl_cv_const_PTHREAD_CREATE_DETACHED=no])
67 ])
68 if test $gl_cv_const_PTHREAD_CREATE_DETACHED != yes; then
69 HAVE_PTHREAD_CREATE_DETACHED=0
70 fi
71
72 AC_CACHE_CHECK([for PTHREAD_MUTEX_RECURSIVE],
73 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE],
74 [AC_COMPILE_IFELSE(
75 [AC_LANG_PROGRAM(
76 [[#include <pthread.h>
77 int x = PTHREAD_MUTEX_RECURSIVE;
78 ]],
79 [[]])],
80 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=yes],
81 [gl_cv_const_PTHREAD_MUTEX_RECURSIVE=no])
82 ])
83 if test $gl_cv_const_PTHREAD_MUTEX_RECURSIVE != yes; then
84 HAVE_PTHREAD_MUTEX_RECURSIVE=0
85 fi
86
87 AC_CACHE_CHECK([for PTHREAD_MUTEX_ROBUST],
88 [gl_cv_const_PTHREAD_MUTEX_ROBUST],
89 [AC_COMPILE_IFELSE(
90 [AC_LANG_PROGRAM(
91 [[#include <pthread.h>
92 int x = PTHREAD_MUTEX_ROBUST;
93 ]],
94 [[]])],
95 [gl_cv_const_PTHREAD_MUTEX_ROBUST=yes],
96 [gl_cv_const_PTHREAD_MUTEX_ROBUST=no])
97 ])
98 if test $gl_cv_const_PTHREAD_MUTEX_ROBUST != yes; then
99 HAVE_PTHREAD_MUTEX_ROBUST=0
100 fi
101
102 AC_CACHE_CHECK([for PTHREAD_PROCESS_SHARED],
103 [gl_cv_const_PTHREAD_PROCESS_SHARED],
104 [AC_COMPILE_IFELSE(
105 [AC_LANG_PROGRAM(
106 [[#include <pthread.h>
107 int x = PTHREAD_PROCESS_SHARED;
108 ]],
109 [[]])],
110 [gl_cv_const_PTHREAD_PROCESS_SHARED=yes],
111 [gl_cv_const_PTHREAD_PROCESS_SHARED=no])
112 ])
113 if test $gl_cv_const_PTHREAD_PROCESS_SHARED != yes; then
114 HAVE_PTHREAD_PROCESS_SHARED=0
115 fi
116
117 dnl Check for declarations of anything we want to poison if the
118 dnl corresponding gnulib module is not in use, if it is not common
119 dnl enough to be declared everywhere.
120 gl_WARN_ON_USE_PREPARE([[#include <pthread.h>
121 ]], [
122 pthread_create pthread_attr_init pthread_attr_getdetachstate
123 pthread_attr_setdetachstate pthread_attr_destroy pthread_self pthread_equal
124 pthread_detach pthread_join pthread_exit
125 pthread_once
126 pthread_mutex_init pthread_mutexattr_init pthread_mutexattr_gettype
127 pthread_mutexattr_settype pthread_mutexattr_getrobust
128 pthread_mutexattr_setrobust pthread_mutexattr_destroy pthread_mutex_lock
129 pthread_mutex_trylock pthread_mutex_timedlock pthread_mutex_unlock
130 pthread_mutex_destroy
131 pthread_rwlock_init pthread_rwlockattr_init pthread_rwlockattr_destroy
132 pthread_rwlock_rdlock pthread_rwlock_wrlock pthread_rwlock_tryrdlock
133 pthread_rwlock_trywrlock pthread_rwlock_timedrdlock
134 pthread_rwlock_timedwrlock pthread_rwlock_unlock pthread_rwlock_destroy
135 pthread_cond_init pthread_condattr_init pthread_condattr_destroy
136 pthread_cond_wait pthread_cond_timedwait pthread_cond_signal
137 pthread_cond_broadcast pthread_cond_destroy
138 pthread_key_create pthread_setspecific pthread_getspecific
139 pthread_key_delete
140 pthread_spin_init pthread_spin_lock pthread_spin_trylock pthread_spin_unlock
141 pthread_spin_destroy])
142
143 AC_REQUIRE([AC_C_RESTRICT])
144
145 dnl For backward compatibility with gnulib versions <= 2019-07.
146 LIB_PTHREAD="$LIBPMULTITHREAD"
147 AC_SUBST([LIB_PTHREAD])
148])
149
150# gl_PTHREAD_MODULE_INDICATOR([modulename])
151# sets the shell variable that indicates the presence of the given module
152# to a C preprocessor expression that will evaluate to 1.
153# This macro invocation must not occur in macros that are AC_REQUIREd.
154AC_DEFUN([gl_PTHREAD_MODULE_INDICATOR],
155[
156 dnl Ensure to expand the default settings once only.
157 gl_PTHREAD_H_REQUIRE_DEFAULTS
158 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
159 dnl Define it also as a C macro, for the benefit of the unit tests.
160 gl_MODULE_INDICATOR_FOR_TESTS([$1])
161])
162
163# Initializes the default values for AC_SUBSTed shell variables.
164# This macro must not be AC_REQUIREd. It must only be invoked, and only
165# outside of macros or in macros that are not AC_REQUIREd.
166AC_DEFUN([gl_PTHREAD_H_REQUIRE_DEFAULTS],
167[
168 m4_defun(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS], [
169 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_THREAD])
170 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_ONCE])
171 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX])
172 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_RWLOCK])
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_COND])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_TSS])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SPIN])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_MUTEX_TIMEDLOCK])
177 ])
178 m4_require(GL_MODULE_INDICATOR_PREFIX[_PTHREAD_H_MODULE_INDICATOR_DEFAULTS])
179 AC_REQUIRE([gl_PTHREAD_H_DEFAULTS])
180])
181
182AC_DEFUN([gl_PTHREAD_H_DEFAULTS],
183[
184 dnl Assume proper GNU behavior unless another module says otherwise.
185 HAVE_PTHREAD_T=1; AC_SUBST([HAVE_PTHREAD_T])
186 HAVE_PTHREAD_SPINLOCK_T=1; AC_SUBST([HAVE_PTHREAD_SPINLOCK_T])
187 HAVE_PTHREAD_CREATE_DETACHED=1; AC_SUBST([HAVE_PTHREAD_CREATE_DETACHED])
188 HAVE_PTHREAD_MUTEX_RECURSIVE=1; AC_SUBST([HAVE_PTHREAD_MUTEX_RECURSIVE])
189 HAVE_PTHREAD_MUTEX_ROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEX_ROBUST])
190 HAVE_PTHREAD_PROCESS_SHARED=1; AC_SUBST([HAVE_PTHREAD_PROCESS_SHARED])
191 HAVE_PTHREAD_CREATE=1; AC_SUBST([HAVE_PTHREAD_CREATE])
192 HAVE_PTHREAD_ATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_ATTR_INIT])
193 HAVE_PTHREAD_ATTR_GETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_GETDETACHSTATE])
194 HAVE_PTHREAD_ATTR_SETDETACHSTATE=1; AC_SUBST([HAVE_PTHREAD_ATTR_SETDETACHSTATE])
195 HAVE_PTHREAD_ATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_ATTR_DESTROY])
196 HAVE_PTHREAD_SELF=1; AC_SUBST([HAVE_PTHREAD_SELF])
197 HAVE_PTHREAD_EQUAL=1; AC_SUBST([HAVE_PTHREAD_EQUAL])
198 HAVE_PTHREAD_DETACH=1; AC_SUBST([HAVE_PTHREAD_DETACH])
199 HAVE_PTHREAD_JOIN=1; AC_SUBST([HAVE_PTHREAD_JOIN])
200 HAVE_PTHREAD_EXIT=1; AC_SUBST([HAVE_PTHREAD_EXIT])
201 HAVE_PTHREAD_ONCE=1; AC_SUBST([HAVE_PTHREAD_ONCE])
202 HAVE_PTHREAD_MUTEX_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEX_INIT])
203 HAVE_PTHREAD_MUTEXATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_INIT])
204 HAVE_PTHREAD_MUTEXATTR_GETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETTYPE])
205 HAVE_PTHREAD_MUTEXATTR_SETTYPE=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETTYPE])
206 HAVE_PTHREAD_MUTEXATTR_GETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_GETROBUST])
207 HAVE_PTHREAD_MUTEXATTR_SETROBUST=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_SETROBUST])
208 HAVE_PTHREAD_MUTEXATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEXATTR_DESTROY])
209 HAVE_PTHREAD_MUTEX_LOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_LOCK])
210 HAVE_PTHREAD_MUTEX_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TRYLOCK])
211 HAVE_PTHREAD_MUTEX_TIMEDLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_TIMEDLOCK])
212 HAVE_PTHREAD_MUTEX_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_MUTEX_UNLOCK])
213 HAVE_PTHREAD_MUTEX_DESTROY=1; AC_SUBST([HAVE_PTHREAD_MUTEX_DESTROY])
214 HAVE_PTHREAD_RWLOCK_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_INIT])
215 HAVE_PTHREAD_RWLOCKATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_INIT])
216 HAVE_PTHREAD_RWLOCKATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCKATTR_DESTROY])
217 HAVE_PTHREAD_RWLOCK_RDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_RDLOCK])
218 HAVE_PTHREAD_RWLOCK_WRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_WRLOCK])
219 HAVE_PTHREAD_RWLOCK_TRYRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYRDLOCK])
220 HAVE_PTHREAD_RWLOCK_TRYWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TRYWRLOCK])
221 HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK])
222 HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK])
223 HAVE_PTHREAD_RWLOCK_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_UNLOCK])
224 HAVE_PTHREAD_RWLOCK_DESTROY=1; AC_SUBST([HAVE_PTHREAD_RWLOCK_DESTROY])
225 HAVE_PTHREAD_COND_INIT=1; AC_SUBST([HAVE_PTHREAD_COND_INIT])
226 HAVE_PTHREAD_CONDATTR_INIT=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_INIT])
227 HAVE_PTHREAD_CONDATTR_DESTROY=1; AC_SUBST([HAVE_PTHREAD_CONDATTR_DESTROY])
228 HAVE_PTHREAD_COND_WAIT=1; AC_SUBST([HAVE_PTHREAD_COND_WAIT])
229 HAVE_PTHREAD_COND_TIMEDWAIT=1; AC_SUBST([HAVE_PTHREAD_COND_TIMEDWAIT])
230 HAVE_PTHREAD_COND_SIGNAL=1; AC_SUBST([HAVE_PTHREAD_COND_SIGNAL])
231 HAVE_PTHREAD_COND_BROADCAST=1; AC_SUBST([HAVE_PTHREAD_COND_BROADCAST])
232 HAVE_PTHREAD_COND_DESTROY=1; AC_SUBST([HAVE_PTHREAD_COND_DESTROY])
233 HAVE_PTHREAD_KEY_CREATE=1; AC_SUBST([HAVE_PTHREAD_KEY_CREATE])
234 HAVE_PTHREAD_SETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_SETSPECIFIC])
235 HAVE_PTHREAD_GETSPECIFIC=1; AC_SUBST([HAVE_PTHREAD_GETSPECIFIC])
236 HAVE_PTHREAD_KEY_DELETE=1; AC_SUBST([HAVE_PTHREAD_KEY_DELETE])
237 HAVE_PTHREAD_SPIN_INIT=1; AC_SUBST([HAVE_PTHREAD_SPIN_INIT])
238 HAVE_PTHREAD_SPIN_LOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_LOCK])
239 HAVE_PTHREAD_SPIN_TRYLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_TRYLOCK])
240 HAVE_PTHREAD_SPIN_UNLOCK=1; AC_SUBST([HAVE_PTHREAD_SPIN_UNLOCK])
241 HAVE_PTHREAD_SPIN_DESTROY=1; AC_SUBST([HAVE_PTHREAD_SPIN_DESTROY])
242 REPLACE_PTHREAD_CREATE=0; AC_SUBST([REPLACE_PTHREAD_CREATE])
243 REPLACE_PTHREAD_ATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_ATTR_INIT])
244 REPLACE_PTHREAD_ATTR_GETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_GETDETACHSTATE])
245 REPLACE_PTHREAD_ATTR_SETDETACHSTATE=0; AC_SUBST([REPLACE_PTHREAD_ATTR_SETDETACHSTATE])
246 REPLACE_PTHREAD_ATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_ATTR_DESTROY])
247 REPLACE_PTHREAD_SELF=0; AC_SUBST([REPLACE_PTHREAD_SELF])
248 REPLACE_PTHREAD_EQUAL=0; AC_SUBST([REPLACE_PTHREAD_EQUAL])
249 REPLACE_PTHREAD_DETACH=0; AC_SUBST([REPLACE_PTHREAD_DETACH])
250 REPLACE_PTHREAD_JOIN=0; AC_SUBST([REPLACE_PTHREAD_JOIN])
251 REPLACE_PTHREAD_EXIT=0; AC_SUBST([REPLACE_PTHREAD_EXIT])
252 REPLACE_PTHREAD_ONCE=0; AC_SUBST([REPLACE_PTHREAD_ONCE])
253 REPLACE_PTHREAD_MUTEX_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_INIT])
254 REPLACE_PTHREAD_MUTEXATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_INIT])
255 REPLACE_PTHREAD_MUTEXATTR_GETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETTYPE])
256 REPLACE_PTHREAD_MUTEXATTR_SETTYPE=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETTYPE])
257 REPLACE_PTHREAD_MUTEXATTR_GETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_GETROBUST])
258 REPLACE_PTHREAD_MUTEXATTR_SETROBUST=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_SETROBUST])
259 REPLACE_PTHREAD_MUTEXATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEXATTR_DESTROY])
260 REPLACE_PTHREAD_MUTEX_LOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_LOCK])
261 REPLACE_PTHREAD_MUTEX_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TRYLOCK])
262 REPLACE_PTHREAD_MUTEX_TIMEDLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_TIMEDLOCK])
263 REPLACE_PTHREAD_MUTEX_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_UNLOCK])
264 REPLACE_PTHREAD_MUTEX_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_MUTEX_DESTROY])
265 REPLACE_PTHREAD_RWLOCK_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_INIT])
266 REPLACE_PTHREAD_RWLOCKATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_INIT])
267 REPLACE_PTHREAD_RWLOCKATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCKATTR_DESTROY])
268 REPLACE_PTHREAD_RWLOCK_RDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_RDLOCK])
269 REPLACE_PTHREAD_RWLOCK_WRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_WRLOCK])
270 REPLACE_PTHREAD_RWLOCK_TRYRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYRDLOCK])
271 REPLACE_PTHREAD_RWLOCK_TRYWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TRYWRLOCK])
272 REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK])
273 REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK])
274 REPLACE_PTHREAD_RWLOCK_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_UNLOCK])
275 REPLACE_PTHREAD_RWLOCK_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_RWLOCK_DESTROY])
276 REPLACE_PTHREAD_COND_INIT=0; AC_SUBST([REPLACE_PTHREAD_COND_INIT])
277 REPLACE_PTHREAD_CONDATTR_INIT=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_INIT])
278 REPLACE_PTHREAD_CONDATTR_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_CONDATTR_DESTROY])
279 REPLACE_PTHREAD_COND_WAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_WAIT])
280 REPLACE_PTHREAD_COND_TIMEDWAIT=0; AC_SUBST([REPLACE_PTHREAD_COND_TIMEDWAIT])
281 REPLACE_PTHREAD_COND_SIGNAL=0; AC_SUBST([REPLACE_PTHREAD_COND_SIGNAL])
282 REPLACE_PTHREAD_COND_BROADCAST=0; AC_SUBST([REPLACE_PTHREAD_COND_BROADCAST])
283 REPLACE_PTHREAD_COND_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_COND_DESTROY])
284 REPLACE_PTHREAD_KEY_CREATE=0; AC_SUBST([REPLACE_PTHREAD_KEY_CREATE])
285 REPLACE_PTHREAD_SETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_SETSPECIFIC])
286 REPLACE_PTHREAD_GETSPECIFIC=0; AC_SUBST([REPLACE_PTHREAD_GETSPECIFIC])
287 REPLACE_PTHREAD_KEY_DELETE=0; AC_SUBST([REPLACE_PTHREAD_KEY_DELETE])
288 REPLACE_PTHREAD_SPIN_INIT=0; AC_SUBST([REPLACE_PTHREAD_SPIN_INIT])
289 REPLACE_PTHREAD_SPIN_LOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_LOCK])
290 REPLACE_PTHREAD_SPIN_TRYLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_TRYLOCK])
291 REPLACE_PTHREAD_SPIN_UNLOCK=0; AC_SUBST([REPLACE_PTHREAD_SPIN_UNLOCK])
292 REPLACE_PTHREAD_SPIN_DESTROY=0; AC_SUBST([REPLACE_PTHREAD_SPIN_DESTROY])
293])
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 @@
1# pthread_rwlock_rdlock.m4 1# pthread_rwlock_rdlock.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2017-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Inspired by 10dnl 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 @@
1# realloc.m4 1# realloc.m4
2# serial 29 2# serial 39.1
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# This is adapted with modifications from upstream Autoconf here: 9# An an experimental option, the user can request a sanitized realloc()
9# https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/functions.m4?id=v2.70#n1455 10# implementation, i.e. one that aborts upon undefined behaviour,
10AC_DEFUN([_AC_FUNC_REALLOC_IF], 11# by setting
12# gl_cv_func_realloc_sanitize=yes
13# at configure time.
14AC_DEFUN([gl_FUNC_REALLOC_SANITIZED],
11[ 15[
12 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles 16 AC_CACHE_CHECK([whether realloc should abort upon undefined behaviour],
13 AC_CACHE_CHECK([whether realloc (0, 0) returns nonnull], 17 [gl_cv_func_realloc_sanitize],
14 [ac_cv_func_realloc_0_nonnull], 18 [test -n "$gl_cv_func_realloc_sanitize" || gl_cv_func_realloc_sanitize=no])
15 [AC_RUN_IFELSE( 19])
16 [AC_LANG_PROGRAM(
17 [[#include <stdlib.h>
18 ]],
19 [[void *p = realloc (0, 0);
20 void * volatile vp = p;
21 int result = !vp;
22 free (p);
23 return result;]])
24 ],
25 [ac_cv_func_realloc_0_nonnull=yes],
26 [ac_cv_func_realloc_0_nonnull=no],
27 [case "$host_os" in
28 # Guess yes on platforms where we know the result.
29 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
30 | gnu* | *-musl* | midipix* | midnightbsd* \
31 | hpux* | solaris* | cygwin* | mingw* | windows* | msys* )
32 ac_cv_func_realloc_0_nonnull="guessing yes" ;;
33 # If we don't know, obey --enable-cross-guesses.
34 *) ac_cv_func_realloc_0_nonnull="$gl_cross_guess_normal" ;;
35 esac
36 ])
37 ])
38 AS_CASE([$ac_cv_func_realloc_0_nonnull], [*yes], [$1], [$2])
39])# AC_FUNC_REALLOC
40
41# gl_FUNC_REALLOC_GNU
42# -------------------
43# Replace realloc if it is not compatible with GNU libc.
44AC_DEFUN([gl_FUNC_REALLOC_GNU],
45[
46 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
47 AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
48 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
49 _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
50 fi
51])# gl_FUNC_REALLOC_GNU
52 20
53# gl_FUNC_REALLOC_POSIX 21# gl_FUNC_REALLOC_POSIX
54# --------------------- 22# ---------------------
@@ -59,7 +27,100 @@ AC_DEFUN([gl_FUNC_REALLOC_POSIX],
59[ 27[
60 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 28 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
61 AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) 29 AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
62 if test $REPLACE_MALLOC_FOR_MALLOC_POSIX = 1; then 30 AC_REQUIRE([AC_CANONICAL_HOST])
31 AC_CACHE_CHECK([whether realloc sets errno on failure],
32 [gl_cv_func_realloc_posix],
33 [
34 dnl FreeBSD 15.0 realloc() does not set errno when asked for more than
35 dnl 0x7000000000000000 bytes.
36 case "$host_os" in
37 darwin* | freebsd* | dragonfly* | midnightbsd* | netbsd* | openbsd*)
38 AC_RUN_IFELSE(
39 [AC_LANG_SOURCE(
40 [[#include <errno.h>
41 #include <stdlib.h>
42 int main (int argc, char **argv)
43 {
44 void *p;
45 errno = 1729;
46 p = realloc (malloc (1), (size_t)(-1) / 100 * 49);
47 return (!p && errno == 1729);
48 }
49 ]])
50 ],
51 [gl_cv_func_realloc_posix=yes],
52 [gl_cv_func_realloc_posix=no],
53 [case "$host_os" in
54 freebsd*) gl_cv_func_realloc_posix="guessing no" ;;
55 *) gl_cv_func_realloc_posix="guessing yes" ;;
56 esac
57 ])
58 ;;
59 *)
60 gl_cv_func_realloc_posix="$gl_cv_func_malloc_posix"
61 ;;
62 esac
63 ])
64 case "$gl_cv_func_realloc_posix" in
65 *yes)
66 AC_DEFINE([HAVE_REALLOC_POSIX], [1],
67 [Define if realloc sets errno on allocation failure.])
68 ;;
69 *)
70 REPLACE_REALLOC_FOR_REALLOC_POSIX=1
71 ;;
72 esac
73 AC_REQUIRE([gl_FUNC_REALLOC_SANITIZED])
74 if test "$gl_cv_func_realloc_sanitize" != no; then
63 REPLACE_REALLOC_FOR_REALLOC_POSIX=1 75 REPLACE_REALLOC_FOR_REALLOC_POSIX=1
76 AC_DEFINE([NEED_SANITIZED_REALLOC], [1],
77 [Define to 1 if realloc should abort upon undefined behaviour.])
64 fi 78 fi
65]) 79])
80
81# gl_FUNC_REALLOC_0_NONNULL
82# -------------------------
83# Replace realloc if realloc (..., 0) returns null.
84# Modules that use this macro directly or indirectly should depend
85# on extensions-aix, so that _LINUX_SOURCE_COMPAT gets defined
86# before this macro gets invoked. This helps if !(__VEC__ || __AIXVEC),
87# and doesn't hurt otherwise.
88AC_DEFUN([gl_FUNC_REALLOC_0_NONNULL],
89[
90 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
91 AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
92 AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
93 AC_CACHE_CHECK([whether realloc (..., 0) returns nonnull],
94 [gl_cv_func_realloc_0_nonnull],
95 [AC_RUN_IFELSE(
96 [AC_LANG_PROGRAM(
97 [[#include <stdlib.h>
98 /* Use prealloc to test; "volatile" prevents the compiler
99 from optimizing the realloc call away. */
100 void *(*volatile prealloc) (void *, size_t) = realloc;]],
101 [[void *p = prealloc (0, 0);
102 int result = !p;
103 p = prealloc (p, 0);
104 result |= !p;
105 free (p);
106 return result;]])],
107 [gl_cv_func_realloc_0_nonnull=yes],
108 [gl_cv_func_realloc_0_nonnull=no],
109 [AS_CASE([$host_os],
110 [# Guess yes on platforms where we know the result.
111 freebsd* | netbsd* | openbsd* | darwin* | bitrig* \
112 | *-musl* | midipix* | midnightbsd* \
113 | hpux* | solaris* | cygwin*],
114 [gl_cv_func_realloc_0_nonnull="guessing yes"],
115 [# Guess as follows if we don't know.
116 gl_cv_func_realloc_0_nonnull=$gl_cross_guess_normal])])])
117 AS_CASE([$gl_cv_func_realloc_0_nonnull],
118 [*yes],
119 [AC_DEFINE([HAVE_REALLOC_0_NONNULL], [1],
120 [Define to 1 if realloc (..., 0) returns nonnull.])],
121 [AS_CASE([$gl_cv_func_realloc_sanitize,$gl_cv_malloc_ptrdiff,$gl_cv_func_malloc_posix,$host],
122 [yes,*,*,* | *,no,*,* | *,*,*no,* | *,*,*,aarch64c-*-freebsd*],
123 [REPLACE_REALLOC_FOR_REALLOC_POSIX=1],
124 [# Optimize for common case of glibc 2.1.1+ and compatibles.
125 REPLACE_REALLOC_FOR_REALLOC_POSIX=2])])
126])
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 @@
1# reallocarray.m4 1# reallocarray.m4
2# serial 5 2# serial 7
3dnl Copyright (C) 2017-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2017-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_REALLOCARRAY], 9AC_DEFUN([gl_FUNC_REALLOCARRAY],
9[ 10[
@@ -12,14 +13,21 @@ AC_DEFUN([gl_FUNC_REALLOCARRAY],
12 13
13 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 14 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
14 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF]) 15 AC_REQUIRE([gl_CHECK_MALLOC_PTRDIFF])
16 AC_REQUIRE([gl_FUNC_REALLOC_0_NONNULL])
15 gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]]) 17 gl_CHECK_FUNCS_ANDROID([reallocarray], [[#include <stdlib.h>]])
16 if test "$ac_cv_func_reallocarray" = no; then 18 if test "$ac_cv_func_reallocarray" = no; then
17 HAVE_REALLOCARRAY=0 19 HAVE_REALLOCARRAY=0
18 case "$gl_cv_onwards_func_reallocarray" in 20 case "$gl_cv_onwards_func_reallocarray" in
19 future*) REPLACE_REALLOCARRAY=1 ;; 21 future*) REPLACE_REALLOCARRAY=1 ;;
20 esac 22 esac
21 elif test "$gl_cv_malloc_ptrdiff" = no; then 23 else
22 REPLACE_REALLOCARRAY=1 24 if test "$gl_cv_malloc_ptrdiff" = no; then
25 REPLACE_REALLOCARRAY=1
26 fi
27 case "$gl_cv_func_realloc_0_nonnull" in
28 *yes) ;;
29 *) REPLACE_REALLOCARRAY=1 ;;
30 esac
23 fi 31 fi
24]) 32])
25 33
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 @@
1# regex.m4 1# regex.m4
2# serial 75 2# serial 81
3dnl Copyright (C) 1996-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Initially derived from code in GNU grep. 9dnl Initially derived from code in GNU grep.
9dnl Mostly written by Jim Meyering. 10dnl Mostly written by Jim Meyering.
@@ -39,19 +40,24 @@ AC_DEFUN([gl_REGEX],
39 #include <limits.h> 40 #include <limits.h>
40 #include <string.h> 41 #include <string.h>
41 42
42 #if defined M_CHECK_ACTION || HAVE_DECL_ALARM 43 #if HAVE_MALLOC_H
43 # include <signal.h> 44 # include <malloc.h> /* defines M_CHECK_ACTION on glibc */
44 # include <unistd.h>
45 #endif 45 #endif
46 46
47 #if HAVE_MALLOC_H 47 #if defined __HAIKU__ || defined M_CHECK_ACTION || HAVE_DECL_ALARM
48 # include <malloc.h> 48 # include <signal.h>
49 # include <unistd.h>
49 #endif 50 #endif
50 51
51 #ifdef M_CHECK_ACTION 52 #if defined __HAIKU__ || defined M_CHECK_ACTION
52 /* Exit with distinguishable exit code. */ 53 /* Exit with distinguishable exit code. */
53 static void sigabrt_no_core (int sig) { raise (SIGTERM); } 54 static void sigabrt_no_core (int sig) { raise (SIGTERM); }
54 #endif 55 #endif
56
57 /* There is no need to check whether RE_SYNTAX_EMACS is
58 (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
59 Emacs 21 (2001) and later, because Gnulib's lib/regex.h
60 is always used and has this value. */
55 ]], 61 ]],
56 [[int result = 0; 62 [[int result = 0;
57 static struct re_pattern_buffer regex; 63 static struct re_pattern_buffer regex;
@@ -67,6 +73,9 @@ AC_DEFUN([gl_REGEX],
67 signal (SIGALRM, SIG_DFL); 73 signal (SIGALRM, SIG_DFL);
68 alarm (2); 74 alarm (2);
69#endif 75#endif
76#ifdef __HAIKU__
77 signal (SIGABRT, sigabrt_no_core);
78#endif
70#ifdef M_CHECK_ACTION 79#ifdef M_CHECK_ACTION
71 signal (SIGABRT, sigabrt_no_core); 80 signal (SIGABRT, sigabrt_no_core);
72 mallopt (M_CHECK_ACTION, 2); 81 mallopt (M_CHECK_ACTION, 2);
@@ -388,7 +397,6 @@ AC_DEFUN([gl_PREREQ_REGEX],
388 AC_REQUIRE([AC_C_INLINE]) 397 AC_REQUIRE([AC_C_INLINE])
389 AC_REQUIRE([AC_C_RESTRICT]) 398 AC_REQUIRE([AC_C_RESTRICT])
390 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 399 AC_REQUIRE([AC_TYPE_MBSTATE_T])
391 AC_REQUIRE([gl_EEMALLOC])
392 AC_CHECK_HEADERS([libintl.h]) 400 AC_CHECK_HEADERS([libintl.h])
393 AC_CHECK_FUNCS_ONCE([isblank iswctype]) 401 AC_CHECK_FUNCS_ONCE([isblank iswctype])
394 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]]) 402 AC_CHECK_DECLS([isblank], [], [], [[#include <ctype.h>]])
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 @@
1# sched_h.m4
2# serial 16
3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Bruno Haible.
10
11AC_DEFUN_ONCE([gl_SCHED_H],
12[
13 dnl Ensure to expand the default settings once only, before all statements
14 dnl that occur in other macros.
15 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
16
17 AC_REQUIRE([AC_CANONICAL_HOST])
18
19 AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H])
20
21 AC_CHECK_HEADERS([sched.h], [], [],
22 [[#if HAVE_SYS_CDEFS_H
23 #include <sys/cdefs.h>
24 #endif
25 ]])
26 gl_NEXT_HEADERS([sched.h])
27
28 if test "$ac_cv_header_sched_h" = yes; then
29 HAVE_SCHED_H=1
30 else
31 HAVE_SCHED_H=0
32 fi
33 AC_SUBST([HAVE_SCHED_H])
34
35 if test "$HAVE_SCHED_H" = 1; then
36 AC_CHECK_TYPE([struct sched_param],
37 [HAVE_STRUCT_SCHED_PARAM=1], [HAVE_STRUCT_SCHED_PARAM=0],
38 [[#if HAVE_SYS_CDEFS_H
39 #include <sys/cdefs.h>
40 #endif
41 #include <sched.h>
42 ]])
43 else
44 HAVE_STRUCT_SCHED_PARAM=0
45 case "$host_os" in
46 os2*)
47 dnl On OS/2 kLIBC, struct sched_param is in spawn.h.
48 AC_CHECK_TYPE([struct sched_param],
49 [HAVE_STRUCT_SCHED_PARAM=1], [],
50 [#include <spawn.h>])
51 ;;
52 vms)
53 dnl On OpenVMS 7.2 or newer, struct sched_param is in pthread.h.
54 AC_CHECK_TYPE([struct sched_param],
55 [HAVE_STRUCT_SCHED_PARAM=1], [],
56 [#include <pthread.h>])
57 ;;
58 esac
59 fi
60 AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
61
62 dnl Ensure the type pid_t gets defined.
63 AC_REQUIRE([AC_TYPE_PID_T])
64
65 dnl Check for declarations of anything we want to poison if the
66 dnl corresponding gnulib module is not in use, if it is not common
67 dnl enough to be declared everywhere.
68 gl_WARN_ON_USE_PREPARE([[#include <sched.h>
69 ]], [sched_yield])
70])
71
72# gl_SCHED_MODULE_INDICATOR([modulename])
73# sets the shell variable that indicates the presence of the given module
74# to a C preprocessor expression that will evaluate to 1.
75# This macro invocation must not occur in macros that are AC_REQUIREd.
76AC_DEFUN([gl_SCHED_MODULE_INDICATOR],
77[
78 dnl Ensure to expand the default settings once only.
79 gl_SCHED_H_REQUIRE_DEFAULTS
80 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
81 dnl Define it also as a C macro, for the benefit of the unit tests.
82 gl_MODULE_INDICATOR_FOR_TESTS([$1])
83])
84
85# Initializes the default values for AC_SUBSTed shell variables.
86# This macro must not be AC_REQUIREd. It must only be invoked, and only
87# outside of macros or in macros that are not AC_REQUIREd.
88AC_DEFUN([gl_SCHED_H_REQUIRE_DEFAULTS],
89[
90 m4_defun(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS], [
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCHED_YIELD])
92 ])
93 m4_require(GL_MODULE_INDICATOR_PREFIX[_SCHED_H_MODULE_INDICATOR_DEFAULTS])
94 AC_REQUIRE([gl_SCHED_H_DEFAULTS])
95])
96
97AC_DEFUN([gl_SCHED_H_DEFAULTS],
98[
99 dnl Assume proper GNU behavior unless another module says otherwise.
100 HAVE_SCHED_YIELD=1; AC_SUBST([HAVE_SCHED_YIELD])
101 REPLACE_SCHED_YIELD=0; AC_SUBST([REPLACE_SCHED_YIELD])
102])
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 @@
1# servent.m4 1# servent.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SERVENT], 9AC_DEFUN([gl_SERVENT],
9[ 10[
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 @@
1# setenv.m4 1# setenv.m4
2# serial 33 2# serial 35
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_SETENV], 9AC_DEFUN([gl_FUNC_SETENV],
9[ 10[
@@ -155,6 +156,7 @@ AC_DEFUN([gl_PREREQ_SETENV],
155 AC_REQUIRE([gl_ENVIRON]) 156 AC_REQUIRE([gl_ENVIRON])
156 AC_CHECK_HEADERS_ONCE([unistd.h]) 157 AC_CHECK_HEADERS_ONCE([unistd.h])
157 AC_CHECK_HEADERS([search.h]) 158 AC_CHECK_HEADERS([search.h])
159 AC_CHECK_DECLS_ONCE([_putenv])
158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) 160 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
159]) 161])
160 162
@@ -163,4 +165,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV],
163[ 165[
164 AC_REQUIRE([gl_ENVIRON]) 166 AC_REQUIRE([gl_ENVIRON])
165 AC_CHECK_HEADERS_ONCE([unistd.h]) 167 AC_CHECK_HEADERS_ONCE([unistd.h])
168 AC_CHECK_DECLS_ONCE([_putenv])
166]) 169])
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 @@
1# setlocale_null.m4 1# setlocale_null.m4
2# serial 9 2# serial 10
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_SETLOCALE_NULL], 9AC_DEFUN_ONCE([gl_FUNC_SETLOCALE_NULL],
9[ 10[
10 AC_REQUIRE([AC_CANONICAL_HOST]) 11 AC_REQUIRE([AC_CANONICAL_HOST])
11 AC_REQUIRE([gl_PTHREADLIB]) 12 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 @@
1# sha256.m4 1# sha256.m4
2# serial 8 2# serial 8
3dnl Copyright (C) 2005, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SHA256], 9AC_DEFUN([gl_SHA256],
9[ 10[
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 @@
1# size_max.m4 1# size_max.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2003, 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
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 @@
1# snprintf.m4 1# snprintf.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Libintl 0.17 will replace snprintf only if it does not support %1$s, 9dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
9dnl but defers to any gnulib snprintf replacements. Therefore, gnulib 10dnl 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 @@
1# socketlib.m4 1# socketlib.m4
2# serial 4 2# serial 4
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl gl_SOCKETLIB 9dnl gl_SOCKETLIB
9dnl Determines the library to use for socket functions. 10dnl 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 @@
1# sockets.m4 1# sockets.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_SOCKETS], 9AC_DEFUN([gl_SOCKETS],
9[ 10[
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 @@
1# socklen.m4 1# socklen.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Albert Chin, Windows fixes from Simon Josefsson. 9dnl From Albert Chin, Windows fixes from Simon Josefsson.
9 10
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 @@
1# sockpfaf.m4 1# sockpfaf.m4
2# serial 10 2# serial 11
3dnl Copyright (C) 2004, 2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...) 9dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
9dnl and some common address families (AF_INET, AF_INET6, ...). 10dnl and some common address families (AF_INET, AF_INET6, ...).
@@ -64,6 +65,13 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
64 AC_REQUIRE([gl_SYS_SOCKET_H]) 65 AC_REQUIRE([gl_SYS_SOCKET_H])
65 AC_CHECK_HEADERS_ONCE([sys/un.h]) 66 AC_CHECK_HEADERS_ONCE([sys/un.h])
66 67
68 dnl Windows versions released after 2017 may have support for AF_UNIX.
69 dnl Including it requires types from <winsock2.h> to be defined.
70 dnl <https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/>.
71 if test "$ac_cv_header_winsock2_h" = yes; then
72 AC_CHECK_HEADERS([afunix.h], [], [], [#include <winsock2.h>])
73 fi
74
67 AC_CACHE_CHECK([for UNIX domain sockets], 75 AC_CACHE_CHECK([for UNIX domain sockets],
68 [gl_cv_socket_unix], 76 [gl_cv_socket_unix],
69 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> 77 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -75,6 +83,9 @@ AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
75#endif 83#endif
76#ifdef HAVE_WINSOCK2_H 84#ifdef HAVE_WINSOCK2_H
77#include <winsock2.h> 85#include <winsock2.h>
86#endif
87#ifdef HAVE_AFUNIX_H
88#include <afunix.h>
78#endif]], 89#endif]],
79[[int x = AF_UNIX; struct sockaddr_un y; 90[[int x = AF_UNIX; struct sockaddr_un y;
80 if (&x && &y) return 0;]])], 91 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 @@
1# ssize_t.m4 1# ssize_t.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2001-2003, 2006, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2003, 2006, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Define ssize_t if it does not already exist. 10dnl 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 @@
1# stat-time.m4 1# stat-time.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2025 Free Software
4dnl Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Checks for stat-related time functions. 10# Checks for stat-related time functions.
9 11
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 @@
1# stat.m4 1# stat.m4
2# serial 21 2# serial 21
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STAT], 9AC_DEFUN([gl_FUNC_STAT],
9[ 10[
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 @@
1# std-gnu11.m4 1# std-gnu11.m4
2# serial 1 2# serial 3
3 3
4# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- 4# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*-
5 5
6# The std-gnu23 module, which defines _AC_C_C23_OPTIONS, supersedes us.
7m4_ifndef([_AC_C_C23_OPTIONS], [
8
6# This implementation is taken from GNU Autoconf lib/autoconf/c.m4 9# This implementation is taken from GNU Autoconf lib/autoconf/c.m4
7# commit 017d5ddd82854911f0119691d91ea8a1438824d6 10# commit 017d5ddd82854911f0119691d91ea8a1438824d6
8# dated Sun Apr 3 13:57:17 2016 -0700 11# dated Sun Apr 3 13:57:17 2016 -0700
12# with minor changes to commentary.
9# This implementation will be obsolete once we can assume Autoconf 2.70 13# This implementation will be obsolete once we can assume Autoconf 2.70
10# or later is installed everywhere a Gnulib program might be developed. 14# or later is installed everywhere a Gnulib program might be developed.
11 15
12m4_version_prereq([2.70], [], [ 16m4_version_prereq([2.70], [], [
13 17
14 18
15# Copyright (C) 2001-2024 Free Software Foundation, Inc. 19# Copyright (C) 2001-2025 Free Software Foundation, Inc.
16 20
17# This program is free software; you can redistribute it and/or modify 21# This file is part of Autoconf. This program is free
18# it under the terms of the GNU General Public License as published by 22# software; you can redistribute it and/or modify it under the
19# the Free Software Foundation, either version 3 of the License, or 23# terms of the GNU General Public License as published by the
24# Free Software Foundation, either version 3 of the License, or
20# (at your option) any later version. 25# (at your option) any later version.
21# 26#
22# This program is distributed in the hope that it will be useful, 27# This program is distributed in the hope that it will be useful,
@@ -24,8 +29,15 @@ m4_version_prereq([2.70], [], [
24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25# GNU General Public License for more details. 30# GNU General Public License for more details.
26# 31#
32# Under Section 7 of GPL version 3, you are granted additional
33# permissions described in the Autoconf Configure Script Exception,
34# version 3.0, as published by the Free Software Foundation.
35#
27# You should have received a copy of the GNU General Public License 36# You should have received a copy of the GNU General Public License
28# along with this program. If not, see <https://www.gnu.org/licenses/>. 37# and a copy of the Autoconf Configure Script Exception along with
38# this program; see the files COPYINGv3 and COPYING.EXCEPTION
39# respectively. If not, see <https://www.gnu.org/licenses/> and
40# <https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;f=COPYING.EXCEPTION>.
29 41
30# Written by David MacKenzie, with help from 42# Written by David MacKenzie, with help from
31# Akim Demaille, Paul Eggert, 43# Akim Demaille, Paul Eggert,
@@ -38,7 +50,7 @@ m4_version_prereq([2.70], [], [
38# COMPILER ... is a space separated list of C compilers to search for. 50# COMPILER ... is a space separated list of C compilers to search for.
39# This just gives the user an opportunity to specify an alternative 51# This just gives the user an opportunity to specify an alternative
40# search list for the C compiler. 52# search list for the C compiler.
41AC_DEFUN_ONCE([AC_PROG_CC], 53AC_DEFUN([AC_PROG_CC],
42[AC_LANG_PUSH(C)dnl 54[AC_LANG_PUSH(C)dnl
43AC_ARG_VAR([CC], [C compiler command])dnl 55AC_ARG_VAR([CC], [C compiler command])dnl
44AC_ARG_VAR([CFLAGS], [C compiler flags])dnl 56AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
@@ -830,3 +842,4 @@ dnl with extended modes being tried first.
830 842
831 843
832])# m4_version_prereq 844])# m4_version_prereq
845])# !_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 @@
1# stdalign.m4 1# stdalign.m4
2# serial 1 2# serial 3
3dnl Copyright 2011-2024 Free Software Foundation, Inc. 3dnl Copyright 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for alignas and alignof that conform to C23. 9# Check for alignas and alignof that conform to C23.
9 10
@@ -81,10 +82,10 @@ AC_DEFUN([gl_ALIGNASOF],
81 82
82 References: 83 References:
83 ISO C23 (latest free draft 84 ISO C23 (latest free draft
84 <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf>) 85 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf>)
85 sections 6.5.3.4, 6.7.5, 7.15. 86 sections 6.5.3.4, 6.7.5, 7.15.
86 C++11 (latest free draft 87 C++11 (latest free draft
87 <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>) 88 <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
88 section 18.10. */ 89 section 18.10. */
89 90
90/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment 91/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
@@ -103,11 +104,13 @@ AC_DEFUN([gl_ALIGNASOF],
103 104
104/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 105/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
105 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. 106 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
106 clang versions < 8.0.0 have the same bug. */ 107 clang versions < 8.0.0 have the same bug.
108 IBM XL C V16.1.0 cc (non-clang) has the same bug. */
107# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ 109# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
108 || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ 110 || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
109 && !defined __clang__) \ 111 && !defined __clang__) \
110 || (defined __clang__ && __clang_major__ < 8)) 112 || (defined __clang__ && __clang_major__ < 8) \
113 || defined __xlC__)
111# undef/**/_Alignof 114# undef/**/_Alignof
112# ifdef __cplusplus 115# ifdef __cplusplus
113# if (201103 <= __cplusplus || defined _MSC_VER) 116# if (201103 <= __cplusplus || defined _MSC_VER)
@@ -178,7 +181,8 @@ AC_DEFUN([gl_ALIGNASOF],
178# if ((defined _Alignas \ 181# if ((defined _Alignas \
179 && !(defined __cplusplus \ 182 && !(defined __cplusplus \
180 && (201103 <= __cplusplus || defined _MSC_VER))) \ 183 && (201103 <= __cplusplus || defined _MSC_VER))) \
181 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) 184 || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \
185 && !defined __xlC__))
182# define alignas _Alignas 186# define alignas _Alignas
183# endif 187# endif
184# endif 188# 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 @@
1# stdckdint_h.m4
2# serial 1
3dnl Copyright 2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Collin Funk.
10
11AC_DEFUN_ONCE([gl_STDCKDINT_H],
12[
13 gl_CHECK_NEXT_HEADERS([stdckdint.h])
14 if test $ac_cv_header_stdckdint_h = yes; then
15 HAVE_STDCKDINT_H=1
16 else
17 HAVE_STDCKDINT_H=0
18 fi
19 AC_SUBST([HAVE_STDCKDINT_H])
20
21 if test $HAVE_STDCKDINT_H = 1; then
22 AC_CACHE_CHECK([whether stdckdint.h can be included in C],
23 [gl_cv_header_c_stdckdint_h],
24 [AC_COMPILE_IFELSE(
25 [AC_LANG_PROGRAM(
26 [[#include <stdckdint.h>
27 ]])],
28 [gl_cv_header_c_stdckdint_h=yes],
29 [gl_cv_header_c_stdckdint_h=no])])
30 if test $gl_cv_header_c_stdckdint_h = yes; then
31 HAVE_C_STDCKDINT_H=1
32 AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C],
33 [gl_cv_header_c_stdckdint_h_works],
34 [AC_COMPILE_IFELSE(
35 [AC_LANG_PROGRAM(
36 [[#include <stdckdint.h>
37 ]],
38 [[int r;
39 int a = 1;
40 int b = 1;
41 return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b)
42 || ckd_mul (&r, a, b));
43 ]])],
44 [gl_cv_header_c_stdckdint_h_works=yes],
45 [gl_cv_header_c_stdckdint_h_works=no])])
46 if test $gl_cv_header_c_stdckdint_h_works = yes; then
47 HAVE_WORKING_C_STDCKDINT_H=1
48 else
49 HAVE_WORKING_C_STDCKDINT_H=0
50 fi
51 else
52 HAVE_C_STDCKDINT_H=0
53 HAVE_WORKING_C_STDCKDINT_H=0
54 fi
55 if test "$CXX" != no; then
56 AC_CACHE_CHECK([whether stdckdint.h can be included in C++],
57 [gl_cv_header_cxx_stdckdint_h],
58 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
59 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
60 cat > conftest.cpp <<\EOF
61#include <stdckdint.h>
62EOF
63 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
64 if AC_TRY_EVAL([gl_command]); then
65 gl_cv_header_cxx_stdckdint_h=yes
66 else
67 gl_cv_header_cxx_stdckdint_h=no
68 fi
69 rm -fr conftest*
70 ])
71 if test $gl_cv_header_cxx_stdckdint_h = yes; then
72 HAVE_CXX_STDCKDINT_H=1
73 AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++],
74 [gl_cv_header_cxx_stdckdint_h_works],
75 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
76 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
77 cat > conftest.cpp <<\EOF
78#include <stdckdint.h>
79int
80main (void)
81{
82 int r;
83 int a = 1;
84 int b = 1;
85 return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b));
86}
87EOF
88 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
89 if AC_TRY_EVAL([gl_command]); then
90 gl_cv_header_cxx_stdckdint_h_works=yes
91 else
92 gl_cv_header_cxx_stdckdint_h_works=no
93 fi
94 rm -fr conftest*
95 ])
96 if test $gl_cv_header_cxx_stdckdint_h_works = yes; then
97 HAVE_WORKING_CXX_STDCKDINT_H=1
98 else
99 HAVE_WORKING_CXX_STDCKDINT_H=0
100 fi
101 else
102 HAVE_CXX_STDCKDINT_H=0
103 HAVE_WORKING_CXX_STDCKDINT_H=0
104 fi
105 fi
106 else
107 HAVE_C_STDCKDINT_H=0
108 HAVE_WORKING_C_STDCKDINT_H=0
109 HAVE_CXX_STDCKDINT_H=0
110 HAVE_WORKING_CXX_STDCKDINT_H=0
111 fi
112 AC_SUBST([HAVE_C_STDCKDINT_H])
113 AC_SUBST([HAVE_WORKING_C_STDCKDINT_H])
114 AC_SUBST([HAVE_CXX_STDCKDINT_H])
115 AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H])
116
117 if test "$CXX" != no; then
118 dnl We might need the header for C or C++.
119 if test $HAVE_C_STDCKDINT_H = 1 \
120 && test $HAVE_WORKING_C_STDCKDINT_H = 1 \
121 && test $HAVE_CXX_STDCKDINT_H = 1 \
122 && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then
123 GL_GENERATE_STDCKDINT_H=false
124 else
125 GL_GENERATE_STDCKDINT_H=true
126 fi
127 else
128 dnl We don't care about C++ here.
129 if test $HAVE_C_STDCKDINT_H = 1 \
130 && test $HAVE_WORKING_C_STDCKDINT_H = 1; then
131 GL_GENERATE_STDCKDINT_H=false
132 else
133 GL_GENERATE_STDCKDINT_H=true
134 fi
135 fi
136])
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 @@
1# stddef_h.m4 1# stddef_h.m4
2# serial 14 2# serial 23
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl A placeholder for <stddef.h>, for platforms that have issues. 9dnl A placeholder for <stddef.h>, for platforms that have issues.
9 10
10AC_DEFUN_ONCE([gl_STDDEF_H], 11AC_DEFUN_ONCE([gl_STDDEF_H],
11[ 12[
12 AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDDEF_H_DEFAULTS])
13 AC_REQUIRE([gt_TYPE_WCHAR_T])
14 14
15 dnl Persuade OpenBSD <stddef.h> to declare max_align_t. 15 dnl Persuade OpenBSD <stddef.h> to declare max_align_t.
16 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 16 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -52,11 +52,6 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
52 GL_GENERATE_STDDEF_H=true 52 GL_GENERATE_STDDEF_H=true
53 fi 53 fi
54 54
55 if test $gt_cv_c_wchar_t = no; then
56 HAVE_WCHAR_T=0
57 GL_GENERATE_STDDEF_H=true
58 fi
59
60 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], 55 AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions],
61 [gl_cv_decl_null_works], 56 [gl_cv_decl_null_works],
62 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h> 57 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
@@ -69,21 +64,60 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
69 GL_GENERATE_STDDEF_H=true 64 GL_GENERATE_STDDEF_H=true
70 fi 65 fi
71 66
72 AC_CACHE_CHECK([for unreachable], 67 AC_CACHE_CHECK([for unreachable in C],
73 [gl_cv_func_unreachable], 68 [gl_cv_c_func_unreachable],
74 [AC_LINK_IFELSE( 69 [AC_LINK_IFELSE(
75 [AC_LANG_PROGRAM( 70 [AC_LANG_PROGRAM(
76 [[#include <stddef.h> 71 [[#include <stddef.h>
77 ]], 72 ]],
78 [[unreachable (); 73 [[unreachable ();
79 ]])], 74 ]])],
80 [gl_cv_func_unreachable=yes], 75 [gl_cv_c_func_unreachable=yes],
81 [gl_cv_func_unreachable=no]) 76 [gl_cv_c_func_unreachable=no])
82 ]) 77 ])
83 if test $gl_cv_func_unreachable = no; then 78 if test $gl_cv_c_func_unreachable = no; then
79 GL_GENERATE_STDDEF_H=true
80 HAVE_C_UNREACHABLE=0
81 else
82 HAVE_C_UNREACHABLE=1
83 fi
84 AC_SUBST([HAVE_C_UNREACHABLE])
85 dnl Provide gl_unreachable() unconditionally.
86 GL_GENERATE_STDDEF_H=true
87
88 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869
89 AC_CACHE_CHECK([whether nullptr_t needs <stddef.h>],
90 [gl_cv_nullptr_t_needs_stddef],
91 [AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[nullptr_t x;]],
92 [gl_cv_nullptr_t_needs_stddef=no],
93 [gl_cv_nullptr_t_needs_stddef=yes])])
94 if test "$gl_cv_nullptr_t_needs_stddef" = no; then
95 NULLPTR_T_NEEDS_STDDEF=0
84 GL_GENERATE_STDDEF_H=true 96 GL_GENERATE_STDDEF_H=true
85 fi 97 fi
86 98
99 dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870
100 dnl affects GCC 13.3 and 14.2.
101 AC_CACHE_CHECK([whether <stddef.h> is idempotent],
102 [gl_cv_stddef_idempotent],
103 [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
104 [[
105 #if \
106 ((__GNUC__ == 13 && __GNUC_MINOR__ <= 3) \
107 || (__GNUC__ == 14 && __GNUC_MINOR__ <= 2))
108 #error "bug 114870 is present"
109 #endif
110 ]])],
111 [gl_cv_stddef_idempotent="guessing yes"],
112 [gl_cv_stddef_idempotent="guessing no"])
113 ])
114 case "$gl_cv_stddef_idempotent" in
115 *yes) ;;
116 *) STDDEF_NOT_IDEMPOTENT=1
117 GL_GENERATE_STDDEF_H=true
118 ;;
119 esac
120
87 if $GL_GENERATE_STDDEF_H; then 121 if $GL_GENERATE_STDDEF_H; then
88 gl_NEXT_HEADERS([stddef.h]) 122 gl_NEXT_HEADERS([stddef.h])
89 fi 123 fi
@@ -114,7 +148,8 @@ AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS],
114AC_DEFUN([gl_STDDEF_H_DEFAULTS], 148AC_DEFUN([gl_STDDEF_H_DEFAULTS],
115[ 149[
116 dnl Assume proper GNU behavior unless another module says otherwise. 150 dnl Assume proper GNU behavior unless another module says otherwise.
151 NULLPTR_T_NEEDS_STDDEF=1; AC_SUBST([NULLPTR_T_NEEDS_STDDEF])
152 STDDEF_NOT_IDEMPOTENT=0; AC_SUBST([STDDEF_NOT_IDEMPOTENT])
117 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) 153 REPLACE_NULL=0; AC_SUBST([REPLACE_NULL])
118 HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) 154 HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T])
119 HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T])
120]) 155])
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 @@
1# stdint.m4 1# stdint.m4
2# serial 63 2# serial 64
3dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert and Bruno Haible. 9dnl From Paul Eggert and Bruno Haible.
9dnl Test whether <stdint.h> is supported or must be substituted. 10dnl Test whether <stdint.h> is supported or must be substituted.
@@ -157,7 +158,7 @@ uintmax_t j = UINTMAX_MAX;
157 || defined __clang__) 158 || defined __clang__)
158int k = _Generic (SIZE_MAX, size_t: 0); 159int k = _Generic (SIZE_MAX, size_t: 0);
159#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ 160#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \
160 || (0x5110 <= __SUNPRO_C && !__STDC__)) 161 || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER)
161extern size_t k; 162extern size_t k;
162extern __typeof__ (SIZE_MAX) k; 163extern __typeof__ (SIZE_MAX) k;
163#endif 164#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 @@
1# stdint_h.m4 1# stdint_h.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 1997-2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-2004, 2006, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Paul Eggert. 9dnl From Paul Eggert.
9 10
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 @@
1# stdio_h.m4 1# stdio_h.m4
2# serial 63 2# serial 75
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_STDIO_H_EARLY], 9AC_DEFUN([gl_STDIO_H_EARLY],
9[ 10[
@@ -133,6 +134,7 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
133[ 134[
134 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ 135 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) 136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DZPRINTF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) 138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) 139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) 140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH])
@@ -153,12 +155,14 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) 156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FZPRINTF])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) 160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) 161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) 162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) 163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) 164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX])
165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_ZPRINTF])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) 166 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE])
163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) 167 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR])
164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) 168 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN])
@@ -172,20 +176,29 @@ AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS],
172 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) 176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT])
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) 177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) 178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNZPRINTF])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) 181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING])
177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) 182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SZPRINTF])
178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE])
179 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) 185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF])
186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASZPRINTF])
180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) 187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF])
181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) 188 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF])
182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) 189 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF])
190 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDZPRINTF])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) 191 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF])
184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) 192 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX])
193 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFZPRINTF])
185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) 194 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF])
186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) 195 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX])
187 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) 196 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF])
197 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNZPRINTF])
188 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) 198 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX])
199 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSZPRINTF])
200 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VZPRINTF])
201 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ZPRINTF])
189 dnl Support Microsoft deprecated alias function names by default. 202 dnl Support Microsoft deprecated alias function names by default.
190 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) 203 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1])
191 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) 204 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 @@
1# stdlib_h.m4 1# stdlib_h.m4
2# serial 77 2# serial 84
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_STDLIB_H], 9AC_DEFUN_ONCE([gl_STDLIB_H],
9[ 10[
@@ -37,44 +38,51 @@ AC_DEFUN_ONCE([gl_STDLIB_H],
37 dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4. 38 dnl On Solaris 10, in UTF-8 locales, its value is 3 but needs to be 4.
38 dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5. 39 dnl Fortunately, we can do this because on this platform MB_LEN_MAX is 5.
39 AC_REQUIRE([AC_CANONICAL_HOST]) 40 AC_REQUIRE([AC_CANONICAL_HOST])
40 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 41 AC_REQUIRE([gt_LOCALE_EN_UTF8])
41 AC_CACHE_CHECK([whether MB_CUR_MAX is correct], 42 AC_CACHE_CHECK([whether MB_CUR_MAX is correct],
42 [gl_cv_macro_MB_CUR_MAX_good], 43 [gl_cv_macro_MB_CUR_MAX_good],
43 [ 44 [AC_LINK_IFELSE(
44 dnl Initial guess, used when cross-compiling or when no suitable locale 45 [AC_LANG_PROGRAM([[#include <stdlib.h>
45 dnl is present. 46 ]],
46changequote(,)dnl 47 [[return !!MB_CUR_MAX;]])
47 case "$host_os" in 48 ],
48 # Guess no on Solaris. 49 [dnl Initial guess, used when cross-compiling or when no suitable locale
49 solaris*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; 50 dnl is present.
50 # Guess yes otherwise. 51 # Guess no on Solaris and Haiku, yes otherwise.
51 *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; 52 AS_CASE([$host_os],
52 esac 53 [solaris* | haiku*],
53changequote([,])dnl 54 [gl_cv_macro_MB_CUR_MAX_good="guessing no"],
54 if test $LOCALE_FR_UTF8 != none; then 55 [gl_cv_macro_MB_CUR_MAX_good="guessing yes"])
55 AC_RUN_IFELSE( 56 if test "$LOCALE_EN_UTF8" != none; then
56 [AC_LANG_SOURCE([[ 57 AC_RUN_IFELSE(
58 [AC_LANG_SOURCE([[
57#include <locale.h> 59#include <locale.h>
58#include <stdlib.h> 60#include <stdlib.h>
59int main () 61int main ()
60{ 62{
61 int result = 0; 63 int result = 0;
62 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 64 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
63 { 65 {
64 if (MB_CUR_MAX < 4) 66 if (MB_CUR_MAX < 4)
65 result |= 1; 67 result |= 1;
66 } 68 }
67 return result; 69 return result;
68}]])], 70}]])],
69 [gl_cv_macro_MB_CUR_MAX_good=yes], 71 [gl_cv_macro_MB_CUR_MAX_good=yes],
70 [gl_cv_macro_MB_CUR_MAX_good=no], 72 [gl_cv_macro_MB_CUR_MAX_good=no],
71 [:]) 73 [:])
72 fi 74 fi
75 ],
76 [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"])
73 ]) 77 ])
74 case "$gl_cv_macro_MB_CUR_MAX_good" in 78 AS_CASE([$gl_cv_macro_MB_CUR_MAX_good],
75 *yes) ;; 79 [*yes],
76 *) REPLACE_MB_CUR_MAX=1 ;; 80 [],
77 esac 81 ["link failed - so no"],
82 [# 4 suffices as a workaround in Android NDK 16,
83 # the only known platform with the bug.
84 REPLACE_MB_CUR_MAX=4],
85 [REPLACE_MB_CUR_MAX="(-1)"])
78 86
79 AC_CHECK_DECLS_ONCE([ecvt]) 87 AC_CHECK_DECLS_ONCE([ecvt])
80 if test $ac_cv_have_decl_ecvt = no; then 88 if test $ac_cv_have_decl_ecvt = no; then
@@ -110,6 +118,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
110[ 118[
111 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [ 119 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDLIB_H_MODULE_INDICATOR_DEFAULTS], [
112 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT]) 120 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB__EXIT])
121 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ABORT_DEBUG])
113 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC]) 122 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ALIGNED_ALLOC])
114 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL]) 123 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ATOLL])
115 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU]) 124 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CALLOC_GNU])
@@ -139,12 +148,12 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM]) 148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM])
140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R]) 149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RANDOM_R])
141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY]) 150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOCARRAY])
142 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_GNU])
143 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX]) 151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALLOC_POSIX])
144 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH]) 152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REALPATH])
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH]) 153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RPMATCH])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV]) 154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SECURE_GETENV])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV]) 155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETENV])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STACK_TRACE])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOD])
149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF]) 158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOF])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOL])
@@ -218,6 +227,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
218 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT]) 227 HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
219 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV]) 228 HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
220 REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT]) 229 REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT])
230 REPLACE_ABORT=0; AC_SUBST([REPLACE_ABORT])
221 REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC]) 231 REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC])
222 REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU]) 232 REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
223 REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX]) 233 REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
@@ -244,7 +254,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
244 REPLACE_RAND=0; AC_SUBST([REPLACE_RAND]) 254 REPLACE_RAND=0; AC_SUBST([REPLACE_RAND])
245 REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM]) 255 REPLACE_RANDOM=0; AC_SUBST([REPLACE_RANDOM])
246 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R]) 256 REPLACE_RANDOM_R=0; AC_SUBST([REPLACE_RANDOM_R])
247 REPLACE_REALLOC_FOR_REALLOC_GNU=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_GNU])
248 REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX]) 257 REPLACE_REALLOC_FOR_REALLOC_POSIX=0; AC_SUBST([REPLACE_REALLOC_FOR_REALLOC_POSIX])
249 REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY]) 258 REPLACE_REALLOCARRAY=0; AC_SUBST([REPLACE_REALLOCARRAY])
250 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH]) 259 REPLACE_REALPATH=0; AC_SUBST([REPLACE_REALPATH])
@@ -259,4 +268,5 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
259 REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL]) 268 REPLACE_STRTOULL=0; AC_SUBST([REPLACE_STRTOULL])
260 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV]) 269 REPLACE_UNSETENV=0; AC_SUBST([REPLACE_UNSETENV])
261 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB]) 270 REPLACE_WCTOMB=0; AC_SUBST([REPLACE_WCTOMB])
271 CAN_PRINT_STACK_TRACE=0; AC_SUBST([CAN_PRINT_STACK_TRACE])
262]) 272])
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 @@
1# strcasecmp.m4
2# serial 3
3dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_STRCASECMP],
10[
11 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
12 AC_CHECK_FUNCS([strcasecmp])
13 if test $ac_cv_func_strcasecmp = yes; then
14 gl_STRCASECMP_WORKS
15 case "$gl_cv_func_strcasecmp_works" in
16 *yes) ;;
17 *) REPLACE_STRCASECMP=1 ;;
18 esac
19 else
20 HAVE_STRCASECMP=0
21 fi
22])
23
24AC_DEFUN([gl_STRCASECMP_WORKS],
25[
26 AC_REQUIRE([AC_CANONICAL_HOST])
27 AC_CACHE_CHECK([whether strcasecmp works],
28 [gl_cv_func_strcasecmp_works],
29 [dnl Prepare a guess, used when cross-compiling or when specific locales
30 dnl are not available.
31 case "$host_os" in
32 solaris* | cygwin*)
33 gl_cv_func_strcasecmp_works="guessing no" ;;
34 *)
35 gl_cv_func_strcasecmp_works="guessing yes" ;;
36 esac
37 AC_RUN_IFELSE(
38 [AC_LANG_SOURCE([[
39#include <stdio.h>
40#include <ctype.h>
41#include <locale.h>
42#include <strings.h>
43int main ()
44{
45 if (setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
46 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
47 {
48 int c1 = (unsigned char) '\311';
49 int c2 = (unsigned char) '\351';
50 if (tolower (c1) == c2 && toupper (c2) == c1)
51 return strcasecmp ("Fej\311r", "Fej\351r") != 0;
52 }
53 return 2;
54}]])],
55 [gl_cv_func_strcasecmp_works=yes],
56 [if test $? = 1; then
57 gl_cv_func_strcasecmp_works=no
58 fi
59 ],
60 [:])
61 ])
62])
63
64# Prerequisites of lib/strcasecmp.c.
65AC_DEFUN([gl_PREREQ_STRCASECMP], [
66 :
67])
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 @@
1# strcasestr.m4 1# strcasestr.m4
2# serial 28 2# serial 29
3dnl Copyright (C) 2005, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check that strcasestr is present and works. 9dnl Check that strcasestr is present and works.
9AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], 10AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
@@ -98,7 +99,7 @@ static void quit (int sig) { _exit (sig + 128); }
98 char *haystack = (char *) malloc (2 * m + 2); 99 char *haystack = (char *) malloc (2 * m + 2);
99 char *needle = (char *) malloc (m + 2); 100 char *needle = (char *) malloc (m + 2);
100 /* Failure to compile this test due to missing alarm is okay, 101 /* Failure to compile this test due to missing alarm is okay,
101 since all such platforms (mingw) also lack strcasestr. */ 102 since all such platforms (mingw, MSVC) also lack strcasestr. */
102 signal (SIGALRM, quit); 103 signal (SIGALRM, quit);
103 alarm (5); 104 alarm (5);
104 /* Check for quadratic performance. */ 105 /* 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 @@
1# strerror.m4 1# strerror.m4
2# serial 25 2# serial 25
3dnl Copyright (C) 2002, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STRERROR], 9AC_DEFUN([gl_FUNC_STRERROR],
9[ 10[
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 @@
1# string_h.m4 1# string_h.m4
2# serial 39 2# serial 44.1
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure a GNU-like replacement for <string.h>. 9# Configure a GNU-like replacement for <string.h>.
9 10
@@ -23,8 +24,9 @@ AC_DEFUN_ONCE([gl_STRING_H],
23 ]], 24 ]],
24 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit 25 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
25 rawmemchr stpcpy stpncpy strchrnul 26 rawmemchr stpcpy stpncpy strchrnul
26 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r 27 strdup strncat strncpy strndup strnlen strpbrk strsep strcasestr strtok_r
27 strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) 28 strerror_l strerror_r strerrorname_np
29 sigabbrev_np sigdescr_np strsignal strverscmp])
28 30
29 AC_REQUIRE([AC_C_RESTRICT]) 31 AC_REQUIRE([AC_C_RESTRICT])
30]) 32])
@@ -62,6 +64,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
62 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) 64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL])
63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) 65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) 66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) 68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) 69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) 70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
@@ -69,6 +72,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) 72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) 73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) 74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) 77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) 78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) 79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
@@ -83,8 +88,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) 88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) 89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) 90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) 93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) 94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) 96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) 97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) 98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@@ -123,6 +131,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
123 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 131 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
124 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 132 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
125 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) 133 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
134 HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
126 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) 135 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
127 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) 136 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
128 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) 137 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@@ -138,6 +147,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
138 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) 147 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
139 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 148 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
140 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) 149 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
150 REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY])
141 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) 151 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
142 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) 152 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
143 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 153 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
@@ -145,6 +155,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
145 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) 155 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
146 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 156 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
147 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) 157 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
158 REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
148 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) 159 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
149 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 160 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
150 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) 161 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 @@
1# strings_h.m4 1# strings_h.m4
2# serial 9 2# serial 14
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Configure a replacement for <strings.h>. 9# Configure a replacement for <strings.h>.
9 10
@@ -28,7 +29,7 @@ AC_DEFUN_ONCE([gl_STRINGS_H],
28 <strings.h>. */ 29 <strings.h>. */
29 #include <sys/types.h> 30 #include <sys/types.h>
30 #include <strings.h> 31 #include <strings.h>
31 ]], [ffs strcasecmp strncasecmp]) 32 ]], [ffs strcasecmp strcasecmp_l strncasecmp strncasecmp_l])
32]) 33])
33 34
34# gl_STRINGS_MODULE_INDICATOR([modulename]) 35# gl_STRINGS_MODULE_INDICATOR([modulename])
@@ -49,6 +50,10 @@ AC_DEFUN([gl_STRINGS_H_REQUIRE_DEFAULTS],
49[ 50[
50 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [ 51 m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS], [
51 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS]) 52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFS])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASECMP_L])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCASECMP_L])
52 ]) 57 ])
53 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS]) 58 m4_require(GL_MODULE_INDICATOR_PREFIX[_STRINGS_H_MODULE_INDICATOR_DEFAULTS])
54 AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) 59 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
@@ -59,5 +64,12 @@ AC_DEFUN([gl_STRINGS_H_DEFAULTS],
59 dnl Assume proper GNU behavior unless another module says otherwise. 64 dnl Assume proper GNU behavior unless another module says otherwise.
60 HAVE_FFS=1; AC_SUBST([HAVE_FFS]) 65 HAVE_FFS=1; AC_SUBST([HAVE_FFS])
61 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP]) 66 HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
67 HAVE_STRCASECMP_L=1; AC_SUBST([HAVE_STRCASECMP_L])
68 HAVE_STRNCASECMP=1; AC_SUBST([HAVE_STRNCASECMP])
69 HAVE_STRNCASECMP_L=1; AC_SUBST([HAVE_STRNCASECMP_L])
62 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP]) 70 HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
71 REPLACE_STRCASECMP=0; AC_SUBST([REPLACE_STRCASECMP])
72 REPLACE_STRCASECMP_L=0; AC_SUBST([REPLACE_STRCASECMP_L])
73 REPLACE_STRNCASECMP=0; AC_SUBST([REPLACE_STRNCASECMP])
74 REPLACE_STRNCASECMP_L=0; AC_SUBST([REPLACE_STRNCASECMP_L])
63]) 75])
diff --git a/gl/m4/strcase.m4 b/gl/m4/strncasecmp.m4
index 63021733..c7c8b240 100644
--- a/gl/m4/strcase.m4
+++ b/gl/m4/strncasecmp.m4
@@ -1,31 +1,22 @@
1# strcase.m4 1# strncasecmp.m4
2# serial 12 2# serial 2
3dnl Copyright (C) 2002, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7 7dnl This file is offered as-is, without any warranty.
8AC_DEFUN([gl_STRCASE],
9[
10 gl_FUNC_STRCASECMP
11 gl_FUNC_STRNCASECMP
12])
13
14AC_DEFUN([gl_FUNC_STRCASECMP],
15[
16 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
17 AC_CHECK_FUNCS([strcasecmp])
18 if test $ac_cv_func_strcasecmp = no; then
19 HAVE_STRCASECMP=0
20 fi
21])
22 8
23AC_DEFUN([gl_FUNC_STRNCASECMP], 9AC_DEFUN([gl_FUNC_STRNCASECMP],
24[ 10[
25 AC_REQUIRE([gl_STRINGS_H_DEFAULTS]) 11 AC_REQUIRE([gl_STRINGS_H_DEFAULTS])
26 AC_CHECK_FUNCS([strncasecmp]) 12 AC_CHECK_FUNCS([strncasecmp])
27 if test $ac_cv_func_strncasecmp = yes; then 13 if test $ac_cv_func_strncasecmp = yes; then
28 HAVE_STRNCASECMP=1 14 dnl Assume that strncasecmp and strcasecmp share the same bugs.
15 gl_STRCASECMP_WORKS
16 case "$gl_cv_func_strcasecmp_works" in
17 *yes) ;;
18 *) REPLACE_STRNCASECMP=1 ;;
19 esac
29 else 20 else
30 HAVE_STRNCASECMP=0 21 HAVE_STRNCASECMP=0
31 fi 22 fi
@@ -35,11 +26,6 @@ AC_DEFUN([gl_FUNC_STRNCASECMP],
35 fi 26 fi
36]) 27])
37 28
38# Prerequisites of lib/strcasecmp.c.
39AC_DEFUN([gl_PREREQ_STRCASECMP], [
40 :
41])
42
43# Prerequisites of lib/strncasecmp.c. 29# Prerequisites of lib/strncasecmp.c.
44AC_DEFUN([gl_PREREQ_STRNCASECMP], [ 30AC_DEFUN([gl_PREREQ_STRNCASECMP], [
45 : 31 :
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 @@
1# strncpy.m4
2# serial 1
3dnl Copyright (C) 2002-2004, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_FUNC_STRNCPY],
10[
11 AC_REQUIRE([gl_STRING_H_DEFAULTS])
12 AC_REQUIRE([AC_PROG_CC])
13 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
14
15 dnl Check for prerequisites for memory fence checks.
16 gl_FUNC_MMAP_ANON
17 AC_CHECK_HEADERS_ONCE([sys/mman.h])
18 AC_CHECK_FUNCS_ONCE([mprotect])
19
20 dnl Detect bug in FreeBSD 15.0 on x86_64:
21 dnl strncpy should not dereference more than n bytes, but always dereferences
22 dnl n+1 bytes if the first n bytes don't contain a NUL byte.
23 dnl Assume that strncpy works on platforms that lack mprotect.
24 AC_CACHE_CHECK([whether strncpy works], [gl_cv_func_strncpy_works],
25 [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
26#include <string.h>
27#if HAVE_SYS_MMAN_H
28# include <fcntl.h>
29# include <unistd.h>
30# include <sys/types.h>
31# include <sys/mman.h>
32#endif
33]GL_MDA_DEFINES],
34[[
35 char *fence = NULL;
36#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
37 {
38 long int pagesize = sysconf (_SC_PAGESIZE);
39 char *two_pages =
40 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
41 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
42 if (two_pages != (char *)(-1)
43 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
44 fence = two_pages + pagesize;
45 }
46#endif
47 if (fence)
48 {
49 char dest[8];
50
51 dest[0] = 'a';
52 dest[1] = 'b';
53 dest[2] = 'c';
54 dest[3] = 'd';
55 dest[4] = 'e';
56 dest[5] = 'f';
57 dest[6] = 'g';
58
59 *(fence - 3) = '7';
60 *(fence - 2) = '2';
61 *(fence - 1) = '9';
62
63 if (strncpy (dest + 1, fence - 3, 3) != dest + 1)
64 return 1;
65 if (dest[0] != 'a')
66 return 2;
67 if (dest[1] != '7' || dest[2] != '2' || dest[3] != '9')
68 return 3;
69 if (dest[4] != 'e')
70 return 4;
71 }
72 return 0;
73]])], [gl_cv_func_strncpy_works=yes], [gl_cv_func_strncpy_works=no],
74 [
75 case "$host_os" in
76 # Guess no on FreeBSD.
77 freebsd* | dragonfly*) gl_cv_func_strncpy_works="guessing no" ;;
78 # Guess yes on native Windows.
79 mingw* | windows*) gl_cv_func_strncpy_works="guessing yes" ;;
80 # Guess yes otherwise.
81 *) gl_cv_func_strncpy_works="guessing yes" ;;
82 esac
83 ])
84 ])
85 case "$gl_cv_func_strncpy_works" in
86 *yes) ;;
87 *) REPLACE_STRNCPY=1 ;;
88 esac
89])
90
91# Prerequisites of lib/strncpy.c.
92AC_DEFUN([gl_PREREQ_STRNCPY], [
93 :
94])
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 @@
1# strsep.m4 1# strsep.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2002-2004, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_STRSEP], 9AC_DEFUN([gl_FUNC_STRSEP],
9[ 10[
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 @@
1# strstr.m4 1# strstr.m4
2# serial 24 2# serial 25
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Check that strstr works. 9dnl Check that strstr works.
9AC_DEFUN([gl_FUNC_STRSTR_SIMPLE], 10AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
@@ -95,7 +96,7 @@ static void quit (int sig) { _exit (sig + 128); }
95 char *haystack = (char *) malloc (2 * m + 2); 96 char *haystack = (char *) malloc (2 * m + 2);
96 char *needle = (char *) malloc (m + 2); 97 char *needle = (char *) malloc (m + 2);
97 /* Failure to compile this test due to missing alarm is okay, 98 /* Failure to compile this test due to missing alarm is okay,
98 since all such platforms (mingw) also have quadratic strstr. */ 99 since all such platforms (mingw, MSVC) also have quadratic strstr. */
99 signal (SIGALRM, quit); 100 signal (SIGALRM, quit);
100 alarm (5); 101 alarm (5);
101 /* Check for quadratic performance. */ 102 /* 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 @@
1# sys_cdefs_h.m4 - Is <sys/cdefs.h> compatible enough with glibc?
2# serial 2
3dnl Copyright 2024-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl Written by Paul Eggert.
10
11AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H],
12 [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h],
13 [gl_cv_header_sys_cdefs_h],
14 [AC_COMPILE_IFELSE(
15 [AC_LANG_DEFINES_PROVIDED
16 [#include <sys/cdefs.h>
17 enum { foo = __GNUC_PREREQ (14, 1) } bar;
18 ]],
19 [gl_cv_header_sys_cdefs_h=yes],
20 [gl_cv_header_sys_cdefs_h=no])])
21 if test "$gl_cv_header_sys_cdefs_h" = yes; then
22 HAVE_SYS_CDEFS_H=1
23 else
24 HAVE_SYS_CDEFS_H=0
25 fi
26 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 @@
1# sys_socket_h.m4 1# sys_socket_h.m4
2# serial 29 2# serial 31
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Simon Josefsson. 9dnl From Simon Josefsson.
9 10
@@ -52,24 +53,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 53 fi
53 # We need to check for ws2tcpip.h now. 54 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 55 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 56 gl_PREREQ_SYS_SA_FAMILY
56 /* sys/types.h is not needed according to POSIX, but the
57 sys/socket.h in i386-unknown-freebsd4.10 and
58 powerpc-apple-darwin5.5 required it. */
59#include <sys/types.h>
60#ifdef HAVE_SYS_SOCKET_H
61#include <sys/socket.h>
62#endif
63#ifdef HAVE_WS2TCPIP_H
64#include <ws2tcpip.h>
65#endif
66])
67 if test $ac_cv_type_struct_sockaddr_storage = no; then 57 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 58 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 59 fi
70 if test $ac_cv_type_sa_family_t = no; then
71 HAVE_SA_FAMILY_T=0
72 fi
73 if test $ac_cv_type_struct_sockaddr_storage != no; then 60 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 61 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 62 [],
@@ -158,6 +145,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 145 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 146])
160 147
148# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
149# replacement.
150# Sets and substitutes HAVE_SA_FAMILY_T.
151AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
152[
153 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
154 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
155 /* sys/types.h is not needed according to POSIX, but the
156 sys/socket.h in i386-unknown-freebsd4.10 and
157 powerpc-apple-darwin5.5 required it. */
158#include <sys/types.h>
159#ifdef HAVE_SYS_SOCKET_H
160#include <sys/socket.h>
161#endif
162#ifdef HAVE_WS2TCPIP_H
163#include <ws2tcpip.h>
164#endif
165])
166 if test $ac_cv_type_sa_family_t = yes; then
167 HAVE_SA_FAMILY_T=1
168 else
169 HAVE_SA_FAMILY_T=0
170 fi
171 AC_SUBST([HAVE_SA_FAMILY_T])
172])
173
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 174# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 175# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 176# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +215,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 215 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 216 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 217 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
205 HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T])
206 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) 218 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 219])
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 @@
1# sys_stat_h.m4 1# sys_stat_h.m4
2# serial 42 -*- Autoconf -*- 2# serial 42 -*- Autoconf -*-
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Eric Blake. 9dnl From Eric Blake.
9dnl Provide a GNU-like <sys/stat.h>. 10dnl Provide a GNU-like <sys/stat.h>.
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 @@
1# sys_types_h.m4 1# sys_types_h.m4
2# serial 13 2# serial 15
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_SYS_TYPES_H], 9AC_DEFUN_ONCE([gl_SYS_TYPES_H],
9[ 10[
@@ -23,6 +24,9 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
23 dnl Whether to override the 'off_t' type. 24 dnl Whether to override the 'off_t' type.
24 AC_REQUIRE([gl_TYPE_OFF_T]) 25 AC_REQUIRE([gl_TYPE_OFF_T])
25 26
27 dnl Whether to define the 'off64_t' type.
28 AC_REQUIRE([gl_TYPE_OFF64_T])
29
26 dnl Whether to override the 'dev_t' and 'ino_t' types. 30 dnl Whether to override the 'dev_t' and 'ino_t' types.
27 m4_ifdef([gl_WINDOWS_STAT_INODES], [ 31 m4_ifdef([gl_WINDOWS_STAT_INODES], [
28 AC_REQUIRE([gl_WINDOWS_STAT_INODES]) 32 AC_REQUIRE([gl_WINDOWS_STAT_INODES])
@@ -30,6 +34,14 @@ AC_DEFUN_ONCE([gl_SYS_TYPES_H],
30 WINDOWS_STAT_INODES=0 34 WINDOWS_STAT_INODES=0
31 ]) 35 ])
32 AC_SUBST([WINDOWS_STAT_INODES]) 36 AC_SUBST([WINDOWS_STAT_INODES])
37
38 dnl Test whether the 'blksize_t' type is defined.
39 AC_CHECK_TYPE([blksize_t], [HAVE_BLKSIZE_T=1], [HAVE_BLKSIZE_T=0])
40 AC_SUBST([HAVE_BLKSIZE_T])
41
42 dnl Test whether the 'blkcnt_t' type is defined.
43 AC_CHECK_TYPE([blkcnt_t], [HAVE_BLKCNT_T=1], [HAVE_BLKCNT_T=0])
44 AC_SUBST([HAVE_BLKCNT_T])
33]) 45])
34 46
35# Initializes the default values for AC_SUBSTed shell variables. 47# 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 @@
1# sys_uio_h.m4 1# sys_uio_h.m4
2# serial 3 2# serial 3
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_SYS_UIO_H], 9AC_DEFUN_ONCE([gl_SYS_UIO_H],
9[ 10[
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 @@
1# threadlib.m4 1# threadlib.m4
2# serial 42 2# serial 45.1
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
@@ -56,24 +57,22 @@ AC_DEFUN([gl_ANYTHREADLIB_EARLY],
56[ 57[
57 AC_REQUIRE([AC_CANONICAL_HOST]) 58 AC_REQUIRE([AC_CANONICAL_HOST])
58 if test -z "$gl_anythreadlib_early_done"; then 59 if test -z "$gl_anythreadlib_early_done"; then
59 case "$host_os" in 60 AS_CASE([$host_os],
60 osf*) 61 [osf*],
61 # On OSF/1, the compiler needs the flag -D_REENTRANT so that it 62 [# On OSF/1, the compiler needs the flag -D_REENTRANT so that it
62 # groks <pthread.h>. cc also understands the flag -pthread, but 63 # groks <pthread.h>. cc also understands the flag -pthread, but
63 # we don't use it because 1. gcc-2.95 doesn't understand -pthread, 64 # we do not use it because 1. gcc-2.95 does not understand -pthread,
64 # 2. putting a flag into CPPFLAGS that has an effect on the linker 65 # 2. putting a flag into CPPFLAGS that has an effect on the linker
65 # causes the AC_LINK_IFELSE test below to succeed unexpectedly, 66 # causes the AC_LINK_IFELSE test below to succeed unexpectedly,
66 # leading to wrong values of LIBTHREAD and LTLIBTHREAD. 67 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
67 CPPFLAGS="$CPPFLAGS -D_REENTRANT" 68 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
68 ;; 69 ])
69 esac
70 # Some systems optimize for single-threaded programs by default, and 70 # Some systems optimize for single-threaded programs by default, and
71 # need special flags to disable these optimizations. For example, the 71 # need special flags to disable these optimizations. For example, the
72 # definition of 'errno' in <errno.h>. 72 # definition of errno in <errno.h>.
73 case "$host_os" in 73 AS_CASE([$host_os],
74 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; 74 [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"],
75 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; 75 [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"])
76 esac
77 gl_anythreadlib_early_done=done 76 gl_anythreadlib_early_done=done
78 fi 77 fi
79]) 78])
@@ -85,24 +84,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
85 AC_REQUIRE([AC_CANONICAL_HOST]) 84 AC_REQUIRE([AC_CANONICAL_HOST])
86 AC_CACHE_CHECK([whether imported symbols can be declared weak], 85 AC_CACHE_CHECK([whether imported symbols can be declared weak],
87 [gl_cv_have_weak], 86 [gl_cv_have_weak],
88 [case "$host_os" in 87 [AS_CASE([$host_os],
89 cygwin* | mingw* | windows*) 88 [cygwin* | mingw* | windows*],
89 [
90 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with 90 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with
91 dnl gcc 11.3, the test below would succeed, but programs that use 91 dnl gcc 11.3, the test below would succeed, but programs that use
92 dnl pthread_in_use() with weak symbol references crash miserably at 92 dnl pthread_in_use() with weak symbol references crash miserably at
93 dnl runtime. 93 dnl runtime.
94 gl_cv_have_weak="guessing no" 94 gl_cv_have_weak="guessing no"
95 ;; 95 ],
96 *) 96 [
97 gl_cv_have_weak=no 97 gl_cv_have_weak=no
98 dnl First, test whether the compiler accepts it syntactically. 98 dnl First, test whether the compiler accepts it syntactically.
99 AC_LINK_IFELSE( 99 AC_LINK_IFELSE(
100 [AC_LANG_PROGRAM( 100 [AC_LANG_PROGRAM(
101 [[extern void xyzzy (); 101 [[extern void xyzzy ();
102#pragma weak xyzzy]], 102#pragma weak xyzzy
103 ]],
103 [[xyzzy();]])], 104 [[xyzzy();]])],
104 [gl_cv_have_weak=maybe]) 105 [gl_cv_have_weak=maybe])
105 if test $gl_cv_have_weak = maybe; then 106 AS_IF([test $gl_cv_have_weak = maybe], [
106 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 107 dnl Second, test whether it actually works. On Cygwin 1.7.2, with
107 dnl gcc 4.3, symbols declared weak always evaluate to the address 0. 108 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
108 AC_RUN_IFELSE( 109 AC_RUN_IFELSE(
@@ -125,20 +126,19 @@ int main ()
125 [gl_cv_have_weak="guessing yes"], 126 [gl_cv_have_weak="guessing yes"],
126 [gl_cv_have_weak="guessing no"]) 127 [gl_cv_have_weak="guessing no"])
127 ]) 128 ])
128 fi 129 ])
129 ;; 130 ])
130 esac 131 dnl But when linking statically, weak symbols do not work.
131 dnl But when linking statically, weak symbols don't work. 132 AS_CASE([" $LDFLAGS "],
132 case " $LDFLAGS " in 133 [*" -static "*], [gl_cv_have_weak=no])
133 *" -static "*) gl_cv_have_weak=no ;;
134 esac
135 dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak 134 dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak
136 dnl symbol and linking against a shared library that has a dependency on 135 dnl symbol and linking against a shared library that has a dependency on
137 dnl the shared library that defines the symbol. 136 dnl the shared library that defines the symbol.
138 case "$gl_cv_have_weak" in 137 AS_CASE([$gl_cv_have_weak],
139 *yes) 138 [*yes],
140 case "$host_os" in 139 [AS_CASE([$host_os],
141 freebsd* | dragonfly* | midnightbsd*) 140 [freebsd* | dragonfly* | midnightbsd*],
141 [
142 : > conftest1.c 142 : > conftest1.c
143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1
144 cat <<EOF > conftest2.c 144 cat <<EOF > conftest2.c
@@ -152,17 +152,15 @@ EOF
152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ 152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \
153 || gl_cv_have_weak=no 153 || gl_cv_have_weak=no
154 rm -f conftest1.c libempty.so conftest2.c conftest 154 rm -f conftest1.c libempty.so conftest2.c conftest
155 ;; 155 ])
156 esac 156 ])
157 ;;
158 esac
159 ]) 157 ])
160 case "$gl_cv_have_weak" in 158 AS_CASE([$gl_cv_have_weak],
161 *yes) 159 [*yes],
160 [
162 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], 161 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
163 [Define to 1 if the compiler and linker support weak declarations of symbols.]) 162 [Define to 1 if the compiler and linker support weak declarations of symbols.])
164 ;; 163 ])
165 esac
166]) 164])
167 165
168dnl ============================================================================ 166dnl ============================================================================
@@ -188,15 +186,15 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once.
188AC_DEFUN([gl_PTHREADLIB_BODY], 186AC_DEFUN([gl_PTHREADLIB_BODY],
189[ 187[
190 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 188 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
191 if test -z "$gl_pthreadlib_body_done"; then 189 AS_IF([test -z "$gl_pthreadlib_body_done"], [
192 gl_pthread_api=no 190 gl_pthread_api=no
193 LIBPTHREAD= 191 LIBPTHREAD=
194 LIBPMULTITHREAD= 192 LIBPMULTITHREAD=
195 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that 193 # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
196 # it groks <pthread.h>. It's added above, in gl_ANYTHREADLIB_EARLY. 194 # it groks <pthread.h>. It is added above, in gl_ANYTHREADLIB_EARLY.
197 AC_CHECK_HEADER([pthread.h], 195 AC_CHECK_HEADER([pthread.h],
198 [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) 196 [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
199 if test "$gl_have_pthread_h" = yes; then 197 AS_IF([test "$gl_have_pthread_h" = yes], [
200 # Other possible tests: 198 # Other possible tests:
201 # -lpthreads (FSU threads, PCthreads) 199 # -lpthreads (FSU threads, PCthreads)
202 # -lgthreads 200 # -lgthreads
@@ -208,7 +206,7 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
208 # needs -pthread for some reason. See: 206 # needs -pthread for some reason. See:
209 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html 207 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
210 saved_LIBS="$LIBS" 208 saved_LIBS="$LIBS"
211 for gl_pthread in '' '-pthread'; do 209 for gl_pthread in "" "-pthread"; do
212 LIBS="$LIBS $gl_pthread" 210 LIBS="$LIBS $gl_pthread"
213 AC_LINK_IFELSE( 211 AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM( 212 [AC_LANG_PROGRAM(
@@ -230,8 +228,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
230 gl_pthread_in_glibc=no 228 gl_pthread_in_glibc=no
231 # On Linux with glibc >= 2.34, libc contains the fully functional 229 # On Linux with glibc >= 2.34, libc contains the fully functional
232 # pthread functions. 230 # pthread functions.
233 case "$host_os" in 231 AS_CASE([$host_os],
234 linux*) 232 [linux*],
233 [
235 AC_EGREP_CPP([Lucky user], 234 AC_EGREP_CPP([Lucky user],
236 [#include <features.h> 235 [#include <features.h>
237 #ifdef __GNU_LIBRARY__ 236 #ifdef __GNU_LIBRARY__
@@ -242,19 +241,18 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
242 ], 241 ],
243 [gl_pthread_in_glibc=yes], 242 [gl_pthread_in_glibc=yes],
244 []) 243 [])
245 ;; 244 ])
246 esac
247 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD 245 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
248 246
249 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 247 # Test for libpthread by looking for pthread_kill. (Not pthread_self,
250 # since it is defined as a macro on OSF/1.) 248 # since it is defined as a macro on OSF/1.)
251 if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then 249 AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [
252 # The program links fine without libpthread. But it may actually 250 # The program links fine without libpthread. But it may actually
253 # need to link with libpthread in order to create multiple threads. 251 # need to link with libpthread in order to create multiple threads.
254 AC_CHECK_LIB([pthread], [pthread_kill], 252 AC_CHECK_LIB([pthread], [pthread_kill],
255 [if test $gl_pthread_in_glibc = yes; then 253 [AS_IF([test $gl_pthread_in_glibc = yes], [
256 LIBPMULTITHREAD= 254 LIBPMULTITHREAD=
257 else 255 ], [
258 LIBPMULTITHREAD=-lpthread 256 LIBPMULTITHREAD=-lpthread
259 # On Solaris and HP-UX, most pthread functions exist also in libc. 257 # On Solaris and HP-UX, most pthread functions exist also in libc.
260 # Therefore pthread_in_use() needs to actually try to create a 258 # Therefore pthread_in_use() needs to actually try to create a
@@ -262,14 +260,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
262 # pthread_create will actually create a thread. 260 # pthread_create will actually create a thread.
263 # On Solaris 10 or newer, this test is no longer needed, because 261 # On Solaris 10 or newer, this test is no longer needed, because
264 # libc contains the fully functional pthread functions. 262 # libc contains the fully functional pthread functions.
265 case "$host_os" in 263 AS_CASE([$host_os],
266changequote(,)dnl 264 [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]],
267 solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) 265 [
268changequote([,])dnl 266 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
269 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 267 [Define if the pthread_in_use() detection is hard.])
270 [Define if the pthread_in_use() detection is hard.]) 268 ])
271 esac 269 ])
272 fi
273 ], 270 ],
274 [dnl This is needed on FreeBSD 5.2.1. 271 [dnl This is needed on FreeBSD 5.2.1.
275 AC_CHECK_LIB([thr], [pthread_kill], 272 AC_CHECK_LIB([thr], [pthread_kill],
@@ -280,35 +277,36 @@ changequote([,])dnl
280 fi 277 fi
281 ]) 278 ])
282 ]) 279 ])
283 elif test $gl_pthread_api != yes; then 280 ], [test $gl_pthread_api != yes], [
284 # Some library is needed. Try libpthread and libc_r. 281 # Some library is needed. Try libpthread and libc_r.
285 AC_CHECK_LIB([pthread], [pthread_kill], 282 AC_CHECK_LIB([pthread], [pthread_kill],
286 [gl_pthread_api=yes 283 [gl_pthread_api=yes
287 LIBPTHREAD=-lpthread 284 LIBPTHREAD=-lpthread
288 LIBPMULTITHREAD=-lpthread]) 285 LIBPMULTITHREAD=-lpthread])
289 if test $gl_pthread_api != yes; then 286 AS_IF([test $gl_pthread_api != yes], [
290 # For FreeBSD 4. 287 # For FreeBSD 4.
291 AC_CHECK_LIB([c_r], [pthread_kill], 288 AC_CHECK_LIB([c_r], [pthread_kill],
292 [gl_pthread_api=yes 289 [gl_pthread_api=yes
293 LIBPTHREAD=-lc_r 290 LIBPTHREAD=-lc_r
294 LIBPMULTITHREAD=-lc_r]) 291 LIBPMULTITHREAD=-lc_r])
295 fi 292 ])
296 fi 293 ])
297 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD 294 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
298 fi 295 ])
299 AC_MSG_CHECKING([whether POSIX threads API is available]) 296 AC_MSG_CHECKING([whether POSIX threads API is available])
300 AC_MSG_RESULT([$gl_pthread_api]) 297 AC_MSG_RESULT([$gl_pthread_api])
301 AC_SUBST([LIBPTHREAD]) 298 AC_SUBST([LIBPTHREAD])
302 AC_SUBST([LIBPMULTITHREAD]) 299 AC_SUBST([LIBPMULTITHREAD])
303 if test $gl_pthread_api = yes; then 300 AS_IF([test $gl_pthread_api = yes], [
304 AC_DEFINE([HAVE_PTHREAD_API], [1], 301 AC_DEFINE([HAVE_PTHREAD_API], [1],
305 [Define if you have the <pthread.h> header and the POSIX threads API.]) 302 [Define if you have the <pthread.h> header and the POSIX threads API.])
306 fi 303 ])
307 304
308 dnl On some systems, sched_yield is in librt, rather than in libpthread. 305 dnl On some systems, sched_yield is in librt, rather than in libpthread.
309 AC_LINK_IFELSE( 306 AC_LINK_IFELSE(
310 [AC_LANG_PROGRAM( 307 [AC_LANG_PROGRAM(
311 [[#include <sched.h>]], 308 [[#include <sched.h>
309 ]],
312 [[sched_yield ();]])], 310 [[sched_yield ();]])],
313 [SCHED_YIELD_LIB= 311 [SCHED_YIELD_LIB=
314 ], 312 ],
@@ -323,7 +321,7 @@ changequote([,])dnl
323 AC_SUBST([LIB_SCHED_YIELD]) 321 AC_SUBST([LIB_SCHED_YIELD])
324 322
325 gl_pthreadlib_body_done=done 323 gl_pthreadlib_body_done=done
326 fi 324 ])
327]) 325])
328 326
329AC_DEFUN([gl_PTHREADLIB], 327AC_DEFUN([gl_PTHREADLIB],
@@ -350,44 +348,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
350[ 348[
351 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 349 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
352 AC_REQUIRE([AC_CANONICAL_HOST]) 350 AC_REQUIRE([AC_CANONICAL_HOST])
353 if test -z "$gl_stdthreadlib_body_done"; then 351 AS_IF([test -z "$gl_stdthreadlib_body_done"], [
354 AC_CHECK_HEADERS_ONCE([threads.h]) 352 AC_CHECK_HEADERS_ONCE([threads.h])
355 353
356 case "$host_os" in 354 AS_CASE([$host_os],
357 mingw* | windows*) 355 [mingw* | windows*],
356 [
358 LIBSTDTHREAD= 357 LIBSTDTHREAD=
359 ;; 358 ],
360 *) 359 [
361 gl_PTHREADLIB_BODY 360 gl_PTHREADLIB_BODY
362 if test $ac_cv_header_threads_h = yes; then 361 AS_IF([test $ac_cv_header_threads_h = yes], [
363 dnl glibc >= 2.29 has thrd_create in libpthread. 362 dnl glibc >= 2.29 has thrd_create in libpthread.
364 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends 363 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
365 dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). 364 dnl on libpthread (for the symbol pthread_mutexattr_gettype).
366 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in 365 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
367 dnl libc. 366 dnl libc.
368 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]]) 367 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>
369 if test $ac_cv_func_thrd_create = yes; then 368 ]])
369 AS_IF([test $ac_cv_func_thrd_create = yes], [
370 LIBSTDTHREAD= 370 LIBSTDTHREAD=
371 else 371 ], [
372 AC_CHECK_LIB([stdthreads], [thrd_create], [ 372 AC_CHECK_LIB([stdthreads], [thrd_create], [
373 LIBSTDTHREAD='-lstdthreads -lpthread' 373 LIBSTDTHREAD="-lstdthreads -lpthread"
374 ], [ 374 ], [
375 dnl Guess that thrd_create is in libpthread. 375 dnl Guess that thrd_create is in libpthread.
376 LIBSTDTHREAD="$LIBPMULTITHREAD" 376 LIBSTDTHREAD="$LIBPMULTITHREAD"
377 ]) 377 ])
378 fi 378 ])
379 else 379 ], [
380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. 380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c.
381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" 381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB"
382 fi 382 ])
383 ;; 383 ])
384 esac
385 AC_SUBST([LIBSTDTHREAD]) 384 AC_SUBST([LIBSTDTHREAD])
386 385
387 AC_MSG_CHECKING([whether ISO C threads API is available]) 386 AC_MSG_CHECKING([whether ISO C threads API is available])
388 AC_MSG_RESULT([$ac_cv_header_threads_h]) 387 AC_MSG_RESULT([$ac_cv_header_threads_h])
389 gl_stdthreadlib_body_done=done 388 gl_stdthreadlib_body_done=done
390 fi 389 ])
391]) 390])
392 391
393AC_DEFUN([gl_STDTHREADLIB], 392AC_DEFUN([gl_STDTHREADLIB],
@@ -404,7 +403,7 @@ dnl ------------
404dnl Tests for a multithreading library to be used. 403dnl Tests for a multithreading library to be used.
405dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO 404dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO
406dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the 405dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the
407dnl default is 'no', otherwise it is system dependent. In both cases, the user 406dnl default is "no", otherwise it is system dependent. In both cases, the user
408dnl can change the choice through the options --enable-threads=choice or 407dnl can change the choice through the options --enable-threads=choice or
409dnl --disable-threads. 408dnl --disable-threads.
410dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, 409dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS,
@@ -449,7 +448,7 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
449 m4_ifdef([gl_THREADLIB_DEFAULT_NO], 448 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], 449 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
451 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) 450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
452 dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like 451 dnl gl_use_winpthreads_default defaults to "no", because in mingw 10, like
453 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash. 452 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash.
454 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) 453 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
455 AC_ARG_ENABLE([threads], 454 AC_ARG_ENABLE([threads],
@@ -459,41 +458,35 @@ AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]),
459 [if test -n "$gl_use_threads_default"; then 458 [if test -n "$gl_use_threads_default"; then
460 gl_use_threads="$gl_use_threads_default" 459 gl_use_threads="$gl_use_threads_default"
461 else 460 else
462changequote(,)dnl 461 AS_CASE([$host_os],
463 case "$host_os" in
464 dnl Disable multithreading by default on OSF/1, because it interferes 462 dnl Disable multithreading by default on OSF/1, because it interferes
465 dnl with fork()/exec(): When msgexec is linked with -lpthread, its 463 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
466 dnl child process gets an endless segmentation fault inside execvp(). 464 dnl child process gets an endless segmentation fault inside execvp().
467 osf*) gl_use_threads=no ;; 465 [osf*], [gl_use_threads=no],
468 dnl Disable multithreading by default on Cygwin 1.5.x, because it has 466 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
469 dnl bugs that lead to endless loops or crashes. See 467 dnl bugs that lead to endless loops or crashes. See
470 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. 468 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
471 cygwin*) 469 [cygwin*],
472 case `uname -r` in 470 [AS_CASE([$(uname -r)],
473 1.[0-5].*) gl_use_threads=no ;; 471 [[1.[0-5].*]], [gl_use_threads=no],
474 *) gl_use_threads=yes ;; 472 [gl_use_threads=yes])
475 esac 473 ],
476 ;;
477 dnl Obey gl_AVOID_WINPTHREAD on mingw. 474 dnl Obey gl_AVOID_WINPTHREAD on mingw.
478 mingw* | windows*) 475 [mingw* | windows*],
479 case "$gl_use_winpthreads_default" in 476 [AS_CASE([$gl_use_winpthreads_default],
480 yes) gl_use_threads=posix ;; 477 [yes], [gl_use_threads=posix],
481 no) gl_use_threads=windows ;; 478 [no], [gl_use_threads=windows],
482 *) gl_use_threads=yes ;; 479 [gl_use_threads=yes])
483 esac 480 ],
484 ;; 481 [gl_use_threads=yes])
485 *) gl_use_threads=yes ;;
486 esac
487changequote([,])dnl
488 fi 482 fi
489 ]) 483 ])
490 if test "$gl_use_threads" = yes \ 484 AS_CASE([$gl_use_threads],
491 || test "$gl_use_threads" = isoc \ 485 [yes | isoc | posix | isoc+posix],
492 || test "$gl_use_threads" = posix \ 486 [
493 || test "$gl_use_threads" = isoc+posix; then 487 # For using <threads.h> or <pthread.h>:
494 # For using <threads.h> or <pthread.h>: 488 gl_ANYTHREADLIB_EARLY
495 gl_ANYTHREADLIB_EARLY 489 ])
496 fi
497]) 490])
498 491
499dnl The guts of gl_THREADLIB. Needs to be expanded only once. 492dnl The guts of gl_THREADLIB. Needs to be expanded only once.
@@ -506,90 +499,95 @@ AC_DEFUN([gl_THREADLIB_BODY],
506 LTLIBTHREAD= 499 LTLIBTHREAD=
507 LIBMULTITHREAD= 500 LIBMULTITHREAD=
508 LTLIBMULTITHREAD= 501 LTLIBMULTITHREAD=
509 if test "$gl_use_threads" != no; then 502 AS_IF([test "$gl_use_threads" = no],
503 [AC_DEFINE([AVOID_ANY_THREADS], [1],
504 [Define if no multithread safety and no multithreading is desired.])],
505 [
510 dnl Check whether the compiler and linker support weak declarations. 506 dnl Check whether the compiler and linker support weak declarations.
511 gl_WEAK_SYMBOLS 507 gl_WEAK_SYMBOLS
512 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 508 AS_CASE([$gl_cv_have_weak],
513 dnl If we use weak symbols to implement pthread_in_use / pth_in_use / 509 [*yes],
514 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create 510 [
515 dnl facility is in use. 511 dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
516 AC_CHECK_HEADERS_ONCE([threads.h]) 512 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
517 : 513 dnl facility is in use.
518 fi 514 AC_CHECK_HEADERS_ONCE([threads.h])
519 if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then 515 :
520 AC_CHECK_HEADERS_ONCE([threads.h]) 516 ])
521 gl_have_isoc_threads="$ac_cv_header_threads_h" 517 AS_CASE([$gl_use_threads],
522 fi 518 [isoc | isoc+posix],
523 if test "$gl_use_threads" = yes \ 519 [
524 || test "$gl_use_threads" = posix \ 520 AC_CHECK_HEADERS_ONCE([threads.h])
525 || test "$gl_use_threads" = isoc+posix; then 521 gl_have_isoc_threads="$ac_cv_header_threads_h"
526 gl_PTHREADLIB_BODY 522 ])
527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD 523 AS_CASE([$gl_use_threads],
528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD 524 [yes | posix | isoc+posix],
529 if test $gl_pthread_api = yes; then 525 [
530 if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then 526 gl_PTHREADLIB_BODY
531 gl_threads_api='isoc+posix' 527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD
532 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], 528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD
533 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) 529 AS_IF([test $gl_pthread_api = yes], [
534 LIBTHREAD= LTLIBTHREAD= 530 AS_IF([test "$gl_use_threads" = isoc+posix &&
535 else 531 test "$gl_have_isoc_threads" = yes], [
536 gl_threads_api=posix 532 gl_threads_api="isoc+posix"
537 AC_DEFINE([USE_POSIX_THREADS], [1], 533 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
538 [Define if the POSIX multithreading library can be used.]) 534 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.])
539 if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then 535 LIBTHREAD= LTLIBTHREAD=
540 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], 536 ], [
541 [Define if references to the POSIX multithreading library are satisfied by libc.]) 537 gl_threads_api=posix
542 else 538 AC_DEFINE([USE_POSIX_THREADS], [1],
543 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 539 [Define if the POSIX multithreading library can be used.])
544 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], 540 AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [
545 [Define if references to the POSIX multithreading library should be made weak.]) 541 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
546 LIBTHREAD= LTLIBTHREAD= 542 [Define if references to the POSIX multithreading library are satisfied by libc.])
547 else 543 ], [
548 case "$host_os" in 544 AS_CASE([$gl_cv_have_weak],
549 freebsd* | dragonfly* | midnightbsd*) 545 [*yes],
550 if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then 546 [
551 dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() 547 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
552 dnl etc. will succeed, we need a runtime test. 548 [Define if references to the POSIX multithreading library should be made weak.])
553 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 549 LIBTHREAD= LTLIBTHREAD=
554 [Define if the pthread_in_use() detection is hard.]) 550 ],
555 fi 551 [AS_CASE([$host_os],
556 ;; 552 [freebsd* | dragonfly* | midnightbsd*],
557 esac 553 [
558 fi 554 AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [
559 fi 555 dnl If weak symbols cannot tell whether
560 fi 556 dnl pthread_create(), dnl pthread_key_create()
561 fi 557 dnl etc. will succeed, we need a runtime test.
562 fi 558 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
563 if test $gl_threads_api = none; then 559 [Define if the pthread_in_use() detection is hard.])
564 if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then 560 ])
561 ])
562 ])
563 ])
564 ])
565 ])
566 ])
567 AS_IF([test $gl_threads_api = none], [
568 AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [
565 gl_STDTHREADLIB_BODY 569 gl_STDTHREADLIB_BODY
566 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD 570 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
567 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD 571 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
568 gl_threads_api=isoc 572 gl_threads_api=isoc
569 AC_DEFINE([USE_ISOC_THREADS], [1], 573 AC_DEFINE([USE_ISOC_THREADS], [1],
570 [Define if the ISO C multithreading library can be used.]) 574 [Define if the ISO C multithreading library can be used.])
571 fi 575 ])
572 fi 576 ])
573 if test $gl_threads_api = none; then 577 AS_IF([test $gl_threads_api = none], [
574 case "$gl_use_threads" in 578 # The "win32" is for backward compatibility.
575 yes | windows | win32) # The 'win32' is for backward compatibility. 579 AS_CASE([$gl_use_threads],
576 if { case "$host_os" in 580 [yes | windows | win32],
577 mingw* | windows*) true;; 581 [AS_CASE([$host_os],
578 *) false;; 582 [mingw* | windows*],
579 esac 583 [
580 }; then 584 gl_threads_api=windows
581 gl_threads_api=windows 585 AC_DEFINE([USE_WINDOWS_THREADS], [1],
582 AC_DEFINE([USE_WINDOWS_THREADS], [1], 586 [Define if the native Windows multithreading API can be used.])
583 [Define if the native Windows multithreading API can be used.]) 587 ])
584 fi 588 ])
585 ;; 589 ])
586 esac 590 ])
587 fi
588 else
589 dnl "$gl_use_threads" is "no".
590 AC_DEFINE([AVOID_ANY_THREADS], [1],
591 [Define if no multithread safety and no multithreading is desired.])
592 fi
593 AC_MSG_CHECKING([for multithread API to use]) 591 AC_MSG_CHECKING([for multithread API to use])
594 AC_MSG_RESULT([$gl_threads_api]) 592 AC_MSG_RESULT([$gl_threads_api])
595 AC_SUBST([LIBTHREAD]) 593 AC_SUBST([LIBTHREAD])
@@ -609,7 +607,7 @@ dnl gl_DISABLE_THREADS
609dnl ------------------ 607dnl ------------------
610dnl Sets the gl_THREADLIB default so that threads are not used by default. 608dnl Sets the gl_THREADLIB default so that threads are not used by default.
611dnl The user can still override it at installation time, by using the 609dnl The user can still override it at installation time, by using the
612dnl configure option '--enable-threads'. 610dnl configure option "--enable-threads".
613 611
614AC_DEFUN([gl_DISABLE_THREADS], [ 612AC_DEFUN([gl_DISABLE_THREADS], [
615 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) 613 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
@@ -621,7 +619,7 @@ dnl -------------------
621dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the 619dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
622dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. 620dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
623dnl The user can still override it at installation time, by using the 621dnl The user can still override it at installation time, by using the
624dnl configure option '--enable-threads=posix'. 622dnl configure option "--enable-threads=posix".
625dnl As of 2023, this is now the default. 623dnl As of 2023, this is now the default.
626 624
627AC_DEFUN([gl_AVOID_WINPTHREAD], [ 625AC_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 @@
1# time_h.m4 1# time_h.m4
2# serial 25 2# serial 27
3dnl Copyright (C) 2000-2001, 2003-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2000-2001, 2003-2007, 2009-2025 Free Software Foundation,
4dnl Inc.
4dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
7 9
8# Configure a more-standard replacement for <time.h>. 10# Configure a more-standard replacement for <time.h>.
9 11
@@ -145,6 +147,7 @@ AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS],
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES]) 147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GETRES])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) 148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) 149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZNAME])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) 151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET])
149 dnl Support Microsoft deprecated alias function names by default. 152 dnl Support Microsoft deprecated alias function names by default.
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) 153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1])
@@ -162,13 +165,16 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
162 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) 165 HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
163 HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) 166 HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET])
164 HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES]) 167 HAVE_TIMESPEC_GETRES=1; AC_SUBST([HAVE_TIMESPEC_GETRES])
165 dnl Even GNU libc does not have timezone_t yet. 168 dnl Even GNU libc does not have timezone_t and tzalloc() yet.
166 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) 169 HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T])
170 HAVE_TZALLOC=0; AC_SUBST([HAVE_TZALLOC])
167 REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME]) 171 REPLACE_CTIME=0; AC_SUBST([REPLACE_CTIME])
168 REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) 172 REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME])
169 REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) 173 REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME])
170 REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R]) 174 REPLACE_LOCALTIME_R=0; AC_SUBST([REPLACE_LOCALTIME_R])
175 REPLACE_LOCALTIME_RZ=0; AC_SUBST([REPLACE_LOCALTIME_RZ])
171 REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME]) 176 REPLACE_MKTIME=0; AC_SUBST([REPLACE_MKTIME])
177 REPLACE_MKTIME_Z=0; AC_SUBST([REPLACE_MKTIME_Z])
172 REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP]) 178 REPLACE_NANOSLEEP=0; AC_SUBST([REPLACE_NANOSLEEP])
173 REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME]) 179 REPLACE_STRFTIME=0; AC_SUBST([REPLACE_STRFTIME])
174 REPLACE_TIME=0; AC_SUBST([REPLACE_TIME]) 180 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 @@
1# time_r.m4 1# time_r.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2003, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Reentrant time functions: localtime_r, gmtime_r. 9dnl Reentrant time functions: localtime_r, gmtime_r.
9 10
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 @@
1# timegm.m4 1# timegm.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 2003, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_TIMEGM], 9AC_DEFUN([gl_FUNC_TIMEGM],
9[ 10[
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 @@
1# uchar_h.m4
2# serial 32
3dnl Copyright (C) 2019-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9dnl From Bruno Haible.
10dnl Prepare the overridden <uchar.h>.
11
12AC_DEFUN_ONCE([gl_UCHAR_H],
13[
14 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
15
16 gl_CHECK_NEXT_HEADERS([uchar.h])
17 if test $ac_cv_header_uchar_h = yes; then
18 HAVE_UCHAR_H=1
19 else
20 HAVE_UCHAR_H=0
21 fi
22 AC_SUBST([HAVE_UCHAR_H])
23
24 dnl On macOS 15, in C mode, <uchar.h> does not exist. But in C++ mode,
25 dnl it exists, and we need to #include_next it, otherwise we get an error
26 dnl "<cuchar> tried including <uchar.h> but didn't find libc++'s <uchar.h>
27 dnl header."
28 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
29 CXX_HAVE_UCHAR_H=0
30 if test "$CXX" != no; then
31 AC_CACHE_CHECK([whether the C++ compiler has <uchar.h>],
32 [gl_cv_cxx_have_uchar_h],
33 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
34 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
35 cat > conftest.cpp <<\EOF
36#include <uchar.h>
37EOF
38 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
39 if AC_TRY_EVAL([gl_command]); then
40 gl_cv_cxx_have_uchar_h=yes
41 else
42 gl_cv_cxx_have_uchar_h=no
43 fi
44 rm -fr conftest*
45 ])
46 if test $gl_cv_cxx_have_uchar_h = yes; then
47 CXX_HAVE_UCHAR_H=1
48 fi
49 fi
50 AC_SUBST([CXX_HAVE_UCHAR_H])
51
52 gl_TYPE_CHAR8_T
53 gl_TYPE_CHAR16_T
54 gl_TYPE_CHAR32_T
55
56 dnl In C++ mode, clang defines 'char16_t' and 'char32_t' as built-in types
57 dnl on some platforms (e.g. OpenBSD 6.7), and as types defined by many
58 dnl header files (<limits.h>, <stddef.h>, <stdint.h>, <stdio.h>, <stdlib.h>
59 dnl and others) on some platforms (e.g. Mac OS X 10.13).
60 dnl The same thing may also happen for 'char8_t'; so, be prepared for it.
61 m4_ifdef([gl_ANSI_CXX], [AC_REQUIRE([gl_ANSI_CXX])])
62 CXX_HAS_UCHAR_TYPES=0
63 if test $HAVE_UCHAR_H = 0; then
64 if test "$CXX" != no; then
65 AC_CACHE_CHECK([whether the C++ compiler predefines the <uchar.h> types],
66 [gl_cv_cxx_has_uchar_types],
67 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
68 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
69 cat > conftest.cpp <<\EOF
70#include <stddef.h>
71char16_t a;
72char32_t b;
73EOF
74 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
75 if AC_TRY_EVAL([gl_command]); then
76 gl_cv_cxx_has_uchar_types=yes
77 else
78 gl_cv_cxx_has_uchar_types=no
79 fi
80 rm -fr conftest*
81 ])
82 if test $gl_cv_cxx_has_uchar_types = yes; then
83 CXX_HAS_UCHAR_TYPES=1
84 fi
85 fi
86 fi
87 AC_SUBST([CXX_HAS_UCHAR_TYPES])
88 CXX_HAS_CHAR8_TYPE=0
89 if test $HAVE_UCHAR_H = 0; then
90 if test "$CXX" != no; then
91 AC_CACHE_CHECK([whether the C++ compiler predefines the char8_t type],
92 [gl_cv_cxx_has_char8_type],
93 [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
94 dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
95 cat > conftest.cpp <<\EOF
96#include <stddef.h>
97char8_t a;
98EOF
99 gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
100 if AC_TRY_EVAL([gl_command]); then
101 gl_cv_cxx_has_char8_type=yes
102 else
103 gl_cv_cxx_has_char8_type=no
104 fi
105 rm -fr conftest*
106 ])
107 if test $gl_cv_cxx_has_char8_type = yes; then
108 CXX_HAS_CHAR8_TYPE=1
109 fi
110 fi
111 fi
112 AC_SUBST([CXX_HAS_CHAR8_TYPE])
113
114 dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'.
115 gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES])
116 if test $BITSIZEOF_WCHAR_T -lt 32; then
117 SMALL_WCHAR_T=1
118 else
119 SMALL_WCHAR_T=0
120 fi
121 dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows.
122 AC_SUBST([SMALL_WCHAR_T])
123
124 dnl Check for declarations of anything we want to poison if the
125 dnl corresponding gnulib module is not in use, and which is not
126 dnl guaranteed by C11.
127 gl_WARN_ON_USE_PREPARE([[
128 #ifdef __HAIKU__
129 #include <stdint.h>
130 #endif
131 #include <uchar.h>
132 ]], [c32rtomb mbrtoc16 mbrtoc32])
133])
134
135AC_DEFUN_ONCE([gl_TYPE_CHAR8_T],
136[
137 dnl Determine whether gnulib's <uchar.h> would, if present, override char8_t.
138 AC_CACHE_CHECK([whether char8_t is correctly defined],
139 [gl_cv_type_char8_t_works],
140 [AC_COMPILE_IFELSE(
141 [AC_LANG_PROGRAM([[
142 #ifdef __HAIKU__
143 #include <stdint.h>
144 #endif
145 #include <uchar.h>
146 int verify[(char8_t)(-1) >= 0 && sizeof (char8_t) == sizeof (unsigned char) ? 1 : -1];
147 ]])
148 ],
149 [gl_cv_type_char8_t_works=yes],
150 [gl_cv_type_char8_t_works=no])
151 ])
152 if test $gl_cv_type_char8_t_works = no; then
153 GNULIBHEADERS_OVERRIDE_CHAR8_T=1
154 else
155 GNULIBHEADERS_OVERRIDE_CHAR8_T=0
156 fi
157 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR8_T])
158])
159
160dnl On Haiku 2020, char16_t and char32_t are incorrectly defined.
161dnl See <https://dev.haiku-os.org/ticket/15990>.
162AC_DEFUN_ONCE([gl_TYPE_CHAR16_T],
163[
164 dnl Determine whether gnulib's <uchar.h> would, if present, override char16_t.
165 AC_CACHE_CHECK([whether char16_t is correctly defined],
166 [gl_cv_type_char16_t_works],
167 [AC_COMPILE_IFELSE(
168 [AC_LANG_PROGRAM([[
169 #ifdef __HAIKU__
170 #include <stdint.h>
171 #endif
172 #include <uchar.h>
173 /* For simplicity, assume that uint16_least_t is equivalent to
174 'unsigned short'. */
175 int verify[(char16_t)(-1) >= 0 && sizeof (char16_t) == sizeof (unsigned short) ? 1 : -1];
176 ]])
177 ],
178 [gl_cv_type_char16_t_works=yes],
179 [gl_cv_type_char16_t_works=no])
180 ])
181 if test $gl_cv_type_char16_t_works = no; then
182 GNULIBHEADERS_OVERRIDE_CHAR16_T=1
183 else
184 GNULIBHEADERS_OVERRIDE_CHAR16_T=0
185 fi
186 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR16_T])
187])
188AC_DEFUN_ONCE([gl_TYPE_CHAR32_T],
189[
190 dnl Determine whether gnulib's <uchar.h> would, if present, override char32_t.
191 AC_CACHE_CHECK([whether char32_t is correctly defined],
192 [gl_cv_type_char32_t_works],
193 [AC_COMPILE_IFELSE(
194 [AC_LANG_PROGRAM([[
195 #ifdef __HAIKU__
196 #include <stdint.h>
197 #endif
198 #include <uchar.h>
199 /* For simplicity, assume that uint32_least_t is equivalent to
200 'unsigned int'. */
201 int verify[(char32_t)(-1) >= 0 && sizeof (char32_t) == sizeof (unsigned int) ? 1 : -1];
202 ]])
203 ],
204 [gl_cv_type_char32_t_works=yes],
205 [gl_cv_type_char32_t_works=no])
206 ])
207 if test $gl_cv_type_char32_t_works = no; then
208 GNULIBHEADERS_OVERRIDE_CHAR32_T=1
209 else
210 GNULIBHEADERS_OVERRIDE_CHAR32_T=0
211 fi
212 AC_SUBST([GNULIBHEADERS_OVERRIDE_CHAR32_T])
213])
214
215# gl_UCHAR_MODULE_INDICATOR([modulename])
216# sets the shell variable that indicates the presence of the given module
217# to a C preprocessor expression that will evaluate to 1.
218# This macro invocation must not occur in macros that are AC_REQUIREd.
219AC_DEFUN([gl_UCHAR_MODULE_INDICATOR],
220[
221 dnl Ensure to expand the default settings once only.
222 gl_UCHAR_H_REQUIRE_DEFAULTS
223 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
224 dnl Define it also as a C macro, for the benefit of the unit tests.
225 gl_MODULE_INDICATOR_FOR_TESTS([$1])
226])
227
228# Initializes the default values for AC_SUBSTed shell variables.
229# This macro must not be AC_REQUIREd. It must only be invoked, and only
230# outside of macros or in macros that are not AC_REQUIREd.
231AC_DEFUN([gl_UCHAR_H_REQUIRE_DEFAULTS],
232[
233 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS], [
234 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BTOC32])
235 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALNUM])
236 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISALPHA])
237 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISBLANK])
238 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISCNTRL])
239 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISDIGIT])
240 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISGRAPH])
241 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISLOWER])
242 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPRINT])
243 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISPUNCT])
244 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISSPACE])
245 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISUPPER])
246 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32ISXDIGIT])
247 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOLOWER])
248 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOUPPER])
249 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32WIDTH])
250 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32RTOMB])
251 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SNRTOMBS])
252 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SRTOMBS])
253 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32STOMBS])
254 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32SWIDTH])
255 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32TOB])
256 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_MAPPING])
257 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_APPLY_TYPE_TEST])
258 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_MAPPING])
259 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_C32_GET_TYPE_TEST])
260 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC16])
261 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBRTOC32])
262 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNRTOC32S])
263 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRTOC32S])
264 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOC32S])
265 ])
266 m4_require(GL_MODULE_INDICATOR_PREFIX[_UCHAR_H_MODULE_INDICATOR_DEFAULTS])
267 AC_REQUIRE([gl_UCHAR_H_DEFAULTS])
268])
269
270AC_DEFUN([gl_UCHAR_H_DEFAULTS],
271[
272 dnl Assume proper GNU behavior unless another module says otherwise.
273 HAVE_C32RTOMB=1; AC_SUBST([HAVE_C32RTOMB])
274 HAVE_MBRTOC16=1; AC_SUBST([HAVE_MBRTOC16])
275 HAVE_MBRTOC32=1; AC_SUBST([HAVE_MBRTOC32])
276 REPLACE_C32RTOMB=0; AC_SUBST([REPLACE_C32RTOMB])
277 REPLACE_MBRTOC16=0; AC_SUBST([REPLACE_MBRTOC16])
278 REPLACE_MBRTOC32=0; AC_SUBST([REPLACE_MBRTOC32])
279])
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 @@
1# ungetc.m4 1# ungetc.m4
2# serial 12 2# serial 12
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS], 9AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
9[ 10[
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 @@
1# unicase_h.m4
2# serial 1
3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNICASE_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
14])
15
16# gl_UNICASE_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNICASE_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNICASE_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNICASE_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_PREFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICASE_EMPTY_SUFFIX_CONTEXT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 ])
38 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICASE_H_MODULE_INDICATOR_DEFAULTS])
39 AC_REQUIRE([gl_UNICASE_H_DEFAULTS])
40])
41
42AC_DEFUN([gl_UNICASE_H_DEFAULTS],
43[
44 dnl Assume proper GNU behavior unless another module says otherwise.
45])
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 @@
1# unictype_h.m4
2# serial 4
3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNICTYPE_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
14])
15
16# gl_UNICTYPE_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNICTYPE_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNICTYPE_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNICTYPE_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_L_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LU_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
38 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
39 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
40 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
41 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_LO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
42 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_M_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
43 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
44 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_MC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
45 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ME_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
46 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_N_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
47 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
48 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
49 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_NO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
50 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_P_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
51 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_PO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_S_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SM_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
60 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
61 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
62 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_SO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_Z_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_ZP_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_C_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CS_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CO_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_CATEGORY_CN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ALPHABETIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NOT_A_CHARACTER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_DEFAULT_IGNORABLE_CODE_POINT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DEPRECATED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOGICAL_ORDER_EXCEPTION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
81 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_VARIATION_SELECTOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
82 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PRIVATE_USE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNASSIGNED_CODE_VALUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_UPPERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_LOWERCASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TITLECASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CASE_IGNORABLE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_LOWERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_UPPERCASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_TITLECASED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEFOLDED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CHANGES_WHEN_CASEMAPPED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SOFT_DOTTED_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
99 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
100 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_ID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
101 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
102 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_XID_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
103 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_START_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
104 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ID_COMPAT_MATH_CONTINUE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
105 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_WHITE_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
106 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PATTERN_SYNTAX_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
107 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_JOIN_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
108 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
109 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
110 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_GRAPHEME_EXTEND_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
111 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_GRAPHEME_LINK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
112 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MODIFIER_COMBINING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
113 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
114 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_LEFT_TO_RIGHT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
115 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_HEBREW_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
116 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_RIGHT_TO_LEFT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
117 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUROPEAN_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
118 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
119 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EUR_NUM_TERMINATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
120 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_ARABIC_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
121 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_COMMON_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
122 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BLOCK_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
123 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_SEGMENT_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
124 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_WHITESPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
125 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_NON_SPACING_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
126 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_BOUNDARY_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
127 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_PDF_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
128 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_EMBEDDING_OR_OVERRIDE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
129 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_BIDI_OTHER_NEUTRAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
130 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ASCII_HEX_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDEOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_UNIFIED_IDEOGRAPH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_RADICAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_UNARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_BINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IDS_TRINARY_OPERATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_PRESENTATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_MODIFIER_BASE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
142 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EMOJI_COMPONENT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
143 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDED_PICTOGRAPHIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
144 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ZERO_WIDTH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
145 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SPACE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
146 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NON_BREAK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
147 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_ISO_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
148 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_FORMAT_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
149 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PREPENDED_CONCATENATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
150 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DASH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
151 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_HYPHEN_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
152 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LINE_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PARAGRAPH_SEPARATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_QUOTATION_MARK_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_SENTENCE_TERMINAL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_TERMINAL_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_CURRENCY_SYMBOL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_OTHER_MATH_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_PAIRED_PUNCTUATION_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_LEFT_OF_PAIR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMBINING_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_COMPOSITE_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DECIMAL_DIGIT_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
166 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_NUMERIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
167 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_DIACRITIC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
168 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_EXTENDER_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
169 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_IGNORABLE_CONTROL_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
170 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNICTYPE_PROPERTY_REGIONAL_INDICATOR_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
171 ])
172 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNICTYPE_H_MODULE_INDICATOR_DEFAULTS])
173 AC_REQUIRE([gl_UNICTYPE_H_DEFAULTS])
174])
175
176AC_DEFUN([gl_UNICTYPE_H_DEFAULTS],
177[
178 dnl Assume proper GNU behavior unless another module says otherwise.
179])
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 @@
1# uninorm_h.m4
2# serial 1
3dnl Copyright (C) 2023-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNINORM_H],
10[
11 dnl Ensure to expand the default settings once only, before all statements
12 dnl that occur in other macros.
13 AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
14])
15
16# gl_UNINORM_MODULE_INDICATOR([modulename])
17# sets the shell variable that indicates the presence of the given module
18# to a C preprocessor expression that will evaluate to 1.
19# This macro invocation must not occur in macros that are AC_REQUIREd.
20AC_DEFUN([gl_UNINORM_MODULE_INDICATOR],
21[
22 dnl Ensure to expand the default settings once only.
23 gl_UNINORM_H_REQUIRE_DEFAULTS
24 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
25 dnl Define it also as a C macro, for the benefit of the unit tests.
26 gl_MODULE_INDICATOR_FOR_TESTS([$1])
27])
28
29# Initializes the default values for AC_SUBSTed shell variables.
30# This macro must not be AC_REQUIREd. It must only be invoked, and only
31# outside of macros or in macros that are not AC_REQUIREd.
32AC_DEFUN([gl_UNINORM_H_REQUIRE_DEFAULTS],
33[
34 m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS], [
35 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
36 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
37 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKD_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
38 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNINORM_NFKC_DLL_VARIABLE], ['LIBUNISTRING_DLL_VARIABLE'])
39 ])
40 m4_require(GL_MODULE_INDICATOR_PREFIX[_UNINORM_H_MODULE_INDICATOR_DEFAULTS])
41 AC_REQUIRE([gl_UNINORM_H_DEFAULTS])
42])
43
44AC_DEFUN([gl_UNINORM_H_DEFAULTS],
45[
46 dnl Assume proper GNU behavior unless another module says otherwise.
47])
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 @@
1# unistd_h.m4 1# unistd_h.m4
2# serial 95 2# serial 97
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Written by Simon Josefsson, Bruno Haible. 9dnl Written by Simon Josefsson, Bruno Haible.
9 10
@@ -243,11 +244,13 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
243 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) 244 REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
244 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) 245 REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
245 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY]) 246 REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
247 REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN])
246 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) 248 REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
247 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) 249 REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
248 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) 250 REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
249 REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) 251 REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS])
250 REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU]) 252 REPLACE_GETPASS_FOR_GETPASS_GNU=0; AC_SUBST([REPLACE_GETPASS_FOR_GETPASS_GNU])
253 REPLACE_GETUSERSHELL=0; AC_SUBST([REPLACE_GETUSERSHELL])
251 REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) 254 REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY])
252 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) 255 REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
253 REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) 256 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 @@
1# unitypes_h.m4
2# serial 1
3dnl Copyright (C) 2021-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN_ONCE([gl_UNITYPES_H],
10[
11 AH_VERBATIM([unitypes_restrict], [
12/* This definition is a duplicate of the one in unitypes.h.
13 It is here so that we can cope with an older version of unitypes.h
14 that does not contain this definition and that is pre-installed among
15 the public header files. */
16# if defined __restrict \
17 || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
18 || __clang_major__ >= 3
19# define _UC_RESTRICT __restrict
20# elif 199901L <= __STDC_VERSION__ || defined restrict
21# define _UC_RESTRICT restrict
22# else
23# define _UC_RESTRICT
24# endif
25])
26])
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 @@
1# unlocked-io.m4 1# unlocked-io.m4
2# serial 16 2# serial 16
3dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Jim Meyering. 9dnl From Jim Meyering.
9dnl 10dnl
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 @@
1# vararrays.m4 1# vararrays.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2001, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# Check for variable-length arrays. 9# Check for variable-length arrays.
9 10
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 @@
1# vasnprintf.m4 1# vasnprintf.m4
2# serial 52 2# serial 56
3dnl Copyright (C) 2002-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_VASNPRINTF], 9AC_DEFUN([gl_FUNC_VASNPRINTF],
9[ 10[
11 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
10 AC_CHECK_FUNCS_ONCE([vasnprintf]) 12 AC_CHECK_FUNCS_ONCE([vasnprintf])
11 if test $ac_cv_func_vasnprintf = no; then 13 if test $ac_cv_func_vasnprintf = yes; then
14 dnl On Cygwin, in directives with a huge width, the width is ignored, and
15 dnl the function returns a wrong result.
16 AC_CACHE_CHECK([whether vasnprintf works],
17 [gl_cv_func_vasnprintf_works],
18 [AC_RUN_IFELSE(
19 [AC_LANG_SOURCE(
20 [[#include <stdio.h>
21 ]],
22 [[size_t len;
23 char *res = vasnprintf (NULL, &len, "x%03000000000dy\n", -17);
24 /* On Cygwin 3.4.6, res is "x-17y\n" and len == 6: wrong. */
25 return (res != NULL && len < 10);
26 ]])
27 ],
28 [gl_cv_func_vasnprintf_works=yes],
29 [gl_cv_func_vasnprintf_works=no],
30 [case "$host_os" in
31 # Guess no on Cygwin.
32 cygwin*) gl_cv_func_vasnprintf_works="guessing no";;
33 # If we don't know, obey --enable-cross-guesses.
34 *) gl_cv_func_vasnprintf_works="$gl_cross_guess_normal";;
35 esac
36 ])
37 ])
38 fi
39 if test $ac_cv_func_vasnprintf != yes \
40 || case "$gl_cv_func_vasnprintf_works" in
41 *yes) false;;
42 *) true;;
43 esac
44 then
12 gl_REPLACE_VASNPRINTF 45 gl_REPLACE_VASNPRINTF
13 fi 46 fi
14]) 47])
@@ -42,7 +75,6 @@ AC_DEFUN([gl_FUNC_VASNWPRINTF],
42# Prerequisites of lib/printf-args.h, lib/printf-args.c. 75# Prerequisites of lib/printf-args.h, lib/printf-args.c.
43AC_DEFUN([gl_PREREQ_PRINTF_ARGS], 76AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
44[ 77[
45 AC_REQUIRE([gt_TYPE_WCHAR_T])
46 AC_REQUIRE([gt_TYPE_WINT_T]) 78 AC_REQUIRE([gt_TYPE_WINT_T])
47]) 79])
48 80
@@ -51,7 +83,6 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
51AC_DEFUN([gl_PREREQ_PRINTF_PARSE], 83AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
52[ 84[
53 AC_REQUIRE([gl_FEATURES_H]) 85 AC_REQUIRE([gl_FEATURES_H])
54 AC_REQUIRE([gt_TYPE_WCHAR_T])
55 AC_REQUIRE([gt_TYPE_WINT_T]) 86 AC_REQUIRE([gt_TYPE_WINT_T])
56 AC_REQUIRE([AC_TYPE_SIZE_T]) 87 AC_REQUIRE([AC_TYPE_SIZE_T])
57 AC_CHECK_TYPE([ptrdiff_t], , 88 AC_CHECK_TYPE([ptrdiff_t], ,
@@ -185,7 +216,6 @@ int main()
185AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF], 216AC_DEFUN_ONCE([gl_PREREQ_VASNXPRINTF],
186[ 217[
187 AC_REQUIRE([AC_FUNC_ALLOCA]) 218 AC_REQUIRE([AC_FUNC_ALLOCA])
188 AC_REQUIRE([gt_TYPE_WCHAR_T])
189 AC_REQUIRE([gt_TYPE_WINT_T]) 219 AC_REQUIRE([gt_TYPE_WINT_T])
190 AC_CHECK_FUNCS([wcslen]) 220 AC_CHECK_FUNCS([wcslen])
191 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization 221 dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
@@ -327,15 +357,39 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LC],
327# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. 357# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
328AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], 358AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
329[ 359[
360 AC_REQUIRE([AC_CANONICAL_HOST])
330 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) 361 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
331 case "$gl_cv_func_printf_flag_grouping" in 362 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_INT_PRECISION])
332 *yes) 363 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING_MULTIBYTE])
333 ;; 364 case "$host_os" in
334 *) 365 mingw* | windows*)
366 dnl MSVC does not support the ' flag at all.
367 dnl mingw does not support it, unless __USE_MINGW_ANSI_STDIO is defined.
368 dnl mingw also has other bugs regarding the ' flag.
335 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1], 369 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
336 [Define if the vasnprintf implementation needs special code for the 370 [Define if the vasnprintf implementation needs special code for the
337 ' flag.]) 371 ' flag.])
338 ;; 372 ;;
373 *)
374 case "$gl_cv_func_printf_flag_grouping,$gl_cv_func_printf_flag_grouping_multibyte" in
375 *yes,*yes)
376 case "$gl_cv_func_printf_flag_grouping_int_precision" in
377 *yes)
378 ;;
379 *)
380 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING_INT], [1],
381 [Define if the vasnprintf implementation needs special code for the
382 ' flag, for integer directives only.])
383 ;;
384 esac
385 ;;
386 *)
387 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
388 [Define if the vasnprintf implementation needs special code for the
389 ' flag.])
390 ;;
391 esac
392 ;;
339 esac 393 esac
340]) 394])
341 395
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 @@
1# vasprintf.m4 1# vasprintf.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2002-2003, 2006-2007, 2009-2024 Free Software Foundation, 3dnl Copyright (C) 2002-2003, 2006-2007, 2009-2025 Free Software Foundation,
4dnl Inc. 4dnl Inc.
5dnl This file is free software; the Free Software Foundation 5dnl This file is free software; the Free Software Foundation
6dnl gives unlimited permission to copy and/or distribute it, 6dnl gives unlimited permission to copy and/or distribute it,
7dnl with or without modifications, as long as this notice is preserved. 7dnl with or without modifications, as long as this notice is preserved.
8dnl This file is offered as-is, without any warranty.
8 9
9AC_DEFUN([gl_FUNC_VASPRINTF], 10AC_DEFUN([gl_FUNC_VASPRINTF],
10[ 11[
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 @@
1# visibility.m4 1# visibility.m4
2# serial 9 2# serial 9
3dnl Copyright (C) 2005, 2008, 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2008, 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9 10
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 @@
1# vsnprintf.m4 1# vsnprintf.m4
2# serial 7 2# serial 7
3dnl Copyright (C) 2002-2004, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, 9dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
9dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib 10dnl 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 @@
1# warn-on-use.m4 1# warn-on-use.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2010-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2010-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) 9# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES)
9# --------------------------------------- 10# ---------------------------------------
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 @@
1# wchar_h.m4 1# wchar_h.m4
2# serial 64 2# serial 65
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. 9dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
9 10
@@ -256,6 +257,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
256 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH]) 257 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
257 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME]) 258 REPLACE_WCSFTIME=0; AC_SUBST([REPLACE_WCSFTIME])
258 REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP]) 259 REPLACE_WCSCMP=0; AC_SUBST([REPLACE_WCSCMP])
260 REPLACE_WCSNCAT=0; AC_SUBST([REPLACE_WCSNCAT])
259 REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP]) 261 REPLACE_WCSNCMP=0; AC_SUBST([REPLACE_WCSNCMP])
260 REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR]) 262 REPLACE_WCSSTR=0; AC_SUBST([REPLACE_WCSSTR])
261 REPLACE_WCSTOK=0; AC_SUBST([REPLACE_WCSTOK]) 263 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 @@
1# wchar_t.m4
2# serial 4 (gettext-0.18.2)
3dnl Copyright (C) 2002-2003, 2008-2024 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl From Bruno Haible.
9dnl Test whether <stddef.h> has the 'wchar_t' type.
10dnl Prerequisite: AC_PROG_CC
11
12AC_DEFUN([gt_TYPE_WCHAR_T],
13[
14 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
15 [AC_COMPILE_IFELSE(
16 [AC_LANG_PROGRAM(
17 [[#include <stddef.h>
18 wchar_t foo = (wchar_t)'\0';]],
19 [[]])],
20 [gt_cv_c_wchar_t=yes],
21 [gt_cv_c_wchar_t=no])])
22 if test $gt_cv_c_wchar_t = yes; then
23 AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
24 fi
25])
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 @@
1# wcrtomb.m4 1# wcrtomb.m4
2# serial 19 2# serial 21
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_FUNC_WCRTOMB], 9AC_DEFUN([gl_FUNC_WCRTOMB],
9[ 10[
@@ -36,7 +37,7 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
36 dnl sometimes returns 0 instead of 1. 37 dnl sometimes returns 0 instead of 1.
37 AC_REQUIRE([AC_PROG_CC]) 38 AC_REQUIRE([AC_PROG_CC])
38 AC_REQUIRE([gt_LOCALE_FR]) 39 AC_REQUIRE([gt_LOCALE_FR])
39 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 40 AC_REQUIRE([gt_LOCALE_EN_UTF8])
40 AC_REQUIRE([gt_LOCALE_JA]) 41 AC_REQUIRE([gt_LOCALE_JA])
41 AC_REQUIRE([gt_LOCALE_ZH_CN]) 42 AC_REQUIRE([gt_LOCALE_ZH_CN])
42 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 43 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
@@ -90,7 +91,7 @@ changequote(,)dnl
90 gl_cv_func_wcrtomb_retval="guessing yes" ;; 91 gl_cv_func_wcrtomb_retval="guessing yes" ;;
91 esac 92 esac
92changequote([,])dnl 93changequote([,])dnl
93 if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then 94 if test $LOCALE_FR != none || test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then
94 AC_RUN_IFELSE( 95 AC_RUN_IFELSE(
95 [AC_LANG_SOURCE([[ 96 [AC_LANG_SOURCE([[
96#include <locale.h> 97#include <locale.h>
@@ -106,8 +107,8 @@ int main ()
106 if (wcrtomb (NULL, 0, NULL) != 1) 107 if (wcrtomb (NULL, 0, NULL) != 1)
107 result |= 1; 108 result |= 1;
108 } 109 }
109 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 110 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
110 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 111 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
111 { 112 {
112 if (wcrtomb (NULL, 0, NULL) != 1) 113 if (wcrtomb (NULL, 0, NULL) != 1)
113 result |= 2; 114 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 @@
1# wctype.m4 1# wctype.m4
2# serial 6 2# serial 6
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN_ONCE([gl_FUNC_WCTYPE], 9AC_DEFUN_ONCE([gl_FUNC_WCTYPE],
9[ 10[
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 @@
3 3
4dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it. 4dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
5 5
6dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 6dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
7dnl This file is free software; the Free Software Foundation 7dnl This file is free software; the Free Software Foundation
8dnl gives unlimited permission to copy and/or distribute it, 8dnl gives unlimited permission to copy and/or distribute it,
9dnl with or without modifications, as long as this notice is preserved. 9dnl with or without modifications, as long as this notice is preserved.
10dnl This file is offered as-is, without any warranty.
10 11
11dnl Written by Paul Eggert. 12dnl Written by Paul Eggert.
12 13
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 @@
1# wcwidth.m4
2# serial 38
3dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
8
9AC_DEFUN([gl_FUNC_WCWIDTH],
10[
11 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
12 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13
14 dnl Persuade glibc <wchar.h> to declare wcwidth().
15 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
16
17 AC_REQUIRE([gt_TYPE_WINT_T])
18
19 AC_CHECK_HEADERS_ONCE([wchar.h])
20 AC_CHECK_FUNCS_ONCE([wcwidth])
21
22 AC_CHECK_DECLS([wcwidth], [], [], [[
23 #include <wchar.h>
24 ]])
25 if test $ac_cv_have_decl_wcwidth != yes; then
26 HAVE_DECL_WCWIDTH=0
27 fi
28
29 if test $ac_cv_func_wcwidth != yes; then
30 AC_CACHE_CHECK([whether wcwidth is a macro],
31 [gl_cv_func_wcwidth_macro],
32 [AC_EGREP_CPP([wchar_header_defines_wcwidth], [
33#include <wchar.h>
34#ifdef wcwidth
35 wchar_header_defines_wcwidth
36#endif],
37 [gl_cv_func_wcwidth_macro=yes],
38 [gl_cv_func_wcwidth_macro=no])
39 ])
40 fi
41
42 if test $ac_cv_func_wcwidth = yes || test $gl_cv_func_wcwidth_macro = yes; then
43 HAVE_WCWIDTH=1
44 dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1.
45 dnl On macOS 12.5, NetBSD 9.3, OpenBSD 5.0, MidnightBSD 1.1,
46 dnl wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1.
47 dnl On macOS 12.5, NetBSD 9.3, MidnightBSD 1.1, OSF/1 5.1,
48 dnl wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1.
49 dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0.
50 dnl This leads to bugs in 'ls' (coreutils).
51 dnl On Solaris 11.4, wcwidth(0x2202) (PARTIAL DIFFERENTIAL) returns 2,
52 dnl even in Western locales.
53 AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales],
54 [gl_cv_func_wcwidth_works],
55 [
56 AC_RUN_IFELSE(
57 [AC_LANG_SOURCE([[
58#include <locale.h>
59#include <wchar.h>
60#if !HAVE_DECL_WCWIDTH
61extern
62# ifdef __cplusplus
63"C"
64# endif
65int wcwidth (int);
66#endif
67int main ()
68{
69 int result = 0;
70 if (setlocale (LC_ALL, "en_US.UTF-8") != NULL)
71 {
72 if (wcwidth (0x0301) > 0)
73 result |= 1;
74 if (wcwidth (0x05B0) > 0)
75 result |= 2;
76 if (wcwidth (0x200B) > 0)
77 result |= 4;
78 if (wcwidth (0xFF1A) == 0)
79 result |= 8;
80 if (wcwidth (0x2202) > 1)
81 result |= 16;
82 }
83 return result;
84}]])],
85 [gl_cv_func_wcwidth_works=yes],
86 [gl_cv_func_wcwidth_works=no],
87 [
88changequote(,)dnl
89 case "$host_os" in
90 # Guess yes on glibc systems.
91 *-gnu* | gnu*) gl_cv_func_wcwidth_works="guessing yes";;
92 # Guess yes on musl systems.
93 *-musl* | midipix*) gl_cv_func_wcwidth_works="guessing yes";;
94 # Guess yes on AIX 7 systems.
95 aix[7-9]*) gl_cv_func_wcwidth_works="guessing yes";;
96 *) gl_cv_func_wcwidth_works="$gl_cross_guess_normal";;
97 esac
98changequote([,])dnl
99 ])
100 ])
101 case "$gl_cv_func_wcwidth_works" in
102 *yes) ;;
103 *no) REPLACE_WCWIDTH=1 ;;
104 esac
105 else
106 HAVE_WCWIDTH=0
107 fi
108 dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not
109 dnl have the wcwidth function, then it does not declare it.
110])
111
112# Prerequisites of lib/wcwidth.c.
113AC_DEFUN([gl_PREREQ_WCWIDTH], [
114 AC_REQUIRE([AC_C_INLINE])
115 :
116])
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 @@
1# wint_t.m4 1# wint_t.m4
2# serial 11 2# serial 11
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl From Bruno Haible. 9dnl From Bruno Haible.
9dnl Test whether <wchar.h> has the 'wint_t' type and whether gnulib's 10dnl Test whether <wchar.h> 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 @@
1# xalloc.m4 1# xalloc.m4
2# serial 18 2# serial 18
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_XALLOC], [:]) 9AC_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 @@
1# xsize.m4 1# xsize.m4
2# serial 5 2# serial 5
3dnl Copyright (C) 2003-2004, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003-2004, 2008-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8AC_DEFUN([gl_XSIZE], 9AC_DEFUN([gl_XSIZE],
9[ 10[
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 @@
1# zzgnulib.m4 1# zzgnulib.m4
2# serial 1 2# serial 1
3dnl Copyright (C) 2020-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2020-2025 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
7dnl This file is offered as-is, without any warranty.
7 8
8dnl This file must be named something that sorts after all other 9dnl This file must be named something that sorts after all other
9dnl package- or gnulib-provided .m4 files - at least for those packages 10dnl package- or gnulib-provided .m4 files - at least for those packages