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)
|
---|
5 |
|
---|
6 | AC_CHECK_HEADERS(sys/mount.h, , , [AC_INCLUDES_DEFAULT
|
---|
7 | #ifdef HAVE_SYS_PARAM_H
|
---|
8 | #include <sys/param.h>
|
---|
9 | #endif])
|
---|
10 |
|
---|
11 | space=no
|
---|
12 |
|
---|
13 | # Test for statvfs64.
|
---|
14 | if test $space = no; then
|
---|
15 | # SVR4
|
---|
16 | AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64,
|
---|
17 | [AC_TRY_RUN([
|
---|
18 | #if defined(HAVE_UNISTD_H)
|
---|
19 | #include <unistd.h>
|
---|
20 | #endif
|
---|
21 | #include <sys/types.h>
|
---|
22 | #include <sys/statvfs.h>
|
---|
23 | main ()
|
---|
24 | {
|
---|
25 | struct statvfs64 fsd;
|
---|
26 | exit (statvfs64 (".", &fsd));
|
---|
27 | }],
|
---|
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
|
---|
32 | space=yes
|
---|
33 | AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available])
|
---|
34 | fi
|
---|
35 | fi
|
---|
36 |
|
---|
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
|
---|
44 | # SVR4
|
---|
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
|
---|
52 | space=yes
|
---|
53 | AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available])
|
---|
54 | fi
|
---|
55 | fi
|
---|
56 |
|
---|
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])
|
---|
65 | fi
|
---|
66 |
|
---|
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,
|
---|
71 | [AC_TRY_RUN([
|
---|
72 | #include <sys/param.h>
|
---|
73 | #include <sys/types.h>
|
---|
74 | #include <sys/mount.h>
|
---|
75 | main ()
|
---|
76 | {
|
---|
77 | struct statfs fsd;
|
---|
78 | fsd.f_fsize = 0;
|
---|
79 | exit (statfs (".", &fsd, sizeof (struct statfs)));
|
---|
80 | }],
|
---|
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
|
---|
86 | space=yes
|
---|
87 | AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments])
|
---|
88 | fi
|
---|
89 | fi
|
---|
90 |
|
---|
91 | if test $space = no; then
|
---|
92 | # AIX
|
---|
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,
|
---|
96 | [AC_TRY_RUN([
|
---|
97 | #ifdef HAVE_SYS_PARAM_H
|
---|
98 | #include <sys/param.h>
|
---|
99 | #endif
|
---|
100 | #ifdef HAVE_SYS_MOUNT_H
|
---|
101 | #include <sys/mount.h>
|
---|
102 | #endif
|
---|
103 | #ifdef HAVE_SYS_VFS_H
|
---|
104 | #include <sys/vfs.h>
|
---|
105 | #endif
|
---|
106 | main ()
|
---|
107 | {
|
---|
108 | struct statfs fsd;
|
---|
109 | fsd.f_bsize = 0;
|
---|
110 | exit (statfs (".", &fsd));
|
---|
111 | }],
|
---|
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
|
---|
117 | space=yes
|
---|
118 | AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property])
|
---|
119 | fi
|
---|
120 | fi
|
---|
121 |
|
---|
122 | if test $space = no; then
|
---|
123 | # SVR3
|
---|
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>
|
---|
128 | main ()
|
---|
129 | {
|
---|
130 | struct statfs fsd;
|
---|
131 | exit (statfs (".", &fsd, sizeof fsd, 0));
|
---|
132 | }],
|
---|
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
|
---|
138 | space=yes
|
---|
139 | AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments])
|
---|
140 | fi
|
---|
141 | fi
|
---|
142 |
|
---|
143 | if test $space = no; then
|
---|
144 | # 4.4BSD and NetBSD
|
---|
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>
|
---|
151 | #endif
|
---|
152 | #ifdef HAVE_SYS_MOUNT_H
|
---|
153 | #include <sys/mount.h>
|
---|
154 | #endif
|
---|
155 | main ()
|
---|
156 | {
|
---|
157 | struct statfs fsd;
|
---|
158 | fsd.f_fsize = 0;
|
---|
159 | exit (statfs (".", &fsd));
|
---|
160 | }],
|
---|
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
|
---|
166 | space=yes
|
---|
167 | AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize])
|
---|
168 | fi
|
---|
169 | fi
|
---|
170 |
|
---|
171 | if test $space = no; then
|
---|
172 | # Ultrix
|
---|
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>
|
---|
178 | #endif
|
---|
179 | #ifdef HAVE_SYS_MOUNT_H
|
---|
180 | #include <sys/mount.h>
|
---|
181 | #endif
|
---|
182 | #ifdef HAVE_SYS_FS_TYPES_H
|
---|
183 | #include <sys/fs_types.h>
|
---|
184 | #endif
|
---|
185 | main ()
|
---|
186 | {
|
---|
187 | struct fs_data fsd;
|
---|
188 | /* Ultrix's statfs returns 1 for success,
|
---|
189 | 0 for not mounted, -1 for failure. */
|
---|
190 | exit (statfs (".", &fsd) != 1);
|
---|
191 | }],
|
---|
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
|
---|
197 | space=yes
|
---|
198 | AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available])
|
---|
199 | fi
|
---|
200 | fi
|
---|