1 # stat-prog.m4 serial 7
2 # Record the prerequisites of src/stat.c from the coreutils package.
4 # Copyright (C) 2002-2023 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 # Written by Jim Meyering.
21 AC_DEFUN([cu_PREREQ_STAT_PROG],
23 AC_REQUIRE([gl_FSUSAGE])
24 AC_REQUIRE([gl_FSTYPENAME])
25 AC_CHECK_HEADERS_ONCE([OS.h netinet/in.h sys/param.h sys/vfs.h])
27 dnl Check for vfs.h first, since this avoids a warning with nfs_client.h
29 test $ac_cv_header_sys_param_h = yes &&
30 test $ac_cv_header_sys_mount_h = yes &&
31 AC_CHECK_HEADERS([nfs/vfs.h],
32 [AC_CHECK_HEADERS([nfs/nfs_client.h])])
36 #include <sys/statvfs.h>
42 #elif HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H
43 # include <sys/param.h>
44 # include <sys/mount.h>
45 # if HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H
46 # include <netinet/in.h>
47 # include <nfs/nfs_clnt.h>
54 dnl Keep this long conditional in sync with the USE_STATVFS conditional
56 if case "$fu_cv_sys_stat_statvfs$fu_cv_sys_stat_statvfs64" in
57 *yes*) ;; *) false;; esac &&
58 { AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
59 test $ac_cv_member_struct_statvfs_f_basetype = yes ||
60 { AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes])
61 test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
62 { test $ac_cv_member_struct_statfs_f_fstypename != yes &&
63 { AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
64 test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
66 AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
71 return (s.s_fsid ^ 0) == 0;])],
72 [AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
73 [Define to 1 if the f_fsid member of struct statvfs is an integer.])])
75 AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_namemax,
76 struct statfs.f_type, struct statfs.f_frsize],,,
78 if test $ac_cv_header_OS_h != yes; then
83 return (s.s_fsid ^ 0) == 0;])],
84 [AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
85 [Define to 1 if the f_fsid member of struct statfs is an integer.])])