1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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.
This commit is contained in:
Po Lu 2023-02-21 16:29:57 +08:00
parent 7aa4ffddd8
commit 8ca4162ecd
29 changed files with 624 additions and 117 deletions

View file

@ -45,7 +45,7 @@ GNULIB_MODULES='
pathmax pipe2 printf-posix vasprintf-posix pselect pthread_sigmask pathmax pipe2 printf-posix vasprintf-posix pselect pthread_sigmask
qcopy-acl readlink readlinkat regex qcopy-acl readlink readlinkat regex
sig2str sigdescr_np socklen stat-time std-gnu11 stdbool stddef stdio sig2str sigdescr_np socklen stat-time std-gnu11 stdbool stddef stdio
stpcpy strnlen strtoimax symlink sys_stat sys_time stpcpy stpncpy strnlen strtoimax symlink sys_stat sys_time
tempname time time_r time_rz timegm timer-time timespec-add timespec-sub tempname time time_r time_rz timegm timer-time timespec-add timespec-sub
update-copyright unlocked-io utimensat update-copyright unlocked-io utimensat
vla warnings vla warnings

View file

@ -47,7 +47,7 @@
# define optind __GETOPT_ID (optind) # define optind __GETOPT_ID (optind)
# define optopt __GETOPT_ID (optopt) # define optopt __GETOPT_ID (optopt)
/* Work around a a problem on macOS, which declares getopt with a /* Work around a problem on macOS, which declares getopt with a
trailing __DARWIN_ALIAS(getopt) that would expand to something like trailing __DARWIN_ALIAS(getopt) that would expand to something like
__asm("_" "rpl_getopt" "$UNIX2003") were it not for the following __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */

View file

@ -119,11 +119,14 @@
/* Macros specified by C23. */ /* Macros specified by C23. */
#if (! defined BOOL_WIDTH \ #if (defined _GNU_SOURCE \
&& (defined _GNU_SOURCE \ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # if ! defined BOOL_WIDTH
# define BOOL_MAX 1 # define BOOL_WIDTH 1
# define BOOL_WIDTH 1 # define BOOL_MAX 1
# elif ! defined BOOL_MAX
# define BOOL_MAX ((((1U << (BOOL_WIDTH - 1)) - 1) << 1) + 1)
# endif
#endif #endif
#endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */

View file

@ -2624,7 +2624,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
# if defined isnan || defined GNULIB_NAMESPACE # if defined isnan || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan # undef isnan
# 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__))) # 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__)))
/* This platform's <cmath> possibly defines isnan through a set of inline /* This platform's <cmath> possibly defines isnan through a set of inline
functions. */ functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)

92
cross/lib/stpncpy.c Normal file
View file

@ -0,0 +1,92 @@
/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2023 Free Software
* Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
#include <config.h>
/* Specification. */
#include <string.h>
#ifndef weak_alias
# define __stpncpy stpncpy
#endif
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
last non-NUL byte written into DST. */
char *
(__stpncpy) (char *dest, const char *src, size_t n)
{
char c;
char *s = dest;
if (n >= 4)
{
size_t n4 = n >> 2;
for (;;)
{
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
if (--n4 == 0)
goto last_chars;
}
n -= dest - s;
goto zero_fill;
}
last_chars:
n &= 3;
if (n == 0)
return dest;
for (;;)
{
c = *src++;
--n;
*dest++ = c;
if (c == '\0')
break;
if (n == 0)
return dest;
}
zero_fill:
while (n-- > 0)
dest[n] = '\0';
return dest - 1;
}
#ifdef weak_alias
weak_alias (__stpncpy, stpncpy)
#endif

View file

@ -126,7 +126,11 @@
# if (@REPLACE_FREE@ && !defined free \ # if (@REPLACE_FREE@ && !defined free \
&& !(defined __cplusplus && defined GNULIB_NAMESPACE)) && !(defined __cplusplus && defined GNULIB_NAMESPACE))
/* We can't do '#define free rpl_free' here. */ /* We can't do '#define free rpl_free' here. */
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
_GL_EXTERN_C void rpl_free (void *) throw ();
# else
_GL_EXTERN_C void rpl_free (void *); _GL_EXTERN_C void rpl_free (void *);
# endif
# undef _GL_ATTRIBUTE_DEALLOC_FREE # undef _GL_ATTRIBUTE_DEALLOC_FREE
# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
# else # else

View file

@ -47,7 +47,7 @@
# define optind __GETOPT_ID (optind) # define optind __GETOPT_ID (optind)
# define optopt __GETOPT_ID (optopt) # define optopt __GETOPT_ID (optopt)
/* Work around a a problem on macOS, which declares getopt with a /* Work around a problem on macOS, which declares getopt with a
trailing __DARWIN_ALIAS(getopt) that would expand to something like trailing __DARWIN_ALIAS(getopt) that would expand to something like
__asm("_" "rpl_getopt" "$UNIX2003") were it not for the following __asm("_" "rpl_getopt" "$UNIX2003") were it not for the following
hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */ hack to suppress the macOS declaration <https://bugs.gnu.org/40205>. */

View file

@ -152,6 +152,7 @@
# stddef \ # stddef \
# stdio \ # stdio \
# stpcpy \ # stpcpy \
# stpncpy \
# strnlen \ # strnlen \
# strtoimax \ # strtoimax \
# symlink \ # symlink \
@ -191,6 +192,7 @@ ANDROID_LIBS = @ANDROID_LIBS@
ANDROID_MIN_SDK = @ANDROID_MIN_SDK@ ANDROID_MIN_SDK = @ANDROID_MIN_SDK@
ANDROID_OBJ = @ANDROID_OBJ@ ANDROID_OBJ = @ANDROID_OBJ@
ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@ ANDROID_SDK_18_OR_EARLIER = @ANDROID_SDK_18_OR_EARLIER@
ANDROID_SDK_8_OR_EARLIER = @ANDROID_SDK_8_OR_EARLIER@
APKSIGNER = @APKSIGNER@ APKSIGNER = @APKSIGNER@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@ AR = @AR@
@ -330,6 +332,7 @@ GL_COND_OBJ_SIGNBIT3_CONDITION = @GL_COND_OBJ_SIGNBIT3_CONDITION@
GL_COND_OBJ_STDIO_READ_CONDITION = @GL_COND_OBJ_STDIO_READ_CONDITION@ GL_COND_OBJ_STDIO_READ_CONDITION = @GL_COND_OBJ_STDIO_READ_CONDITION@
GL_COND_OBJ_STDIO_WRITE_CONDITION = @GL_COND_OBJ_STDIO_WRITE_CONDITION@ GL_COND_OBJ_STDIO_WRITE_CONDITION = @GL_COND_OBJ_STDIO_WRITE_CONDITION@
GL_COND_OBJ_STPCPY_CONDITION = @GL_COND_OBJ_STPCPY_CONDITION@ GL_COND_OBJ_STPCPY_CONDITION = @GL_COND_OBJ_STPCPY_CONDITION@
GL_COND_OBJ_STPNCPY_CONDITION = @GL_COND_OBJ_STPNCPY_CONDITION@
GL_COND_OBJ_STRNLEN_CONDITION = @GL_COND_OBJ_STRNLEN_CONDITION@ GL_COND_OBJ_STRNLEN_CONDITION = @GL_COND_OBJ_STRNLEN_CONDITION@
GL_COND_OBJ_STRTOIMAX_CONDITION = @GL_COND_OBJ_STRTOIMAX_CONDITION@ GL_COND_OBJ_STRTOIMAX_CONDITION = @GL_COND_OBJ_STRTOIMAX_CONDITION@
GL_COND_OBJ_STRTOLL_CONDITION = @GL_COND_OBJ_STRTOLL_CONDITION@ GL_COND_OBJ_STRTOLL_CONDITION = @GL_COND_OBJ_STRTOLL_CONDITION@
@ -1150,6 +1153,7 @@ LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@ LIBS = @LIBS@
LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@ LIBSECCOMP_CFLAGS = @LIBSECCOMP_CFLAGS@
LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@ LIBSECCOMP_LIBS = @LIBSECCOMP_LIBS@
LIBSELINUX_CFLAGS = @LIBSELINUX_CFLAGS@
LIBSELINUX_LIBS = @LIBSELINUX_LIBS@ LIBSELINUX_LIBS = @LIBSELINUX_LIBS@
LIBSOUND = @LIBSOUND@ LIBSOUND = @LIBSOUND@
LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@
@ -1203,6 +1207,7 @@ NDK_BUILD_ANY_CXX_MODULE = @NDK_BUILD_ANY_CXX_MODULE@
NDK_BUILD_AR = @NDK_BUILD_AR@ NDK_BUILD_AR = @NDK_BUILD_AR@
NDK_BUILD_ARCH = @NDK_BUILD_ARCH@ NDK_BUILD_ARCH = @NDK_BUILD_ARCH@
NDK_BUILD_CC = @NDK_BUILD_CC@ NDK_BUILD_CC = @NDK_BUILD_CC@
NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@
NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@ NDK_BUILD_CXX_SHARED = @NDK_BUILD_CXX_SHARED@
NDK_BUILD_MODULES = @NDK_BUILD_MODULES@ NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
NDK_BUILD_NASM = @NDK_BUILD_NASM@ NDK_BUILD_NASM = @NDK_BUILD_NASM@
@ -1554,7 +1559,7 @@ REPLACE_WRITE = @REPLACE_WRITE@
REPLACE__EXIT = @REPLACE__EXIT@ REPLACE__EXIT = @REPLACE__EXIT@
RSVG_CFLAGS = @RSVG_CFLAGS@ RSVG_CFLAGS = @RSVG_CFLAGS@
RSVG_LIBS = @RSVG_LIBS@ RSVG_LIBS = @RSVG_LIBS@
SDK_BULD_TOOLS = @SDK_BULD_TOOLS@ SDK_BUILD_TOOLS = @SDK_BUILD_TOOLS@
SEPCHAR = @SEPCHAR@ SEPCHAR = @SEPCHAR@
SETFATTR = @SETFATTR@ SETFATTR = @SETFATTR@
SETTINGS_CFLAGS = @SETTINGS_CFLAGS@ SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
@ -4184,6 +4189,16 @@ endif
endif endif
## end gnulib module stpcpy ## end gnulib module stpcpy
## begin gnulib module stpncpy
ifeq (,$(OMIT_GNULIB_MODULE_stpncpy))
ifneq (,$(GL_COND_OBJ_STPNCPY_CONDITION))
libgnu_a_SOURCES += stpncpy.c
endif
endif
## end gnulib module stpncpy
## begin gnulib module string ## begin gnulib module string
ifeq (,$(OMIT_GNULIB_MODULE_string)) ifeq (,$(OMIT_GNULIB_MODULE_string))

View file

@ -119,11 +119,14 @@
/* Macros specified by C23. */ /* Macros specified by C23. */
#if (! defined BOOL_WIDTH \ #if (defined _GNU_SOURCE \
&& (defined _GNU_SOURCE \ || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))
|| (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # if ! defined BOOL_WIDTH
# define BOOL_MAX 1 # define BOOL_WIDTH 1
# define BOOL_WIDTH 1 # define BOOL_MAX 1
# elif ! defined BOOL_MAX
# define BOOL_MAX ((((1U << (BOOL_WIDTH - 1)) - 1) << 1) + 1)
# endif
#endif #endif
#endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */

View file

@ -2624,7 +2624,7 @@ _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
# if defined isnan || defined GNULIB_NAMESPACE # if defined isnan || defined GNULIB_NAMESPACE
_GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan) _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
# undef isnan # undef isnan
# 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__))) # 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__)))
/* This platform's <cmath> possibly defines isnan through a set of inline /* This platform's <cmath> possibly defines isnan through a set of inline
functions. */ functions. */
_GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool) _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan, rpl_isnan, bool)

92
lib/stpncpy.c Normal file
View file

@ -0,0 +1,92 @@
/* Copyright (C) 1993, 1995-1997, 2002-2003, 2005-2007, 2009-2023 Free Software
* Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This is almost copied from strncpy.c, written by Torbjorn Granlund. */
#include <config.h>
/* Specification. */
#include <string.h>
#ifndef weak_alias
# define __stpncpy stpncpy
#endif
/* Copy no more than N bytes of SRC to DST, returning a pointer past the
last non-NUL byte written into DST. */
char *
(__stpncpy) (char *dest, const char *src, size_t n)
{
char c;
char *s = dest;
if (n >= 4)
{
size_t n4 = n >> 2;
for (;;)
{
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
c = *src++;
*dest++ = c;
if (c == '\0')
break;
if (--n4 == 0)
goto last_chars;
}
n -= dest - s;
goto zero_fill;
}
last_chars:
n &= 3;
if (n == 0)
return dest;
for (;;)
{
c = *src++;
--n;
*dest++ = c;
if (c == '\0')
break;
if (n == 0)
return dest;
}
zero_fill:
while (n-- > 0)
dest[n] = '\0';
return dest - 1;
}
#ifdef weak_alias
weak_alias (__stpncpy, stpncpy)
#endif

View file

@ -126,7 +126,11 @@
# if (@REPLACE_FREE@ && !defined free \ # if (@REPLACE_FREE@ && !defined free \
&& !(defined __cplusplus && defined GNULIB_NAMESPACE)) && !(defined __cplusplus && defined GNULIB_NAMESPACE))
/* We can't do '#define free rpl_free' here. */ /* We can't do '#define free rpl_free' here. */
# if defined __cplusplus && (__GLIBC__ + (__GLIBC_MINOR__ >= 14) > 2)
_GL_EXTERN_C void rpl_free (void *) throw ();
# else
_GL_EXTERN_C void rpl_free (void *); _GL_EXTERN_C void rpl_free (void *);
# endif
# undef _GL_ATTRIBUTE_DEALLOC_FREE # undef _GL_ATTRIBUTE_DEALLOC_FREE
# define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1) # define _GL_ATTRIBUTE_DEALLOC_FREE _GL_ATTRIBUTE_DEALLOC (rpl_free, 1)
# else # else

View file

@ -46,10 +46,13 @@ AC_DEFUN([gl_ASSERT_H],
gl_NEXT_HEADERS([assert.h])]) gl_NEXT_HEADERS([assert.h])])
dnl The "zz" puts this toward config.h's end, to avoid potential dnl The "zz" puts this toward config.h's end, to avoid potential
dnl collisions with other definitions. #undef assert so that dnl collisions with other definitions.
dnl programs are not tempted to use it without specifically dnl #undef assert so that programs are not tempted to use it without
dnl including assert.h. Break the #undef apart with a comment dnl specifically including assert.h.
dnl so that 'configure' does not comment it out. dnl #undef __ASSERT_H__ so that on IRIX, when programs later include
dnl <assert.h>, this include actually defines assert.
dnl Break the #undef_s apart with a comment so that 'configure' does
dnl not comment them out.
AH_VERBATIM([zzstatic_assert], AH_VERBATIM([zzstatic_assert],
[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ [#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \
&& (!defined __cplusplus \ && (!defined __cplusplus \
@ -57,6 +60,9 @@ AC_DEFUN([gl_ASSERT_H],
&& __GNUG__ < 6 && __clang_major__ < 6))) && __GNUG__ < 6 && __clang_major__ < 6)))
#include <assert.h> #include <assert.h>
#undef/**/assert #undef/**/assert
#ifdef __sgi
#undef/**/__ASSERT_H__
#endif
/* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments. /* Solaris 11.4 <assert.h> defines static_assert as a macro with 2 arguments.
We need it also to be invocable with a single argument. */ We need it also to be invocable with a single argument. */
#if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus #if defined __sun && (__STDC_VERSION__ - 0 >= 201112L) && !defined __cplusplus

View file

@ -1,4 +1,4 @@
# serial 14 # serial 15
# See if we need to provide fdopendir. # See if we need to provide fdopendir.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@ -49,12 +49,12 @@ DIR *fdopendir (int);
[gl_cv_func_fdopendir_works=yes], [gl_cv_func_fdopendir_works=yes],
[gl_cv_func_fdopendir_works=no], [gl_cv_func_fdopendir_works=no],
[case "$host_os" in [case "$host_os" in
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;; *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_fdopendir_works="guessing yes" ;; *-musl* | midipix*) gl_cv_func_fdopendir_works="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.
*) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;; *) gl_cv_func_fdopendir_works="$gl_cross_guess_normal" ;;
esac esac
])]) ])])
case "$gl_cv_func_fdopendir_works" in case "$gl_cv_func_fdopendir_works" in

View file

@ -1,4 +1,4 @@
# getdelim.m4 serial 18 # getdelim.m4 serial 19
dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2005-2007, 2009-2023 Free Software Foundation, Inc.
dnl dnl
@ -82,8 +82,8 @@ AC_DEFUN([gl_FUNC_GETDELIM],
], ],
[gl_cv_func_working_getdelim="guessing yes"], [gl_cv_func_working_getdelim="guessing yes"],
[case "$host_os" in [case "$host_os" in
*-musl*) gl_cv_func_working_getdelim="guessing yes" ;; *-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
*) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;; *) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
esac esac
]) ])
]) ])

View file

@ -1,4 +1,4 @@
# getline.m4 serial 32 # getline.m4 serial 33
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation, dnl Copyright (C) 1998-2003, 2005-2007, 2009-2023 Free Software Foundation,
dnl Inc. dnl Inc.
@ -76,8 +76,8 @@ AC_DEFUN([gl_FUNC_GETLINE],
], ],
[am_cv_func_working_getline="guessing yes"], [am_cv_func_working_getline="guessing yes"],
[case "$host_os" in [case "$host_os" in
*-musl*) am_cv_func_working_getline="guessing yes" ;; *-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
*) am_cv_func_working_getline="$gl_cross_guess_normal" ;; *) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
esac esac
]) ])
]) ])

View file

@ -1,4 +1,4 @@
# gnulib-common.m4 serial 80 # gnulib-common.m4 serial 82
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -356,7 +356,7 @@ AC_DEFUN([gl_COMMON_BODY], [
[[__maybe_unused__]] nevertheless produces a warning. */ [[__maybe_unused__]] nevertheless produces a warning. */
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED #ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
# if defined __clang__ && defined __cplusplus # if defined __clang__ && defined __cplusplus
# if __clang_major__ >= 10 # if !defined __apple_build_version__ && __clang_major__ >= 10
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] # define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
# endif # endif
# elif defined __has_c_attribute # elif defined __has_c_attribute
@ -1095,6 +1095,113 @@ AC_DEFUN([gl_CONDITIONAL_HEADER],
m4_popdef([gl_header_name]) m4_popdef([gl_header_name])
]) ])
dnl Preparations for gl_CHECK_FUNCS_MACOS.
AC_DEFUN([gl_PREPARE_CHECK_FUNCS_MACOS],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_COMPILER_CLANG])
AC_CACHE_CHECK([for compiler option needed when checking for future declarations],
[gl_cv_compiler_check_future_option],
[case "$host_os" in
dnl This is only needed on macOS.
darwin*)
if test $gl_cv_compiler_clang = yes; then
dnl Test whether the compiler supports the option
dnl '-Werror=unguarded-availability-new'.
save_ac_compile="$ac_compile"
ac_compile="$ac_compile -Werror=unguarded-availability-new"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
[gl_cv_compiler_check_future_option='-Werror=unguarded-availability-new'],
[gl_cv_compiler_check_future_option=none])
ac_compile="$save_ac_compile"
else
gl_cv_compiler_check_future_option=none
fi
;;
*) gl_cv_compiler_check_future_option=none ;;
esac
])
])
dnl Pieces of the expansion of
dnl gl_CHECK_FUNCS_ANDROID
dnl gl_CHECK_FUNCS_MACOS
dnl gl_CHECK_FUNCS_ANDROID_MACOS
AC_DEFUN([gl_CHECK_FUNCS_DEFAULT_CASE],
[
*)
AC_CHECK_FUNC([$1])
[gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
;;
])
AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_ANDROID],
[
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_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS],
[
darwin*)
if test "x$gl_cv_compiler_check_future_option" != "xnone"; then
dnl Use a compile test, not a link test.
save_ac_compile="$ac_compile"
ac_compile="$ac_compile $gl_cv_compiler_check_future_option"
save_ac_compile_for_check_decl="$ac_compile_for_check_decl"
ac_compile_for_check_decl="$ac_compile_for_check_decl $gl_cv_compiler_check_future_option"
unset [ac_cv_have_decl_][$1]
AC_CHECK_DECL([$1], , , [$2])
ac_compile="$save_ac_compile"
ac_compile_for_check_decl="$save_ac_compile_for_check_decl"
[ac_cv_func_][$1]="$[ac_cv_have_decl_][$1]"
if test $[ac_cv_func_][$1] = yes; then
[gl_cv_onwards_func_][$1]=yes
else
unset [ac_cv_have_decl_][$1]
AC_CHECK_DECL([$1], , , [$2])
if test $[ac_cv_have_decl_][$1] = yes; then
[gl_cv_onwards_func_][$1]='future OS version'
else
[gl_cv_onwards_func_][$1]=no
fi
fi
else
AC_CHECK_FUNC([$1])
[gl_cv_onwards_func_][$1]=$[ac_cv_func_][$1]
fi
;;
])
AC_DEFUN([gl_CHECK_FUNCS_SET_RESULTS],
[
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
])
dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]]) dnl gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
dnl on Android. dnl on Android.
@ -1137,39 +1244,87 @@ AC_DEFUN([gl_CHECK_FUNCS_ANDROID],
[[gl_cv_onwards_func_][$1]], [[gl_cv_onwards_func_][$1]],
[gl_SILENT([ [gl_SILENT([
case "$host_os" in case "$host_os" in
linux*-android*) gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
AC_CHECK_DECL([$1], , , [$2]) gl_CHECK_FUNCS_DEFAULT_CASE([$1])
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 esac
]) ])
]) ])
case "$[gl_cv_onwards_func_][$1]" in gl_CHECK_FUNCS_SET_RESULTS([$1])
future*) [ac_cv_func_][$1]=no ;; ])
*) [ac_cv_func_][$1]=$[gl_cv_onwards_func_][$1] ;;
esac dnl gl_CHECK_FUNCS_MACOS([func], [[#include <foo.h>]])
if test $[ac_cv_func_][$1] = yes; then dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
AC_DEFINE([HAVE_]m4_translit([[$1]], dnl on macOS.
[abcdefghijklmnopqrstuvwxyz], dnl
[ABCDEFGHIJKLMNOPQRSTUVWXYZ]), dnl When code is compiled on macOS, it is in the context of a certain minimum
[1], [Define to 1 if you have the `$1' function.]) dnl macOS version, that can be set through the option '-mmacosx-version-min='.
fi dnl In other words, you don't compile for a specific version of macOS. You
dnl compile for all versions of macOS, onwards from the given version.
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 version,
dnl - no, in no version,
dnl - not in the given version, but in a later version of macOS.
dnl
dnl In detail, this works as follows:
dnl If func was added to, say, macOS version 13, then the libc has the
dnl symbol func always, whereas the header file <foo.h> declares func
dnl conditionally with a special availability attribute:
dnl ... func (...) __attribute__((availability(macos,introduced=13.0)));
dnl Thus, when compiling with "clang mmacosx-version-min=13", there is no
dnl warning about the use of func, and the resulting binary
dnl - runs fine on macOS 13,
dnl - aborts with a dyld "Symbol not found" message on macOS 12.
dnl Whereas, when compiling with "clang mmacosx-version-min=12", there is a
dnl warning: 'func' is only available on macOS 13.0 or newer
dnl [-Wunguarded-availability-new],
dnl and the resulting binary
dnl - runs fine on macOS 13,
dnl - crashes with a SIGSEGV (signal 11) on macOS 12.
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_MACOS([func], [[#include <foo.h>]])
dnl can be used as a drop-in replacement for
dnl AC_CHECK_FUNCS([func]).
AC_DEFUN([gl_CHECK_FUNCS_MACOS],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
AC_CACHE_CHECK([for [$1]],
[[gl_cv_onwards_func_][$1]],
[gl_SILENT([
case "$host_os" in
gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
gl_CHECK_FUNCS_DEFAULT_CASE([$1])
esac
])
])
gl_CHECK_FUNCS_SET_RESULTS([$1])
])
dnl gl_CHECK_FUNCS_ANDROID_MACOS([func], [[#include <foo.h>]])
dnl is like AC_CHECK_FUNCS([func]), taking into account a portability problem
dnl on Android and on macOS.
dnl It is the combination of gl_CHECK_FUNCS_ANDROID and gl_CHECK_FUNCS_MACOS.
AC_DEFUN([gl_CHECK_FUNCS_ANDROID_MACOS],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_PREPARE_CHECK_FUNCS_MACOS])
AC_CACHE_CHECK([for [$1]],
[[gl_cv_onwards_func_][$1]],
[gl_SILENT([
case "$host_os" in
gl_CHECK_FUNCS_CASE_FOR_ANDROID([$1], [$2])
gl_CHECK_FUNCS_CASE_FOR_MACOS([$1], [$2])
gl_CHECK_FUNCS_DEFAULT_CASE([$1])
esac
])
])
gl_CHECK_FUNCS_SET_RESULTS([$1])
]) ])
dnl Expands to some code for use in .c programs that, on native Windows, defines dnl Expands to some code for use in .c programs that, on native Windows, defines

View file

@ -195,6 +195,7 @@ AC_DEFUN([gl_EARLY],
# Code from module stdio: # Code from module stdio:
# Code from module stdlib: # Code from module stdlib:
# Code from module stpcpy: # Code from module stpcpy:
# Code from module stpncpy:
# Code from module string: # Code from module string:
# Code from module strnlen: # Code from module strnlen:
# Code from module strtoimax: # Code from module strtoimax:
@ -619,6 +620,13 @@ AC_DEFUN([gl_INIT],
gl_PREREQ_STPCPY gl_PREREQ_STPCPY
]) ])
gl_STRING_MODULE_INDICATOR([stpcpy]) gl_STRING_MODULE_INDICATOR([stpcpy])
gl_FUNC_STPNCPY
gl_CONDITIONAL([GL_COND_OBJ_STPNCPY],
[test $HAVE_STPNCPY = 0 || test $REPLACE_STPNCPY = 1])
AM_COND_IF([GL_COND_OBJ_STPNCPY], [
gl_PREREQ_STPNCPY
])
gl_STRING_MODULE_INDICATOR([stpncpy])
gl_STRING_H gl_STRING_H
gl_STRING_H_REQUIRE_DEFAULTS gl_STRING_H_REQUIRE_DEFAULTS
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
@ -1587,6 +1595,7 @@ AC_DEFUN([gl_FILE_LIST], [
lib/stdio.in.h lib/stdio.in.h
lib/stdlib.in.h lib/stdlib.in.h
lib/stpcpy.c lib/stpcpy.c
lib/stpncpy.c
lib/str-two-way.h lib/str-two-way.h
lib/strftime.h lib/strftime.h
lib/string.in.h lib/string.in.h
@ -1758,6 +1767,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stdio_h.m4 m4/stdio_h.m4
m4/stdlib_h.m4 m4/stdlib_h.m4
m4/stpcpy.m4 m4/stpcpy.m4
m4/stpncpy.m4
m4/string_h.m4 m4/string_h.m4
m4/strnlen.m4 m4/strnlen.m4
m4/strtoimax.m4 m4/strtoimax.m4

View file

@ -23,6 +23,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H],
int wb = WORD_BIT; int wb = WORD_BIT;
int ullw = ULLONG_WIDTH; int ullw = ULLONG_WIDTH;
int bw = BOOL_WIDTH; int bw = BOOL_WIDTH;
int bm = BOOL_MAX;
]])], ]])],
[gl_cv_header_limits_width=yes], [gl_cv_header_limits_width=yes],
[gl_cv_header_limits_width=no])]) [gl_cv_header_limits_width=no])])

View file

@ -1,4 +1,4 @@
# serial 33 # serial 34
# Copyright (C) 1997-2001, 2003-2023 Free Software Foundation, Inc. # Copyright (C) 1997-2001, 2003-2023 Free Software Foundation, Inc.
# #
@ -56,6 +56,9 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
linux-* | linux) linux-* | linux)
# Guess yes on Linux systems. # Guess yes on Linux systems.
gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
midipix*)
# Guess yes on systems that emulate the Linux system calls.
gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
*-gnu* | gnu*) *-gnu* | gnu*)
# Guess yes on glibc systems. # Guess yes on glibc systems.
gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;

View file

@ -1,4 +1,4 @@
# malloc.m4 serial 28 # malloc.m4 serial 29
dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -25,7 +25,7 @@ AC_DEFUN([_AC_FUNC_MALLOC_IF],
[case "$host_os" in [case "$host_os" in
# Guess yes on platforms where we know the result. # Guess yes on platforms where we know the result.
*-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
| gnu* | *-musl* | midnightbsd* \ | gnu* | *-musl* | midipix* | midnightbsd* \
| hpux* | solaris* | cygwin* | mingw* | msys* ) | hpux* | solaris* | cygwin* | mingw* | msys* )
ac_cv_func_malloc_0_nonnull="guessing yes" ;; ac_cv_func_malloc_0_nonnull="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.

View file

@ -1,4 +1,4 @@
# printf.m4 serial 73 # printf.m4 serial 74
dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -63,7 +63,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_sizes_c99="guessing yes";;
# Guess yes on FreeBSD >= 5. # Guess yes on FreeBSD >= 5.
freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";;
@ -244,7 +244,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_infinite="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_infinite="guessing yes";;
# Guess yes on FreeBSD >= 6. # Guess yes on FreeBSD >= 6.
freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";;
@ -467,7 +467,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_infinite_long_double="guessing yes";;
# Guess yes on FreeBSD >= 6. # Guess yes on FreeBSD >= 6.
freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";;
@ -591,7 +591,7 @@ int main ()
[gl_cv_func_printf_directive_a="guessing no"]) [gl_cv_func_printf_directive_a="guessing no"])
;; ;;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_directive_a="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_directive_a="guessing yes";;
# Guess no on Android. # Guess no on Android.
linux*-android*) gl_cv_func_printf_directive_a="guessing no";; linux*-android*) gl_cv_func_printf_directive_a="guessing no";;
# Guess no on native Windows. # Guess no on native Windows.
@ -643,7 +643,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_directive_f="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_directive_f="guessing yes";;
# Guess yes on FreeBSD >= 6. # Guess yes on FreeBSD >= 6.
freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";;
@ -990,18 +990,18 @@ int main ()
[ [
changequote(,)dnl changequote(,)dnl
case "$host_os" in case "$host_os" in
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_printf_flag_zero="guessing yes";; *-musl* | midipix*) gl_cv_func_printf_flag_zero="guessing yes";;
# Guess yes on BeOS. # Guess yes on BeOS.
beos*) gl_cv_func_printf_flag_zero="guessing yes";; beos*) gl_cv_func_printf_flag_zero="guessing yes";;
# Guess no on Android. # Guess no on Android.
linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; linux*-android*) gl_cv_func_printf_flag_zero="guessing no";;
# Guess no on native Windows. # Guess no on native Windows.
mingw*) gl_cv_func_printf_flag_zero="guessing no";; mingw*) gl_cv_func_printf_flag_zero="guessing no";;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.
*) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";;
esac esac
changequote([,])dnl changequote([,])dnl
]) ])
@ -1239,7 +1239,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";; *-gnu* | gnu*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_snprintf_truncation_c99="guessing yes";; *-musl* | midipix*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
# Guess yes on FreeBSD >= 5. # Guess yes on FreeBSD >= 5.
freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";; freebsd[1-4].*) gl_cv_func_snprintf_truncation_c99="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_snprintf_truncation_c99="guessing yes";;
@ -1344,7 +1344,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; *-musl* | midipix*) gl_cv_func_snprintf_retval_c99="guessing yes";;
# Guess yes on FreeBSD >= 5. # Guess yes on FreeBSD >= 5.
freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";;
@ -1447,7 +1447,7 @@ int main ()
;; ;;
changequote(,)dnl changequote(,)dnl
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; *-musl* | midipix*) gl_cv_func_snprintf_directive_n="guessing yes";;
# Guess yes on FreeBSD >= 5. # Guess yes on FreeBSD >= 5.
freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";; freebsd[1-4].*) gl_cv_func_snprintf_directive_n="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_snprintf_directive_n="guessing yes";;
@ -1604,7 +1604,7 @@ changequote(,)dnl
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; *-gnu* | gnu*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; *-musl* | midipix*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;
# Guess yes on FreeBSD >= 5. # Guess yes on FreeBSD >= 5.
freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";; freebsd[1-4].*) gl_cv_func_vsnprintf_zerosize_c99="guessing no";;
freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";; freebsd* | kfreebsd*) gl_cv_func_vsnprintf_zerosize_c99="guessing yes";;

View file

@ -1,4 +1,4 @@
# pselect.m4 serial 10 # pselect.m4 serial 11
dnl Copyright (C) 2011-2023 Free Software Foundation, Inc. dnl Copyright (C) 2011-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -54,6 +54,8 @@ AC_DEFUN([gl_FUNC_PSELECT],
case "$host_os" in case "$host_os" in
# Guess yes on Linux systems. # Guess yes on Linux systems.
linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; linux-* | linux) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# Guess yes on systems that emulate the Linux system calls.
midipix*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;; *-gnu* | gnu*) gl_cv_func_pselect_detects_ebadf="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.

View file

@ -1,4 +1,4 @@
# readlink.m4 serial 16 # readlink.m4 serial 17
dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -38,6 +38,9 @@ AC_DEFUN([gl_FUNC_READLINK],
# Guess yes on Linux or glibc systems. # Guess yes on Linux or glibc systems.
linux-* | linux | *-gnu* | gnu*) linux-* | linux | *-gnu* | gnu*)
gl_cv_func_readlink_trailing_slash="guessing yes" ;; gl_cv_func_readlink_trailing_slash="guessing yes" ;;
# Guess yes on systems that emulate the Linux system calls.
midipix*)
gl_cv_func_readlink_trailing_slash="guessing yes" ;;
# Guess no on AIX or HP-UX. # Guess no on AIX or HP-UX.
aix* | hpux*) aix* | hpux*)
gl_cv_func_readlink_trailing_slash="guessing no" ;; gl_cv_func_readlink_trailing_slash="guessing no" ;;
@ -75,6 +78,9 @@ AC_DEFUN([gl_FUNC_READLINK],
# Guess yes on Linux or glibc systems. # Guess yes on Linux or glibc systems.
linux-* | linux | *-gnu* | gnu*) linux-* | linux | *-gnu* | gnu*)
gl_cv_func_readlink_truncate="guessing yes" ;; gl_cv_func_readlink_truncate="guessing yes" ;;
# Guess yes on systems that emulate the Linux system calls.
midipix*)
gl_cv_func_readlink_truncate="guessing yes" ;;
# Guess no on AIX or HP-UX. # Guess no on AIX or HP-UX.
aix* | hpux*) aix* | hpux*)
gl_cv_func_readlink_truncate="guessing no" ;; gl_cv_func_readlink_truncate="guessing no" ;;

View file

@ -1,4 +1,4 @@
# realloc.m4 serial 26 # realloc.m4 serial 27
dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -25,7 +25,7 @@ AC_DEFUN([_AC_FUNC_REALLOC_IF],
[case "$host_os" in [case "$host_os" in
# Guess yes on platforms where we know the result. # Guess yes on platforms where we know the result.
*-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \
| gnu* | *-musl* | midnightbsd* \ | gnu* | *-musl* | midipix* | midnightbsd* \
| hpux* | solaris* | cygwin* | mingw* | msys* ) | hpux* | solaris* | cygwin* | mingw* | msys* )
ac_cv_func_realloc_0_nonnull="guessing yes" ;; ac_cv_func_realloc_0_nonnull="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.

View file

@ -1,4 +1,4 @@
# signbit.m4 serial 20 # signbit.m4 serial 21
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc. dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
@ -29,14 +29,14 @@ AC_DEFUN([gl_SIGNBIT],
[gl_cv_func_signbit=yes], [gl_cv_func_signbit=yes],
[gl_cv_func_signbit=no], [gl_cv_func_signbit=no],
[case "$host_os" in [case "$host_os" in
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;; *-gnu* | gnu*) gl_cv_func_signbit="guessing yes" ;;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_signbit="guessing yes" ;; *-musl* | midipix*) gl_cv_func_signbit="guessing yes" ;;
# Guess yes on native Windows. # Guess yes on native Windows.
mingw*) gl_cv_func_signbit="guessing yes" ;; mingw*) gl_cv_func_signbit="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.
*) gl_cv_func_signbit="$gl_cross_guess_normal" ;; *) gl_cv_func_signbit="$gl_cross_guess_normal" ;;
esac esac
]) ])
]) ])
@ -63,19 +63,19 @@ AC_DEFUN([gl_SIGNBIT],
[gl_cv_func_signbit_builtins=yes], [gl_cv_func_signbit_builtins=yes],
[gl_cv_func_signbit_builtins=no], [gl_cv_func_signbit_builtins=no],
[case "$host_os" in [case "$host_os" in
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;; *-gnu* | gnu*) gl_cv_func_signbit_builtins="guessing yes" ;;
# Guess yes on musl systems. # Guess yes on musl systems.
*-musl*) gl_cv_func_signbit_builtins="guessing yes" ;; *-musl* | midipix*) gl_cv_func_signbit_builtins="guessing yes" ;;
# Guess yes on mingw, no on MSVC. # Guess yes on mingw, no on MSVC.
mingw*) if test -n "$GCC"; then mingw*) if test -n "$GCC"; then
gl_cv_func_signbit_builtins="guessing yes" gl_cv_func_signbit_builtins="guessing yes"
else else
gl_cv_func_signbit_builtins="guessing no" gl_cv_func_signbit_builtins="guessing no"
fi fi
;; ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.
*) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;; *) gl_cv_func_signbit_builtins="$gl_cross_guess_normal" ;;
esac esac
]) ])
]) ])

108
m4/stpncpy.m4 Normal file
View file

@ -0,0 +1,108 @@
# stpncpy.m4 serial 22
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STPNCPY],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Persuade glibc <string.h> to declare stpncpy().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
dnl The stpncpy() declaration in lib/string.in.h uses 'restrict'.
AC_REQUIRE([AC_C_RESTRICT])
AC_REQUIRE([gl_STRING_H_DEFAULTS])
dnl Both glibc and AIX (4.3.3, 5.1) have an stpncpy() function
dnl declared in <string.h>. Its side effects are the same as those
dnl of strncpy():
dnl stpncpy (dest, src, n)
dnl overwrites dest[0..n-1], min(strlen(src),n) bytes coming from src,
dnl and the remaining bytes being NULs. However, the return value is
dnl in glibc: dest + min(strlen(src),n)
dnl in AIX: dest + max(0,n-1)
dnl Only the glibc return value is useful in practice.
AC_CHECK_DECLS_ONCE([stpncpy])
gl_CHECK_FUNCS_ANDROID([stpncpy], [[#include <string.h>]])
if test $ac_cv_func_stpncpy = yes; then
AC_CACHE_CHECK([for working stpncpy], [gl_cv_func_stpncpy], [
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdlib.h>
#include <string.h> /* for strcpy */
/* The stpncpy prototype is missing in <string.h> on AIX 4. */
#if !HAVE_DECL_STPNCPY
extern
# ifdef __cplusplus
"C"
# endif
char *stpncpy (char *dest, const char *src, size_t n);
#endif
int main ()
{
int result = 0;
const char *src = "Hello";
char dest[10];
/* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+1 here. */
{
strcpy (dest, "\377\377\377\377\377\377");
if (stpncpy (dest, src, 2) != dest + 2)
result |= 1;
}
/* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+4 here. */
{
strcpy (dest, "\377\377\377\377\377\377");
if (stpncpy (dest, src, 5) != dest + 5)
result |= 2;
}
/* AIX 4.3.3 and AIX 5.1 stpncpy() returns dest+6 here. */
{
strcpy (dest, "\377\377\377\377\377\377");
if (stpncpy (dest, src, 7) != dest + 5)
result |= 4;
}
return result;
}
]])],
[gl_cv_func_stpncpy=yes],
[gl_cv_func_stpncpy=no],
[dnl Guess yes on glibc systems and musl systems.
AC_EGREP_CPP([Thanks for using GNU], [
#include <features.h>
#ifdef __GNU_LIBRARY__
Thanks for using GNU
#endif
], [gl_cv_func_stpncpy="guessing yes"],
[case "$host_os" in
*-musl* | midipix*) gl_cv_func_stpncpy="guessing yes" ;;
*) gl_cv_func_stpncpy="$gl_cross_guess_normal" ;;
esac
])
])
])
case "$gl_cv_func_stpncpy" in
*yes)
AC_DEFINE([HAVE_STPNCPY], [1],
[Define if you have the stpncpy() function and it works.])
;;
*)
REPLACE_STPNCPY=1
;;
esac
else
HAVE_STPNCPY=0
case "$gl_cv_onwards_func_stpncpy" in
future*) REPLACE_STPNCPY=1 ;;
esac
fi
])
# Prerequisites of lib/stpncpy.c.
AC_DEFUN([gl_PREREQ_STPNCPY], [
:
])

View file

@ -1,4 +1,4 @@
# serial 9 # serial 10
# See if we need to provide symlink replacement. # See if we need to provide symlink replacement.
dnl Copyright (C) 2009-2023 Free Software Foundation, Inc. dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
@ -38,6 +38,8 @@ AC_DEFUN([gl_FUNC_SYMLINK],
[case "$host_os" in [case "$host_os" in
# Guess yes on Linux systems. # Guess yes on Linux systems.
linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;; linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
# Guess yes on systems that emulate the Linux system calls.
midipix*) gl_cv_func_symlink_works="guessing yes" ;;
# Guess yes on glibc systems. # Guess yes on glibc systems.
*-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;; *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;;
# If we don't know, obey --enable-cross-guesses. # If we don't know, obey --enable-cross-guesses.

View file

@ -27,6 +27,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h> #include <errno.h>
#include <math.h> #include <math.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>