3 # From fileutils/configure.in
4 # Determine how a program can obtain filesystems usage information.
6 AC_DEFUN(jm_FILE_SYSTEM_USAGE,
9 AC_CHECKING(how to get filesystem space usage)
12 # Perform only the link test since it seems there are no variants of the
13 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
14 # because that got a false positive on SCO OSR5. Adding the declaration
15 # of a `struct statvfs' causes this test to fail (as it should) on such
16 # systems. That system is reported to work fine with STAT_STATFS4 which
17 # is what it gets when this test fails.
18 if test $space = no; then
20 AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
21 [AC_TRY_LINK([#include <sys/types.h>
22 #include <sys/statvfs.h>],
23 [struct statvfs fsd; statvfs (0, &fsd);],
24 fu_cv_sys_stat_statvfs=yes,
25 fu_cv_sys_stat_statvfs=no)])
26 if test $fu_cv_sys_stat_statvfs = yes; then
28 AC_DEFINE(STAT_STATVFS, 1,
29 [ Define if there is a function named statvfs. (SVR4)])
33 if test $space = no; then
34 # DEC Alpha running OSF/1
35 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
36 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
38 #include <sys/param.h>
39 #include <sys/types.h>
40 #include <sys/mount.h>
45 exit (statfs (".", &fsd, sizeof (struct statfs)));
47 fu_cv_sys_stat_statfs3_osf1=yes,
48 fu_cv_sys_stat_statfs3_osf1=no,
49 fu_cv_sys_stat_statfs3_osf1=no)])
50 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
51 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
53 AC_DEFINE(STAT_STATFS3_OSF1, 1,
54 [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)])
58 if test $space = no; then
60 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
61 member (AIX, 4.3BSD)])
62 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
64 #ifdef HAVE_SYS_PARAM_H
65 #include <sys/param.h>
67 #ifdef HAVE_SYS_MOUNT_H
68 #include <sys/mount.h>
77 exit (statfs (".", &fsd));
79 fu_cv_sys_stat_statfs2_bsize=yes,
80 fu_cv_sys_stat_statfs2_bsize=no,
81 fu_cv_sys_stat_statfs2_bsize=no)])
82 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
83 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
85 AC_DEFINE(STAT_STATFS2_BSIZE, 1,
86 [ Define if statfs takes 2 args and struct statfs has a field named f_bsize.
87 (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
91 if test $space = no; then
93 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
94 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
95 [AC_TRY_RUN([#include <sys/types.h>
96 #include <sys/statfs.h>
100 exit (statfs (".", &fsd, sizeof fsd, 0));
102 fu_cv_sys_stat_statfs4=yes,
103 fu_cv_sys_stat_statfs4=no,
104 fu_cv_sys_stat_statfs4=no)])
105 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
106 if test $fu_cv_sys_stat_statfs4 = yes; then
108 AC_DEFINE(STAT_STATFS4, 1,
109 [ Define if statfs takes 4 args. (SVR3, Dynix, Irix, Dolphin)])
113 if test $space = no; then
115 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
116 member (4.4BSD and NetBSD)])
117 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
118 [AC_TRY_RUN([#include <sys/types.h>
119 #ifdef HAVE_SYS_PARAM_H
120 #include <sys/param.h>
122 #ifdef HAVE_SYS_MOUNT_H
123 #include <sys/mount.h>
129 exit (statfs (".", &fsd));
131 fu_cv_sys_stat_statfs2_fsize=yes,
132 fu_cv_sys_stat_statfs2_fsize=no,
133 fu_cv_sys_stat_statfs2_fsize=no)])
134 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
135 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
137 AC_DEFINE(STAT_STATFS2_FSIZE, 1,
138 [ Define if statfs takes 2 args and struct statfs has a field named f_fsize.
143 if test $space = no; then
145 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
146 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
147 [AC_TRY_RUN([#include <sys/types.h>
148 #ifdef HAVE_SYS_PARAM_H
149 #include <sys/param.h>
151 #ifdef HAVE_SYS_MOUNT_H
152 #include <sys/mount.h>
154 #ifdef HAVE_SYS_FS_TYPES_H
155 #include <sys/fs_types.h>
160 /* Ultrix's statfs returns 1 for success,
161 0 for not mounted, -1 for failure. */
162 exit (statfs (".", &fsd) != 1);
164 fu_cv_sys_stat_fs_data=yes,
165 fu_cv_sys_stat_fs_data=no,
166 fu_cv_sys_stat_fs_data=no)])
167 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
168 if test $fu_cv_sys_stat_fs_data = yes; then
170 AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
171 [ Define if statfs takes 2 args and the second argument has
172 type struct fs_data. (Ultrix)])
176 if test $space = no; then
178 AC_TRY_CPP([#include <sys/filsys.h>],
179 AC_DEFINE(STAT_READ_FILSYS, 1,
180 [ Define if there is no specific function for reading filesystems usage
181 information and you have the <sys/filsys.h> header file. (SVR2)])