5 dnl This is not pretty. I've just taken the autoconf code and wrapped
8 dnl CAUTION: This is very fragile. It relies on several checks that
9 dnl are still in fileutils' configure.in:
10 dnl FIXME: add AC_REQUIRE uses to pull in all definitions required
11 dnl for all uses of $ac_cv_func_* and $ac_cv_header_* variables below.
14 AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
16 # Determine how to get the list of mounted filesystems.
19 # If the getmntent function is available but not in the standard library,
20 # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
23 # This test must precede the ones for getmntent because Unicos-9 is
24 # reported to have the getmntent function, but its support is incompatible
25 # with other getmntent implementations.
27 # NOTE: Normally, I wouldn't use a check for system type as I've done for
28 # `CRAY' below since that goes against the whole autoconf philosophy. But
29 # I think there is too great a chance that some non-Cray system has a
30 # function named listmntent to risk the false positive.
32 if test -z "$list_mounted_fs"; then
34 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
35 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
36 [fu_cv_sys_mounted_cray_listmntent=no
41 ], [test $ac_cv_func_listmntent = yes \
42 && fu_cv_sys_mounted_cray_listmntent=yes]
46 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
47 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
49 AC_DEFINE(MOUNTED_LISTMNTENT)
53 if test $ac_cv_func_getmntent = yes; then
55 # This system has the getmntent function.
56 # Determine whether it's the one-argument variant or the two-argument one.
58 if test -z "$list_mounted_fs"; then
59 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
60 AC_MSG_CHECKING([for one-argument getmntent function])
61 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
62 [test $ac_cv_header_mntent_h = yes \
63 && fu_cv_sys_mounted_getmntent1=yes \
64 || fu_cv_sys_mounted_getmntent1=no])
65 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
66 if test $fu_cv_sys_mounted_getmntent1 = yes; then
68 AC_DEFINE(MOUNTED_GETMNTENT1)
72 if test -z "$list_mounted_fs"; then
74 AC_MSG_CHECKING([for two-argument getmntent function])
75 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
76 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
77 fu_cv_sys_mounted_getmntent2=yes,
78 fu_cv_sys_mounted_getmntent2=no)])
79 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
80 if test $fu_cv_sys_mounted_getmntent2 = yes; then
82 AC_DEFINE(MOUNTED_GETMNTENT2)
86 if test -z "$list_mounted_fs"; then
87 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
92 if test -z "$list_mounted_fs"; then
93 # DEC Alpha running OSF/1.
94 AC_MSG_CHECKING([for getfsstat function])
95 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
97 #include <sys/types.h>
98 #include <sys/mount.h>
99 #include <sys/fs_types.h>],
100 [struct statfs *stats;
101 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
102 fu_cv_sys_mounted_getsstat=yes,
103 fu_cv_sys_mounted_getsstat=no)])
104 AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
105 if test $fu_cv_sys_mounted_getsstat = yes; then
106 list_mounted_fs=found
107 AC_DEFINE(MOUNTED_GETFSSTAT)
111 if test -z "$list_mounted_fs"; then
113 AC_MSG_CHECKING([for mntctl function and struct vmount])
114 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
115 [AC_TRY_CPP([#include <fshelp.h>],
116 fu_cv_sys_mounted_vmount=yes,
117 fu_cv_sys_mounted_vmount=no)])
118 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
119 if test $fu_cv_sys_mounted_vmount = yes; then
120 list_mounted_fs=found
121 AC_DEFINE(MOUNTED_VMOUNT)
125 if test -z "$list_mounted_fs"; then
127 AC_MSG_CHECKING([for FIXME existence of three headers])
128 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
130 #include <sys/statfs.h>
131 #include <sys/fstyp.h>
132 #include <mnttab.h>],
133 fu_cv_sys_mounted_fread_fstyp=yes,
134 fu_cv_sys_mounted_fread_fstyp=no)])
135 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
136 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
137 list_mounted_fs=found
138 AC_DEFINE(MOUNTED_FREAD_FSTYP)
142 if test -z "$list_mounted_fs"; then
143 # 4.4BSD and DEC OSF/1.
144 AC_MSG_CHECKING([for getmntinfo function])
145 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
148 if test $ac_cv_func_getmntinfo = yes; then
149 AC_EGREP_HEADER(f_type;, sys/mount.h,
153 && fu_cv_sys_mounted_getmntinfo=yes \
154 || fu_cv_sys_mounted_getmntinfo=no
156 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
157 if test $fu_cv_sys_mounted_getmntinfo = yes; then
158 list_mounted_fs=found
159 AC_DEFINE(MOUNTED_GETMNTINFO)
163 # FIXME: add a test for netbsd-1.1 here
165 if test -z "$list_mounted_fs"; then
167 AC_MSG_CHECKING([for getmnt function])
168 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
170 #include <sys/fs_types.h>
171 #include <sys/mount.h>],
172 fu_cv_sys_mounted_getmnt=yes,
173 fu_cv_sys_mounted_getmnt=no)])
174 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
175 if test $fu_cv_sys_mounted_getmnt = yes; then
176 list_mounted_fs=found
177 AC_DEFINE(MOUNTED_GETMNT)
181 if test -z "$list_mounted_fs"; then
183 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
184 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
185 [AC_TRY_CPP([#include <mnttab.h>],
186 fu_cv_sys_mounted_fread=yes,
187 fu_cv_sys_mounted_fread=no)])
188 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
189 if test $fu_cv_sys_mounted_fread = yes; then
190 list_mounted_fs=found
191 AC_DEFINE(MOUNTED_FREAD)
195 if test -z "$list_mounted_fs"; then
196 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
197 # FIXME -- no need to abort building the whole package
198 # Can't build mountlist.c or anything that needs its functions