|
|
1.1 root 1: AC_DEFUN([GNOME_FILEUTILS_CHECKS],
2: [
3: AC_CHECK_HEADERS(fcntl.h sys/param.h sys/statfs.h sys/fstyp.h \
4: mnttab.h mntent.h sys/statvfs.h sys/vfs.h sys/mount.h \
5: sys/filsys.h sys/fs_types.h sys/fs/s5param.h)
6:
7: AC_CHECK_FUNCS(bcopy endgrent endpwent fchdir ftime ftruncate \
8: getcwd getmntinfo gettimeofday isascii lchown \
9: listmntent memcpy mkfifo strchr strerror strrchr)
10:
11: # Determine how to get the list of mounted filesystems.
12: list_mounted_fs=
13:
14: # If the getmntent function is available but not in the standard library,
15: # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
16: AC_FUNC_GETMNTENT
17:
18: # This test must precede the ones for getmntent because Unicos-9 is
19: # reported to have the getmntent function, but its support is incompatible
20: # with other getmntent implementations.
21:
22: # NOTE: Normally, I wouldn't use a check for system type as I've done for
23: # `CRAY' below since that goes against the whole autoconf philosophy. But
24: # I think there is too great a chance that some non-Cray system has a
25: # function named listmntent to risk the false positive.
26:
27: if test -z "$list_mounted_fs"; then
28: # Cray UNICOS 9
29: AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
30: AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
31: [fu_cv_sys_mounted_cray_listmntent=no
32: AC_EGREP_CPP(yes,
33: [#ifdef _CRAY
34: yes
35: #endif
36: ], [test $ac_cv_func_listmntent = yes \
37: && fu_cv_sys_mounted_cray_listmntent=yes]
38: )
39: ]
40: )
41: AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
42: if test $fu_cv_sys_mounted_cray_listmntent = yes; then
43: list_mounted_fs=found
44: AC_DEFINE(MOUNTED_LISTMNTENT)
45: fi
46: fi
47:
48: if test $ac_cv_func_getmntent = yes; then
49:
50: # This system has the getmntent function.
51: # Determine whether it's the one-argument variant or the two-argument one.
52:
53: if test -z "$list_mounted_fs"; then
54: # 4.3BSD, SunOS, HP-UX, Dynix, Irix
55: AC_MSG_CHECKING([for one-argument getmntent function])
56: AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
57: [test $ac_cv_header_mntent_h = yes \
58: && fu_cv_sys_mounted_getmntent1=yes \
59: || fu_cv_sys_mounted_getmntent1=no])
60: AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
61: if test $fu_cv_sys_mounted_getmntent1 = yes; then
62: list_mounted_fs=found
63: AC_DEFINE(MOUNTED_GETMNTENT1)
64: fi
65: fi
66:
67: if test -z "$list_mounted_fs"; then
68: # SVR4
69: AC_MSG_CHECKING([for two-argument getmntent function])
70: AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
71: [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
72: fu_cv_sys_mounted_getmntent2=yes,
73: fu_cv_sys_mounted_getmntent2=no)])
74: AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
75: if test $fu_cv_sys_mounted_getmntent2 = yes; then
76: list_mounted_fs=found
77: AC_DEFINE(MOUNTED_GETMNTENT2)
78: fi
79: fi
80:
81: if test -z "$list_mounted_fs"; then
82: AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
83: fi
84:
85: fi
86:
87: if test -z "$list_mounted_fs"; then
88: # DEC Alpha running OSF/1.
89: AC_MSG_CHECKING([for getfsstat function])
90: AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
91: [AC_TRY_LINK([
92: #include <sys/types.h>
93: #include <sys/mount.h>
94: #include <sys/fs_types.h>],
95: [struct statfs *stats;
96: int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
97: fu_cv_sys_mounted_getsstat=yes,
98: fu_cv_sys_mounted_getsstat=no)])
99: AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
100: if test $fu_cv_sys_mounted_getsstat = yes; then
101: list_mounted_fs=found
102: AC_DEFINE(MOUNTED_GETFSSTAT)
103: fi
104: fi
105:
106: if test -z "$list_mounted_fs"; then
107: # AIX.
108: AC_MSG_CHECKING([for mntctl function and struct vmount])
109: AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
110: [AC_TRY_CPP([#include <fshelp.h>],
111: fu_cv_sys_mounted_vmount=yes,
112: fu_cv_sys_mounted_vmount=no)])
113: AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
114: if test $fu_cv_sys_mounted_vmount = yes; then
115: list_mounted_fs=found
116: AC_DEFINE(MOUNTED_VMOUNT)
117: fi
118: fi
119:
120: if test -z "$list_mounted_fs"; then
121: # SVR3
122: AC_MSG_CHECKING([for FIXME existence of three headers])
123: AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
124: [AC_TRY_CPP([
125: #include <sys/statfs.h>
126: #include <sys/fstyp.h>
127: #include <mnttab.h>],
128: fu_cv_sys_mounted_fread_fstyp=yes,
129: fu_cv_sys_mounted_fread_fstyp=no)])
130: AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
131: if test $fu_cv_sys_mounted_fread_fstyp = yes; then
132: list_mounted_fs=found
133: AC_DEFINE(MOUNTED_FREAD_FSTYP)
134: fi
135: fi
136:
137: if test -z "$list_mounted_fs"; then
138: # 4.4BSD and DEC OSF/1.
139: AC_MSG_CHECKING([for getmntinfo function])
140: AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
141: [
142: ok=
143: if test $ac_cv_func_getmntinfo = yes; then
144: AC_EGREP_HEADER(f_type;, sys/mount.h,
145: ok=yes)
146: fi
147: test -n "$ok" \
148: && fu_cv_sys_mounted_getmntinfo=yes \
149: || fu_cv_sys_mounted_getmntinfo=no
150: ])
151: AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
152: if test $fu_cv_sys_mounted_getmntinfo = yes; then
153: list_mounted_fs=found
154: AC_DEFINE(MOUNTED_GETMNTINFO)
155: fi
156: fi
157:
158: # FIXME: add a test for netbsd-1.1 here
159:
160: if test -z "$list_mounted_fs"; then
161: # Ultrix
162: AC_MSG_CHECKING([for getmnt function])
163: AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
164: [AC_TRY_CPP([
165: #include <sys/fs_types.h>
166: #include <sys/mount.h>],
167: fu_cv_sys_mounted_getmnt=yes,
168: fu_cv_sys_mounted_getmnt=no)])
169: AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
170: if test $fu_cv_sys_mounted_getmnt = yes; then
171: list_mounted_fs=found
172: AC_DEFINE(MOUNTED_GETMNT)
173: fi
174: fi
175:
176: if test -z "$list_mounted_fs"; then
177: # SVR2
178: AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
179: AC_CACHE_VAL(fu_cv_sys_mounted_fread,
180: [AC_TRY_CPP([#include <mnttab.h>],
181: fu_cv_sys_mounted_fread=yes,
182: fu_cv_sys_mounted_fread=no)])
183: AC_MSG_RESULT($fu_cv_sys_mounted_fread)
184: if test $fu_cv_sys_mounted_fread = yes; then
185: list_mounted_fs=found
186: AC_DEFINE(MOUNTED_FREAD)
187: fi
188: fi
189:
190: if test -z "$list_mounted_fs"; then
191: AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
192: # FIXME -- no need to abort building the whole package
193: # Can't build mountlist.c or anything that needs its functions
194: fi
195:
196: AC_CHECKING(how to get filesystem space usage)
197: space=no
198:
199: # Perform only the link test since it seems there are no variants of the
200: # statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
201: # because that got a false positive on SCO OSR5. Adding the declaration
202: # of a `struct statvfs' causes this test to fail (as it should) on such
203: # systems. That system is reported to work fine with STAT_STATFS4 which
204: # is what it gets when this test fails.
205: if test $space = no; then
206: # SVR4
207: AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
208: [AC_TRY_LINK([#include <sys/types.h>
209: #include <sys/statvfs.h>],
210: [struct statvfs fsd; statvfs (0, &fsd);],
211: fu_cv_sys_stat_statvfs=yes,
212: fu_cv_sys_stat_statvfs=no)])
213: if test $fu_cv_sys_stat_statvfs = yes; then
214: space=yes
215: AC_DEFINE(STAT_STATVFS)
216: fi
217: fi
218:
219: if test $space = no; then
220: # DEC Alpha running OSF/1
221: AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
222: AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
223: [AC_TRY_RUN([
224: #include <sys/param.h>
225: #include <sys/types.h>
226: #include <sys/mount.h>
227: main ()
228: {
229: struct statfs fsd;
230: fsd.f_fsize = 0;
231: exit (statfs (".", &fsd, sizeof (struct statfs)));
232: }],
233: fu_cv_sys_stat_statfs3_osf1=yes,
234: fu_cv_sys_stat_statfs3_osf1=no,
235: fu_cv_sys_stat_statfs3_osf1=no)])
236: AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
237: if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
238: space=yes
239: AC_DEFINE(STAT_STATFS3_OSF1)
240: fi
241: fi
242:
243: if test $space = no; then
244: # AIX
245: AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
246: member (AIX, 4.3BSD)])
247: AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
248: [AC_TRY_RUN([
249: #ifdef HAVE_SYS_PARAM_H
250: #include <sys/param.h>
251: #endif
252: #ifdef HAVE_SYS_MOUNT_H
253: #include <sys/mount.h>
254: #endif
255: #ifdef HAVE_SYS_VFS_H
256: #include <sys/vfs.h>
257: #endif
258: main ()
259: {
260: struct statfs fsd;
261: fsd.f_bsize = 0;
262: exit (statfs (".", &fsd));
263: }],
264: fu_cv_sys_stat_statfs2_bsize=yes,
265: fu_cv_sys_stat_statfs2_bsize=no,
266: fu_cv_sys_stat_statfs2_bsize=no)])
267: AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
268: if test $fu_cv_sys_stat_statfs2_bsize = yes; then
269: space=yes
270: AC_DEFINE(STAT_STATFS2_BSIZE)
271: fi
272: fi
273:
274: if test $space = no; then
275: # SVR3
276: AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
277: AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
278: [AC_TRY_RUN([#include <sys/types.h>
279: #include <sys/statfs.h>
280: main ()
281: {
282: struct statfs fsd;
283: exit (statfs (".", &fsd, sizeof fsd, 0));
284: }],
285: fu_cv_sys_stat_statfs4=yes,
286: fu_cv_sys_stat_statfs4=no,
287: fu_cv_sys_stat_statfs4=no)])
288: AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
289: if test $fu_cv_sys_stat_statfs4 = yes; then
290: space=yes
291: AC_DEFINE(STAT_STATFS4)
292: fi
293: fi
294:
295: if test $space = no; then
296: # 4.4BSD and NetBSD
297: AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
298: member (4.4BSD and NetBSD)])
299: AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
300: [AC_TRY_RUN([#include <sys/types.h>
301: #ifdef HAVE_SYS_PARAM_H
302: #include <sys/param.h>
303: #endif
304: #ifdef HAVE_SYS_MOUNT_H
305: #include <sys/mount.h>
306: #endif
307: main ()
308: {
309: struct statfs fsd;
310: fsd.f_fsize = 0;
311: exit (statfs (".", &fsd));
312: }],
313: fu_cv_sys_stat_statfs2_fsize=yes,
314: fu_cv_sys_stat_statfs2_fsize=no,
315: fu_cv_sys_stat_statfs2_fsize=no)])
316: AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
317: if test $fu_cv_sys_stat_statfs2_fsize = yes; then
318: space=yes
319: AC_DEFINE(STAT_STATFS2_FSIZE)
320: fi
321: fi
322:
323: if test $space = no; then
324: # Ultrix
325: AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
326: AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
327: [AC_TRY_RUN([#include <sys/types.h>
328: #ifdef HAVE_SYS_PARAM_H
329: #include <sys/param.h>
330: #endif
331: #ifdef HAVE_SYS_MOUNT_H
332: #include <sys/mount.h>
333: #endif
334: #ifdef HAVE_SYS_FS_TYPES_H
335: #include <sys/fs_types.h>
336: #endif
337: main ()
338: {
339: struct fs_data fsd;
340: /* Ultrix's statfs returns 1 for success,
341: 0 for not mounted, -1 for failure. */
342: exit (statfs (".", &fsd) != 1);
343: }],
344: fu_cv_sys_stat_fs_data=yes,
345: fu_cv_sys_stat_fs_data=no,
346: fu_cv_sys_stat_fs_data=no)])
347: AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
348: if test $fu_cv_sys_stat_fs_data = yes; then
349: space=yes
350: AC_DEFINE(STAT_STATFS2_FS_DATA)
351: fi
352: fi
353:
354: if test $space = no; then
355: # SVR2
356: AC_TRY_CPP([#include <sys/filsys.h>],
357: AC_DEFINE(STAT_READ_FILSYS) space=yes)
358: fi
359:
360: if test -n "$list_mounted_fs" && test $space != no; then
361: DF_PROG="df"
362: AC_LIBOBJ([fsusage])
363: AC_LIBOBJ([mountlist])
364: fi
365:
366: AC_CHECK_FUNCS(ftruncate, , [ftruncate_missing=yes])
367:
368: if test "$ftruncate_missing" = yes; then
369: AC_MSG_CHECKING([fcntl emulation of ftruncate])
370: AC_CACHE_VAL(fu_cv_sys_ftruncate_emulation,
371: [AC_TRY_LINK([
372: #include <sys/types.h>
373: #include <fcntl.h>], [
374: #if !defined(F_CHSIZE) && !defined(F_FREESP)
375: chsize();
376: #endif
377: ],
378: fu_cv_sys_ftruncate_emulation=yes,
379: fu_cv_sys_ftruncate_emulation=no)])
380: AC_MSG_RESULT($fu_cv_sys_ftruncate_emulation)
381: if test $fu_cv_sys_ftruncate_emulation = yes; then
382: AC_LIBOBJ([ftruncate])
383: fi
384: fi
385:
386: # Check for SunOS statfs brokenness wrt partitions 2GB and larger.
387: # If <sys/vfs.h> exists and struct statfs has a member named f_spare,
388: # enable the work-around code in fsusage.c.
389: AC_MSG_CHECKING([for statfs that truncates block counts])
390: AC_CACHE_VAL(fu_cv_sys_truncating_statfs,
391: [AC_TRY_COMPILE([
392: #if !defined(sun) && !defined(__sun)
393: choke -- this is a workaround for a Sun-specific problem
394: #endif
395: #include <sys/types.h>
396: #include <sys/vfs.h>],
397: [struct statfs t; long c = *(t.f_spare);],
398: fu_cv_sys_truncating_statfs=yes,
399: fu_cv_sys_truncating_statfs=no,
400: )])
401: if test $fu_cv_sys_truncating_statfs = yes; then
402: AC_DEFINE(STATFS_TRUNCATES_BLOCK_COUNTS)
403: fi
404: AC_MSG_RESULT($fu_cv_sys_truncating_statfs)
405:
406: AC_CHECKING(for AFS)
407: test -d /afs && AC_DEFINE(AFS)
408: ])
409:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.