1 #################################################
2 # these tests are taken from the GNU fileutils package
3 AC_CHECKING(how to get filesystem space usage)
4 AC_CHECK_HEADERS(sys/statfs.h sys/statvfs.h sys/vfs.h)
6 AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
7 #ifdef HAVE_SYS_PARAM_H
14 if test $space = no; then
16 AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
18 #if defined(HAVE_UNISTD_H)
21 #include <sys/types.h>
22 #include <sys/statvfs.h>
26 exit (statvfs64 (".", &fsd));
28 fu_cv_sys_stat_statvfs64=yes,
29 fu_cv_sys_stat_statvfs64=no,
30 fu_cv_sys_stat_statvfs64=cross)])
31 if test $fu_cv_sys_stat_statvfs64 = yes; then
33 AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
37 # Perform only the link test since it seems there are no variants of the
38 # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
39 # because that got a false positive on SCO OSR5. Adding the declaration
40 # of a `struct statvfs' causes this test to fail (as it should) on such
41 # systems. That system is reported to work fine with STAT_STATFS4 which
42 # is what it gets when this test fails.
43 if test $space = no; then
45 AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
46 [AC_TRY_LINK([#include <sys/types.h>
47 #include <sys/statvfs.h>],
48 [struct statvfs fsd; statvfs (0, &fsd);],
49 fu_cv_sys_stat_statvfs=yes,
50 fu_cv_sys_stat_statvfs=no)])
51 if test $fu_cv_sys_stat_statvfs = yes; then
53 AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
57 if test $space = no; then
58 # DEC Alpha running OSF/1
59 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
60 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
62 #include <sys/param.h>
63 #include <sys/types.h>
64 #include <sys/mount.h>
69 exit (statfs (".", &fsd, sizeof (struct statfs)));
71 fu_cv_sys_stat_statfs3_osf1=yes,
72 fu_cv_sys_stat_statfs3_osf1=no,
73 fu_cv_sys_stat_statfs3_osf1=no)])
74 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
75 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
77 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
81 if test $space = no; then
83 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
84 member (AIX, 4.3BSD)])
85 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
87 #ifdef HAVE_SYS_PARAM_H
88 #include <sys/param.h>
90 #ifdef HAVE_SYS_MOUNT_H
91 #include <sys/mount.h>
100 exit (statfs (".", &fsd));
102 fu_cv_sys_stat_statfs2_bsize=yes,
103 fu_cv_sys_stat_statfs2_bsize=no,
104 fu_cv_sys_stat_statfs2_bsize=no)])
105 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
106 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
108 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
112 if test $space = no; then
114 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
115 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
116 [AC_TRY_RUN([#include <sys/types.h>
117 #include <sys/statfs.h>
121 exit (statfs (".", &fsd, sizeof fsd, 0));
123 fu_cv_sys_stat_statfs4=yes,
124 fu_cv_sys_stat_statfs4=no,
125 fu_cv_sys_stat_statfs4=no)])
126 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
127 if test $fu_cv_sys_stat_statfs4 = yes; then
129 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
133 if test $space = no; then
135 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
136 member (4.4BSD and NetBSD)])
137 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
138 [AC_TRY_RUN([#include <sys/types.h>
139 #ifdef HAVE_SYS_PARAM_H
140 #include <sys/param.h>
142 #ifdef HAVE_SYS_MOUNT_H
143 #include <sys/mount.h>
149 exit (statfs (".", &fsd));
151 fu_cv_sys_stat_statfs2_fsize=yes,
152 fu_cv_sys_stat_statfs2_fsize=no,
153 fu_cv_sys_stat_statfs2_fsize=no)])
154 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
155 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
157 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
161 if test $space = no; then
163 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
164 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
165 [AC_TRY_RUN([#include <sys/types.h>
166 #ifdef HAVE_SYS_PARAM_H
167 #include <sys/param.h>
169 #ifdef HAVE_SYS_MOUNT_H
170 #include <sys/mount.h>
172 #ifdef HAVE_SYS_FS_TYPES_H
173 #include <sys/fs_types.h>
178 /* Ultrix's statfs returns 1 for success,
179 0 for not mounted, -1 for failure. */
180 exit (statfs (".", &fsd) != 1);
182 fu_cv_sys_stat_fs_data=yes,
183 fu_cv_sys_stat_fs_data=no,
184 fu_cv_sys_stat_fs_data=no)])
185 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
186 if test $fu_cv_sys_stat_fs_data = yes; then
188 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])