2
dnl GNOME_FILEUTILS_CHECKS
4
dnl checks that are needed for the diskusage applet.
7
AC_DEFUN([GNOME_FILEUTILS_CHECKS],
9
AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
10
mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
11
sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
13
AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
14
getcwd getmntinfo gettimeofday isascii lchown \
15
listmntent memcpy mkfifo strchr strerror strrchr vprintf)
17
dnl Set some defaults when cross-compiling
19
if test x$cross_compiling = xyes ; then
22
fu_cv_sys_mounted_getmntent1=yes
23
fu_cv_sys_stat_statfs2_bsize=yes
26
fu_cv_sys_stat_statfs4=yes
29
fu_cv_sys_stat_statfs2_bsize=yes
32
fu_cv_sys_stat_statfs3_osf1=yes
37
# Determine how to get the list of mounted filesystems.
40
# If the getmntent function is available but not in the standard library,
41
# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
44
# This test must precede the ones for getmntent because Unicos-9 is
45
# reported to have the getmntent function, but its support is incompatible
46
# with other getmntent implementations.
48
# NOTE: Normally, I wouldn't use a check for system type as I've done for
49
# `CRAY' below since that goes against the whole autoconf philosophy. But
50
# I think there is too great a chance that some non-Cray system has a
51
# function named listmntent to risk the false positive.
53
if test -z "$list_mounted_fs"; then
55
AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
56
AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
57
[fu_cv_sys_mounted_cray_listmntent=no
62
], [test $ac_cv_func_listmntent = yes \
63
&& fu_cv_sys_mounted_cray_listmntent=yes]
67
AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
68
if test $fu_cv_sys_mounted_cray_listmntent = yes; then
70
AC_DEFINE(MOUNTED_LISTMNTENT)
74
if test $ac_cv_func_getmntent = yes; then
76
# This system has the getmntent function.
77
# Determine whether it's the one-argument variant or the two-argument one.
79
if test -z "$list_mounted_fs"; then
80
# 4.3BSD, SunOS, HP-UX, Dynix, Irix
81
AC_MSG_CHECKING([for one-argument getmntent function])
82
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
83
[test $ac_cv_header_mntent_h = yes \
84
&& fu_cv_sys_mounted_getmntent1=yes \
85
|| fu_cv_sys_mounted_getmntent1=no])
86
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
87
if test $fu_cv_sys_mounted_getmntent1 = yes; then
89
AC_DEFINE(MOUNTED_GETMNTENT1)
93
if test -z "$list_mounted_fs"; then
95
AC_MSG_CHECKING([for two-argument getmntent function])
96
AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
97
[AC_EGREP_HEADER(getmntent, sys/mnttab.h,
98
fu_cv_sys_mounted_getmntent2=yes,
99
fu_cv_sys_mounted_getmntent2=no)])
100
AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
101
if test $fu_cv_sys_mounted_getmntent2 = yes; then
102
list_mounted_fs=found
103
AC_DEFINE(MOUNTED_GETMNTENT2)
107
if test -z "$list_mounted_fs"; then
108
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
113
if test -z "$list_mounted_fs"; then
114
# DEC Alpha running OSF/1.
115
AC_MSG_CHECKING([for getfsstat function])
116
AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
118
#include <sys/types.h>
119
#include <sys/mount.h>
120
#include <sys/fs_types.h>],
121
[struct statfs *stats;
122
int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
123
fu_cv_sys_mounted_getsstat=yes,
124
fu_cv_sys_mounted_getsstat=no)])
125
AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
126
if test $fu_cv_sys_mounted_getsstat = yes; then
127
list_mounted_fs=found
128
AC_DEFINE(MOUNTED_GETFSSTAT)
132
if test -z "$list_mounted_fs"; then
134
AC_MSG_CHECKING([for mntctl function and struct vmount])
135
AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
136
[AC_TRY_CPP([#include <fshelp.h>],
137
fu_cv_sys_mounted_vmount=yes,
138
fu_cv_sys_mounted_vmount=no)])
139
AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
140
if test $fu_cv_sys_mounted_vmount = yes; then
141
list_mounted_fs=found
142
AC_DEFINE(MOUNTED_VMOUNT)
146
if test -z "$list_mounted_fs"; then
148
AC_MSG_CHECKING([for FIXME existence of three headers])
149
AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
151
#include <sys/statfs.h>
152
#include <sys/fstyp.h>
153
#include <mnttab.h>],
154
fu_cv_sys_mounted_fread_fstyp=yes,
155
fu_cv_sys_mounted_fread_fstyp=no)])
156
AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
157
if test $fu_cv_sys_mounted_fread_fstyp = yes; then
158
list_mounted_fs=found
159
AC_DEFINE(MOUNTED_FREAD_FSTYP)
163
if test -z "$list_mounted_fs"; then
164
# 4.4BSD and DEC OSF/1.
165
AC_MSG_CHECKING([for getmntinfo function])
166
AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
169
if test $ac_cv_func_getmntinfo = yes; then
170
AC_EGREP_HEADER(f_type;, sys/mount.h,
174
&& fu_cv_sys_mounted_getmntinfo=yes \
175
|| fu_cv_sys_mounted_getmntinfo=no
177
AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
178
if test $fu_cv_sys_mounted_getmntinfo = yes; then
179
list_mounted_fs=found
180
AC_DEFINE(MOUNTED_GETMNTINFO)
184
# FIXME: add a test for netbsd-1.1 here
186
if test -z "$list_mounted_fs"; then
188
AC_MSG_CHECKING([for getmnt function])
189
AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
191
#include <sys/fs_types.h>
192
#include <sys/mount.h>],
193
fu_cv_sys_mounted_getmnt=yes,
194
fu_cv_sys_mounted_getmnt=no)])
195
AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
196
if test $fu_cv_sys_mounted_getmnt = yes; then
197
list_mounted_fs=found
198
AC_DEFINE(MOUNTED_GETMNT)
202
if test -z "$list_mounted_fs"; then
204
AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
205
AC_CACHE_VAL(fu_cv_sys_mounted_fread,
206
[AC_TRY_CPP([#include <mnttab.h>],
207
fu_cv_sys_mounted_fread=yes,
208
fu_cv_sys_mounted_fread=no)])
209
AC_MSG_RESULT($fu_cv_sys_mounted_fread)
210
if test $fu_cv_sys_mounted_fread = yes; then
211
list_mounted_fs=found
212
AC_DEFINE(MOUNTED_FREAD)
216
if test -z "$list_mounted_fs"; then
217
AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
218
# FIXME -- no need to abort building the whole package
219
# Can't build mountlist.c or anything that needs its functions
222
AC_CHECKING(how to get filesystem space usage)
225
# Perform only the link test since it seems there are no variants of the
226
# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
227
# because that got a false positive on SCO OSR5. Adding the declaration
228
# of a `struct statvfs' causes this test to fail (as it should) on such
229
# systems. That system is reported to work fine with STAT_STATFS4 which
230
# is what it gets when this test fails.
231
if test $space = no; then
233
AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
234
[AC_TRY_LINK([#include <sys/types.h>
235
#include <sys/statvfs.h>],
236
[struct statvfs fsd; statvfs (0, &fsd);],
237
fu_cv_sys_stat_statvfs=yes,
238
fu_cv_sys_stat_statvfs=no)])
239
if test $fu_cv_sys_stat_statvfs = yes; then
241
AC_DEFINE(STAT_STATVFS)
245
if test $space = no; then
246
# DEC Alpha running OSF/1
247
AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
248
AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
250
#include <sys/param.h>
251
#include <sys/types.h>
252
#include <sys/mount.h>
257
exit (statfs (".", &fsd, sizeof (struct statfs)));
259
fu_cv_sys_stat_statfs3_osf1=yes,
260
fu_cv_sys_stat_statfs3_osf1=no,
261
fu_cv_sys_stat_statfs3_osf1=no)])
262
AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
263
if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
265
AC_DEFINE(STAT_STATFS3_OSF1)
269
if test $space = no; then
271
AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
272
member (AIX, 4.3BSD)])
273
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
275
#ifdef HAVE_SYS_PARAM_H
276
#include <sys/param.h>
278
#ifdef HAVE_SYS_MOUNT_H
279
#include <sys/mount.h>
281
#ifdef HAVE_SYS_VFS_H
288
exit (statfs (".", &fsd));
290
fu_cv_sys_stat_statfs2_bsize=yes,
291
fu_cv_sys_stat_statfs2_bsize=no,
292
fu_cv_sys_stat_statfs2_bsize=no)])
293
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
294
if test $fu_cv_sys_stat_statfs2_bsize = yes; then
296
AC_DEFINE(STAT_STATFS2_BSIZE)
300
if test $space = no; then
302
AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
303
AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
304
[AC_TRY_RUN([#include <sys/types.h>
305
#include <sys/statfs.h>
309
exit (statfs (".", &fsd, sizeof fsd, 0));
311
fu_cv_sys_stat_statfs4=yes,
312
fu_cv_sys_stat_statfs4=no,
313
fu_cv_sys_stat_statfs4=no)])
314
AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
315
if test $fu_cv_sys_stat_statfs4 = yes; then
317
AC_DEFINE(STAT_STATFS4)
321
if test $space = no; then
323
AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
324
member (4.4BSD and NetBSD)])
325
AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
326
[AC_TRY_RUN([#include <sys/types.h>
327
#ifdef HAVE_SYS_PARAM_H
328
#include <sys/param.h>
330
#ifdef HAVE_SYS_MOUNT_H
331
#include <sys/mount.h>
337
exit (statfs (".", &fsd));
339
fu_cv_sys_stat_statfs2_fsize=yes,
340
fu_cv_sys_stat_statfs2_fsize=no,
341
fu_cv_sys_stat_statfs2_fsize=no)])
342
AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
343
if test $fu_cv_sys_stat_statfs2_fsize = yes; then
345
AC_DEFINE(STAT_STATFS2_FSIZE)
349
if test $space = no; then
351
AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
352
AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
353
[AC_TRY_RUN([#include <sys/types.h>
354
#ifdef HAVE_SYS_PARAM_H
355
#include <sys/param.h>
357
#ifdef HAVE_SYS_MOUNT_H
358
#include <sys/mount.h>
360
#ifdef HAVE_SYS_FS_TYPES_H
361
#include <sys/fs_types.h>
366
/* Ultrix's statfs returns 1 for success,
367
0 for not mounted, -1 for failure. */
368
exit (statfs (".", &fsd) != 1);
370
fu_cv_sys_stat_fs_data=yes,
371
fu_cv_sys_stat_fs_data=no,
372
fu_cv_sys_stat_fs_data=no)])
373
AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
374
if test $fu_cv_sys_stat_fs_data = yes; then
376
AC_DEFINE(STAT_STATFS2_FS_DATA)
380
if test $space = no; then
382
AC_TRY_CPP([#include <sys/filsys.h>],
383
AC_DEFINE(STAT_READ_FILSYS) space=yes)
386
if test -n "$list_mounted_fs" && test $space != no; then
388
# LIBOBJS="$LIBOBJS fsusage.o"
389
# LIBOBJS="$LIBOBJS mountlist.o"
392
# Check for SunOS statfs brokenness wrt partitions 2GB and larger.
393
# If <sys/vfs.h> exists and struct statfs has a member named f_spare,
394
# enable the work-around code in fsusage.c.
395
AC_MSG_CHECKING([for statfs that truncates block counts])
396
AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
398
#if !defined(sun) && !defined(__sun)
399
choke -- this is a workaround for a Sun-specific problem
401
#include <sys/types.h>
402
#include <sys/vfs.h>],
403
[struct statfs t; long c = *(t.f_spare);],
404
fu_cv_sys_truncating_statfs=yes,
405
fu_cv_sys_truncating_statfs=no,
407
if test $fu_cv_sys_truncating_statfs = yes; then
408
AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
410
AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
413
test -d /afs && AC_DEFINE(AFS)