maint: add syntax-check rule to prohibit "."-terminated "SEE ALSO"
[coreutils/ericb.git] / m4 / stat-prog.m4
blobc23fb1fbe794f43eabe47841d7c83948f181d8c4
1 # stat-prog.m4 serial 6
2 # Record the prerequisites of src/stat.c from the coreutils package.
4 # Copyright (C) 2002-2004, 2006, 2008-2011 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 <http://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
28   dnl on Solaris 8.
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])])
34   statvfs_includes="\
35 AC_INCLUDES_DEFAULT
36 #include <sys/statvfs.h>
38   statfs_includes="\
39 AC_INCLUDES_DEFAULT
40 #if HAVE_SYS_VFS_H
41 # include <sys/vfs.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>
48 #  include <nfs/vfs.h>
49 # endif
50 #elif HAVE_OS_H
51 # include <fs_info.h>
52 #endif
54   dnl Keep this long conditional in sync with the USE_STATVFS conditional
55   dnl in ../src/stat.c.
56   if test "$fu_cv_sys_stat_statvfs" = yes &&
57      { AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
58        test $ac_cv_member_struct_statvfs_f_basetype = yes ||
59        { AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes])
60          test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
61          { test $ac_cv_member_struct_statfs_f_fstypename != yes &&
62            { AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
63              test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
64   then
65     AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
66     AC_COMPILE_IFELSE(
67       [AC_LANG_PROGRAM(
68          [$statvfs_includes],
69          [static statvfs s;
70           return (s.s_fsid ^ 0) == 0;])],
71       [AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
72          [Define to 1 if the f_fsid member of struct statvfs is an integer.])])
73   else
74     AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type],,,
75       [$statfs_includes])
76     if test $ac_cv_header_OS_h != yes; then
77       AC_COMPILE_IFELSE(
78         [AC_LANG_PROGRAM(
79            [$statfs_includes],
80            [static statfs s;
81             return (s.s_fsid ^ 0) == 0;])],
82         [AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
83            [Define to 1 if the f_fsid member of struct statfs is an integer.])])
84     fi
85   fi