summaryrefslogtreecommitdiffstats
path: root/lib/fsusage.m4
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fsusage.m4')
-rw-r--r--lib/fsusage.m453
1 files changed, 50 insertions, 3 deletions
diff --git a/lib/fsusage.m4 b/lib/fsusage.m4
index 85d0fc8..a0ab1e1 100644
--- a/lib/fsusage.m4
+++ b/lib/fsusage.m4
@@ -1,7 +1,18 @@
1#serial 9 1#serial 11
2 2
3# From fileutils/configure.in 3# From fileutils/configure.in
4 4
5AC_DEFUN([gl_FSUSAGE],
6[
7 AC_CHECK_HEADERS_ONCE(sys/param.h)
8 AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h)
9 jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
10 if test $gl_cv_fs_space = yes; then
11 AC_LIBOBJ(fsusage)
12 gl_PREREQ_FSUSAGE_EXTRA
13 fi
14])
15
5# Try to determine how a program can obtain filesystem usage information. 16# Try to determine how a program can obtain filesystem usage information.
6# If successful, define the appropriate symbol (see fsusage.c) and 17# If successful, define the appropriate symbol (see fsusage.c) and
7# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND. 18# execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND.
@@ -193,7 +204,43 @@ if test $ac_fsusage_space = no; then
193 ac_fsusage_space=yes) 204 ac_fsusage_space=yes)
194fi 205fi
195 206
196dnl AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) 207AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
197if test $ac_fsusage_space = yes ; then [$1] ; else [$2] ; fi
198 208
199]) 209])
210
211
212# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
213# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
214# enable the work-around code in fsusage.c.
215AC_DEFUN([jm_STATFS_TRUNCATES],
216[
217 AC_MSG_CHECKING([for statfs that truncates block counts])
218 AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
219 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
220#if !defined(sun) && !defined(__sun)
221choke -- this is a workaround for a Sun-specific problem
222#endif
223#include <sys/types.h>
224#include <sys/vfs.h>]],
225 [[struct statfs t; long c = *(t.f_spare);]])],
226 [fu_cv_sys_truncating_statfs=yes],
227 [fu_cv_sys_truncating_statfs=no])])
228 if test $fu_cv_sys_truncating_statfs = yes; then
229 AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
230 [Define if the block counts reported by statfs may be truncated to 2GB
231 and the correct values may be stored in the f_spare array.
232 (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
233 SunOS 4.1.1 seems not to be affected.)])
234 fi
235 AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
236])
237
238
239# Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE.
240AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
241[
242 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
243 AC_CHECK_HEADERS_ONCE(fcntl.h)
244 AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h)
245 jm_STATFS_TRUNCATES
246])