diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 61c386c3e35..7474a0a4a57 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -48,10 +48,10 @@ GNULIB_MODULES=' qcopy-acl readlink readlinkat realloc-posix regex sig2str sigdescr_np socklen stat-time std-gnu11 stdc_bit_width stdc_count_ones stdc_trailing_zeros - stdckdint-h stddef-h stdio-h - stpcpy stringeq strnlen strnlen strtoimax symlink sys_stat-h sys_time-h + stdckdint-h stddef-h stdio-h stdio-windows + stpcpy stringeq strnlen strtoimax symlink sys_stat-h sys_time-h tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub - update-copyright unlocked-io utimensat + unlocked-io update-copyright utimensat vla warnings year2038 ' diff --git a/lib/acl_entries.c b/lib/acl_entries.c index b78ba18a656..7b44e694896 100644 --- a/lib/acl_entries.c +++ b/lib/acl_entries.c @@ -22,7 +22,10 @@ #include "acl-internal.h" /* This file assumes POSIX-draft like ACLs - (Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5). */ + (Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5). + + It is compiled only on systems that do not have the acl_entries() function + (in libc or libacl). */ /* Return the number of entries in ACL. Return -1 and set errno upon failure to determine it. */ @@ -34,7 +37,8 @@ acl_entries (acl_t acl) if (acl != NULL) { -#if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ +#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */ +# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ /* acl_get_entry returns 0 when it successfully fetches an entry, and -1/EINVAL at the end. */ acl_entry_t ace; @@ -44,7 +48,7 @@ acl_entries (acl_t acl) got_one >= 0; got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace)) count++; -#else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */ +# else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */ /* acl_get_entry returns 1 when it successfully fetches an entry, and 0 at the end. */ acl_entry_t ace; @@ -56,6 +60,7 @@ acl_entries (acl_t acl) count++; if (got_one < 0) return -1; +# endif #endif } diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index f158acef91f..e655023878e 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -166,7 +166,9 @@ # stdckdint-h \ # stddef-h \ # stdio-h \ +# stdio-windows \ # stpcpy \ +# stringeq \ # strnlen \ # strtoimax \ # symlink \ @@ -295,6 +297,7 @@ GIF_CFLAGS = @GIF_CFLAGS@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CFLAG_GNULIB_WARNINGS = @GL_CFLAG_GNULIB_WARNINGS@ GL_COND_LIBTOOL_CONDITION = @GL_COND_LIBTOOL_CONDITION@ +GL_COND_OBJ_ACL_ENTRIES_CONDITION = @GL_COND_OBJ_ACL_ENTRIES_CONDITION@ GL_COND_OBJ_CANONICALIZE_LGPL_CONDITION = @GL_COND_OBJ_CANONICALIZE_LGPL_CONDITION@ GL_COND_OBJ_COPY_FILE_RANGE_CONDITION = @GL_COND_OBJ_COPY_FILE_RANGE_CONDITION@ GL_COND_OBJ_DIRFD_CONDITION = @GL_COND_OBJ_DIRFD_CONDITION@ @@ -1588,10 +1591,11 @@ endif ifeq (,$(OMIT_GNULIB_MODULE_acl-permissions)) libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c get-permissions.c set-permissions.c +ifneq (,$(GL_COND_OBJ_ACL_ENTRIES_CONDITION)) +libgnu_a_SOURCES += acl_entries.c +endif -EXTRA_DIST += acl-internal.h acl.h acl_entries.c - -EXTRA_libgnu_a_SOURCES += acl_entries.c +EXTRA_DIST += acl-internal.h acl.h endif ## end gnulib module acl-permissions @@ -3502,9 +3506,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(AM_V_at)mv $@-t3 $@ MOSTLYCLEANFILES += stdio.h stdio.h-t1 stdio.h-t2 stdio.h-t3 -ifneq (,$(GL_COND_OBJ_STDIO_CONSOLESAFE_CONDITION)) -libgnu_a_SOURCES += stdio-consolesafe.c -endif ifneq (,$(GL_COND_OBJ_STDIO_READ_CONDITION)) libgnu_a_SOURCES += stdio-read.c endif @@ -3517,6 +3518,16 @@ EXTRA_DIST += stdio.in.h endif ## end gnulib module stdio-h +## begin gnulib module stdio-windows +ifeq (,$(OMIT_GNULIB_MODULE_stdio-windows)) + +ifneq (,$(GL_COND_OBJ_STDIO_CONSOLESAFE_CONDITION)) +libgnu_a_SOURCES += stdio-consolesafe.c +endif + +endif +## end gnulib module stdio-windows + ## begin gnulib module stdlib-h ifeq (,$(OMIT_GNULIB_MODULE_stdlib-h)) diff --git a/lib/nproc.c b/lib/nproc.c index e899ff17620..9404be1d384 100644 --- a/lib/nproc.c +++ b/lib/nproc.c @@ -22,7 +22,7 @@ #include #include -#if HAVE_MNTENT_H +#if HAVE_SETMNTENT # include #endif #include @@ -385,7 +385,7 @@ cgroup2_mount (void) if (access ("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) return strdup ("/sys/fs/cgroup"); -#if HAVE_MNTENT_H +#if HAVE_SETMNTENT /* Otherwise look for the mount point. */ struct mntent *mnt; if (! (fp = setmntent ("/proc/mounts", "r"))) diff --git a/m4/acl.m4 b/m4/acl.m4 index 0ab7d34e2d2..e68ed377ba9 100644 --- a/m4/acl.m4 +++ b/m4/acl.m4 @@ -1,5 +1,5 @@ # acl.m4 -# serial 39 +# serial 40 dnl Copyright (C) 2002, 2004-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -28,6 +28,7 @@ AC_DEFUN_ONCE([gl_FUNC_ACL], AC_CHECK_FUNCS_ONCE([fchmod]) LIB_ACL= use_acl=0 + NEED_ACL_ENTRIES=0 if test "$enable_acl" != no; then dnl On all platforms, the ACL related API is declared in . AC_CHECK_HEADERS([sys/acl.h]) @@ -55,7 +56,10 @@ AC_DEFUN_ONCE([gl_FUNC_ACL], if test $use_acl = 1; then dnl On GNU/Linux, an additional API is declared in . AC_CHECK_HEADERS([acl/libacl.h]) - AC_REPLACE_FUNCS([acl_entries]) + AC_CHECK_FUNC([acl_entries], + [AC_DEFINE([HAVE_ACL_ENTRIES], [1], + [Define to 1 if libc or libacl defines the function acl_entries.])], + [NEED_ACL_ENTRIES=1]) AC_CACHE_CHECK([for ACL_FIRST_ENTRY], [gl_cv_acl_ACL_FIRST_ENTRY], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index b80c5c84a0b..fea8b7d684b 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -192,6 +192,7 @@ AC_DEFUN([gl_EARLY], # Code from module stdint-h: # Code from module stdio-h: gl_STDIO_H_EARLY + # Code from module stdio-windows: # Code from module stdlib-h: # Code from module stpcpy: # Code from module string-h: @@ -250,6 +251,7 @@ AC_DEFUN([gl_INIT], gl_source_base='lib' gl_source_base_prefix= gl_FUNC_ACL + gl_CONDITIONAL([GL_COND_OBJ_ACL_ENTRIES], [test $NEED_ACL_ENTRIES = 1]) gl_ALIGNASOF gl_FUNC_ALLOCA gl_CONDITIONAL_HEADER([alloca.h]) @@ -568,18 +570,6 @@ AC_DEFUN([gl_INIT], gl_STDIO_H gl_STDIO_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P - USES_MSVCRT=0 - case "$host_os" in - mingw* | windows*) - AC_EGREP_CPP([Special], [ - #ifndef _UCRT - Special - #endif - ], - [USES_MSVCRT=1]) - ;; - esac - gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_READ], [test $REPLACE_STDIO_READ_FUNCS = 1]) gl_CONDITIONAL([GL_COND_OBJ_STDIO_WRITE], [test $REPLACE_STDIO_WRITE_FUNCS = 1]) dnl No need to create extra modules for these functions. Everyone who uses @@ -605,6 +595,19 @@ AC_DEFUN([gl_INIT], gl_STDIO_MODULE_INDICATOR([fputs]) gl_STDIO_MODULE_INDICATOR([puts]) gl_STDIO_MODULE_INDICATOR([fwrite]) + AC_REQUIRE([AC_CANONICAL_HOST]) + USES_MSVCRT=0 + case "$host_os" in + mingw* | windows*) + AC_EGREP_CPP([Special], [ + #ifndef _UCRT + Special + #endif + ], + [USES_MSVCRT=1]) + ;; + esac + gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1]) gl_STDLIB_H gl_STDLIB_H_REQUIRE_DEFAULTS AC_PROG_MKDIR_P diff --git a/m4/nproc.m4 b/m4/nproc.m4 index 9225779585a..e9fba1533ca 100644 --- a/m4/nproc.m4 +++ b/m4/nproc.m4 @@ -1,5 +1,5 @@ # nproc.m4 -# serial 7 +# serial 8 dnl Copyright (C) 2009-2025 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,10 @@ AC_DEFUN([gl_PREREQ_NPROC], AC_CHECK_HEADERS([mntent.h sys/pstat.h sys/param.h],,, [AC_INCLUDES_DEFAULT]) + gl_CHECK_FUNCS_ANDROID([setmntent], + [[#include + #include + ]]) dnl requires on OpenBSD 4.0. AC_CHECK_HEADERS([sys/sysctl.h],,, [AC_INCLUDES_DEFAULT