summaryrefslogtreecommitdiffstats
path: root/gl/m4
diff options
context:
space:
mode:
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.m481
-rw-r--r--gl/m4/base64.m43
-rw-r--r--gl/m4/btowc.m456
-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.m468
-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.m417
-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.m49
-rw-r--r--gl/m4/fflush.m414
-rw-r--r--gl/m4/float_h.m433
-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.m47
-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.m447
-rw-r--r--gl/m4/ftell.m43
-rw-r--r--gl/m4/ftello.m49
-rw-r--r--gl/m4/getaddrinfo.m460
-rw-r--r--gl/m4/getdelim.m452
-rw-r--r--gl/m4/getdtablesize.m43
-rw-r--r--gl/m4/gethostname.m43
-rw-r--r--gl/m4/getline.m452
-rw-r--r--gl/m4/getloadavg.m410
-rw-r--r--gl/m4/getopt.m425
-rw-r--r--gl/m4/getprogname.m411
-rw-r--r--gl/m4/gettext_h.m421
-rw-r--r--gl/m4/gl-openssl.m418
-rw-r--r--gl/m4/gnulib-cache.m42
-rw-r--r--gl/m4/gnulib-common.m4480
-rw-r--r--gl/m4/gnulib-comp.m4532
-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.m48
-rw-r--r--gl/m4/inet_pton.m473
-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.m449
-rw-r--r--gl/m4/largefile.m414
-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.m429
-rw-r--r--gl/m4/locale-ja.m414
-rw-r--r--gl/m4/locale-zh.m424
-rw-r--r--gl/m4/locale_h.m456
-rw-r--r--gl/m4/localeconv.m43
-rw-r--r--gl/m4/lock.m49
-rw-r--r--gl/m4/lseek.m43
-rw-r--r--gl/m4/lstat.m482
-rw-r--r--gl/m4/malloc.m4193
-rw-r--r--gl/m4/malloca.m47
-rw-r--r--gl/m4/math_h.m447
-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.m4100
-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.m436
-rw-r--r--gl/m4/minmax.m43
-rw-r--r--gl/m4/mktime.m428
-rw-r--r--gl/m4/mmap-anon.m422
-rw-r--r--gl/m4/mode_t.m43
-rw-r--r--gl/m4/mountlist.m429
-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.m440
-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.m4317
-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.m45
-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.m49
-rw-r--r--gl/m4/setlocale_null.m415
-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.m47
-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.m429
-rw-r--r--gl/m4/stdalign.m424
-rw-r--r--gl/m4/stdckdint_h.m4136
-rw-r--r--gl/m4/stddef_h.m463
-rw-r--r--gl/m4/stdint.m413
-rw-r--r--gl/m4/stdint_h.m43
-rw-r--r--gl/m4/stdio_h.m417
-rw-r--r--gl/m4/stdlib_h.m468
-rw-r--r--gl/m4/strcasecmp.m467
-rw-r--r--gl/m4/strcasestr.m411
-rw-r--r--gl/m4/strerror.m43
-rw-r--r--gl/m4/string_h.m422
-rw-r--r--gl/m4/stringeq.m425
-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.m411
-rw-r--r--gl/m4/sys_cdefs_h.m426
-rw-r--r--gl/m4/sys_socket_h.m459
-rw-r--r--gl/m4/sys_stat_h.m45
-rw-r--r--gl/m4/sys_types_h.m416
-rw-r--r--gl/m4/sys_uio_h.m43
-rw-r--r--gl/m4/threadlib.m4403
-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.m46
-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.m412
-rw-r--r--gl/m4/wchar_t.m425
-rw-r--r--gl/m4/wcrtomb.m419
-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
194 files changed, 5953 insertions, 1628 deletions
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4
index cd167718..a4b32403 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-2026 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..4dedc0d4 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-2026 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..94ecc510 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-2026 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..e4ff9a3d 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-2026 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..ff0c59dd 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-2026 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..63634c30 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-2026 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..d9433ef7 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 6
3dnl Copyright (C) 2011-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2011-2026 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,25 +50,36 @@ 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
54 dnl <assert.h>, this include actually defines assert.
55 dnl Break the #undef_s apart with a comment so that 'configure' does 59 dnl Break the #undef_s apart with a comment so that 'configure' does
56 dnl not comment them out. 60 dnl not comment them out.
57 AH_VERBATIM([zzstatic_assert], 61 AH_VERBATIM([zzstatic_assert],
58[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ 62[#if (!(defined __clang__ \
63 ? (defined __cplusplus \
64 ? __cplusplus >= 201703L \
65 : __STDC_VERSION__ >= 202000L && __clang_major__ >= 16 \
66 && !defined __sun) \
67 : (defined __GNUC__ \
68 ? (defined __cplusplus \
69 ? __cplusplus >= 201103L && __GNUG__ >= 6 \
70 : __STDC_VERSION__ >= 202000L && __GNUC__ >= 13 \
71 && !defined __sun) \
72 : defined HAVE_C_STATIC_ASSERT)) \
73 && !defined assert \
59 && (!defined __cplusplus \ 74 && (!defined __cplusplus \
60 || (__cpp_static_assert < 201411 \ 75 || (__cpp_static_assert < 201411 \
61 && __GNUG__ < 6 && __clang_major__ < 6))) 76 && __GNUG__ < 6 && __clang_major__ < 6)))
62 #include <assert.h> 77 #include <assert.h>
63 #undef/**/assert 78 #undef/**/assert
64 #ifdef __sgi
65 #undef/**/__ASSERT_H__
66 #endif
67 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. 79 /* 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. */ 80 We need it also to be invocable with a single argument.
69 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus 81 Haiku 2022 <assert.h> does not define static_assert at all. */
82 #if (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
70 #undef/**/static_assert 83 #undef/**/static_assert
71 #define static_assert _Static_assert 84 #define static_assert _Static_assert
72 #endif 85 #endif
diff --git a/gl/m4/base64.m4 b/gl/m4/base64.m4
index 26f2af41..40beb50b 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-2026 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..93c9d769 100644
--- a/gl/m4/btowc.m4
+++ b/gl/m4/btowc.m4
@@ -1,17 +1,19 @@
1# btowc.m4 1# btowc.m4
2# serial 14 2# serial 16
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 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
14 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. 16 dnl <https://gcc.gnu.org/PR42440>.
15 AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) 17 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
16 18
17 AC_CHECK_FUNCS_ONCE([btowc]) 19 AC_CHECK_FUNCS_ONCE([btowc])
@@ -52,43 +54,6 @@ changequote([,])dnl
52 ]) 54 ])
53 ]) 55 ])
54 56
55 dnl IRIX 6.5 btowc(EOF) is 0xFF, not WEOF.
56 AC_CACHE_CHECK([whether btowc(EOF) is correct],
57 [gl_cv_func_btowc_eof],
58 [
59 dnl Initial guess, used when cross-compiling or when no suitable locale
60 dnl is present.
61changequote(,)dnl
62 case "$host_os" in
63 # Guess no on IRIX.
64 irix*) gl_cv_func_btowc_eof="guessing no" ;;
65 # Guess yes on native Windows.
66 mingw* | windows*) gl_cv_func_btowc_eof="guessing yes" ;;
67 # Guess yes otherwise.
68 *) gl_cv_func_btowc_eof="guessing yes" ;;
69 esac
70changequote([,])dnl
71 if test $LOCALE_FR != none; then
72 AC_RUN_IFELSE(
73 [AC_LANG_SOURCE([[
74#include <locale.h>
75#include <stdio.h>
76#include <wchar.h>
77int main ()
78{
79 if (setlocale (LC_ALL, "$LOCALE_FR") != NULL)
80 {
81 if (btowc (EOF) != WEOF)
82 return 1;
83 }
84 return 0;
85}]])],
86 [gl_cv_func_btowc_eof=yes],
87 [gl_cv_func_btowc_eof=no],
88 [:])
89 fi
90 ])
91
92 dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc: 57 dnl On mingw, in the C locale, btowc is inconsistent with mbrtowc:
93 dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and 58 dnl mbrtowc avoids calling MultiByteToWideChar when MB_CUR_MAX is 1 and
94 dnl ___lc_codepage_func() is 0, but btowc is lacking this special case. 59 dnl ___lc_codepage_func() is 0, but btowc is lacking this special case.
@@ -133,14 +98,17 @@ int main ()
133 ]) 98 ])
134 ]) 99 ])
135 100
101 if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then
102 dnl On mingw/ucrt, we override the return type of btowc().
103 dnl While the original wint_t (= unsigned short) and the overridden wint_t
104 dnl (= unsigned int) are equivalent in function parameters, this is not
105 dnl the case for function return types.
106 REPLACE_BTOWC=1
107 fi
136 case "$gl_cv_func_btowc_nul" in 108 case "$gl_cv_func_btowc_nul" in
137 *yes) ;; 109 *yes) ;;
138 *) REPLACE_BTOWC=1 ;; 110 *) REPLACE_BTOWC=1 ;;
139 esac 111 esac
140 case "$gl_cv_func_btowc_eof" in
141 *yes) ;;
142 *) REPLACE_BTOWC=1 ;;
143 esac
144 case "$gl_cv_func_btowc_consistent" in 112 case "$gl_cv_func_btowc_consistent" in
145 *yes) ;; 113 *yes) ;;
146 *) REPLACE_BTOWC=1 ;; 114 *) 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..d3b93ce1
--- /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-2026 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..cf96977e 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-2026 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..a0287062 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-2026 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..f04041a4 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-2026 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..b7a0d44c
--- /dev/null
+++ b/gl/m4/c32rtomb.m4
@@ -0,0 +1,187 @@
1# c32rtomb.m4
2# serial 8
3dnl Copyright (C) 2020-2026 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..2ed64332 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-2026 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..9b498643 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-2026 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..4ab542f4 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-2026 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..957adca6 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-2026 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..e1d51898 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-2026 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..5c0644ab 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-2026 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..ade19b6f 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 19
3dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004, 2006, 2008-2026 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])
@@ -74,59 +83,4 @@ booboo
74 gl_NEXT_HEADERS([errno.h]) 83 gl_NEXT_HEADERS([errno.h])
75 GL_GENERATE_ERRNO_H=true 84 GL_GENERATE_ERRNO_H=true
76 fi 85 fi
77 gl_REPLACE_ERRNO_VALUE([EMULTIHOP])
78 gl_REPLACE_ERRNO_VALUE([ENOLINK])
79 gl_REPLACE_ERRNO_VALUE([EOVERFLOW])
80])
81
82# Assuming $1 = EOVERFLOW.
83# The EOVERFLOW errno value ought to be defined in <errno.h>, according to
84# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and
85# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined.
86# Check for the value of EOVERFLOW.
87# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE.
88AC_DEFUN([gl_REPLACE_ERRNO_VALUE],
89[
90 if $GL_GENERATE_ERRNO_H; then
91 AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [
92 AC_EGREP_CPP([yes],[
93#include <errno.h>
94#ifdef ]$1[
95yes
96#endif
97 ],
98 [gl_cv_header_errno_h_]$1[=yes],
99 [gl_cv_header_errno_h_]$1[=no])
100 if test $gl_cv_header_errno_h_]$1[ = no; then
101 AC_EGREP_CPP([yes],[
102#define _XOPEN_SOURCE_EXTENDED 1
103#include <errno.h>
104#ifdef ]$1[
105yes
106#endif
107 ], [gl_cv_header_errno_h_]$1[=hidden])
108 if test $gl_cv_header_errno_h_]$1[ = hidden; then
109 dnl The macro exists but is hidden.
110 dnl Define it to the same value.
111 AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [
112#define _XOPEN_SOURCE_EXTENDED 1
113#include <errno.h>
114/* The following two lines are a workaround against an autoconf-2.52 bug. */
115#include <stdio.h>
116#include <stdlib.h>
117])
118 fi
119 fi
120 ])
121 case $gl_cv_header_errno_h_]$1[ in
122 yes | no)
123 ]$1[_HIDDEN=0; ]$1[_VALUE=
124 ;;
125 *)
126 ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1["
127 ;;
128 esac
129 AC_SUBST($1[_HIDDEN])
130 AC_SUBST($1[_VALUE])
131 fi
132]) 86])
diff --git a/gl/m4/error.m4 b/gl/m4/error.m4
index 273b636b..f14b9ceb 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-2026 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..73e96943 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-2026 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..bff98570 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-2026 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..9036d7bb
--- /dev/null
+++ b/gl/m4/extensions-aix.m4
@@ -0,0 +1,26 @@
1# extensions-aix.m4
2# serial 1
3dnl Copyright (C) 2024-2026 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..01a8e5f9 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-2026 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..4ccc4a95 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 2
3dnl Copyright 2012-2024 Free Software Foundation, Inc. 3dnl Copyright 2012-2026 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
@@ -42,9 +43,11 @@ AC_DEFUN([gl_EXTERN_INLINE],
42 functions or macros in standard C headers like <ctype.h>. For example, 43 functions or macros in standard C headers like <ctype.h>. For example,
43 if isdigit is mistakenly implemented via a static inline function, 44 if isdigit is mistakenly implemented via a static inline function,
44 a program containing an extern inline function that calls isdigit 45 a program containing an extern inline function that calls isdigit
45 may not work since the C standard prohibits extern inline functions 46 may not work since C99 through C23 prohibit extern inline functions
46 from calling static functions (ISO C 99 section 6.7.4.(3). 47 from calling static functions (ISO C 23 § 6.7.5 ¶ 3)).
47 This bug is known to occur on: 48 Although a future C standard will likely relax this restriction
49 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3622.txt>,
50 respect it for now. This bug is known to occur on:
48 51
49 OS X 10.8 and earlier; see: 52 OS X 10.8 and earlier; see:
50 https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html 53 https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html
@@ -111,8 +114,8 @@ AC_DEFUN([gl_EXTERN_INLINE],
111 suppress bogus "no previous prototype for 'FOO'" 114 suppress bogus "no previous prototype for 'FOO'"
112 and "no previous declaration for 'FOO'" diagnostics, 115 and "no previous declaration for 'FOO'" diagnostics,
113 when FOO is an inline function in the header; see 116 when FOO is an inline function in the header; see
114 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and 117 <https://gcc.gnu.org/PR54113> and
115 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ 118 <https://gcc.gnu.org/PR63877>. */
116#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ 119#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__
117# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ 120# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
118# define _GL_INLINE_HEADER_CONST_PRAGMA 121# define _GL_INLINE_HEADER_CONST_PRAGMA
diff --git a/gl/m4/fclose.m4 b/gl/m4/fclose.m4
index 0c1358ed..65eb7705 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-2026 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..a94fc557 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-2026 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..69ac76f9 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-2026 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..946a0bd6 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 21
3dnl Copyright (C) 2006-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2007, 2009-2026 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
@@ -25,7 +26,7 @@ AC_DEFUN_ONCE([gl_FCNTL_H],
25 dnl corresponding gnulib module is not in use, if it is not common 26 dnl corresponding gnulib module is not in use, if it is not common
26 dnl enough to be declared everywhere. 27 dnl enough to be declared everywhere.
27 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h> 28 gl_WARN_ON_USE_PREPARE([[#include <fcntl.h>
28 ]], [fcntl openat]) 29 ]], [fcntl openat openat2])
29]) 30])
30 31
31# gl_FCNTL_MODULE_INDICATOR([modulename]) 32# gl_FCNTL_MODULE_INDICATOR([modulename])
@@ -52,6 +53,7 @@ AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS],
52 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) 53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING])
53 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) 54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN])
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) 55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT2])
55 dnl Support Microsoft deprecated alias function names by default. 57 dnl Support Microsoft deprecated alias function names by default.
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) 58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) 59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1])
@@ -65,6 +67,7 @@ AC_DEFUN([gl_FCNTL_H_DEFAULTS],
65 dnl Assume proper GNU behavior unless another module says otherwise. 67 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) 68 HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL])
67 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) 69 HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT])
70 HAVE_OPENAT2=0; AC_SUBST([HAVE_OPENAT2])
68 REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) 71 REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT])
69 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) 72 REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL])
70 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) 73 REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN])
diff --git a/gl/m4/fflush.m4 b/gl/m4/fflush.m4
index 43fc3bf3..c5913b23 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-2026 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..c0ee7f8f 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 17
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 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[
@@ -12,7 +13,7 @@ AC_DEFUN([gl_FLOAT_H],
12 GL_GENERATE_FLOAT_H=false 13 GL_GENERATE_FLOAT_H=false
13 REPLACE_FLOAT_LDBL=0 14 REPLACE_FLOAT_LDBL=0
14 case "$host_os" in 15 case "$host_os" in
15 aix* | beos* | openbsd* | mirbsd* | irix*) 16 aix* | beos* | openbsd* | mirbsd*)
16 GL_GENERATE_FLOAT_H=true 17 GL_GENERATE_FLOAT_H=true
17 ;; 18 ;;
18 freebsd* | dragonfly*) 19 freebsd* | dragonfly*)
@@ -54,6 +55,32 @@ 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 int y[] = { FLT_IS_IEC_60559, DBL_IS_IEC_60559, LDBL_IS_IEC_60559 };
67 float maxf = FLT_NORM_MAX;
68 double maxd = DBL_NORM_MAX;
69 long double maxl = LDBL_NORM_MAX;
70 ]],
71 [[float sf = FLT_SNAN;
72 double sd = DBL_SNAN;
73 long double sl = LDBL_SNAN;
74 return (sf != 0) + (sd != 0) + (sl != 0);
75 ]])],
76 [gl_cv_header_float_h_isoc23=yes],
77 [gl_cv_header_float_h_isoc23=no])
78 ])
79 if test $gl_cv_header_float_h_isoc23 != yes; then
80 GL_GENERATE_FLOAT_H=true
81 REPLACE_FLOAT_SNAN=1
82 fi
83
57 dnl Test against glibc-2.7 Linux/SPARC64 bug. 84 dnl Test against glibc-2.7 Linux/SPARC64 bug.
58 REPLACE_ITOLD=0 85 REPLACE_ITOLD=0
59 AC_CACHE_CHECK([whether conversion from 'int' to 'long double' works], 86 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..731f0b0a 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-2026 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..07779a16 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-2026 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..a7cf67dc 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-2026 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..b5b54f40 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-2026 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..c7a134ba 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-2026 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
@@ -13,10 +14,10 @@ AC_DEFUN([gl_FUNC_FREE],
13 14
14 dnl In the next release of POSIX, free must preserve errno. 15 dnl In the next release of POSIX, free must preserve errno.
15 dnl https://www.austingroupbugs.net/view.php?id=385 16 dnl https://www.austingroupbugs.net/view.php?id=385
16 dnl https://sourceware.org/bugzilla/show_bug.cgi?id=17924 17 dnl https://sourceware.org/PR17924
17 dnl So far, we know of three platforms that do this: 18 dnl So far, we know of three platforms that do this:
18 dnl * glibc >= 2.33, thanks to the fix for this bug: 19 dnl * glibc >= 2.33, thanks to the fix for this bug:
19 dnl <https://sourceware.org/bugzilla/show_bug.cgi?id=17924> 20 dnl <https://sourceware.org/PR17924>
20 dnl * OpenBSD >= 4.5, thanks to this commit: 21 dnl * OpenBSD >= 4.5, thanks to this commit:
21 dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h> 22 dnl <https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdlib/malloc.c.diff?r1=1.100&r2=1.101&f=h>
22 dnl * Solaris, because its malloc() implementation is based on brk(), 23 dnl * Solaris, because its malloc() implementation is based on brk(),
diff --git a/gl/m4/fseek.m4 b/gl/m4/fseek.m4
index fb220a1f..398fd5f8 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-2026 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..cd81961a 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-2026 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..e5ad635b
--- /dev/null
+++ b/gl/m4/fseterr.m4
@@ -0,0 +1,15 @@
1# fseterr.m4
2# serial 2
3dnl Copyright (C) 2012-2026 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..7db4e346 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-2026 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..64122a73 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-2026 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..db6e0e3b 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 37
3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1997-1998, 2000-2001, 2003-2026 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
@@ -46,16 +48,12 @@ AC_DEFUN([gl_FILE_SYSTEM_USAGE],
46 # is what it gets when this test fails. 48 # is what it gets when this test fails.
47 if test $ac_fsusage_space = no; then 49 if test $ac_fsusage_space = no; then
48 # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, 50 # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
49 # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. 51 # OpenBSD >= 4.4, AIX, HP-UX, Solaris, Cygwin, Interix, BeOS.
50 AC_CACHE_CHECK([for statvfs function (SVR4)], 52 AC_CACHE_CHECK([for statvfs function (SVR4)],
51 [fu_cv_sys_stat_statvfs], 53 [fu_cv_sys_stat_statvfs],
52 [AC_LINK_IFELSE( 54 [AC_LINK_IFELSE(
53 [AC_LANG_PROGRAM([[ 55 [AC_LANG_PROGRAM([[
54#include <sys/types.h> 56#include <sys/types.h>
55#ifdef __osf__
56"Do not use Tru64's statvfs implementation"
57#endif
58
59#include <sys/statvfs.h> 57#include <sys/statvfs.h>
60 58
61struct statvfs fsd; 59struct statvfs fsd;
@@ -77,7 +75,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
77 if test $fu_cv_sys_stat_statvfs = yes; then 75 if test $fu_cv_sys_stat_statvfs = yes; then
78 ac_fsusage_space=yes 76 ac_fsusage_space=yes
79 # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. 77 # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs.
80 # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems 78 # glibc, HP-UX, Solaris have statvfs64 as well, but on these systems
81 # statvfs with large-file support is already equivalent to statvfs64. 79 # statvfs with large-file support is already equivalent to statvfs64.
82 AC_CACHE_CHECK([whether to use statvfs64], 80 AC_CACHE_CHECK([whether to use statvfs64],
83 [fu_cv_sys_stat_statvfs64], 81 [fu_cv_sys_stat_statvfs64],
@@ -139,37 +137,9 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
139 fi 137 fi
140 138
141 if test $ac_fsusage_space = no; then 139 if test $ac_fsusage_space = no; then
142 # DEC Alpha running OSF/1
143 AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)],
144 [fu_cv_sys_stat_statfs3_osf1],
145 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
146#include <sys/param.h>
147#include <sys/types.h>
148#include <sys/mount.h>
149 int
150 main ()
151 {
152 struct statfs fsd;
153 fsd.f_fsize = 0;
154 return statfs (".", &fsd, sizeof (struct statfs)) != 0;
155 }]])],
156 [fu_cv_sys_stat_statfs3_osf1=yes],
157 [fu_cv_sys_stat_statfs3_osf1=no],
158 [fu_cv_sys_stat_statfs3_osf1=no])
159 ])
160 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
161 ac_fsusage_space=yes
162 AC_DEFINE([STAT_STATFS3_OSF1], [1],
163 [Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
164 fi
165 fi
166
167 if test $ac_fsusage_space = no; then
168 # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. 140 # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
169 # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, 141 # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
170 # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) 142 # OpenBSD >= 4.4, AIX, HP-UX, Cygwin already handled above.)
171 # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
172 # <sys/vfs.h>.)
173 # (On Solaris, statfs has 4 arguments.) 143 # (On Solaris, statfs has 4 arguments.)
174 AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], 144 AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)],
175 [fu_cv_sys_stat_statfs2_bsize], 145 [fu_cv_sys_stat_statfs2_bsize],
@@ -223,13 +193,12 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
223 if test $fu_cv_sys_stat_statfs4 = yes; then 193 if test $fu_cv_sys_stat_statfs4 = yes; then
224 ac_fsusage_space=yes 194 ac_fsusage_space=yes
225 AC_DEFINE([STAT_STATFS4], [1], 195 AC_DEFINE([STAT_STATFS4], [1],
226 [Define if statfs takes 4 args. (SVR3, old Irix)]) 196 [Define if statfs takes 4 args. (SVR3)])
227 fi 197 fi
228 fi 198 fi
229 199
230 if test $ac_fsusage_space = no; then 200 if test $ac_fsusage_space = no; then
231 # 4.4BSD and older NetBSD 201 # 4.4BSD and older NetBSD
232 # (OSF/1 already handled above.)
233 # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) 202 # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.)
234 # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in 203 # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in
235 # <sys/mount.h>.) 204 # <sys/mount.h>.)
diff --git a/gl/m4/ftell.m4 b/gl/m4/ftell.m4
index ab10736b..0b389f86 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-2026 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..ae0e884f 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-2026 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..8a63600b 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 39
3dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2004-2026 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,60 @@ 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_NUMERICHOST and 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 int result = 0;
111 struct addrinfo *ai;
112 {
113 struct addrinfo hints;
114 memset (&hints, 0, sizeof (hints));
115 hints.ai_flags = AI_NUMERICHOST;
116 if (getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME)
117 result |= 1;
118 }
119 {
120 struct addrinfo hints;
121 memset (&hints, 0, sizeof (hints));
122 hints.ai_flags = AI_NUMERICSERV;
123 if (getaddrinfo ("www.gnu.org", "http", &hints, &ai) != EAI_NONAME)
124 result |= 2;
125 }
126 return result;
127 ]])
128 ],
129 [gl_cv_func_getaddrinfo_works=yes],
130 [gl_cv_func_getaddrinfo_works=no],
131 [case "$host_os" in
132 # Guess no on Solaris.
133 solaris*) gl_cv_func_getaddrinfo_works="guessing no" ;;
134 # Guess no on native Windows.
135 mingw* | windows*) gl_cv_func_getaddrinfo_works="guessing no" ;;
136 # Guess yes otherwise.
137 *) gl_cv_func_getaddrinfo_works="guessing yes" ;;
138 esac
139 ])
140 ])
141 case "$gl_cv_func_getaddrinfo_works" in
142 *yes) ;;
143 *) REPLACE_GETADDRINFO=1 ;;
144 esac
145 fi
90 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO], 146 AC_DEFINE_UNQUOTED([HAVE_GETADDRINFO], [$HAVE_GETADDRINFO],
91 [Define to 1 if getaddrinfo exists, or to 0 otherwise.]) 147 [Define to 1 if getaddrinfo exists, or to 0 otherwise.])
92 148
diff --git a/gl/m4/getdelim.m4 b/gl/m4/getdelim.m4
index 61139039..8b6eff47 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 21
3 3
4dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 4dnl Copyright (C) 2005-2007, 2009-2026 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
@@ -36,6 +37,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
36 gl_cv_func_working_getdelim=no ;; 37 gl_cv_func_working_getdelim=no ;;
37 *) 38 *)
38 echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data 39 echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
40 touch conftest.empty
39 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 41 AC_RUN_IFELSE([AC_LANG_SOURCE([[
40# include <stdio.h> 42# include <stdio.h>
41# include <stdlib.h> 43# include <stdlib.h>
@@ -43,6 +45,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
43 int main () 45 int main ()
44 { 46 {
45 FILE *in = fopen ("./conftest.data", "r"); 47 FILE *in = fopen ("./conftest.data", "r");
48 int result = 0;
46 if (!in) 49 if (!in)
47 return 1; 50 return 1;
48 { 51 {
@@ -52,7 +55,7 @@ AC_DEFUN([gl_FUNC_GETDELIM],
52 size_t siz = 0; 55 size_t siz = 0;
53 int len = getdelim (&line, &siz, '\n', in); 56 int len = getdelim (&line, &siz, '\n', in);
54 if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) 57 if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
55 { free (line); fclose (in); return 2; } 58 result |= 2;
56 free (line); 59 free (line);
57 } 60 }
58 { 61 {
@@ -61,35 +64,40 @@ AC_DEFUN([gl_FUNC_GETDELIM],
61 char *line = NULL; 64 char *line = NULL;
62 size_t siz = (size_t)(~0) / 4; 65 size_t siz = (size_t)(~0) / 4;
63 if (getdelim (&line, &siz, '\n', in) == -1) 66 if (getdelim (&line, &siz, '\n', in) == -1)
64 { fclose (in); return 3; } 67 result |= 4;
65 free (line); 68 free (line);
66 } 69 }
67 fclose (in); 70 fclose (in);
68 return 0; 71 {
72 /* Test that reading EOF as the first character sets the first byte
73 in the buffer to NUL. This fails on glibc 2.42 and earlier. */
74 in = fopen ("./conftest.empty", "r");
75 if (!in)
76 return 1;
77 char *line = malloc (1);
78 line[0] = 'A';
79 size_t siz = 1;
80 if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0')
81 result |= 8;
82 free (line);
83 }
84 fclose (in);
85 return result;
69 } 86 }
70 ]])], 87 ]])],
71 [gl_cv_func_working_getdelim=yes], 88 [gl_cv_func_working_getdelim=yes],
72 [gl_cv_func_working_getdelim=no], 89 [gl_cv_func_working_getdelim=no],
73 [dnl We're cross compiling. 90 [case "$host_os" in
74 dnl Guess it works on glibc2 systems and musl systems. 91 # Guess yes on musl.
75 AC_EGREP_CPP([Lucky GNU user], 92 *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
76 [ 93 # Guess no on glibc.
77#include <features.h> 94 *-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;;
78#ifdef __GNU_LIBRARY__ 95 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
79 #if (__GLIBC__ >= 2) && !defined __UCLIBC__ 96 esac
80 Lucky GNU user
81 #endif
82#endif
83 ],
84 [gl_cv_func_working_getdelim="guessing yes"],
85 [case "$host_os" in
86 *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
87 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
88 esac
89 ])
90 ]) 97 ])
91 ;; 98 ;;
92 esac 99 esac
100 rm -f conftest.data conftest.empty
93 ]) 101 ])
94 case "$gl_cv_func_working_getdelim" in 102 case "$gl_cv_func_working_getdelim" in
95 *yes) ;; 103 *yes) ;;
diff --git a/gl/m4/getdtablesize.m4 b/gl/m4/getdtablesize.m4
index aaefe9b2..0b780110 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-2026 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..33293521 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-2026 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..ed32fa10 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 35
3 3
4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2024 Free Software Foundation, 4dnl Copyright (C) 1998-2003, 2005-2007, 2009-2026 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
@@ -30,6 +31,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
30 AC_CACHE_CHECK([for working getline function], 31 AC_CACHE_CHECK([for working getline function],
31 [am_cv_func_working_getline], 32 [am_cv_func_working_getline],
32 [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data 33 [echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
34 touch conftest.empty
33 AC_RUN_IFELSE([AC_LANG_SOURCE([[ 35 AC_RUN_IFELSE([AC_LANG_SOURCE([[
34# include <stdio.h> 36# include <stdio.h>
35# include <stdlib.h> 37# include <stdlib.h>
@@ -37,6 +39,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
37 int main () 39 int main ()
38 { 40 {
39 FILE *in = fopen ("./conftest.data", "r"); 41 FILE *in = fopen ("./conftest.data", "r");
42 int result = 0;
40 if (!in) 43 if (!in)
41 return 1; 44 return 1;
42 { 45 {
@@ -46,7 +49,7 @@ AC_DEFUN([gl_FUNC_GETLINE],
46 size_t siz = 0; 49 size_t siz = 0;
47 int len = getline (&line, &siz, in); 50 int len = getline (&line, &siz, in);
48 if (!(len == 4 && line && strcmp (line, "foo\n") == 0)) 51 if (!(len == 4 && line && strcmp (line, "foo\n") == 0))
49 { free (line); fclose (in); return 2; } 52 result |= 2;
50 free (line); 53 free (line);
51 } 54 }
52 { 55 {
@@ -55,33 +58,38 @@ AC_DEFUN([gl_FUNC_GETLINE],
55 char *line = NULL; 58 char *line = NULL;
56 size_t siz = (size_t)(~0) / 4; 59 size_t siz = (size_t)(~0) / 4;
57 if (getline (&line, &siz, in) == -1) 60 if (getline (&line, &siz, in) == -1)
58 { fclose (in); return 3; } 61 result |= 4;
59 free (line); 62 free (line);
60 } 63 }
61 fclose (in); 64 fclose (in);
62 return 0; 65 {
66 /* Test that reading EOF as the first character sets the first byte
67 in the buffer to NUL. This fails on glibc 2.42 and earlier. */
68 in = fopen ("./conftest.empty", "r");
69 if (!in)
70 return 1;
71 char *line = malloc (1);
72 line[0] = 'A';
73 size_t siz = 1;
74 if (getline (&line, &siz, in) != -1 || line[0] != '\0')
75 result |= 8;
76 free (line);
77 }
78 fclose (in);
79 return result;
63 } 80 }
64 ]])], 81 ]])],
65 [am_cv_func_working_getline=yes], 82 [am_cv_func_working_getline=yes],
66 [am_cv_func_working_getline=no], 83 [am_cv_func_working_getline=no],
67 [dnl We're cross compiling. 84 [case "$host_os" in
68 dnl Guess it works on glibc2 systems and musl systems. 85 # Guess yes on musl.
69 AC_EGREP_CPP([Lucky GNU user], 86 *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
70 [ 87 # Guess no on glibc.
71#include <features.h> 88 *-gnu* | gnu*) am_cv_func_working_getline="guessing no" ;;
72#ifdef __GNU_LIBRARY__ 89 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
73 #if (__GLIBC__ >= 2) && !defined __UCLIBC__ 90 esac
74 Lucky GNU user
75 #endif
76#endif
77 ],
78 [am_cv_func_working_getline="guessing yes"],
79 [case "$host_os" in
80 *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
81 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
82 esac
83 ])
84 ]) 91 ])
92 rm -f conftest.data conftest.empty
85 ]) 93 ])
86 else 94 else
87 am_cv_func_working_getline=no 95 am_cv_func_working_getline=no
diff --git a/gl/m4/getloadavg.m4 b/gl/m4/getloadavg.m4
index 0918bcd2..dc226168 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 14
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-2026 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
@@ -123,8 +124,7 @@ if test $gl_func_getloadavg_done = no; then
123fi 124fi
124 125
125# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it 126# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it
126# uses stabs), but it is still SVR4. We cannot check for <elf.h> because 127# uses stabs), but it is still SVR4.
127# Irix 4.0.5F has the header but not the library.
128if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \ 128if test $gl_func_getloadavg_done = no && test "$ac_cv_lib_elf_elf_begin" = yes \
129 && test "$ac_cv_lib_kvm_kvm_open" = yes; then 129 && test "$ac_cv_lib_kvm_kvm_open" = yes; then
130 gl_func_getloadavg_done=yes 130 gl_func_getloadavg_done=yes
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 297722ea..c620b2b7 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 52
3dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2008-2026 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
@@ -87,8 +88,8 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
87 dnl Merging these three different test programs into a single one 88 dnl Merging these three different test programs into a single one
88 dnl would require a reset mechanism. On BSD systems, it can be done 89 dnl would require a reset mechanism. On BSD systems, it can be done
89 dnl through 'optreset'; on some others (glibc), it can be done by 90 dnl through 'optreset'; on some others (glibc), it can be done by
90 dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1, 91 dnl setting 'optind' to 0; on others again (HP-UX, Solaris 9,
91 dnl Solaris 9, musl libc), there is no such mechanism. 92 dnl musl libc), there is no such mechanism.
92 if test $cross_compiling = no; then 93 if test $cross_compiling = no; then
93 dnl Sanity check. Succeeds everywhere (except on MSVC, 94 dnl Sanity check. Succeeds everywhere (except on MSVC,
94 dnl which lacks <unistd.h> and getopt() entirely). 95 dnl which lacks <unistd.h> and getopt() entirely).
@@ -237,8 +238,7 @@ dnl is ambiguous with environment values that contain newlines.
237 nocrash_init(); 238 nocrash_init();
238 239
239 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, 240 /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
240 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, 241 and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, Solaris 10. */
241 OSF/1 5.1, Solaris 10. */
242 { 242 {
243 static char conftest[] = "conftest"; 243 static char conftest[] = "conftest";
244 static char plus[] = "-+"; 244 static char plus[] = "-+";
@@ -249,7 +249,7 @@ dnl is ambiguous with environment values that contain newlines.
249 } 249 }
250 /* This code succeeds on glibc 2.8, mingw, 250 /* This code succeeds on glibc 2.8, mingw,
251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, 251 and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
252 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ 252 Solaris 10, Cygwin 1.5.x. */
253 { 253 {
254 static char program[] = "program"; 254 static char program[] = "program";
255 static char p[] = "-p"; 255 static char p[] = "-p";
@@ -366,14 +366,7 @@ dnl is ambiguous with environment values that contain newlines.
366 366
367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 367AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
368[ 368[
369 AC_CHECK_HEADERS_ONCE([sys/cdefs.h]) 369 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_]], 370 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
378 [Define to rpl_ if the getopt replacement functions and variables 371 [Define to rpl_ if the getopt replacement functions and variables
379 should be used.]) 372 should be used.])
diff --git a/gl/m4/getprogname.m4 b/gl/m4/getprogname.m4
index b24f4480..d60f3efb 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 9
3dnl Copyright (C) 2016-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2016-2026 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
@@ -11,6 +12,12 @@ AC_DEFUN([gl_FUNC_GETPROGNAME],
11[ 12[
12 AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) 13 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) 14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 AC_CHECK_HEADERS_ONCE([sys/process.h])
16 if test $ac_cv_header_sys_process_h = yes; then
17 HAVE_SYS_PROCESS_H=1
18 else
19 HAVE_SYS_PROCESS_H=0
20 fi
14 gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]]) 21 gl_CHECK_FUNCS_ANDROID([getprogname], [[#include <stdlib.h>]])
15 if test $ac_cv_func_getprogname = no; then 22 if test $ac_cv_func_getprogname = no; then
16 HAVE_GETPROGNAME=0 23 HAVE_GETPROGNAME=0
diff --git a/gl/m4/gettext_h.m4 b/gl/m4/gettext_h.m4
new file mode 100644
index 00000000..7ef89541
--- /dev/null
+++ b/gl/m4/gettext_h.m4
@@ -0,0 +1,21 @@
1# gettext_h.m4
2# serial 1
3dnl Copyright (C) 2025-2026 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_GETTEXT_H],
10[
11 AC_SUBST([LIBINTL])
12 AC_SUBST([LTLIBINTL])
13 AH_BOTTOM([
14/* The text domainname for Gnulib messages. Ordinarily this is "gnulib",
15 but packages that do their own translations of Gnulib can use something
16 different by defining GNULIB_TEXT_DOMAIN in their config.h file. */
17#ifndef GNULIB_TEXT_DOMAIN
18# define GNULIB_TEXT_DOMAIN/**/"gnulib"
19#endif
20])
21])
diff --git a/gl/m4/gl-openssl.m4 b/gl/m4/gl-openssl.m4
index c5e1f7ba..70f43a55 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 8
3dnl Copyright (C) 2013-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2013-2026 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[
@@ -57,12 +58,17 @@ AC_DEFUN([gl_CRYPTO_CHECK],
57 fi 58 fi
58 if test "x$with_openssl" != xauto-gpl-compat || 59 if test "x$with_openssl" != xauto-gpl-compat ||
59 test "x$gl_cv_openssl_gpl_compat" = xyes; then 60 test "x$gl_cv_openssl_gpl_compat" = xyes; then
60 AC_CHECK_LIB([crypto], [$1], 61 m4_if([$1], [SHA3],
61 [AC_CHECK_HEADERS( 62 [AC_CHECK_LIB([crypto], [EVP_sha3_224],
62 m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]),
63 [LIB_CRYPTO=-lcrypto 63 [LIB_CRYPTO=-lcrypto
64 AC_DEFINE([HAVE_OPENSSL_$1], [1], 64 AC_DEFINE([HAVE_OPENSSL_$1], [1],
65 [Define to 1 if libcrypto is used for $1.])])]) 65 [Define to 1 if libcrypto is used for $1.])])],
66 [AC_CHECK_LIB([crypto], [$1],
67 [AC_CHECK_HEADERS(
68 m4_if([$1], [MD5], [openssl/md5.h], [openssl/sha.h]),
69 [LIB_CRYPTO=-lcrypto
70 AC_DEFINE([HAVE_OPENSSL_$1], [1],
71 [Define to 1 if libcrypto is used for $1.])])])])
66 fi 72 fi
67 if test "x$LIB_CRYPTO" = x; then 73 if test "x$LIB_CRYPTO" = x; then
68 message='openssl development library not found for $1. 74 message='openssl development library not found for $1.
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index fcf84226..1b964b34 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-2026 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..26eef771 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 115
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 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/PR108796>, 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,12 +413,20 @@ 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 a call, or omit a duplicate call
206 This attribute is safe for a function that neither depends on nor affects 418 and reuse a cached return value, even if the state changes between calls.
207 observable state, and always returns exactly once - e.g., does not loop 419 It is also OK to omit a call if the result is not used.
208 forever, and does not call longjmp. 420 This attribute is safe if the function does not change observable state,
209 (This attribute is stricter than _GL_ATTRIBUTE_PURE.) */ 421 returns a value determined solely by its arguments' values
422 without examining state, and always returns exactly once -
423 e.g., does not raise an exception, call longjmp, or loop forever.
424 (This attribute is stricter than _GL_ATTRIBUTE_PURE because the
425 function cannot observe state. Unlike _GL_ATTRIBUTE_UNSEQUENCED
426 the function must return exactly once and cannot access state
427 addressed by its pointer arguments or that happens to have the same
428 value for all calls to the function, but the function is allowed to
429 return a pointer to storage that can be modified later. */
210/* Applies to: functions. */ 430/* Applies to: functions. */
211#ifndef _GL_ATTRIBUTE_CONST 431#ifndef _GL_ATTRIBUTE_CONST
212# if _GL_HAS_ATTRIBUTE (const) 432# if _GL_HAS_ATTRIBUTE (const)
@@ -234,7 +454,7 @@ AC_DEFUN([gl_COMMON_BODY], [
234 yet. */ 454 yet. */
235#ifndef _GL_ATTRIBUTE_DEALLOC_FREE 455#ifndef _GL_ATTRIBUTE_DEALLOC_FREE
236# if defined __cplusplus && defined __GNUC__ && !defined __clang__ 456# if defined __cplusplus && defined __GNUC__ && !defined __clang__
237/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108231> */ 457/* Work around GCC bug <https://gcc.gnu.org/PR108231> */
238# define _GL_ATTRIBUTE_DEALLOC_FREE \ 458# define _GL_ATTRIBUTE_DEALLOC_FREE \
239 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) 459 _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1)
240# else 460# else
@@ -373,7 +593,9 @@ AC_DEFUN([gl_COMMON_BODY], [
373 593
374/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if 594/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
375 the entity is not used. The compiler should not warn if the entity is not 595 the entity is not used. The compiler should not warn if the entity is not
376 used. */ 596 used. However, 'int _GL_UNNAMED (i)' is preferable to
597 '_GL_ATTRIBUTE_MAYBE_UNUSED int i' when parameter I is unused
598 regardless of preprocessor macro settings. */
377/* Applies to: 599/* Applies to:
378 - function, variable, 600 - function, variable,
379 - struct, union, struct/union member, 601 - struct, union, struct/union member,
@@ -460,6 +682,17 @@ AC_DEFUN([gl_COMMON_BODY], [
460# endif 682# endif
461#endif 683#endif
462 684
685/* _GL_ATTRIBUTE_NONNULL_IF_NONZERO (NP, NI) declares that the argument NP
686 (a pointer) must not be NULL if the argument NI (an integer) is != 0. */
687/* Applies to: functions. */
688#ifndef _GL_ATTRIBUTE_NONNULL_IF_NONZERO
689# if _GL_HAS_ATTRIBUTE (nonnull_if_nonzero)
690# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni) __attribute__ ((__nonnull_if_nonzero__ (np, ni)))
691# else
692# define _GL_ATTRIBUTE_NONNULL_IF_NONZERO(np, ni)
693# endif
694#endif
695
463/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is 696/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
464 not meant to be NUL-terminated. */ 697 not meant to be NUL-terminated. */
465/* Applies to: struct/union members and variables that are arrays of element 698/* Applies to: struct/union members and variables that are arrays of element
@@ -481,7 +714,7 @@ AC_DEFUN([gl_COMMON_BODY], [
481 other attributes. */ 714 other attributes. */
482#ifndef _GL_ATTRIBUTE_NOTHROW 715#ifndef _GL_ATTRIBUTE_NOTHROW
483# if defined __cplusplus 716# if defined __cplusplus
484# if _GL_GNUC_PREREQ (2, 8) || __clang_major >= 4 717# if _GL_GNUC_PREREQ (2, 8) || __clang_major__ >= 4
485# if __cplusplus >= 201103L 718# if __cplusplus >= 201103L
486# define _GL_ATTRIBUTE_NOTHROW noexcept (true) 719# define _GL_ATTRIBUTE_NOTHROW noexcept (true)
487# else 720# else
@@ -505,9 +738,9 @@ AC_DEFUN([gl_COMMON_BODY], [
505 minimizing the memory required. */ 738 minimizing the memory required. */
506/* Applies to: struct members, struct, union, 739/* Applies to: struct members, struct, union,
507 in C++ also: class. */ 740 in C++ also: class. */
741#ifndef _GL_ATTRIBUTE_PACKED
508/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite 742/* Oracle Studio 12.6 miscompiles code with __attribute__ ((__packed__)) despite
509 __has_attribute OK. */ 743 __has_attribute OK. */
510#ifndef _GL_ATTRIBUTE_PACKED
511# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C 744# if _GL_HAS_ATTRIBUTE (packed) && !defined __SUNPRO_C
512# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) 745# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
513# else 746# else
@@ -515,12 +748,18 @@ AC_DEFUN([gl_COMMON_BODY], [
515# endif 748# endif
516#endif 749#endif
517 750
518/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate 751/* _GL_ATTRIBUTE_PURE declares:
519 calls to the function with the same arguments if observable state is not 752 It is OK for a compiler to move a call, or omit a duplicate call
520 changed between calls. 753 and reuse a cached return value, if observable state is the same.
521 This attribute is safe for a function that does not affect 754 It is also OK to omit a call if the return value is not used.
522 observable state, and always returns exactly once. 755 This attribute is safe if the function does not change observable state,
523 (This attribute is looser than _GL_ATTRIBUTE_CONST.) */ 756 returns a value determined solely by its arguments's values
757 together with observable state, and always returns exactly once.
758 (This attribute is looser than _GL_ATTRIBUTE_CONST because the function
759 can depend on observable state.
760 Unlike _GL_ATTRIBUTE_REPRODUCIBLE the function must return exactly
761 once and cannot change state addressed by its arguments, but the
762 function can return a pointer to storage whose contents change later.) */
524/* Applies to: functions. */ 763/* Applies to: functions. */
525#ifndef _GL_ATTRIBUTE_PURE 764#ifndef _GL_ATTRIBUTE_PURE
526# if _GL_HAS_ATTRIBUTE (pure) 765# if _GL_HAS_ATTRIBUTE (pure)
@@ -530,6 +769,34 @@ AC_DEFUN([gl_COMMON_BODY], [
530# endif 769# endif
531#endif 770#endif
532 771
772/* _GL_ATTRIBUTE_REPRODUCIBLE declares:
773 It is OK for a compiler to move a call, or omit a duplicate call
774 and reuse a cached value returned either directly or indirectly via
775 a pointer, if other observable state is the same;
776 however, pointer arguments cannot alias.
777 This attribute is safe for a function that is effectless and idempotent;
778 see ISO C 23 § 6.7.13.8 for a definition of these terms.
779 (This attribute is looser than _GL_ATTRIBUTE_UNSEQUENCED because
780 the function need not be stateless or independent.
781 Unlike _GL_ATTRIBUTE_PURE the function need not return exactly once
782 and can change state addressed by its pointer arguments, but the
783 function cannot return a pointer to storage whose contents change later.)
784 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
785 <https://stackoverflow.com/questions/76847905/>. */
786/* Applies to: functions, pointer to functions, function types. */
787#ifndef _GL_ATTRIBUTE_REPRODUCIBLE
788/* This may be revisited when gcc and clang support [[reproducible]] or possibly
789 __attribute__ ((__reproducible__)). */
790# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
791# if _GL_HAS_ATTRIBUTE (reproducible)
792# define _GL_ATTRIBUTE_REPRODUCIBLE [[reproducible]]
793# endif
794# endif
795# ifndef _GL_ATTRIBUTE_REPRODUCIBLE
796# define _GL_ATTRIBUTE_REPRODUCIBLE
797# endif
798#endif
799
533/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is 800/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
534 a non-NULL pointer. */ 801 a non-NULL pointer. */
535/* Applies to: functions. */ 802/* Applies to: functions. */
@@ -554,6 +821,37 @@ AC_DEFUN([gl_COMMON_BODY], [
554# endif 821# endif
555#endif 822#endif
556 823
824/* _GL_ATTRIBUTE_UNSEQUENCED declares:
825 It is OK for a compiler to move a call, or omit a duplicate call
826 and reuse a cached value returned either directly or indirectly via
827 a pointer, if the state addressed by its pointer arguments is the same;
828 however, pointer arguments cannot alias.
829 This attribute is safe for a function that is effectless, idempotent,
830 stateless, and independent; see ISO C 23 § 6.7.13.8 for a definition of
831 these terms.
832 (This attribute is stricter than _GL_ATTRIBUTE_REPRODUCIBLE because
833 the function must be stateless and independent. Unlike
834 _GL_ATTRIBUTE_CONST the function need not return exactly once, and
835 can depend on state accessed via its pointer arguments or that
836 happens to have the same value for all calls to the function, but
837 the function cannot return a pointer to storage whose contents
838 change later.)
839 See also <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2956.htm> and
840 <https://stackoverflow.com/questions/76847905/>. */
841/* Applies to: functions, pointer to functions, function types. */
842#ifndef _GL_ATTRIBUTE_UNSEQUENCED
843/* This may be revisited when gcc and clang support [[unsequenced]] or possibly
844 __attribute__ ((__unsequenced__)). */
845# ifndef _GL_BRACKET_BEFORE_ATTRIBUTE
846# if _GL_HAS_ATTRIBUTE (unsequenced)
847# define _GL_ATTRIBUTE_UNSEQUENCED [[unsequenced]]
848# endif
849# endif
850# ifndef _GL_ATTRIBUTE_UNSEQUENCED
851# define _GL_ATTRIBUTE_UNSEQUENCED
852# endif
853#endif
854
557/* A helper macro. Don't use it directly. */ 855/* A helper macro. Don't use it directly. */
558#ifndef _GL_ATTRIBUTE_UNUSED 856#ifndef _GL_ATTRIBUTE_UNUSED
559# if _GL_HAS_ATTRIBUTE (unused) 857# if _GL_HAS_ATTRIBUTE (unused)
@@ -578,6 +876,50 @@ AC_DEFUN([gl_COMMON_BODY], [
578# define _GL_UNUSED_LABEL 876# define _GL_UNUSED_LABEL
579# endif 877# endif
580#endif 878#endif
879
880/* _GL_UNNAMED (ID) is the "name" of an unnamed function parameter.
881 Each of the function's unnamed parameters should have a unique "name".
882 The "name" cannot be used. This ports both to C17 and earlier, which
883 lack unnamed parameters, and to C++ and later C, which have them. */
884/* Applies to:
885 - function parameters. */
886#ifndef _GL_UNNAMED
887# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \
888 && !defined __cplusplus)
889# define _GL_UNNAMED(id) unnamed_##id _GL_ATTRIBUTE_UNUSED
890# else
891# define _GL_UNNAMED(id)
892# endif
893#endif
894
895/* The following attributes enable detection of multithread-safety problems
896 and resource leaks at compile-time, by clang ≥ 15, when the warning option
897 -Wthread-safety is enabled. For usage, see
898 <https://clang.llvm.org/docs/ThreadSafetyAnalysis.html>. */
899#ifndef _GL_ATTRIBUTE_CAPABILITY_TYPE
900# if __clang_major__ >= 15
901# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept) \
902 __attribute__ ((__capability__ (concept)))
903# else
904# define _GL_ATTRIBUTE_CAPABILITY_TYPE(concept)
905# endif
906#endif
907#ifndef _GL_ATTRIBUTE_ACQUIRE_CAPABILITY
908# if __clang_major__ >= 15
909# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource) \
910 __attribute__ ((__acquire_capability__ (resource)))
911# else
912# define _GL_ATTRIBUTE_ACQUIRE_CAPABILITY(resource)
913# endif
914#endif
915#ifndef _GL_ATTRIBUTE_RELEASE_CAPABILITY
916# if __clang_major__ >= 15
917# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource) \
918 __attribute__ ((__release_capability__ (resource)))
919# else
920# define _GL_ATTRIBUTE_RELEASE_CAPABILITY(resource)
921# endif
922#endif
581]) 923])
582 AH_VERBATIM([c_linkage], 924 AH_VERBATIM([c_linkage],
583[/* In C++, there is the concept of "language linkage", that encompasses 925[/* In C++, there is the concept of "language linkage", that encompasses
@@ -628,8 +970,8 @@ AC_DEFUN([gl_COMMON_BODY], [
628 -1 if n1 < n2 970 -1 if n1 < n2
629 The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional 971 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. 972 jump with nearly all GCC versions up to GCC 10.
631 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many 973 This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
632 GCC versions up to GCC 9. 974 many GCC versions up to GCC 9.
633 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 975 The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
634 avoids conditional jumps in all GCC versions >= 3.4. */ 976 avoids conditional jumps in all GCC versions >= 3.4. */
635#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) 977#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1006,7 +1348,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1006 AC_REQUIRE([AC_PROG_CC]) 1348 AC_REQUIRE([AC_PROG_CC])
1007 AC_CACHE_CHECK([for C compiler option to allow warnings], 1349 AC_CACHE_CHECK([for C compiler option to allow warnings],
1008 [gl_cv_cc_wallow], 1350 [gl_cv_cc_wallow],
1009 [rm -f conftest* 1351 [rm -fr conftest*
1010 echo 'int dummy;' > conftest.c 1352 echo 'int dummy;' > conftest.c
1011 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null 1353 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 1354 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
@@ -1019,7 +1361,7 @@ AC_DEFUN([gl_CC_ALLOW_WARNINGS],
1019 else 1361 else
1020 gl_cv_cc_wallow=none 1362 gl_cv_cc_wallow=none
1021 fi 1363 fi
1022 rm -f conftest* 1364 rm -fr conftest*
1023 ]) 1365 ])
1024 case "$gl_cv_cc_wallow" in 1366 case "$gl_cv_cc_wallow" in
1025 none) GL_CFLAG_ALLOW_WARNINGS='' ;; 1367 none) GL_CFLAG_ALLOW_WARNINGS='' ;;
@@ -1037,7 +1379,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1037 if test -n "$CXX" && test "$CXX" != no; then 1379 if test -n "$CXX" && test "$CXX" != no; then
1038 AC_CACHE_CHECK([for C++ compiler option to allow warnings], 1380 AC_CACHE_CHECK([for C++ compiler option to allow warnings],
1039 [gl_cv_cxx_wallow], 1381 [gl_cv_cxx_wallow],
1040 [rm -f conftest* 1382 [rm -fr conftest*
1041 echo 'int dummy;' > conftest.cc 1383 echo 'int dummy;' > conftest.cc
1042 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null 1384 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 1385 AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
@@ -1050,7 +1392,7 @@ AC_DEFUN([gl_CXX_ALLOW_WARNINGS],
1050 else 1392 else
1051 gl_cv_cxx_wallow=none 1393 gl_cv_cxx_wallow=none
1052 fi 1394 fi
1053 rm -f conftest* 1395 rm -fr conftest*
1054 ]) 1396 ])
1055 case "$gl_cv_cxx_wallow" in 1397 case "$gl_cv_cxx_wallow" in
1056 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; 1398 none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
@@ -1087,11 +1429,12 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1087 dnl -Wno-type-limits >= 4.3 >= 3.9 1429 dnl -Wno-type-limits >= 4.3 >= 3.9
1088 dnl -Wno-undef >= 3 >= 3.9 1430 dnl -Wno-undef >= 3 >= 3.9
1089 dnl -Wno-unsuffixed-float-constants >= 4.5 1431 dnl -Wno-unsuffixed-float-constants >= 4.5
1432 dnl -Wno-unused-const-variable >= 6.1 >= 3.9
1090 dnl -Wno-unused-function >= 3 >= 3.9 1433 dnl -Wno-unused-function >= 3 >= 3.9
1091 dnl -Wno-unused-parameter >= 3 >= 3.9 1434 dnl -Wno-unused-parameter >= 3 >= 3.9
1092 dnl 1435 dnl
1093 cat > conftest.c <<\EOF 1436 cat > conftest.c <<\EOF
1094 #if __GNUC__ >= 3 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1437 #if (__GNUC__ >= 3 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1095 -Wno-cast-qual 1438 -Wno-cast-qual
1096 -Wno-conversion 1439 -Wno-conversion
1097 -Wno-float-equal 1440 -Wno-float-equal
@@ -1100,23 +1443,26 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
1100 -Wno-unused-function 1443 -Wno-unused-function
1101 -Wno-unused-parameter 1444 -Wno-unused-parameter
1102 #endif 1445 #endif
1103 #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1446 #if (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1104 -Wno-float-conversion 1447 -Wno-float-conversion
1105 #endif 1448 #endif
1106 #if __GNUC__ >= 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1449 #if (__GNUC__ >= 7 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1107 -Wimplicit-fallthrough 1450 -Wimplicit-fallthrough
1108 #endif 1451 #endif
1109 #if __GNUC__ + (__GNUC_MINOR__ >= 8) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1452 #if (__GNUC__ + (__GNUC_MINOR__ >= 8) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1110 -Wno-pedantic 1453 -Wno-pedantic
1111 #endif 1454 #endif
1112 #if 3 < __clang_major__ + (9 <= __clang_minor__) 1455 #if 3 < __clang_major__ + (9 <= __clang_minor__)
1113 -Wno-tautological-constant-out-of-range-compare 1456 -Wno-tautological-constant-out-of-range-compare
1114 #endif 1457 #endif
1115 #if __GNUC__ + (__GNUC_MINOR__ >= 3) > 4 || (__clang_major__ + (__clang_minor__ >= 9) > 3) 1458 #if (__GNUC__ + (__GNUC_MINOR__ >= 3) > 4 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1116 -Wno-sign-conversion 1459 -Wno-sign-conversion
1117 -Wno-type-limits 1460 -Wno-type-limits
1118 #endif 1461 #endif
1119 #if __GNUC__ + (__GNUC_MINOR__ >= 5) > 4 1462 #if (__GNUC__ + (__GNUC_MINOR__ >= 1) > 6 && !defined __clang__) || (__clang_major__ + (__clang_minor__ >= 9) > 3)
1463 -Wno-unused-const-variable
1464 #endif
1465 #if (__GNUC__ + (__GNUC_MINOR__ >= 5) > 4 && !defined __clang__)
1120 -Wno-unsuffixed-float-constants 1466 -Wno-unsuffixed-float-constants
1121 #endif 1467 #endif
1122EOF 1468EOF
@@ -1240,13 +1586,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1240 if test $[ac_cv_func_][$1] = yes; then 1586 if test $[ac_cv_func_][$1] = yes; then
1241 [gl_cv_onwards_func_][$1]=yes 1587 [gl_cv_onwards_func_][$1]=yes
1242 else 1588 else
1589 dnl This is a bit complicated, because here we need the behaviour
1590 dnl of AC_CHECK_DECL before the
1591 dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
1592 [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
1243 unset [ac_cv_have_decl_][$1] 1593 unset [ac_cv_have_decl_][$1]
1594 ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
1595 ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
1596 ac_c_future_darwin_options=
1597 ac_cxx_future_darwin_options=
1244 AC_CHECK_DECL([$1], , , [$2]) 1598 AC_CHECK_DECL([$1], , , [$2])
1599 ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
1600 ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
1245 if test $[ac_cv_have_decl_][$1] = yes; then 1601 if test $[ac_cv_have_decl_][$1] = yes; then
1246 [gl_cv_onwards_func_][$1]='future OS version' 1602 [gl_cv_onwards_func_][$1]='future OS version'
1247 else 1603 else
1248 [gl_cv_onwards_func_][$1]=no 1604 [gl_cv_onwards_func_][$1]=no
1249 fi 1605 fi
1606 [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
1607 unset [ac_cv_have_decl_][$1][_saved]
1250 fi 1608 fi
1251 else 1609 else
1252 AC_CHECK_FUNC([$1]) 1610 AC_CHECK_FUNC([$1])
@@ -1299,7 +1657,7 @@ dnl
1299dnl This macro sets two variables: 1657dnl This macro sets two variables:
1300dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1658dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1301dnl - ac_cv_func_<func> to yes / no / no 1659dnl - ac_cv_func_<func> to yes / no / no
1302dnl The first variable allows to distinguish all three cases. 1660dnl The first variable allows distinguishing all three cases.
1303dnl The second variable is set, so that an invocation 1661dnl The second variable is set, so that an invocation
1304dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1662dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1305dnl can be used as a drop-in replacement for 1663dnl can be used as a drop-in replacement for
@@ -1352,7 +1710,7 @@ dnl
1352dnl This macro sets two variables: 1710dnl This macro sets two variables:
1353dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version" 1711dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1354dnl - ac_cv_func_<func> to yes / no / no 1712dnl - ac_cv_func_<func> to yes / no / no
1355dnl The first variable allows to distinguish all three cases. 1713dnl The first variable allows distinguishing all three cases.
1356dnl The second variable is set, so that an invocation 1714dnl The second variable is set, so that an invocation
1357dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]]) 1715dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1358dnl can be used as a drop-in replacement for 1716dnl 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..cdd46759 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-2026 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,58 @@ 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 stdio-windows:
213 # Code from module stdlib-h:
182 # Code from module strcase: 214 # Code from module strcase:
215 # Code from module strcasecmp:
183 # Code from module strcasestr: 216 # Code from module strcasestr:
184 # Code from module strcasestr-simple: 217 # Code from module strcasestr-simple:
185 # Code from module streq: 218 # Code from module streq:
186 # Code from module strerror: 219 # Code from module strerror:
187 # Code from module strerror-override: 220 # Code from module strerror-override:
188 # Code from module string: 221 # Code from module string-h:
189 # Code from module strings: 222 # Code from module stringeq:
223 # Code from module strings-h:
224 # Code from module strncasecmp:
225 # Code from module strncpy:
190 # Code from module strsep: 226 # Code from module strsep:
191 # Code from module strstr-simple: 227 # Code from module strstr-simple:
192 # Code from module sys_socket: 228 # Code from module sys_socket-h:
193 # Code from module sys_stat: 229 # Code from module sys_stat-h:
194 # Code from module sys_types: 230 # Code from module sys_types-h:
195 # Code from module sys_uio: 231 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
232 # Code from module sys_uio-h:
196 # Code from module threadlib: 233 # Code from module threadlib:
197 gl_THREADLIB_EARLY 234 gl_THREADLIB_EARLY
198 # Code from module time-h: 235 # Code from module time-h:
199 # Code from module time_r: 236 # Code from module time_r:
200 # Code from module timegm: 237 # Code from module timegm:
201 # Code from module unistd: 238 # Code from module uchar-h:
239 # Code from module unicase/base:
240 # Code from module unicase/tolower:
241 # Code from module unictype/base:
242 # Code from module unictype/ctype-alnum:
243 # Code from module unictype/ctype-alpha:
244 # Code from module unictype/ctype-blank:
245 # Code from module unictype/ctype-cntrl:
246 # Code from module unictype/ctype-digit:
247 # Code from module unictype/ctype-graph:
248 # Code from module unictype/ctype-lower:
249 # Code from module unictype/ctype-print:
250 # Code from module unictype/ctype-punct:
251 # Code from module unictype/ctype-space:
252 # Code from module unictype/ctype-upper:
253 # Code from module unictype/ctype-xdigit:
254 # Code from module uninorm/base:
255 # Code from module unistd-h:
256 # Code from module unitypes-h:
257 # Code from module uniwidth/base:
258 # Code from module uniwidth/width:
202 # Code from module unlocked-io-internal: 259 # Code from module unlocked-io-internal:
203 # Code from module unsetenv: 260 # Code from module unsetenv:
204 # Code from module vararrays: 261 # Code from module vararrays:
@@ -206,10 +263,12 @@ AC_DEFUN([gl_EARLY],
206 # Code from module vasprintf: 263 # Code from module vasprintf:
207 # Code from module verify: 264 # Code from module verify:
208 # Code from module vsnprintf: 265 # Code from module vsnprintf:
209 # Code from module wchar: 266 # Code from module vsnzprintf:
267 # Code from module wchar-h:
210 # Code from module wcrtomb: 268 # Code from module wcrtomb:
211 # Code from module wctype: 269 # Code from module wctype:
212 # Code from module wctype-h: 270 # Code from module wctype-h:
271 # Code from module wcwidth:
213 # Code from module windows-mutex: 272 # Code from module windows-mutex:
214 # Code from module windows-once: 273 # Code from module windows-once:
215 # Code from module windows-recmutex: 274 # Code from module windows-recmutex:
@@ -250,6 +309,7 @@ AC_DEFUN([gl_INIT],
250 gl_CONDITIONAL_HEADER([assert.h]) 309 gl_CONDITIONAL_HEADER([assert.h])
251 AC_PROG_MKDIR_P 310 AC_PROG_MKDIR_P
252 gl_FUNC_BASE64 311 gl_FUNC_BASE64
312 gl_C_BOOL
253 gl_FUNC_BTOWC 313 gl_FUNC_BTOWC
254 gl_CONDITIONAL([GL_COND_OBJ_BTOWC], 314 gl_CONDITIONAL([GL_COND_OBJ_BTOWC],
255 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1]) 315 [test $HAVE_BTOWC = 0 || test $REPLACE_BTOWC = 1])
@@ -261,6 +321,104 @@ AC_DEFUN([gl_INIT],
261 gl_BYTESWAP 321 gl_BYTESWAP
262 gl_CONDITIONAL_HEADER([byteswap.h]) 322 gl_CONDITIONAL_HEADER([byteswap.h])
263 AC_PROG_MKDIR_P 323 AC_PROG_MKDIR_P
324 AC_REQUIRE([gl_UCHAR_H])
325 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
326 dnl determined. It describes how mbrtoc32 is implemented.
327 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
328 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
329 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
330 gl_UCHAR_MODULE_INDICATOR([c32isalnum])
331 AC_REQUIRE([gl_UCHAR_H])
332 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
333 dnl determined. It describes how mbrtoc32 is implemented.
334 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
335 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
336 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
337 gl_UCHAR_MODULE_INDICATOR([c32isalpha])
338 AC_REQUIRE([gl_UCHAR_H])
339 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
340 dnl determined. It describes how mbrtoc32 is implemented.
341 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
342 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
343 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
344 gl_UCHAR_MODULE_INDICATOR([c32isblank])
345 AC_REQUIRE([gl_UCHAR_H])
346 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
347 dnl determined. It describes how mbrtoc32 is implemented.
348 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
349 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
350 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
351 gl_UCHAR_MODULE_INDICATOR([c32iscntrl])
352 AC_REQUIRE([gl_UCHAR_H])
353 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
354 dnl determined. It describes how mbrtoc32 is implemented.
355 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
356 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
357 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
358 gl_UCHAR_MODULE_INDICATOR([c32isdigit])
359 AC_REQUIRE([gl_UCHAR_H])
360 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
361 dnl determined. It describes how mbrtoc32 is implemented.
362 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
363 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
364 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
365 gl_UCHAR_MODULE_INDICATOR([c32isgraph])
366 AC_REQUIRE([gl_UCHAR_H])
367 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
368 dnl determined. It describes how mbrtoc32 is implemented.
369 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
370 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
371 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
372 gl_UCHAR_MODULE_INDICATOR([c32islower])
373 AC_REQUIRE([gl_UCHAR_H])
374 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
375 dnl determined. It describes how mbrtoc32 is implemented.
376 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
377 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
378 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
379 gl_UCHAR_MODULE_INDICATOR([c32isprint])
380 AC_REQUIRE([gl_UCHAR_H])
381 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
382 dnl determined. It describes how mbrtoc32 is implemented.
383 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
384 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
385 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
386 gl_UCHAR_MODULE_INDICATOR([c32ispunct])
387 AC_REQUIRE([gl_UCHAR_H])
388 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
389 dnl determined. It describes how mbrtoc32 is implemented.
390 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
391 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
392 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
393 gl_UCHAR_MODULE_INDICATOR([c32isspace])
394 AC_REQUIRE([gl_UCHAR_H])
395 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
396 dnl determined. It describes how mbrtoc32 is implemented.
397 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
398 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
399 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
400 gl_UCHAR_MODULE_INDICATOR([c32isupper])
401 AC_REQUIRE([gl_UCHAR_H])
402 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
403 dnl determined. It describes how mbrtoc32 is implemented.
404 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
405 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
406 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
407 gl_UCHAR_MODULE_INDICATOR([c32isxdigit])
408 AC_REQUIRE([gl_UCHAR_H])
409 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
410 dnl determined. It describes how mbrtoc32 is implemented.
411 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
412 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
413 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
414 gl_UCHAR_MODULE_INDICATOR([c32tolower])
415 AC_REQUIRE([gl_UCHAR_H])
416 dnl Determine REPLACE_MBSTATE_T, from which GNULIB_defined_mbstate_t is
417 dnl determined. It describes how mbrtoc32 is implemented.
418 AC_REQUIRE([gl_MBSTATE_T_BROKEN])
419 AC_REQUIRE([gl_MBRTOC32_SANITYCHECK])
420 AC_REQUIRE([gl_C32RTOMB_SANITYCHECK])
421 gl_UCHAR_MODULE_INDICATOR([c32width])
264 gl_FUNC_CALLOC_GNU 422 gl_FUNC_CALLOC_GNU
265 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then 423 if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1; then
266 AC_LIBOBJ([calloc]) 424 AC_LIBOBJ([calloc])
@@ -275,6 +433,7 @@ AC_DEFUN([gl_INIT],
275 gl_FUNC_CLOSE 433 gl_FUNC_CLOSE
276 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1]) 434 gl_CONDITIONAL([GL_COND_OBJ_CLOSE], [test $REPLACE_CLOSE = 1])
277 gl_UNISTD_MODULE_INDICATOR([close]) 435 gl_UNISTD_MODULE_INDICATOR([close])
436 gl_MODULE_INDICATOR([close])
278 gl_AF_ALG 437 gl_AF_ALG
279 AC_REQUIRE([AC_C_RESTRICT]) 438 AC_REQUIRE([AC_C_RESTRICT])
280 gl_SHA256 439 gl_SHA256
@@ -320,8 +479,11 @@ AC_DEFUN([gl_INIT],
320 gl_FLOAT_H 479 gl_FLOAT_H
321 gl_CONDITIONAL_HEADER([float.h]) 480 gl_CONDITIONAL_HEADER([float.h])
322 AC_PROG_MKDIR_P 481 AC_PROG_MKDIR_P
323 gl_CONDITIONAL([GL_COND_OBJ_FLOAT], [test $REPLACE_FLOAT_LDBL = 1]) 482 gl_CONDITIONAL([GL_COND_OBJ_FLOAT],
483 [test $REPLACE_FLOAT_LDBL = 1 || test $REPLACE_FLOAT_SNAN = 1])
324 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1]) 484 gl_CONDITIONAL([GL_COND_OBJ_ITOLD], [test $REPLACE_ITOLD = 1])
485 dnl Prerequisites of lib/float.c.
486 AC_REQUIRE([gl_BIGENDIAN])
325 gl_FUNC_FLOORF 487 gl_FUNC_FLOORF
326 gl_CONDITIONAL([GL_COND_OBJ_FLOORF], 488 gl_CONDITIONAL([GL_COND_OBJ_FLOORF],
327 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1]) 489 [test $HAVE_DECL_FLOORF = 0 || test $REPLACE_FLOORF = 1])
@@ -360,6 +522,8 @@ AC_DEFUN([gl_INIT],
360 gl_PREREQ_FSEEKO 522 gl_PREREQ_FSEEKO
361 ]) 523 ])
362 gl_STDIO_MODULE_INDICATOR([fseeko]) 524 gl_STDIO_MODULE_INDICATOR([fseeko])
525 gl_FUNC_FSETERR
526 gl_CONDITIONAL([GL_COND_OBJ_FSETERR], [test $ac_cv_func___fseterr = no])
363 gl_FUNC_FSTAT 527 gl_FUNC_FSTAT
364 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1]) 528 gl_CONDITIONAL([GL_COND_OBJ_FSTAT], [test $REPLACE_FSTAT = 1])
365 AM_COND_IF([GL_COND_OBJ_FSTAT], [ 529 AM_COND_IF([GL_COND_OBJ_FSTAT], [
@@ -371,6 +535,7 @@ AC_DEFUN([gl_INIT],
371 gl_PREREQ_FSTAT 535 gl_PREREQ_FSTAT
372 ]) 536 ])
373 gl_SYS_STAT_MODULE_INDICATOR([fstat]) 537 gl_SYS_STAT_MODULE_INDICATOR([fstat])
538 gl_MODULE_INDICATOR([fstat])
374 gl_FSUSAGE 539 gl_FSUSAGE
375 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes]) 540 gl_CONDITIONAL([GL_COND_OBJ_FSUSAGE], [test $gl_cv_fs_space = yes])
376 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [ 541 AM_COND_IF([GL_COND_OBJ_FSUSAGE], [
@@ -407,11 +572,13 @@ AC_DEFUN([gl_INIT],
407 ]) 572 ])
408 gl_UNISTD_MODULE_INDICATOR([getdtablesize]) 573 gl_UNISTD_MODULE_INDICATOR([getdtablesize])
409 gl_FUNC_GETHOSTNAME 574 gl_FUNC_GETHOSTNAME
410 gl_CONDITIONAL([GL_COND_OBJ_GETHOSTNAME], [test $HAVE_GETHOSTNAME = 0]) 575 gl_CONDITIONAL([GL_COND_OBJ_GETHOSTNAME],
576 [test $HAVE_GETHOSTNAME = 0 || test $UNISTD_H_HAVE_WINSOCK2_H = 1])
411 AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [ 577 AM_COND_IF([GL_COND_OBJ_GETHOSTNAME], [
412 gl_PREREQ_GETHOSTNAME 578 gl_PREREQ_GETHOSTNAME
413 ]) 579 ])
414 gl_UNISTD_MODULE_INDICATOR([gethostname]) 580 gl_UNISTD_MODULE_INDICATOR([gethostname])
581 gl_MODULE_INDICATOR([gethostname])
415 gl_FUNC_GETLINE 582 gl_FUNC_GETLINE
416 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1]) 583 gl_CONDITIONAL([GL_COND_OBJ_GETLINE], [test $REPLACE_GETLINE = 1])
417 AM_COND_IF([GL_COND_OBJ_GETLINE], [ 584 AM_COND_IF([GL_COND_OBJ_GETLINE], [
@@ -441,6 +608,8 @@ AC_DEFUN([gl_INIT],
441 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1]) 608 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_GETOPT], [1])
442 ]) 609 ])
443 gl_UNISTD_MODULE_INDICATOR([getopt-posix]) 610 gl_UNISTD_MODULE_INDICATOR([getopt-posix])
611 gl_MUSL_LIBC
612 AC_REQUIRE([AC_CANONICAL_HOST])
444 gl_FUNC_GETPROGNAME 613 gl_FUNC_GETPROGNAME
445 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME], 614 gl_CONDITIONAL([GL_COND_OBJ_GETPROGNAME],
446 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1]) 615 [test $HAVE_GETPROGNAME = 0 || test $REPLACE_GETPROGNAME = 1])
@@ -448,9 +617,9 @@ AC_DEFUN([gl_INIT],
448 gl_PREREQ_GETPROGNAME 617 gl_PREREQ_GETPROGNAME
449 ]) 618 ])
450 gl_STDLIB_MODULE_INDICATOR([getprogname]) 619 gl_STDLIB_MODULE_INDICATOR([getprogname])
451 AC_SUBST([LIBINTL]) 620 gl_GETTEXT_H
452 AC_SUBST([LTLIBINTL])
453 AC_PROG_MKDIR_P 621 AC_PROG_MKDIR_P
622 GNULIB_I18N
454 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL]) 623 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
455 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB" 624 HARD_LOCALE_LIB="$SETLOCALE_NULL_LIB"
456 AC_SUBST([HARD_LOCALE_LIB]) 625 AC_SUBST([HARD_LOCALE_LIB])
@@ -466,6 +635,13 @@ AC_DEFUN([gl_INIT],
466 gl_PREREQ_INET_NTOP 635 gl_PREREQ_INET_NTOP
467 ]) 636 ])
468 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop]) 637 gl_ARPA_INET_MODULE_INDICATOR([inet_ntop])
638 gl_FUNC_INET_PTON
639 gl_CONDITIONAL([GL_COND_OBJ_INET_PTON],
640 [test $HAVE_INET_PTON = 0 || test $REPLACE_INET_PTON = 1])
641 AM_COND_IF([GL_COND_OBJ_INET_PTON], [
642 gl_PREREQ_INET_PTON
643 ])
644 gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
469 gl_INTTYPES_INCOMPLETE 645 gl_INTTYPES_INCOMPLETE
470 gl_INTTYPES_H_REQUIRE_DEFAULTS 646 gl_INTTYPES_H_REQUIRE_DEFAULTS
471 AC_PROG_MKDIR_P 647 AC_PROG_MKDIR_P
@@ -510,11 +686,19 @@ AC_DEFUN([gl_INIT],
510 gl_PREREQ_LOCALECONV 686 gl_PREREQ_LOCALECONV
511 ]) 687 ])
512 gl_LOCALE_MODULE_INDICATOR([localeconv]) 688 gl_LOCALE_MODULE_INDICATOR([localeconv])
689 gl_MODULE_INDICATOR([localeconv])
513 gl_LOCK 690 gl_LOCK
514 gl_MODULE_INDICATOR([lock]) 691 gl_MODULE_INDICATOR([lock])
515 gl_FUNC_LSEEK 692 gl_FUNC_LSEEK
516 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1]) 693 gl_CONDITIONAL([GL_COND_OBJ_LSEEK], [test $REPLACE_LSEEK = 1])
517 gl_UNISTD_MODULE_INDICATOR([lseek]) 694 gl_UNISTD_MODULE_INDICATOR([lseek])
695 gl_FUNC_LSTAT
696 gl_CONDITIONAL([GL_COND_OBJ_LSTAT], [test $REPLACE_LSTAT = 1])
697 AM_COND_IF([GL_COND_OBJ_LSTAT], [
698 gl_PREREQ_LSTAT
699 ])
700 gl_SYS_STAT_MODULE_INDICATOR([lstat])
701 gl_MODULE_INDICATOR([lstat])
518 gl_FUNC_MALLOC_GNU 702 gl_FUNC_MALLOC_GNU
519 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then 703 if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1; then
520 AC_LIBOBJ([malloc]) 704 AC_LIBOBJ([malloc])
@@ -529,6 +713,20 @@ AC_DEFUN([gl_INIT],
529 gl_MATH_H 713 gl_MATH_H
530 gl_MATH_H_REQUIRE_DEFAULTS 714 gl_MATH_H_REQUIRE_DEFAULTS
531 AC_PROG_MKDIR_P 715 AC_PROG_MKDIR_P
716 gl_MBCHAR
717 gl_MBITER
718 gl_FUNC_MBRTOC32
719 gl_CONDITIONAL([GL_COND_OBJ_MBRTOC32],
720 [test $HAVE_MBRTOC32 = 0 || test $REPLACE_MBRTOC32 = 1])
721 AM_COND_IF([GL_COND_OBJ_MBRTOC32], [
722 if test $REPLACE_MBSTATE_T = 1; then
723 AC_LIBOBJ([lc-charset-dispatch])
724 AC_LIBOBJ([mbtowc-lock])
725 gl_PREREQ_MBTOWC_LOCK
726 fi
727 gl_PREREQ_MBRTOC32
728 ])
729 gl_UCHAR_MODULE_INDICATOR([mbrtoc32])
532 gl_FUNC_MBRTOWC 730 gl_FUNC_MBRTOWC
533 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC], 731 gl_CONDITIONAL([GL_COND_OBJ_MBRTOWC],
534 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1]) 732 [test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1])
@@ -548,6 +746,7 @@ AC_DEFUN([gl_INIT],
548 gl_PREREQ_MBSINIT 746 gl_PREREQ_MBSINIT
549 ]) 747 ])
550 gl_WCHAR_MODULE_INDICATOR([mbsinit]) 748 gl_WCHAR_MODULE_INDICATOR([mbsinit])
749 gl_STRING_MODULE_INDICATOR([mbsnlen])
551 AC_REQUIRE([AC_TYPE_MBSTATE_T]) 750 AC_REQUIRE([AC_TYPE_MBSTATE_T])
552 gl_MBSTATE_T_BROKEN 751 gl_MBSTATE_T_BROKEN
553 gl_MUSL_LIBC 752 gl_MUSL_LIBC
@@ -578,10 +777,7 @@ AC_DEFUN([gl_INIT],
578 gl_PREREQ_MKTIME 777 gl_PREREQ_MKTIME
579 fi 778 fi
580 gl_MOUNTLIST 779 gl_MOUNTLIST
581 gl_CONDITIONAL([GL_COND_OBJ_MOUNTLIST], [test $gl_cv_list_mounted_fs = yes]) 780 gl_PREREQ_MOUNTLIST_EXTRA
582 AM_COND_IF([GL_COND_OBJ_MOUNTLIST], [
583 gl_PREREQ_MOUNTLIST_EXTRA
584 ])
585 AC_REQUIRE([gl_MSVC_INVAL]) 781 AC_REQUIRE([gl_MSVC_INVAL])
586 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL], 782 gl_CONDITIONAL([GL_COND_OBJ_MSVC_INVAL],
587 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1]) 783 [test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1])
@@ -605,6 +801,7 @@ AC_DEFUN([gl_INIT],
605 gl_PREREQ_NL_LANGINFO_LOCK 801 gl_PREREQ_NL_LANGINFO_LOCK
606 fi 802 fi
607 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo]) 803 gl_LANGINFO_MODULE_INDICATOR([nl_langinfo])
804 gl_ONCE
608 gl_FUNC_OPEN 805 gl_FUNC_OPEN
609 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1]) 806 gl_CONDITIONAL([GL_COND_OBJ_OPEN], [test $REPLACE_OPEN = 1])
610 AM_COND_IF([GL_COND_OBJ_OPEN], [ 807 AM_COND_IF([GL_COND_OBJ_OPEN], [
@@ -612,15 +809,17 @@ AC_DEFUN([gl_INIT],
612 ]) 809 ])
613 gl_FCNTL_MODULE_INDICATOR([open]) 810 gl_FCNTL_MODULE_INDICATOR([open])
614 gl_PATHMAX 811 gl_PATHMAX
615 gl_FUNC_REALLOC_GNU 812 gl_PTHREAD_H
616 if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1; then 813 gl_PTHREAD_H_REQUIRE_DEFAULTS
617 AC_LIBOBJ([realloc]) 814 AC_PROG_MKDIR_P
618 fi 815 gl_PTHREAD_ONCE
619 gl_STDLIB_MODULE_INDICATOR([realloc-gnu]) 816 gl_CONDITIONAL([GL_COND_OBJ_PTHREAD_ONCE],
817 [test $HAVE_PTHREAD_ONCE = 0 || test $REPLACE_PTHREAD_ONCE = 1])
818 gl_PTHREAD_MODULE_INDICATOR([pthread-once])
620 gl_FUNC_REALLOC_POSIX 819 gl_FUNC_REALLOC_POSIX
621 if test $REPLACE_REALLOC_FOR_REALLOC_POSIX = 1; then 820 gl_FUNC_REALLOC_0_NONNULL
622 AC_LIBOBJ([realloc]) 821 gl_CONDITIONAL([GL_COND_OBJ_REALLOC_POSIX],
623 fi 822 [test $REPLACE_REALLOC_FOR_REALLOC_POSIX != 0])
624 gl_STDLIB_MODULE_INDICATOR([realloc-posix]) 823 gl_STDLIB_MODULE_INDICATOR([realloc-posix])
625 gl_FUNC_REALLOCARRAY 824 gl_FUNC_REALLOCARRAY
626 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY], 825 gl_CONDITIONAL([GL_COND_OBJ_REALLOCARRAY],
@@ -635,6 +834,9 @@ AC_DEFUN([gl_INIT],
635 AM_COND_IF([GL_COND_OBJ_REGEX], [ 834 AM_COND_IF([GL_COND_OBJ_REGEX], [
636 gl_PREREQ_REGEX 835 gl_PREREQ_REGEX
637 ]) 836 ])
837 gl_SCHED_H
838 gl_SCHED_H_REQUIRE_DEFAULTS
839 AC_PROG_MKDIR_P
638 gl_SERVENT 840 gl_SERVENT
639 gl_FUNC_SETENV 841 gl_FUNC_SETENV
640 gl_CONDITIONAL([GL_COND_OBJ_SETENV], 842 gl_CONDITIONAL([GL_COND_OBJ_SETENV],
@@ -666,15 +868,10 @@ AC_DEFUN([gl_INIT],
666 gl_PREREQ_STAT 868 gl_PREREQ_STAT
667 ]) 869 ])
668 gl_SYS_STAT_MODULE_INDICATOR([stat]) 870 gl_SYS_STAT_MODULE_INDICATOR([stat])
871 gl_MODULE_INDICATOR([stat])
669 gl_STAT_TIME 872 gl_STAT_TIME
670 gl_STAT_BIRTHTIME 873 gl_STAT_BIRTHTIME
671 gl_C_BOOL 874 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]) 875 gl_CONDITIONAL_HEADER([stdckdint.h])
679 AC_PROG_MKDIR_P 876 AC_PROG_MKDIR_P
680 gl_STDDEF_H 877 gl_STDDEF_H
@@ -714,18 +911,30 @@ AC_DEFUN([gl_INIT],
714 gl_STDIO_MODULE_INDICATOR([fputs]) 911 gl_STDIO_MODULE_INDICATOR([fputs])
715 gl_STDIO_MODULE_INDICATOR([puts]) 912 gl_STDIO_MODULE_INDICATOR([puts])
716 gl_STDIO_MODULE_INDICATOR([fwrite]) 913 gl_STDIO_MODULE_INDICATOR([fwrite])
914 AC_REQUIRE([AC_CANONICAL_HOST])
915 USES_MSVCRT=0
916 case "$host_os" in
917 mingw* | windows*)
918 AC_EGREP_CPP([Special], [
919 #ifndef _UCRT
920 Special
921 #endif
922 ],
923 [USES_MSVCRT=1])
924 ;;
925 esac
926 gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
927 AC_CHECK_FUNCS([vasprintf])
717 gl_STDLIB_H 928 gl_STDLIB_H
718 gl_STDLIB_H_REQUIRE_DEFAULTS 929 gl_STDLIB_H_REQUIRE_DEFAULTS
719 AC_PROG_MKDIR_P 930 AC_PROG_MKDIR_P
720 gl_STRCASE 931 gl_FUNC_STRCASECMP
721 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP], [test $HAVE_STRCASECMP = 0]) 932 gl_CONDITIONAL([GL_COND_OBJ_STRCASECMP],
933 [test $HAVE_STRCASECMP = 0 || test $REPLACE_STRCASECMP = 1])
722 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [ 934 AM_COND_IF([GL_COND_OBJ_STRCASECMP], [
723 gl_PREREQ_STRCASECMP 935 gl_PREREQ_STRCASECMP
724 ]) 936 ])
725 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP], [test $HAVE_STRNCASECMP = 0]) 937 gl_STRINGS_MODULE_INDICATOR([strcasecmp])
726 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
727 gl_PREREQ_STRNCASECMP
728 ])
729 gl_FUNC_STRCASESTR 938 gl_FUNC_STRCASESTR
730 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then 939 if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then
731 AC_LIBOBJ([strcasestr]) 940 AC_LIBOBJ([strcasestr])
@@ -751,9 +960,25 @@ AC_DEFUN([gl_INIT],
751 gl_STRING_H 960 gl_STRING_H
752 gl_STRING_H_REQUIRE_DEFAULTS 961 gl_STRING_H_REQUIRE_DEFAULTS
753 AC_PROG_MKDIR_P 962 AC_PROG_MKDIR_P
963 gl_FUNC_STREQ
964 gl_FUNC_MEMEQ
965 gl_STRING_MODULE_INDICATOR([stringeq])
754 gl_STRINGS_H 966 gl_STRINGS_H
755 gl_STRINGS_H_REQUIRE_DEFAULTS 967 gl_STRINGS_H_REQUIRE_DEFAULTS
756 AC_PROG_MKDIR_P 968 AC_PROG_MKDIR_P
969 gl_FUNC_STRNCASECMP
970 gl_CONDITIONAL([GL_COND_OBJ_STRNCASECMP],
971 [test $HAVE_STRNCASECMP = 0 || test $REPLACE_STRNCASECMP = 1])
972 AM_COND_IF([GL_COND_OBJ_STRNCASECMP], [
973 gl_PREREQ_STRNCASECMP
974 ])
975 gl_STRINGS_MODULE_INDICATOR([strncasecmp])
976 gl_FUNC_STRNCPY
977 gl_CONDITIONAL([GL_COND_OBJ_STRNCPY], [test $REPLACE_STRNCPY = 1])
978 AM_COND_IF([GL_COND_OBJ_STRNCPY], [
979 gl_PREREQ_STRNCPY
980 ])
981 gl_STRING_MODULE_INDICATOR([strncpy])
757 gl_FUNC_STRSEP 982 gl_FUNC_STRSEP
758 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0]) 983 gl_CONDITIONAL([GL_COND_OBJ_STRSEP], [test $HAVE_STRSEP = 0])
759 AM_COND_IF([GL_COND_OBJ_STRSEP], [ 984 AM_COND_IF([GL_COND_OBJ_STRSEP], [
@@ -795,9 +1020,55 @@ AC_DEFUN([gl_INIT],
795 gl_PREREQ_TIMEGM 1020 gl_PREREQ_TIMEGM
796 ]) 1021 ])
797 gl_TIME_MODULE_INDICATOR([timegm]) 1022 gl_TIME_MODULE_INDICATOR([timegm])
1023 gl_UCHAR_H
1024 gl_UCHAR_H_REQUIRE_DEFAULTS
1025 AC_PROG_MKDIR_P
1026 gl_LIBUNISTRING_LIBHEADER([1.2], [unicase.h])
1027 gl_UNICASE_H
1028 gl_UNICASE_H_REQUIRE_DEFAULTS
1029 AC_PROG_MKDIR_P
1030 gl_LIBUNISTRING_MODULE([1.4], [unicase/tolower])
1031 gl_LIBUNISTRING_LIBHEADER([1.3], [unictype.h])
1032 gl_UNICTYPE_H
1033 gl_UNICTYPE_H_REQUIRE_DEFAULTS
1034 AC_PROG_MKDIR_P
1035 AC_REQUIRE([AC_C_INLINE])
1036 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-alnum])
1037 AC_REQUIRE([AC_C_INLINE])
1038 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-alpha])
1039 AC_REQUIRE([AC_C_INLINE])
1040 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-blank])
1041 AC_REQUIRE([AC_C_INLINE])
1042 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-cntrl])
1043 AC_REQUIRE([AC_C_INLINE])
1044 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-digit])
1045 AC_REQUIRE([AC_C_INLINE])
1046 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-graph])
1047 AC_REQUIRE([AC_C_INLINE])
1048 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-lower])
1049 AC_REQUIRE([AC_C_INLINE])
1050 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-print])
1051 AC_REQUIRE([AC_C_INLINE])
1052 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-punct])
1053 AC_REQUIRE([AC_C_INLINE])
1054 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-space])
1055 AC_REQUIRE([AC_C_INLINE])
1056 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-upper])
1057 AC_REQUIRE([AC_C_INLINE])
1058 gl_LIBUNISTRING_MODULE([1.4], [unictype/ctype-xdigit])
1059 gl_LIBUNISTRING_LIBHEADER([1.2], [uninorm.h])
1060 gl_UNINORM_H
1061 gl_UNINORM_H_REQUIRE_DEFAULTS
1062 AC_PROG_MKDIR_P
798 gl_UNISTD_H 1063 gl_UNISTD_H
799 gl_UNISTD_H_REQUIRE_DEFAULTS 1064 gl_UNISTD_H_REQUIRE_DEFAULTS
800 AC_PROG_MKDIR_P 1065 AC_PROG_MKDIR_P
1066 gl_LIBUNISTRING_LIBHEADER([0.9.11], [unitypes.h])
1067 AC_PROG_MKDIR_P
1068 gl_UNITYPES_H
1069 gl_LIBUNISTRING_LIBHEADER([0.9.11], [uniwidth.h])
1070 AC_PROG_MKDIR_P
1071 gl_LIBUNISTRING_MODULE([1.4], [uniwidth/width])
801 gl_FUNC_GLIBC_UNLOCKED_IO 1072 gl_FUNC_GLIBC_UNLOCKED_IO
802 gl_FUNC_UNSETENV 1073 gl_FUNC_UNSETENV
803 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV], 1074 gl_CONDITIONAL([GL_COND_OBJ_UNSETENV],
@@ -816,6 +1087,7 @@ AC_DEFUN([gl_INIT],
816 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])]) 1087 AM_][XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
817 gl_FUNC_VSNPRINTF 1088 gl_FUNC_VSNPRINTF
818 gl_STDIO_MODULE_INDICATOR([vsnprintf]) 1089 gl_STDIO_MODULE_INDICATOR([vsnprintf])
1090 gl_STDIO_MODULE_INDICATOR([vsnzprintf])
819 gl_WCHAR_H 1091 gl_WCHAR_H
820 gl_WCHAR_H_REQUIRE_DEFAULTS 1092 gl_WCHAR_H_REQUIRE_DEFAULTS
821 AC_PROG_MKDIR_P 1093 AC_PROG_MKDIR_P
@@ -832,6 +1104,13 @@ AC_DEFUN([gl_INIT],
832 gl_WCTYPE_H 1104 gl_WCTYPE_H
833 gl_WCTYPE_H_REQUIRE_DEFAULTS 1105 gl_WCTYPE_H_REQUIRE_DEFAULTS
834 AC_PROG_MKDIR_P 1106 AC_PROG_MKDIR_P
1107 gl_FUNC_WCWIDTH
1108 gl_CONDITIONAL([GL_COND_OBJ_WCWIDTH],
1109 [test $HAVE_WCWIDTH = 0 || test $REPLACE_WCWIDTH = 1])
1110 AM_COND_IF([GL_COND_OBJ_WCWIDTH], [
1111 gl_PREREQ_WCWIDTH
1112 ])
1113 gl_WCHAR_MODULE_INDICATOR([wcwidth])
835 AC_REQUIRE([AC_CANONICAL_HOST]) 1114 AC_REQUIRE([AC_CANONICAL_HOST])
836 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX], 1115 gl_CONDITIONAL([GL_COND_OBJ_WINDOWS_MUTEX],
837 [case "$host_os" in mingw* | windows*) true;; *) false;; esac]) 1116 [case "$host_os" in mingw* | windows*) true;; *) false;; esac])
@@ -871,27 +1150,35 @@ AC_DEFUN([gl_INIT],
871 gl_libobjs= 1150 gl_libobjs=
872 gl_ltlibobjs= 1151 gl_ltlibobjs=
873 gl_libobjdeps= 1152 gl_libobjdeps=
1153 gl_libgnu_libobjs=
1154 gl_libgnu_ltlibobjs=
1155 gl_libgnu_libobjdeps=
874 if test -n "$gl_LIBOBJS"; then 1156 if test -n "$gl_LIBOBJS"; then
875 # Remove the extension. 1157 # Remove the extension.
876changequote(,)dnl 1158changequote(,)dnl
877 sed_drop_objext='s/\.o$//;s/\.obj$//' 1159 sed_drop_objext='s/\.o$//;s/\.obj$//'
878 sed_dirname1='s,//*,/,g' 1160 sed_dirname1='s,//*,/,g'
879 sed_dirname2='s,\(.\)/$,\1,' 1161 sed_dirname2='s,\(.\)/$,\1,'
880 sed_dirname3='s,^[^/]*$,.,' 1162 sed_dirname3='s,[^/]*$,,'
881 sed_dirname4='s,\(.\)/[^/]*$,\1,'
882 sed_basename1='s,.*/,,' 1163 sed_basename1='s,.*/,,'
883changequote([, ])dnl 1164changequote([, ])dnl
884 for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1165 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" 1166 gl_libobjs="$gl_libobjs $i.$ac_objext"
886 gl_ltlibobjs="$gl_ltlibobjs $i.lo" 1167 gl_ltlibobjs="$gl_ltlibobjs $i.lo"
887 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1168 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
888 i_base=`echo "$i" | sed -e "$sed_basename1"` 1169 i_base=`echo "$i" | sed -e "$sed_basename1"`
889 gl_libobjdeps="$gl_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1170 gl_libgnu_libobjs="$gl_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1171 gl_libgnu_ltlibobjs="$gl_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1172 gl_libobjdeps="$gl_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1173 gl_libgnu_libobjdeps="$gl_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
890 done 1174 done
891 fi 1175 fi
892 AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) 1176 AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
893 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) 1177 AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
894 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps]) 1178 AC_SUBST([gl_LIBOBJDEPS], [$gl_libobjdeps])
1179 AC_SUBST([gl_libgnu_LIBOBJS], [$gl_libgnu_libobjs])
1180 AC_SUBST([gl_libgnu_LTLIBOBJS], [$gl_libgnu_ltlibobjs])
1181 AC_SUBST([gl_libgnu_LIBOBJDEPS], [$gl_libgnu_libobjdeps])
895 ]) 1182 ])
896 gltests_libdeps= 1183 gltests_libdeps=
897 gltests_ltlibdeps= 1184 gltests_ltlibdeps=
@@ -934,27 +1221,35 @@ changequote([, ])dnl
934 gltests_libobjs= 1221 gltests_libobjs=
935 gltests_ltlibobjs= 1222 gltests_ltlibobjs=
936 gltests_libobjdeps= 1223 gltests_libobjdeps=
1224 gltests_libgnu_libobjs=
1225 gltests_libgnu_ltlibobjs=
1226 gltests_libgnu_libobjdeps=
937 if test -n "$gltests_LIBOBJS"; then 1227 if test -n "$gltests_LIBOBJS"; then
938 # Remove the extension. 1228 # Remove the extension.
939changequote(,)dnl 1229changequote(,)dnl
940 sed_drop_objext='s/\.o$//;s/\.obj$//' 1230 sed_drop_objext='s/\.o$//;s/\.obj$//'
941 sed_dirname1='s,//*,/,g' 1231 sed_dirname1='s,//*,/,g'
942 sed_dirname2='s,\(.\)/$,\1,' 1232 sed_dirname2='s,\(.\)/$,\1,'
943 sed_dirname3='s,^[^/]*$,.,' 1233 sed_dirname3='s,[^/]*$,,'
944 sed_dirname4='s,\(.\)/[^/]*$,\1,'
945 sed_basename1='s,.*/,,' 1234 sed_basename1='s,.*/,,'
946changequote([, ])dnl 1235changequote([, ])dnl
947 for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do 1236 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" 1237 gltests_libobjs="$gltests_libobjs $i.$ac_objext"
949 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" 1238 gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
950 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"` 1239 i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3"`
951 i_base=`echo "$i" | sed -e "$sed_basename1"` 1240 i_base=`echo "$i" | sed -e "$sed_basename1"`
952 gltests_libobjdeps="$gltests_libobjdeps $i_dir/\$(DEPDIR)/$i_base.Po" 1241 gltests_libgnu_libobjs="$gltests_libgnu_libobjs $i_dir""libgnu_a-$i_base.$ac_objext"
1242 gltests_libgnu_ltlibobjs="$gltests_libgnu_ltlibobjs $i_dir""libgnu_la-$i_base.lo"
1243 gltests_libobjdeps="$gltests_libobjdeps $i_dir\$(DEPDIR)/$i_base.Po"
1244 gltests_libgnu_libobjdeps="$gltests_libgnu_libobjdeps $i_dir\$(DEPDIR)/libgnu_a-$i_base.Po"
953 done 1245 done
954 fi 1246 fi
955 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) 1247 AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
956 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) 1248 AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
957 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps]) 1249 AC_SUBST([gltests_LIBOBJDEPS], [$gltests_libobjdeps])
1250 AC_SUBST([gltests_libgnu_LIBOBJS], [$gltests_libgnu_libobjs])
1251 AC_SUBST([gltests_libgnu_LTLIBOBJS], [$gltests_libgnu_ltlibobjs])
1252 AC_SUBST([gltests_libgnu_LIBOBJDEPS], [$gltests_libgnu_libobjdeps])
958 ]) 1253 ])
959 AC_REQUIRE([gl_CC_GNULIB_WARNINGS]) 1254 AC_REQUIRE([gl_CC_GNULIB_WARNINGS])
960 LIBGNU_LIBDEPS="$gl_libdeps" 1255 LIBGNU_LIBDEPS="$gl_libdeps"
@@ -1025,6 +1320,7 @@ AC_DEFUN([gl_FILE_LIST], [
1025 lib/af_alg.h 1320 lib/af_alg.h
1026 lib/alloca.in.h 1321 lib/alloca.in.h
1027 lib/arg-nonnull.h 1322 lib/arg-nonnull.h
1323 lib/arpa_inet.c
1028 lib/arpa_inet.in.h 1324 lib/arpa_inet.in.h
1029 lib/asnprintf.c 1325 lib/asnprintf.c
1030 lib/asprintf.c 1326 lib/asprintf.c
@@ -1036,8 +1332,27 @@ AC_DEFUN([gl_FILE_LIST], [
1036 lib/basename-lgpl.h 1332 lib/basename-lgpl.h
1037 lib/basename.c 1333 lib/basename.c
1038 lib/btowc.c 1334 lib/btowc.c
1335 lib/byteswap.c
1039 lib/byteswap.in.h 1336 lib/byteswap.in.h
1040 lib/c++defs.h 1337 lib/c++defs.h
1338 lib/c-ctype.c
1339 lib/c-ctype.h
1340 lib/c32is-impl.h
1341 lib/c32isalnum.c
1342 lib/c32isalpha.c
1343 lib/c32isblank.c
1344 lib/c32iscntrl.c
1345 lib/c32isdigit.c
1346 lib/c32isgraph.c
1347 lib/c32islower.c
1348 lib/c32isprint.c
1349 lib/c32ispunct.c
1350 lib/c32isspace.c
1351 lib/c32isupper.c
1352 lib/c32isxdigit.c
1353 lib/c32to-impl.h
1354 lib/c32tolower.c
1355 lib/c32width.c
1041 lib/calloc.c 1356 lib/calloc.c
1042 lib/cdefs.h 1357 lib/cdefs.h
1043 lib/cloexec.c 1358 lib/cloexec.c
@@ -1071,6 +1386,8 @@ AC_DEFUN([gl_FILE_LIST], [
1071 lib/free.c 1386 lib/free.c
1072 lib/fseek.c 1387 lib/fseek.c
1073 lib/fseeko.c 1388 lib/fseeko.c
1389 lib/fseterr.c
1390 lib/fseterr.h
1074 lib/fstat.c 1391 lib/fstat.c
1075 lib/fsusage.c 1392 lib/fsusage.c
1076 lib/fsusage.h 1393 lib/fsusage.h
@@ -1098,6 +1415,8 @@ AC_DEFUN([gl_FILE_LIST], [
1098 lib/gl_openssl.h 1415 lib/gl_openssl.h
1099 lib/glthread/lock.c 1416 lib/glthread/lock.c
1100 lib/glthread/lock.h 1417 lib/glthread/lock.h
1418 lib/glthread/once.c
1419 lib/glthread/once.h
1101 lib/glthread/threadlib.c 1420 lib/glthread/threadlib.c
1102 lib/hard-locale.c 1421 lib/hard-locale.c
1103 lib/hard-locale.h 1422 lib/hard-locale.h
@@ -1107,6 +1426,7 @@ AC_DEFUN([gl_FILE_LIST], [
1107 lib/idpriv.h 1426 lib/idpriv.h
1108 lib/idx.h 1427 lib/idx.h
1109 lib/inet_ntop.c 1428 lib/inet_ntop.c
1429 lib/inet_pton.c
1110 lib/intprops-internal.h 1430 lib/intprops-internal.h
1111 lib/intprops.h 1431 lib/intprops.h
1112 lib/inttypes.in.h 1432 lib/inttypes.in.h
@@ -1127,6 +1447,7 @@ AC_DEFUN([gl_FILE_LIST], [
1127 lib/locale.in.h 1447 lib/locale.in.h
1128 lib/localeconv.c 1448 lib/localeconv.c
1129 lib/lseek.c 1449 lib/lseek.c
1450 lib/lstat.c
1130 lib/malloc.c 1451 lib/malloc.c
1131 lib/malloc/dynarray-skeleton.c 1452 lib/malloc/dynarray-skeleton.c
1132 lib/malloc/dynarray.h 1453 lib/malloc/dynarray.h
@@ -1139,10 +1460,16 @@ AC_DEFUN([gl_FILE_LIST], [
1139 lib/malloca.h 1460 lib/malloca.h
1140 lib/math.c 1461 lib/math.c
1141 lib/math.in.h 1462 lib/math.in.h
1463 lib/mbchar.c
1464 lib/mbchar.h
1465 lib/mbiterf.c
1466 lib/mbiterf.h
1467 lib/mbrtoc32.c
1142 lib/mbrtowc-impl-utf8.h 1468 lib/mbrtowc-impl-utf8.h
1143 lib/mbrtowc-impl.h 1469 lib/mbrtowc-impl.h
1144 lib/mbrtowc.c 1470 lib/mbrtowc.c
1145 lib/mbsinit.c 1471 lib/mbsinit.c
1472 lib/mbsnlen.c
1146 lib/mbszero.c 1473 lib/mbszero.c
1147 lib/mbtowc-impl.h 1474 lib/mbtowc-impl.h
1148 lib/mbtowc-lock.c 1475 lib/mbtowc-lock.c
@@ -1169,6 +1496,8 @@ AC_DEFUN([gl_FILE_LIST], [
1169 lib/printf-args.h 1496 lib/printf-args.h
1170 lib/printf-parse.c 1497 lib/printf-parse.c
1171 lib/printf-parse.h 1498 lib/printf-parse.h
1499 lib/pthread-once.c
1500 lib/pthread.in.h
1172 lib/realloc.c 1501 lib/realloc.c
1173 lib/reallocarray.c 1502 lib/reallocarray.c
1174 lib/regcomp.c 1503 lib/regcomp.c
@@ -1177,6 +1506,7 @@ AC_DEFUN([gl_FILE_LIST], [
1177 lib/regex_internal.c 1506 lib/regex_internal.c
1178 lib/regex_internal.h 1507 lib/regex_internal.h
1179 lib/regexec.c 1508 lib/regexec.c
1509 lib/sched.in.h
1180 lib/setenv.c 1510 lib/setenv.c
1181 lib/setlocale-lock.c 1511 lib/setlocale-lock.c
1182 lib/setlocale_null-unlocked.c 1512 lib/setlocale_null-unlocked.c
@@ -1197,10 +1527,12 @@ AC_DEFUN([gl_FILE_LIST], [
1197 lib/stdckdint.in.h 1527 lib/stdckdint.in.h
1198 lib/stddef.in.h 1528 lib/stddef.in.h
1199 lib/stdint.in.h 1529 lib/stdint.in.h
1530 lib/stdio-consolesafe.c
1200 lib/stdio-impl.h 1531 lib/stdio-impl.h
1201 lib/stdio-read.c 1532 lib/stdio-read.c
1202 lib/stdio-write.c 1533 lib/stdio-write.c
1203 lib/stdio.in.h 1534 lib/stdio.in.h
1535 lib/stdlib.c
1204 lib/stdlib.in.h 1536 lib/stdlib.in.h
1205 lib/str-two-way.h 1537 lib/str-two-way.h
1206 lib/strcasecmp.c 1538 lib/strcasecmp.c
@@ -1209,10 +1541,12 @@ AC_DEFUN([gl_FILE_LIST], [
1209 lib/strerror-override.c 1541 lib/strerror-override.c
1210 lib/strerror-override.h 1542 lib/strerror-override.h
1211 lib/strerror.c 1543 lib/strerror.c
1544 lib/string.c
1212 lib/string.in.h 1545 lib/string.in.h
1213 lib/strings.in.h 1546 lib/strings.in.h
1214 lib/stripslash.c 1547 lib/stripslash.c
1215 lib/strncasecmp.c 1548 lib/strncasecmp.c
1549 lib/strncpy.c
1216 lib/strsep.c 1550 lib/strsep.c
1217 lib/strstr.c 1551 lib/strstr.c
1218 lib/sys-limits.h 1552 lib/sys-limits.h
@@ -1224,8 +1558,46 @@ AC_DEFUN([gl_FILE_LIST], [
1224 lib/time.in.h 1558 lib/time.in.h
1225 lib/time_r.c 1559 lib/time_r.c
1226 lib/timegm.c 1560 lib/timegm.c
1561 lib/uchar.in.h
1562 lib/unicase.in.h
1563 lib/unicase/simple-mapping.h
1564 lib/unicase/tolower.c
1565 lib/unicase/tolower.h
1566 lib/unictype.in.h
1567 lib/unictype/bitmap.h
1568 lib/unictype/ctype_alnum.c
1569 lib/unictype/ctype_alnum.h
1570 lib/unictype/ctype_alpha.c
1571 lib/unictype/ctype_alpha.h
1572 lib/unictype/ctype_blank.c
1573 lib/unictype/ctype_blank.h
1574 lib/unictype/ctype_cntrl.c
1575 lib/unictype/ctype_cntrl.h
1576 lib/unictype/ctype_digit.c
1577 lib/unictype/ctype_digit.h
1578 lib/unictype/ctype_graph.c
1579 lib/unictype/ctype_graph.h
1580 lib/unictype/ctype_lower.c
1581 lib/unictype/ctype_lower.h
1582 lib/unictype/ctype_print.c
1583 lib/unictype/ctype_print.h
1584 lib/unictype/ctype_punct.c
1585 lib/unictype/ctype_punct.h
1586 lib/unictype/ctype_space.c
1587 lib/unictype/ctype_space.h
1588 lib/unictype/ctype_upper.c
1589 lib/unictype/ctype_upper.h
1590 lib/unictype/ctype_xdigit.c
1591 lib/unictype/ctype_xdigit.h
1592 lib/uninorm.in.h
1227 lib/unistd.c 1593 lib/unistd.c
1228 lib/unistd.in.h 1594 lib/unistd.in.h
1595 lib/unitypes.in.h
1596 lib/uniwidth.in.h
1597 lib/uniwidth/cjk.h
1598 lib/uniwidth/width.c
1599 lib/uniwidth/width0.h
1600 lib/uniwidth/width2.h
1229 lib/unlocked-io.h 1601 lib/unlocked-io.h
1230 lib/unsetenv.c 1602 lib/unsetenv.c
1231 lib/vasnprintf.c 1603 lib/vasnprintf.c
@@ -1233,6 +1605,7 @@ AC_DEFUN([gl_FILE_LIST], [
1233 lib/vasprintf.c 1605 lib/vasprintf.c
1234 lib/verify.h 1606 lib/verify.h
1235 lib/vsnprintf.c 1607 lib/vsnprintf.c
1608 lib/vsnzprintf.c
1236 lib/w32sock.h 1609 lib/w32sock.h
1237 lib/warn-on-use.h 1610 lib/warn-on-use.h
1238 lib/wchar.in.h 1611 lib/wchar.in.h
@@ -1241,6 +1614,7 @@ AC_DEFUN([gl_FILE_LIST], [
1241 lib/wctype-impl.h 1614 lib/wctype-impl.h
1242 lib/wctype.c 1615 lib/wctype.c
1243 lib/wctype.in.h 1616 lib/wctype.in.h
1617 lib/wcwidth.c
1244 lib/windows-initguard.h 1618 lib/windows-initguard.h
1245 lib/windows-mutex.c 1619 lib/windows-mutex.c
1246 lib/windows-mutex.h 1620 lib/windows-mutex.h
@@ -1265,20 +1639,22 @@ AC_DEFUN([gl_FILE_LIST], [
1265 m4/assert_h.m4 1639 m4/assert_h.m4
1266 m4/base64.m4 1640 m4/base64.m4
1267 m4/btowc.m4 1641 m4/btowc.m4
1642 m4/build-to-host.m4
1268 m4/builtin-expect.m4 1643 m4/builtin-expect.m4
1269 m4/byteswap.m4 1644 m4/byteswap.m4
1270 m4/c-bool.m4 1645 m4/c-bool.m4
1646 m4/c32rtomb.m4
1271 m4/calloc.m4 1647 m4/calloc.m4
1272 m4/close.m4 1648 m4/close.m4
1273 m4/codeset.m4 1649 m4/codeset.m4
1274 m4/double-slash-root.m4 1650 m4/double-slash-root.m4
1275 m4/dup2.m4 1651 m4/dup2.m4
1276 m4/eealloc.m4
1277 m4/environ.m4 1652 m4/environ.m4
1278 m4/errno_h.m4 1653 m4/errno_h.m4
1279 m4/error.m4 1654 m4/error.m4
1280 m4/error_h.m4 1655 m4/error_h.m4
1281 m4/exponentd.m4 1656 m4/exponentd.m4
1657 m4/extensions-aix.m4
1282 m4/extensions.m4 1658 m4/extensions.m4
1283 m4/extern-inline.m4 1659 m4/extern-inline.m4
1284 m4/fclose.m4 1660 m4/fclose.m4
@@ -1294,6 +1670,7 @@ AC_DEFUN([gl_FILE_LIST], [
1294 m4/free.m4 1670 m4/free.m4
1295 m4/fseek.m4 1671 m4/fseek.m4
1296 m4/fseeko.m4 1672 m4/fseeko.m4
1673 m4/fseterr.m4
1297 m4/fstat.m4 1674 m4/fstat.m4
1298 m4/fstypename.m4 1675 m4/fstypename.m4
1299 m4/fsusage.m4 1676 m4/fsusage.m4
@@ -1307,12 +1684,15 @@ AC_DEFUN([gl_FILE_LIST], [
1307 m4/getloadavg.m4 1684 m4/getloadavg.m4
1308 m4/getopt.m4 1685 m4/getopt.m4
1309 m4/getprogname.m4 1686 m4/getprogname.m4
1687 m4/gettext_h.m4
1310 m4/gl-openssl.m4 1688 m4/gl-openssl.m4
1311 m4/gnulib-common.m4 1689 m4/gnulib-common.m4
1690 m4/gnulib-i18n.m4
1312 m4/hostent.m4 1691 m4/hostent.m4
1313 m4/idpriv.m4 1692 m4/idpriv.m4
1314 m4/include_next.m4 1693 m4/include_next.m4
1315 m4/inet_ntop.m4 1694 m4/inet_ntop.m4
1695 m4/inet_pton.m4
1316 m4/intmax_t.m4 1696 m4/intmax_t.m4
1317 m4/inttypes.m4 1697 m4/inttypes.m4
1318 m4/inttypes_h.m4 1698 m4/inttypes_h.m4
@@ -1323,8 +1703,10 @@ AC_DEFUN([gl_FILE_LIST], [
1323 m4/iswxdigit.m4 1703 m4/iswxdigit.m4
1324 m4/langinfo_h.m4 1704 m4/langinfo_h.m4
1325 m4/largefile.m4 1705 m4/largefile.m4
1706 m4/libunistring-base.m4
1326 m4/limits-h.m4 1707 m4/limits-h.m4
1327 m4/localcharset.m4 1708 m4/localcharset.m4
1709 m4/locale-en.m4
1328 m4/locale-fr.m4 1710 m4/locale-fr.m4
1329 m4/locale-ja.m4 1711 m4/locale-ja.m4
1330 m4/locale-zh.m4 1712 m4/locale-zh.m4
@@ -1332,9 +1714,13 @@ AC_DEFUN([gl_FILE_LIST], [
1332 m4/localeconv.m4 1714 m4/localeconv.m4
1333 m4/lock.m4 1715 m4/lock.m4
1334 m4/lseek.m4 1716 m4/lseek.m4
1717 m4/lstat.m4
1335 m4/malloc.m4 1718 m4/malloc.m4
1336 m4/malloca.m4 1719 m4/malloca.m4
1337 m4/math_h.m4 1720 m4/math_h.m4
1721 m4/mbchar.m4
1722 m4/mbiter.m4
1723 m4/mbrtoc32.m4
1338 m4/mbrtowc.m4 1724 m4/mbrtowc.m4
1339 m4/mbsinit.m4 1725 m4/mbsinit.m4
1340 m4/mbstate_t.m4 1726 m4/mbstate_t.m4
@@ -1353,17 +1739,23 @@ AC_DEFUN([gl_FILE_LIST], [
1353 m4/netinet_in_h.m4 1739 m4/netinet_in_h.m4
1354 m4/nl_langinfo.m4 1740 m4/nl_langinfo.m4
1355 m4/nocrash.m4 1741 m4/nocrash.m4
1742 m4/off64_t.m4
1356 m4/off_t.m4 1743 m4/off_t.m4
1744 m4/once.m4
1357 m4/open-cloexec.m4 1745 m4/open-cloexec.m4
1358 m4/open-slash.m4 1746 m4/open-slash.m4
1359 m4/open.m4 1747 m4/open.m4
1360 m4/pathmax.m4 1748 m4/pathmax.m4
1361 m4/pid_t.m4 1749 m4/pid_t.m4
1362 m4/printf.m4 1750 m4/printf.m4
1751 m4/pthread-once.m4
1752 m4/pthread-spin.m4
1753 m4/pthread_h.m4
1363 m4/pthread_rwlock_rdlock.m4 1754 m4/pthread_rwlock_rdlock.m4
1364 m4/realloc.m4 1755 m4/realloc.m4
1365 m4/reallocarray.m4 1756 m4/reallocarray.m4
1366 m4/regex.m4 1757 m4/regex.m4
1758 m4/sched_h.m4
1367 m4/servent.m4 1759 m4/servent.m4
1368 m4/setenv.m4 1760 m4/setenv.m4
1369 m4/setlocale_null.m4 1761 m4/setlocale_null.m4
@@ -1379,18 +1771,23 @@ AC_DEFUN([gl_FILE_LIST], [
1379 m4/stat.m4 1771 m4/stat.m4
1380 m4/std-gnu11.m4 1772 m4/std-gnu11.m4
1381 m4/stdalign.m4 1773 m4/stdalign.m4
1774 m4/stdckdint_h.m4
1382 m4/stddef_h.m4 1775 m4/stddef_h.m4
1383 m4/stdint.m4 1776 m4/stdint.m4
1384 m4/stdint_h.m4 1777 m4/stdint_h.m4
1385 m4/stdio_h.m4 1778 m4/stdio_h.m4
1386 m4/stdlib_h.m4 1779 m4/stdlib_h.m4
1387 m4/strcase.m4 1780 m4/strcasecmp.m4
1388 m4/strcasestr.m4 1781 m4/strcasestr.m4
1389 m4/strerror.m4 1782 m4/strerror.m4
1390 m4/string_h.m4 1783 m4/string_h.m4
1784 m4/stringeq.m4
1391 m4/strings_h.m4 1785 m4/strings_h.m4
1786 m4/strncasecmp.m4
1787 m4/strncpy.m4
1392 m4/strsep.m4 1788 m4/strsep.m4
1393 m4/strstr.m4 1789 m4/strstr.m4
1790 m4/sys_cdefs_h.m4
1394 m4/sys_socket_h.m4 1791 m4/sys_socket_h.m4
1395 m4/sys_stat_h.m4 1792 m4/sys_stat_h.m4
1396 m4/sys_types_h.m4 1793 m4/sys_types_h.m4
@@ -1399,8 +1796,13 @@ AC_DEFUN([gl_FILE_LIST], [
1399 m4/time_h.m4 1796 m4/time_h.m4
1400 m4/time_r.m4 1797 m4/time_r.m4
1401 m4/timegm.m4 1798 m4/timegm.m4
1799 m4/uchar_h.m4
1402 m4/ungetc.m4 1800 m4/ungetc.m4
1801 m4/unicase_h.m4
1802 m4/unictype_h.m4
1803 m4/uninorm_h.m4
1403 m4/unistd_h.m4 1804 m4/unistd_h.m4
1805 m4/unitypes_h.m4
1404 m4/unlocked-io.m4 1806 m4/unlocked-io.m4
1405 m4/vararrays.m4 1807 m4/vararrays.m4
1406 m4/vasnprintf.m4 1808 m4/vasnprintf.m4
@@ -1409,10 +1811,10 @@ AC_DEFUN([gl_FILE_LIST], [
1409 m4/vsnprintf.m4 1811 m4/vsnprintf.m4
1410 m4/warn-on-use.m4 1812 m4/warn-on-use.m4
1411 m4/wchar_h.m4 1813 m4/wchar_h.m4
1412 m4/wchar_t.m4
1413 m4/wcrtomb.m4 1814 m4/wcrtomb.m4
1414 m4/wctype.m4 1815 m4/wctype.m4
1415 m4/wctype_h.m4 1816 m4/wctype_h.m4
1817 m4/wcwidth.m4
1416 m4/wint_t.m4 1818 m4/wint_t.m4
1417 m4/xalloc.m4 1819 m4/xalloc.m4
1418 m4/xsize.m4 1820 m4/xsize.m4
diff --git a/gl/m4/gnulib-i18n.m4 b/gl/m4/gnulib-i18n.m4
new file mode 100644
index 00000000..9a389187
--- /dev/null
+++ b/gl/m4/gnulib-i18n.m4
@@ -0,0 +1,61 @@
1# gnulib-i18n.m4
2# serial 1
3dnl Copyright (C) 2005-2026 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..83d1e701 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-2026 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..0303ff80 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-2026 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..a7091ad3 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-2026 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..a19f2dfd 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-2026 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..62e7a575 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 23
3dnl Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2006, 2008-2026 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[
@@ -18,6 +19,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
18 dnl Solaris 8..10 provide inet_ntop in libnsl instead. 19 dnl Solaris 8..10 provide inet_ntop in libnsl instead.
19 dnl Solaris 2.6..7 provide inet_ntop in libresolv instead. 20 dnl Solaris 2.6..7 provide inet_ntop in libresolv instead.
20 dnl Haiku provides it in -lnetwork. 21 dnl Haiku provides it in -lnetwork.
22 dnl QNX provides it in -lsocket.
21 dnl Native Windows provides it in -lws2_32 instead, with a declaration in 23 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
22 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl 24 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
23 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it). 25 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
@@ -38,7 +40,7 @@ AC_DEFUN([gl_FUNC_INET_NTOP],
38 fi 40 fi
39 else 41 else
40 gl_saved_LIBS=$LIBS 42 gl_saved_LIBS=$LIBS
41 AC_SEARCH_LIBS([inet_ntop], [nsl resolv network], [], 43 AC_SEARCH_LIBS([inet_ntop], [nsl resolv network socket], [],
42 [AC_CHECK_FUNCS([inet_ntop]) 44 [AC_CHECK_FUNCS([inet_ntop])
43 if test $ac_cv_func_inet_ntop = no; then 45 if test $ac_cv_func_inet_ntop = no; then
44 HAVE_INET_NTOP=0 46 HAVE_INET_NTOP=0
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
new file mode 100644
index 00000000..150c3a07
--- /dev/null
+++ b/gl/m4/inet_pton.m4
@@ -0,0 +1,73 @@
1# inet_pton.m4
2# serial 21
3dnl Copyright (C) 2006, 2008-2026 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 QNX provides it in -lsocket.
23 dnl Native Windows provides it in -lws2_32 instead, with a declaration in
24 dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
25 dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
26 HAVE_INET_PTON=1
27 INET_PTON_LIB=
28 gl_PREREQ_SYS_H_WINSOCK2
29 if test $HAVE_WINSOCK2_H = 1; then
30 dnl It needs to be overridden, because the stdcall calling convention
31 dnl is not compliant with POSIX. Set REPLACE_INET_PTON in order to avoid
32 dnl a name conflict at the linker level, even though the header file
33 dnl <ws2tcpip.h> declares inet_pton only if _WIN32_WINNT >= 0x0600.
34 REPLACE_INET_PTON=1
35 AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
36 if test $ac_cv_have_decl_inet_pton = yes; then
37 INET_PTON_LIB="-lws2_32"
38 else
39 HAVE_DECL_INET_PTON=0
40 fi
41 else
42 gl_saved_LIBS=$LIBS
43 AC_SEARCH_LIBS([inet_pton], [nsl resolv network socket], [],
44 [AC_CHECK_FUNCS([inet_pton])
45 if test $ac_cv_func_inet_pton = no; then
46 HAVE_INET_PTON=0
47 fi
48 ])
49 LIBS=$gl_saved_LIBS
50
51 if test "$ac_cv_search_inet_pton" != "no" \
52 && test "$ac_cv_search_inet_pton" != "none required"; then
53 INET_PTON_LIB="$ac_cv_search_inet_pton"
54 fi
55
56 AC_CHECK_HEADERS_ONCE([netdb.h])
57 AC_CHECK_DECLS([inet_pton],,,
58 [[#include <arpa/inet.h>
59 #if HAVE_NETDB_H
60 # include <netdb.h>
61 #endif
62 ]])
63 if test $ac_cv_have_decl_inet_pton = no; then
64 HAVE_DECL_INET_PTON=0
65 fi
66 fi
67 AC_SUBST([INET_PTON_LIB])
68])
69
70# Prerequisites of lib/inet_pton.c.
71AC_DEFUN([gl_PREREQ_INET_PTON], [
72 AC_REQUIRE([gl_SOCKET_FAMILIES])
73])
diff --git a/gl/m4/intmax_t.m4 b/gl/m4/intmax_t.m4
index 72858ea8..ad79536c 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-2026 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..ec17c237 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-2026 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..ed9e7033 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-2026 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..2c301a97 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-2026 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..3b179a76 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-2026 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..7fca8167 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-2026 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..be312d6c 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-2026 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..2cb8e873 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-2026 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..3ed8d593 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 14
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 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[
@@ -17,18 +18,17 @@ AC_DEFUN_ONCE([gl_LANGINFO_H],
17 18
18 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS. 19 dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
19 HAVE_LANGINFO_CODESET=0 20 HAVE_LANGINFO_CODESET=0
20 HAVE_LANGINFO_T_FMT_AMPM=0
21 HAVE_LANGINFO_ALTMON=0 21 HAVE_LANGINFO_ALTMON=0
22 HAVE_LANGINFO_ABALTMON=0
22 HAVE_LANGINFO_ERA=0 23 HAVE_LANGINFO_ERA=0
23 HAVE_LANGINFO_YESEXPR=0
24 AC_CHECK_HEADERS_ONCE([langinfo.h]) 24 AC_CHECK_HEADERS_ONCE([langinfo.h])
25 if test $ac_cv_header_langinfo_h = yes; then 25 if test $ac_cv_header_langinfo_h = yes; then
26 HAVE_LANGINFO_H=1 26 HAVE_LANGINFO_H=1
27 dnl Determine what <langinfo.h> defines. 27 dnl Determine what <langinfo.h> defines.
28 dnl CODESET is missing on OpenBSD 3.8. 28 dnl CODESET is missing on OpenBSD 3.8.
29 dnl ERA etc. are missing on OpenBSD 6.7. 29 dnl ERA etc. are missing on OpenBSD 6.7.
30 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. 30 dnl ALTMON_* are missing on glibc 2.26 and many other systems.
31 dnl ABALTMON_* are missing on glibc 2.41 and many other systems.
32 AC_CACHE_CHECK([whether langinfo.h defines CODESET], 32 AC_CACHE_CHECK([whether langinfo.h defines CODESET],
33 [gl_cv_header_langinfo_codeset], 33 [gl_cv_header_langinfo_codeset],
34 [AC_COMPILE_IFELSE( 34 [AC_COMPILE_IFELSE(
@@ -41,18 +41,6 @@ int a = CODESET;
41 if test $gl_cv_header_langinfo_codeset = yes; then 41 if test $gl_cv_header_langinfo_codeset = yes; then
42 HAVE_LANGINFO_CODESET=1 42 HAVE_LANGINFO_CODESET=1
43 fi 43 fi
44 AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
45 [gl_cv_header_langinfo_t_fmt_ampm],
46 [AC_COMPILE_IFELSE(
47 [AC_LANG_PROGRAM([[#include <langinfo.h>
48int a = T_FMT_AMPM;
49]])],
50 [gl_cv_header_langinfo_t_fmt_ampm=yes],
51 [gl_cv_header_langinfo_t_fmt_ampm=no])
52 ])
53 if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
54 HAVE_LANGINFO_T_FMT_AMPM=1
55 fi
56 AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1], 44 AC_CACHE_CHECK([whether langinfo.h defines ALTMON_1],
57 [gl_cv_header_langinfo_altmon], 45 [gl_cv_header_langinfo_altmon],
58 [AC_COMPILE_IFELSE( 46 [AC_COMPILE_IFELSE(
@@ -65,6 +53,18 @@ int a = ALTMON_1;
65 if test $gl_cv_header_langinfo_altmon = yes; then 53 if test $gl_cv_header_langinfo_altmon = yes; then
66 HAVE_LANGINFO_ALTMON=1 54 HAVE_LANGINFO_ALTMON=1
67 fi 55 fi
56 AC_CACHE_CHECK([whether langinfo.h defines ABALTMON_1],
57 [gl_cv_header_langinfo_abaltmon],
58 [AC_COMPILE_IFELSE(
59 [AC_LANG_PROGRAM([[#include <langinfo.h>
60int a = ABALTMON_1;
61]])],
62 [gl_cv_header_langinfo_abaltmon=yes],
63 [gl_cv_header_langinfo_abaltmon=no])
64 ])
65 if test $gl_cv_header_langinfo_abaltmon = yes; then
66 HAVE_LANGINFO_ABALTMON=1
67 fi
68 AC_CACHE_CHECK([whether langinfo.h defines ERA], 68 AC_CACHE_CHECK([whether langinfo.h defines ERA],
69 [gl_cv_header_langinfo_era], 69 [gl_cv_header_langinfo_era],
70 [AC_COMPILE_IFELSE( 70 [AC_COMPILE_IFELSE(
@@ -77,27 +77,14 @@ int a = ERA;
77 if test $gl_cv_header_langinfo_era = yes; then 77 if test $gl_cv_header_langinfo_era = yes; then
78 HAVE_LANGINFO_ERA=1 78 HAVE_LANGINFO_ERA=1
79 fi 79 fi
80 AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
81 [gl_cv_header_langinfo_yesexpr],
82 [AC_COMPILE_IFELSE(
83 [AC_LANG_PROGRAM([[#include <langinfo.h>
84int a = YESEXPR;
85]])],
86 [gl_cv_header_langinfo_yesexpr=yes],
87 [gl_cv_header_langinfo_yesexpr=no])
88 ])
89 if test $gl_cv_header_langinfo_yesexpr = yes; then
90 HAVE_LANGINFO_YESEXPR=1
91 fi
92 else 80 else
93 HAVE_LANGINFO_H=0 81 HAVE_LANGINFO_H=0
94 fi 82 fi
95 AC_SUBST([HAVE_LANGINFO_H]) 83 AC_SUBST([HAVE_LANGINFO_H])
96 AC_SUBST([HAVE_LANGINFO_CODESET]) 84 AC_SUBST([HAVE_LANGINFO_CODESET])
97 AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
98 AC_SUBST([HAVE_LANGINFO_ALTMON]) 85 AC_SUBST([HAVE_LANGINFO_ALTMON])
86 AC_SUBST([HAVE_LANGINFO_ABALTMON])
99 AC_SUBST([HAVE_LANGINFO_ERA]) 87 AC_SUBST([HAVE_LANGINFO_ERA])
100 AC_SUBST([HAVE_LANGINFO_YESEXPR])
101 88
102 dnl Check for declarations of anything we want to poison if the 89 dnl Check for declarations of anything we want to poison if the
103 dnl corresponding gnulib module is not in use. 90 dnl corresponding gnulib module is not in use.
diff --git a/gl/m4/largefile.m4 b/gl/m4/largefile.m4
index 2f824089..3134f336 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 4
3dnl Copyright 1992-1996, 1998-2024 Free Software Foundation, Inc. 3dnl Copyright 1992-1996, 1998-2026 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.
@@ -354,8 +355,7 @@ AC_DEFUN([gl_LARGEFILE],
354 *) 355 *)
355 dnl Nothing to do on gnulib's side. 356 dnl Nothing to do on gnulib's side.
356 dnl A 64-bit off_t is 357 dnl A 64-bit off_t is
357 dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, 358 dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, Cygwin,
358 dnl OSF/1, Cygwin,
359 dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on 359 dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
360 dnl glibc, HP-UX, Solaris, 360 dnl glibc, HP-UX, Solaris,
361 dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, 361 dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
diff --git a/gl/m4/libunistring-base.m4 b/gl/m4/libunistring-base.m4
new file mode 100644
index 00000000..f2f144ac
--- /dev/null
+++ b/gl/m4/libunistring-base.m4
@@ -0,0 +1,204 @@
1# libunistring-base.m4
2# serial 10
3dnl Copyright (C) 2010-2026 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..048c8fab 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-2026 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..8e2c2755 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-2026 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..f5e035f3
--- /dev/null
+++ b/gl/m4/locale-en.m4
@@ -0,0 +1,138 @@
1# locale-en.m4
2# serial 1
3dnl Copyright (C) 2003-2026 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_MESSAGES)
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..097cefa6 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 25
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2026 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.
@@ -109,7 +112,7 @@ int main () {
109 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 112 if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
110 gt_cv_locale_fr=fr_FR.ISO-8859-1 113 gt_cv_locale_fr=fr_FR.ISO-8859-1
111 else 114 else
112 # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. 115 # Test for the AIX, FreeBSD, NetBSD, OpenBSD locale name.
113 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 116 if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
114 gt_cv_locale_fr=fr_FR.ISO8859-1 117 gt_cv_locale_fr=fr_FR.ISO8859-1
115 else 118 else
@@ -153,7 +156,7 @@ AC_DEFUN_ONCE([gt_LOCALE_FR_UTF8],
153 *-musl* | midipix*) 156 *-musl* | midipix*)
154 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without 157 dnl On musl libc, all kinds of ll_CC.UTF-8 locales exist, even without
155 dnl any locale file on disk. But they are effectively equivalent to the 158 dnl any locale file on disk. But they are effectively equivalent to the
156 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSSAGES) 159 dnl C.UTF-8 locale, except for locale categories (such as LC_MESSAGES)
157 dnl for which localizations (.mo files) have been installed. 160 dnl for which localizations (.mo files) have been installed.
158 gt_cv_locale_fr_utf8=fr_FR.UTF-8 161 gt_cv_locale_fr_utf8=fr_FR.UTF-8
159 ;; 162 ;;
@@ -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..ee4309ed 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 21
3dnl Copyright (C) 2003, 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2005-2026 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
@@ -110,11 +112,11 @@ int main ()
110 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 112 if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
111 gt_cv_locale_ja=ja_JP.EUC-JP 113 gt_cv_locale_ja=ja_JP.EUC-JP
112 else 114 else
113 # Test for the HP-UX, OSF/1, NetBSD locale name. 115 # Test for the HP-UX, NetBSD locale name.
114 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 116 if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
115 gt_cv_locale_ja=ja_JP.eucJP 117 gt_cv_locale_ja=ja_JP.eucJP
116 else 118 else
117 # Test for the IRIX, FreeBSD locale name. 119 # Test for the FreeBSD locale name.
118 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then 120 if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then
119 gt_cv_locale_ja=ja_JP.EUC 121 gt_cv_locale_ja=ja_JP.EUC
120 else 122 else
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4
index 7f1a10be..98975bdd 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-2026 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..aeda9f9d 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 39
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 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.
@@ -42,8 +63,8 @@ AC_DEFUN_ONCE([gl_LOCALE_H],
42 63
43 dnl Check whether 'struct lconv' is complete. 64 dnl Check whether 'struct lconv' is complete.
44 dnl Bionic libc's 'struct lconv' is just a dummy. 65 dnl Bionic libc's 'struct lconv' is just a dummy.
45 dnl On OpenBSD 4.9, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 9, Cygwin 1.5.x, 66 dnl On OpenBSD 4.9, HP-UX 11, Solaris 9, Cygwin 1.5.x, mingw, MSVC 9,
46 dnl mingw, MSVC 9, it lacks the int_p_* and int_n_* members. 67 dnl it lacks the int_p_* and int_n_* members.
47 AC_CACHE_CHECK([whether struct lconv is properly defined], 68 AC_CACHE_CHECK([whether struct lconv is properly defined],
48 [gl_cv_sys_struct_lconv_ok], 69 [gl_cv_sys_struct_lconv_ok],
49 [AC_COMPILE_IFELSE( 70 [AC_COMPILE_IFELSE(
@@ -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..9fa31de8 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-2026 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..7058fb30 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 15
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 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
@@ -11,8 +12,8 @@ AC_DEFUN([gl_LOCK],
11[ 12[
12 AC_REQUIRE([gl_THREADLIB]) 13 AC_REQUIRE([gl_THREADLIB])
13 if test "$gl_threads_api" = posix; then 14 if test "$gl_threads_api" = posix; then
14 # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the 15 # Mac OS X 10.1 lacks the pthread_rwlock_t type and the pthread_rwlock_*
15 # pthread_rwlock_* functions. 16 # functions.
16 has_rwlock=false 17 has_rwlock=false
17 AC_CHECK_TYPE([pthread_rwlock_t], 18 AC_CHECK_TYPE([pthread_rwlock_t],
18 [has_rwlock=true 19 [has_rwlock=true
diff --git a/gl/m4/lseek.m4 b/gl/m4/lseek.m4
index 0bc3d65e..342fc55b 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-2026 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..57df6fd9
--- /dev/null
+++ b/gl/m4/lstat.m4
@@ -0,0 +1,82 @@
1# lstat.m4
2# serial 36
3dnl Copyright (C) 1997-2001, 2003-2026 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..a95e33db 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 46
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 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,64 +145,84 @@ 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.
135 irix* | solaris*) 176 dnl More recent MSVCRT from 2019 does so.
136 dnl On IRIX 6.5, the three functions return NULL with errno unset 177 dnl UCRT is the successor of MSVCRT. Assume that UCRT does so as well.
137 dnl when the argument is larger than PTRDIFF_MAX. 178 AC_COMPILE_IFELSE(
138 dnl On Solaris 11.3, the three functions return NULL with errno set 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 ;;
190 solaris*)
191 dnl On Solaris 11.3, the three functions might fail with errno set
139 dnl to EAGAIN, not ENOMEM, when the argument is larger than 192 dnl to EAGAIN, not ENOMEM, when the argument is larger than
140 dnl PTRDIFF_MAX. 193 dnl PTRDIFF_MAX. See:
194 dnl https://lists.gnu.org/r/bug-gnulib/2021-05/msg00052.html
141 dnl Here is a test program: 195 dnl Here is a test program:
196
142m4_divert_push([KILL]) 197m4_divert_push([KILL])
143#include <errno.h> 198#include <errno.h>
199#include <stddef.h>
144#include <stdio.h> 200#include <stdio.h>
201#include <stdint.h>
145#include <stdlib.h> 202#include <stdlib.h>
146#define ptrdiff_t long
147#ifndef PTRDIFF_MAX
148# define PTRDIFF_MAX ((ptrdiff_t) ((1UL << (8 * sizeof (ptrdiff_t) - 1)) - 1))
149#endif
150
151int main ()
152{
153 void *p;
154
155 fprintf (stderr, "PTRDIFF_MAX = %lu\n", (unsigned long) PTRDIFF_MAX);
156 203
157 errno = 0; 204#define TEST_CALL(call) \
158 p = malloc ((unsigned long) PTRDIFF_MAX + 1); 205 do { \
159 fprintf (stderr, "p=%p errno=%d\n", p, errno); 206 void *p = call; \
160 207 if (p) \
161 errno = 0; 208 fprintf (stderr, "returned %p (incorrect success)\n", p); \
162 p = calloc (PTRDIFF_MAX / 2 + 1, 2); 209 else if (errno == ENOMEM) \
163 fprintf (stderr, "p=%p errno=%d\n", p, errno); 210 perror ("correct failure"); \
164 211 else \
165 errno = 0; 212 perror ("incorrect failure (wrong errno)"); \
166 p = realloc (NULL, (unsigned long) PTRDIFF_MAX + 1); 213 free (p); \
167 fprintf (stderr, "p=%p errno=%d\n", p, errno); 214 } while (0)
168 215
216int
217main ()
218{
219 size_t big = PTRDIFF_MAX;
220 TEST_CALL (malloc (big + 1));
221 TEST_CALL (calloc (big / 2 + 1, 2));
222 TEST_CALL (realloc (NULL, big + 1));
223 void *small = malloc (1);
224 TEST_CALL (realloc (small, big + 1));
225 free (small);
169 return 0; 226 return 0;
170} 227}
171m4_divert_pop([KILL]) 228m4_divert_pop([KILL])
diff --git a/gl/m4/malloca.m4 b/gl/m4/malloca.m4
index 9e09d22c..2c0ed8ea 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-2026 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..4cf59671 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 146
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 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
@@ -130,8 +131,11 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
130 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF]) 131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBF])
131 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL]) 132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ILOGBL])
132 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE]) 133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISFINITE_NO_CXX])
133 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF]) 135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISINF_NO_CXX])
134 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN]) 137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN])
138 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAN_NO_CXX])
135 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF]) 139 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANF])
136 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND]) 140 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNAND])
137 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL]) 141 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISNANL])
@@ -153,6 +157,9 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
153 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB]) 157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGB])
154 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF]) 158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBF])
155 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL]) 159 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGBL])
160 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1])
161 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1F])
162 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOGP1L])
156 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF]) 163 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODF])
157 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF]) 164 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFF])
158 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL]) 165 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MODFL])
@@ -173,6 +180,7 @@ AC_DEFUN([gl_MATH_H_REQUIRE_DEFAULTS],
173 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF]) 180 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGF])
174 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL]) 181 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETPAYLOADSIGL])
175 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT]) 182 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT])
183 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNBIT_NO_CXX])
176 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF]) 184 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINF])
177 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL]) 185 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINL])
178 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF]) 186 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SINHF])
@@ -216,14 +224,19 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
216 HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF]) 224 HAVE_CBRTF=1; AC_SUBST([HAVE_CBRTF])
217 HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL]) 225 HAVE_CBRTL=1; AC_SUBST([HAVE_CBRTL])
218 HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN]) 226 HAVE_COPYSIGN=1; AC_SUBST([HAVE_COPYSIGN])
227 HAVE_COPYSIGNF=1; AC_SUBST([HAVE_COPYSIGNF])
219 HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL]) 228 HAVE_COPYSIGNL=1; AC_SUBST([HAVE_COPYSIGNL])
220 HAVE_COSF=1; AC_SUBST([HAVE_COSF]) 229 HAVE_COSF=1; AC_SUBST([HAVE_COSF])
221 HAVE_COSL=1; AC_SUBST([HAVE_COSL]) 230 HAVE_COSL=1; AC_SUBST([HAVE_COSL])
222 HAVE_COSHF=1; AC_SUBST([HAVE_COSHF]) 231 HAVE_COSHF=1; AC_SUBST([HAVE_COSHF])
223 HAVE_EXPF=1; AC_SUBST([HAVE_EXPF]) 232 HAVE_EXPF=1; AC_SUBST([HAVE_EXPF])
224 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL]) 233 HAVE_EXPL=1; AC_SUBST([HAVE_EXPL])
234 HAVE_EXP2=1; AC_SUBST([HAVE_EXP2])
235 HAVE_EXP2F=1; AC_SUBST([HAVE_EXP2F])
236 HAVE_EXP2L=1; AC_SUBST([HAVE_EXP2L])
225 HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1]) 237 HAVE_EXPM1=1; AC_SUBST([HAVE_EXPM1])
226 HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F]) 238 HAVE_EXPM1F=1; AC_SUBST([HAVE_EXPM1F])
239 HAVE_EXPM1L=1; AC_SUBST([HAVE_EXPM1L])
227 HAVE_FABSF=1; AC_SUBST([HAVE_FABSF]) 240 HAVE_FABSF=1; AC_SUBST([HAVE_FABSF])
228 HAVE_FABSL=1; AC_SUBST([HAVE_FABSL]) 241 HAVE_FABSL=1; AC_SUBST([HAVE_FABSL])
229 HAVE_FMA=1; AC_SUBST([HAVE_FMA]) 242 HAVE_FMA=1; AC_SUBST([HAVE_FMA])
@@ -251,15 +264,26 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
251 HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P]) 264 HAVE_LOG1P=1; AC_SUBST([HAVE_LOG1P])
252 HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF]) 265 HAVE_LOG1PF=1; AC_SUBST([HAVE_LOG1PF])
253 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL]) 266 HAVE_LOG1PL=1; AC_SUBST([HAVE_LOG1PL])
267 HAVE_LOG2=1; AC_SUBST([HAVE_LOG2])
268 HAVE_LOG2F=1; AC_SUBST([HAVE_LOG2F])
269 HAVE_LOG2L=1; AC_SUBST([HAVE_LOG2L])
254 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF]) 270 HAVE_LOGBF=1; AC_SUBST([HAVE_LOGBF])
255 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL]) 271 HAVE_LOGBL=1; AC_SUBST([HAVE_LOGBL])
272 HAVE_LOGP1=1; AC_SUBST([HAVE_LOGP1])
273 HAVE_LOGP1F=1; AC_SUBST([HAVE_LOGP1F])
274 HAVE_LOGP1L=1; AC_SUBST([HAVE_LOGP1L])
256 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF]) 275 HAVE_MODFF=1; AC_SUBST([HAVE_MODFF])
257 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL]) 276 HAVE_MODFL=1; AC_SUBST([HAVE_MODFL])
258 HAVE_POWF=1; AC_SUBST([HAVE_POWF]) 277 HAVE_POWF=1; AC_SUBST([HAVE_POWF])
259 HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER]) 278 HAVE_REMAINDER=1; AC_SUBST([HAVE_REMAINDER])
260 HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF]) 279 HAVE_REMAINDERF=1; AC_SUBST([HAVE_REMAINDERF])
280 HAVE_REMAINDERL=1; AC_SUBST([HAVE_REMAINDERL])
261 HAVE_RINT=1; AC_SUBST([HAVE_RINT]) 281 HAVE_RINT=1; AC_SUBST([HAVE_RINT])
282 HAVE_RINTF=1; AC_SUBST([HAVE_RINTF])
262 HAVE_RINTL=1; AC_SUBST([HAVE_RINTL]) 283 HAVE_RINTL=1; AC_SUBST([HAVE_RINTL])
284 HAVE_ROUND=1; AC_SUBST([HAVE_ROUND])
285 HAVE_ROUNDF=1; AC_SUBST([HAVE_ROUNDF])
286 HAVE_ROUNDL=1; AC_SUBST([HAVE_ROUNDL])
263 HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD]) 287 HAVE_SETPAYLOAD=1; AC_SUBST([HAVE_SETPAYLOAD])
264 HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF]) 288 HAVE_SETPAYLOADF=1; AC_SUBST([HAVE_SETPAYLOADF])
265 HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL]) 289 HAVE_SETPAYLOADL=1; AC_SUBST([HAVE_SETPAYLOADL])
@@ -283,33 +307,17 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
283 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL]) 307 HAVE_DECL_ACOSL=1; AC_SUBST([HAVE_DECL_ACOSL])
284 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL]) 308 HAVE_DECL_ASINL=1; AC_SUBST([HAVE_DECL_ASINL])
285 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL]) 309 HAVE_DECL_ATANL=1; AC_SUBST([HAVE_DECL_ATANL])
286 HAVE_DECL_CBRTF=1; AC_SUBST([HAVE_DECL_CBRTF])
287 HAVE_DECL_CBRTL=1; AC_SUBST([HAVE_DECL_CBRTL])
288 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF]) 310 HAVE_DECL_CEILF=1; AC_SUBST([HAVE_DECL_CEILF])
289 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL]) 311 HAVE_DECL_CEILL=1; AC_SUBST([HAVE_DECL_CEILL])
290 HAVE_DECL_COPYSIGNF=1; AC_SUBST([HAVE_DECL_COPYSIGNF])
291 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL]) 312 HAVE_DECL_COSL=1; AC_SUBST([HAVE_DECL_COSL])
292 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL]) 313 HAVE_DECL_EXPL=1; AC_SUBST([HAVE_DECL_EXPL])
293 HAVE_DECL_EXP2=1; AC_SUBST([HAVE_DECL_EXP2])
294 HAVE_DECL_EXP2F=1; AC_SUBST([HAVE_DECL_EXP2F])
295 HAVE_DECL_EXP2L=1; AC_SUBST([HAVE_DECL_EXP2L])
296 HAVE_DECL_EXPM1L=1; AC_SUBST([HAVE_DECL_EXPM1L])
297 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF]) 314 HAVE_DECL_FLOORF=1; AC_SUBST([HAVE_DECL_FLOORF])
298 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL]) 315 HAVE_DECL_FLOORL=1; AC_SUBST([HAVE_DECL_FLOORL])
299 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL]) 316 HAVE_DECL_FREXPL=1; AC_SUBST([HAVE_DECL_FREXPL])
300 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL]) 317 HAVE_DECL_LDEXPL=1; AC_SUBST([HAVE_DECL_LDEXPL])
301 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL]) 318 HAVE_DECL_LOGL=1; AC_SUBST([HAVE_DECL_LOGL])
302 HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L]) 319 HAVE_DECL_LOG10L=1; AC_SUBST([HAVE_DECL_LOG10L])
303 HAVE_DECL_LOG2=1; AC_SUBST([HAVE_DECL_LOG2])
304 HAVE_DECL_LOG2F=1; AC_SUBST([HAVE_DECL_LOG2F])
305 HAVE_DECL_LOG2L=1; AC_SUBST([HAVE_DECL_LOG2L])
306 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB]) 320 HAVE_DECL_LOGB=1; AC_SUBST([HAVE_DECL_LOGB])
307 HAVE_DECL_REMAINDER=1; AC_SUBST([HAVE_DECL_REMAINDER])
308 HAVE_DECL_REMAINDERL=1; AC_SUBST([HAVE_DECL_REMAINDERL])
309 HAVE_DECL_RINTF=1; AC_SUBST([HAVE_DECL_RINTF])
310 HAVE_DECL_ROUND=1; AC_SUBST([HAVE_DECL_ROUND])
311 HAVE_DECL_ROUNDF=1; AC_SUBST([HAVE_DECL_ROUNDF])
312 HAVE_DECL_ROUNDL=1; AC_SUBST([HAVE_DECL_ROUNDL])
313 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL]) 321 HAVE_DECL_SINL=1; AC_SUBST([HAVE_DECL_SINL])
314 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL]) 322 HAVE_DECL_SQRTL=1; AC_SUBST([HAVE_DECL_SQRTL])
315 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL]) 323 HAVE_DECL_TANL=1; AC_SUBST([HAVE_DECL_TANL])
@@ -392,6 +400,7 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
392 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS]) 400 REPLACE_SIGNBIT_USING_BUILTINS=0; AC_SUBST([REPLACE_SIGNBIT_USING_BUILTINS])
393 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF]) 401 REPLACE_SINF=0; AC_SUBST([REPLACE_SINF])
394 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF]) 402 REPLACE_SINHF=0; AC_SUBST([REPLACE_SINHF])
403 REPLACE_SINL=0; AC_SUBST([REPLACE_SINL])
395 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF]) 404 REPLACE_SQRTF=0; AC_SUBST([REPLACE_SQRTF])
396 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL]) 405 REPLACE_SQRTL=0; AC_SUBST([REPLACE_SQRTL])
397 REPLACE_TANF=0; AC_SUBST([REPLACE_TANF]) 406 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..4251a84c
--- /dev/null
+++ b/gl/m4/mbchar.m4
@@ -0,0 +1,15 @@
1# mbchar.m4
2# serial 9
3dnl Copyright (C) 2005-2007, 2009-2026 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..927876bc
--- /dev/null
+++ b/gl/m4/mbiter.m4
@@ -0,0 +1,16 @@
1# mbiter.m4
2# serial 7
3dnl Copyright (C) 2005, 2008-2026 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..d1690fb4
--- /dev/null
+++ b/gl/m4/mbrtoc32.m4
@@ -0,0 +1,326 @@
1# mbrtoc32.m4
2# serial 21
3dnl Copyright (C) 2014-2026 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..a49872fa 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 47
3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2024 Free Software Foundation, 3dnl Copyright (C) 2001-2002, 2004-2005, 2008-2026 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[
@@ -32,7 +33,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
32 REPLACE_MBRTOWC=1 33 REPLACE_MBRTOWC=1
33 else 34 else
34 gl_MBRTOWC_NULL_ARG1 35 gl_MBRTOWC_NULL_ARG1
35 gl_MBRTOWC_NULL_ARG2
36 gl_MBRTOWC_RETVAL 36 gl_MBRTOWC_RETVAL
37 gl_MBRTOWC_NUL_RETVAL 37 gl_MBRTOWC_NUL_RETVAL
38 gl_MBRTOWC_STORES_INCOMPLETE 38 gl_MBRTOWC_STORES_INCOMPLETE
@@ -45,13 +45,6 @@ AC_DEFUN([gl_FUNC_MBRTOWC],
45 REPLACE_MBRTOWC=1 45 REPLACE_MBRTOWC=1
46 ;; 46 ;;
47 esac 47 esac
48 case "$gl_cv_func_mbrtowc_null_arg2" in
49 *yes) ;;
50 *) AC_DEFINE([MBRTOWC_NULL_ARG2_BUG], [1],
51 [Define if the mbrtowc function has the NULL string argument bug.])
52 REPLACE_MBRTOWC=1
53 ;;
54 esac
55 case "$gl_cv_func_mbrtowc_retval" in 48 case "$gl_cv_func_mbrtowc_retval" in
56 *yes) ;; 49 *yes) ;;
57 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1], 50 *) AC_DEFINE([MBRTOWC_RETVAL_BUG], [1],
@@ -160,7 +153,7 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
160[ 153[
161 AC_REQUIRE([AC_PROG_CC]) 154 AC_REQUIRE([AC_PROG_CC])
162 AC_REQUIRE([gt_LOCALE_JA]) 155 AC_REQUIRE([gt_LOCALE_JA])
163 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 156 AC_REQUIRE([gt_LOCALE_EN_UTF8])
164 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 157 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
165 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters], 158 AC_CACHE_CHECK([whether mbrtowc handles incomplete characters],
166 [gl_cv_func_mbrtowc_incomplete_state], 159 [gl_cv_func_mbrtowc_incomplete_state],
@@ -169,10 +162,10 @@ AC_DEFUN([gl_MBRTOWC_INCOMPLETE_STATE],
169 dnl is present. 162 dnl is present.
170changequote(,)dnl 163changequote(,)dnl
171 case "$host_os" in 164 case "$host_os" in
172 # Guess no on AIX and OSF/1. 165 # Guess no on AIX.
173 aix* | osf*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;; 166 aix*) gl_cv_func_mbrtowc_incomplete_state="guessing no" ;;
174 # Guess yes otherwise. 167 # Guess yes otherwise.
175 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;; 168 *) gl_cv_func_mbrtowc_incomplete_state="guessing yes" ;;
176 esac 169 esac
177changequote([,])dnl 170changequote([,])dnl
178 if test $LOCALE_JA != none; then 171 if test $LOCALE_JA != none; then
@@ -200,7 +193,7 @@ int main ()
200 [gl_cv_func_mbrtowc_incomplete_state=no], 193 [gl_cv_func_mbrtowc_incomplete_state=no],
201 [:]) 194 [:])
202 else 195 else
203 if test $LOCALE_FR_UTF8 != none; then 196 if test "$LOCALE_EN_UTF8" != none; then
204 AC_RUN_IFELSE( 197 AC_RUN_IFELSE(
205 [AC_LANG_SOURCE([[ 198 [AC_LANG_SOURCE([[
206#include <locale.h> 199#include <locale.h>
@@ -208,7 +201,7 @@ int main ()
208#include <wchar.h> 201#include <wchar.h>
209int main () 202int main ()
210{ 203{
211 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 204 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
212 { 205 {
213 const char input[] = "B\303\274\303\237er"; /* "Büßer" */ 206 const char input[] = "B\303\274\303\237er"; /* "Büßer" */
214 mbstate_t state; 207 mbstate_t state;
@@ -288,7 +281,7 @@ dnl Result is gl_cv_func_mbrtowc_null_arg1.
288AC_DEFUN([gl_MBRTOWC_NULL_ARG1], 281AC_DEFUN([gl_MBRTOWC_NULL_ARG1],
289[ 282[
290 AC_REQUIRE([AC_PROG_CC]) 283 AC_REQUIRE([AC_PROG_CC])
291 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 284 AC_REQUIRE([gt_LOCALE_EN_UTF8])
292 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 285 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
293 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument], 286 AC_CACHE_CHECK([whether mbrtowc handles a NULL pwc argument],
294 [gl_cv_func_mbrtowc_null_arg1], 287 [gl_cv_func_mbrtowc_null_arg1],
@@ -303,7 +296,7 @@ changequote(,)dnl
303 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;; 296 *) gl_cv_func_mbrtowc_null_arg1="guessing yes" ;;
304 esac 297 esac
305changequote([,])dnl 298changequote([,])dnl
306 if test $LOCALE_FR_UTF8 != none; then 299 if test "$LOCALE_EN_UTF8" != none; then
307 AC_RUN_IFELSE( 300 AC_RUN_IFELSE(
308 [AC_LANG_SOURCE([[ 301 [AC_LANG_SOURCE([[
309#include <locale.h> 302#include <locale.h>
@@ -314,7 +307,7 @@ int main ()
314{ 307{
315 int result = 0; 308 int result = 0;
316 309
317 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 310 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
318 { 311 {
319 char input[] = "\303\237er"; 312 char input[] = "\303\237er";
320 mbstate_t state; 313 mbstate_t state;
@@ -345,57 +338,6 @@ int main ()
345 ]) 338 ])
346]) 339])
347 340
348dnl Test whether mbrtowc supports a NULL string argument correctly.
349dnl Result is gl_cv_func_mbrtowc_null_arg2.
350
351AC_DEFUN([gl_MBRTOWC_NULL_ARG2],
352[
353 AC_REQUIRE([AC_PROG_CC])
354 AC_REQUIRE([gt_LOCALE_FR_UTF8])
355 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
356 AC_CACHE_CHECK([whether mbrtowc handles a NULL string argument],
357 [gl_cv_func_mbrtowc_null_arg2],
358 [
359 dnl Initial guess, used when cross-compiling or when no suitable locale
360 dnl is present.
361changequote(,)dnl
362 case "$host_os" in
363 # Guess no on OSF/1.
364 osf*) gl_cv_func_mbrtowc_null_arg2="guessing no" ;;
365 # Guess yes otherwise.
366 *) gl_cv_func_mbrtowc_null_arg2="guessing yes" ;;
367 esac
368changequote([,])dnl
369 if test $LOCALE_FR_UTF8 != none; then
370 AC_RUN_IFELSE(
371 [AC_LANG_SOURCE([[
372#include <locale.h>
373#include <string.h>
374#include <wchar.h>
375int main ()
376{
377 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
378 {
379 mbstate_t state;
380 wchar_t wc;
381 int ret;
382
383 memset (&state, '\0', sizeof (mbstate_t));
384 wc = (wchar_t) 0xBADFACE;
385 mbrtowc (&wc, NULL, 5, &state);
386 /* Check that wc was not modified. */
387 if (wc != (wchar_t) 0xBADFACE)
388 return 2;
389 }
390 return 0;
391}]])],
392 [gl_cv_func_mbrtowc_null_arg2=yes],
393 [gl_cv_func_mbrtowc_null_arg2=no],
394 [:])
395 fi
396 ])
397])
398
399dnl Test whether mbrtowc, when parsing the end of a multibyte character, 341dnl Test whether mbrtowc, when parsing the end of a multibyte character,
400dnl correctly returns the number of bytes that were needed to complete the 342dnl correctly returns the number of bytes that were needed to complete the
401dnl character (not the total number of bytes of the multibyte character). 343dnl character (not the total number of bytes of the multibyte character).
@@ -404,7 +346,7 @@ dnl Result is gl_cv_func_mbrtowc_retval.
404AC_DEFUN([gl_MBRTOWC_RETVAL], 346AC_DEFUN([gl_MBRTOWC_RETVAL],
405[ 347[
406 AC_REQUIRE([AC_PROG_CC]) 348 AC_REQUIRE([AC_PROG_CC])
407 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 349 AC_REQUIRE([gt_LOCALE_EN_UTF8])
408 AC_REQUIRE([gt_LOCALE_JA]) 350 AC_REQUIRE([gt_LOCALE_JA])
409 AC_REQUIRE([AC_CANONICAL_HOST]) 351 AC_REQUIRE([AC_CANONICAL_HOST])
410 AC_CACHE_CHECK([whether mbrtowc has a correct return value], 352 AC_CACHE_CHECK([whether mbrtowc has a correct return value],
@@ -422,7 +364,7 @@ changequote(,)dnl
422 gl_cv_func_mbrtowc_retval="guessing yes" ;; 364 gl_cv_func_mbrtowc_retval="guessing yes" ;;
423 esac 365 esac
424changequote([,])dnl 366changequote([,])dnl
425 if test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none \ 367 if test "$LOCALE_EN_UTF8" != none || test $LOCALE_JA != none \
426 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then 368 || { case "$host_os" in mingw* | windows*) true;; *) false;; esac; }; then
427 AC_RUN_IFELSE( 369 AC_RUN_IFELSE(
428 [AC_LANG_SOURCE([[ 370 [AC_LANG_SOURCE([[
@@ -434,8 +376,8 @@ int main ()
434 int result = 0; 376 int result = 0;
435 int found_some_locale = 0; 377 int found_some_locale = 0;
436 /* This fails on Solaris. */ 378 /* This fails on Solaris. */
437 if (strcmp ("$LOCALE_FR_UTF8", "none") != 0 379 if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
438 && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 380 && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
439 { 381 {
440 char input[] = "B\303\274\303\237er"; /* "Büßer" */ 382 char input[] = "B\303\274\303\237er"; /* "Büßer" */
441 mbstate_t state; 383 mbstate_t state;
@@ -649,8 +591,8 @@ int main ()
649 [:]) 591 [:])
650 ;; 592 ;;
651 *) 593 *)
652 AC_REQUIRE([gt_LOCALE_FR_UTF8]) 594 AC_REQUIRE([gt_LOCALE_EN_UTF8])
653 if test $LOCALE_FR_UTF8 != none; then 595 if test "$LOCALE_EN_UTF8" != none; then
654 AC_RUN_IFELSE( 596 AC_RUN_IFELSE(
655 [AC_LANG_SOURCE([[ 597 [AC_LANG_SOURCE([[
656#include <locale.h> 598#include <locale.h>
@@ -658,7 +600,7 @@ int main ()
658#include <wchar.h> 600#include <wchar.h>
659int main () 601int main ()
660{ 602{
661 if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) 603 if (setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
662 { 604 {
663 wchar_t wc = (wchar_t) 0xBADFACE; 605 wchar_t wc = (wchar_t) 0xBADFACE;
664 mbstate_t state; 606 mbstate_t state;
@@ -715,7 +657,7 @@ AC_DEFUN([gl_MBRTOWC_EMPTY_INPUT],
715dnl Test whether mbrtowc reports encoding errors in the C locale. 657dnl Test whether mbrtowc reports encoding errors in the C locale.
716dnl Although POSIX was never intended to allow this, the GNU C Library 658dnl Although POSIX was never intended to allow this, the GNU C Library
717dnl and other implementations do it. See: 659dnl and other implementations do it. See:
718dnl https://sourceware.org/bugzilla/show_bug.cgi?id=19932 660dnl https://sourceware.org/PR19932
719dnl POSIX has now clarified it: 661dnl POSIX has now clarified it:
720dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html> 662dnl <https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbrtowc.html>
721dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte 663dnl says: "In the POSIX locale an [EILSEQ] error cannot occur since all byte
diff --git a/gl/m4/mbsinit.m4 b/gl/m4/mbsinit.m4
index 10c86ba9..757f2360 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-2026 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..88307d7a 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-2026 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..9c5887d3 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-2026 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..c5c74682 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 21
3dnl Copyright (C) 2002-2004, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2004, 2009-2026 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[
@@ -20,7 +21,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
20 # https://bugzilla.redhat.com/show_bug.cgi?id=499689 21 # https://bugzilla.redhat.com/show_bug.cgi?id=499689
21 # memchr should not dereference overestimated length after a match 22 # memchr should not dereference overestimated length after a match
22 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 23 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737
23 # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 24 # https://sourceware.org/PR10162
24 # memchr should cast the second argument to 'unsigned char'. 25 # memchr should cast the second argument to 'unsigned char'.
25 # This bug exists in Android 4.3. 26 # This bug exists in Android 4.3.
26 # Assume that memchr works on platforms that lack mprotect. 27 # Assume that memchr works on platforms that lack mprotect.
@@ -32,31 +33,20 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
32# include <unistd.h> 33# include <unistd.h>
33# include <sys/types.h> 34# include <sys/types.h>
34# include <sys/mman.h> 35# include <sys/mman.h>
35# ifndef MAP_FILE
36# define MAP_FILE 0
37# endif
38#endif 36#endif
39]], [[ 37]], [[
40 int result = 0; 38 int result = 0;
41 char *fence = NULL; 39 char *fence = NULL;
42#if HAVE_SYS_MMAN_H && HAVE_MPROTECT 40#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
43# if HAVE_MAP_ANONYMOUS 41 {
44 const int flags = MAP_ANONYMOUS | MAP_PRIVATE; 42 long int pagesize = sysconf (_SC_PAGESIZE);
45 const int fd = -1; 43 char *two_pages =
46# else /* !HAVE_MAP_ANONYMOUS */ 44 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
47 const int flags = MAP_FILE | MAP_PRIVATE; 45 MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
48 int fd = open ("/dev/zero", O_RDONLY, 0666); 46 if (two_pages != (char *)(-1)
49 if (fd >= 0) 47 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
50# endif 48 fence = two_pages + pagesize;
51 { 49 }
52 int pagesize = getpagesize ();
53 char *two_pages =
54 (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE,
55 flags, fd, 0);
56 if (two_pages != (char *)(-1)
57 && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0)
58 fence = two_pages + pagesize;
59 }
60#endif 50#endif
61 if (fence) 51 if (fence)
62 { 52 {
diff --git a/gl/m4/minmax.m4 b/gl/m4/minmax.m4
index bc7d0c34..3344e3f7 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-2026 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..fa32d138 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 43
3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2003, 2005-2007, 2009-2026 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
@@ -111,22 +113,6 @@ mktime_test (time_t now)
111} 113}
112 114
113static int 115static int
114irix_6_4_bug ()
115{
116 /* Based on code from Ariel Faigon. */
117 struct tm tm;
118 tm.tm_year = 96;
119 tm.tm_mon = 3;
120 tm.tm_mday = 0;
121 tm.tm_hour = 0;
122 tm.tm_min = 0;
123 tm.tm_sec = 0;
124 tm.tm_isdst = -1;
125 mktime (&tm);
126 return tm.tm_mon == 2 && tm.tm_mday == 31;
127}
128
129static int
130bigtime_test (int j) 116bigtime_test (int j)
131{ 117{
132 struct tm tm; 118 struct tm tm;
@@ -253,12 +239,10 @@ main ()
253 if ((result & 8) == 0 && ! bigtime_test (INT_MAX)) 239 if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
254 result |= 8; 240 result |= 8;
255 } 241 }
256 if (! irix_6_4_bug ())
257 result |= 16;
258 if (! spring_forward_gap ()) 242 if (! spring_forward_gap ())
259 result |= 32; 243 result |= 16;
260 if (! year_2050_test () || ! indiana_test ()) 244 if (! year_2050_test () || ! indiana_test ())
261 result |= 64; 245 result |= 32;
262 return result; 246 return result;
263}]])], 247}]])],
264 [gl_cv_func_working_mktime=yes], 248 [gl_cv_func_working_mktime=yes],
diff --git a/gl/m4/mmap-anon.m4 b/gl/m4/mmap-anon.m4
index 61ca0120..b5e323d4 100644
--- a/gl/m4/mmap-anon.m4
+++ b/gl/m4/mmap-anon.m4
@@ -1,18 +1,17 @@
1# mmap-anon.m4 1# mmap-anon.m4
2# serial 12 2# serial 15
3dnl Copyright (C) 2005, 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005, 2007, 2009-2026 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.
10# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS 11# - On Linux, AIX, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS and
11# and MAP_ANON exist and have the same value. 12# MAP_ANON exist and have the same value.
12# - On HP-UX, only MAP_ANONYMOUS exists. 13# - On HP-UX, only MAP_ANONYMOUS exists.
13# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. 14# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists.
14# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
15# used.
16 15
17AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], 16AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
18[ 17[
@@ -22,11 +21,13 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
22 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it 21 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
23 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is 22 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
24 # irrelevant for anonymous mappings. 23 # irrelevant for anonymous mappings.
25 AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) 24 # Instead, assume that mmap() exists if and only if <sys/mman.h> exists.
25 # Code needs to tests HAVE_SYS_MMAN_H, not HAVE_MMAP.
26 AC_CHECK_HEADERS_ONCE([sys/mman.h])
26 27
27 # Try to allow MAP_ANONYMOUS. 28 # Try to allow MAP_ANONYMOUS.
28 gl_have_mmap_anonymous=no 29 gl_have_mmap_anonymous=no
29 if test $gl_have_mmap = yes; then 30 if test $ac_cv_header_sys_mman_h = yes; then
30 AC_MSG_CHECKING([for MAP_ANONYMOUS]) 31 AC_MSG_CHECKING([for MAP_ANONYMOUS])
31 AC_EGREP_CPP([I cannot identify this map], [ 32 AC_EGREP_CPP([I cannot identify this map], [
32#include <sys/mman.h> 33#include <sys/mman.h>
@@ -47,10 +48,5 @@ AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON],
47 gl_have_mmap_anonymous=yes]) 48 gl_have_mmap_anonymous=yes])
48 fi 49 fi
49 AC_MSG_RESULT([$gl_have_mmap_anonymous]) 50 AC_MSG_RESULT([$gl_have_mmap_anonymous])
50 if test $gl_have_mmap_anonymous = yes; then
51 AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
52 [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
53 config.h and <sys/mman.h>.])
54 fi
55 fi 51 fi
56]) 52])
diff --git a/gl/m4/mode_t.m4 b/gl/m4/mode_t.m4
index 0d5c2808..4621813d 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-2026 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..311e00b2 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 20
3dnl Copyright (C) 2002-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2002-2006, 2009-2026 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
@@ -74,7 +75,7 @@ $ac_includes_default
74 # Determine whether it's the one-argument variant or the two-argument one. 75 # Determine whether it's the one-argument variant or the two-argument one.
75 76
76 if test -z "$ac_list_mounted_fs"; then 77 if test -z "$ac_list_mounted_fs"; then
77 # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS. 78 # glibc, HP-UX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS.
78 AC_CACHE_CHECK([for one-argument getmntent function], 79 AC_CACHE_CHECK([for one-argument getmntent function],
79 [fu_cv_sys_mounted_getmntent1], 80 [fu_cv_sys_mounted_getmntent1],
80 [AC_COMPILE_IFELSE( 81 [AC_COMPILE_IFELSE(
@@ -106,7 +107,7 @@ $ac_includes_default
106 AC_DEFINE([MOUNTED_GETMNTENT1], [1], 107 AC_DEFINE([MOUNTED_GETMNTENT1], [1],
107 [Define if there is a function named getmntent for reading the list 108 [Define if there is a function named getmntent for reading the list
108 of mounted file systems, and that function takes a single argument. 109 of mounted file systems, and that function takes a single argument.
109 (4.3BSD, SunOS, HP-UX, Irix)]) 110 (4.3BSD, SunOS, HP-UX)])
110 gl_CHECK_FUNCS_ANDROID([setmntent], 111 gl_CHECK_FUNCS_ANDROID([setmntent],
111 [[#include <stdio.h> 112 [[#include <stdio.h>
112 #include <mntent.h> 113 #include <mntent.h>
@@ -158,7 +159,7 @@ $ac_includes_default
158 fi 159 fi
159 160
160 if test -z "$ac_list_mounted_fs"; then 161 if test -z "$ac_list_mounted_fs"; then
161 # OSF/1, also (obsolete) Apple Darwin 1.3. 162 # (obsolete) Apple Darwin 1.3.
162 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h 163 # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
163 164
164 AC_CACHE_CHECK([for getfsstat function], 165 AC_CACHE_CHECK([for getfsstat function],
@@ -184,7 +185,7 @@ $getfsstat_includes
184 ac_list_mounted_fs=found 185 ac_list_mounted_fs=found
185 AC_DEFINE([MOUNTED_GETFSSTAT], [1], 186 AC_DEFINE([MOUNTED_GETFSSTAT], [1],
186 [Define if there is a function named getfsstat for reading the 187 [Define if there is a function named getfsstat for reading the
187 list of mounted file systems. (DEC Alpha running OSF/1)]) 188 list of mounted file systems. (obsolete Darwin)])
188 fi 189 fi
189 fi 190 fi
190 191
@@ -211,10 +212,9 @@ $getfsstat_includes
211 212
212 if test -z "$ac_list_mounted_fs"; then 213 if test -z "$ac_list_mounted_fs"; then
213 # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD. 214 # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD.
214 # OSF/1 also has getmntinfo but is already handled above.
215 # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker 215 # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker
216 # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64 216 # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64
217 # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1. 217 # on Mac OS X, __getmntinfo13 on NetBSD and Minix.
218 AC_CACHE_CHECK([for getmntinfo function], 218 AC_CACHE_CHECK([for getmntinfo function],
219 [fu_cv_sys_mounted_getmntinfo], 219 [fu_cv_sys_mounted_getmntinfo],
220 [AC_LINK_IFELSE( 220 [AC_LINK_IFELSE(
@@ -318,12 +318,17 @@ int getmntinfo (struct statfs **, int);
318 fi 318 fi
319 319
320 if test -z "$ac_list_mounted_fs"; then 320 if test -z "$ac_list_mounted_fs"; then
321 AC_MSG_ERROR([could not determine how to read list of mounted file systems]) 321 case "$host_os" in
322 # FIXME -- no need to abort building the whole package 322 mingw* | windows*) ac_list_mounted_fs=found ;;
323 # Can't build mountlist.c or anything that needs its functions 323 esac
324 fi
325
326 if test -z "$ac_list_mounted_fs"; then
327 AC_DEFINE([MOUNTED_NOT_PORTED], [1],
328 [Define if we don't know how to determine the list of mounted file systems.])
324 fi 329 fi
325 330
326 if test $ac_list_mounted_fs = found; then 331 if test "$ac_list_mounted_fs" = found; then
327 gl_cv_list_mounted_fs=yes 332 gl_cv_list_mounted_fs=yes
328 else 333 else
329 gl_cv_list_mounted_fs=no 334 gl_cv_list_mounted_fs=no
diff --git a/gl/m4/msvc-inval.m4 b/gl/m4/msvc-inval.m4
index 7919ff12..565c0d3a 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-2026 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..1c2b491e 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-2026 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..4fb642b7 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-2026 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..15b34466 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-2026 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..bcf19b01 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-2026 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..6d9eaf97 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-2026 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..a3ec57f7 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 14
3dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2009-2026 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[
@@ -15,43 +16,18 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
15 AC_REQUIRE([gl_PTHREADLIB]) 16 AC_REQUIRE([gl_PTHREADLIB])
16 AC_CHECK_HEADERS_ONCE([threads.h]) 17 AC_CHECK_HEADERS_ONCE([threads.h])
17 if test $ac_cv_func_nl_langinfo = yes; then 18 if test $ac_cv_func_nl_langinfo = yes; then
18 # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. 19 # On macOS 26, Solaris 10, and Solaris 11.3, nl_langinfo is not
19 AC_CACHE_CHECK([whether YESEXPR works], 20 # multithread-safe.
20 [gl_cv_func_nl_langinfo_yesexpr_works],
21 [AC_RUN_IFELSE(
22 [AC_LANG_PROGRAM([[#include <langinfo.h>
23]], [[return !*nl_langinfo(YESEXPR);
24]])],
25 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
26 [gl_cv_func_nl_langinfo_yesexpr_works=no],
27 [
28 case "$host_os" in
29 # Guess no on irix systems.
30 irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
31 # Guess yes elsewhere.
32 *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
33 esac
34 ])
35 ])
36 case $gl_cv_func_nl_langinfo_yesexpr_works in
37 *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
38 *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
39 esac
40 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
41 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
42 [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 case "$host_os" in 21 case "$host_os" in
45 solaris*) NL_LANGINFO_MTSAFE=0 ;; 22 darwin* | solaris*) NL_LANGINFO_MTSAFE=0 ;;
46 *) NL_LANGINFO_MTSAFE=1 ;; 23 *) NL_LANGINFO_MTSAFE=1 ;;
47 esac 24 esac
48 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE], 25 AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
49 [Define to 1 if nl_langinfo is multithread-safe.]) 26 [Define to 1 if nl_langinfo is multithread-safe.])
50 if test $HAVE_LANGINFO_CODESET = 1 \ 27 if test $HAVE_LANGINFO_CODESET = 1 \
51 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
52 && test $HAVE_LANGINFO_ALTMON = 1 \ 28 && test $HAVE_LANGINFO_ALTMON = 1 \
29 && test $HAVE_LANGINFO_ABALTMON = 1 \
53 && test $HAVE_LANGINFO_ERA = 1 \ 30 && test $HAVE_LANGINFO_ERA = 1 \
54 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
55 && test $NL_LANGINFO_MTSAFE = 1; then 31 && test $NL_LANGINFO_MTSAFE = 1; then
56 : 32 :
57 else 33 else
diff --git a/gl/m4/nocrash.m4 b/gl/m4/nocrash.m4
index cbe8fe82..5c1af8c7 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-2026 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..93d9e37b
--- /dev/null
+++ b/gl/m4/off64_t.m4
@@ -0,0 +1,32 @@
1# off64_t.m4
2# serial 1
3dnl Copyright (C) 2024-2026 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..d7d6aa0c 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-2026 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..a478d81a
--- /dev/null
+++ b/gl/m4/once.m4
@@ -0,0 +1,14 @@
1# once.m4
2# serial 1
3dnl Copyright (C) 2024-2026 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..9c9aef23 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-2026 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..c36bdced 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-2026 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..f5b2a91c 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-2026 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..d6bdf43e 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-2026 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..314792ed 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-2026 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..0de493b6 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 98
3dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2003, 2007-2026 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/PR2908>
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,9 +932,12 @@ 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)
928 support %n in format strings in read-only memory but not in writable 941 support %n in format strings in read-only memory but not in writable
929 memory. */ 942 memory. */
930 strcpy (fmtstring, "%d %n"); 943 strcpy (fmtstring, "%d %n");
@@ -981,7 +994,7 @@ int main ()
981 int result = 0; 994 int result = 0;
982 char buf[100]; 995 char buf[100];
983 /* Test whether %ls works at all. 996 /* Test whether %ls works at all.
984 This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on 997 This test fails on OpenBSD 4.0, Solaris 2.6, Haiku, but not on
985 Cygwin 1.5. */ 998 Cygwin 1.5. */
986 { 999 {
987 static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; 1000 static const wchar_t wstring[] = { 'a', 'b', 'c', 0 };
@@ -990,8 +1003,8 @@ int main ()
990 || strcmp (buf, "abc") != 0) 1003 || strcmp (buf, "abc") != 0)
991 result |= 1; 1004 result |= 1;
992 } 1005 }
993 /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an 1006 /* This test fails on Solaris 2.6, Cygwin 1.5, Haiku (with an assertion
994 assertion failure inside libc), but not on OpenBSD 4.0. */ 1007 failure inside libc), but not on OpenBSD 4.0. */
995 { 1008 {
996 static const wchar_t wstring[] = { 'a', 0 }; 1009 static const wchar_t wstring[] = { 'a', 0 };
997 buf[0] = '\0'; 1010 buf[0] = '\0';
@@ -1024,7 +1037,6 @@ changequote(,)dnl
1024 # Guess yes on OpenBSD >= 6.0. 1037 # Guess yes on OpenBSD >= 6.0.
1025 openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";; 1038 openbsd[1-5].*) gl_cv_func_printf_directive_ls="guessing no";;
1026 openbsd*) gl_cv_func_printf_directive_ls="guessing yes";; 1039 openbsd*) gl_cv_func_printf_directive_ls="guessing yes";;
1027 irix*) gl_cv_func_printf_directive_ls="guessing no";;
1028 solaris*) gl_cv_func_printf_directive_ls="guessing no";; 1040 solaris*) gl_cv_func_printf_directive_ls="guessing no";;
1029 cygwin*) gl_cv_func_printf_directive_ls="guessing no";; 1041 cygwin*) gl_cv_func_printf_directive_ls="guessing no";;
1030 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; 1042 beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";;
@@ -1173,6 +1185,112 @@ changequote([,])dnl
1173 ]) 1185 ])
1174]) 1186])
1175 1187
1188dnl Test whether the *printf family of functions supports POSIX/XSI format
1189dnl strings with the ' flag for grouping of decimal digits on integers,
1190dnl together with a precision.
1191dnl Result is gl_cv_func_printf_flag_grouping_int_precision.
1192
1193AC_DEFUN([gl_PRINTF_FLAG_GROUPING_INT_PRECISION],
1194[
1195 AC_REQUIRE([AC_PROG_CC])
1196 AC_REQUIRE([AC_CANONICAL_HOST])
1197 AC_CACHE_CHECK([whether printf supports grouping on integers with a precision],
1198 [gl_cv_func_printf_flag_grouping_int_precision],
1199 [
1200 dnl Prepare a guess, used when cross-compiling or when specific locales
1201 dnl are not available.
1202 case "$host_os" in
1203 # Guess no on FreeBSD, NetBSD, Solaris, Cygwin, Haiku.
1204 freebsd* | dragonfly* | netbsd* | solaris* | cygwin* | haiku*)
1205 gl_cv_func_printf_flag_grouping_int_precision="guessing no";;
1206 *)
1207 gl_cv_func_printf_flag_grouping_int_precision="guessing yes";;
1208 esac
1209 AC_RUN_IFELSE(
1210 [AC_LANG_SOURCE([[
1211#include <locale.h>
1212#include <stdio.h>
1213#include <string.h>
1214static char buf[100];
1215int main ()
1216{
1217 if (setlocale (LC_ALL, "fr_FR.UTF-8") != NULL
1218 || setlocale (LC_ALL, "fr_FR") != NULL
1219 || setlocale (LC_ALL, "fr_FR.ISO-8859-1") != NULL
1220 || setlocale (LC_ALL, "fr_FR.ISO8859-1") != NULL)
1221 {
1222 if (sprintf (buf, "%'.10d", 1000) < 0)
1223 return 1;
1224 if (strlen (buf) == 10 && strcmp (buf, "0000001000") != 0)
1225 /* The sprintf implementation has produced fewer than 10 digits. */
1226 return 2;
1227 else
1228 return 0;
1229 }
1230 return 3;
1231}]])],
1232 [gl_cv_func_printf_flag_grouping_int_precision=yes],
1233 [if test $? = 2; then
1234 gl_cv_func_printf_flag_grouping_int_precision=no
1235 fi
1236 ],
1237 [:])
1238 ])
1239])
1240
1241dnl Test whether the *printf family of functions supports POSIX/XSI format
1242dnl strings with the ' flag for grouping of decimal digits, when the thousands
1243dnl separator is a multibyte character (such as U+00A0 or U+202F in a UTF-8
1244dnl locale).
1245dnl Result is gl_cv_func_printf_flag_grouping_multibyte.
1246
1247AC_DEFUN([gl_PRINTF_FLAG_GROUPING_MULTIBYTE],
1248[
1249 AC_REQUIRE([AC_PROG_CC])
1250 AC_REQUIRE([AC_CANONICAL_HOST])
1251 AC_CACHE_CHECK([whether printf supports grouping with a multibyte separator],
1252 [gl_cv_func_printf_flag_grouping_multibyte],
1253 [
1254 dnl Prepare a guess, used when cross-compiling or when specific locales
1255 dnl are not available.
1256 case "$host_os" in
1257 # Guess no on NetBSD and Solaris 11 OpenIndiana.
1258 netbsd* | solaris*)
1259 gl_cv_func_printf_flag_grouping_multibyte="guessing no";;
1260 *)
1261 gl_cv_func_printf_flag_grouping_multibyte="guessing yes";;
1262 esac
1263 AC_RUN_IFELSE(
1264 [AC_LANG_SOURCE([[
1265#include <locale.h>
1266#include <stdio.h>
1267#include <string.h>
1268static char buf[100];
1269int main ()
1270{
1271 if (setlocale (LC_ALL, "fr_FR.UTF-8") == NULL)
1272 return 0;
1273 if (sprintf (buf, "%'.0f", 1000.0) < 0)
1274 return 1;
1275 if (strlen (localeconv ()->thousands_sep) > 1)
1276 {
1277 if (strlen (buf) <= 4 + 1)
1278 return 2;
1279 else
1280 return 3;
1281 }
1282 return 0;
1283}]])],
1284 [:],
1285 [case $? in
1286 2) gl_cv_func_printf_flag_grouping_multibyte=no ;;
1287 3) gl_cv_func_printf_flag_grouping_multibyte=yes ;;
1288 esac
1289 ],
1290 [:])
1291 ])
1292])
1293
1176dnl Test whether the *printf family of functions supports the - flag correctly. 1294dnl Test whether the *printf family of functions supports the - flag correctly.
1177dnl (ISO C99.) See 1295dnl (ISO C99.) See
1178dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html> 1296dnl <https://lists.gnu.org/r/bug-coreutils/2008-02/msg00035.html>
@@ -1470,10 +1588,6 @@ changequote(,)dnl
1470 *) gl_cv_func_printf_enomem="guessing no";; 1588 *) gl_cv_func_printf_enomem="guessing no";;
1471 esac 1589 esac
1472 ;; 1590 ;;
1473 # Guess yes on IRIX.
1474 irix*) gl_cv_func_printf_enomem="guessing yes";;
1475 # Guess yes on OSF/1.
1476 osf*) gl_cv_func_printf_enomem="guessing yes";;
1477 # Guess yes on BeOS. 1591 # Guess yes on BeOS.
1478 beos*) gl_cv_func_printf_enomem="guessing yes";; 1592 beos*) gl_cv_func_printf_enomem="guessing yes";;
1479 # Guess yes on Haiku. 1593 # Guess yes on Haiku.
@@ -1565,11 +1679,6 @@ changequote(,)dnl
1565 # Guess yes on HP-UX >= 11. 1679 # Guess yes on HP-UX >= 11.
1566 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1680 hpux[7-9]* | hpux10*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1567 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1681 hpux*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1568 # Guess yes on IRIX >= 6.5.
1569 irix6.5) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1570 # Guess yes on OSF/1 >= 5.
1571 osf[3-4]*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1572 osf*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1573 # Guess yes on NetBSD >= 3. 1682 # Guess yes on NetBSD >= 3.
1574 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1683 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1575 gl_cv_func_snprintf_truncation_c99="guessing no";; 1684 gl_cv_func_snprintf_truncation_c99="guessing no";;
@@ -1591,7 +1700,7 @@ changequote([,])dnl
1591dnl Test whether the return value of the snprintf function is the number 1700dnl Test whether the return value of the snprintf function is the number
1592dnl of bytes (excluding the terminating NUL) that would have been produced 1701dnl of bytes (excluding the terminating NUL) that would have been produced
1593dnl if the buffer had been large enough. (ISO C99, POSIX:2001) 1702dnl if the buffer had been large enough. (ISO C99, POSIX:2001)
1594dnl For example, this test program fails on IRIX 6.5: 1703dnl For example, this test program fails on HP-UX 11.31 and Solaris 9:
1595dnl --------------------------------------------------------------------- 1704dnl ---------------------------------------------------------------------
1596dnl #include <stdio.h> 1705dnl #include <stdio.h>
1597dnl int main() 1706dnl int main()
@@ -1709,6 +1818,11 @@ AC_DEFUN([gl_SNPRINTF_DIRECTIVE_N],
1709#include <signal.h> 1818#include <signal.h>
1710#include <stdio.h> 1819#include <stdio.h>
1711#include <string.h> 1820#include <string.h>
1821#if defined _WIN32 && !defined __CYGWIN__
1822# include <stdlib.h>
1823#else
1824# include <unistd.h>
1825#endif
1712#if HAVE_SNPRINTF 1826#if HAVE_SNPRINTF
1713# define my_snprintf snprintf 1827# define my_snprintf snprintf
1714#else 1828#else
@@ -1735,7 +1849,7 @@ int main ()
1735{ 1849{
1736 int count = -1; 1850 int count = -1;
1737 signal (SIGABRT, abort_handler); 1851 signal (SIGABRT, abort_handler);
1738 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) 1852 /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE >= 2)
1739 support %n in format strings in read-only memory but not in writable 1853 support %n in format strings in read-only memory but not in writable
1740 memory. */ 1854 memory. */
1741 strcpy (fmtstring, "%d %n"); 1855 strcpy (fmtstring, "%d %n");
@@ -1775,11 +1889,6 @@ changequote(,)dnl
1775 # Guess yes on AIX >= 4. 1889 # Guess yes on AIX >= 4.
1776 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";; 1890 aix[1-3]*) gl_cv_func_snprintf_directive_n="guessing no";;
1777 aix*) gl_cv_func_snprintf_directive_n="guessing yes";; 1891 aix*) gl_cv_func_snprintf_directive_n="guessing yes";;
1778 # Guess yes on IRIX >= 6.5.
1779 irix6.5) gl_cv_func_snprintf_directive_n="guessing yes";;
1780 # Guess yes on OSF/1 >= 5.
1781 osf[3-4]*) gl_cv_func_snprintf_directive_n="guessing no";;
1782 osf*) gl_cv_func_snprintf_directive_n="guessing yes";;
1783 # Guess yes on NetBSD >= 3. 1892 # Guess yes on NetBSD >= 3.
1784 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 1893 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1785 gl_cv_func_snprintf_directive_n="guessing no";; 1894 gl_cv_func_snprintf_directive_n="guessing no";;
@@ -1934,8 +2043,6 @@ changequote(,)dnl
1934 # Guess yes on AIX >= 4. 2043 # Guess yes on AIX >= 4.
1935 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 2044 aix[1-3]*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1936 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 2045 aix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1937 # Guess yes on IRIX >= 6.5.
1938 irix6.5) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1939 # Guess yes on NetBSD >= 3. 2046 # Guess yes on NetBSD >= 3.
1940 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) 2047 netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*)
1941 gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 2048 gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
@@ -2143,20 +2250,22 @@ dnl 11 = gl_PRINTF_DIRECTIVE_LS
2143dnl 12 = gl_PRINTF_DIRECTIVE_LC 2250dnl 12 = gl_PRINTF_DIRECTIVE_LC
2144dnl 13 = gl_PRINTF_POSITIONS 2251dnl 13 = gl_PRINTF_POSITIONS
2145dnl 14 = gl_PRINTF_FLAG_GROUPING 2252dnl 14 = gl_PRINTF_FLAG_GROUPING
2146dnl 15 = gl_PRINTF_FLAG_LEFTADJUST 2253dnl 15 = gl_PRINTF_FLAG_GROUPING_INT_PRECISION
2147dnl 16 = gl_PRINTF_FLAG_ZERO 2254dnl 16 = gl_PRINTF_FLAG_GROUPING_MULTIBYTE
2148dnl 17 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO 2255dnl 17 = gl_PRINTF_FLAG_LEFTADJUST
2149dnl 18 = gl_PRINTF_PRECISION 2256dnl 18 = gl_PRINTF_FLAG_ZERO
2150dnl 19 = gl_PRINTF_ENOMEM 2257dnl 19 = gl_PRINTF_FLAG_ALT_PRECISION_ZERO
2151dnl 20 = gl_SNPRINTF_PRESENCE 2258dnl 20 = gl_PRINTF_PRECISION
2152dnl 21 = gl_SNPRINTF_TRUNCATION_C99 2259dnl 21 = gl_PRINTF_ENOMEM
2153dnl 22 = gl_SNPRINTF_RETVAL_C99 2260dnl 22 = gl_SNPRINTF_PRESENCE
2154dnl 23 = gl_SNPRINTF_DIRECTIVE_N 2261dnl 23 = gl_SNPRINTF_TRUNCATION_C99
2155dnl 24 = gl_SNPRINTF_SIZE1 2262dnl 24 = gl_SNPRINTF_RETVAL_C99
2156dnl 25 = gl_VSNPRINTF_ZEROSIZE_C99 2263dnl 25 = gl_SNPRINTF_DIRECTIVE_N
2157dnl 26 = gl_SWPRINTF_WORKS 2264dnl 26 = gl_SNPRINTF_SIZE1
2158dnl 27 = gl_SWPRINTF_DIRECTIVE_LA 2265dnl 27 = gl_VSNPRINTF_ZEROSIZE_C99
2159dnl 28 = gl_SWPRINTF_DIRECTIVE_LC 2266dnl 28 = gl_SWPRINTF_WORKS
2267dnl 29 = gl_SWPRINTF_DIRECTIVE_LA
2268dnl 30 = gl_SWPRINTF_DIRECTIVE_LC
2160dnl 2269dnl
2161dnl 1 = checking whether printf supports size specifiers as in C99... 2270dnl 1 = checking whether printf supports size specifiers as in C99...
2162dnl 2 = checking whether printf supports size specifiers as in C23... 2271dnl 2 = checking whether printf supports size specifiers as in C23...
@@ -2172,62 +2281,64 @@ dnl 11 = checking whether printf supports the 'ls' directive...
2172dnl 12 = checking whether printf supports the 'lc' directive correctly... 2281dnl 12 = checking whether printf supports the 'lc' directive correctly...
2173dnl 13 = checking whether printf supports POSIX/XSI format strings with positions... 2282dnl 13 = checking whether printf supports POSIX/XSI format strings with positions...
2174dnl 14 = checking whether printf supports the grouping flag... 2283dnl 14 = checking whether printf supports the grouping flag...
2175dnl 15 = checking whether printf supports the left-adjust flag correctly... 2284dnl 15 = checking whether printf supports grouping on integers with a precision...
2176dnl 16 = checking whether printf supports the zero flag correctly... 2285dnl 16 = checking whether printf supports grouping with a multibyte separator...
2177dnl 17 = checking whether printf supports the alternative flag with a zero precision... 2286dnl 17 = checking whether printf supports the left-adjust flag correctly...
2178dnl 18 = checking whether printf supports large precisions... 2287dnl 18 = checking whether printf supports the zero flag correctly...
2179dnl 19 = checking whether printf survives out-of-memory conditions... 2288dnl 19 = checking whether printf supports the alternative flag with a zero precision...
2180dnl 20 = checking for snprintf... 2289dnl 20 = checking whether printf supports large precisions...
2181dnl 21 = checking whether snprintf truncates the result as in C99... 2290dnl 21 = checking whether printf survives out-of-memory conditions...
2182dnl 22 = checking whether snprintf returns a byte count as in C99... 2291dnl 22 = checking for snprintf...
2183dnl 23 = checking whether snprintf fully supports the 'n' directive... 2292dnl 23 = checking whether snprintf truncates the result as in C99...
2184dnl 24 = checking whether snprintf respects a size of 1... 2293dnl 24 = checking whether snprintf returns a byte count as in C99...
2185dnl 25 = checking whether vsnprintf respects a zero size as in C99... 2294dnl 25 = checking whether snprintf fully supports the 'n' directive...
2186dnl 26 = checking whether swprintf works... 2295dnl 26 = checking whether snprintf respects a size of 1...
2187dnl 27 = checking whether swprintf supports the 'La' and 'LA' directives... 2296dnl 27 = checking whether vsnprintf respects a zero size as in C99...
2188dnl 28 = checking whether swprintf supports the 'lc' directive... 2297dnl 28 = checking whether swprintf works...
2298dnl 29 = checking whether swprintf supports the 'La' and 'LA' directives...
2299dnl 30 = checking whether swprintf supports the 'lc' directive...
2189dnl 2300dnl
2190dnl . = yes, # = no. 2301dnl . = yes, # = no.
2191dnl 2302dnl
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 2303dnl 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 . # . . . . # # . . . # . . . . ? . . . . . . . . # . # 2304dnl musl libc 1.2.3 . # . . . . # # . . . # . . . . . . . . . . . . . . . # . #
2194dnl glibc 2.35 . # . . . . . . . . . . . . . . . . . . . . . . . . . . 2305dnl glibc 2.35 . # . . . . . . . . . . . . # . . . . . . . . . . . . . . .
2195dnl glibc 2.5 . # . . . . # # . . . . . . . . . . . . . . . . . . # . 2306dnl glibc 2.5 . # . . . . # # . . . . . . # . . . . . . . . . . . . . # .
2196dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . # . 2307dnl glibc 2.3.6 . # . . . # # # . . . . . . . . . . . . . . . . . . . . # .
2197dnl FreeBSD 14.0 . . . . . # . . . . . . . . . . . . # . . . . . . # . # 2308dnl FreeBSD 14.0 . . . . . # . . . . . . . . # . . . . . # . . . . . . # . #
2198dnl FreeBSD 13.0 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2309dnl FreeBSD 13.0 . # . . . # # # . . . . . . # . . . . . # . . . . . . # . #
2199dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . # ? . # . . . . . . # ? ? 2310dnl FreeBSD 5.4, 6.1 . # . . . # # # . . . . . . . . . # ? . # . . . . . . # ? ?
2200dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . . . . . . . . . # . . # ? ? 2311dnl Mac OS X 10.13.5 . # . . # # # # . # . . . . ? ? . . . . . . . . # . . # ? ?
2201dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . . # # . . . . . . . . # ? ? 2312dnl Mac OS X 10.5.8 . # . . # # # # . . . . . . ? ? . # # . . . . . . . . # ? ?
2202dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . . # # . # . . . . . . # ? ? 2313dnl Mac OS X 10.3.9 . # . . . # # # . . . . . . ? ? . # # . # . . . . . . # ? ?
2203dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . # . . . . . . # . # 2314dnl OpenBSD 6.0, 6.7 . # . . . # # # . . . . . . . . . . . . # . . . . . . # . #
2204dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # . # ? . # . . . . . . # ? ? 2315dnl OpenBSD 3.9, 4.0 . # . # # # # # # . # . . # ? ? . # ? . # . . . . . . # ? ?
2205dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . . . ? . ? . . . . . . ? ? ? 2316dnl Cygwin 1.7.0 (2009) . # . . # . # # . . ? ? . . ? ? . . ? . ? . . . . . . ? ? ?
2206dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . . . ? . # . . . . . . ? ? ? 2317dnl Cygwin 1.5.25 (2008) . # . . # # # # . . # ? . . ? ? . . ? . # . . . . . . ? ? ?
2207dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # . # ? # # . . . . . . ? ? ? 2318dnl Cygwin 1.5.19 (2006) # # . . # # # # # . # ? . # ? ? . # ? # # . . . . . . ? ? ?
2208dnl Solaris 11.4 . # . # # # # # . . # . . . . # . . . . . . . . . . # . 2319dnl Solaris 11.4 . # . # # # # # . . # . . . # # . # . . . . . . . . . . # .
2209dnl Solaris 11.3 . # . . . # # # . . # . . . . . . . . . . . . . . . # . 2320dnl Solaris 11.3 . # . . . # # # . . # . . . ? ? . . . . . . . . . . . . # .
2210dnl Solaris 11.0 . # . # # # # # . . # . . . . # . . . . . . . . . ? ? ? 2321dnl Solaris 11.0 . # . # # # # # . . # . . . ? ? . # . . . . . . . . . ? ? ?
2211dnl Solaris 10 . # . # # # # # . . # . . . . # . # . . . . . . . . # . 2322dnl Solaris 10 . # . # # # # # . . # . . . # # . # . # . . . . . . . . # .
2212dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . . # ? # . . . # . . . ? ? ? 2323dnl Solaris 2.6 ... 9 # # . # # # # # # . # . . . ? ? . # ? # . . . # . . . ? ? ?
2213dnl Solaris 2.5.1 # # . # # # # # # . # . . . . # ? . . # # # # # # ? ? ? 2324dnl Solaris 2.5.1 # # . # # # # # # . # . . . ? ? . # ? . . # # # # # # ? ? ?
2214dnl AIX 7.1 . # . # # # # # . . . . . . . # . # . . . . . . . # . . 2325dnl AIX 7.1 . # . # # # # # . . . . . . . . . # . # . . . . . . . # . .
2215dnl AIX 5.2 . # . # # # # # . . . . . . . # ? . . . . . . . . # ? ? 2326dnl AIX 5.2 . # . # # # # # . . . . . . ? ? . # ? . . . . . . . . # ? ?
2216dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . . # ? . . . . # . . . # ? ? 2327dnl AIX 4.3.2, 5.1 # # . # # # # # # . . . . . ? ? . # ? . . . . # . . . # ? ?
2217dnl HP-UX 11.31 . # . . . # # # . . . ? . . . # ? . . . . # # . . ? ? ? 2328dnl HP-UX 11.31 . # . . . # # # . . . ? . . ? ? . # ? . . . . # # . . ? ? ?
2218dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . . # ? . . . . # # . # ? ? ? 2329dnl HP-UX 11.{00,11,23} # # . . . # # # # . . ? . . ? ? . # ? . . . . # # . # ? ? ?
2219dnl HP-UX 10.20 # # . # . # # # # . ? ? . . # # ? . . . . # # ? # ? ? ? 2330dnl HP-UX 10.20 # # . # . # # # # . ? ? . . ? ? # # ? . . . . # # ? # ? ? ?
2220dnl IRIX 6.5 # # . # # # # # # . # . . . . # ? . . . . # . . . # ? ? 2331dnl IRIX 6.5 # # . # # # # # # . # . . . ? ? . # ? . . . . # . . . # ? ?
2221dnl OSF/1 5.1 # # . # # # # # # . . ? . . . # ? . . . . # . . # ? ? ? 2332dnl OSF/1 5.1 # # . # # # # # # . . ? . . ? ? . # ? . . . . # . . # ? ? ?
2222dnl OSF/1 4.0d # # . # # # # # # . . ? . . . # ? . . # # # # # # ? ? ? 2333dnl OSF/1 4.0d # # . # # # # # # . . ? . . ? ? . # ? . . # # # # # # ? ? ?
2223dnl NetBSD 9.0 . # . . . # # # . . . . . . . . . . . . . . . . . # . # 2334dnl NetBSD 9.0 . # . . . # # # . . . . . . # # . . . . . . . . . . . # . #
2224dnl NetBSD 5.0 . # . . # # # # . . . . . . . # ? . # . . . . . . # ? ? 2335dnl NetBSD 5.0 . # . . # # # # . . . . . . ? ? . # ? . # . . . . . . # ? ?
2225dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? . . . ? ? ? # ? ? 2336dnl NetBSD 4.0 . # ? ? ? ? # # ? . ? . . ? ? ? ? ? ? ? ? . . . ? ? ? # ? ?
2226dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? # ? . # . . . . . . # ? ? 2337dnl NetBSD 3.0 . # . . . # # # # . ? . # # ? ? ? # ? . # . . . . . . # ? ?
2227dnl Haiku . # . . # # # # # . # ? . . . . ? . ? . . ? . . . . # . 2338dnl Haiku . # . . # # # # # . # ? . . # . . . ? . ? . . ? . . . . # .
2228dnl BeOS # # # . # # # # # . ? ? # . ? . ? # ? . . ? . . . ? ? ? 2339dnl BeOS # # # . # # # # # . ? ? # . ? ? ? . ? # ? . . ? . . . ? ? ?
2229dnl Android 4.3 . # . # # # # # # # # ? . # . # ? . # . . . # . . ? ? ? 2340dnl Android 4.3 . # . # # # # # # # # ? . # ? ? . # ? . # . . . # . . ? ? ?
2230dnl old mingw / msvcrt # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2341dnl old mingw / msvcrt # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
2231dnl MSVC 9 # # # # # # # # # # . ? # # . # ? # ? # # # # . . # ? ? 2342dnl MSVC 9 # # # # # # # # # # . ? # # ? ? . # ? # ? # # # # . . # ? ?
2232dnl mingw 2009-2011 . # # . # . # # . . . ? # # . . ? . ? . . . . . . # ? ? 2343dnl mingw 2009-2011 . # # . # . # # . . . ? # # ? ? . . ? . ? . . . . . . # ? ?
2233dnl mingw-w64 2011 # # # # # # # # # . . ? # # . # ? # ? . # # # . . # ? ? 2344dnl mingw-w64 2011 # # # # # # # # # . . ? # # ? ? . # ? # ? . # # # . . # ? ?
diff --git a/gl/m4/pthread-once.m4 b/gl/m4/pthread-once.m4
new file mode 100644
index 00000000..9080363d
--- /dev/null
+++ b/gl/m4/pthread-once.m4
@@ -0,0 +1,83 @@
1# pthread-once.m4
2# serial 6
3dnl Copyright (C) 2019-2026 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..17fa3b5e
--- /dev/null
+++ b/gl/m4/pthread-spin.m4
@@ -0,0 +1,72 @@
1# pthread-spin.m4
2# serial 8
3dnl Copyright (C) 2019-2026 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..f01dc3d3
--- /dev/null
+++ b/gl/m4/pthread_h.m4
@@ -0,0 +1,293 @@
1# pthread_h.m4
2# serial 11
3dnl Copyright (C) 2009-2026 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..c16c781d 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-2026 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
@@ -31,7 +32,7 @@ dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rd
31dnl but this test verifies the guarantee regardless of TPS and regardless of 32dnl but this test verifies the guarantee regardless of TPS and regardless of
32dnl scheduling policy. 33dnl scheduling policy.
33dnl Glibc does not provide this guarantee (and never will on Linux), see 34dnl Glibc does not provide this guarantee (and never will on Linux), see
34dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 35dnl https://sourceware.org/PR13701
35dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 36dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052
36AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], 37AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER],
37[ 38[
diff --git a/gl/m4/realloc.m4 b/gl/m4/realloc.m4
index eb90d588..8938db92 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 40
3dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007, 2009-2026 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..e789967c 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-2026 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..45a10490 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-2026 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..92ebe1b7
--- /dev/null
+++ b/gl/m4/sched_h.m4
@@ -0,0 +1,102 @@
1# sched_h.m4
2# serial 16
3dnl Copyright (C) 2008-2026 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..97bcad0f 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-2026 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..5faf28d2 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 36
3dnl Copyright (C) 2001-2004, 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2004, 2006-2026 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[
@@ -84,8 +85,6 @@ AC_DEFUN([gl_FUNC_UNSETENV],
84 [AC_COMPILE_IFELSE( 85 [AC_COMPILE_IFELSE(
85 [AC_LANG_PROGRAM( 86 [AC_LANG_PROGRAM(
86 [[ 87 [[
87#undef _BSD
88#define _BSD 1 /* unhide unsetenv declaration in OSF/1 5.1 <stdlib.h> */
89#include <stdlib.h> 88#include <stdlib.h>
90extern 89extern
91#ifdef __cplusplus 90#ifdef __cplusplus
@@ -155,6 +154,7 @@ AC_DEFUN([gl_PREREQ_SETENV],
155 AC_REQUIRE([gl_ENVIRON]) 154 AC_REQUIRE([gl_ENVIRON])
156 AC_CHECK_HEADERS_ONCE([unistd.h]) 155 AC_CHECK_HEADERS_ONCE([unistd.h])
157 AC_CHECK_HEADERS([search.h]) 156 AC_CHECK_HEADERS([search.h])
157 AC_CHECK_DECLS_ONCE([_putenv])
158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]]) 158 gl_CHECK_FUNCS_ANDROID([tsearch], [[#include <search.h>]])
159]) 159])
160 160
@@ -163,4 +163,5 @@ AC_DEFUN([gl_PREREQ_UNSETENV],
163[ 163[
164 AC_REQUIRE([gl_ENVIRON]) 164 AC_REQUIRE([gl_ENVIRON])
165 AC_CHECK_HEADERS_ONCE([unistd.h]) 165 AC_CHECK_HEADERS_ONCE([unistd.h])
166 AC_CHECK_DECLS_ONCE([_putenv])
166]) 167])
diff --git a/gl/m4/setlocale_null.m4 b/gl/m4/setlocale_null.m4
index e5b7d28b..b6727245 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 11
3dnl Copyright (C) 2019-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2019-2026 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])
@@ -31,8 +32,8 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
31 [gl_cv_func_setlocale_null_all_mtsafe=yes], 32 [gl_cv_func_setlocale_null_all_mtsafe=yes],
32 [gl_cv_func_setlocale_null_all_mtsafe=no]) 33 [gl_cv_func_setlocale_null_all_mtsafe=no])
33 ;; 34 ;;
34 # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. 35 # Guess yes on glibc, HP-UX, Solaris, native Windows.
35 *-gnu* | gnu* | hpux* | irix* | solaris* | mingw* | windows*) 36 *-gnu* | gnu* | hpux* | solaris* | mingw* | windows*)
36 gl_cv_func_setlocale_null_all_mtsafe=yes ;; 37 gl_cv_func_setlocale_null_all_mtsafe=yes ;;
37 # If we don't know, obey --enable-cross-guesses. 38 # If we don't know, obey --enable-cross-guesses.
38 *) 39 *)
@@ -62,8 +63,8 @@ AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
62 # Guess no on OpenBSD, AIX. 63 # Guess no on OpenBSD, AIX.
63 openbsd* | aix*) 64 openbsd* | aix*)
64 gl_cv_func_setlocale_null_one_mtsafe=no ;; 65 gl_cv_func_setlocale_null_one_mtsafe=no ;;
65 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. 66 # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, Solaris, Haiku, Cygwin, native Windows.
66 *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw* | windows*) 67 *-gnu* | gnu* | *-musl* | midipix* | darwin* | freebsd* | midnightbsd* | netbsd* | hpux* | solaris* | haiku* | cygwin* | mingw* | windows*)
67 gl_cv_func_setlocale_null_one_mtsafe=yes ;; 68 gl_cv_func_setlocale_null_one_mtsafe=yes ;;
68 # If we don't know, obey --enable-cross-guesses. 69 # If we don't know, obey --enable-cross-guesses.
69 *) 70 *)
diff --git a/gl/m4/sha256.m4 b/gl/m4/sha256.m4
index ad5596a4..a9bd7857 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-2026 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..b7a5153a 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-2026 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..6de225c2 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-2026 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..f62ffcfd 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-2026 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..95800d2e 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-2026 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..e5156511 100644
--- a/gl/m4/socklen.m4
+++ b/gl/m4/socklen.m4
@@ -1,16 +1,17 @@
1# socklen.m4 1# socklen.m4
2# serial 11 2# serial 13
3dnl Copyright (C) 2005-2007, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2007, 2009-2026 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
10dnl Check for socklen_t: historically on BSD it is an int, and in 11dnl Check for socklen_t: historically on BSD it is an int, and in
11dnl POSIX 1g it is a type of its own, but some platforms use different 12dnl POSIX 1g it is a type of its own, but some platforms use different
12dnl types for the argument to getsockopt, getpeername, etc.: 13dnl types for the argument to getsockopt, getpeername, etc.:
13dnl HP-UX 10.20, IRIX 6.5, OSF/1 4.0, Interix 3.5, BeOS. 14dnl HP-UX 10.20, Interix 3.5, BeOS.
14dnl So we have to test to find something that will work. 15dnl So we have to test to find something that will work.
15 16
16AC_DEFUN([gl_TYPE_SOCKLEN_T], 17AC_DEFUN([gl_TYPE_SOCKLEN_T],
diff --git a/gl/m4/sockpfaf.m4 b/gl/m4/sockpfaf.m4
index c68b3abb..6379766d 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-2026 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..8710cb72 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-2026 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..10eb1dfa 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-2026 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..3764ec0b 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-2026 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..0868a43a 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-2026 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
@@ -765,7 +777,7 @@ AC_DEFUN([_AC_CXX_CXX11_TEST_BODY],
765} 777}
766{ 778{
767 // Unicode literals 779 // Unicode literals
768 char const *utf8 = u8"UTF-8 string \u2500"; 780 auto const *utf8 = u8"UTF-8 string \u2500"; // This is portable to C++20.
769 char16_t const *utf16 = u"UTF-8 string \u2500"; 781 char16_t const *utf16 = u"UTF-8 string \u2500";
770 char32_t const *utf32 = U"UTF-32 string \u2500"; 782 char32_t const *utf32 = U"UTF-32 string \u2500";
771} 783}
@@ -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..7177d034 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-2026 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
@@ -29,7 +30,7 @@ AC_DEFUN([gl_ALIGNASOF],
29 30
30 /* Test that alignof yields a result consistent with offsetof. 31 /* Test that alignof yields a result consistent with offsetof.
31 This catches GCC bug 52023 32 This catches GCC bug 52023
32 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ 33 <https://gcc.gnu.org/PR52023>. */
33 #ifdef __cplusplus 34 #ifdef __cplusplus
34 template <class t> struct alignof_helper { char a; t b; }; 35 template <class t> struct alignof_helper { char a; t b; };
35 # define ao(type) offsetof (alignof_helper<type>, b) 36 # define ao(type) offsetof (alignof_helper<type>, b)
@@ -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/n3220.pdf>)
85 sections 6.5.3.4, 6.7.5, 7.15. 86 sections 6.2.8, 6.7.6.
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
@@ -102,12 +103,14 @@ AC_DEFUN([gl_ALIGNASOF],
102 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ 103 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
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/PR52023>.
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..eb8c858a
--- /dev/null
+++ b/gl/m4/stdckdint_h.m4
@@ -0,0 +1,136 @@
1# stdckdint_h.m4
2# serial 1
3dnl Copyright 2025-2026 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..299472b1 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-2026 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/PR114869
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/PR114870
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..410da153 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 65
3dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2001-2026 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
@@ -390,9 +391,9 @@ AC_DEFUN([gl_STDINT_BITSIZEOF],
390 ]) 391 ])
391 eval result=\$gl_cv_bitsizeof_${gltype} 392 eval result=\$gl_cv_bitsizeof_${gltype}
392 if test $result = unknown; then 393 if test $result = unknown; then
393 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, 394 dnl Use a nonempty default, because some old compilers do a syntax check
394 dnl do a syntax check even on unused #if conditions and give an error 395 dnl even on unused #if conditions and give an error on valid C code like
395 dnl on valid C code like this: 396 dnl this:
396 dnl #if 0 397 dnl #if 0
397 dnl # if > 32 398 dnl # if > 32
398 dnl # endif 399 dnl # endif
diff --git a/gl/m4/stdint_h.m4 b/gl/m4/stdint_h.m4
index 29f42160..7f60af20 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-2026 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..9d4126f5 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-2026 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..f35d6611 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 86
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 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])
@@ -196,7 +205,6 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
196 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R]) 205 HAVE_PTSNAME_R=1; AC_SUBST([HAVE_PTSNAME_R])
197 HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R]) 206 HAVE_QSORT_R=1; AC_SUBST([HAVE_QSORT_R])
198 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM]) 207 HAVE_RANDOM=1; AC_SUBST([HAVE_RANDOM])
199 HAVE_RANDOM_H=1; AC_SUBST([HAVE_RANDOM_H])
200 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R]) 208 HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
201 HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY]) 209 HAVE_REALLOCARRAY=1; AC_SUBST([HAVE_REALLOCARRAY])
202 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH]) 210 HAVE_REALPATH=1; AC_SUBST([HAVE_REALPATH])
@@ -215,9 +223,11 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
215 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL]) 223 HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
216 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA]) 224 HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
217 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H]) 225 HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
226 HAVE_SYS_PROCESS_H=0; AC_SUBST([HAVE_SYS_PROCESS_H])
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..f9f90928
--- /dev/null
+++ b/gl/m4/strcasecmp.m4
@@ -0,0 +1,67 @@
1# strcasecmp.m4
2# serial 3
3dnl Copyright (C) 2002-2026 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..f56eed58 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-2026 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],
@@ -21,8 +22,8 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
21 if test $REPLACE_MEMCHR = 1; then 22 if test $REPLACE_MEMCHR = 1; then
22 REPLACE_STRCASESTR=1 23 REPLACE_STRCASESTR=1
23 else 24 else
24 dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 25 dnl Detect https://sourceware.org/PR12092
25 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. 26 dnl and https://sourceware.org/PR23637.
26 AC_CACHE_CHECK([whether strcasestr works], 27 AC_CACHE_CHECK([whether strcasestr works],
27 [gl_cv_func_strcasestr_works_always], 28 [gl_cv_func_strcasestr_works_always],
28 [AC_RUN_IFELSE( 29 [AC_RUN_IFELSE(
@@ -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..9bb60c3f 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-2026 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..2a6e4db4 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 46
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 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])
@@ -61,7 +63,9 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
61 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) 63 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
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])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRINGEQ])
64 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) 67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT])
68 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCPY])
65 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) 69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP])
66 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) 70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN])
67 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) 71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK])
@@ -69,6 +73,8 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
69 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) 73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR])
70 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) 74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR])
71 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) 75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_STARTSWITH])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STR_ENDSWITH])
72 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) 78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN])
73 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) 79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN])
74 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) 80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR])
@@ -83,8 +89,11 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) 89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) 90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) 91 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R])
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_STARTSWITH])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) 94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) 95 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
96 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) 97 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) 98 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) 99 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
@@ -107,6 +116,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
107 HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) 116 HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO])
108 HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) 117 HAVE_FFSL=1; AC_SUBST([HAVE_FFSL])
109 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) 118 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
119 HAVE_DECL_MEMEQ=0; AC_SUBST([HAVE_DECL_MEMEQ])
110 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) 120 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
111 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) 121 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
112 HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT]) 122 HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT])
@@ -116,6 +126,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
116 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) 126 HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
117 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) 127 HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
118 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) 128 HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
129 HAVE_DECL_STREQ=0; AC_SUBST([HAVE_DECL_STREQ])
119 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) 130 HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
120 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) 131 HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
121 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) 132 HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
@@ -123,6 +134,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
123 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) 134 HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
124 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) 135 HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
125 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) 136 HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
137 HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
126 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) 138 HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
127 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) 139 HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
128 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) 140 HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
@@ -138,6 +150,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
138 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) 150 REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
139 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) 151 REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
140 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) 152 REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
153 REPLACE_STRNCPY=0; AC_SUBST([REPLACE_STRNCPY])
141 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) 154 REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
142 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) 155 REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
143 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) 156 REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
@@ -145,6 +158,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
145 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) 158 REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
146 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) 159 REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
147 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) 160 REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
161 REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
148 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) 162 REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
149 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) 163 REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
150 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP]) 164 REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])
diff --git a/gl/m4/stringeq.m4 b/gl/m4/stringeq.m4
new file mode 100644
index 00000000..ffea8afc
--- /dev/null
+++ b/gl/m4/stringeq.m4
@@ -0,0 +1,25 @@
1# stringeq.m4
2# serial 1
3dnl Copyright (C) 2025-2026 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_STREQ],
10[
11 AC_REQUIRE([gl_STRING_H_DEFAULTS])
12 AC_CHECK_DECLS_ONCE([streq])
13 if test $ac_cv_have_decl_streq != no; then
14 HAVE_DECL_STREQ=1
15 fi
16])
17
18AC_DEFUN([gl_FUNC_MEMEQ],
19[
20 AC_REQUIRE([gl_STRING_H_DEFAULTS])
21 AC_CHECK_DECLS_ONCE([memeq])
22 if test $ac_cv_have_decl_memeq != no; then
23 HAVE_DECL_MEMEQ=1
24 fi
25])
diff --git a/gl/m4/strings_h.m4 b/gl/m4/strings_h.m4
index aaafb559..aec4f715 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-2026 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..4314b603 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-2026 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..b94abede
--- /dev/null
+++ b/gl/m4/strncpy.m4
@@ -0,0 +1,94 @@
1# strncpy.m4
2# serial 1
3dnl Copyright (C) 2002-2004, 2009-2026 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..6afd34a9 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-2026 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..3a9e9c60 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-2026 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],
@@ -13,8 +14,8 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
13 if test $REPLACE_MEMCHR = 1; then 14 if test $REPLACE_MEMCHR = 1; then
14 REPLACE_STRSTR=1 15 REPLACE_STRSTR=1
15 else 16 else
16 dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092 17 dnl Detect https://sourceware.org/PR12092
17 dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637. 18 dnl and https://sourceware.org/PR23637.
18 AC_CACHE_CHECK([whether strstr works], 19 AC_CACHE_CHECK([whether strstr works],
19 [gl_cv_func_strstr_works_always], 20 [gl_cv_func_strstr_works_always],
20 [AC_RUN_IFELSE( 21 [AC_RUN_IFELSE(
@@ -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..a1398a29
--- /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-2026 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..cdc374e4 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 32
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 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
@@ -12,17 +13,6 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
12 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) 13 AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
13 AC_REQUIRE([AC_CANONICAL_HOST]) 14 AC_REQUIRE([AC_CANONICAL_HOST])
14 15
15 dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
16 dnl old-style declarations (with return type 'int' instead of 'ssize_t')
17 dnl unless _POSIX_PII_SOCKET is defined.
18 case "$host_os" in
19 osf*)
20 AC_DEFINE([_POSIX_PII_SOCKET], [1],
21 [Define to 1 in order to get the POSIX compatible declarations
22 of socket functions.])
23 ;;
24 esac
25
26 GL_GENERATE_SYS_SOCKET_H=false 16 GL_GENERATE_SYS_SOCKET_H=false
27 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained], 17 AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
28 [gl_cv_header_sys_socket_h_selfcontained], 18 [gl_cv_header_sys_socket_h_selfcontained],
@@ -52,24 +42,10 @@ AC_DEFUN_ONCE([gl_SYS_SOCKET_H],
52 fi 42 fi
53 # We need to check for ws2tcpip.h now. 43 # We need to check for ws2tcpip.h now.
54 gl_PREREQ_SYS_H_SOCKET 44 gl_PREREQ_SYS_H_SOCKET
55 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ 45 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 46 if test $ac_cv_type_struct_sockaddr_storage = no; then
68 HAVE_STRUCT_SOCKADDR_STORAGE=0 47 HAVE_STRUCT_SOCKADDR_STORAGE=0
69 fi 48 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 49 if test $ac_cv_type_struct_sockaddr_storage != no; then
74 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], 50 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
75 [], 51 [],
@@ -158,6 +134,32 @@ AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP],
158 AC_SUBST([HAVE_WS2TCPIP_H]) 134 AC_SUBST([HAVE_WS2TCPIP_H])
159]) 135])
160 136
137# Common prerequisites of the <sys/socket.h> replacement and of the <sys/un.h>
138# replacement.
139# Sets and substitutes HAVE_SA_FAMILY_T.
140AC_DEFUN([gl_PREREQ_SYS_SA_FAMILY],
141[
142 AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
143 AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
144 /* sys/types.h is not needed according to POSIX, but the
145 sys/socket.h in i386-unknown-freebsd4.10 and
146 powerpc-apple-darwin5.5 required it. */
147#include <sys/types.h>
148#ifdef HAVE_SYS_SOCKET_H
149#include <sys/socket.h>
150#endif
151#ifdef HAVE_WS2TCPIP_H
152#include <ws2tcpip.h>
153#endif
154])
155 if test $ac_cv_type_sa_family_t = yes; then
156 HAVE_SA_FAMILY_T=1
157 else
158 HAVE_SA_FAMILY_T=0
159 fi
160 AC_SUBST([HAVE_SA_FAMILY_T])
161])
162
161# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) 163# gl_SYS_SOCKET_MODULE_INDICATOR([modulename])
162# sets the shell variable that indicates the presence of the given module 164# sets the shell variable that indicates the presence of the given module
163# to a C preprocessor expression that will evaluate to 1. 165# to a C preprocessor expression that will evaluate to 1.
@@ -202,6 +204,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
202 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) 204 HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
203 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; 205 HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
204 AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) 206 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]) 207 HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4])
207]) 208])
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
index 3cc50ce6..04dfce7e 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 44 -*- Autoconf -*-
3dnl Copyright (C) 2006-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2006-2026 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..b284e08e 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-2026 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..59496e01 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-2026 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..bdea4b97 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 49
3dnl Copyright (C) 2005-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2026 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,12 @@ 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 osf*)
61 # 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 # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
64 # 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 # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
67 CPPFLAGS="$CPPFLAGS -D_REENTRANT"
68 ;;
69 esac
70 # Some systems optimize for single-threaded programs by default, and 60 # Some systems optimize for single-threaded programs by default, and
71 # need special flags to disable these optimizations. For example, the 61 # need special flags to disable these optimizations. For example, the
72 # definition of 'errno' in <errno.h>. 62 # definition of errno in <errno.h>.
73 case "$host_os" in 63 AS_CASE([$host_os],
74 aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; 64 [aix* | freebsd*], [CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"],
75 solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; 65 [hpux* | solaris*], [CPPFLAGS="$CPPFLAGS -D_REENTRANT"])
76 esac
77 gl_anythreadlib_early_done=done 66 gl_anythreadlib_early_done=done
78 fi 67 fi
79]) 68])
@@ -85,24 +74,26 @@ AC_DEFUN([gl_WEAK_SYMBOLS],
85 AC_REQUIRE([AC_CANONICAL_HOST]) 74 AC_REQUIRE([AC_CANONICAL_HOST])
86 AC_CACHE_CHECK([whether imported symbols can be declared weak], 75 AC_CACHE_CHECK([whether imported symbols can be declared weak],
87 [gl_cv_have_weak], 76 [gl_cv_have_weak],
88 [case "$host_os" in 77 [AS_CASE([$host_os],
89 cygwin* | mingw* | windows*) 78 [cygwin* | mingw* | windows*],
79 [
90 dnl On Cygwin 3.2.0 with gcc 10.2, and likewise on mingw 10.0.0 with 80 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 81 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 82 dnl pthread_in_use() with weak symbol references crash miserably at
93 dnl runtime. 83 dnl runtime.
94 gl_cv_have_weak="guessing no" 84 gl_cv_have_weak="guessing no"
95 ;; 85 ],
96 *) 86 [
97 gl_cv_have_weak=no 87 gl_cv_have_weak=no
98 dnl First, test whether the compiler accepts it syntactically. 88 dnl First, test whether the compiler accepts it syntactically.
99 AC_LINK_IFELSE( 89 AC_LINK_IFELSE(
100 [AC_LANG_PROGRAM( 90 [AC_LANG_PROGRAM(
101 [[extern void xyzzy (); 91 [[extern void xyzzy ();
102#pragma weak xyzzy]], 92#pragma weak xyzzy
93 ]],
103 [[xyzzy();]])], 94 [[xyzzy();]])],
104 [gl_cv_have_weak=maybe]) 95 [gl_cv_have_weak=maybe])
105 if test $gl_cv_have_weak = maybe; then 96 AS_IF([test $gl_cv_have_weak = maybe], [
106 dnl Second, test whether it actually works. On Cygwin 1.7.2, with 97 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. 98 dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
108 AC_RUN_IFELSE( 99 AC_RUN_IFELSE(
@@ -125,20 +116,19 @@ int main ()
125 [gl_cv_have_weak="guessing yes"], 116 [gl_cv_have_weak="guessing yes"],
126 [gl_cv_have_weak="guessing no"]) 117 [gl_cv_have_weak="guessing no"])
127 ]) 118 ])
128 fi 119 ])
129 ;; 120 ])
130 esac 121 dnl But when linking statically, weak symbols do not work.
131 dnl But when linking statically, weak symbols don't work. 122 AS_CASE([" $LDFLAGS "],
132 case " $LDFLAGS " in 123 [*" -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 124 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 125 dnl symbol and linking against a shared library that has a dependency on
137 dnl the shared library that defines the symbol. 126 dnl the shared library that defines the symbol.
138 case "$gl_cv_have_weak" in 127 AS_CASE([$gl_cv_have_weak],
139 *yes) 128 [*yes],
140 case "$host_os" in 129 [AS_CASE([$host_os],
141 freebsd* | dragonfly* | midnightbsd*) 130 [freebsd* | dragonfly* | midnightbsd*],
131 [
142 : > conftest1.c 132 : > conftest1.c
143 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 133 $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1
144 cat <<EOF > conftest2.c 134 cat <<EOF > conftest2.c
@@ -152,17 +142,15 @@ EOF
152 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ 142 $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \
153 || gl_cv_have_weak=no 143 || gl_cv_have_weak=no
154 rm -f conftest1.c libempty.so conftest2.c conftest 144 rm -f conftest1.c libempty.so conftest2.c conftest
155 ;; 145 ])
156 esac 146 ])
157 ;;
158 esac
159 ]) 147 ])
160 case "$gl_cv_have_weak" in 148 AS_CASE([$gl_cv_have_weak],
161 *yes) 149 [*yes],
150 [
162 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], 151 AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
163 [Define to 1 if the compiler and linker support weak declarations of symbols.]) 152 [Define to 1 if the compiler and linker support weak declarations of symbols.])
164 ;; 153 ])
165 esac
166]) 154])
167 155
168dnl ============================================================================ 156dnl ============================================================================
@@ -188,36 +176,30 @@ dnl The guts of gl_PTHREADLIB. Needs to be expanded only once.
188AC_DEFUN([gl_PTHREADLIB_BODY], 176AC_DEFUN([gl_PTHREADLIB_BODY],
189[ 177[
190 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 178 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
191 if test -z "$gl_pthreadlib_body_done"; then 179 AS_IF([test -z "$gl_pthreadlib_body_done"], [
192 gl_pthread_api=no 180 gl_pthread_api=no
193 LIBPTHREAD= 181 LIBPTHREAD=
194 LIBPMULTITHREAD= 182 LIBPMULTITHREAD=
195 # 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.
197 AC_CHECK_HEADER([pthread.h], 183 AC_CHECK_HEADER([pthread.h],
198 [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) 184 [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
199 if test "$gl_have_pthread_h" = yes; then 185 AS_IF([test "$gl_have_pthread_h" = yes], [
200 # Other possible tests: 186 # Other possible tests:
201 # -lpthreads (FSU threads, PCthreads) 187 # -lpthreads (FSU threads, PCthreads)
202 # -lgthreads 188 # -lgthreads
203 # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist 189 # Test whether both pthread_mutex_lock exists in libc.
204 # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
205 # the second one only in libpthread, and lock.c needs it.
206 # 190 #
207 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 191 # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04
208 # needs -pthread for some reason. See: 192 # needs -pthread for some reason. See:
209 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html 193 # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html
210 saved_LIBS="$LIBS" 194 saved_LIBS="$LIBS"
211 for gl_pthread in '' '-pthread'; do 195 for gl_pthread in "" "-pthread"; do
212 LIBS="$LIBS $gl_pthread" 196 LIBS="$LIBS $gl_pthread"
213 AC_LINK_IFELSE( 197 AC_LINK_IFELSE(
214 [AC_LANG_PROGRAM( 198 [AC_LANG_PROGRAM(
215 [[#include <pthread.h> 199 [[#include <pthread.h>
216 pthread_mutex_t m; 200 pthread_mutex_t m;
217 pthread_mutexattr_t ma;
218 ]], 201 ]],
219 [[pthread_mutex_lock (&m); 202 [[pthread_mutex_lock (&m);]])],
220 pthread_mutexattr_init (&ma);]])],
221 [gl_pthread_api=yes 203 [gl_pthread_api=yes
222 LIBPTHREAD=$gl_pthread 204 LIBPTHREAD=$gl_pthread
223 LIBPMULTITHREAD=$gl_pthread]) 205 LIBPMULTITHREAD=$gl_pthread])
@@ -230,8 +212,9 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
230 gl_pthread_in_glibc=no 212 gl_pthread_in_glibc=no
231 # On Linux with glibc >= 2.34, libc contains the fully functional 213 # On Linux with glibc >= 2.34, libc contains the fully functional
232 # pthread functions. 214 # pthread functions.
233 case "$host_os" in 215 AS_CASE([$host_os],
234 linux*) 216 [linux*],
217 [
235 AC_EGREP_CPP([Lucky user], 218 AC_EGREP_CPP([Lucky user],
236 [#include <features.h> 219 [#include <features.h>
237 #ifdef __GNU_LIBRARY__ 220 #ifdef __GNU_LIBRARY__
@@ -242,19 +225,17 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
242 ], 225 ],
243 [gl_pthread_in_glibc=yes], 226 [gl_pthread_in_glibc=yes],
244 []) 227 [])
245 ;; 228 ])
246 esac
247 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD 229 echo "$as_me:__oline__: gl_pthread_in_glibc=$gl_pthread_in_glibc" >&AS_MESSAGE_LOG_FD
248 230
249 # Test for libpthread by looking for pthread_kill. (Not pthread_self, 231 # Test for libpthread by looking for pthread_kill.
250 # since it is defined as a macro on OSF/1.) 232 AS_IF([test $gl_pthread_api = yes && test -z "$LIBPTHREAD"], [
251 if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then
252 # The program links fine without libpthread. But it may actually 233 # The program links fine without libpthread. But it may actually
253 # need to link with libpthread in order to create multiple threads. 234 # need to link with libpthread in order to create multiple threads.
254 AC_CHECK_LIB([pthread], [pthread_kill], 235 AC_CHECK_LIB([pthread], [pthread_kill],
255 [if test $gl_pthread_in_glibc = yes; then 236 [AS_IF([test $gl_pthread_in_glibc = yes], [
256 LIBPMULTITHREAD= 237 LIBPMULTITHREAD=
257 else 238 ], [
258 LIBPMULTITHREAD=-lpthread 239 LIBPMULTITHREAD=-lpthread
259 # On Solaris and HP-UX, most pthread functions exist also in libc. 240 # On Solaris and HP-UX, most pthread functions exist also in libc.
260 # Therefore pthread_in_use() needs to actually try to create a 241 # Therefore pthread_in_use() needs to actually try to create a
@@ -262,14 +243,13 @@ AC_DEFUN([gl_PTHREADLIB_BODY],
262 # pthread_create will actually create a thread. 243 # pthread_create will actually create a thread.
263 # On Solaris 10 or newer, this test is no longer needed, because 244 # On Solaris 10 or newer, this test is no longer needed, because
264 # libc contains the fully functional pthread functions. 245 # libc contains the fully functional pthread functions.
265 case "$host_os" in 246 AS_CASE([$host_os],
266changequote(,)dnl 247 [[solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*]],
267 solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) 248 [
268changequote([,])dnl 249 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
269 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 250 [Define if the pthread_in_use() detection is hard.])
270 [Define if the pthread_in_use() detection is hard.]) 251 ])
271 esac 252 ])
272 fi
273 ], 253 ],
274 [dnl This is needed on FreeBSD 5.2.1. 254 [dnl This is needed on FreeBSD 5.2.1.
275 AC_CHECK_LIB([thr], [pthread_kill], 255 AC_CHECK_LIB([thr], [pthread_kill],
@@ -280,35 +260,36 @@ changequote([,])dnl
280 fi 260 fi
281 ]) 261 ])
282 ]) 262 ])
283 elif test $gl_pthread_api != yes; then 263 ], [test $gl_pthread_api != yes], [
284 # Some library is needed. Try libpthread and libc_r. 264 # Some library is needed. Try libpthread and libc_r.
285 AC_CHECK_LIB([pthread], [pthread_kill], 265 AC_CHECK_LIB([pthread], [pthread_kill],
286 [gl_pthread_api=yes 266 [gl_pthread_api=yes
287 LIBPTHREAD=-lpthread 267 LIBPTHREAD=-lpthread
288 LIBPMULTITHREAD=-lpthread]) 268 LIBPMULTITHREAD=-lpthread])
289 if test $gl_pthread_api != yes; then 269 AS_IF([test $gl_pthread_api != yes], [
290 # For FreeBSD 4. 270 # For FreeBSD 4.
291 AC_CHECK_LIB([c_r], [pthread_kill], 271 AC_CHECK_LIB([c_r], [pthread_kill],
292 [gl_pthread_api=yes 272 [gl_pthread_api=yes
293 LIBPTHREAD=-lc_r 273 LIBPTHREAD=-lc_r
294 LIBPMULTITHREAD=-lc_r]) 274 LIBPMULTITHREAD=-lc_r])
295 fi 275 ])
296 fi 276 ])
297 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD 277 echo "$as_me:__oline__: LIBPMULTITHREAD=$LIBPMULTITHREAD" >&AS_MESSAGE_LOG_FD
298 fi 278 ])
299 AC_MSG_CHECKING([whether POSIX threads API is available]) 279 AC_MSG_CHECKING([whether POSIX threads API is available])
300 AC_MSG_RESULT([$gl_pthread_api]) 280 AC_MSG_RESULT([$gl_pthread_api])
301 AC_SUBST([LIBPTHREAD]) 281 AC_SUBST([LIBPTHREAD])
302 AC_SUBST([LIBPMULTITHREAD]) 282 AC_SUBST([LIBPMULTITHREAD])
303 if test $gl_pthread_api = yes; then 283 AS_IF([test $gl_pthread_api = yes], [
304 AC_DEFINE([HAVE_PTHREAD_API], [1], 284 AC_DEFINE([HAVE_PTHREAD_API], [1],
305 [Define if you have the <pthread.h> header and the POSIX threads API.]) 285 [Define if you have the <pthread.h> header and the POSIX threads API.])
306 fi 286 ])
307 287
308 dnl On some systems, sched_yield is in librt, rather than in libpthread. 288 dnl On some systems, sched_yield is in librt, rather than in libpthread.
309 AC_LINK_IFELSE( 289 AC_LINK_IFELSE(
310 [AC_LANG_PROGRAM( 290 [AC_LANG_PROGRAM(
311 [[#include <sched.h>]], 291 [[#include <sched.h>
292 ]],
312 [[sched_yield ();]])], 293 [[sched_yield ();]])],
313 [SCHED_YIELD_LIB= 294 [SCHED_YIELD_LIB=
314 ], 295 ],
@@ -323,7 +304,7 @@ changequote([,])dnl
323 AC_SUBST([LIB_SCHED_YIELD]) 304 AC_SUBST([LIB_SCHED_YIELD])
324 305
325 gl_pthreadlib_body_done=done 306 gl_pthreadlib_body_done=done
326 fi 307 ])
327]) 308])
328 309
329AC_DEFUN([gl_PTHREADLIB], 310AC_DEFUN([gl_PTHREADLIB],
@@ -350,44 +331,45 @@ AC_DEFUN([gl_STDTHREADLIB_BODY],
350[ 331[
351 AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) 332 AC_REQUIRE([gl_ANYTHREADLIB_EARLY])
352 AC_REQUIRE([AC_CANONICAL_HOST]) 333 AC_REQUIRE([AC_CANONICAL_HOST])
353 if test -z "$gl_stdthreadlib_body_done"; then 334 AS_IF([test -z "$gl_stdthreadlib_body_done"], [
354 AC_CHECK_HEADERS_ONCE([threads.h]) 335 AC_CHECK_HEADERS_ONCE([threads.h])
355 336
356 case "$host_os" in 337 AS_CASE([$host_os],
357 mingw* | windows*) 338 [mingw* | windows*],
339 [
358 LIBSTDTHREAD= 340 LIBSTDTHREAD=
359 ;; 341 ],
360 *) 342 [
361 gl_PTHREADLIB_BODY 343 gl_PTHREADLIB_BODY
362 if test $ac_cv_header_threads_h = yes; then 344 AS_IF([test $ac_cv_header_threads_h = yes], [
363 dnl glibc >= 2.29 has thrd_create in libpthread. 345 dnl glibc >= 2.29 has thrd_create in libpthread.
364 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends 346 dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends
365 dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). 347 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 348 dnl glibc >= 2.34, AIX >= 7.1, and Solaris >= 11.4 have thrd_create in
367 dnl libc. 349 dnl libc.
368 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>]]) 350 gl_CHECK_FUNCS_ANDROID([thrd_create], [[#include <threads.h>
369 if test $ac_cv_func_thrd_create = yes; then 351 ]])
352 AS_IF([test $ac_cv_func_thrd_create = yes], [
370 LIBSTDTHREAD= 353 LIBSTDTHREAD=
371 else 354 ], [
372 AC_CHECK_LIB([stdthreads], [thrd_create], [ 355 AC_CHECK_LIB([stdthreads], [thrd_create], [
373 LIBSTDTHREAD='-lstdthreads -lpthread' 356 LIBSTDTHREAD="-lstdthreads -lpthread"
374 ], [ 357 ], [
375 dnl Guess that thrd_create is in libpthread. 358 dnl Guess that thrd_create is in libpthread.
376 LIBSTDTHREAD="$LIBPMULTITHREAD" 359 LIBSTDTHREAD="$LIBPMULTITHREAD"
377 ]) 360 ])
378 fi 361 ])
379 else 362 ], [
380 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. 363 dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c.
381 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB" 364 LIBSTDTHREAD="$LIBPMULTITHREAD $SCHED_YIELD_LIB"
382 fi 365 ])
383 ;; 366 ])
384 esac
385 AC_SUBST([LIBSTDTHREAD]) 367 AC_SUBST([LIBSTDTHREAD])
386 368
387 AC_MSG_CHECKING([whether ISO C threads API is available]) 369 AC_MSG_CHECKING([whether ISO C threads API is available])
388 AC_MSG_RESULT([$ac_cv_header_threads_h]) 370 AC_MSG_RESULT([$ac_cv_header_threads_h])
389 gl_stdthreadlib_body_done=done 371 gl_stdthreadlib_body_done=done
390 fi 372 ])
391]) 373])
392 374
393AC_DEFUN([gl_STDTHREADLIB], 375AC_DEFUN([gl_STDTHREADLIB],
@@ -404,7 +386,7 @@ dnl ------------
404dnl Tests for a multithreading library to be used. 386dnl Tests for a multithreading library to be used.
405dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO 387dnl 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 388dnl (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 389dnl 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 390dnl can change the choice through the options --enable-threads=choice or
409dnl --disable-threads. 391dnl --disable-threads.
410dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, 392dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS,
@@ -449,51 +431,46 @@ AC_DEFUN([gl_THREADLIB_EARLY_BODY],
449 m4_ifdef([gl_THREADLIB_DEFAULT_NO], 431 m4_ifdef([gl_THREADLIB_DEFAULT_NO],
450 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], 432 [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])],
451 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) 433 [m4_divert_text([DEFAULTS], [gl_use_threads_default=])])
452 dnl gl_use_winpthreads_default defaults to 'no', because in mingw 10, like 434 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. 435 dnl in mingw 5, the use of libwinpthread still makes test-pthread-tss crash.
454 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no]) 436 m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=no])
437 dnl Don't display the --disable-threads option
438 dnl - if the package builds one or more libraries, because libraries must
439 dnl always be multithread-safe (as far as possible),
440 dnl - if the package defines gl_THREADLIB_DEFAULT_NO, because the option
441 dnl would then be a no-op.
455 AC_ARG_ENABLE([threads], 442 AC_ARG_ENABLE([threads],
456AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ 443AS_HELP_STRING([[--enable-threads={isoc|posix|isoc+posix|windows}]], [specify multithreading API])m4_ifdef([LT_INIT], [], [m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [
457AS_HELP_STRING([[--disable-threads]], [build without multithread safety])]), 444AS_HELP_STRING([[--disable-threads]], [build without multithread safety])])]),
458 [gl_use_threads=$enableval], 445 [gl_use_threads=$enableval],
459 [if test -n "$gl_use_threads_default"; then 446 [if test -n "$gl_use_threads_default"; then
460 gl_use_threads="$gl_use_threads_default" 447 gl_use_threads="$gl_use_threads_default"
461 else 448 else
462changequote(,)dnl 449 AS_CASE([$host_os],
463 case "$host_os" in
464 dnl Disable multithreading by default on OSF/1, because it interferes
465 dnl with fork()/exec(): When msgexec is linked with -lpthread, its
466 dnl child process gets an endless segmentation fault inside execvp().
467 osf*) gl_use_threads=no ;;
468 dnl Disable multithreading by default on Cygwin 1.5.x, because it has 450 dnl Disable multithreading by default on Cygwin 1.5.x, because it has
469 dnl bugs that lead to endless loops or crashes. See 451 dnl bugs that lead to endless loops or crashes. See
470 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>. 452 dnl <https://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
471 cygwin*) 453 [cygwin*],
472 case `uname -r` in 454 [AS_CASE([$(uname -r)],
473 1.[0-5].*) gl_use_threads=no ;; 455 [[1.[0-5].*]], [gl_use_threads=no],
474 *) gl_use_threads=yes ;; 456 [gl_use_threads=yes])
475 esac 457 ],
476 ;;
477 dnl Obey gl_AVOID_WINPTHREAD on mingw. 458 dnl Obey gl_AVOID_WINPTHREAD on mingw.
478 mingw* | windows*) 459 [mingw* | windows*],
479 case "$gl_use_winpthreads_default" in 460 [AS_CASE([$gl_use_winpthreads_default],
480 yes) gl_use_threads=posix ;; 461 [yes], [gl_use_threads=posix],
481 no) gl_use_threads=windows ;; 462 [no], [gl_use_threads=windows],
482 *) gl_use_threads=yes ;; 463 [gl_use_threads=yes])
483 esac 464 ],
484 ;; 465 [gl_use_threads=yes])
485 *) gl_use_threads=yes ;;
486 esac
487changequote([,])dnl
488 fi 466 fi
489 ]) 467 ])
490 if test "$gl_use_threads" = yes \ 468 AS_CASE([$gl_use_threads],
491 || test "$gl_use_threads" = isoc \ 469 [yes | isoc | posix | isoc+posix],
492 || test "$gl_use_threads" = posix \ 470 [
493 || test "$gl_use_threads" = isoc+posix; then 471 # For using <threads.h> or <pthread.h>:
494 # For using <threads.h> or <pthread.h>: 472 gl_ANYTHREADLIB_EARLY
495 gl_ANYTHREADLIB_EARLY 473 ])
496 fi
497]) 474])
498 475
499dnl The guts of gl_THREADLIB. Needs to be expanded only once. 476dnl The guts of gl_THREADLIB. Needs to be expanded only once.
@@ -506,90 +483,95 @@ AC_DEFUN([gl_THREADLIB_BODY],
506 LTLIBTHREAD= 483 LTLIBTHREAD=
507 LIBMULTITHREAD= 484 LIBMULTITHREAD=
508 LTLIBMULTITHREAD= 485 LTLIBMULTITHREAD=
509 if test "$gl_use_threads" != no; then 486 AS_IF([test "$gl_use_threads" = no],
487 [AC_DEFINE([AVOID_ANY_THREADS], [1],
488 [Define if no multithread safety and no multithreading is desired.])],
489 [
510 dnl Check whether the compiler and linker support weak declarations. 490 dnl Check whether the compiler and linker support weak declarations.
511 gl_WEAK_SYMBOLS 491 gl_WEAK_SYMBOLS
512 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 492 AS_CASE([$gl_cv_have_weak],
513 dnl If we use weak symbols to implement pthread_in_use / pth_in_use / 493 [*yes],
514 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create 494 [
515 dnl facility is in use. 495 dnl If we use weak symbols to implement pthread_in_use / pth_in_use /
516 AC_CHECK_HEADERS_ONCE([threads.h]) 496 dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create
517 : 497 dnl facility is in use.
518 fi 498 AC_CHECK_HEADERS_ONCE([threads.h])
519 if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then 499 :
520 AC_CHECK_HEADERS_ONCE([threads.h]) 500 ])
521 gl_have_isoc_threads="$ac_cv_header_threads_h" 501 AS_CASE([$gl_use_threads],
522 fi 502 [isoc | isoc+posix],
523 if test "$gl_use_threads" = yes \ 503 [
524 || test "$gl_use_threads" = posix \ 504 AC_CHECK_HEADERS_ONCE([threads.h])
525 || test "$gl_use_threads" = isoc+posix; then 505 gl_have_isoc_threads="$ac_cv_header_threads_h"
526 gl_PTHREADLIB_BODY 506 ])
527 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD 507 AS_CASE([$gl_use_threads],
528 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD 508 [yes | posix | isoc+posix],
529 if test $gl_pthread_api = yes; then 509 [
530 if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then 510 gl_PTHREADLIB_BODY
531 gl_threads_api='isoc+posix' 511 LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD
532 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], 512 LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD
533 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) 513 AS_IF([test $gl_pthread_api = yes], [
534 LIBTHREAD= LTLIBTHREAD= 514 AS_IF([test "$gl_use_threads" = isoc+posix &&
535 else 515 test "$gl_have_isoc_threads" = yes], [
536 gl_threads_api=posix 516 gl_threads_api="isoc+posix"
537 AC_DEFINE([USE_POSIX_THREADS], [1], 517 AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1],
538 [Define if the POSIX multithreading library can be used.]) 518 [Define if the combination of the ISO C and POSIX multithreading APIs can be used.])
539 if test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"; then 519 LIBTHREAD= LTLIBTHREAD=
540 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1], 520 ], [
541 [Define if references to the POSIX multithreading library are satisfied by libc.]) 521 gl_threads_api=posix
542 else 522 AC_DEFINE([USE_POSIX_THREADS], [1],
543 if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then 523 [Define if the POSIX multithreading library can be used.])
544 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], 524 AS_IF([test -z "$LIBMULTITHREAD" && test -z "$LTLIBMULTITHREAD"], [
545 [Define if references to the POSIX multithreading library should be made weak.]) 525 AC_DEFINE([USE_POSIX_THREADS_FROM_LIBC], [1],
546 LIBTHREAD= LTLIBTHREAD= 526 [Define if references to the POSIX multithreading library are satisfied by libc.])
547 else 527 ], [
548 case "$host_os" in 528 AS_CASE([$gl_cv_have_weak],
549 freebsd* | dragonfly* | midnightbsd*) 529 [*yes],
550 if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then 530 [
551 dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() 531 AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
552 dnl etc. will succeed, we need a runtime test. 532 [Define if references to the POSIX multithreading library should be made weak.])
553 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], 533 LIBTHREAD= LTLIBTHREAD=
554 [Define if the pthread_in_use() detection is hard.]) 534 ],
555 fi 535 [AS_CASE([$host_os],
556 ;; 536 [freebsd* | dragonfly* | midnightbsd*],
557 esac 537 [
558 fi 538 AS_IF([test "x$LIBTHREAD" != "x$LIBMULTITHREAD"], [
559 fi 539 dnl If weak symbols cannot tell whether
560 fi 540 dnl pthread_create(), dnl pthread_key_create()
561 fi 541 dnl etc. will succeed, we need a runtime test.
562 fi 542 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
563 if test $gl_threads_api = none; then 543 [Define if the pthread_in_use() detection is hard.])
564 if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then 544 ])
545 ])
546 ])
547 ])
548 ])
549 ])
550 ])
551 AS_IF([test $gl_threads_api = none], [
552 AS_IF([test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes], [
565 gl_STDTHREADLIB_BODY 553 gl_STDTHREADLIB_BODY
566 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD 554 LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD
567 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD 555 LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD
568 gl_threads_api=isoc 556 gl_threads_api=isoc
569 AC_DEFINE([USE_ISOC_THREADS], [1], 557 AC_DEFINE([USE_ISOC_THREADS], [1],
570 [Define if the ISO C multithreading library can be used.]) 558 [Define if the ISO C multithreading library can be used.])
571 fi 559 ])
572 fi 560 ])
573 if test $gl_threads_api = none; then 561 AS_IF([test $gl_threads_api = none], [
574 case "$gl_use_threads" in 562 # The "win32" is for backward compatibility.
575 yes | windows | win32) # The 'win32' is for backward compatibility. 563 AS_CASE([$gl_use_threads],
576 if { case "$host_os" in 564 [yes | windows | win32],
577 mingw* | windows*) true;; 565 [AS_CASE([$host_os],
578 *) false;; 566 [mingw* | windows*],
579 esac 567 [
580 }; then 568 gl_threads_api=windows
581 gl_threads_api=windows 569 AC_DEFINE([USE_WINDOWS_THREADS], [1],
582 AC_DEFINE([USE_WINDOWS_THREADS], [1], 570 [Define if the native Windows multithreading API can be used.])
583 [Define if the native Windows multithreading API can be used.]) 571 ])
584 fi 572 ])
585 ;; 573 ])
586 esac 574 ])
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]) 575 AC_MSG_CHECKING([for multithread API to use])
594 AC_MSG_RESULT([$gl_threads_api]) 576 AC_MSG_RESULT([$gl_threads_api])
595 AC_SUBST([LIBTHREAD]) 577 AC_SUBST([LIBTHREAD])
@@ -609,7 +591,7 @@ dnl gl_DISABLE_THREADS
609dnl ------------------ 591dnl ------------------
610dnl Sets the gl_THREADLIB default so that threads are not used by default. 592dnl 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 593dnl The user can still override it at installation time, by using the
612dnl configure option '--enable-threads'. 594dnl configure option "--enable-threads".
613 595
614AC_DEFUN([gl_DISABLE_THREADS], [ 596AC_DEFUN([gl_DISABLE_THREADS], [
615 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) 597 m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
@@ -621,7 +603,7 @@ dnl -------------------
621dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the 603dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the
622dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. 604dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided.
623dnl The user can still override it at installation time, by using the 605dnl The user can still override it at installation time, by using the
624dnl configure option '--enable-threads=posix'. 606dnl configure option "--enable-threads=posix".
625dnl As of 2023, this is now the default. 607dnl As of 2023, this is now the default.
626 608
627AC_DEFUN([gl_AVOID_WINPTHREAD], [ 609AC_DEFUN([gl_AVOID_WINPTHREAD], [
@@ -667,13 +649,8 @@ dnl
667dnl HP-UX 11 posix -lpthread N (cc) OK 649dnl HP-UX 11 posix -lpthread N (cc) OK
668dnl Y (gcc) 650dnl Y (gcc)
669dnl 651dnl
670dnl IRIX 6.5 posix -lpthread Y 0.5
671dnl
672dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK 652dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK
673dnl 653dnl
674dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK
675dnl -lpthread (gcc) Y
676dnl
677dnl Cygwin posix -lpthread Y OK 654dnl Cygwin posix -lpthread Y OK
678dnl 655dnl
679dnl Mingw windows N OK 656dnl Mingw windows N OK
diff --git a/gl/m4/time_h.m4 b/gl/m4/time_h.m4
index d2f3c970..8d896ea5 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-2026 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..59477e3b 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-2026 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..50a98b25 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-2026 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..20b63b6c
--- /dev/null
+++ b/gl/m4/uchar_h.m4
@@ -0,0 +1,279 @@
1# uchar_h.m4
2# serial 32
3dnl Copyright (C) 2019-2026 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..299c43f2 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-2026 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..71dccf06
--- /dev/null
+++ b/gl/m4/unicase_h.m4
@@ -0,0 +1,45 @@
1# unicase_h.m4
2# serial 1
3dnl Copyright (C) 2023-2026 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..ba5a3688
--- /dev/null
+++ b/gl/m4/unictype_h.m4
@@ -0,0 +1,179 @@
1# unictype_h.m4
2# serial 4
3dnl Copyright (C) 2023-2026 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..5ec9ea67
--- /dev/null
+++ b/gl/m4/uninorm_h.m4
@@ -0,0 +1,47 @@
1# uninorm_h.m4
2# serial 1
3dnl Copyright (C) 2023-2026 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..8000e888 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-2026 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..733b9ee2
--- /dev/null
+++ b/gl/m4/unitypes_h.m4
@@ -0,0 +1,26 @@
1# unitypes_h.m4
2# serial 1
3dnl Copyright (C) 2021-2026 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..16ab6e9a 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 17
3dnl Copyright (C) 1998-2006, 2009-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 1998-2006, 2009-2026 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
@@ -24,6 +25,7 @@ AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
24 AC_CHECK_DECLS_ONCE([ferror_unlocked]) 25 AC_CHECK_DECLS_ONCE([ferror_unlocked])
25 AC_CHECK_DECLS_ONCE([fflush_unlocked]) 26 AC_CHECK_DECLS_ONCE([fflush_unlocked])
26 AC_CHECK_DECLS_ONCE([fgets_unlocked]) 27 AC_CHECK_DECLS_ONCE([fgets_unlocked])
28 AC_CHECK_DECLS_ONCE([fileno_unlocked])
27 AC_CHECK_DECLS_ONCE([fputc_unlocked]) 29 AC_CHECK_DECLS_ONCE([fputc_unlocked])
28 AC_CHECK_DECLS_ONCE([fputs_unlocked]) 30 AC_CHECK_DECLS_ONCE([fputs_unlocked])
29 AC_CHECK_DECLS_ONCE([fread_unlocked]) 31 AC_CHECK_DECLS_ONCE([fread_unlocked])
diff --git a/gl/m4/vararrays.m4 b/gl/m4/vararrays.m4
index 9211f69d..3dd8e68f 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-2026 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..4e01fbc9 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-2026 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..3e6913e2 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-2026 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..55ceb672 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-2026 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..df767486 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-2026 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..3765368c 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-2026 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..42338a00 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 66
3dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2007-2026 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
@@ -64,8 +65,8 @@ dnl Check whether <wchar.h> is usable at all.
64AC_DEFUN([gl_WCHAR_H_INLINE_OK], 65AC_DEFUN([gl_WCHAR_H_INLINE_OK],
65[ 66[
66 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to 67 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
67 dnl 'gnu_inline'. See <https://sourceware.org/bugzilla/show_bug.cgi?id=4022> 68 dnl 'gnu_inline'. See <https://sourceware.org/PR4022>
68 dnl and <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary, 69 dnl and <https://gcc.gnu.org/PR42440>. In summary,
69 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and 70 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
70 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>. 71 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
71 AC_REQUIRE([AC_CANONICAL_HOST]) 72 AC_REQUIRE([AC_CANONICAL_HOST])
@@ -238,7 +239,7 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS],
238 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK]) 239 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
239 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH]) 240 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
240 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME]) 241 HAVE_WCSFTIME=1; AC_SUBST([HAVE_WCSFTIME])
241 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) 242 HAVE_WCTOB=1; AC_SUBST([HAVE_WCTOB])
242 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP]) 243 HAVE_DECL_WCSDUP=1; AC_SUBST([HAVE_DECL_WCSDUP])
243 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) 244 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
244 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) 245 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
@@ -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..a69f17c4 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 22
3dnl Copyright (C) 2008-2024 Free Software Foundation, Inc. 3dnl Copyright (C) 2008-2026 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[
@@ -32,11 +33,11 @@ AC_DEFUN([gl_FUNC_WCRTOMB],
32 dnl fi 33 dnl fi
33 if test $REPLACE_WCRTOMB = 0; then 34 if test $REPLACE_WCRTOMB = 0; then
34 dnl On Android 4.3, wcrtomb produces wrong characters in the C locale. 35 dnl On Android 4.3, wcrtomb produces wrong characters in the C locale.
35 dnl On AIX 4.3, OSF/1 5.1 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL) 36 dnl On AIX 4.3 and Solaris <= 11.3, wcrtomb (NULL, 0, NULL)
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
@@ -82,15 +83,15 @@ int main ()
82 dnl is present. 83 dnl is present.
83changequote(,)dnl 84changequote(,)dnl
84 case "$host_os" in 85 case "$host_os" in
85 # Guess no on AIX 4, OSF/1, Solaris, native Windows. 86 # Guess no on AIX 4, Solaris, native Windows.
86 aix4* | osf* | solaris* | mingw* | windows*) 87 aix4* | solaris* | mingw* | windows*)
87 gl_cv_func_wcrtomb_retval="guessing no" ;; 88 gl_cv_func_wcrtomb_retval="guessing no" ;;
88 # Guess yes otherwise. 89 # Guess yes otherwise.
89 *) 90 *)
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..6a6cb3a4 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-2026 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..12b4c618 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-2026 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..515076ba
--- /dev/null
+++ b/gl/m4/wcwidth.m4
@@ -0,0 +1,116 @@
1# wcwidth.m4
2# serial 39
3dnl Copyright (C) 2006-2026 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,
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..384462d2 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-2026 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..a0d0f060 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-2026 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..4e35a5fe 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-2026 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..fed091ca 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-2026 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