diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 14:46:01 +0100 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2023-01-31 14:46:01 +0100 |
commit | e8bd88d1fcded01ccd066572eeaae1b507989cb3 (patch) | |
tree | c8e7be6c07c6f635f6e803e6a6ba9e7a95fee7c0 /gl/m4/fsusage.m4 | |
parent | 2ad962c13473607ca0d974bfaa516a0ed53ec73d (diff) | |
download | monitoring-plugins-e8bd88d1fcded01ccd066572eeaae1b507989cb3.tar.gz |
Sync with the latest Gnulib code 668c0b8ffa
Diffstat (limited to 'gl/m4/fsusage.m4')
-rw-r--r-- | gl/m4/fsusage.m4 | 363 |
1 files changed, 161 insertions, 202 deletions
diff --git a/gl/m4/fsusage.m4 b/gl/m4/fsusage.m4 index 6277bfa5..88f3ca81 100644 --- a/gl/m4/fsusage.m4 +++ b/gl/m4/fsusage.m4 | |||
@@ -1,7 +1,7 @@ | |||
1 | # serial 30 | 1 | # serial 35 |
2 | # Obtaining file system usage information. | 2 | # Obtaining file system usage information. |
3 | 3 | ||
4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2013 Free Software Foundation, Inc. | 4 | # Copyright (C) 1997-1998, 2000-2001, 2003-2023 Free Software Foundation, Inc. |
5 | # | 5 | # |
6 | # This file is free software; the Free Software Foundation | 6 | # This file is free software; the Free Software Foundation |
7 | # gives unlimited permission to copy and/or distribute it, | 7 | # gives unlimited permission to copy and/or distribute it, |
@@ -29,27 +29,29 @@ AC_DEFUN([gl_FSUSAGE], | |||
29 | 29 | ||
30 | AC_DEFUN([gl_FILE_SYSTEM_USAGE], | 30 | AC_DEFUN([gl_FILE_SYSTEM_USAGE], |
31 | [ | 31 | [ |
32 | dnl Enable large-file support. This has the effect of changing the size | 32 | dnl Enable large-file support. This has the effect of changing the size |
33 | dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on | 33 | dnl of field f_blocks in 'struct statvfs' from 32 bit to 64 bit on |
34 | dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size | 34 | dnl glibc/Hurd, HP-UX 11, Solaris (32-bit mode). It also changes the size |
35 | dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on | 35 | dnl of field f_blocks in 'struct statfs' from 32 bit to 64 bit on |
36 | dnl Mac OS X >= 10.5 (32-bit mode). | 36 | dnl Mac OS X >= 10.5 (32-bit mode). |
37 | AC_REQUIRE([AC_SYS_LARGEFILE]) | 37 | AC_REQUIRE([AC_SYS_LARGEFILE]) |
38 | 38 | ||
39 | AC_MSG_NOTICE([checking how to get file system space usage]) | 39 | ac_fsusage_space=no |
40 | ac_fsusage_space=no | ||
41 | 40 | ||
42 | # Perform only the link test since it seems there are no variants of the | 41 | # Perform only the link test since it seems there are no variants of the |
43 | # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) | 42 | # statvfs function. This check is more than just AC_CHECK_FUNCS([statvfs]) |
44 | # because that got a false positive on SCO OSR5. Adding the declaration | 43 | # because that got a false positive on SCO OSR5. Adding the declaration |
45 | # of a 'struct statvfs' causes this test to fail (as it should) on such | 44 | # of a 'struct statvfs' causes this test to fail (as it should) on such |
46 | # systems. That system is reported to work fine with STAT_STATFS4 which | 45 | # systems. That system is reported to work fine with STAT_STATFS4 which |
47 | # is what it gets when this test fails. | 46 | # is what it gets when this test fails. |
48 | if test $ac_fsusage_space = no; then | 47 | if test $ac_fsusage_space = no; then |
49 | # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, | 48 | # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, |
50 | # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. | 49 | # OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS. |
51 | AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs], | 50 | AC_CACHE_CHECK([for statvfs function (SVR4)], |
52 | [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h> | 51 | [fu_cv_sys_stat_statvfs], |
52 | [AC_LINK_IFELSE( | ||
53 | [AC_LANG_PROGRAM([[ | ||
54 | #include <sys/types.h> | ||
53 | #ifdef __osf__ | 55 | #ifdef __osf__ |
54 | "Do not use Tru64's statvfs implementation" | 56 | "Do not use Tru64's statvfs implementation" |
55 | #endif | 57 | #endif |
@@ -68,45 +70,47 @@ struct statvfs fsd; | |||
68 | int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; | 70 | int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1]; |
69 | #endif | 71 | #endif |
70 | ]], | 72 | ]], |
71 | [[statvfs (0, &fsd);]])], | 73 | [[statvfs (0, &fsd);]])], |
72 | [fu_cv_sys_stat_statvfs=yes], | 74 | [fu_cv_sys_stat_statvfs=yes], |
73 | [fu_cv_sys_stat_statvfs=no])]) | 75 | [fu_cv_sys_stat_statvfs=no]) |
74 | if test $fu_cv_sys_stat_statvfs = yes; then | ||
75 | ac_fsusage_space=yes | ||
76 | # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. | ||
77 | # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems | ||
78 | # statvfs with large-file support is already equivalent to statvfs64. | ||
79 | AC_CACHE_CHECK([whether to use statvfs64], | ||
80 | [fu_cv_sys_stat_statvfs64], | ||
81 | [AC_LINK_IFELSE( | ||
82 | [AC_LANG_PROGRAM( | ||
83 | [[#include <sys/types.h> | ||
84 | #include <sys/statvfs.h> | ||
85 | struct statvfs64 fsd; | ||
86 | int check_f_blocks_larger_in_statvfs64 | ||
87 | [sizeof (((struct statvfs64 *) 0)->f_blocks) | ||
88 | > sizeof (((struct statvfs *) 0)->f_blocks) | ||
89 | ? 1 : -1]; | ||
90 | ]], | ||
91 | [[statvfs64 (0, &fsd);]])], | ||
92 | [fu_cv_sys_stat_statvfs64=yes], | ||
93 | [fu_cv_sys_stat_statvfs64=no]) | ||
94 | ]) | 76 | ]) |
95 | if test $fu_cv_sys_stat_statvfs64 = yes; then | 77 | if test $fu_cv_sys_stat_statvfs = yes; then |
96 | AC_DEFINE([STAT_STATVFS64], [1], | 78 | ac_fsusage_space=yes |
97 | [ Define if statvfs64 should be preferred over statvfs.]) | 79 | # AIX >= 5.2 has statvfs64 that has a wider f_blocks field than statvfs. |
98 | else | 80 | # glibc, HP-UX, IRIX, Solaris have statvfs64 as well, but on these systems |
99 | AC_DEFINE([STAT_STATVFS], [1], | 81 | # statvfs with large-file support is already equivalent to statvfs64. |
100 | [ Define if there is a function named statvfs. (SVR4)]) | 82 | AC_CACHE_CHECK([whether to use statvfs64], |
83 | [fu_cv_sys_stat_statvfs64], | ||
84 | [AC_LINK_IFELSE( | ||
85 | [AC_LANG_PROGRAM( | ||
86 | [[#include <sys/types.h> | ||
87 | #include <sys/statvfs.h> | ||
88 | struct statvfs64 fsd; | ||
89 | int check_f_blocks_larger_in_statvfs64 | ||
90 | [sizeof (((struct statvfs64 *) 0)->f_blocks) | ||
91 | > sizeof (((struct statvfs *) 0)->f_blocks) | ||
92 | ? 1 : -1]; | ||
93 | ]], | ||
94 | [[statvfs64 (0, &fsd);]])], | ||
95 | [fu_cv_sys_stat_statvfs64=yes], | ||
96 | [fu_cv_sys_stat_statvfs64=no]) | ||
97 | ]) | ||
98 | if test $fu_cv_sys_stat_statvfs64 = yes; then | ||
99 | AC_DEFINE([STAT_STATVFS64], [1], | ||
100 | [Define if statvfs64 should be preferred over statvfs.]) | ||
101 | else | ||
102 | AC_DEFINE([STAT_STATVFS], [1], | ||
103 | [Define if there is a function named statvfs. (SVR4)]) | ||
104 | fi | ||
101 | fi | 105 | fi |
102 | fi | 106 | fi |
103 | fi | ||
104 | 107 | ||
105 | # Check for this unconditionally so we have a | 108 | # Check for this unconditionally so we have a |
106 | # good fallback on glibc/Linux > 2.6 < 2.6.36 | 109 | # good fallback on glibc/Linux > 2.6 < 2.6.36 |
107 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_frsize member]) | 110 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_frsize member], |
108 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize], | 111 | [fu_cv_sys_stat_statfs2_frsize], |
109 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 112 | [AC_RUN_IFELSE( |
113 | [AC_LANG_SOURCE([[ | ||
110 | #ifdef HAVE_SYS_PARAM_H | 114 | #ifdef HAVE_SYS_PARAM_H |
111 | #include <sys/param.h> | 115 | #include <sys/param.h> |
112 | #endif | 116 | #endif |
@@ -119,26 +123,26 @@ AC_CACHE_VAL([fu_cv_sys_stat_statfs2_frsize], | |||
119 | int | 123 | int |
120 | main () | 124 | main () |
121 | { | 125 | { |
122 | struct statfs fsd; | 126 | struct statfs fsd; |
123 | fsd.f_frsize = 0; | 127 | fsd.f_frsize = 0; |
124 | return statfs (".", &fsd) != 0; | 128 | return statfs (".", &fsd) != 0; |
125 | }]])], | 129 | }]])], |
126 | [fu_cv_sys_stat_statfs2_frsize=yes], | 130 | [fu_cv_sys_stat_statfs2_frsize=yes], |
127 | [fu_cv_sys_stat_statfs2_frsize=no], | 131 | [fu_cv_sys_stat_statfs2_frsize=no], |
128 | [fu_cv_sys_stat_statfs2_frsize=no])]) | 132 | [fu_cv_sys_stat_statfs2_frsize=no]) |
129 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_frsize]) | 133 | ]) |
130 | if test $fu_cv_sys_stat_statfs2_frsize = yes; then | 134 | if test $fu_cv_sys_stat_statfs2_frsize = yes; then |
131 | ac_fsusage_space=yes | 135 | ac_fsusage_space=yes |
132 | AC_DEFINE([STAT_STATFS2_FRSIZE], [1], | 136 | AC_DEFINE([STAT_STATFS2_FRSIZE], [1], |
133 | [ Define if statfs takes 2 args and struct statfs has a field named f_frsize. | 137 | [Define if statfs takes 2 args and struct statfs has a field named f_frsize. |
134 | (glibc/Linux > 2.6)]) | 138 | (glibc/Linux > 2.6)]) |
135 | fi | 139 | fi |
136 | 140 | ||
137 | if test $ac_fsusage_space = no; then | 141 | if test $ac_fsusage_space = no; then |
138 | # DEC Alpha running OSF/1 | 142 | # DEC Alpha running OSF/1 |
139 | AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) | 143 | AC_CACHE_CHECK([for 3-argument statfs function (DEC OSF/1)], |
140 | AC_CACHE_VAL([fu_cv_sys_stat_statfs3_osf1], | 144 | [fu_cv_sys_stat_statfs3_osf1], |
141 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 145 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
142 | #include <sys/param.h> | 146 | #include <sys/param.h> |
143 | #include <sys/types.h> | 147 | #include <sys/types.h> |
144 | #include <sys/mount.h> | 148 | #include <sys/mount.h> |
@@ -149,28 +153,27 @@ if test $ac_fsusage_space = no; then | |||
149 | fsd.f_fsize = 0; | 153 | fsd.f_fsize = 0; |
150 | return statfs (".", &fsd, sizeof (struct statfs)) != 0; | 154 | return statfs (".", &fsd, sizeof (struct statfs)) != 0; |
151 | }]])], | 155 | }]])], |
152 | [fu_cv_sys_stat_statfs3_osf1=yes], | 156 | [fu_cv_sys_stat_statfs3_osf1=yes], |
153 | [fu_cv_sys_stat_statfs3_osf1=no], | 157 | [fu_cv_sys_stat_statfs3_osf1=no], |
154 | [fu_cv_sys_stat_statfs3_osf1=no])]) | 158 | [fu_cv_sys_stat_statfs3_osf1=no]) |
155 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs3_osf1]) | 159 | ]) |
156 | if test $fu_cv_sys_stat_statfs3_osf1 = yes; then | 160 | if test $fu_cv_sys_stat_statfs3_osf1 = yes; then |
157 | ac_fsusage_space=yes | 161 | ac_fsusage_space=yes |
158 | AC_DEFINE([STAT_STATFS3_OSF1], [1], | 162 | AC_DEFINE([STAT_STATFS3_OSF1], [1], |
159 | [ Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) | 163 | [Define if statfs takes 3 args. (DEC Alpha running OSF/1)]) |
164 | fi | ||
160 | fi | 165 | fi |
161 | fi | ||
162 | 166 | ||
163 | if test $ac_fsusage_space = no; then | 167 | if test $ac_fsusage_space = no; then |
164 | # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. | 168 | # glibc/Linux, Mac OS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4. |
165 | # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, | 169 | # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0, |
166 | # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) | 170 | # OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.) |
167 | # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and | 171 | # (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and |
168 | # <sys/vfs.h>.) | 172 | # <sys/vfs.h>.) |
169 | # (On Solaris, statfs has 4 arguments.) | 173 | # (On Solaris, statfs has 4 arguments.) |
170 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_bsize dnl | 174 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_bsize member (AIX, 4.3BSD)], |
171 | member (AIX, 4.3BSD)]) | 175 | [fu_cv_sys_stat_statfs2_bsize], |
172 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_bsize], | 176 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
173 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
174 | #ifdef HAVE_SYS_PARAM_H | 177 | #ifdef HAVE_SYS_PARAM_H |
175 | #include <sys/param.h> | 178 | #include <sys/param.h> |
176 | #endif | 179 | #endif |
@@ -183,88 +186,56 @@ member (AIX, 4.3BSD)]) | |||
183 | int | 186 | int |
184 | main () | 187 | main () |
185 | { | 188 | { |
186 | struct statfs fsd; | 189 | struct statfs fsd; |
187 | fsd.f_bsize = 0; | 190 | fsd.f_bsize = 0; |
188 | return statfs (".", &fsd) != 0; | 191 | return statfs (".", &fsd) != 0; |
189 | }]])], | 192 | }]])], |
190 | [fu_cv_sys_stat_statfs2_bsize=yes], | 193 | [fu_cv_sys_stat_statfs2_bsize=yes], |
191 | [fu_cv_sys_stat_statfs2_bsize=no], | 194 | [fu_cv_sys_stat_statfs2_bsize=no], |
192 | [fu_cv_sys_stat_statfs2_bsize=no])]) | 195 | [fu_cv_sys_stat_statfs2_bsize=no]) |
193 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_bsize]) | 196 | ]) |
194 | if test $fu_cv_sys_stat_statfs2_bsize = yes; then | 197 | if test $fu_cv_sys_stat_statfs2_bsize = yes; then |
195 | ac_fsusage_space=yes | 198 | ac_fsusage_space=yes |
196 | AC_DEFINE([STAT_STATFS2_BSIZE], [1], | 199 | AC_DEFINE([STAT_STATFS2_BSIZE], [1], |
197 | [ Define if statfs takes 2 args and struct statfs has a field named f_bsize. | 200 | [Define if statfs takes 2 args and struct statfs has a field named f_bsize. |
198 | (4.3BSD, SunOS 4, HP-UX, AIX PS/2)]) | 201 | (4.3BSD, SunOS 4, HP-UX)]) |
202 | fi | ||
199 | fi | 203 | fi |
200 | fi | ||
201 | 204 | ||
202 | if test $ac_fsusage_space = no; then | 205 | if test $ac_fsusage_space = no; then |
203 | # SVR3 | 206 | # SVR3 |
204 | # (Solaris already handled above.) | 207 | # (Solaris already handled above.) |
205 | AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) | 208 | AC_CACHE_CHECK([for four-argument statfs (SVR3)], |
206 | AC_CACHE_VAL([fu_cv_sys_stat_statfs4], | 209 | [fu_cv_sys_stat_statfs4], |
207 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 210 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
208 | #include <sys/types.h> | 211 | #include <sys/types.h> |
209 | #include <sys/statfs.h> | 212 | #include <sys/statfs.h> |
210 | int | 213 | int |
211 | main () | 214 | main () |
212 | { | 215 | { |
213 | struct statfs fsd; | 216 | struct statfs fsd; |
214 | return statfs (".", &fsd, sizeof fsd, 0) != 0; | 217 | return statfs (".", &fsd, sizeof fsd, 0) != 0; |
215 | }]])], | ||
216 | [fu_cv_sys_stat_statfs4=yes], | ||
217 | [fu_cv_sys_stat_statfs4=no], | ||
218 | [fu_cv_sys_stat_statfs4=no])]) | ||
219 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs4]) | ||
220 | if test $fu_cv_sys_stat_statfs4 = yes; then | ||
221 | ac_fsusage_space=yes | ||
222 | AC_DEFINE([STAT_STATFS4], [1], | ||
223 | [ Define if statfs takes 4 args. (SVR3, Dynix, old Irix, old AIX, Dolphin)]) | ||
224 | fi | ||
225 | fi | ||
226 | |||
227 | if test $ac_fsusage_space = no; then | ||
228 | # 4.4BSD and older NetBSD | ||
229 | # (OSF/1 already handled above.) | ||
230 | # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) | ||
231 | # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in | ||
232 | # <sys/mount.h>.) | ||
233 | AC_MSG_CHECKING([for two-argument statfs with statfs.f_fsize dnl | ||
234 | member (4.4BSD and NetBSD)]) | ||
235 | AC_CACHE_VAL([fu_cv_sys_stat_statfs2_fsize], | ||
236 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
237 | #include <sys/types.h> | ||
238 | #ifdef HAVE_SYS_PARAM_H | ||
239 | #include <sys/param.h> | ||
240 | #endif | ||
241 | #ifdef HAVE_SYS_MOUNT_H | ||
242 | #include <sys/mount.h> | ||
243 | #endif | ||
244 | int | ||
245 | main () | ||
246 | { | ||
247 | struct statfs fsd; | ||
248 | fsd.f_fsize = 0; | ||
249 | return statfs (".", &fsd) != 0; | ||
250 | }]])], | 218 | }]])], |
251 | [fu_cv_sys_stat_statfs2_fsize=yes], | 219 | [fu_cv_sys_stat_statfs4=yes], |
252 | [fu_cv_sys_stat_statfs2_fsize=no], | 220 | [fu_cv_sys_stat_statfs4=no], |
253 | [fu_cv_sys_stat_statfs2_fsize=no])]) | 221 | [fu_cv_sys_stat_statfs4=no]) |
254 | AC_MSG_RESULT([$fu_cv_sys_stat_statfs2_fsize]) | 222 | ]) |
255 | if test $fu_cv_sys_stat_statfs2_fsize = yes; then | 223 | if test $fu_cv_sys_stat_statfs4 = yes; then |
256 | ac_fsusage_space=yes | 224 | ac_fsusage_space=yes |
257 | AC_DEFINE([STAT_STATFS2_FSIZE], [1], | 225 | AC_DEFINE([STAT_STATFS4], [1], |
258 | [ Define if statfs takes 2 args and struct statfs has a field named f_fsize. | 226 | [Define if statfs takes 4 args. (SVR3, old Irix)]) |
259 | (4.4BSD, NetBSD)]) | 227 | fi |
260 | fi | 228 | fi |
261 | fi | ||
262 | 229 | ||
263 | if test $ac_fsusage_space = no; then | 230 | if test $ac_fsusage_space = no; then |
264 | # Ultrix | 231 | # 4.4BSD and older NetBSD |
265 | AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) | 232 | # (OSF/1 already handled above.) |
266 | AC_CACHE_VAL([fu_cv_sys_stat_fs_data], | 233 | # (On AIX, you need to include <sys/statfs.h>, not only <sys/mount.h>.) |
267 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | 234 | # (On Solaris, statfs has 4 arguments and 'struct statfs' is not declared in |
235 | # <sys/mount.h>.) | ||
236 | AC_CACHE_CHECK([for two-argument statfs with statfs.f_fsize member (4.4BSD and NetBSD)], | ||
237 | [fu_cv_sys_stat_statfs2_fsize], | ||
238 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
268 | #include <sys/types.h> | 239 | #include <sys/types.h> |
269 | #ifdef HAVE_SYS_PARAM_H | 240 | #ifdef HAVE_SYS_PARAM_H |
270 | #include <sys/param.h> | 241 | #include <sys/param.h> |
@@ -272,41 +243,26 @@ if test $ac_fsusage_space = no; then | |||
272 | #ifdef HAVE_SYS_MOUNT_H | 243 | #ifdef HAVE_SYS_MOUNT_H |
273 | #include <sys/mount.h> | 244 | #include <sys/mount.h> |
274 | #endif | 245 | #endif |
275 | #ifdef HAVE_SYS_FS_TYPES_H | ||
276 | #include <sys/fs_types.h> | ||
277 | #endif | ||
278 | int | 246 | int |
279 | main () | 247 | main () |
280 | { | 248 | { |
281 | struct fs_data fsd; | 249 | struct statfs fsd; |
282 | /* Ultrix's statfs returns 1 for success, | 250 | fsd.f_fsize = 0; |
283 | 0 for not mounted, -1 for failure. */ | 251 | return statfs (".", &fsd) != 0; |
284 | return statfs (".", &fsd) != 1; | ||
285 | }]])], | 252 | }]])], |
286 | [fu_cv_sys_stat_fs_data=yes], | 253 | [fu_cv_sys_stat_statfs2_fsize=yes], |
287 | [fu_cv_sys_stat_fs_data=no], | 254 | [fu_cv_sys_stat_statfs2_fsize=no], |
288 | [fu_cv_sys_stat_fs_data=no])]) | 255 | [fu_cv_sys_stat_statfs2_fsize=no]) |
289 | AC_MSG_RESULT([$fu_cv_sys_stat_fs_data]) | 256 | ]) |
290 | if test $fu_cv_sys_stat_fs_data = yes; then | 257 | if test $fu_cv_sys_stat_statfs2_fsize = yes; then |
291 | ac_fsusage_space=yes | 258 | ac_fsusage_space=yes |
292 | AC_DEFINE([STAT_STATFS2_FS_DATA], [1], | 259 | AC_DEFINE([STAT_STATFS2_FSIZE], [1], |
293 | [ Define if statfs takes 2 args and the second argument has | 260 | [Define if statfs takes 2 args and struct statfs has a field named f_fsize. |
294 | type struct fs_data. (Ultrix)]) | 261 | (4.4BSD, NetBSD)]) |
262 | fi | ||
295 | fi | 263 | fi |
296 | fi | ||
297 | 264 | ||
298 | if test $ac_fsusage_space = no; then | 265 | AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) |
299 | # SVR2 | ||
300 | # (AIX, HP-UX, OSF/1 already handled above.) | ||
301 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <sys/filsys.h> | ||
302 | ]])], | ||
303 | [AC_DEFINE([STAT_READ_FILSYS], [1], | ||
304 | [Define if there is no specific function for reading file systems usage | ||
305 | information and you have the <sys/filsys.h> header file. (SVR2)]) | ||
306 | ac_fsusage_space=yes]) | ||
307 | fi | ||
308 | |||
309 | AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) | ||
310 | 266 | ||
311 | ]) | 267 | ]) |
312 | 268 | ||
@@ -316,18 +272,22 @@ AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) | |||
316 | # enable the work-around code in fsusage.c. | 272 | # enable the work-around code in fsusage.c. |
317 | AC_DEFUN([gl_STATFS_TRUNCATES], | 273 | AC_DEFUN([gl_STATFS_TRUNCATES], |
318 | [ | 274 | [ |
319 | AC_MSG_CHECKING([for statfs that truncates block counts]) | 275 | AC_CACHE_CHECK([for statfs that truncates block counts], |
320 | AC_CACHE_VAL([fu_cv_sys_truncating_statfs], | 276 | [fu_cv_sys_truncating_statfs], |
321 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 277 | [AC_COMPILE_IFELSE( |
278 | [AC_LANG_PROGRAM([[ | ||
322 | #if !defined(sun) && !defined(__sun) | 279 | #if !defined(sun) && !defined(__sun) |
323 | choke -- this is a workaround for a Sun-specific problem | 280 | choke -- this is a workaround for a Sun-specific problem |
324 | #endif | 281 | #endif |
325 | #include <sys/types.h> | 282 | #include <sys/types.h> |
326 | #include <sys/vfs.h>]], | 283 | #include <sys/vfs.h> |
327 | [[struct statfs t; long c = *(t.f_spare); | 284 | ]], |
328 | if (c) return 0;]])], | 285 | [[struct statfs t; long c = *(t.f_spare); |
329 | [fu_cv_sys_truncating_statfs=yes], | 286 | if (c) return 0; |
330 | [fu_cv_sys_truncating_statfs=no])]) | 287 | ]])], |
288 | [fu_cv_sys_truncating_statfs=yes], | ||
289 | [fu_cv_sys_truncating_statfs=no]) | ||
290 | ]) | ||
331 | if test $fu_cv_sys_truncating_statfs = yes; then | 291 | if test $fu_cv_sys_truncating_statfs = yes; then |
332 | AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], | 292 | AC_DEFINE([STATFS_TRUNCATES_BLOCK_COUNTS], [1], |
333 | [Define if the block counts reported by statfs may be truncated to 2GB | 293 | [Define if the block counts reported by statfs may be truncated to 2GB |
@@ -335,13 +295,12 @@ choke -- this is a workaround for a Sun-specific problem | |||
335 | (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. | 295 | (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. |
336 | SunOS 4.1.1 seems not to be affected.)]) | 296 | SunOS 4.1.1 seems not to be affected.)]) |
337 | fi | 297 | fi |
338 | AC_MSG_RESULT([$fu_cv_sys_truncating_statfs]) | ||
339 | ]) | 298 | ]) |
340 | 299 | ||
341 | 300 | ||
342 | # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. | 301 | # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. |
343 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], | 302 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], |
344 | [ | 303 | [ |
345 | AC_CHECK_HEADERS([dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h]) | 304 | AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h]) |
346 | gl_STATFS_TRUNCATES | 305 | gl_STATFS_TRUNCATES |
347 | ]) | 306 | ]) |