keymap files: unification of Fxx keys: move to lower case.
[midnight-commander.git] / m4.include / ac-get-fs-info.m4
blobb1a65132d5e5e43dbb115e7828026f716f3c5554
1 #serial 6
3 # How to list mounted file systems.
5 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
6 # Foundation, Inc.
8 # This file is free software; the Free Software Foundation
9 # gives unlimited permission to copy and/or distribute it,
10 # with or without modifications, as long as this notice is preserved.
12 dnl From Jim Meyering.
13 dnl
14 dnl This is not pretty.  I've just taken the autoconf code and wrapped
15 dnl it in an AC_DEFUN and made some other fixes.
16 dnl
18 # Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf
19 # through Autoconf 2.59.  We can remove this once we assume Autoconf 2.60
20 # or later.
21 AC_DEFUN([AC_FUNC_GETMNTENT],
22 [# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4,
23 # -lseq on Dynix/PTX, -lgen on Unixware.
24 AC_SEARCH_LIBS(getmntent, [sun seq gen])
25 AC_CHECK_FUNCS(getmntent)
28 # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
29 AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS],
30   [
31 AC_CHECK_FUNCS(listmntent getmntinfo)
32 AC_CHECK_HEADERS_ONCE(sys/param.h sys/statvfs.h)
34 # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses
35 # NGROUPS (as the array dimension for a struct member) without a definition.
36 AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>])
38 AC_CHECK_HEADERS(sys/mount.h, [], [],
39   [AC_INCLUDES_DEFAULT
40    [#if HAVE_SYS_PARAM_H
41      #include <sys/param.h>
42     #endif]])
44 AC_CHECK_HEADERS(mntent.h sys/fs_types.h)
45     getfsstat_includes="\
46 $ac_includes_default
47 #if HAVE_SYS_PARAM_H
48 # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */
49 #endif
50 #if HAVE_SYS_UCRED_H
51 # include <grp.h> /* needed for definition of NGROUPS */
52 # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
53 #endif
54 #if HAVE_SYS_MOUNT_H
55 # include <sys/mount.h>
56 #endif
57 #if HAVE_SYS_FS_TYPES_H
58 # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */
59 #endif
61 AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes])
63 # Determine how to get the list of mounted file systems.
64 ac_list_mounted_fs=
66 # If the getmntent function is available but not in the standard library,
67 # make sure LIBS contains the appropriate -l option.
68 AC_FUNC_GETMNTENT
70 # This test must precede the ones for getmntent because Unicos-9 is
71 # reported to have the getmntent function, but its support is incompatible
72 # with other getmntent implementations.
74 # NOTE: Normally, I wouldn't use a check for system type as I've done for
75 # `CRAY' below since that goes against the whole autoconf philosophy.  But
76 # I think there is too great a chance that some non-Cray system has a
77 # function named listmntent to risk the false positive.
79 if test x"$ac_list_mounted_fs" = x; then
80   # Cray UNICOS 9
81   AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
82   AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
83     [fu_cv_sys_mounted_cray_listmntent=no
84       AC_EGREP_CPP(yes,
85         [#ifdef _CRAY
86 yes
87 #endif
88         ], [test x"$ac_cv_func_listmntent" = xyes \
89             && fu_cv_sys_mounted_cray_listmntent=yes]
90       )
91     ]
92   )
93   AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
94   if test x"$fu_cv_sys_mounted_cray_listmntent" = xyes; then
95     ac_list_mounted_fs=found
96     AC_DEFINE(MOUNTED_LISTMNTENT, 1,
97       [Define if there is a function named listmntent that can be used to
98        list all mounted file systems.  (UNICOS)])
99   fi
102 if test x"$ac_list_mounted_fs" = x; then
103   # AIX.
104   AC_MSG_CHECKING([for mntctl function and struct vmount])
105   AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
106   [AC_TRY_CPP([#include <fshelp.h>],
107     fu_cv_sys_mounted_vmount=yes,
108     fu_cv_sys_mounted_vmount=no)])
109   AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
110   if test x"$fu_cv_sys_mounted_vmount" = xyes; then
111     ac_list_mounted_fs=found
112     AC_DEFINE(MOUNTED_VMOUNT, 1,
113         [Define if there is a function named mntctl that can be used to read
114          the list of mounted file systems, and there is a system header file
115          that declares `struct vmount.'  (AIX)])
116   fi
119 if test x"$ac_cv_func_getmntent" = xyes; then
121   # This system has the getmntent function.
122   # Determine whether it's the one-argument variant or the two-argument one.
124   if test x"$ac_list_mounted_fs" = x; then
125     # 4.3BSD, SunOS, HP-UX, Dynix, Irix
126     AC_MSG_CHECKING([for one-argument getmntent function])
127     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
128                  [AC_TRY_COMPILE([
129 /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */
130 #include <stdio.h>
132 #include <mntent.h>
133 #if !defined MOUNTED
134 # if defined _PATH_MOUNTED      /* GNU libc  */
135 #  define MOUNTED _PATH_MOUNTED
136 # endif
137 # if defined MNT_MNTTAB /* HP-UX.  */
138 #  define MOUNTED MNT_MNTTAB
139 # endif
140 # if defined MNTTABNAME /* Dynix.  */
141 #  define MOUNTED MNTTABNAME
142 # endif
143 #endif
145                     [ struct mntent *mnt = 0; const char *table = MOUNTED;
146                       if (sizeof mnt && sizeof table) return 0;],
147                     fu_cv_sys_mounted_getmntent1=yes,
148                     fu_cv_sys_mounted_getmntent1=no)])
149     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
150     if test x"$fu_cv_sys_mounted_getmntent1" = xyes; then
151       ac_list_mounted_fs=found
152       AC_DEFINE(MOUNTED_GETMNTENT1, 1,
153         [Define if there is a function named getmntent for reading the list
154          of mounted file systems, and that function takes a single argument.
155          (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
156     fi
157   fi
159   if test x"$ac_list_mounted_fs" = x; then
160     # SVR4
161     AC_MSG_CHECKING([for two-argument getmntent function])
162     AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
163     [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
164       fu_cv_sys_mounted_getmntent2=yes,
165       fu_cv_sys_mounted_getmntent2=no)])
166     AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
167     if test x"$fu_cv_sys_mounted_getmntent2" = xyes; then
168       ac_list_mounted_fs=found
169       AC_DEFINE(MOUNTED_GETMNTENT2, 1,
170         [Define if there is a function named getmntent for reading the list of
171          mounted file systems, and that function takes two arguments.  (SVR4)])
172       AC_CHECK_FUNCS(hasmntopt)
173     fi
174   fi
178 if test x"$ac_list_mounted_fs" = x; then
179   # DEC Alpha running OSF/1, and Apple Darwin 1.3.
180   # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h
182   AC_MSG_CHECKING([for getfsstat function])
183   AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat,
184   [AC_TRY_LINK([
185 #include <sys/types.h>
186 #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME
187 # define FS_TYPE(Ent) ((Ent).f_fstypename)
188 #else
189 # define FS_TYPE(Ent) mnt_names[(Ent).f_type]
190 #endif
191 ]$getfsstat_includes
193   [struct statfs *stats;
194    int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT);
195    char *t = FS_TYPE (*stats); ],
196     fu_cv_sys_mounted_getfsstat=yes,
197     fu_cv_sys_mounted_getfsstat=no)])
198   AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat)
199   if test x"$fu_cv_sys_mounted_getfsstat" = xyes; then
200     ac_list_mounted_fs=found
201     AC_DEFINE(MOUNTED_GETFSSTAT, 1,
202               [Define if there is a function named getfsstat for reading the
203                list of mounted file systems.  (DEC Alpha running OSF/1)])
204   fi
207 if test x"$ac_list_mounted_fs" = x; then
208   # SVR3
209   AC_MSG_CHECKING([for FIXME existence of three headers])
210   AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
211     [AC_TRY_CPP([
212 #include <sys/statfs.h>
213 #include <sys/fstyp.h>
214 #include <mnttab.h>],
215                 fu_cv_sys_mounted_fread_fstyp=yes,
216                 fu_cv_sys_mounted_fread_fstyp=no)])
217   AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
218   if test x"$fu_cv_sys_mounted_fread_fstyp" = xyes; then
219     ac_list_mounted_fs=found
220     AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
221       [Define if (like SVR2) there is no specific function for reading the
222        list of mounted file systems, and your system has these header files:
223        <sys/fstyp.h> and <sys/statfs.h>.  (SVR3)])
224   fi
227 if test x"$ac_list_mounted_fs" = x; then
228   # 4.4BSD and DEC OSF/1.
229   AC_MSG_CHECKING([for getmntinfo function])
230   AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
231     [
232       test x"$ac_cv_func_getmntinfo" = xyes \
233           && fu_cv_sys_mounted_getmntinfo=yes \
234           || fu_cv_sys_mounted_getmntinfo=no
235     ])
236   AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
237   if test x"$fu_cv_sys_mounted_getmntinfo" = xyes; then
238     AC_MSG_CHECKING([whether getmntinfo returns statvfs structures])
239     AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo2,
240       [
241         AC_TRY_COMPILE([
242 #if HAVE_SYS_PARAM_H
243 # include <sys/param.h>
244 #endif
245 #include <sys/types.h>
246 #if HAVE_SYS_MOUNT_H
247 # include <sys/mount.h>
248 #endif
249 #if HAVE_SYS_STATVFS_H
250 # include <sys/statvfs.h>
251 #endif
252 extern int getmntinfo (struct statfs **, int);
253           ], [],
254           [fu_cv_sys_mounted_getmntinfo2=no],
255           [fu_cv_sys_mounted_getmntinfo2=yes])
256       ])
257     AC_MSG_RESULT([$fu_cv_sys_mounted_getmntinfo2])
258     if test x"$fu_cv_sys_mounted_getmntinfo2" = xno; then
259       ac_list_mounted_fs=found
260       AC_DEFINE(MOUNTED_GETMNTINFO, 1,
261                 [Define if there is a function named getmntinfo for reading the
262                  list of mounted file systems and it returns an array of
263                  'struct statfs'.  (4.4BSD, Darwin)])
264     else
265       ac_list_mounted_fs=found
266       AC_DEFINE(MOUNTED_GETMNTINFO2, 1,
267                 [Define if there is a function named getmntinfo for reading the
268                  list of mounted file systems and it returns an array of
269                  'struct statvfs'.  (NetBSD 3.0)])
270     fi
271   fi
274 if test x"$ac_list_mounted_fs" = x; then
275   # Ultrix
276   AC_MSG_CHECKING([for getmnt function])
277   AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
278     [AC_TRY_CPP([
279 #include <sys/fs_types.h>
280 #include <sys/mount.h>],
281                 fu_cv_sys_mounted_getmnt=yes,
282                 fu_cv_sys_mounted_getmnt=no)])
283   AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
284   if test x"$fu_cv_sys_mounted_getmnt" = xyes; then
285     ac_list_mounted_fs=found
286     AC_DEFINE(MOUNTED_GETMNT, 1,
287       [Define if there is a function named getmnt for reading the list of
288        mounted file systems.  (Ultrix)])
289   fi
292 if test x"$ac_list_mounted_fs" = x; then
293   # BeOS
294   AC_CHECK_FUNCS(next_dev fs_stat_dev)
295   AC_CHECK_HEADERS(fs_info.h)
296   AC_MSG_CHECKING([for BEOS mounted file system support functions])
297   if test x"$ac_cv_header_fs_info_h" = xyes \
298       && test x"$ac_cv_func_next_dev" = xyes \
299         && test x"$ac_cv_func_fs_stat_dev" = xyes; then
300     fu_result=yes
301   else
302     fu_result=no
303   fi
304   AC_MSG_RESULT($fu_result)
305   if test x"$fu_result" = xyes; then
306     ac_list_mounted_fs=found
307     AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
308       [Define if there are functions named next_dev and fs_stat_dev for
309        reading the list of mounted file systems.  (BeOS)])
310   fi
313 if test x"$ac_list_mounted_fs" = x; then
314   # SVR2
315   AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
316   AC_CACHE_VAL(fu_cv_sys_mounted_fread,
317     [AC_TRY_CPP([#include <mnttab.h>],
318                 fu_cv_sys_mounted_fread=yes,
319                 fu_cv_sys_mounted_fread=no)])
320   AC_MSG_RESULT($fu_cv_sys_mounted_fread)
321   if test x"$fu_cv_sys_mounted_fread" = xyes; then
322     ac_list_mounted_fs=found
323     AC_DEFINE(MOUNTED_FREAD, 1,
324               [Define if there is no specific function for reading the list of
325                mounted file systems.  fread will be used to read /etc/mnttab.
326                (SVR2) ])
327   fi
330 if test x"$ac_list_mounted_fs" = x; then
331   AC_MSG_ERROR([could not determine how to read list of mounted file systems])
332   # FIXME -- no need to abort building the whole package
333   # Can't build mountlist.c or anything that needs its functions
336 AS_IF([test x"$ac_list_mounted_fs" = xfound], [$1], [$2])
338   ])
340 # Obtaining file system usage information.
342 # Copyright (C) 1997, 1998, 2000, 2001, 2003-2007 Free Software Foundation, Inc.
344 # This file is free software; the Free Software Foundation
345 # gives unlimited permission to copy and/or distribute it,
346 # with or without modifications, as long as this notice is preserved.
348 # Written by Jim Meyering.
350 AC_DEFUN([gl_FSUSAGE],
352   AC_LIBSOURCES([fsusage.c, fsusage.h])
354   AC_CHECK_HEADERS_ONCE(sys/param.h)
355   AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h)
356   AC_CHECK_HEADERS(sys/mount.h, [], [],
357     [AC_INCLUDES_DEFAULT
358      [#if HAVE_SYS_PARAM_H
359        #include <sys/param.h>
360       #endif]])
361   gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no])
362   if test x"$gl_cv_fs_space" = xyes; then
363     AC_LIBOBJ(fsusage)
364     gl_PREREQ_FSUSAGE_EXTRA
365   fi
368 # Try to determine how a program can obtain file system usage information.
369 # If successful, define the appropriate symbol (see fsusage.c) and
370 # execute ACTION-IF-FOUND.  Otherwise, execute ACTION-IF-NOT-FOUND.
372 # gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
374 AC_DEFUN([gl_FILE_SYSTEM_USAGE],
377 AC_MSG_NOTICE([checking how to get file system space usage])
378 ac_fsusage_space=no
380 # Perform only the link test since it seems there are no variants of the
381 # statvfs function.  This check is more than just AC_CHECK_FUNCS(statvfs)
382 # because that got a false positive on SCO OSR5.  Adding the declaration
383 # of a `struct statvfs' causes this test to fail (as it should) on such
384 # systems.  That system is reported to work fine with STAT_STATFS4 which
385 # is what it gets when this test fails.
386 if test x"$ac_fsusage_space" = xno; then
387   # SVR4
388   AC_CACHE_CHECK([for statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
389                  [AC_TRY_LINK([#include <sys/types.h>
390 #if defined __GLIBC__ && !defined __BEOS__
391 Do not use statvfs on systems with GNU libc, because that function stats
392 all preceding entries in /proc/mounts, and that makes df hang if even
393 one of the corresponding file systems is hard-mounted, but not available.
394 statvfs in GNU libc on BeOS operates differently: it only makes a system
395 call.
396 #endif
398 #ifdef __osf__
399 "Do not use Tru64's statvfs implementation"
400 #endif
402 #include <sys/statvfs.h>],
403                               [struct statvfs fsd; statvfs (0, &fsd);],
404                               fu_cv_sys_stat_statvfs=yes,
405                               fu_cv_sys_stat_statvfs=no)])
406   if test x"$fu_cv_sys_stat_statvfs" = xyes; then
407     ac_fsusage_space=yes
408     AC_DEFINE(STAT_STATVFS, 1,
409               [  Define if there is a function named statvfs.  (SVR4)])
410   fi
413 if test x"$ac_fsusage_space" = xno; then
414   # DEC Alpha running OSF/1
415   AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
416   AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
417   [AC_TRY_RUN([
418 #include <sys/param.h>
419 #include <sys/types.h>
420 #include <sys/mount.h>
421   int
422   main ()
423   {
424     struct statfs fsd;
425     fsd.f_fsize = 0;
426     return statfs (".", &fsd, sizeof (struct statfs)) != 0;
427   }],
428   fu_cv_sys_stat_statfs3_osf1=yes,
429   fu_cv_sys_stat_statfs3_osf1=no,
430   fu_cv_sys_stat_statfs3_osf1=no)])
431   AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
432   if test x"$fu_cv_sys_stat_statfs3_osf1" = xyes; then
433     ac_fsusage_space=yes
434     AC_DEFINE(STAT_STATFS3_OSF1, 1,
435               [   Define if  statfs takes 3 args.  (DEC Alpha running OSF/1)])
436   fi
439 if test x"$ac_fsusage_space" = xno; then
440 # AIX
441   AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
442 member (AIX, 4.3BSD)])
443   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
444   [AC_TRY_RUN([
445 #ifdef HAVE_SYS_PARAM_H
446 #include <sys/param.h>
447 #endif
448 #ifdef HAVE_SYS_MOUNT_H
449 #include <sys/mount.h>
450 #endif
451 #ifdef HAVE_SYS_VFS_H
452 #include <sys/vfs.h>
453 #endif
454   int
455   main ()
456   {
457   struct statfs fsd;
458   fsd.f_bsize = 0;
459   return statfs (".", &fsd) != 0;
460   }],
461   fu_cv_sys_stat_statfs2_bsize=yes,
462   fu_cv_sys_stat_statfs2_bsize=no,
463   fu_cv_sys_stat_statfs2_bsize=no)])
464   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
465   if test x"$fu_cv_sys_stat_statfs2_bsize" = xyes; then
466     ac_fsusage_space=yes
467     AC_DEFINE(STAT_STATFS2_BSIZE, 1,
468 [  Define if statfs takes 2 args and struct statfs has a field named f_bsize.
469    (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
470   fi
473 if test x"$ac_fsusage_space" = xno; then
474 # SVR3
475   AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
476   AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
477   [AC_TRY_RUN([#include <sys/types.h>
478 #include <sys/statfs.h>
479   int
480   main ()
481   {
482   struct statfs fsd;
483   return statfs (".", &fsd, sizeof fsd, 0) != 0;
484   }],
485     fu_cv_sys_stat_statfs4=yes,
486     fu_cv_sys_stat_statfs4=no,
487     fu_cv_sys_stat_statfs4=no)])
488   AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
489   if test x"$fu_cv_sys_stat_statfs4" = xyes; then
490     ac_fsusage_space=yes
491     AC_DEFINE(STAT_STATFS4, 1,
492               [  Define if statfs takes 4 args.  (SVR3, Dynix, Irix, Dolphin)])
493   fi
496 if test x"$ac_fsusage_space" = xno; then
497 # 4.4BSD and NetBSD
498   AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
499 member (4.4BSD and NetBSD)])
500   AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
501   [AC_TRY_RUN([#include <sys/types.h>
502 #ifdef HAVE_SYS_PARAM_H
503 #include <sys/param.h>
504 #endif
505 #ifdef HAVE_SYS_MOUNT_H
506 #include <sys/mount.h>
507 #endif
508   int
509   main ()
510   {
511   struct statfs fsd;
512   fsd.f_fsize = 0;
513   return statfs (".", &fsd) != 0;
514   }],
515   fu_cv_sys_stat_statfs2_fsize=yes,
516   fu_cv_sys_stat_statfs2_fsize=no,
517   fu_cv_sys_stat_statfs2_fsize=no)])
518   AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
519   if test x"$fu_cv_sys_stat_statfs2_fsize" = xyes; then
520     ac_fsusage_space=yes
521     AC_DEFINE(STAT_STATFS2_FSIZE, 1,
522 [  Define if statfs takes 2 args and struct statfs has a field named f_fsize.
523    (4.4BSD, NetBSD)])
524   fi
527 if test x"$ac_fsusage_space" = xno; then
528   # Ultrix
529   AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
530   AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
531   [AC_TRY_RUN([#include <sys/types.h>
532 #ifdef HAVE_SYS_PARAM_H
533 #include <sys/param.h>
534 #endif
535 #ifdef HAVE_SYS_MOUNT_H
536 #include <sys/mount.h>
537 #endif
538 #ifdef HAVE_SYS_FS_TYPES_H
539 #include <sys/fs_types.h>
540 #endif
541   int
542   main ()
543   {
544   struct fs_data fsd;
545   /* Ultrix's statfs returns 1 for success,
546      0 for not mounted, -1 for failure.  */
547   return statfs (".", &fsd) != 1;
548   }],
549   fu_cv_sys_stat_fs_data=yes,
550   fu_cv_sys_stat_fs_data=no,
551   fu_cv_sys_stat_fs_data=no)])
552   AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
553   if test x"$fu_cv_sys_stat_fs_data" = xyes; then
554     ac_fsusage_space=yes
555     AC_DEFINE(STAT_STATFS2_FS_DATA, 1,
556 [  Define if statfs takes 2 args and the second argument has
557    type struct fs_data.  (Ultrix)])
558   fi
561 if test x"$ac_fsusage_space" = xno; then
562   # SVR2
563   AC_TRY_CPP([#include <sys/filsys.h>
564     ],
565     AC_DEFINE(STAT_READ_FILSYS, 1,
566       [Define if there is no specific function for reading file systems usage
567        information and you have the <sys/filsys.h> header file.  (SVR2)])
568     ac_fsusage_space=yes)
571 AS_IF([test x"$ac_fsusage_space" = xyes], [$1], [$2])
576 # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
577 # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
578 # enable the work-around code in fsusage.c.
579 AC_DEFUN([gl_STATFS_TRUNCATES],
581   AC_MSG_CHECKING([for statfs that truncates block counts])
582   AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
583   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
584 #if !defined(sun) && !defined(__sun)
585 choke -- this is a workaround for a Sun-specific problem
586 #endif
587 #include <sys/types.h>
588 #include <sys/vfs.h>]],
589     [[struct statfs t; long c = *(t.f_spare);
590       if (c) return 0;]])],
591     [fu_cv_sys_truncating_statfs=yes],
592     [fu_cv_sys_truncating_statfs=no])])
593   if test x"$fu_cv_sys_truncating_statfs" = xyes; then
594     AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS, 1,
595       [Define if the block counts reported by statfs may be truncated to 2GB
596        and the correct values may be stored in the f_spare array.
597        (SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem.
598        SunOS 4.1.1 seems not to be affected.)])
599   fi
600   AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
604 # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
605 AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
607   AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])
608   AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h)
609   gl_STATFS_TRUNCATES
612 dnl From Jim Meyering.
614 dnl See if struct statfs has the f_fstypename member.
615 dnl If so, define HAVE_STRUCT_STATFS_F_FSTYPENAME.
618 # Copyright (C) 1998, 1999, 2001, 2004, 2006 Free Software Foundation, Inc.
619 # This file is free software; the Free Software Foundation
620 # gives unlimited permission to copy and/or distribute it,
621 # with or without modifications, as long as this notice is preserved.
623 AC_DEFUN([gl_FSTYPENAME],
625   AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,
626     [
627       #include <sys/types.h>
628       #include <sys/param.h>
629       #include <sys/mount.h>
630     ])
631   AC_CHECK_MEMBERS([struct statvfs.f_fstypename, struct statvfs.f_basetype],,,
632     [
633       AC_INCLUDES_DEFAULT
634       #include <sys/statvfs.h>
635     ])
639 dnl Filesystem information detection
641 dnl To get information about the disk, mount points, etc.
644 AC_DEFUN([AC_GET_FS_INFO], [
645     AC_CHECK_HEADERS([fcntl.h utime.h])
647     gl_LIST_MOUNTED_FILE_SYSTEMS([
648         AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
649             [Define if the list of mounted filesystems can be determined])],
650         [AC_MSG_WARN([could not determine how to read list of mounted fs])])
652     gl_FSUSAGE
653     gl_FSTYPENAME