summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-02-04 14:45:11 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2023-02-04 15:14:16 -0800
commit04d97e76a96854a9a9f4778cb1202a87537731de (patch)
tree9c70da51ec099c2c1c0ca95dbace29190e563f8a /m4
parent7e1c7db1cb5a33a66115bb767224bdc79a257266 (diff)
downloademacs-04d97e76a96854a9a9f4778cb1202a87537731de.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4')
-rw-r--r--m4/canonicalize.m48
-rw-r--r--m4/euidaccess.m44
-rw-r--r--m4/faccessat.m47
-rw-r--r--m4/fchmodat.m44
-rw-r--r--m4/futimens.m47
-rw-r--r--m4/getloadavg.m414
-rw-r--r--m4/getrandom.m45
-rw-r--r--m4/gettime.m435
-rw-r--r--m4/gnulib-common.m4403
-rw-r--r--m4/gnulib-comp.m418
-rw-r--r--m4/inttypes.m46
-rw-r--r--m4/mempcpy.m47
-rw-r--r--m4/mkostemp.m47
-rw-r--r--m4/nproc.m46
-rw-r--r--m4/pipe2.m49
-rw-r--r--m4/readlinkat.m47
-rw-r--r--m4/stdalign.m4176
-rw-r--r--m4/stddef_h.m411
-rw-r--r--m4/stdlib_h.m413
-rw-r--r--m4/stpcpy.m47
-rw-r--r--m4/string_h.m44
-rw-r--r--m4/time_h.m43
-rw-r--r--m4/timegm.m47
-rw-r--r--m4/unistd_h.m47
-rw-r--r--m4/utimens.m46
-rw-r--r--m4/utimensat.m47
26 files changed, 534 insertions, 254 deletions
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index 03cb0aec93f..d319645fd3f 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 37
+# canonicalize.m4 serial 38
dnl Copyright (C) 2003-2007, 2009-2023 Free Software Foundation, Inc.
@@ -12,7 +12,8 @@ AC_DEFUN([gl_FUNC_CANONICALIZE_FILENAME_MODE],
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
- AC_CHECK_FUNCS_ONCE([canonicalize_file_name faccessat])
+ AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
+ gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
AC_REQUIRE([gl_FUNC_REALPATH_WORKS])
if test $ac_cv_func_canonicalize_file_name = no; then
@@ -58,7 +59,8 @@ AC_DEFUN([gl_CANONICALIZE_LGPL_SEPARATE],
[
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
- AC_CHECK_FUNCS_ONCE([canonicalize_file_name faccessat])
+ AC_CHECK_FUNCS_ONCE([canonicalize_file_name])
+ gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
dnl On native Windows, we use _getcwd(), regardless whether getcwd() is
dnl available through the linker option '-loldnames'.
diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4
index f0eb5bde84a..7429779c152 100644
--- a/m4/euidaccess.m4
+++ b/m4/euidaccess.m4
@@ -1,4 +1,4 @@
-# euidaccess.m4 serial 16
+# euidaccess.m4 serial 17
dnl Copyright (C) 2002-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -32,7 +32,7 @@ AC_DEFUN([gl_FUNC_EUIDACCESS],
# Prerequisites of lib/euidaccess.c.
AC_DEFUN([gl_PREREQ_EUIDACCESS], [
dnl Prefer POSIX faccessat over non-standard euidaccess.
- AC_CHECK_FUNCS_ONCE([faccessat])
+ gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
dnl Try various other non-standard fallbacks.
AC_CHECK_HEADERS([libgen.h])
AC_FUNC_GETGROUPS
diff --git a/m4/faccessat.m4 b/m4/faccessat.m4
index 934c1f41546..a858bfee33d 100644
--- a/m4/faccessat.m4
+++ b/m4/faccessat.m4
@@ -1,4 +1,4 @@
-# serial 10
+# serial 12
# See if we need to provide faccessat replacement.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -16,9 +16,12 @@ AC_DEFUN([gl_FUNC_FACCESSAT],
dnl Persuade glibc <unistd.h> to declare faccessat().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([faccessat])
+ gl_CHECK_FUNCS_ANDROID([faccessat], [[#include <unistd.h>]])
if test $ac_cv_func_faccessat = no; then
HAVE_FACCESSAT=0
+ case "$gl_cv_onwards_func_faccessat" in
+ future*) REPLACE_FACCESSAT=1 ;;
+ esac
else
case $gl_cv_func_lstat_dereferences_slashed_symlink in
*yes) ;;
diff --git a/m4/fchmodat.m4 b/m4/fchmodat.m4
index 7a3ee863e3c..5356da40bae 100644
--- a/m4/fchmodat.m4
+++ b/m4/fchmodat.m4
@@ -1,4 +1,4 @@
-# fchmodat.m4 serial 7
+# fchmodat.m4 serial 8
dnl Copyright (C) 2004-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -97,6 +97,6 @@ AC_DEFUN([gl_FUNC_FCHMODAT],
# Prerequisites of lib/fchmodat.c.
AC_DEFUN([gl_PREREQ_FCHMODAT],
[
- AC_CHECK_FUNCS_ONCE([readlinkat])
+ gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
:
])
diff --git a/m4/futimens.m4 b/m4/futimens.m4
index 3aaa10a0b52..dc0b21b9d51 100644
--- a/m4/futimens.m4
+++ b/m4/futimens.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 11
# See if we need to provide futimens replacement.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -13,9 +13,12 @@ AC_DEFUN([gl_FUNC_FUTIMENS],
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([futimens])
+ gl_CHECK_FUNCS_ANDROID([futimens], [[#include <sys/stat.h>]])
if test $ac_cv_func_futimens = no; then
HAVE_FUTIMENS=0
+ case "$gl_cv_onwards_func_futimens" in
+ future*) REPLACE_FUTIMENS=1 ;;
+ esac
else
AC_CACHE_CHECK([whether futimens works],
[gl_cv_func_futimens_works],
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index 79e420baae8..ee83b32f1e0 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -7,7 +7,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-#serial 10
+#serial 12
# Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
# New applications should use gl_GETLOADAVG instead.
@@ -25,8 +25,13 @@ gl_save_LIBS=$LIBS
# getloadavg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
# NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
HAVE_GETLOADAVG=1
-AC_CHECK_FUNC([getloadavg], [],
- [gl_func_getloadavg_done=no
+gl_CHECK_FUNCS_ANDROID([getloadavg], [[#include <stdlib.h>]])
+if test $ac_cv_func_getloadavg != yes; then
+ case "$gl_cv_onwards_func_getloadavg" in
+ future*) REPLACE_GETLOADAVG=1 ;;
+ esac
+
+ gl_func_getloadavg_done=no
# Some systems with -lutil have (and need) -lkvm as well, some do not.
# On Solaris, -lkvm requires nlist from -lelf, so check that first
@@ -73,7 +78,8 @@ AC_CHECK_FUNC([getloadavg], [],
AC_DEFINE([DGUX], [1], [Define to 1 for DGUX with <sys/dg_sys_info.h>.])
AC_CHECK_LIB([dgc], [dg_sys_info])])
fi
- fi])
+ fi
+fi
if test "x$gl_save_LIBS" = x; then
GETLOADAVG_LIBS=$LIBS
diff --git a/m4/getrandom.m4 b/m4/getrandom.m4
index c508f1a55c3..7b7f9ce2ee8 100644
--- a/m4/getrandom.m4
+++ b/m4/getrandom.m4
@@ -1,4 +1,4 @@
-# getrandom.m4 serial 10
+# getrandom.m4 serial 11
dnl Copyright 2020-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -18,6 +18,9 @@ AC_DEFUN([gl_FUNC_GETRANDOM],
]])
if test "$ac_cv_func_getrandom" != yes; then
HAVE_GETRANDOM=0
+ case "$gl_cv_onwards_func_getrandom" in
+ future*) REPLACE_GETRANDOM=1 ;;
+ esac
else
dnl On Solaris 11.4 the return type is 'int', not 'ssize_t'.
AC_CACHE_CHECK([whether getrandom is compatible with its GNU+BSD signature],
diff --git a/m4/gettime.m4 b/m4/gettime.m4
index 7e353fcd00e..ec1f97ee0d5 100644
--- a/m4/gettime.m4
+++ b/m4/gettime.m4
@@ -1,4 +1,4 @@
-# gettime.m4 serial 13
+# gettime.m4 serial 14
dnl Copyright (C) 2002, 2004-2006, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -18,9 +18,11 @@ AC_DEFUN([gl_GETTIME],
])
dnl Tests whether the function timespec_get exists.
-dnl Sets gl_cv_func_timespec_get.
+dnl Sets gl_cv_func_timespec_get and gl_cv_onwards_func_timespec_get.
AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
[
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
dnl Persuade OpenBSD <time.h> to declare timespec_get().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -29,21 +31,32 @@ AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
dnl But at the same time, we need to notice a missing declaration, like
dnl gl_CHECK_FUNCS_ANDROID does.
AC_CHECK_DECL([timespec_get], , , [[#include <time.h>]])
- if test $ac_cv_have_decl_timespec_get = yes; then
- AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get],
- [AC_LINK_IFELSE(
+ AC_CACHE_CHECK([for timespec_get], [gl_cv_onwards_func_timespec_get],
+ [if test $ac_cv_have_decl_timespec_get = yes; then
+ AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <time.h>
struct timespec ts;
]],
[[return timespec_get (&ts, 0);]])
],
- [gl_cv_func_timespec_get=yes],
- [gl_cv_func_timespec_get=no])
- ])
- else
- gl_cv_func_timespec_get=no
- fi
+ [gl_cv_onwards_func_timespec_get=yes],
+ [gl_cv_onwards_func_timespec_get=no])
+ else
+ gl_cv_onwards_func_timespec_get=no
+ fi
+ case "$host_os" in
+ linux*-android*)
+ if test $gl_cv_onwards_func_timespec_get = no; then
+ gl_cv_onwards_func_timespec_get='future OS version'
+ fi
+ ;;
+ esac
+ ])
+ case "$gl_cv_onwards_func_timespec_get" in
+ future*) gl_cv_func_timespec_get=no ;;
+ *) gl_cv_func_timespec_get=$gl_cv_onwards_func_timespec_get ;;
+ esac
])
AC_DEFUN([gl_GETTIME_RES],
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 2db3376b01e..c0181abdc50 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 76
+# gnulib-common.m4 serial 80
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -38,6 +38,11 @@ AC_DEFUN([gl_COMMON_BODY], [
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__ \
@@ -119,29 +124,35 @@ AC_DEFUN([gl_COMMON_BODY], [
by the Nth argument of the function is the size of the returned memory block.
*/
/* Applies to: function, pointer to function, function types. */
-#if _GL_HAS_ATTRIBUTE (alloc_size)
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
-#else
-# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
+#ifndef _GL_ATTRIBUTE_ALLOC_SIZE
+# if _GL_HAS_ATTRIBUTE (alloc_size)
+# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args))
+# else
+# define _GL_ATTRIBUTE_ALLOC_SIZE(args)
+# endif
#endif
/* _GL_ATTRIBUTE_ALWAYS_INLINE tells that the compiler should always inline the
function and report an error if it cannot do so. */
/* Applies to: function. */
-#if _GL_HAS_ATTRIBUTE (always_inline)
-# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
-#else
-# define _GL_ATTRIBUTE_ALWAYS_INLINE
+#ifndef _GL_ATTRIBUTE_ALWAYS_INLINE
+# if _GL_HAS_ATTRIBUTE (always_inline)
+# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
+# else
+# define _GL_ATTRIBUTE_ALWAYS_INLINE
+# endif
#endif
/* _GL_ATTRIBUTE_ARTIFICIAL declares that the function is not important to show
in stack traces when debugging. The compiler should omit the function from
stack traces. */
/* Applies to: function. */
-#if _GL_HAS_ATTRIBUTE (artificial)
-# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
-#else
-# define _GL_ATTRIBUTE_ARTIFICIAL
+#ifndef _GL_ATTRIBUTE_ARTIFICIAL
+# if _GL_HAS_ATTRIBUTE (artificial)
+# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__))
+# else
+# define _GL_ATTRIBUTE_ARTIFICIAL
+# endif
#endif
/* _GL_ATTRIBUTE_COLD declares that the function is rarely executed. */
@@ -149,14 +160,16 @@ AC_DEFUN([gl_COMMON_BODY], [
/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at
<https://lists.gnu.org/r/emacs-devel/2019-04/msg01152.html>.
Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */
-#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
-# ifndef __SUNPRO_C
-# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
+#ifndef _GL_ATTRIBUTE_COLD
+# if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__
+# ifndef __SUNPRO_C
+# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__))
+# else
+# define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
+# endif
# else
-# define _GL_ATTRIBUTE_COLD __attribute__ ((cold))
+# define _GL_ATTRIBUTE_COLD
# endif
-#else
-# define _GL_ATTRIBUTE_COLD
#endif
/* _GL_ATTRIBUTE_CONST declares that it is OK for a compiler to omit duplicate
@@ -166,10 +179,12 @@ AC_DEFUN([gl_COMMON_BODY], [
forever, and does not call longjmp.
(This attribute is stricter than _GL_ATTRIBUTE_PURE.) */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (const)
-# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
-#else
-# define _GL_ATTRIBUTE_CONST
+#ifndef _GL_ATTRIBUTE_CONST
+# if _GL_HAS_ATTRIBUTE (const)
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+# define _GL_ATTRIBUTE_CONST
+# endif
#endif
/* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers
@@ -178,10 +193,12 @@ AC_DEFUN([gl_COMMON_BODY], [
_GL_ATTRIBUTE_DEALLOC_FREE declares that the function returns pointers that
can be freed via 'free'; it can be used only after declaring 'free'. */
/* Applies to: functions. Cannot be used on inline functions. */
-#if _GL_GNUC_PREREQ (11, 0)
-# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
-#else
-# define _GL_ATTRIBUTE_DEALLOC(f, i)
+#ifndef _GL_ATTRIBUTE_DEALLOC
+# if _GL_GNUC_PREREQ (11, 0)
+# define _GL_ATTRIBUTE_DEALLOC(f, i) __attribute__ ((__malloc__ (f, i)))
+# else
+# define _GL_ATTRIBUTE_DEALLOC(f, i)
+# endif
#endif
/* If gnulib's <string.h> or <wchar.h> has already defined this macro, continue
to use this earlier definition, since <stdlib.h> may not have been included
@@ -205,16 +222,18 @@ AC_DEFUN([gl_COMMON_BODY], [
- enumeration, enumeration item,
- typedef,
in C++ also: namespace, class, template specialization. */
-#ifdef __has_c_attribute
-# if __has_c_attribute (__deprecated__)
-# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
-# endif
-#endif
-#if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
-# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
-#endif
#ifndef _GL_ATTRIBUTE_DEPRECATED
-# define _GL_ATTRIBUTE_DEPRECATED
+# ifdef __has_c_attribute
+# if __has_c_attribute (__deprecated__)
+# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
+# endif
+# endif
+# if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
+# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
+# endif
+# ifndef _GL_ATTRIBUTE_DEPRECATED
+# define _GL_ATTRIBUTE_DEPRECATED
+# endif
#endif
/* _GL_ATTRIBUTE_ERROR(msg) requests an error if a function is called and
@@ -222,24 +241,28 @@ AC_DEFUN([gl_COMMON_BODY], [
_GL_ATTRIBUTE_WARNING(msg) requests a warning if a function is called and
the function call is not optimized away. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (error)
-# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
-# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
-#elif _GL_HAS_ATTRIBUTE (diagnose_if)
-# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error")))
-# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning")))
-#else
-# define _GL_ATTRIBUTE_ERROR(msg)
-# define _GL_ATTRIBUTE_WARNING(msg)
+#if !(defined _GL_ATTRIBUTE_ERROR && defined _GL_ATTRIBUTE_WARNING)
+# if _GL_HAS_ATTRIBUTE (error)
+# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg)))
+# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg)))
+# elif _GL_HAS_ATTRIBUTE (diagnose_if)
+# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error")))
+# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning")))
+# else
+# define _GL_ATTRIBUTE_ERROR(msg)
+# define _GL_ATTRIBUTE_WARNING(msg)
+# endif
#endif
/* _GL_ATTRIBUTE_EXTERNALLY_VISIBLE declares that the entity should remain
visible to debuggers etc., even with '-fwhole-program'. */
/* Applies to: functions, variables. */
-#if _GL_HAS_ATTRIBUTE (externally_visible)
-# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
-#else
-# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+#ifndef _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+# if _GL_HAS_ATTRIBUTE (externally_visible)
+# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible))
+# else
+# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE
+# endif
#endif
/* _GL_ATTRIBUTE_FALLTHROUGH declares that it is not a programming mistake if
@@ -247,16 +270,18 @@ AC_DEFUN([gl_COMMON_BODY], [
'default' label. The compiler should not warn in this case. */
/* Applies to: Empty statement (;), inside a 'switch' statement. */
/* Always expands to something. */
-#ifdef __has_c_attribute
-# if __has_c_attribute (__fallthrough__)
-# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
-# endif
-#endif
-#if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
-# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
-#endif
#ifndef _GL_ATTRIBUTE_FALLTHROUGH
-# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+# ifdef __has_c_attribute
+# if __has_c_attribute (__fallthrough__)
+# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
+# endif
+# endif
+# if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
+# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+# ifndef _GL_ATTRIBUTE_FALLTHROUGH
+# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
+# endif
#endif
/* _GL_ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK))
@@ -270,10 +295,12 @@ AC_DEFUN([gl_COMMON_BODY], [
If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK
are suitable for the format string. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (format)
-# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
-#else
-# define _GL_ATTRIBUTE_FORMAT(spec)
+#ifndef _GL_ATTRIBUTE_FORMAT
+# if _GL_HAS_ATTRIBUTE (format)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+# else
+# define _GL_ATTRIBUTE_FORMAT(spec)
+# endif
#endif
/* _GL_ATTRIBUTE_LEAF declares that if the function is called from some other
@@ -281,19 +308,23 @@ AC_DEFUN([gl_COMMON_BODY], [
exception handling. This declaration lets the compiler optimize that unit
more aggressively. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (leaf)
-# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
-#else
-# define _GL_ATTRIBUTE_LEAF
+#ifndef _GL_ATTRIBUTE_LEAF
+# if _GL_HAS_ATTRIBUTE (leaf)
+# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__))
+# else
+# define _GL_ATTRIBUTE_LEAF
+# endif
#endif
/* _GL_ATTRIBUTE_MALLOC declares that the function returns a pointer to freshly
allocated memory. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (malloc)
-# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
-#else
-# define _GL_ATTRIBUTE_MALLOC
+#ifndef _GL_ATTRIBUTE_MALLOC
+# if _GL_HAS_ATTRIBUTE (malloc)
+# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# else
+# define _GL_ATTRIBUTE_MALLOC
+# endif
#endif
/* _GL_ATTRIBUTE_MAY_ALIAS declares that pointers to the type may point to the
@@ -301,10 +332,12 @@ AC_DEFUN([gl_COMMON_BODY], [
strict aliasing optimization. */
/* Applies to: types. */
/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */
-#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
-# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
-#else
-# define _GL_ATTRIBUTE_MAY_ALIAS
+#ifndef _GL_ATTRIBUTE_MAY_ALIAS
+# if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C
+# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__))
+# else
+# define _GL_ATTRIBUTE_MAY_ALIAS
+# endif
#endif
/* _GL_ATTRIBUTE_MAYBE_UNUSED declares that it is not a programming mistake if
@@ -318,14 +351,22 @@ AC_DEFUN([gl_COMMON_BODY], [
in C++ also: class. */
/* In C++ and C23, this is spelled [[__maybe_unused__]].
GCC's syntax is __attribute__ ((__unused__)).
- clang supports both syntaxes. */
-#ifdef __has_c_attribute
-# if __has_c_attribute (__maybe_unused__)
-# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
-# endif
-#endif
+ clang supports both syntaxes. Except that with clang ≥ 6, < 10, in C++ mode,
+ __has_c_attribute (__maybe_unused__) yields true but the use of
+ [[__maybe_unused__]] nevertheless produces a warning. */
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
-# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
+# if defined __clang__ && defined __cplusplus
+# if __clang_major__ >= 10
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# endif
+# elif defined __has_c_attribute
+# if __has_c_attribute (__maybe_unused__)
+# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
+# endif
+# endif
+# ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
+# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
+# endif
#endif
/* Alternative spelling of this macro, for convenience and for
compatibility with glibc/include/libc-symbols.h. */
@@ -337,25 +378,38 @@ AC_DEFUN([gl_COMMON_BODY], [
discard the return value. The compiler may warn if the caller does not use
the return value, unless the caller uses something like ignore_value. */
/* Applies to: function, enumeration, class. */
-#ifdef __has_c_attribute
-# if __has_c_attribute (__nodiscard__)
-# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
-# endif
-#endif
-#if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
-# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
-#endif
#ifndef _GL_ATTRIBUTE_NODISCARD
-# define _GL_ATTRIBUTE_NODISCARD
+# if defined __clang__ && defined __cplusplus
+ /* With clang up to 15.0.6 (at least), in C++ mode, [[__nodiscard__]] produces
+ a warning.
+ The 1000 below means a yet unknown threshold. When clang++ version X
+ starts supporting [[__nodiscard__]] without warning about it, you can
+ replace the 1000 with X. */
+# if __clang_major__ >= 1000
+# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
+# endif
+# elif defined __has_c_attribute
+# if __has_c_attribute (__nodiscard__)
+# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
+# endif
+# endif
+# if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
+# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
+# endif
+# ifndef _GL_ATTRIBUTE_NODISCARD
+# define _GL_ATTRIBUTE_NODISCARD
+# endif
#endif
/* _GL_ATTRIBUTE_NOINLINE tells that the compiler should not inline the
function. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (noinline)
-# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
-#else
-# define _GL_ATTRIBUTE_NOINLINE
+#ifndef _GL_ATTRIBUTE_NOINLINE
+# if _GL_HAS_ATTRIBUTE (noinline)
+# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__))
+# else
+# define _GL_ATTRIBUTE_NOINLINE
+# endif
#endif
/* _GL_ATTRIBUTE_NONNULL ((N1, N2,...)) declares that the arguments N1, N2,...
@@ -363,20 +417,24 @@ AC_DEFUN([gl_COMMON_BODY], [
_GL_ATTRIBUTE_NONNULL () declares that all pointer arguments must not be
null. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (nonnull)
-# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
-#else
-# define _GL_ATTRIBUTE_NONNULL(args)
+#ifndef _GL_ATTRIBUTE_NONNULL
+# if _GL_HAS_ATTRIBUTE (nonnull)
+# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args))
+# else
+# define _GL_ATTRIBUTE_NONNULL(args)
+# endif
#endif
/* _GL_ATTRIBUTE_NONSTRING declares that the contents of a character array is
not meant to be NUL-terminated. */
/* Applies to: struct/union members and variables that are arrays of element
type '[[un]signed] char'. */
-#if _GL_HAS_ATTRIBUTE (nonstring)
-# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
-#else
-# define _GL_ATTRIBUTE_NONSTRING
+#ifndef _GL_ATTRIBUTE_NONSTRING
+# if _GL_HAS_ATTRIBUTE (nonstring)
+# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__))
+# else
+# define _GL_ATTRIBUTE_NONSTRING
+# endif
#endif
/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */
@@ -384,10 +442,12 @@ AC_DEFUN([gl_COMMON_BODY], [
/* _GL_ATTRIBUTE_NOTHROW declares that the function does not throw exceptions.
*/
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus
-# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
-#else
-# define _GL_ATTRIBUTE_NOTHROW
+#ifndef _GL_ATTRIBUTE_NOTHROW
+# if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus
+# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__))
+# else
+# define _GL_ATTRIBUTE_NOTHROW
+# endif
#endif
/* _GL_ATTRIBUTE_PACKED declares:
@@ -396,10 +456,12 @@ AC_DEFUN([gl_COMMON_BODY], [
minimizing the memory required. */
/* Applies to: struct members, struct, union,
in C++ also: class. */
-#if _GL_HAS_ATTRIBUTE (packed)
-# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
-#else
-# define _GL_ATTRIBUTE_PACKED
+#ifndef _GL_ATTRIBUTE_PACKED
+# if _GL_HAS_ATTRIBUTE (packed)
+# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__))
+# else
+# define _GL_ATTRIBUTE_PACKED
+# endif
#endif
/* _GL_ATTRIBUTE_PURE declares that It is OK for a compiler to omit duplicate
@@ -409,19 +471,23 @@ AC_DEFUN([gl_COMMON_BODY], [
observable state, and always returns exactly once.
(This attribute is looser than _GL_ATTRIBUTE_CONST.) */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (pure)
-# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-# define _GL_ATTRIBUTE_PURE
+#ifndef _GL_ATTRIBUTE_PURE
+# if _GL_HAS_ATTRIBUTE (pure)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _GL_ATTRIBUTE_PURE
+# endif
#endif
/* _GL_ATTRIBUTE_RETURNS_NONNULL declares that the function's return value is
a non-NULL pointer. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (returns_nonnull)
-# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
-#else
-# define _GL_ATTRIBUTE_RETURNS_NONNULL
+#ifndef _GL_ATTRIBUTE_RETURNS_NONNULL
+# if _GL_HAS_ATTRIBUTE (returns_nonnull)
+# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__))
+# else
+# define _GL_ATTRIBUTE_RETURNS_NONNULL
+# endif
#endif
/* _GL_ATTRIBUTE_SENTINEL(pos) declares that the variadic function expects a
@@ -429,17 +495,21 @@ AC_DEFUN([gl_COMMON_BODY], [
_GL_ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99).
_GL_ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */
/* Applies to: functions. */
-#if _GL_HAS_ATTRIBUTE (sentinel)
-# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
-#else
-# define _GL_ATTRIBUTE_SENTINEL(pos)
+#ifndef _GL_ATTRIBUTE_SENTINEL
+# if _GL_HAS_ATTRIBUTE (sentinel)
+# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos))
+# else
+# define _GL_ATTRIBUTE_SENTINEL(pos)
+# endif
#endif
/* A helper macro. Don't use it directly. */
-#if _GL_HAS_ATTRIBUTE (unused)
-# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-#else
-# define _GL_ATTRIBUTE_UNUSED
+#ifndef _GL_ATTRIBUTE_UNUSED
+# if _GL_HAS_ATTRIBUTE (unused)
+# define _GL_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define _GL_ATTRIBUTE_UNUSED
+# endif
#endif
]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead.
@@ -450,10 +520,12 @@ AC_DEFUN([gl_COMMON_BODY], [
/* Applies to: label (both in C and C++). */
/* Note that g++ < 4.5 does not support the '__attribute__ ((__unused__)) ;'
syntax. But clang does. */
-#if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
-# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
-#else
-# define _GL_UNUSED_LABEL
+#ifndef _GL_UNUSED_LABEL
+# if !(defined __cplusplus && !_GL_GNUC_PREREQ (4, 5)) || defined __clang__
+# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_UNUSED
+# else
+# define _GL_UNUSED_LABEL
+# endif
#endif
])
AH_VERBATIM([async_safe],
@@ -1026,8 +1098,21 @@ AC_DEFUN([gl_CONDITIONAL_HEADER],
dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
dnl on Android.
-dnl Namely, if func was added to Android API level, say, 28, then the libc.so
-dnl has the symbol func always, whereas the header file <foo.h> declares func
+dnl
+dnl When code is compiled on Android, it is in the context of a certain
+dnl "Android API level", which indicates the minimum version of Android on
+dnl which the app can be installed. In other words, you don't compile for a
+dnl specific version of Android. You compile for all versions of Android,
+dnl onwards from the given API level.
+dnl Thus, the question "does the OS have the function func" has three possible
+dnl answers:
+dnl - yes, in all versions starting from the given API level,
+dnl - no, in no version,
+dnl - not in the given API level, but in a later version of Android.
+dnl
+dnl In detail, this works as follows:
+dnl If func was added to Android API level, say, 28, then the libc.so has the
+dnl symbol func always, whereas the header file <foo.h> declares func
dnl conditionally:
dnl #if __ANDROID_API__ >= 28
dnl ... func (...) __INTRODUCED_IN(28);
@@ -1035,15 +1120,55 @@ dnl #endif
dnl Thus, when compiling with "clang -target armv7a-unknown-linux-android28",
dnl the function func is declared and exists in libc.
dnl Whereas when compiling with "clang -target armv7a-unknown-linux-android27",
-dnl the function func is not declared but exists in libc. We need to treat this
-dnl case like the case where func does not exist.
+dnl the function func is not declared but exists in libc.
+dnl
+dnl This macro sets two variables:
+dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
+dnl - ac_cv_func_<func> to yes / no / no
+dnl The first variable allows to distinguish all three cases.
+dnl The second variable is set, so that an invocation
+dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
+dnl can be used as a drop-in replacement for
+dnl AC_CHECK_FUNCS([func]).
AC_DEFUN([gl_CHECK_FUNCS_ANDROID],
[
- AC_CHECK_DECL([$1], , , [$2])
- if test $ac_cv_have_decl_[$1] = yes; then
- AC_CHECK_FUNCS([$1])
- else
- ac_cv_func_[$1]=no
+ AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_CACHE_CHECK([for [$1]],
+ [[gl_cv_onwards_func_][$1]],
+ [gl_SILENT([
+ case "$host_os" in
+ linux*-android*)
+ AC_CHECK_DECL([$1], , , [$2])
+ if test $[ac_cv_have_decl_][$1] = yes; then
+ AC_CHECK_FUNC([[$1]])
+ if test $[ac_cv_func_][$1] = yes; then
+ [gl_cv_onwards_func_][$1]=yes
+ else
+ dnl The function is declared but does not exist. This should not
+ dnl happen normally. But anyway, we know that a future version
+ dnl of Android will have the function.
+ [gl_cv_onwards_func_][$1]='future OS version'
+ fi
+ else
+ [gl_cv_onwards_func_][$1]='future OS version'
+ fi
+ ;;
+ *)
+ AC_CHECK_FUNC([$1])
+ [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
+ ;;
+ esac
+ ])
+ ])
+ case "$[gl_cv_onwards_func_][$1]" in
+ future*) [ac_cv_func_][$1]=no ;;
+ *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;;
+ esac
+ if test $[ac_cv_func_][$1] = yes; then
+ AC_DEFINE([HAVE_]m4_translit([[$1]],
+ [abcdefghijklmnopqrstuvwxyz],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ]),
+ [1], [Define to 1 if you have the `$1' function.])
fi
])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 10c74fa2392..aacceb92258 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -44,6 +44,7 @@ AC_DEFUN([gl_EARLY],
# Code from module absolute-header:
# Code from module acl-permissions:
+ # Code from module alignasof:
# Code from module alloca-opt:
# Code from module allocator:
# Code from module assert-h:
@@ -231,6 +232,7 @@ AC_DEFUN([gl_INIT],
gl_source_base='lib'
gl_source_base_prefix=
gl_FUNC_ACL
+ gl_ALIGNASOF
gl_FUNC_ALLOCA
gl_CONDITIONAL_HEADER([alloca.h])
AC_PROG_MKDIR_P
@@ -248,7 +250,7 @@ AC_DEFUN([gl_INIT],
gl_STDLIB_MODULE_INDICATOR([canonicalize_file_name])
gl_STDLIB_MODULE_INDICATOR([realpath])
AC_REQUIRE([AC_C_RESTRICT])
- AC_CHECK_FUNCS_ONCE([readlinkat])
+ gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
gl_CLOCK_TIME
gl_MODULE_INDICATOR([close-stream])
gl_FUNC_COPY_FILE_RANGE
@@ -344,7 +346,8 @@ AC_DEFUN([gl_INIT],
gl_SYS_STAT_MODULE_INDICATOR([futimens])
AC_REQUIRE([AC_CANONICAL_HOST])
gl_GETLOADAVG
- gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG], [test $HAVE_GETLOADAVG = 0])
+ gl_CONDITIONAL([GL_COND_OBJ_GETLOADAVG],
+ [test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1])
AM_COND_IF([GL_COND_OBJ_GETLOADAVG], [
gl_PREREQ_GETLOADAVG
])
@@ -404,7 +407,8 @@ AC_DEFUN([gl_INIT],
fi
gl_STRING_MODULE_INDICATOR([memmem])
gl_FUNC_MEMPCPY
- gl_CONDITIONAL([GL_COND_OBJ_MEMPCPY], [test $HAVE_MEMPCPY = 0])
+ gl_CONDITIONAL([GL_COND_OBJ_MEMPCPY],
+ [test $HAVE_MEMPCPY = 0 || test $REPLACE_MEMPCPY = 1])
AM_COND_IF([GL_COND_OBJ_MEMPCPY], [
gl_PREREQ_MEMPCPY
])
@@ -423,7 +427,8 @@ AC_DEFUN([gl_INIT],
gl_STRING_MODULE_INDICATOR([memset_explicit])
gl_MINMAX
gl_FUNC_MKOSTEMP
- gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], [test $HAVE_MKOSTEMP = 0])
+ gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP],
+ [test $HAVE_MKOSTEMP = 0 || test $REPLACE_MKOSTEMP = 1])
AM_COND_IF([GL_COND_OBJ_MKOSTEMP], [
gl_PREREQ_MKOSTEMP
])
@@ -548,7 +553,8 @@ AC_DEFUN([gl_INIT],
gl_STDLIB_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P
gl_FUNC_STPCPY
- gl_CONDITIONAL([GL_COND_OBJ_STPCPY], [test $HAVE_STPCPY = 0])
+ gl_CONDITIONAL([GL_COND_OBJ_STPCPY],
+ [test $HAVE_STPCPY = 0 || test $REPLACE_STPCPY = 1])
AM_COND_IF([GL_COND_OBJ_STPCPY], [
gl_PREREQ_STPCPY
])
@@ -973,7 +979,7 @@ AC_DEFUN([gl_INIT],
if test $HAVE_FUTIMENS = 0 || test $REPLACE_FUTIMENS = 1; then
func_gl_gnulib_m4code_utimens
fi
- if case $host_os in mingw*) false;; *) test $HAVE_GETLOADAVG = 0;; esac; then
+ if case $host_os in mingw*) false;; *) test $HAVE_GETLOADAVG = 0 || test $REPLACE_GETLOADAVG = 1;; esac; then
func_gl_gnulib_m4code_open
fi
if test $REPLACE_GETOPT = 1; then
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index bf2eab2ba31..e7efbe94167 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
-# inttypes.m4 serial 36
+# inttypes.m4 serial 37
dnl Copyright (C) 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -170,6 +170,10 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
HAVE_IMAXDIV_T=1; AC_SUBST([HAVE_IMAXDIV_T])
+ HAVE_IMAXABS=1; AC_SUBST([HAVE_IMAXABS])
+ HAVE_IMAXDIV=1; AC_SUBST([HAVE_IMAXDIV])
+ REPLACE_IMAXABS=0; AC_SUBST([REPLACE_IMAXABS])
+ REPLACE_IMAXDIV=0; AC_SUBST([REPLACE_IMAXDIV])
REPLACE_STRTOIMAX=0; AC_SUBST([REPLACE_STRTOIMAX])
REPLACE_STRTOUMAX=0; AC_SUBST([REPLACE_STRTOUMAX])
INT32_MAX_LT_INTMAX_MAX=1; AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
diff --git a/m4/mempcpy.m4 b/m4/mempcpy.m4
index 55bee2ab7a2..612b77b3c11 100644
--- a/m4/mempcpy.m4
+++ b/m4/mempcpy.m4
@@ -1,4 +1,4 @@
-# mempcpy.m4 serial 12
+# mempcpy.m4 serial 14
dnl Copyright (C) 2003-2004, 2006-2007, 2009-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -14,9 +14,12 @@ AC_DEFUN([gl_FUNC_MEMPCPY],
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS([mempcpy])
+ gl_CHECK_FUNCS_ANDROID([mempcpy], [[#include <string.h>]])
if test $ac_cv_func_mempcpy = no; then
HAVE_MEMPCPY=0
+ case "$gl_cv_onwards_func_mempcpy" in
+ future*) REPLACE_MEMPCPY=1 ;;
+ esac
fi
])
diff --git a/m4/mkostemp.m4 b/m4/mkostemp.m4
index a7cfac4cb87..1b0d0d55946 100644
--- a/m4/mkostemp.m4
+++ b/m4/mkostemp.m4
@@ -1,4 +1,4 @@
-# mkostemp.m4 serial 2
+# mkostemp.m4 serial 4
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,9 +11,12 @@ AC_DEFUN([gl_FUNC_MKOSTEMP],
dnl Persuade glibc <stdlib.h> to declare mkostemp().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([mkostemp])
+ gl_CHECK_FUNCS_ANDROID([mkostemp], [[#include <stdlib.h>]])
if test $ac_cv_func_mkostemp != yes; then
HAVE_MKOSTEMP=0
+ case "$gl_cv_onwards_func_mkostemp" in
+ future*) REPLACE_MKOSTEMP=1 ;;
+ esac
fi
])
diff --git a/m4/nproc.m4 b/m4/nproc.m4
index 3065b7b9bff..c892ad74b7d 100644
--- a/m4/nproc.m4
+++ b/m4/nproc.m4
@@ -1,4 +1,4 @@
-# nproc.m4 serial 5
+# nproc.m4 serial 6
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -25,8 +25,8 @@ AC_DEFUN([gl_PREREQ_NPROC],
#endif
])
- AC_CHECK_FUNCS([sched_getaffinity sched_getaffinity_np \
- pstat_getdynamic sysmp sysctl])
+ AC_CHECK_FUNCS([sched_getaffinity_np pstat_getdynamic sysmp sysctl])
+ gl_CHECK_FUNCS_ANDROID([sched_getaffinity], [[#include <sched.h>]])
dnl Test whether sched_getaffinity has the expected declaration.
dnl glibc 2.3.[0-2]:
diff --git a/m4/pipe2.m4 b/m4/pipe2.m4
index 501f3a4303d..79de69cd1a4 100644
--- a/m4/pipe2.m4
+++ b/m4/pipe2.m4
@@ -1,4 +1,4 @@
-# pipe2.m4 serial 2
+# pipe2.m4 serial 4
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -11,8 +11,13 @@ AC_DEFUN([gl_FUNC_PIPE2],
dnl Persuade glibc <unistd.h> to declare pipe2().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([pipe2])
+ gl_CHECK_FUNCS_ANDROID([pipe2], [[#include <unistd.h>]])
if test $ac_cv_func_pipe2 != yes; then
HAVE_PIPE2=0
+ case "$gl_cv_onwards_func_pipe2" in
+ future*) REPLACE_PIPE2=1 ;;
+ esac
+ else
+ REPLACE_PIPE2=1
fi
])
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
index ffd0b8e9bc1..5c513562919 100644
--- a/m4/readlinkat.m4
+++ b/m4/readlinkat.m4
@@ -1,4 +1,4 @@
-# serial 6
+# serial 8
# See if we need to provide readlinkat replacement.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -12,10 +12,13 @@ AC_DEFUN([gl_FUNC_READLINKAT],
[
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE([readlinkat])
+ gl_CHECK_FUNCS_ANDROID([readlinkat], [[#include <unistd.h>]])
AC_REQUIRE([gl_FUNC_READLINK])
if test $ac_cv_func_readlinkat = no; then
HAVE_READLINKAT=0
+ case "$gl_cv_onwards_func_readlinkat" in
+ future*) REPLACE_READLINKAT=1 ;;
+ esac
else
AC_CACHE_CHECK([whether readlinkat signature is correct],
[gl_cv_decl_readlinkat_works],
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index b1438eeaced..f49cf8ec162 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -5,9 +5,11 @@ dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+dnl Written by Paul Eggert and Bruno Haible.
+
# Prepare for substituting <stdalign.h> if it is not supported.
-AC_DEFUN([gl_STDALIGN_H],
+AC_DEFUN([gl_ALIGNASOF],
[
AC_CACHE_CHECK([for alignas and alignof],
[gl_cv_header_working_stdalign_h],
@@ -58,77 +60,141 @@ AC_DEFUN([gl_STDALIGN_H],
test "$gl_cv_header_working_stdalign_h" != no && break
done])
- GL_GENERATE_STDALIGN_H=false
AS_CASE([$gl_cv_header_working_stdalign_h],
- [no],
- [GL_GENERATE_STDALIGN_H=true],
[yes*keyword*],
[AC_DEFINE([HAVE_C_ALIGNASOF], [1],
[Define to 1 if the alignas and alignof keywords work.])])
- AC_CHECK_HEADERS_ONCE([stdalign.h])
-
dnl The "zz" puts this toward config.h's end, to avoid potential
dnl collisions with other definitions.
AH_VERBATIM([zzalignas],
[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof
# if HAVE_STDALIGN_H
# include <stdalign.h>
-# else
- /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */
-# ifndef _GL_STDALIGN_H
-# define _GL_STDALIGN_H
-# undef _Alignas
-# undef _Alignof
-# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
- || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
- && !defined __clang__) \
- || (defined __clang__ && __clang_major__ < 8))
-# ifdef __cplusplus
-# if (201103 <= __cplusplus || defined _MSC_VER)
-# define _Alignof(type) alignof (type)
-# else
- template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-# define _GL_STDALIGN_NEEDS_STDDEF 1
-# endif
+# endif
+
+/* ISO C23 alignas and alignof for platforms that lack it.
+
+ References:
+ ISO C23 (latest free draft
+ <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf>)
+ sections 6.5.3.4, 6.7.5, 7.15.
+ C++11 (latest free draft
+ <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
+ section 18.10. */
+
+/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
+ requirement of a structure member (i.e., slot or field) that is of
+ type TYPE, as an integer constant expression.
+
+ This differs from GCC's and clang's __alignof__ operator, which can
+ yield a better-performing alignment for an object of that type. For
+ example, on x86 with GCC and on Linux/x86 with clang,
+ __alignof__ (double) and __alignof__ (long long) are 8, whereas
+ alignof (double) and alignof (long long) are 4 unless the option
+ '-malign-double' is used.
+
+ The result cannot be used as a value for an 'enum' constant, if you
+ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
+
+/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
+ clang versions < 8.0.0 have the same bug. */
+# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
+ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
+ && !defined __clang__) \
+ || (defined __clang__ && __clang_major__ < 8))
+# undef/**/_Alignof
+# ifdef __cplusplus
+# if (201103 <= __cplusplus || defined _MSC_VER)
+# define _Alignof(type) alignof (type)
# else
-# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+ template <class __t> struct __alignof_helper { char __a; __t __b; };
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
-# endif
-# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
-# define alignof _Alignof
-# endif
-# define __alignof_is_defined 1
-# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
-# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
-# define _Alignas(a) alignas (a)
-# elif (!defined __attribute__ \
- && ((defined __APPLE__ && defined __MACH__ \
- ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
- : __GNUC__ && !defined __ibmxl__) \
- || (4 <= __clang_major__) \
- || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
- || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__))
-# define _Alignas(a) __attribute__ ((__aligned__ (a)))
-# elif 1300 <= _MSC_VER
-# define _Alignas(a) __declspec (align (a))
+# else
+# if (defined __GNUC__ && 4 <= __GNUC__) || defined __clang__
+# define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
+# else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# define _GL_STDALIGN_NEEDS_STDDEF 1
# endif
# endif
-# if ((defined _Alignas \
- && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \
- || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# define alignas _Alignas
-# endif
-# if (defined alignas \
- || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)))
-# define __alignas_is_defined 1
-# endif
-# if _GL_STDALIGN_NEEDS_STDDEF
-# include <stddef.h>
+# endif
+# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))
+# undef/**/alignof
+# define alignof _Alignof
+# endif
+
+/* alignas (A), also known as _Alignas (A), aligns a variable or type
+ to the alignment A, where A is an integer constant expression. For
+ example:
+
+ int alignas (8) foo;
+ struct s { int a; int alignas (8) bar; };
+
+ aligns the address of FOO and the offset of BAR to be multiples of 8.
+
+ A should be a power of two that is at least the type's alignment
+ and at most the implementation's alignment limit. This limit is
+ 2**28 on typical GNUish hosts, and 2**13 on MSVC. To be portable
+ to MSVC through at least version 10.0, A should be an integer
+ constant, as MSVC does not support expressions such as 1 << 3.
+ To be portable to Sun C 5.11, do not align auto variables to
+ anything stricter than their default alignment.
+
+ The following C23 requirements are not supported here:
+
+ - If A is zero, alignas has no effect.
+ - alignas can be used multiple times; the strictest one wins.
+ - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
+
+ */
+# if !HAVE_STDALIGN_H
+# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)
+# define _Alignas(a) alignas (a)
+# elif (!defined __attribute__ \
+ && ((defined __APPLE__ && defined __MACH__ \
+ ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+ : __GNUC__ && !defined __ibmxl__) \
+ || (4 <= __clang_major__) \
+ || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
+ || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__))
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+# elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
# endif
-# endif /* _GL_STDALIGN_H */
+# endif
+# if ((defined _Alignas \
+ && !(defined __cplusplus \
+ && (201103 <= __cplusplus || defined _MSC_VER))) \
+ || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
+# define alignas _Alignas
+# endif
+# endif
+
+# if _GL_STDALIGN_NEEDS_STDDEF
+# include <stddef.h>
# endif
#endif])
])
+
+AC_DEFUN([gl_STDALIGN_H],
+[
+ AC_REQUIRE([gl_ALIGNASOF])
+ if test "$gl_cv_header_working_stdalign_h" = no; then
+ GL_GENERATE_STDALIGN_H=true
+ else
+ GL_GENERATE_STDALIGN_H=false
+ fi
+
+ gl_CHECK_NEXT_HEADERS([stdalign.h])
+ if test $ac_cv_header_stdalign_h = yes; then
+ HAVE_STDALIGN_H=1
+ else
+ HAVE_STDALIGN_H=0
+ fi
+ AC_SUBST([HAVE_STDALIGN_H])
+])
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index c0553d6f2ff..a2322ebb7ee 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,4 +1,4 @@
-# stddef_h.m4 serial 12
+# stddef_h.m4 serial 13
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -22,7 +22,14 @@ AC_DEFUN_ONCE([gl_STDDEF_H],
[gl_cv_type_max_align_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
- [[#include <stddef.h>
+ [[/* On FreeBSD 12.0/x86, max_align_t defined by <stddef.h> has
+ the correct alignment with the default (wrong) definition of
+ _Alignof, but a wrong alignment as soon as we activate an
+ ISO C compliant _Alignof definition. */
+ #if ((defined __GNUC__ && 4 <= __GNUC__) || defined __clang__) && !defined __cplusplus
+ #define _Alignof(type) __builtin_offsetof (struct { char __a; type __b; }, __b)
+ #endif
+ #include <stddef.h>
unsigned int s = sizeof (max_align_t);
#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__
int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1];
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index e96be22f583..249ef657224 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 66
+# stdlib_h.m4 serial 71
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,7 @@ AC_DEFUN_ONCE([gl_STDLIB_H],
# include <random.h>
#endif
]], [_Exit aligned_alloc atoll canonicalize_file_name free
- getloadavg getsubopt grantpt
+ getloadavg getprogname getsubopt grantpt
initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
posix_memalign posix_openpt ptsname ptsname_r qsort_r
random random_r reallocarray realpath rpmatch secure_getenv setenv
@@ -73,6 +73,7 @@ AC_DEFUN([gl_STDLIB_H_REQUIRE_DEFAULTS],
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CANONICALIZE_FILE_NAME])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREE_POSIX])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOADAVG])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPROGNAME])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSUBOPT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GRANTPT])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MALLOC_GNU])
@@ -130,6 +131,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_DECL_FCVT=1; AC_SUBST([HAVE_DECL_FCVT])
HAVE_DECL_GCVT=1; AC_SUBST([HAVE_DECL_GCVT])
HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
+ HAVE_GETPROGNAME=1; AC_SUBST([HAVE_GETPROGNAME])
HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
HAVE_GRANTPT=1; AC_SUBST([HAVE_GRANTPT])
HAVE_INITSTATE=1; AC_SUBST([HAVE_INITSTATE])
@@ -166,17 +168,24 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
HAVE_UNLOCKPT=1; AC_SUBST([HAVE_UNLOCKPT])
HAVE_DECL_UNSETENV=1; AC_SUBST([HAVE_DECL_UNSETENV])
+ REPLACE__EXIT=0; AC_SUBST([REPLACE__EXIT])
REPLACE_ALIGNED_ALLOC=0; AC_SUBST([REPLACE_ALIGNED_ALLOC])
REPLACE_CALLOC_FOR_CALLOC_GNU=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_GNU])
REPLACE_CALLOC_FOR_CALLOC_POSIX=0; AC_SUBST([REPLACE_CALLOC_FOR_CALLOC_POSIX])
REPLACE_CANONICALIZE_FILE_NAME=0; AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
REPLACE_FREE=0; AC_SUBST([REPLACE_FREE])
+ REPLACE_GETLOADAVG=0; AC_SUBST([REPLACE_GETLOADAVG])
+ REPLACE_GETPROGNAME=0; AC_SUBST([REPLACE_GETPROGNAME])
+ REPLACE_GETSUBOPT=0; AC_SUBST([REPLACE_GETSUBOPT])
REPLACE_INITSTATE=0; AC_SUBST([REPLACE_INITSTATE])
REPLACE_MALLOC_FOR_MALLOC_GNU=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_GNU])
REPLACE_MALLOC_FOR_MALLOC_POSIX=0; AC_SUBST([REPLACE_MALLOC_FOR_MALLOC_POSIX])
REPLACE_MBTOWC=0; AC_SUBST([REPLACE_MBTOWC])
+ REPLACE_MKOSTEMP=0; AC_SUBST([REPLACE_MKOSTEMP])
+ REPLACE_MKOSTEMPS=0; AC_SUBST([REPLACE_MKOSTEMPS])
REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
REPLACE_POSIX_MEMALIGN=0; AC_SUBST([REPLACE_POSIX_MEMALIGN])
+ REPLACE_POSIX_OPENPT=0; AC_SUBST([REPLACE_POSIX_OPENPT])
REPLACE_PTSNAME=0; AC_SUBST([REPLACE_PTSNAME])
REPLACE_PTSNAME_R=0; AC_SUBST([REPLACE_PTSNAME_R])
REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4
index e8a76bc34f3..f3acbee7be9 100644
--- a/m4/stpcpy.m4
+++ b/m4/stpcpy.m4
@@ -1,4 +1,4 @@
-# stpcpy.m4 serial 9
+# stpcpy.m4 serial 11
dnl Copyright (C) 2002, 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -13,9 +13,12 @@ AC_DEFUN([gl_FUNC_STPCPY],
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_STRING_H_DEFAULTS])
- AC_CHECK_FUNCS([stpcpy])
+ gl_CHECK_FUNCS_ANDROID([stpcpy], [[#include <string.h>]])
if test $ac_cv_func_stpcpy = no; then
HAVE_STPCPY=0
+ case "$gl_cv_onwards_func_stpcpy" in
+ future*) REPLACE_STPCPY=1 ;;
+ esac
fi
])
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 5da3cc25291..7f51391cbff 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -5,7 +5,7 @@
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 35
+# serial 37
# Written by Paul Eggert.
@@ -131,6 +131,8 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL])
REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR])
REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
+ REPLACE_MEMPCPY=0; AC_SUBST([REPLACE_MEMPCPY])
+ REPLACE_STPCPY=0; AC_SUBST([REPLACE_STPCPY])
REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY])
REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL])
REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index f6bf3a4f30e..b74870c3d0e 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
# Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc.
-# serial 20
+# serial 21
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -170,6 +170,7 @@ AC_DEFUN([gl_TIME_H_DEFAULTS],
REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME])
REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
+ REPLACE_TIMESPEC_GET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMESPEC_GET])
REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET])
dnl Hack so that the time module doesn't depend on the sys_time module.
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 6079f1a39c8..8ab265e65fe 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,4 +1,4 @@
-# timegm.m4 serial 13
+# timegm.m4 serial 15
dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_TIMEGM],
AC_REQUIRE([gl_TIME_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
REPLACE_TIMEGM=0
- AC_CHECK_FUNCS_ONCE([timegm])
+ gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]])
if test $ac_cv_func_timegm = yes; then
if test "$gl_cv_func_working_mktime" != yes; then
# Assume that timegm is buggy if mktime is.
@@ -17,6 +17,9 @@ AC_DEFUN([gl_FUNC_TIMEGM],
fi
else
HAVE_TIMEGM=0
+ case "$gl_cv_onwards_func_timegm" in
+ future*) REPLACE_TIMEGM=1 ;;
+ esac
fi
])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index f4384027e37..1c96158155a 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 90
+# unistd_h.m4 serial 94
dnl Copyright (C) 2006-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -225,6 +225,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_COPY_FILE_RANGE=0; AC_SUBST([REPLACE_COPY_FILE_RANGE])
REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
+ REPLACE_DUP3=0; AC_SUBST([REPLACE_DUP3])
REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL])
REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE])
REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP])
@@ -234,10 +235,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE])
REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
+ REPLACE_FDATASYNC=0; AC_SUBST([REPLACE_FDATASYNC])
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
+ REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
@@ -248,12 +251,14 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
+ REPLACE_PIPE2=0; AC_SUBST([REPLACE_PIPE2])
REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
REPLACE_READ=0; AC_SUBST([REPLACE_READ])
REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT])
REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
+ REPLACE_SETHOSTNAME=0; AC_SUBST([REPLACE_SETHOSTNAME])
REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT])
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index c5d9b69e6f5..5f8606167a6 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -3,7 +3,7 @@ dnl This file is free software; the Free 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 serial 12
+dnl serial 15
AC_DEFUN([gl_UTIMENS],
[
@@ -11,9 +11,11 @@ AC_DEFUN([gl_UTIMENS],
AC_REQUIRE([gl_FUNC_UTIMES])
AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_FUNCS_ONCE([futimens utimensat lutimes])
gl_CHECK_FUNCS_ANDROID([futimes], [[#include <sys/time.h>]])
gl_CHECK_FUNCS_ANDROID([futimesat], [[#include <sys/time.h>]])
+ gl_CHECK_FUNCS_ANDROID([lutimes], [[#include <sys/time.h>]])
+ gl_CHECK_FUNCS_ANDROID([futimens], [[#include <sys/stat.h>]])
+ gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time). It is not
diff --git a/m4/utimensat.m4 b/m4/utimensat.m4
index dd210fc989a..1a670bb7b78 100644
--- a/m4/utimensat.m4
+++ b/m4/utimensat.m4
@@ -1,4 +1,4 @@
-# serial 9
+# serial 11
# See if we need to provide utimensat replacement.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -13,9 +13,12 @@ AC_DEFUN([gl_FUNC_UTIMENSAT],
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CHECK_FUNCS_ONCE([utimensat])
+ gl_CHECK_FUNCS_ANDROID([utimensat], [[#include <sys/stat.h>]])
if test $ac_cv_func_utimensat = no; then
HAVE_UTIMENSAT=0
+ case "$gl_cv_onwards_func_utimensat" in
+ future*) REPLACE_UTIMENSAT=1 ;;
+ esac
else
AC_CACHE_CHECK([whether utimensat works],
[gl_cv_func_utimensat_works],