From 8ccb487c21368a7fdc8c7c72315325bf0aa06147 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 19:44:12 +0200 Subject: Adding upstream version 3:4.8.29. Signed-off-by: Daniel Baumann --- m4.include/gnulib/fstypename.m4 | 23 +++ m4.include/gnulib/fsusage.m4 | 306 ++++++++++++++++++++++++++++ m4.include/gnulib/mode_t.m4 | 26 +++ m4.include/gnulib/mountlist.m4 | 338 +++++++++++++++++++++++++++++++ m4.include/gnulib/stat-size.m4 | 14 ++ m4.include/gnulib/sys_types_h.m4 | 67 ++++++ m4.include/gnulib/windows-stat-inodes.m4 | 19 ++ 7 files changed, 793 insertions(+) create mode 100644 m4.include/gnulib/fstypename.m4 create mode 100644 m4.include/gnulib/fsusage.m4 create mode 100644 m4.include/gnulib/mode_t.m4 create mode 100644 m4.include/gnulib/mountlist.m4 create mode 100644 m4.include/gnulib/stat-size.m4 create mode 100644 m4.include/gnulib/sys_types_h.m4 create mode 100644 m4.include/gnulib/windows-stat-inodes.m4 (limited to 'm4.include/gnulib') diff --git a/m4.include/gnulib/fstypename.m4 b/m4.include/gnulib/fstypename.m4 new file mode 100644 index 0000000..20d2f05 --- /dev/null +++ b/m4.include/gnulib/fstypename.m4 @@ -0,0 +1,23 @@ +#serial 6 + +dnl From Jim Meyering. +dnl +dnl See if struct statfs has the f_fstypename member. +dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME. +dnl + +# Copyright (C) 1998-1999, 2001, 2004, 2006, 2009-2011 Free Software +# Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FSTYPENAME], +[ + AC_CHECK_MEMBERS([struct statfs.f_fstypename],,, + [ + #include + #include + #include + ]) +]) diff --git a/m4.include/gnulib/fsusage.m4 b/m4.include/gnulib/fsusage.m4 new file mode 100644 index 0000000..c15cfca --- /dev/null +++ b/m4.include/gnulib/fsusage.m4 @@ -0,0 +1,306 @@ +# serial 35 +# Obtaining file system usage information. + +# Copyright (C) 1997-1998, 2000-2001, 2003-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Jim Meyering. + +AC_DEFUN([gl_FSUSAGE], +[ + AC_CHECK_HEADERS_ONCE([sys/param.h]) + AC_CHECK_HEADERS_ONCE([sys/vfs.h sys/fs_types.h]) + AC_CHECK_HEADERS([sys/mount.h], [], [], + [AC_INCLUDES_DEFAULT + [#if HAVE_SYS_PARAM_H + #include + #endif]]) + gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no]) +]) + +# Try to determine how a program can obtain file system usage information. +# If successful, define the appropriate symbol (see fsusage.c) and +# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND. +# +# gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([gl_FILE_SYSTEM_USAGE], +[ + dnl Enable large-file support. This has the effect of changing the size + dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on + dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size + dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on + dnl Mac OS X >= 10.5 (32-bit mode). + AC_REQUIRE([AC_SYS_LARGEFILE]) + + ac_fsusage_space=no + + # Perform only the link test since it seems there are no variants of the + # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) + # because that got a false positive on SCO OSR5. Adding the declaration + # of a 'struct statvfs' causes this test to fail (as it should) on such + # systems. That system is reported to work fine with STAT_STATFS4 which + # is what it gets when this test fails. + if test $ac_fsusage_space = no; then + # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, + # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. + AC_CACHE_CHECK([for statvfs function (SVR4)], + [fu_cv_sys_stat_statvfs], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#ifdef __osf__ +"Do not use Tru64's statvfs implementation" +#endif + +#include + +struct statvfs fsd; + +#if defined __APPLE__ && defined __MACH__ +#include +/* On Mac OS X >= 10.5, f_blocks in 'struct statvfs' is a 32-bit quantity; + that commonly limits file systems to 4 TiB. Whereas f_blocks in + 'struct statfs' is a 64-bit type, thanks to the large-file support + that was enabled above. In this case, don't use statvfs(); use statfs() + instead. */ +int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; +#endif +]], + [[statvfs (0, &fsd);]])], + [fu_cv_sys_stat_statvfs=yes], + [fu_cv_sys_stat_statvfs=no]) + ]) + if test $fu_cv_sys_stat_statvfs = yes; then + ac_fsusage_space=yes + # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. + # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems + # statvfs with large-file support is already equivalent to statvfs64. + AC_CACHE_CHECK([whether to use statvfs64], + [fu_cv_sys_stat_statvfs64], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + struct statvfs64 fsd; + int check_f_blocks_larger_in_statvfs64 + [sizeof (((struct statvfs64 *) 0)->f_blocks) + > sizeof (((struct statvfs *) 0)->f_blocks) + ? 1 : -1]; + ]], + [[statvfs64 (0, &fsd);]])], + [fu_cv_sys_stat_statvfs64=yes], + [fu_cv_sys_stat_statvfs64=no]) + ]) + if test $fu_cv_sys_stat_statvfs64 = yes; then + AC_DEFINE([STAT_STATVFS64], [1], + [Define if statvfs64 should be preferred over statvfs.]) + else + AC_DEFINE([STAT_STATVFS], [1], + [Define if there is a function named statvfs. (SVR4)]) + fi + fi + fi + + # Check for this unconditionally so we have a + # good fallback on glibc/Linux > 2.6 < 2.6.36 + AC_CACHE_CHECK([for two-argument statfs with statfs.f_frsize member], + [fu_cv_sys_stat_statfs2_frsize], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif + int + main () + { + struct statfs fsd; + fsd.f_frsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_frsize=yes], + [fu_cv_sys_stat_statfs2_frsize=no], + [fu_cv_sys_stat_statfs2_frsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_frsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_FRSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_frsize. + (glibc/Linux > 2.6)]) + fi + + if test $ac_fsusage_space = no; then + # DEC Alpha running OSF/1 + AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)], + [fu_cv_sys_stat_statfs3_osf1], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include + int + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + return statfs (".", &fsd, sizeof (struct statfs)) != 0; + }]])], + [fu_cv_sys_stat_statfs3_osf1=yes], + [fu_cv_sys_stat_statfs3_osf1=no], + [fu_cv_sys_stat_statfs3_osf1=no]) + ]) + if test $fu_cv_sys_stat_statfs3_osf1 = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS3_OSF1], [1], + [Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) + fi + fi + + if test $ac_fsusage_space = no; then + # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. + # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, + # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) + # (On IRIX you need to include , not only and + # .) + # (On Solaris, statfs has 4 arguments.) + AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], + [fu_cv_sys_stat_statfs2_bsize], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif + int + main () + { + struct statfs fsd; + fsd.f_bsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_bsize=yes], + [fu_cv_sys_stat_statfs2_bsize=no], + [fu_cv_sys_stat_statfs2_bsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_bsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_BSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_bsize. + (4.3BSD, SunOS 4, HP-UX)]) + fi + fi + + if test $ac_fsusage_space = no; then + # SVR3 + # (Solaris already handled above.) + AC_CACHE_CHECK([for four-argument statfs (SVR3)], + [fu_cv_sys_stat_statfs4], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include + int + main () + { + struct statfs fsd; + return statfs (".", &fsd, sizeof fsd, 0) != 0; + }]])], + [fu_cv_sys_stat_statfs4=yes], + [fu_cv_sys_stat_statfs4=no], + [fu_cv_sys_stat_statfs4=no]) + ]) + if test $fu_cv_sys_stat_statfs4 = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS4], [1], + [Define if statfs takes 4 args. (SVR3, old Irix)]) + fi + fi + + if test $ac_fsusage_space = no; then + # 4.4BSD and older NetBSD + # (OSF/1 already handled above.) + # (On AIX, you need to include , not only .) + # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in + # .) + AC_CACHE_CHECK([for two-argument statfs with statfs.f_fsize member (4.4BSD and NetBSD)], + [fu_cv_sys_stat_statfs2_fsize], + [AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif + int + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + return statfs (".", &fsd) != 0; + }]])], + [fu_cv_sys_stat_statfs2_fsize=yes], + [fu_cv_sys_stat_statfs2_fsize=no], + [fu_cv_sys_stat_statfs2_fsize=no]) + ]) + if test $fu_cv_sys_stat_statfs2_fsize = yes; then + ac_fsusage_space=yes + AC_DEFINE([STAT_STATFS2_FSIZE], [1], + [Define if statfs takes 2 args and struct statfs has a field named f_fsize. + (4.4BSD, NetBSD)]) + fi + fi + + AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) + +]) + + +# Check for SunOS statfs brokenness wrt partitions 2GB and larger. +# If exists and struct statfs has a member named f_spare, +# enable the work-around code in fsusage.c. +AC_DEFUN([gl_STATFS_TRUNCATES], +[ + AC_CACHE_CHECK([for statfs that truncates block counts], + [fu_cv_sys_truncating_statfs], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#if !defined(sun) && !defined(__sun) +choke -- this is a workaround for a Sun-specific problem +#endif +#include +#include + ]], + [[struct statfs t; long c = *(t.f_spare); + if (c) return 0; + ]])], + [fu_cv_sys_truncating_statfs=yes], + [fu_cv_sys_truncating_statfs=no]) + ]) + if test $fu_cv_sys_truncating_statfs = yes; then + AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], + [Define if the block counts reported by statfs may be truncated to 2GB + and the correct values may be stored in the f_spare array. + (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. + SunOS 4.1.1 seems not to be affected.)]) + fi +]) + + +# Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. +AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], +[ + AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h]) + gl_STATFS_TRUNCATES +]) diff --git a/m4.include/gnulib/mode_t.m4 b/m4.include/gnulib/mode_t.m4 new file mode 100644 index 0000000..0cd40db --- /dev/null +++ b/m4.include/gnulib/mode_t.m4 @@ -0,0 +1,26 @@ +# mode_t.m4 serial 2 +dnl Copyright (C) 2009-2016 Free Software Foundation, 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. + +# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and +# include . + +# Define PROMOTED_MODE_T to the type that is the result of "default argument +# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. +AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], +[ + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ + dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', + dnl and to itself otherwise. This assumption is not guaranteed by the ISO C + dnl standard, but we don't know of any real-world counterexamples. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], + [gl_cv_promoted_mode_t='int'], + [gl_cv_promoted_mode_t='mode_t']) + ]) + AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], + [Define to the type that is the result of default argument promotions of type mode_t.]) +]) diff --git a/m4.include/gnulib/mountlist.m4 b/m4.include/gnulib/mountlist.m4 new file mode 100644 index 0000000..49029ed --- /dev/null +++ b/m4.include/gnulib/mountlist.m4 @@ -0,0 +1,338 @@ +# serial 15 +dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, 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. + +dnl From Jim Meyering. + +AC_PREREQ([2.60]) + +AC_DEFUN([gl_MOUNTLIST], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS([listmntent]) + AC_CHECK_HEADERS_ONCE([sys/param.h sys/statvfs.h]) + + # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses + # NGROUPS (as the array dimension for a struct member) without a definition. + AC_CHECK_HEADERS([sys/ucred.h], [], [], [#include ]) + + AC_CHECK_HEADERS([sys/mount.h], [], [], + [AC_INCLUDES_DEFAULT + [#if HAVE_SYS_PARAM_H + #include + #endif + ]]) + + AC_CHECK_HEADERS([mntent.h sys/fs_types.h]) + getfsstat_includes="\ +$ac_includes_default +#if HAVE_SYS_PARAM_H +# include /* needed by powerpc-apple-darwin1.3.7 */ +#endif +#if HAVE_SYS_UCRED_H +# include /* needed for definition of NGROUPS */ +# include /* needed by powerpc-apple-darwin1.3.7 */ +#endif +#if HAVE_SYS_MOUNT_H +# include +#endif +#if HAVE_SYS_FS_TYPES_H +# include /* needed by powerpc-apple-darwin1.3.7 */ +#endif +" + AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) + + # Determine how to get the list of mounted file systems. + ac_list_mounted_fs= + + # If the getmntent function is available but not in the standard library, + # make sure LIBS contains the appropriate -l option. + AC_FUNC_GETMNTENT + + if test -z "$ac_list_mounted_fs"; then + # AIX. + AC_CACHE_CHECK([for mntctl function and struct vmount], + [fu_cv_sys_mounted_vmount], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include ]])], + [fu_cv_sys_mounted_vmount=yes], + [fu_cv_sys_mounted_vmount=no])]) + if test $fu_cv_sys_mounted_vmount = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_VMOUNT], [1], + [Define if there is a function named mntctl that can be used to read + the list of mounted file systems, and there is a system header file + that declares 'struct vmount'. (AIX)]) + fi + fi + + if test $ac_cv_func_getmntent = yes; then + + # This system has the getmntent function. + # Determine whether it's the one-argument variant or the two-argument one. + + if test -z "$ac_list_mounted_fs"; then + # glibc, HP-UX, IRIX, Cygwin, Android, also (obsolete) 4.3BSD, SunOS. + AC_CACHE_CHECK([for one-argument getmntent function], + [fu_cv_sys_mounted_getmntent1], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +/* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ +#include + +#include +#if defined __ANDROID__ /* Android */ +# undef MOUNTED +# define MOUNTED "/proc/mounts" +#elif !defined MOUNTED +# if defined _PATH_MOUNTED /* GNU libc */ +# define MOUNTED _PATH_MOUNTED +# endif +# if defined MNT_MNTTAB /* HP-UX. */ +# define MOUNTED MNT_MNTTAB +# endif +#endif +]], + [[struct mntent *mnt = 0; char *table = MOUNTED; + if (sizeof mnt && sizeof table) return 0; + ]])], + [fu_cv_sys_mounted_getmntent1=yes], + [fu_cv_sys_mounted_getmntent1=no]) + ]) + if test $fu_cv_sys_mounted_getmntent1 = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTENT1], [1], + [Define if there is a function named getmntent for reading the list + of mounted file systems, and that function takes a single argument. + (4.3BSD, SunOS, HP-UX, Irix)]) + AC_CHECK_FUNCS([setmntent endmntent hasmntopt]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Solaris >= 8. + AC_CACHE_CHECK([for getextmntent function], + [fu_cv_sys_mounted_getextmntent], + [AC_EGREP_HEADER([getextmntent], [sys/mnttab.h], + [fu_cv_sys_mounted_getextmntent=yes], + [fu_cv_sys_mounted_getextmntent=no])]) + if test $fu_cv_sys_mounted_getextmntent = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETEXTMNTENT], [1], + [Define if there is a function named getextmntent for reading the list + of mounted file systems. (Solaris)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Solaris < 8, also (obsolete) SVR4. + # Solaris >= 8 has the two-argument getmntent but is already handled above. + AC_CACHE_CHECK([for two-argument getmntent function], + [fu_cv_sys_mounted_getmntent2], + [AC_EGREP_HEADER([getmntent], [sys/mnttab.h], + [fu_cv_sys_mounted_getmntent2=yes], + [fu_cv_sys_mounted_getmntent2=no]) + ]) + if test $fu_cv_sys_mounted_getmntent2 = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTENT2], [1], + [Define if there is a function named getmntent for reading the list of + mounted file systems, and that function takes two arguments. (SVR4)]) + AC_CHECK_FUNCS([hasmntopt]) + fi + fi + + fi + + if test -z "$ac_list_mounted_fs"; then + # OSF/1, also (obsolete) Apple Darwin 1.3. + # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h + + AC_CACHE_CHECK([for getfsstat function], + [fu_cv_sys_mounted_getfsstat], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#include +#if HAVE_STRUCT_FSSTAT_F_FSTYPENAME +# define FS_TYPE(Ent) ((Ent).f_fstypename) +#else +# define FS_TYPE(Ent) mnt_names[(Ent).f_type] +#endif +$getfsstat_includes + ]], + [[struct statfs *stats; + int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); + char *t = FS_TYPE (*stats); + ]])], + [fu_cv_sys_mounted_getfsstat=yes], + [fu_cv_sys_mounted_getfsstat=no]) + ]) + if test $fu_cv_sys_mounted_getfsstat = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETFSSTAT], [1], + [Define if there is a function named getfsstat for reading the + list of mounted file systems. (DEC Alpha running OSF/1)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # (obsolete) SVR3 + AC_CACHE_CHECK([for FIXME existence of three headers], + [fu_cv_sys_mounted_fread_fstyp], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +]])], + [fu_cv_sys_mounted_fread_fstyp=yes], + [fu_cv_sys_mounted_fread_fstyp=no]) + ]) + if test $fu_cv_sys_mounted_fread_fstyp = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_FREAD_FSTYP], [1], + [Define if (like SVR2) there is no specific function for reading the + list of mounted file systems, and your system has these header files: + and . (SVR3)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, also (obsolete) 4.4BSD. + # OSF/1 also has getmntinfo but is already handled above. + # We cannot use AC_CHECK_FUNCS([getmntinfo]) here, because at the linker + # level the function is sometimes called getmntinfo64 or getmntinfo$INODE64 + # on Mac OS X, __getmntinfo13 on NetBSD and Minix, _F64_getmntinfo on OSF/1. + AC_CACHE_CHECK([for getmntinfo function], + [fu_cv_sys_mounted_getmntinfo], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[ +#if HAVE_SYS_PARAM_H +# include +#endif +#include +#if HAVE_SYS_MOUNT_H +# include +#endif +#if HAVE_SYS_STATVFS_H +# include +#endif +#include + ]], + [[int count = getmntinfo (NULL, MNT_WAIT); + ]])], + [fu_cv_sys_mounted_getmntinfo=yes], + [fu_cv_sys_mounted_getmntinfo=no]) + ]) + if test $fu_cv_sys_mounted_getmntinfo = yes; then + AC_CACHE_CHECK([whether getmntinfo returns statvfs structures], + [fu_cv_sys_mounted_getmntinfo2], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +#if HAVE_SYS_PARAM_H +# include +#endif +#include +#if HAVE_SYS_MOUNT_H +# include +#endif +#if HAVE_SYS_STATVFS_H +# include +#endif +extern +#ifdef __cplusplus +"C" +#endif +int getmntinfo (struct statfs **, int); + ]], [[]])], + [fu_cv_sys_mounted_getmntinfo2=no], + [fu_cv_sys_mounted_getmntinfo2=yes]) + ]) + if test $fu_cv_sys_mounted_getmntinfo2 = no; then + # Mac OS X, FreeBSD, OpenBSD, also (obsolete) 4.4BSD. + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTINFO], [1], + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statfs'. (4.4BSD, Darwin)]) + else + # NetBSD, Minix. + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_GETMNTINFO2], [1], + [Define if there is a function named getmntinfo for reading the + list of mounted file systems and it returns an array of + 'struct statvfs'. (NetBSD 3.0)]) + fi + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Haiku, also (obsolete) BeOS. + AC_CHECK_FUNCS([next_dev fs_stat_dev]) + AC_CHECK_HEADERS([fs_info.h]) + AC_CACHE_CHECK([for BEOS mounted file system support functions], + [fu_cv_sys_mounted_fs_stat_dev], + [if test $ac_cv_header_fs_info_h = yes \ + && test $ac_cv_func_next_dev = yes \ + && test $ac_cv_func_fs_stat_dev = yes; then + fu_cv_sys_mounted_fs_stat_dev=yes + else + fu_cv_sys_mounted_fs_stat_dev=no + fi + ]) + if test $fu_cv_sys_mounted_fs_stat_dev = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_FS_STAT_DEV], [1], + [Define if there are functions named next_dev and fs_stat_dev for + reading the list of mounted file systems. (BeOS)]) + fi + fi + + if test -z "$ac_list_mounted_fs"; then + # Interix / BSD alike statvfs + # the code is really interix specific, so make sure, we're on it. + case "$host" in + *-interix*) + AC_CHECK_FUNCS([statvfs]) + if test $ac_cv_func_statvfs = yes; then + ac_list_mounted_fs=found + AC_DEFINE([MOUNTED_INTERIX_STATVFS], [1], + [Define if we are on interix, and ought to use statvfs plus + some special knowledge on where mounted file systems can be + found. (Interix)]) + fi + ;; + esac + fi + + if test -z "$ac_list_mounted_fs"; then + AC_MSG_ERROR([could not determine how to read list of mounted file systems]) + # FIXME -- no need to abort building the whole package + # Can't build mountlist.c or anything that needs its functions + fi + + if test $ac_list_mounted_fs = found; then + gl_cv_list_mounted_fs=yes + else + gl_cv_list_mounted_fs=no + fi +]) + +# Prerequisites of lib/mountlist.c not done by gl_MOUNTLIST. +AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], +[ + dnl Note gl_MOUNTLIST checks for mntent.h, not sys/mntent.h. + AC_CHECK_HEADERS([sys/mntent.h]) + AC_HEADER_MAJOR()dnl for use of makedev () + gl_FSTYPENAME +]) + +# Replace Autoconf's AC_FUNC_GETMNTENT to omit checks that are unnecessary +# nowadays. +AC_DEFUN([AC_FUNC_GETMNTENT], +[ + # getmntent is in the standard C library on most systems, but in -lgen on + # Unixware. + AC_SEARCH_LIBS([getmntent], [gen]) + AC_CHECK_FUNCS([getmntent]) +]) diff --git a/m4.include/gnulib/stat-size.m4 b/m4.include/gnulib/stat-size.m4 new file mode 100644 index 0000000..95f4828 --- /dev/null +++ b/m4.include/gnulib/stat-size.m4 @@ -0,0 +1,14 @@ +#serial 1 + +# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_STAT_SIZE], +[ + # Don't call AC_STRUCT_ST_BLOCKS because it causes bugs. Details at + # https://lists.gnu.org/r/bug-gnulib/2011-06/msg00051.html + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) diff --git a/m4.include/gnulib/sys_types_h.m4 b/m4.include/gnulib/sys_types_h.m4 new file mode 100644 index 0000000..53f2c09 --- /dev/null +++ b/m4.include/gnulib/sys_types_h.m4 @@ -0,0 +1,67 @@ +# sys_types_h.m4 serial 12 +dnl Copyright (C) 2011-2021 Free Software Foundation, 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_ONCE([gl_SYS_TYPES_H], +[ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + + dnl Use sane struct stat types in OpenVMS 8.2 and later. + AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) + + gl_NEXT_HEADERS([sys/types.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to override the 'off_t' type. + AC_REQUIRE([gl_TYPE_OFF_T]) + + dnl Whether to override the 'dev_t' and 'ino_t' types. + m4_ifdef([gl_WINDOWS_STAT_INODES], [ + AC_REQUIRE([gl_WINDOWS_STAT_INODES]) + ], [ + WINDOWS_STAT_INODES=0 + ]) + AC_SUBST([WINDOWS_STAT_INODES]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], +[ +]) + +# This works around a buggy version in autoconf <= 2.69. +# See +# The 2.70 version isn't quoted properly, so override it too. + +m4_version_prereq([2.70.1], [], [ + +m4_undefine([AC_HEADER_MAJOR]) +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CHECK_HEADERS_ONCE([sys/types.h]) +AC_CHECK_HEADER([sys/mkdev.h], + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are + declared in .])]) +if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER([sys/sysmacros.h], + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' + are declared in .])]) +fi +])# AC_HEADER_MAJOR + +]) diff --git a/m4.include/gnulib/windows-stat-inodes.m4 b/m4.include/gnulib/windows-stat-inodes.m4 new file mode 100644 index 0000000..936900a --- /dev/null +++ b/m4.include/gnulib/windows-stat-inodes.m4 @@ -0,0 +1,19 @@ +# windows-stat-inodes.m4 serial 1 +dnl Copyright (C) 2017-2018 Free Software Foundation, 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. + +dnl Enable inode identification in 'struct stat' on native Windows platforms. +dnl Set WINDOWS_STAT_INODES to +dnl - 0 -> keep the default (dev_t = 32-bit, ino_t = 16-bit), +dnl - 1 -> override types normally (dev_t = 32-bit, ino_t = 64-bit), +dnl - 2 -> override types in an extended way (dev_t = 64-bit, ino_t = 128-bit). +AC_DEFUN([gl_WINDOWS_STAT_INODES], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) WINDOWS_STAT_INODES=1 ;; + *) WINDOWS_STAT_INODES=0 ;; + esac +]) -- cgit v1.2.3