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 # fsusage.c assumes that statvfs has an f_frsize entry. Some weird
58 # systems use f_bsize.
59 AC_CACHE_CHECK([that statvfs.f_frsize works],samba_cv_frsize, [
60 AC_TRY_COMPILE([#include <sys/types.h>
61 #include <sys/statvfs.h>],[struct statvfs buf; buf.f_frsize = 0],
62 samba_cv_frsize=yes,samba_cv_frsize=no)])
63 if test x"$samba_cv_frsize" = x"yes"; then
64 AC_DEFINE(HAVE_FRSIZE, 1, [Whether statvfs.f_frsize exists])
67 if test $space = no; then
68 # DEC Alpha running OSF/1
69 AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
70 AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
72 #include <sys/param.h>
73 #include <sys/types.h>
74 #include <sys/mount.h>
79 exit (statfs (".", &fsd, sizeof (struct statfs)));
81 fu_cv_sys_stat_statfs3_osf1=yes,
82 fu_cv_sys_stat_statfs3_osf1=no,
83 fu_cv_sys_stat_statfs3_osf1=no)])
84 AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
85 if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
87 AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
91 if test $space = no; then
93 AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
94 member (AIX, 4.3BSD)])
95 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
97 #ifdef HAVE_SYS_PARAM_H
98 #include <sys/param.h>
100 #ifdef HAVE_SYS_MOUNT_H
101 #include <sys/mount.h>
103 #ifdef HAVE_SYS_VFS_H
110 exit (statfs (".", &fsd));
112 fu_cv_sys_stat_statfs2_bsize=yes,
113 fu_cv_sys_stat_statfs2_bsize=no,
114 fu_cv_sys_stat_statfs2_bsize=no)])
115 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
116 if test $fu_cv_sys_stat_statfs2_bsize = yes; then
118 AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
122 if test $space = no; then
124 AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
125 AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
126 [AC_TRY_RUN([#include <sys/types.h>
127 #include <sys/statfs.h>
131 exit (statfs (".", &fsd, sizeof fsd, 0));
133 fu_cv_sys_stat_statfs4=yes,
134 fu_cv_sys_stat_statfs4=no,
135 fu_cv_sys_stat_statfs4=no)])
136 AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
137 if test $fu_cv_sys_stat_statfs4 = yes; then
139 AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
143 if test $space = no; then
145 AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
146 member (4.4BSD and NetBSD)])
147 AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
148 [AC_TRY_RUN([#include <sys/types.h>
149 #ifdef HAVE_SYS_PARAM_H
150 #include <sys/param.h>
152 #ifdef HAVE_SYS_MOUNT_H
153 #include <sys/mount.h>
159 exit (statfs (".", &fsd));
161 fu_cv_sys_stat_statfs2_fsize=yes,
162 fu_cv_sys_stat_statfs2_fsize=no,
163 fu_cv_sys_stat_statfs2_fsize=no)])
164 AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
165 if test $fu_cv_sys_stat_statfs2_fsize = yes; then
167 AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
171 if test $space = no; then
173 AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
174 AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
175 [AC_TRY_RUN([#include <sys/types.h>
176 #ifdef HAVE_SYS_PARAM_H
177 #include <sys/param.h>
179 #ifdef HAVE_SYS_MOUNT_H
180 #include <sys/mount.h>
182 #ifdef HAVE_SYS_FS_TYPES_H
183 #include <sys/fs_types.h>
188 /* Ultrix's statfs returns 1 for success,
189 0 for not mounted, -1 for failure. */
190 exit (statfs (".", &fsd) != 1);
192 fu_cv_sys_stat_fs_data=yes,
193 fu_cv_sys_stat_fs_data=no,
194 fu_cv_sys_stat_fs_data=no)])
195 AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
196 if test $fu_cv_sys_stat_fs_data = yes; then
198 AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])