summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2025-06-27 22:32:33 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2025-06-27 23:06:40 -0700
commitdbdf761187d7cccfad20a2899bab3dc77f379c3a (patch)
treed4e160b187f6f56e27dad185dfdd4cb955c4ec80 /m4
parent68100ca656ad76e937622a1a74b6ca185bc82e07 (diff)
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4')
-rw-r--r--m4/acl.m416
-rw-r--r--m4/gnulib-common.m457
-rw-r--r--m4/gnulib-comp.m48
-rw-r--r--m4/libgmp.m48
-rw-r--r--m4/open.m45
-rw-r--r--m4/stdckdint_h.m4136
-rw-r--r--m4/stddef_h.m418
7 files changed, 196 insertions, 52 deletions
diff --git a/m4/acl.m4 b/m4/acl.m4
index 7e4b0e354d9..2dd33497efd 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,5 +1,5 @@
# acl.m4
-# serial 35
+# serial 37
dnl Copyright (C) 2002, 2004-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,6 @@ dnl This file is offered as-is, without any warranty.
AC_DEFUN([gl_FUNC_ACL_ARG],
[
- gl_need_lib_has_acl=
AC_ARG_ENABLE([acl],
AS_HELP_STRING([[--disable-acl]], [do not support ACLs]),
, [enable_acl=auto])
@@ -22,6 +21,7 @@ AC_DEFUN([gl_FUNC_ACL_ARG],
[], [with_libsmack=maybe])
])
+# Prerequisites of module acl-permissions.
AC_DEFUN_ONCE([gl_FUNC_ACL],
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
@@ -145,9 +145,6 @@ int type = ACL_TYPE_EXTENDED;]])],
AC_MSG_WARN([AC_PACKAGE_NAME will be built without ACL support.])
fi
fi
- if test -n "$gl_need_lib_has_acl"; then
- FILE_HAS_ACL_LIB=$LIB_ACL
- fi
AC_SUBST([LIB_ACL])
AC_DEFINE_UNQUOTED([USE_ACL], [$use_acl],
[Define to nonzero if you want access control list support.])
@@ -187,6 +184,7 @@ AC_DEFUN([gl_ACL_GET_FILE],
AC_DEFUN([gl_FILE_HAS_ACL],
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
+ AC_REQUIRE([gl_FUNC_ACL])
# On GNU/Linux, testing if a file has an acl can be done with the
# listxattr and getxattr syscalls, which don't require linking
# against additional libraries. Assume this works if linux/attr.h
@@ -224,10 +222,7 @@ AC_DEFUN([gl_FILE_HAS_ACL],
AS_CASE([$enable_acl,$gl_file_has_acl_uses_selinux,$gl_file_has_acl_uses_smack],
[no,* | *,yes,* | *,yes], [],
[*],
- [dnl Set gl_need_lib_has_acl to a nonempty value, so that any
- dnl later gl_FUNC_ACL call will set FILE_HAS_ACL_LIB=$LIB_ACL.
- gl_need_lib_has_acl=1
- FILE_HAS_ACL_LIB=$LIB_ACL])
+ [FILE_HAS_ACL_LIB=$LIB_ACL])
AC_SUBST([FILE_HAS_ACL_LIB])
])
@@ -235,10 +230,11 @@ AC_DEFUN([gl_FILE_HAS_ACL],
AC_DEFUN([gl_QCOPY_ACL],
[
AC_REQUIRE([gl_FUNC_ACL])
+ AC_REQUIRE([gl_FILE_HAS_ACL])
AC_CHECK_HEADERS_ONCE([linux/xattr.h])
gl_FUNC_XATTR
if test "$use_xattr" = yes; then
- QCOPY_ACL_LIB="$LIB_XATTR"
+ QCOPY_ACL_LIB="$LIB_XATTR $FILE_HAS_ACL_LIB"
else
QCOPY_ACL_LIB="$LIB_ACL"
fi
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index a07c7dd5a89..d525d8b1faa 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,5 +1,5 @@
# gnulib-common.m4
-# serial 110
+# serial 112
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -57,33 +57,24 @@ AC_DEFUN([gl_COMMON_BODY], [
#endif
])
AH_VERBATIM([_Noreturn],
-[/* The _Noreturn keyword of C11. */
+[/* The _Noreturn keyword of C11.
+ Do not use [[noreturn]], because with it the syntax
+ extern _Noreturn void func (...);
+ would not be valid; such a declaration would be valid only with 'extern'
+ and '_Noreturn' swapped, or without the 'extern' keyword. However, some
+ AIX system header files and several gnulib header files use precisely
+ this syntax with 'extern'. So even though C23 deprecates _Noreturn,
+ it is currently more portable to prefer it to [[noreturn]].
+
+ Also, do not try to work around LLVM bug 59792 (clang 15 or earlier).
+ This rare bug can be worked around by compiling with 'clang -D_Noreturn=',
+ though the workaround may generate many false-alarm warnings. */
#ifndef _Noreturn
-# if (defined __cplusplus \
- && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
- || (defined _MSC_VER && 1900 <= _MSC_VER)) \
- && 0)
- /* [[noreturn]] is not practically usable, because with it the syntax
- extern _Noreturn void func (...);
- would not be valid; such a declaration would only be valid with 'extern'
- and '_Noreturn' swapped, or without the 'extern' keyword. However, some
- AIX system header files and several gnulib header files use precisely
- this syntax with 'extern'. */
-# define _Noreturn [[noreturn]]
-# elif (defined __clang__ && __clang_major__ < 16 \
- && defined _GL_WORK_AROUND_LLVM_BUG_59792)
- /* Compile with -D_GL_WORK_AROUND_LLVM_BUG_59792 to work around
- that rare LLVM bug, though you may get many false-alarm warnings. */
-# define _Noreturn
-# elif ((!defined __cplusplus || defined __clang__) \
- && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
- || (!defined __STRICT_ANSI__ \
- && (_GL_GNUC_PREREQ (4, 7) \
- || (defined __apple_build_version__ \
- ? 6000000 <= __apple_build_version__ \
- : 3 < __clang_major__ + (5 <= __clang_minor__))))))
+# if 201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)
/* _Noreturn works as-is. */
# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
+ /* Prefer __attribute__ ((__noreturn__)) to plain _Noreturn even if the
+ latter works, as 'gcc -std=gnu99 -Wpedantic' warns about _Noreturn. */
# define _Noreturn __attribute__ ((__noreturn__))
# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
# define _Noreturn __declspec (noreturn)
@@ -955,8 +946,8 @@ AC_DEFUN([gl_COMMON_BODY], [
-1 if n1 < n2
The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional
jump with nearly all GCC versions up to GCC 10.
- This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many
- GCC versions up to GCC 9.
+ This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional jump with
+ many GCC versions up to GCC 9.
The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9
avoids conditional jumps in all GCC versions >= 3.4. */
#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2)))
@@ -1571,13 +1562,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
if test $[ac_cv_func_][$1] = yes; then
[gl_cv_onwards_func_][$1]=yes
else
+ dnl This is a bit complicated, because here we need the behaviour
+ dnl of AC_CHECK_DECL before the
+ dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb (2025-05-26).
+ [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
unset [ac_cv_have_decl_][$1]
+ ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
+ ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
+ ac_c_future_darwin_options=
+ ac_cxx_future_darwin_options=
AC_CHECK_DECL([$1], , , [$2])
+ ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
+ ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
if test $[ac_cv_have_decl_][$1] = yes; then
[gl_cv_onwards_func_][$1]='future OS version'
else
[gl_cv_onwards_func_][$1]=no
fi
+ [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
+ unset [ac_cv_have_decl_][$1][_saved]
fi
else
AC_CHECK_FUNC([$1])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 97db7d32a66..7e6a8a5494f 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -547,12 +547,7 @@ AC_DEFUN([gl_INIT],
GL_STDC_LEADING_ZEROS=1
AC_REQUIRE([gl_STDBIT_H])
GL_STDC_TRAILING_ZEROS=1
- AC_CHECK_HEADERS_ONCE([stdckdint.h])
- if test $ac_cv_header_stdckdint_h = yes; then
- GL_GENERATE_STDCKDINT_H=false
- else
- GL_GENERATE_STDCKDINT_H=true
- fi
+ gl_STDCKDINT_H
gl_CONDITIONAL_HEADER([stdckdint.h])
AC_PROG_MKDIR_P
gl_STDDEF_H
@@ -1558,6 +1553,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/std-gnu11.m4
m4/stdalign.m4
m4/stdbit_h.m4
+ m4/stdckdint_h.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdio_h.m4
diff --git a/m4/libgmp.m4 b/m4/libgmp.m4
index baed8ab1a0a..abf677949dd 100644
--- a/m4/libgmp.m4
+++ b/m4/libgmp.m4
@@ -1,5 +1,5 @@
# libgmp.m4
-# serial 8
+# serial 9
# Configure the GMP library or a replacement.
dnl Copyright 2020-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -34,7 +34,11 @@ AC_DEFUN([gl_LIBGMP],
# include <gmp.h>
#else
# include <gmp/gmp.h>
- #endif],
+ #endif
+ #if ! (6 < __GNU_MP_VERSION + (2 <= __GNU_MP_VERSION_MINOR))
+ # error "GMP < 6.2.0, so mpz_probab_prime_p lacks Baillie-PSW"
+ #endif
+ ],
[static const mp_limb_t x[2] = { 0x73, 0x55 };
mpz_t tmp;
mpz_roinit_n (tmp, x, 2);
diff --git a/m4/open.m4 b/m4/open.m4
index 2bceddbdbe3..dd3a805f5e9 100644
--- a/m4/open.m4
+++ b/m4/open.m4
@@ -1,5 +1,5 @@
# open.m4
-# serial 16
+# serial 17
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,9 @@ AC_DEFUN([gl_FUNC_OPEN],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_PREPROC_O_CLOEXEC])
+ AC_REQUIRE([gl_FCNTL_O_FLAGS])
+ AS_CASE([$gl_cv_header_working_fcntl_h],
+ [*O_DIRECTORY* | *no], [REPLACE_OPEN=1])
case "$host_os" in
mingw* | windows* | pw*)
REPLACE_OPEN=1
diff --git a/m4/stdckdint_h.m4 b/m4/stdckdint_h.m4
new file mode 100644
index 00000000000..d269faa5c92
--- /dev/null
+++ b/m4/stdckdint_h.m4
@@ -0,0 +1,136 @@
+# stdckdint_h.m4
+# serial 1
+dnl Copyright 2025 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
+
+dnl Written by Collin Funk.
+
+AC_DEFUN_ONCE([gl_STDCKDINT_H],
+[
+ gl_CHECK_NEXT_HEADERS([stdckdint.h])
+ if test $ac_cv_header_stdckdint_h = yes; then
+ HAVE_STDCKDINT_H=1
+ else
+ HAVE_STDCKDINT_H=0
+ fi
+ AC_SUBST([HAVE_STDCKDINT_H])
+
+ if test $HAVE_STDCKDINT_H = 1; then
+ AC_CACHE_CHECK([whether stdckdint.h can be included in C],
+ [gl_cv_header_c_stdckdint_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdckdint.h>
+ ]])],
+ [gl_cv_header_c_stdckdint_h=yes],
+ [gl_cv_header_c_stdckdint_h=no])])
+ if test $gl_cv_header_c_stdckdint_h = yes; then
+ HAVE_C_STDCKDINT_H=1
+ AC_CACHE_CHECK([checking for an ISO C23 compliant stdckdint.h in C],
+ [gl_cv_header_c_stdckdint_h_works],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <stdckdint.h>
+ ]],
+ [[int r;
+ int a = 1;
+ int b = 1;
+ return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b)
+ || ckd_mul (&r, a, b));
+ ]])],
+ [gl_cv_header_c_stdckdint_h_works=yes],
+ [gl_cv_header_c_stdckdint_h_works=no])])
+ if test $gl_cv_header_c_stdckdint_h_works = yes; then
+ HAVE_WORKING_C_STDCKDINT_H=1
+ else
+ HAVE_WORKING_C_STDCKDINT_H=0
+ fi
+ else
+ HAVE_C_STDCKDINT_H=0
+ HAVE_WORKING_C_STDCKDINT_H=0
+ fi
+ if test "$CXX" != no; then
+ AC_CACHE_CHECK([whether stdckdint.h can be included in C++],
+ [gl_cv_header_cxx_stdckdint_h],
+ [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
+ dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
+ cat > conftest.cpp <<\EOF
+#include <stdckdint.h>
+EOF
+ gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
+ if AC_TRY_EVAL([gl_command]); then
+ gl_cv_header_cxx_stdckdint_h=yes
+ else
+ gl_cv_header_cxx_stdckdint_h=no
+ fi
+ rm -fr conftest*
+ ])
+ if test $gl_cv_header_cxx_stdckdint_h = yes; then
+ HAVE_CXX_STDCKDINT_H=1
+ AC_CACHE_CHECK([checking for an ISO C++26 compliant stdckdint.h in C++],
+ [gl_cv_header_cxx_stdckdint_h_works],
+ [dnl We can't use AC_LANG_PUSH([C++]) and AC_LANG_POP([C++]) here, due to
+ dnl an autoconf bug <https://savannah.gnu.org/support/?110294>.
+ cat > conftest.cpp <<\EOF
+#include <stdckdint.h>
+int
+main (void)
+{
+ int r;
+ int a = 1;
+ int b = 1;
+ return !!(ckd_add (&r, a, b) || ckd_sub (&r, a, b) || ckd_mul (&r, a, b));
+}
+EOF
+ gl_command="$CXX $CXXFLAGS $CPPFLAGS -c conftest.cpp"
+ if AC_TRY_EVAL([gl_command]); then
+ gl_cv_header_cxx_stdckdint_h_works=yes
+ else
+ gl_cv_header_cxx_stdckdint_h_works=no
+ fi
+ rm -fr conftest*
+ ])
+ if test $gl_cv_header_cxx_stdckdint_h_works = yes; then
+ HAVE_WORKING_CXX_STDCKDINT_H=1
+ else
+ HAVE_WORKING_CXX_STDCKDINT_H=0
+ fi
+ else
+ HAVE_CXX_STDCKDINT_H=0
+ HAVE_WORKING_CXX_STDCKDINT_H=0
+ fi
+ fi
+ else
+ HAVE_C_STDCKDINT_H=0
+ HAVE_WORKING_C_STDCKDINT_H=0
+ HAVE_CXX_STDCKDINT_H=0
+ HAVE_WORKING_CXX_STDCKDINT_H=0
+ fi
+ AC_SUBST([HAVE_C_STDCKDINT_H])
+ AC_SUBST([HAVE_WORKING_C_STDCKDINT_H])
+ AC_SUBST([HAVE_CXX_STDCKDINT_H])
+ AC_SUBST([HAVE_WORKING_CXX_STDCKDINT_H])
+
+ if test "$CXX" != no; then
+ dnl We might need the header for C or C++.
+ if test $HAVE_C_STDCKDINT_H = 1 \
+ && test $HAVE_WORKING_C_STDCKDINT_H = 1 \
+ && test $HAVE_CXX_STDCKDINT_H = 1 \
+ && test $HAVE_WORKING_CXX_STDCKDINT_H = 1; then
+ GL_GENERATE_STDCKDINT_H=false
+ else
+ GL_GENERATE_STDCKDINT_H=true
+ fi
+ else
+ dnl We don't care about C++ here.
+ if test $HAVE_C_STDCKDINT_H = 1 \
+ && test $HAVE_WORKING_C_STDCKDINT_H = 1; then
+ GL_GENERATE_STDCKDINT_H=false
+ else
+ GL_GENERATE_STDCKDINT_H=true
+ fi
+ fi
+])
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index 3bc8cd85fea..127ec05b60d 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,5 +1,5 @@
# stddef_h.m4
-# serial 21
+# serial 23
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -64,20 +64,26 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
GL_GENERATE_STDDEF_H=true
fi
- AC_CACHE_CHECK([for unreachable],
- [gl_cv_func_unreachable],
+ AC_CACHE_CHECK([for unreachable in C],
+ [gl_cv_c_func_unreachable],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stddef.h>
]],
[[unreachable ();
]])],
- [gl_cv_func_unreachable=yes],
- [gl_cv_func_unreachable=no])
+ [gl_cv_c_func_unreachable=yes],
+ [gl_cv_c_func_unreachable=no])
])
- if test $gl_cv_func_unreachable = no; then
+ if test $gl_cv_c_func_unreachable = no; then
GL_GENERATE_STDDEF_H=true
+ HAVE_C_UNREACHABLE=0
+ else
+ HAVE_C_UNREACHABLE=1
fi
+ AC_SUBST([HAVE_C_UNREACHABLE])
+ dnl Provide gl_unreachable() unconditionally.
+ GL_GENERATE_STDDEF_H=true
dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114869
AC_CACHE_CHECK([whether nullptr_t needs <stddef.h>],