Update from Gnulib by running admin/merge-gnulib

This commit is contained in:
Paul Eggert 2026-02-13 17:37:50 -08:00
parent a937396e76
commit f81d3a4882
5 changed files with 54 additions and 56 deletions

View file

@ -49,7 +49,10 @@ extern "C" {
any notion of "current directory".
IS_RELATIVE_FILE_NAME(Filename)
tests whether Filename may be concatenated
to a directory filename.
to a directory filename to yield the name
of a file relative to that directory.
Watch out: IS_RELATIVE_FILE_NAME ("") is 1
even though "" is not a relative file name.
Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a
relative file name!
IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device

View file

@ -85,7 +85,7 @@ gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp)
specifiers as the mingw *printf functions. */
static int
vasprintf (char **resultp, const char *format, va_list args)
local_vasprintf (char **resultp, const char *format, va_list args)
{
/* First try: Use a stack-allocated buffer. */
char buf[2048];
@ -123,6 +123,9 @@ vasprintf (char **resultp, const char *format, va_list args)
return nbytes;
}
# undef vasprintf
# define vasprintf local_vasprintf
# endif
/* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt,

View file

@ -1,5 +1,5 @@
# getdelim.m4
# serial 21
# serial 22
dnl Copyright (C) 2005-2007, 2009-2026 Free Software Foundation, Inc.
dnl
@ -37,7 +37,6 @@ AC_DEFUN([gl_FUNC_GETDELIM],
gl_cv_func_working_getdelim=no ;;
*)
echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
touch conftest.empty
AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <stdio.h>
# include <stdlib.h>
@ -68,36 +67,32 @@ AC_DEFUN([gl_FUNC_GETDELIM],
free (line);
}
fclose (in);
{
/* Test that reading EOF as the first character sets the first byte
in the buffer to NUL. This fails on glibc 2.42 and earlier. */
in = fopen ("./conftest.empty", "r");
if (!in)
return 1;
char *line = malloc (1);
line[0] = 'A';
size_t siz = 1;
if (getdelim (&line, &siz, '\n', in) != -1 || line[0] != '\0')
result |= 8;
free (line);
}
fclose (in);
return result;
}
]])],
[gl_cv_func_working_getdelim=yes],
[gl_cv_func_working_getdelim=no],
[case "$host_os" in
# Guess yes on musl.
*-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
# Guess no on glibc.
*-gnu* | gnu*) gl_cv_func_working_getdelim="guessing no" ;;
*) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
esac
[dnl We're cross compiling.
dnl Guess it works on glibc2 systems and musl systems.
AC_EGREP_CPP([Lucky GNU user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ >= 2) && !defined __UCLIBC__
Lucky GNU user
#endif
#endif
],
[gl_cv_func_working_getdelim="guessing yes"],
[case "$host_os" in
*-musl* | midipix*) gl_cv_func_working_getdelim="guessing yes" ;;
*) gl_cv_func_working_getdelim="$gl_cross_guess_normal" ;;
esac
])
])
;;
esac
rm -f conftest.data conftest.empty
rm -f conftest.data
])
case "$gl_cv_func_working_getdelim" in
*yes) ;;

View file

@ -1,5 +1,5 @@
# getline.m4
# serial 35
# serial 36
dnl Copyright (C) 1998-2003, 2005-2007, 2009-2026 Free Software Foundation,
dnl Inc.
@ -31,7 +31,6 @@ AC_DEFUN([gl_FUNC_GETLINE],
AC_CACHE_CHECK([for working getline function],
[am_cv_func_working_getline],
[echo fooNbarN | tr -d '\012' | tr N '\012' > conftest.data
touch conftest.empty
AC_RUN_IFELSE([AC_LANG_SOURCE([[
# include <stdio.h>
# include <stdlib.h>
@ -62,34 +61,30 @@ AC_DEFUN([gl_FUNC_GETLINE],
free (line);
}
fclose (in);
{
/* Test that reading EOF as the first character sets the first byte
in the buffer to NUL. This fails on glibc 2.42 and earlier. */
in = fopen ("./conftest.empty", "r");
if (!in)
return 1;
char *line = malloc (1);
line[0] = 'A';
size_t siz = 1;
if (getline (&line, &siz, in) != -1 || line[0] != '\0')
result |= 8;
free (line);
}
fclose (in);
return result;
}
]])],
[am_cv_func_working_getline=yes],
[am_cv_func_working_getline=no],
[case "$host_os" in
# Guess yes on musl.
*-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
# Guess no on glibc.
*-gnu* | gnu*) am_cv_func_working_getline="guessing no" ;;
*) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
esac
[dnl We're cross compiling.
dnl Guess it works on glibc2 systems and musl systems.
AC_EGREP_CPP([Lucky GNU user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ >= 2) && !defined __UCLIBC__
Lucky GNU user
#endif
#endif
],
[am_cv_func_working_getline="guessing yes"],
[case "$host_os" in
*-musl* | midipix*) am_cv_func_working_getline="guessing yes" ;;
*) am_cv_func_working_getline="$gl_cross_guess_normal" ;;
esac
])
])
rm -f conftest.data conftest.empty
rm -f conftest.data
])
else
am_cv_func_working_getline=no

View file

@ -1,5 +1,5 @@
# selinux-selinux-h.m4
# serial 10 -*- Autoconf -*-
# serial 12 -*- Autoconf -*-
dnl Copyright (C) 2006-2007, 2009-2026 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@ -49,7 +49,7 @@ AC_DEFUN([gl_CHECK_HEADER_SELINUX_SELINUX_H],
USE_SELINUX_SELINUX_H=0
fi
case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in
case "$ac_cv_search_getfilecon_raw:$ac_cv_header_selinux_selinux_h" in
no:*) # already warned
;;
*:no)
@ -79,15 +79,17 @@ AC_DEFUN([gl_LIBSELINUX],
LIB_SELINUX=
if test "$with_selinux" != no; then
gl_saved_LIBS=$LIBS
AC_SEARCH_LIBS([setfilecon], [selinux],
[test "$ac_cv_search_setfilecon" = "none required" ||
LIB_SELINUX=$ac_cv_search_setfilecon])
dnl On Android, in Termux, prefer libandroid-selinux.so, because it
dnl defines many more API functions than /system/lib/libselinux.so.
AC_SEARCH_LIBS([getfilecon_raw], [android-selinux selinux],
[test "$ac_cv_search_getfilecon_raw" = "none required" ||
LIB_SELINUX=$ac_cv_search_getfilecon_raw])
LIBS=$gl_saved_LIBS
fi
AC_SUBST([LIB_SELINUX])
# Warn if SELinux is found but libselinux is absent;
if test "$ac_cv_search_setfilecon" = no; then
if test "$ac_cv_search_getfilecon_raw" = no; then
if test "$host" = "$build" \
&& { test -d /sys/fs/selinux || test -d /selinux; }; then
AC_MSG_WARN([This system supports SELinux but libselinux is missing.])