aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-02-21 16:29:57 +0800
committerPo Lu2023-02-21 16:29:57 +0800
commit8ca4162ecdb174e59d59fc127a1bc4fef7b89fa2 (patch)
tree7af0e3cbc48c5bba714d68ba05885a4bd0e1da52
parent7aa4ffddd842e495d1ae388afff12075317ecb07 (diff)
downloademacs-8ca4162ecdb174e59d59fc127a1bc4fef7b89fa2.tar.gz
emacs-8ca4162ecdb174e59d59fc127a1bc4fef7b89fa2.zip
Update from gnulib
* admin/merge-gnulib (GNULIB_MODULES): * cross/lib/getopt-pfx-core.h (optind): * cross/lib/limits.in.h (BOOL_WIDTH): * cross/lib/math.in.h: * cross/lib/stpncpy.c (__stpncpy): * cross/lib/string.in.h: * lib/getopt-pfx-core.h (optind): * lib/gnulib.mk.in (ANDROID_MIN_SDK): (GL_COND_OBJ_STDIO_READ_CONDITION): (LIBS): (NDK_BUILD_AR): (REPLACE__EXIT): (libgnu_a_SOURCES): * lib/limits.in.h (BOOL_WIDTH): * lib/math.in.h: * lib/stpncpy.c (__stpncpy): * lib/string.in.h: * m4/assert_h.m4 (gl_ASSERT_H): * m4/fdopendir.m4 (gl_FUNC_FDOPENDIR): * m4/getdelim.m4 (gl_FUNC_GETDELIM): * m4/getline.m4 (gl_FUNC_GETLINE): * m4/gnulib-common.m4 (gl_COMMON_BODY): (gl_CONDITIONAL_HEADER): (gl_CHECK_FUNCS_ANDROID): * m4/gnulib-comp.m4 (gl_EARLY): (gl_INIT): (gl_FILE_LIST): * m4/limits-h.m4: * m4/lstat.m4 (gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): * m4/malloc.m4 (_AC_FUNC_MALLOC_IF): * m4/printf.m4 (gl_PRINTF_SIZES_C99): (gl_PRINTF_INFINITE): (gl_PRINTF_INFINITE_LONG_DOUBLE): (gl_PRINTF_DIRECTIVE_A): (gl_PRINTF_DIRECTIVE_F): (gl_PRINTF_FLAG_ZERO): (gl_SNPRINTF_PRESENCE): (gl_SNPRINTF_DIRECTIVE_N): (gl_VSNPRINTF_ZEROSIZE_C99): * m4/pselect.m4 (gl_FUNC_PSELECT): * m4/readlink.m4 (gl_FUNC_READLINK): * m4/realloc.m4 (_AC_FUNC_REALLOC_IF): * m4/signbit.m4 (gl_SIGNBIT): * m4/stpncpy.m4 (gl_FUNC_STPNCPY): * m4/symlink.m4 (gl_FUNC_SYMLINK): Add gnulib module stpncpy. * src/android.c: Include string.h.
-rwxr-xr-xadmin/merge-gnulib2
-rw-r--r--cross/lib/getopt-pfx-core.h2
-rw-r--r--cross/lib/limits.in.h13
-rw-r--r--cross/lib/math.in.h2
-rw-r--r--cross/lib/stpncpy.c92
-rw-r--r--cross/lib/string.in.h4
-rw-r--r--lib/getopt-pfx-core.h2
-rw-r--r--lib/gnulib.mk.in17
-rw-r--r--lib/limits.in.h13
-rw-r--r--lib/math.in.h2
-rw-r--r--lib/stpncpy.c92
-rw-r--r--lib/string.in.h4
-rw-r--r--m4/assert_h.m414
-rw-r--r--m4/fdopendir.m414
-rw-r--r--m4/getdelim.m46
-rw-r--r--m4/getline.m46
-rw-r--r--m4/gnulib-common.m4219
-rw-r--r--m4/gnulib-comp.m410
-rw-r--r--m4/limits-h.m41
-rw-r--r--m4/lstat.m45
-rw-r--r--m4/malloc.m44
-rw-r--r--m4/printf.m444
-rw-r--r--m4/pselect.m44
-rw-r--r--m4/readlink.m48
-rw-r--r--m4/realloc.m44
-rw-r--r--m4/signbit.m444
-rw-r--r--m4/stpncpy.m4108
-rw-r--r--m4/symlink.m44
-rw-r--r--src/android.c1
29 files changed, 624 insertions, 117 deletions
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index f21c652c35c..60963669f1b 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -45,7 +45,7 @@ GNULIB_MODULES='
45 pathmax pipe2 printf-posix vasprintf-posix pselect pthread_sigmask 45 pathmax pipe2 printf-posix vasprintf-posix pselect pthread_sigmask
46 qcopy-acl readlink readlinkat regex 46 qcopy-acl readlink readlinkat regex
47 sig2str sigdescr_np socklen stat-time std-gnu11 stdbool stddef stdio 47 sig2str sigdescr_np socklen stat-time std-gnu11 stdbool stddef stdio
48 stpcpy strnlen strtoimax symlink sys_stat sys_time 48 stpcpy stpncpy strnlen strtoimax symlink sys_stat sys_time
49 tempname time time_r time_rz timegm timer-time timespec-add timespec-sub 49 tempname time time_r time_rz timegm timer-time timespec-add timespec-sub
50 update-copyright unlocked-io utimensat 50 update-copyright unlocked-io utimensat
51 vla warnings 51 vla warnings
diff --git a/cross/lib/getopt-pfx-core.h b/cross/lib/getopt-pfx-core.h
index 3a2fde5ad4f..095e3930feb 100644
--- a/cross/lib/getopt-pfx-core.h
+++ b/cross/lib/getopt-pfx-core.h
@@ -47,7 +47,7 @@
47# define optind __GETOPT_ID (optind) 47# define optind __GETOPT_ID (optind)
48# define optopt __GETOPT_ID (optopt) 48# define optopt __GETOPT_ID (optopt)
49 49
50/* Work around a a problem on macOS, which declares getopt with a 50/* Work around a problem on macOS, which declares getopt with a
51 trailing __DARWIN_ALIAS(getopt) that would expand to something like 51 trailing __DARWIN_ALIAS(getopt) that would expand to something like
52 __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following 52 __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
53 hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ 53 hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */
diff --git a/cross/lib/limits.in.h b/cross/lib/limits.in.h
index eaeac472299..a01b4c6a280 100644
--- a/cross/lib/limits.in.h
+++ b/cross/lib/limits.in.h
@@ -119,11 +119,14 @@
119 119
120/* Macros specified by C23. */ 120/* Macros specified by C23. */
121 121
122#if (! defined BOOL_WIDTH \ 122#if (defined _GNU_SOURCE \
123 && (defined _GNU_SOURCE \ 123 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
124 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) 124# if ! defined BOOL_WIDTH
125# define BOOL_MAX 1 125# define BOOL_WIDTH 1
126# define BOOL_WIDTH 1 126# define BOOL_MAX 1
127# elif ! defined BOOL_MAX
128# define BOOL_MAX ((((1U << (BOOL_WIDTH - 1)) - 1) << 1) + 1)
129# endif
127#endif 130#endif
128 131
129#endif /* _@GUARD_PREFIX@_LIMITS_H */ 132#endif /* _@GUARD_PREFIX@_LIMITS_H */
diff --git a/cross/lib/math.in.h b/cross/lib/math.in.h
index 70b75e2399e..76d48a44437 100644
--- a/cross/lib/math.in.h
+++ b/cross/lib/math.in.h
@@ -2624,7 +2624,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
2624# if defined isnan || defined GNULIB_NAMESPACE 2624# if defined isnan || defined GNULIB_NAMESPACE
2625_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) 2625_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
2626# undef isnan 2626# undef isnan
2627# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) 2627# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
2628 /* This platform's <cmath> possibly defines isnan through a set of inline 2628 /* This platform's <cmath> possibly defines isnan through a set of inline
2629 functions. */ 2629 functions. */
2630_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) 2630_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
diff --git a/cross/lib/stpncpy.c b/cross/lib/stpncpy.c
new file mode 100644
index 00000000000..d1422a927df
--- /dev/null
+++ b/cross/lib/stpncpy.c
@@ -0,0 +1,92 @@
1/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2023 Free Software
2 * Foundation, Inc.
3
4 NOTE: The canonical source of this file is maintained with the GNU C Library.
5 Bugs can be reported to bug-glibc@gnu.org.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
21
22#include <config.h>
23
24/* Specification. */
25#include <string.h>
26
27#ifndef weak_alias
28# define __stpncpy stpncpy
29#endif
30
31/* Copy no more than N bytes of SRC to DST, returning a pointer past the
32 last non-NUL byte written into DST. */
33char *
34(__stpncpy) (char *dest, const char *src, size_t n)
35{
36 char c;
37 char *s = dest;
38
39 if (n >= 4)
40 {
41 size_t n4 = n >> 2;
42
43 for (;;)
44 {
45 c = *src++;
46 *dest++ = c;
47 if (c == '\0')
48 break;
49 c = *src++;
50 *dest++ = c;
51 if (c == '\0')
52 break;
53 c = *src++;
54 *dest++ = c;
55 if (c == '\0')
56 break;
57 c = *src++;
58 *dest++ = c;
59 if (c == '\0')
60 break;
61 if (--n4 == 0)
62 goto last_chars;
63 }
64 n -= dest - s;
65 goto zero_fill;
66 }
67
68 last_chars:
69 n &= 3;
70 if (n == 0)
71 return dest;
72
73 for (;;)
74 {
75 c = *src++;
76 --n;
77 *dest++ = c;
78 if (c == '\0')
79 break;
80 if (n == 0)
81 return dest;
82 }
83
84 zero_fill:
85 while (n-- > 0)
86 dest[n] = '\0';
87
88 return dest - 1;
89}
90#ifdef weak_alias
91weak_alias (__stpncpy, stpncpy)
92#endif
diff --git a/cross/lib/string.in.h b/cross/lib/string.in.h
index aa088213927..b6bf432e1f1 100644
--- a/cross/lib/string.in.h
+++ b/cross/lib/string.in.h
@@ -126,7 +126,11 @@
126# if (@REPLACE_FREE@ && !defined free \ 126# if (@REPLACE_FREE@ && !defined free \
127 && !(defined __cplusplus && defined GNULIB_NAMESPACE)) 127 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
128/* We can't do '#define free rpl_free' here. */ 128/* We can't do '#define free rpl_free' here. */
129# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
130_GL_EXTERN_C void rpl_free (void *) throw ();
131# else
129_GL_EXTERN_C void rpl_free (void *); 132_GL_EXTERN_C void rpl_free (void *);
133# endif
130# undef _GL_ATTRIBUTE_DEALLOC_FREE 134# undef _GL_ATTRIBUTE_DEALLOC_FREE
131# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) 135# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
132# else 136# else
diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
index 3a2fde5ad4f..095e3930feb 100644
--- a/lib/getopt-pfx-core.h
+++ b/lib/getopt-pfx-core.h
@@ -47,7 +47,7 @@
47# define optind __GETOPT_ID (optind) 47# define optind __GETOPT_ID (optind)
48# define optopt __GETOPT_ID (optopt) 48# define optopt __GETOPT_ID (optopt)
49 49
50/* Work around a a problem on macOS, which declares getopt with a 50/* Work around a problem on macOS, which declares getopt with a
51 trailing __DARWIN_ALIAS(getopt) that would expand to something like 51 trailing __DARWIN_ALIAS(getopt) that would expand to something like
52 __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following 52 __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
53 hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ 53 hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 4746f5f86f2..e577d8063fd 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -152,6 +152,7 @@
152# stddef \ 152# stddef \
153# stdio \ 153# stdio \
154# stpcpy \ 154# stpcpy \
155# stpncpy \
155# strnlen \ 156# strnlen \
156# strtoimax \ 157# strtoimax \
157# symlink \ 158# symlink \
@@ -191,6 +192,7 @@ ANDROID_LIBS = @ANDROID_LIBS@
191ANDROID_MIN_SDK = @ANDROID_MIN_SDK@ 192ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
192ANDROID_OBJ = @ANDROID_OBJ@ 193ANDROID_OBJ = @ANDROID_OBJ@
193ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@ 194ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
195ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
194APKSIGNER = @APKSIGNER@ 196APKSIGNER = @APKSIGNER@
195APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ 197APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
196AR = @AR@ 198AR = @AR@
@@ -330,6 +332,7 @@ GL_COND_OBJ_SIGNBIT3_CONDITION = @GL_COND_OBJ_SIGNBIT3_CONDITION@
330GL_COND_OBJ_STDIO_READ_CONDITION = @GL_COND_OBJ_STDIO_READ_CONDITION@ 332GL_COND_OBJ_STDIO_READ_CONDITION = @GL_COND_OBJ_STDIO_READ_CONDITION@
331GL_COND_OBJ_STDIO_WRITE_CONDITION = @GL_COND_OBJ_STDIO_WRITE_CONDITION@ 333GL_COND_OBJ_STDIO_WRITE_CONDITION = @GL_COND_OBJ_STDIO_WRITE_CONDITION@
332GL_COND_OBJ_STPCPY_CONDITION = @GL_COND_OBJ_STPCPY_CONDITION@ 334GL_COND_OBJ_STPCPY_CONDITION = @GL_COND_OBJ_STPCPY_CONDITION@
335GL_COND_OBJ_STPNCPY_CONDITION = @GL_COND_OBJ_STPNCPY_CONDITION@
333GL_COND_OBJ_STRNLEN_CONDITION = @GL_COND_OBJ_STRNLEN_CONDITION@ 336GL_COND_OBJ_STRNLEN_CONDITION = @GL_COND_OBJ_STRNLEN_CONDITION@
334GL_COND_OBJ_STRTOIMAX_CONDITION = @GL_COND_OBJ_STRTOIMAX_CONDITION@ 337GL_COND_OBJ_STRTOIMAX_CONDITION = @GL_COND_OBJ_STRTOIMAX_CONDITION@
335GL_COND_OBJ_STRTOLL_CONDITION = @GL_COND_OBJ_STRTOLL_CONDITION@ 338GL_COND_OBJ_STRTOLL_CONDITION = @GL_COND_OBJ_STRTOLL_CONDITION@
@@ -1150,6 +1153,7 @@ LIBRESOLV = @LIBRESOLV@
1150LIBS = @LIBS@ 1153LIBS = @LIBS@
1151LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@ 1154LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@
1152LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@ 1155LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
1156LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@
1153LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ 1157LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
1154LIBSOUND = @LIBSOUND@ 1158LIBSOUND = @LIBSOUND@
1155LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ 1159LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@
@@ -1203,6 +1207,7 @@ NDK_BUILD_ANY_CXX_MODULE = @NDK_BUILD_ANY_CXX_MODULE@
1203NDK_BUILD_AR = @NDK_BUILD_AR@ 1207NDK_BUILD_AR = @NDK_BUILD_AR@
1204NDK_BUILD_ARCH = @NDK_BUILD_ARCH@ 1208NDK_BUILD_ARCH = @NDK_BUILD_ARCH@
1205NDK_BUILD_CC = @NDK_BUILD_CC@ 1209NDK_BUILD_CC = @NDK_BUILD_CC@
1210NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@
1206NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@ 1211NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@
1207NDK_BUILD_MODULES = @NDK_BUILD_MODULES@ 1212NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
1208NDK_BUILD_NASM = @NDK_BUILD_NASM@ 1213NDK_BUILD_NASM = @NDK_BUILD_NASM@
@@ -1554,7 +1559,7 @@ REPLACE_WRITE = @REPLACE_WRITE@
1554REPLACE__EXIT = @REPLACE__EXIT@ 1559REPLACE__EXIT = @REPLACE__EXIT@
1555RSVG_CFLAGS = @RSVG_CFLAGS@ 1560RSVG_CFLAGS = @RSVG_CFLAGS@
1556RSVG_LIBS = @RSVG_LIBS@ 1561RSVG_LIBS = @RSVG_LIBS@
1557SDK_BULD_TOOLS = @SDK_BULD_TOOLS@ 1562SDK_BUILD_TOOLS = @SDK_BUILD_TOOLS@
1558SEPCHAR = @SEPCHAR@ 1563SEPCHAR = @SEPCHAR@
1559SETFATTR = @SETFATTR@ 1564SETFATTR = @SETFATTR@
1560SETTINGS_CFLAGS = @SETTINGS_CFLAGS@ 1565SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
@@ -4184,6 +4189,16 @@ endif
4184endif 4189endif
4185## end gnulib module stpcpy 4190## end gnulib module stpcpy
4186 4191
4192## begin gnulib module stpncpy
4193ifeq (,$(OMIT_GNULIB_MODULE_stpncpy))
4194
4195ifneq (,$(GL_COND_OBJ_STPNCPY_CONDITION))
4196libgnu_a_SOURCES += stpncpy.c
4197endif
4198
4199endif
4200## end gnulib module stpncpy
4201
4187## begin gnulib module string 4202## begin gnulib module string
4188ifeq (,$(OMIT_GNULIB_MODULE_string)) 4203ifeq (,$(OMIT_GNULIB_MODULE_string))
4189 4204
diff --git a/lib/limits.in.h b/lib/limits.in.h
index eaeac472299..a01b4c6a280 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -119,11 +119,14 @@
119 119
120/* Macros specified by C23. */ 120/* Macros specified by C23. */
121 121
122#if (! defined BOOL_WIDTH \ 122#if (defined _GNU_SOURCE \
123 && (defined _GNU_SOURCE \ 123 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
124 || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) 124# if ! defined BOOL_WIDTH
125# define BOOL_MAX 1 125# define BOOL_WIDTH 1
126# define BOOL_WIDTH 1 126# define BOOL_MAX 1
127# elif ! defined BOOL_MAX
128# define BOOL_MAX ((((1U << (BOOL_WIDTH - 1)) - 1) << 1) + 1)
129# endif
127#endif 130#endif
128 131
129#endif /* _@GUARD_PREFIX@_LIMITS_H */ 132#endif /* _@GUARD_PREFIX@_LIMITS_H */
diff --git a/lib/math.in.h b/lib/math.in.h
index 70b75e2399e..76d48a44437 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -2624,7 +2624,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
2624# if defined isnan || defined GNULIB_NAMESPACE 2624# if defined isnan || defined GNULIB_NAMESPACE
2625_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) 2625_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
2626# undef isnan 2626# undef isnan
2627# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ < 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__))) 2627# if __GNUC__ >= 6 || (defined __clang__ && !((defined __APPLE__ && defined __MACH__ && __clang_major__ != 12) || (defined __FreeBSD__ && (__clang_major__ < 7 || __clang_major__ >= 11)) || defined __OpenBSD__ || (defined _WIN32 && !defined __CYGWIN__)))
2628 /* This platform's <cmath> possibly defines isnan through a set of inline 2628 /* This platform's <cmath> possibly defines isnan through a set of inline
2629 functions. */ 2629 functions. */
2630_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) 2630_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)
diff --git a/lib/stpncpy.c b/lib/stpncpy.c
new file mode 100644
index 00000000000..d1422a927df
--- /dev/null
+++ b/lib/stpncpy.c
@@ -0,0 +1,92 @@
1/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2023 Free Software
2 * Foundation, Inc.
3
4 NOTE: The canonical source of this file is maintained with the GNU C Library.
5 Bugs can be reported to bug-glibc@gnu.org.
6
7 This file is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
11
12 This file is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>. */
19
20/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
21
22#include <config.h>
23
24/* Specification. */
25#include <string.h>
26
27#ifndef weak_alias
28# define __stpncpy stpncpy
29#endif
30
31/* Copy no more than N bytes of SRC to DST, returning a pointer past the
32 last non-NUL byte written into DST. */
33char *
34(__stpncpy) (char *dest, const char *src, size_t n)
35{
36 char c;
37 char *s = dest;
38
39 if (n >= 4)
40 {
41 size_t n4 = n >> 2;
42
43 for (;;)
44 {
45 c = *src++;
46 *dest++ = c;
47 if (c == '\0')
48 break;
49 c = *src++;
50 *dest++ = c;
51 if (c == '\0')
52 break;
53 c = *src++;
54 *dest++ = c;
55 if (c == '\0')
56 break;
57 c = *src++;
58 *dest++ = c;
59 if (c == '\0')
60 break;
61 if (--n4 == 0)
62 goto last_chars;
63 }
64 n -= dest - s;
65 goto zero_fill;
66 }
67
68 last_chars:
69 n &= 3;
70 if (n == 0)
71 return dest;
72
73 for (;;)
74 {
75 c = *src++;
76 --n;
77 *dest++ = c;
78 if (c == '\0')
79 break;
80 if (n == 0)
81 return dest;
82 }
83
84 zero_fill:
85 while (n-- > 0)
86 dest[n] = '\0';
87
88 return dest - 1;
89}
90#ifdef weak_alias
91weak_alias (__stpncpy, stpncpy)
92#endif
diff --git a/lib/string.in.h b/lib/string.in.h
index aa088213927..b6bf432e1f1 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -126,7 +126,11 @@
126# if (@REPLACE_FREE@ && !defined free \ 126# if (@REPLACE_FREE@ && !defined free \
127 && !(defined __cplusplus && defined GNULIB_NAMESPACE)) 127 && !(defined __cplusplus && defined GNULIB_NAMESPACE))
128/* We can't do '#define free rpl_free' here. */ 128/* We can't do '#define free rpl_free' here. */
129# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
130_GL_EXTERN_C void rpl_free (void *) throw ();
131# else
129_GL_EXTERN_C void rpl_free (void *); 132_GL_EXTERN_C void rpl_free (void *);
133# endif
130# undef _GL_ATTRIBUTE_DEALLOC_FREE 134# undef _GL_ATTRIBUTE_DEALLOC_FREE
131# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) 135# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
132# else 136# else
diff --git a/m4/assert_h.m4 b/m4/assert_h.m4
index 3801452ef0d..d255855d313 100644
--- a/m4/assert_h.m4
+++ b/m4/assert_h.m4
@@ -46,10 +46,13 @@ AC_DEFUN([gl_ASSERT_H],
46 gl_NEXT_HEADERS([assert.h])]) 46 gl_NEXT_HEADERS([assert.h])])
47 47
48 dnl The "zz" puts this toward config.h's end, to avoid potential 48 dnl The "zz" puts this toward config.h's end, to avoid potential
49 dnl collisions with other definitions. #undef assert so that 49 dnl collisions with other definitions.
50 dnl programs are not tempted to use it without specifically 50 dnl #undef assert so that programs are not tempted to use it without
51 dnl including assert.h. Break the #undef apart with a comment 51 dnl specifically including assert.h.
52 dnl so that 'configure' does not comment it out. 52 dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
53 dnl <assert.h>, this include actually defines assert.
54 dnl Break the #undef_s apart with a comment so that 'configure' does
55 dnl not comment them out.
53 AH_VERBATIM([zzstatic_assert], 56 AH_VERBATIM([zzstatic_assert],
54[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ 57[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
55 && (!defined __cplusplus \ 58 && (!defined __cplusplus \
@@ -57,6 +60,9 @@ AC_DEFUN([gl_ASSERT_H],
57 && __GNUG__ < 6 && __clang_major__ < 6))) 60 && __GNUG__ < 6 && __clang_major__ < 6)))
58 #include <assert.h> 61 #include <assert.h>
59 #undef/**/assert 62 #undef/**/assert
63 #ifdef __sgi
64 #undef/**/__ASSERT_H__
65 #endif
60 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. 66 /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
61 We need it also to be invocable with a single argument. */ 67 We need it also to be invocable with a single argument. */
62 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus 68 #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index 2c975397118..dfcc46c03e2 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,4 +1,4 @@
1# serial 14 1# serial 15
2# See if we need to provide fdopendir. 2# See if we need to provide fdopendir.
3 3
4dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. 4dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -49,12 +49,12 @@ DIR *fdopendir (int);
49 [gl_cv_func_fdopendir_works=yes], 49 [gl_cv_func_fdopendir_works=yes],
50 [gl_cv_func_fdopendir_works=no], 50 [gl_cv_func_fdopendir_works=no],
51 [case "$host_os" in 51 [case "$host_os" in
52 # Guess yes on glibc systems. 52 # Guess yes on glibc systems.
53 *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; 53 *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
54 # Guess yes on musl systems. 54 # Guess yes on musl systems.
55 *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; 55 *-musl* | midipix*) gl_cv_func_fdopendir_works="guessing yes" ;;
56 # If we don't know, obey --enable-cross-guesses. 56 # If we don't know, obey --enable-cross-guesses.
57 *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; 57 *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;;
58 esac 58 esac
59 ])]) 59 ])])
60 case "$gl_cv_func_fdopendir_works" in 60 case "$gl_cv_func_fdopendir_works" in
diff --git a/m4/getdelim.m4 b/m4/getdelim.m4
index d89aae5dffc..60555b9718b 100644
--- a/m4/getdelim.m4
+++ b/m4/getdelim.m4
@@ -1,4 +1,4 @@
1# getdelim.m4 serial 18 1# getdelim.m4 serial 19
2 2
3dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. 3dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc.
4dnl 4dnl
@@ -82,8 +82,8 @@ AC_DEFUN([gl_FUNC_GETDELIM],
82 ], 82 ],
83 [gl_cv_func_working_getdelim="guessing yes"], 83 [gl_cv_func_working_getdelim="guessing yes"],
84 [case "$host_os" in 84 [case "$host_os" in
85 *-musl*) gl_cv_func_working_getdelim="guessing yes" ;; 85 *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
86 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; 86 *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
87 esac 87 esac
88 ]) 88 ])
89 ]) 89 ])
diff --git a/m4/getline.m4 b/m4/getline.m4
index 1f2825c3361..83e7e9315f6 100644
--- a/m4/getline.m4
+++ b/m4/getline.m4
@@ -1,4 +1,4 @@
1# getline.m4 serial 32 1# getline.m4 serial 33
2 2
3dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, 3dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation,
4dnl Inc. 4dnl Inc.
@@ -76,8 +76,8 @@ AC_DEFUN([gl_FUNC_GETLINE],
76 ], 76 ],
77 [am_cv_func_working_getline="guessing yes"], 77 [am_cv_func_working_getline="guessing yes"],
78 [case "$host_os" in 78 [case "$host_os" in
79 *-musl*) am_cv_func_working_getline="guessing yes" ;; 79 *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
80 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;; 80 *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
81 esac 81 esac
82 ]) 82 ])
83 ]) 83 ])
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index c0181abdc50..c84a2afd9c5 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,4 +1,4 @@
1# gnulib-common.m4 serial 80 1# gnulib-common.m4 serial 82
2dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -356,7 +356,7 @@ AC_DEFUN([gl_COMMON_BODY], [
356 [[__maybe_unused__]] nevertheless produces a warning. */ 356 [[__maybe_unused__]] nevertheless produces a warning. */
357#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED 357#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
358# if defined __clang__ && defined __cplusplus 358# if defined __clang__ && defined __cplusplus
359# if __clang_major__ >= 10 359# if !defined __apple_build_version__ && __clang_major__ >= 10
360# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] 360# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
361# endif 361# endif
362# elif defined __has_c_attribute 362# elif defined __has_c_attribute
@@ -1095,6 +1095,113 @@ AC_DEFUN([gl_CONDITIONAL_HEADER],
1095 m4_popdef([gl_header_name]) 1095 m4_popdef([gl_header_name])
1096]) 1096])
1097 1097
1098dnl Preparations for gl_CHECK_FUNCS_MACOS.
1099AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS],
1100[
1101 AC_REQUIRE([AC_CANONICAL_HOST])
1102 AC_REQUIRE([gl_COMPILER_CLANG])
1103 AC_CACHE_CHECK([for compiler option needed when checking for future declarations],
1104 [gl_cv_compiler_check_future_option],
1105 [case "$host_os" in
1106 dnl This is only needed on macOS.
1107 darwin*)
1108 if test $gl_cv_compiler_clang = yes; then
1109 dnl Test whether the compiler supports the option
1110 dnl '-Werror=unguarded-availability-new'.
1111 save_ac_compile="$ac_compile"
1112 ac_compile="$ac_compile -Werror=unguarded-availability-new"
1113 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
1114 [gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'],
1115 [gl_cv_compiler_check_future_option=none])
1116 ac_compile="$save_ac_compile"
1117 else
1118 gl_cv_compiler_check_future_option=none
1119 fi
1120 ;;
1121 *) gl_cv_compiler_check_future_option=none ;;
1122 esac
1123 ])
1124])
1125
1126dnl Pieces of the expansion of
1127dnl gl_CHECK_FUNCS_ANDROID
1128dnl gl_CHECK_FUNCS_MACOS
1129dnl gl_CHECK_FUNCS_ANDROID_MACOS
1130
1131AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE],
1132[
1133 *)
1134 AC_CHECK_FUNC([$1])
1135 [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
1136 ;;
1137])
1138
1139AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID],
1140[
1141 linux*-android*)
1142 AC_CHECK_DECL([$1], , , [$2])
1143 if test $[ac_cv_have_decl_][$1] = yes; then
1144 AC_CHECK_FUNC([[$1]])
1145 if test $[ac_cv_func_][$1] = yes; then
1146 [gl_cv_onwards_func_][$1]=yes
1147 else
1148 dnl The function is declared but does not exist. This should not
1149 dnl happen normally. But anyway, we know that a future version
1150 dnl of Android will have the function.
1151 [gl_cv_onwards_func_][$1]='future OS version'
1152 fi
1153 else
1154 [gl_cv_onwards_func_][$1]='future OS version'
1155 fi
1156 ;;
1157])
1158
1159AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
1160[
1161 darwin*)
1162 if test "x$gl_cv_compiler_check_future_option" != "xnone"; then
1163 dnl Use a compile test, not a link test.
1164 save_ac_compile="$ac_compile"
1165 ac_compile="$ac_compile $gl_cv_compiler_check_future_option"
1166 save_ac_compile_for_check_decl="$ac_compile_for_check_decl"
1167 ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option"
1168 unset [ac_cv_have_decl_][$1]
1169 AC_CHECK_DECL([$1], , , [$2])
1170 ac_compile="$save_ac_compile"
1171 ac_compile_for_check_decl="$save_ac_compile_for_check_decl"
1172 [ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]"
1173 if test $[ac_cv_func_][$1] = yes; then
1174 [gl_cv_onwards_func_][$1]=yes
1175 else
1176 unset [ac_cv_have_decl_][$1]
1177 AC_CHECK_DECL([$1], , , [$2])
1178 if test $[ac_cv_have_decl_][$1] = yes; then
1179 [gl_cv_onwards_func_][$1]='future OS version'
1180 else
1181 [gl_cv_onwards_func_][$1]=no
1182 fi
1183 fi
1184 else
1185 AC_CHECK_FUNC([$1])
1186 [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
1187 fi
1188 ;;
1189])
1190
1191AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS],
1192[
1193 case "$[gl_cv_onwards_func_][$1]" in
1194 future*) [ac_cv_func_][$1]=no ;;
1195 *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;;
1196 esac
1197 if test $[ac_cv_func_][$1] = yes; then
1198 AC_DEFINE([HAVE_]m4_translit([[$1]],
1199 [abcdefghijklmnopqrstuvwxyz],
1200 [ABCDEFGHIJKLMNOPQRSTUVWXYZ]),
1201 [1], [Define to 1 if you have the `$1' function.])
1202 fi
1203])
1204
1098dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) 1205dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
1099dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem 1206dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
1100dnl on Android. 1207dnl on Android.
@@ -1137,39 +1244,87 @@ AC_DEFUN([gl_CHECK_FUNCS_ANDROID],
1137 [[gl_cv_onwards_func_][$1]], 1244 [[gl_cv_onwards_func_][$1]],
1138 [gl_SILENT([ 1245 [gl_SILENT([
1139 case "$host_os" in 1246 case "$host_os" in
1140 linux*-android*) 1247 gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
1141 AC_CHECK_DECL([$1], , , [$2]) 1248 gl_CHECK_FUNCS_DEFAULT_CASE([$1])
1142 if test $[ac_cv_have_decl_][$1] = yes; then
1143 AC_CHECK_FUNC([[$1]])
1144 if test $[ac_cv_func_][$1] = yes; then
1145 [gl_cv_onwards_func_][$1]=yes
1146 else
1147 dnl The function is declared but does not exist. This should not
1148 dnl happen normally. But anyway, we know that a future version
1149 dnl of Android will have the function.
1150 [gl_cv_onwards_func_][$1]='future OS version'
1151 fi
1152 else
1153 [gl_cv_onwards_func_][$1]='future OS version'
1154 fi
1155 ;;
1156 *)
1157 AC_CHECK_FUNC([$1])
1158 [gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
1159 ;;
1160 esac 1249 esac
1161 ]) 1250 ])
1162 ]) 1251 ])
1163 case "$[gl_cv_onwards_func_][$1]" in 1252 gl_CHECK_FUNCS_SET_RESULTS([$1])
1164 future*) [ac_cv_func_][$1]=no ;; 1253])
1165 *) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;; 1254
1166 esac 1255dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1167 if test $[ac_cv_func_][$1] = yes; then 1256dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
1168 AC_DEFINE([HAVE_]m4_translit([[$1]], 1257dnl on macOS.
1169 [abcdefghijklmnopqrstuvwxyz], 1258dnl
1170 [ABCDEFGHIJKLMNOPQRSTUVWXYZ]), 1259dnl When code is compiled on macOS, it is in the context of a certain minimum
1171 [1], [Define to 1 if you have the `$1' function.]) 1260dnl macOS version, that can be set through the option '-mmacosx-version-min='.
1172 fi 1261dnl In other words, you don't compile for a specific version of macOS. You
1262dnl compile for all versions of macOS, onwards from the given version.
1263dnl Thus, the question "does the OS have the function func" has three possible
1264dnl answers:
1265dnl - yes, in all versions starting from the given version,
1266dnl - no, in no version,
1267dnl - not in the given version, but in a later version of macOS.
1268dnl
1269dnl In detail, this works as follows:
1270dnl If func was added to, say, macOS version 13, then the libc has the
1271dnl symbol func always, whereas the header file <foo.h> declares func
1272dnl conditionally with a special availability attribute:
1273dnl ... func (...) __attribute__((availability(macos,introduced=13.0)));
1274dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no
1275dnl warning about the use of func, and the resulting binary
1276dnl - runs fine on macOS 13,
1277dnl - aborts with a dyld "Symbol not found" message on macOS 12.
1278dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a
1279dnl warning: 'func' is only available on macOS 13.0 or newer
1280dnl [-Wunguarded-availability-new],
1281dnl and the resulting binary
1282dnl - runs fine on macOS 13,
1283dnl - crashes with a SIGSEGV (signal 11) on macOS 12.
1284dnl
1285dnl This macro sets two variables:
1286dnl - gl_cv_onwards_func_<func> to yes / no / "future OS version"
1287dnl - ac_cv_func_<func> to yes / no / no
1288dnl The first variable allows to distinguish all three cases.
1289dnl The second variable is set, so that an invocation
1290dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
1291dnl can be used as a drop-in replacement for
1292dnl AC_CHECK_FUNCS([func]).
1293AC_DEFUN([gl_CHECK_FUNCS_MACOS],
1294[
1295 AC_REQUIRE([AC_CANONICAL_HOST])
1296 AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
1297 AC_CACHE_CHECK([for [$1]],
1298 [[gl_cv_onwards_func_][$1]],
1299 [gl_SILENT([
1300 case "$host_os" in
1301 gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
1302 gl_CHECK_FUNCS_DEFAULT_CASE([$1])
1303 esac
1304 ])
1305 ])
1306 gl_CHECK_FUNCS_SET_RESULTS([$1])
1307])
1308
1309dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include <foo.h>]])
1310dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
1311dnl on Android and on macOS.
1312dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS.
1313AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS],
1314[
1315 AC_REQUIRE([AC_CANONICAL_HOST])
1316 AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
1317 AC_CACHE_CHECK([for [$1]],
1318 [[gl_cv_onwards_func_][$1]],
1319 [gl_SILENT([
1320 case "$host_os" in
1321 gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
1322 gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
1323 gl_CHECK_FUNCS_DEFAULT_CASE([$1])
1324 esac
1325 ])
1326 ])
1327 gl_CHECK_FUNCS_SET_RESULTS([$1])
1173]) 1328])
1174 1329
1175dnl Expands to some code for use in .c programs that, on native Windows, defines 1330dnl Expands to some code for use in .c programs that, on native Windows, defines
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 55444bc1450..fa9e589778f 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -195,6 +195,7 @@ AC_DEFUN([gl_EARLY],
195 # Code from module stdio: 195 # Code from module stdio:
196 # Code from module stdlib: 196 # Code from module stdlib:
197 # Code from module stpcpy: 197 # Code from module stpcpy:
198 # Code from module stpncpy:
198 # Code from module string: 199 # Code from module string:
199 # Code from module strnlen: 200 # Code from module strnlen:
200 # Code from module strtoimax: 201 # Code from module strtoimax:
@@ -619,6 +620,13 @@ AC_DEFUN([gl_INIT],
619 gl_PREREQ_STPCPY 620 gl_PREREQ_STPCPY
620 ]) 621 ])
621 gl_STRING_MODULE_INDICATOR([stpcpy]) 622 gl_STRING_MODULE_INDICATOR([stpcpy])
623 gl_FUNC_STPNCPY
624 gl_CONDITIONAL([GL_COND_OBJ_STPNCPY],
625 [test $HAVE_STPNCPY = 0 || test $REPLACE_STPNCPY = 1])
626 AM_COND_IF([GL_COND_OBJ_STPNCPY], [
627 gl_PREREQ_STPNCPY
628 ])
629 gl_STRING_MODULE_INDICATOR([stpncpy])
622 gl_STRING_H 630 gl_STRING_H
623 gl_STRING_H_REQUIRE_DEFAULTS 631 gl_STRING_H_REQUIRE_DEFAULTS
624 AC_PROG_MKDIR_P 632 AC_PROG_MKDIR_P
@@ -1587,6 +1595,7 @@ AC_DEFUN([gl_FILE_LIST], [
1587 lib/stdio.in.h 1595 lib/stdio.in.h
1588 lib/stdlib.in.h 1596 lib/stdlib.in.h
1589 lib/stpcpy.c 1597 lib/stpcpy.c
1598 lib/stpncpy.c
1590 lib/str-two-way.h 1599 lib/str-two-way.h
1591 lib/strftime.h 1600 lib/strftime.h
1592 lib/string.in.h 1601 lib/string.in.h
@@ -1758,6 +1767,7 @@ AC_DEFUN([gl_FILE_LIST], [
1758 m4/stdio_h.m4 1767 m4/stdio_h.m4
1759 m4/stdlib_h.m4 1768 m4/stdlib_h.m4
1760 m4/stpcpy.m4 1769 m4/stpcpy.m4
1770 m4/stpncpy.m4
1761 m4/string_h.m4 1771 m4/string_h.m4
1762 m4/strnlen.m4 1772 m4/strnlen.m4
1763 m4/strtoimax.m4 1773 m4/strtoimax.m4
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index 5088fa16fd3..4f8ce41098a 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -23,6 +23,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
23 int wb = WORD_BIT; 23 int wb = WORD_BIT;
24 int ullw = ULLONG_WIDTH; 24 int ullw = ULLONG_WIDTH;
25 int bw = BOOL_WIDTH; 25 int bw = BOOL_WIDTH;
26 int bm = BOOL_MAX;
26 ]])], 27 ]])],
27 [gl_cv_header_limits_width=yes], 28 [gl_cv_header_limits_width=yes],
28 [gl_cv_header_limits_width=no])]) 29 [gl_cv_header_limits_width=no])])
diff --git a/m4/lstat.m4 b/m4/lstat.m4
index 7e667fb187a..2bc46697934 100644
--- a/m4/lstat.m4
+++ b/m4/lstat.m4
@@ -1,4 +1,4 @@
1# serial 33 1# serial 34
2 2
3# Copyright (C) 1997-2001, 2003-2023 Free Software Foundation, Inc. 3# Copyright (C) 1997-2001, 2003-2023 Free Software Foundation, Inc.
4# 4#
@@ -56,6 +56,9 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
56 linux-* | linux) 56 linux-* | linux)
57 # Guess yes on Linux systems. 57 # Guess yes on Linux systems.
58 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; 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" ;;
59 *-gnu* | gnu*) 62 *-gnu* | gnu*)
60 # Guess yes on glibc systems. 63 # Guess yes on glibc systems.
61 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; 64 gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
diff --git a/m4/malloc.m4 b/m4/malloc.m4
index 554029243d1..bc580176f5f 100644
--- a/m4/malloc.m4
+++ b/m4/malloc.m4
@@ -1,4 +1,4 @@
1# malloc.m4 serial 28 1# malloc.m4 serial 29
2dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,7 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
25 [case "$host_os" in 25 [case "$host_os" in
26 # Guess yes on platforms where we know the result. 26 # Guess yes on platforms where we know the result.
27 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ 27 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
28 | gnu* | *-musl* | midnightbsd* \ 28 | gnu* | *-musl* | midipix* | midnightbsd* \
29 | hpux* | solaris* | cygwin* | mingw* | msys* ) 29 | hpux* | solaris* | cygwin* | mingw* | msys* )
30 ac_cv_func_malloc_0_nonnull="guessing yes" ;; 30 ac_cv_func_malloc_0_nonnull="guessing yes" ;;
31 # If we don't know, obey --enable-cross-guesses. 31 # If we don't know, obey --enable-cross-guesses.
diff --git a/m4/printf.m4 b/m4/printf.m4
index 4e65abc6e69..de98a870e98 100644
--- a/m4/printf.m4
+++ b/m4/printf.m4
@@ -1,4 +1,4 @@
1# printf.m4 serial 73 1# printf.m4 serial 74
2dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -63,7 +63,7 @@ changequote(,)dnl
63 # Guess yes on glibc systems. 63 # Guess yes on glibc systems.
64 *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; 64 *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
65 # Guess yes on musl systems. 65 # Guess yes on musl systems.
66 *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; 66 *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";;
67 # Guess yes on FreeBSD >= 5. 67 # Guess yes on FreeBSD >= 5.
68 freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; 68 freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";;
69 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; 69 freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
@@ -244,7 +244,7 @@ changequote(,)dnl
244 # Guess yes on glibc systems. 244 # Guess yes on glibc systems.
245 *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; 245 *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";;
246 # Guess yes on musl systems. 246 # Guess yes on musl systems.
247 *-musl*) gl_cv_func_printf_infinite="guessing yes";; 247 *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";;
248 # Guess yes on FreeBSD >= 6. 248 # Guess yes on FreeBSD >= 6.
249 freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; 249 freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
250 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; 250 freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
@@ -467,7 +467,7 @@ changequote(,)dnl
467 # Guess yes on glibc systems. 467 # Guess yes on glibc systems.
468 *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; 468 *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
469 # Guess yes on musl systems. 469 # Guess yes on musl systems.
470 *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; 470 *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";;
471 # Guess yes on FreeBSD >= 6. 471 # Guess yes on FreeBSD >= 6.
472 freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; 472 freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
473 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; 473 freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
@@ -591,7 +591,7 @@ int main ()
591 [gl_cv_func_printf_directive_a="guessing no"]) 591 [gl_cv_func_printf_directive_a="guessing no"])
592 ;; 592 ;;
593 # Guess yes on musl systems. 593 # Guess yes on musl systems.
594 *-musl*) gl_cv_func_printf_directive_a="guessing yes";; 594 *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";;
595 # Guess no on Android. 595 # Guess no on Android.
596 linux*-android*) gl_cv_func_printf_directive_a="guessing no";; 596 linux*-android*) gl_cv_func_printf_directive_a="guessing no";;
597 # Guess no on native Windows. 597 # Guess no on native Windows.
@@ -643,7 +643,7 @@ changequote(,)dnl
643 # Guess yes on glibc systems. 643 # Guess yes on glibc systems.
644 *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; 644 *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";;
645 # Guess yes on musl systems. 645 # Guess yes on musl systems.
646 *-musl*) gl_cv_func_printf_directive_f="guessing yes";; 646 *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";;
647 # Guess yes on FreeBSD >= 6. 647 # Guess yes on FreeBSD >= 6.
648 freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; 648 freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
649 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; 649 freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
@@ -990,18 +990,18 @@ int main ()
990 [ 990 [
991changequote(,)dnl 991changequote(,)dnl
992 case "$host_os" in 992 case "$host_os" in
993 # Guess yes on glibc systems. 993 # Guess yes on glibc systems.
994 *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; 994 *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
995 # Guess yes on musl systems. 995 # Guess yes on musl systems.
996 *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; 996 *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";;
997 # Guess yes on BeOS. 997 # Guess yes on BeOS.
998 beos*) gl_cv_func_printf_flag_zero="guessing yes";; 998 beos*) gl_cv_func_printf_flag_zero="guessing yes";;
999 # Guess no on Android. 999 # Guess no on Android.
1000 linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; 1000 linux*-android*) gl_cv_func_printf_flag_zero="guessing no";;
1001 # Guess no on native Windows. 1001 # Guess no on native Windows.
1002 mingw*) gl_cv_func_printf_flag_zero="guessing no";; 1002 mingw*) gl_cv_func_printf_flag_zero="guessing no";;
1003 # If we don't know, obey --enable-cross-guesses. 1003 # If we don't know, obey --enable-cross-guesses.
1004 *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; 1004 *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";;
1005 esac 1005 esac
1006changequote([,])dnl 1006changequote([,])dnl
1007 ]) 1007 ])
@@ -1239,7 +1239,7 @@ changequote(,)dnl
1239 # Guess yes on glibc systems. 1239 # Guess yes on glibc systems.
1240 *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1240 *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1241 # Guess yes on musl systems. 1241 # Guess yes on musl systems.
1242 *-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1242 *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
1243 # Guess yes on FreeBSD >= 5. 1243 # Guess yes on FreeBSD >= 5.
1244 freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; 1244 freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
1245 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; 1245 freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
@@ -1344,7 +1344,7 @@ changequote(,)dnl
1344 # Guess yes on glibc systems. 1344 # Guess yes on glibc systems.
1345 *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1345 *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1346 # Guess yes on musl systems. 1346 # Guess yes on musl systems.
1347 *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1347 *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
1348 # Guess yes on FreeBSD >= 5. 1348 # Guess yes on FreeBSD >= 5.
1349 freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; 1349 freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";;
1350 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; 1350 freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
@@ -1447,7 +1447,7 @@ int main ()
1447 ;; 1447 ;;
1448changequote(,)dnl 1448changequote(,)dnl
1449 # Guess yes on musl systems. 1449 # Guess yes on musl systems.
1450 *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; 1450 *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";;
1451 # Guess yes on FreeBSD >= 5. 1451 # Guess yes on FreeBSD >= 5.
1452 freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; 1452 freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";;
1453 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; 1453 freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
@@ -1604,7 +1604,7 @@ changequote(,)dnl
1604 # Guess yes on glibc systems. 1604 # Guess yes on glibc systems.
1605 *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1605 *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1606 # Guess yes on musl systems. 1606 # Guess yes on musl systems.
1607 *-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1607 *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
1608 # Guess yes on FreeBSD >= 5. 1608 # Guess yes on FreeBSD >= 5.
1609 freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; 1609 freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
1610 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; 1610 freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 9f2b282cee0..6c3d1b8f97f 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,4 +1,4 @@
1# pselect.m4 serial 10 1# pselect.m4 serial 11
2dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2011-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -54,6 +54,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
54 case "$host_os" in 54 case "$host_os" in
55 # Guess yes on Linux systems. 55 # Guess yes on Linux systems.
56 linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; 56 linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
57 # Guess yes on systems that emulate the Linux system calls.
58 midipix*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
57 # Guess yes on glibc systems. 59 # Guess yes on glibc systems.
58 *-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; 60 *-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
59 # If we don't know, obey --enable-cross-guesses. 61 # If we don't know, obey --enable-cross-guesses.
diff --git a/m4/readlink.m4 b/m4/readlink.m4
index 078b93aa9dc..f1d41d2b113 100644
--- a/m4/readlink.m4
+++ b/m4/readlink.m4
@@ -1,4 +1,4 @@
1# readlink.m4 serial 16 1# readlink.m4 serial 17
2dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -38,6 +38,9 @@ AC_DEFUN([gl_FUNC_READLINK],
38 # Guess yes on Linux or glibc systems. 38 # Guess yes on Linux or glibc systems.
39 linux-* | linux | *-gnu* | gnu*) 39 linux-* | linux | *-gnu* | gnu*)
40 gl_cv_func_readlink_trailing_slash="guessing yes" ;; 40 gl_cv_func_readlink_trailing_slash="guessing yes" ;;
41 # Guess yes on systems that emulate the Linux system calls.
42 midipix*)
43 gl_cv_func_readlink_trailing_slash="guessing yes" ;;
41 # Guess no on AIX or HP-UX. 44 # Guess no on AIX or HP-UX.
42 aix* | hpux*) 45 aix* | hpux*)
43 gl_cv_func_readlink_trailing_slash="guessing no" ;; 46 gl_cv_func_readlink_trailing_slash="guessing no" ;;
@@ -75,6 +78,9 @@ AC_DEFUN([gl_FUNC_READLINK],
75 # Guess yes on Linux or glibc systems. 78 # Guess yes on Linux or glibc systems.
76 linux-* | linux | *-gnu* | gnu*) 79 linux-* | linux | *-gnu* | gnu*)
77 gl_cv_func_readlink_truncate="guessing yes" ;; 80 gl_cv_func_readlink_truncate="guessing yes" ;;
81 # Guess yes on systems that emulate the Linux system calls.
82 midipix*)
83 gl_cv_func_readlink_truncate="guessing yes" ;;
78 # Guess no on AIX or HP-UX. 84 # Guess no on AIX or HP-UX.
79 aix* | hpux*) 85 aix* | hpux*)
80 gl_cv_func_readlink_truncate="guessing no" ;; 86 gl_cv_func_readlink_truncate="guessing no" ;;
diff --git a/m4/realloc.m4 b/m4/realloc.m4
index d22138fc7ac..26053914cbe 100644
--- a/m4/realloc.m4
+++ b/m4/realloc.m4
@@ -1,4 +1,4 @@
1# realloc.m4 serial 26 1# realloc.m4 serial 27
2dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,7 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
25 [case "$host_os" in 25 [case "$host_os" in
26 # Guess yes on platforms where we know the result. 26 # Guess yes on platforms where we know the result.
27 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ 27 *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
28 | gnu* | *-musl* | midnightbsd* \ 28 | gnu* | *-musl* | midipix* | midnightbsd* \
29 | hpux* | solaris* | cygwin* | mingw* | msys* ) 29 | hpux* | solaris* | cygwin* | mingw* | msys* )
30 ac_cv_func_realloc_0_nonnull="guessing yes" ;; 30 ac_cv_func_realloc_0_nonnull="guessing yes" ;;
31 # If we don't know, obey --enable-cross-guesses. 31 # If we don't know, obey --enable-cross-guesses.
diff --git a/m4/signbit.m4 b/m4/signbit.m4
index f957884340d..2fea73f854c 100644
--- a/m4/signbit.m4
+++ b/m4/signbit.m4
@@ -1,4 +1,4 @@
1# signbit.m4 serial 20 1# signbit.m4 serial 21
2dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. 2dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -29,14 +29,14 @@ AC_DEFUN([gl_SIGNBIT],
29 [gl_cv_func_signbit=yes], 29 [gl_cv_func_signbit=yes],
30 [gl_cv_func_signbit=no], 30 [gl_cv_func_signbit=no],
31 [case "$host_os" in 31 [case "$host_os" in
32 # Guess yes on glibc systems. 32 # Guess yes on glibc systems.
33 *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; 33 *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;;
34 # Guess yes on musl systems. 34 # Guess yes on musl systems.
35 *-musl*) gl_cv_func_signbit="guessing yes" ;; 35 *-musl* | midipix*) gl_cv_func_signbit="guessing yes" ;;
36 # Guess yes on native Windows. 36 # Guess yes on native Windows.
37 mingw*) gl_cv_func_signbit="guessing yes" ;; 37 mingw*) gl_cv_func_signbit="guessing yes" ;;
38 # If we don't know, obey --enable-cross-guesses. 38 # If we don't know, obey --enable-cross-guesses.
39 *) gl_cv_func_signbit="$gl_cross_guess_normal" ;; 39 *) gl_cv_func_signbit="$gl_cross_guess_normal" ;;
40 esac 40 esac
41 ]) 41 ])
42 ]) 42 ])
@@ -63,19 +63,19 @@ AC_DEFUN([gl_SIGNBIT],
63 [gl_cv_func_signbit_builtins=yes], 63 [gl_cv_func_signbit_builtins=yes],
64 [gl_cv_func_signbit_builtins=no], 64 [gl_cv_func_signbit_builtins=no],
65 [case "$host_os" in 65 [case "$host_os" in
66 # Guess yes on glibc systems. 66 # Guess yes on glibc systems.
67 *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;; 67 *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;;
68 # Guess yes on musl systems. 68 # Guess yes on musl systems.
69 *-musl*) gl_cv_func_signbit_builtins="guessing yes" ;; 69 *-musl* | midipix*) gl_cv_func_signbit_builtins="guessing yes" ;;
70 # Guess yes on mingw, no on MSVC. 70 # Guess yes on mingw, no on MSVC.
71 mingw*) if test -n "$GCC"; then 71 mingw*) if test -n "$GCC"; then
72 gl_cv_func_signbit_builtins="guessing yes" 72 gl_cv_func_signbit_builtins="guessing yes"
73 else 73 else
74 gl_cv_func_signbit_builtins="guessing no" 74 gl_cv_func_signbit_builtins="guessing no"
75 fi 75 fi
76 ;; 76 ;;
77 # If we don't know, obey --enable-cross-guesses. 77 # If we don't know, obey --enable-cross-guesses.
78 *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;; 78 *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;;
79 esac 79 esac
80 ]) 80 ])
81 ]) 81 ])
diff --git a/m4/stpncpy.m4 b/m4/stpncpy.m4
new file mode 100644
index 00000000000..073607004be
--- /dev/null
+++ b/m4/stpncpy.m4
@@ -0,0 +1,108 @@
1# stpncpy.m4 serial 22
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation,
3dnl 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_FUNC_STPNCPY],
9[
10 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
11
12 dnl Persuade glibc <string.h> to declare stpncpy().
13 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
14
15 dnl The stpncpy() declaration in lib/string.in.h uses 'restrict'.
16 AC_REQUIRE([AC_C_RESTRICT])
17
18 AC_REQUIRE([gl_STRING_H_DEFAULTS])
19
20 dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
21 dnl declared in <string.h>. Its side effects are the same as those
22 dnl of strncpy():
23 dnl stpncpy (dest, src, n)
24 dnl overwrites dest[0..n-1], min(strlen(src),n) bytes coming from src,
25 dnl and the remaining bytes being NULs. However, the return value is
26 dnl in glibc: dest + min(strlen(src),n)
27 dnl in AIX: dest + max(0,n-1)
28 dnl Only the glibc return value is useful in practice.
29
30 AC_CHECK_DECLS_ONCE([stpncpy])
31 gl_CHECK_FUNCS_ANDROID([stpncpy], [[#include <string.h>]])
32 if test $ac_cv_func_stpncpy = yes; then
33 AC_CACHE_CHECK([for working stpncpy], [gl_cv_func_stpncpy], [
34 AC_RUN_IFELSE(
35 [AC_LANG_SOURCE([[
36#include <stdlib.h>
37#include <string.h> /* for strcpy */
38/* The stpncpy prototype is missing in <string.h> on AIX 4. */
39#if !HAVE_DECL_STPNCPY
40extern
41# ifdef __cplusplus
42"C"
43# endif
44char *stpncpy (char *dest, const char *src, size_t n);
45#endif
46int main ()
47{
48 int result = 0;
49 const char *src = "Hello";
50 char dest[10];
51 /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+1 here. */
52 {
53 strcpy (dest, "\377\377\377\377\377\377");
54 if (stpncpy (dest, src, 2) != dest + 2)
55 result |= 1;
56 }
57 /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+4 here. */
58 {
59 strcpy (dest, "\377\377\377\377\377\377");
60 if (stpncpy (dest, src, 5) != dest + 5)
61 result |= 2;
62 }
63 /* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+6 here. */
64 {
65 strcpy (dest, "\377\377\377\377\377\377");
66 if (stpncpy (dest, src, 7) != dest + 5)
67 result |= 4;
68 }
69 return result;
70}
71]])],
72 [gl_cv_func_stpncpy=yes],
73 [gl_cv_func_stpncpy=no],
74 [dnl Guess yes on glibc systems and musl systems.
75 AC_EGREP_CPP([Thanks for using GNU], [
76#include <features.h>
77#ifdef __GNU_LIBRARY__
78 Thanks for using GNU
79#endif
80], [gl_cv_func_stpncpy="guessing yes"],
81 [case "$host_os" in
82 *-musl* | midipix*) gl_cv_func_stpncpy="guessing yes" ;;
83 *) gl_cv_func_stpncpy="$gl_cross_guess_normal" ;;
84 esac
85 ])
86 ])
87 ])
88 case "$gl_cv_func_stpncpy" in
89 *yes)
90 AC_DEFINE([HAVE_STPNCPY], [1],
91 [Define if you have the stpncpy() function and it works.])
92 ;;
93 *)
94 REPLACE_STPNCPY=1
95 ;;
96 esac
97 else
98 HAVE_STPNCPY=0
99 case "$gl_cv_onwards_func_stpncpy" in
100 future*) REPLACE_STPNCPY=1 ;;
101 esac
102 fi
103])
104
105# Prerequisites of lib/stpncpy.c.
106AC_DEFUN([gl_PREREQ_STPNCPY], [
107 :
108])
diff --git a/m4/symlink.m4 b/m4/symlink.m4
index 7796ec8bbc0..52d6c115ca5 100644
--- a/m4/symlink.m4
+++ b/m4/symlink.m4
@@ -1,4 +1,4 @@
1# serial 9 1# serial 10
2# See if we need to provide symlink replacement. 2# See if we need to provide symlink replacement.
3 3
4dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. 4dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@@ -38,6 +38,8 @@ AC_DEFUN([gl_FUNC_SYMLINK],
38 [case "$host_os" in 38 [case "$host_os" in
39 # Guess yes on Linux systems. 39 # Guess yes on Linux systems.
40 linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; 40 linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
41 # Guess yes on systems that emulate the Linux system calls.
42 midipix*) gl_cv_func_symlink_works="guessing yes" ;;
41 # Guess yes on glibc systems. 43 # Guess yes on glibc systems.
42 *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; 44 *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;;
43 # If we don't know, obey --enable-cross-guesses. 45 # If we don't know, obey --enable-cross-guesses.
diff --git a/src/android.c b/src/android.c
index 75a97f9db33..0627b44f8fd 100644
--- a/src/android.c
+++ b/src/android.c
@@ -27,6 +27,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
27#include <dlfcn.h> 27#include <dlfcn.h>
28#include <errno.h> 28#include <errno.h>
29#include <math.h> 29#include <math.h>
30#include <string.h>
30 31
31#include <sys/stat.h> 32#include <sys/stat.h>
32#include <sys/mman.h> 33#include <sys/mman.h>