diff options
Diffstat (limited to 'm4/ls-mntd-fs.m4')
-rw-r--r-- | m4/ls-mntd-fs.m4 | 306 |
1 files changed, 0 insertions, 306 deletions
diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 deleted file mode 100644 index a4c80890..00000000 --- a/m4/ls-mntd-fs.m4 +++ /dev/null | |||
@@ -1,306 +0,0 @@ | |||
1 | #serial 21 | ||
2 | # How to list mounted file systems. | ||
3 | |||
4 | # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software | ||
5 | # Foundation, Inc. | ||
6 | # | ||
7 | # This file is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | dnl From Jim Meyering. | ||
12 | dnl | ||
13 | dnl This is not pretty. I've just taken the autoconf code and wrapped | ||
14 | dnl it in an AC_DEFUN and made some other fixes. | ||
15 | dnl | ||
16 | |||
17 | # Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf | ||
18 | # through Autoconf 2.59. We can remove this once we assume Autoconf 2.60 | ||
19 | # or later. | ||
20 | AC_DEFUN([AC_FUNC_GETMNTENT], | ||
21 | [# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, | ||
22 | # -lseq on Dynix/PTX, -lgen on Unixware. | ||
23 | AC_SEARCH_LIBS(getmntent, [sun seq gen]) | ||
24 | AC_CHECK_FUNCS(getmntent) | ||
25 | ]) | ||
26 | |||
27 | # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||
28 | AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS], | ||
29 | [ | ||
30 | AC_CHECK_FUNCS(listmntent getmntinfo) | ||
31 | AC_CHECK_HEADERS_ONCE(sys/param.h) | ||
32 | |||
33 | # We must include grp.h before ucred.h on OSF V4.0, since ucred.h uses | ||
34 | # NGROUPS (as the array dimension for a struct member) without a definition. | ||
35 | AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>]) | ||
36 | |||
37 | AC_CHECK_HEADERS(sys/mount.h, [], [], | ||
38 | [AC_INCLUDES_DEFAULT | ||
39 | [#if HAVE_SYS_PARAM_H | ||
40 | #include <sys/param.h> | ||
41 | #endif]]) | ||
42 | |||
43 | AC_CHECK_HEADERS(mntent.h sys/fs_types.h) | ||
44 | getfsstat_includes="\ | ||
45 | $ac_includes_default | ||
46 | #if HAVE_SYS_PARAM_H | ||
47 | # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
48 | #endif | ||
49 | #if HAVE_SYS_UCRED_H | ||
50 | # include <grp.h> /* needed for definition of NGROUPS */ | ||
51 | # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
52 | #endif | ||
53 | #if HAVE_SYS_MOUNT_H | ||
54 | # include <sys/mount.h> | ||
55 | #endif | ||
56 | #if HAVE_SYS_FS_TYPES_H | ||
57 | # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
58 | #endif | ||
59 | " | ||
60 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) | ||
61 | |||
62 | # Determine how to get the list of mounted file systems. | ||
63 | ac_list_mounted_fs= | ||
64 | |||
65 | # If the getmntent function is available but not in the standard library, | ||
66 | # make sure LIBS contains the appropriate -l option. | ||
67 | AC_FUNC_GETMNTENT | ||
68 | |||
69 | # This test must precede the ones for getmntent because Unicos-9 is | ||
70 | # reported to have the getmntent function, but its support is incompatible | ||
71 | # with other getmntent implementations. | ||
72 | |||
73 | # NOTE: Normally, I wouldn't use a check for system type as I've done for | ||
74 | # `CRAY' below since that goes against the whole autoconf philosophy. But | ||
75 | # I think there is too great a chance that some non-Cray system has a | ||
76 | # function named listmntent to risk the false positive. | ||
77 | |||
78 | if test -z "$ac_list_mounted_fs"; then | ||
79 | # Cray UNICOS 9 | ||
80 | AC_MSG_CHECKING([for listmntent of Cray/Unicos-9]) | ||
81 | AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent, | ||
82 | [fu_cv_sys_mounted_cray_listmntent=no | ||
83 | AC_EGREP_CPP(yes, | ||
84 | [#ifdef _CRAY | ||
85 | yes | ||
86 | #endif | ||
87 | ], [test $ac_cv_func_listmntent = yes \ | ||
88 | && fu_cv_sys_mounted_cray_listmntent=yes] | ||
89 | ) | ||
90 | ] | ||
91 | ) | ||
92 | AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) | ||
93 | if test $fu_cv_sys_mounted_cray_listmntent = yes; then | ||
94 | ac_list_mounted_fs=found | ||
95 | AC_DEFINE(MOUNTED_LISTMNTENT, 1, | ||
96 | [Define if there is a function named listmntent that can be used to | ||
97 | list all mounted file systems. (UNICOS)]) | ||
98 | fi | ||
99 | fi | ||
100 | |||
101 | if test -z "$ac_list_mounted_fs"; then | ||
102 | # AIX. | ||
103 | AC_MSG_CHECKING([for mntctl function and struct vmount]) | ||
104 | AC_CACHE_VAL(fu_cv_sys_mounted_vmount, | ||
105 | [AC_TRY_CPP([#include <fshelp.h>], | ||
106 | fu_cv_sys_mounted_vmount=yes, | ||
107 | fu_cv_sys_mounted_vmount=no)]) | ||
108 | AC_MSG_RESULT($fu_cv_sys_mounted_vmount) | ||
109 | if test $fu_cv_sys_mounted_vmount = yes; then | ||
110 | ac_list_mounted_fs=found | ||
111 | AC_DEFINE(MOUNTED_VMOUNT, 1, | ||
112 | [Define if there is a function named mntctl that can be used to read | ||
113 | the list of mounted file systems, and there is a system header file | ||
114 | that declares `struct vmount.' (AIX)]) | ||
115 | fi | ||
116 | fi | ||
117 | |||
118 | if test $ac_cv_func_getmntent = yes; then | ||
119 | |||
120 | # This system has the getmntent function. | ||
121 | # Determine whether it's the one-argument variant or the two-argument one. | ||
122 | |||
123 | if test -z "$ac_list_mounted_fs"; then | ||
124 | # 4.3BSD, SunOS, HP-UX, Dynix, Irix | ||
125 | AC_MSG_CHECKING([for one-argument getmntent function]) | ||
126 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, | ||
127 | [AC_TRY_COMPILE([ | ||
128 | /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ | ||
129 | #include <stdio.h> | ||
130 | |||
131 | #include <mntent.h> | ||
132 | #if !defined MOUNTED | ||
133 | # if defined _PATH_MOUNTED /* GNU libc */ | ||
134 | # define MOUNTED _PATH_MOUNTED | ||
135 | # endif | ||
136 | # if defined MNT_MNTTAB /* HP-UX. */ | ||
137 | # define MOUNTED MNT_MNTTAB | ||
138 | # endif | ||
139 | # if defined MNTTABNAME /* Dynix. */ | ||
140 | # define MOUNTED MNTTABNAME | ||
141 | # endif | ||
142 | #endif | ||
143 | ], | ||
144 | [ struct mntent *mnt = 0; char *table = MOUNTED; ], | ||
145 | fu_cv_sys_mounted_getmntent1=yes, | ||
146 | fu_cv_sys_mounted_getmntent1=no)]) | ||
147 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) | ||
148 | if test $fu_cv_sys_mounted_getmntent1 = yes; then | ||
149 | ac_list_mounted_fs=found | ||
150 | AC_DEFINE(MOUNTED_GETMNTENT1, 1, | ||
151 | [Define if there is a function named getmntent for reading the list | ||
152 | of mounted file systems, and that function takes a single argument. | ||
153 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) | ||
154 | fi | ||
155 | fi | ||
156 | |||
157 | if test -z "$ac_list_mounted_fs"; then | ||
158 | # SVR4 | ||
159 | AC_MSG_CHECKING([for two-argument getmntent function]) | ||
160 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2, | ||
161 | [AC_EGREP_HEADER(getmntent, sys/mnttab.h, | ||
162 | fu_cv_sys_mounted_getmntent2=yes, | ||
163 | fu_cv_sys_mounted_getmntent2=no)]) | ||
164 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) | ||
165 | if test $fu_cv_sys_mounted_getmntent2 = yes; then | ||
166 | ac_list_mounted_fs=found | ||
167 | AC_DEFINE(MOUNTED_GETMNTENT2, 1, | ||
168 | [Define if there is a function named getmntent for reading the list of | ||
169 | mounted file systems, and that function takes two arguments. (SVR4)]) | ||
170 | fi | ||
171 | fi | ||
172 | |||
173 | fi | ||
174 | |||
175 | if test -z "$ac_list_mounted_fs"; then | ||
176 | # DEC Alpha running OSF/1, and Apple Darwin 1.3. | ||
177 | # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h | ||
178 | |||
179 | AC_MSG_CHECKING([for getfsstat function]) | ||
180 | AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat, | ||
181 | [AC_TRY_LINK([ | ||
182 | #include <sys/types.h> | ||
183 | #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME | ||
184 | # define FS_TYPE(Ent) ((Ent).f_fstypename) | ||
185 | #else | ||
186 | # define FS_TYPE(Ent) mnt_names[(Ent).f_type] | ||
187 | #endif | ||
188 | ]$getfsstat_includes | ||
189 | , | ||
190 | [struct statfs *stats; | ||
191 | int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); | ||
192 | char *t = FS_TYPE (*stats); ], | ||
193 | fu_cv_sys_mounted_getfsstat=yes, | ||
194 | fu_cv_sys_mounted_getfsstat=no)]) | ||
195 | AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat) | ||
196 | if test $fu_cv_sys_mounted_getfsstat = yes; then | ||
197 | ac_list_mounted_fs=found | ||
198 | AC_DEFINE(MOUNTED_GETFSSTAT, 1, | ||
199 | [Define if there is a function named getfsstat for reading the | ||
200 | list of mounted file systems. (DEC Alpha running OSF/1)]) | ||
201 | fi | ||
202 | fi | ||
203 | |||
204 | if test -z "$ac_list_mounted_fs"; then | ||
205 | # SVR3 | ||
206 | AC_MSG_CHECKING([for FIXME existence of three headers]) | ||
207 | AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, | ||
208 | [AC_TRY_CPP([ | ||
209 | #include <sys/statfs.h> | ||
210 | #include <sys/fstyp.h> | ||
211 | #include <mnttab.h>], | ||
212 | fu_cv_sys_mounted_fread_fstyp=yes, | ||
213 | fu_cv_sys_mounted_fread_fstyp=no)]) | ||
214 | AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) | ||
215 | if test $fu_cv_sys_mounted_fread_fstyp = yes; then | ||
216 | ac_list_mounted_fs=found | ||
217 | AC_DEFINE(MOUNTED_FREAD_FSTYP, 1, | ||
218 | [Define if (like SVR2) there is no specific function for reading the | ||
219 | list of mounted file systems, and your system has these header files: | ||
220 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) | ||
221 | fi | ||
222 | fi | ||
223 | |||
224 | if test -z "$ac_list_mounted_fs"; then | ||
225 | # 4.4BSD and DEC OSF/1. | ||
226 | AC_MSG_CHECKING([for getmntinfo function]) | ||
227 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, | ||
228 | [ | ||
229 | test "$ac_cv_func_getmntinfo" = yes \ | ||
230 | && fu_cv_sys_mounted_getmntinfo=yes \ | ||
231 | || fu_cv_sys_mounted_getmntinfo=no | ||
232 | ]) | ||
233 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) | ||
234 | if test $fu_cv_sys_mounted_getmntinfo = yes; then | ||
235 | ac_list_mounted_fs=found | ||
236 | AC_DEFINE(MOUNTED_GETMNTINFO, 1, | ||
237 | [Define if there is a function named getmntinfo for reading the | ||
238 | list of mounted file systems. (4.4BSD, Darwin)]) | ||
239 | fi | ||
240 | fi | ||
241 | |||
242 | if test -z "$ac_list_mounted_fs"; then | ||
243 | # Ultrix | ||
244 | AC_MSG_CHECKING([for getmnt function]) | ||
245 | AC_CACHE_VAL(fu_cv_sys_mounted_getmnt, | ||
246 | [AC_TRY_CPP([ | ||
247 | #include <sys/fs_types.h> | ||
248 | #include <sys/mount.h>], | ||
249 | fu_cv_sys_mounted_getmnt=yes, | ||
250 | fu_cv_sys_mounted_getmnt=no)]) | ||
251 | AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) | ||
252 | if test $fu_cv_sys_mounted_getmnt = yes; then | ||
253 | ac_list_mounted_fs=found | ||
254 | AC_DEFINE(MOUNTED_GETMNT, 1, | ||
255 | [Define if there is a function named getmnt for reading the list of | ||
256 | mounted file systems. (Ultrix)]) | ||
257 | fi | ||
258 | fi | ||
259 | |||
260 | if test -z "$ac_list_mounted_fs"; then | ||
261 | # BeOS | ||
262 | AC_CHECK_FUNCS(next_dev fs_stat_dev) | ||
263 | AC_CHECK_HEADERS(fs_info.h) | ||
264 | AC_MSG_CHECKING([for BEOS mounted file system support functions]) | ||
265 | if test $ac_cv_header_fs_info_h = yes \ | ||
266 | && test $ac_cv_func_next_dev = yes \ | ||
267 | && test $ac_cv_func_fs_stat_dev = yes; then | ||
268 | fu_result=yes | ||
269 | else | ||
270 | fu_result=no | ||
271 | fi | ||
272 | AC_MSG_RESULT($fu_result) | ||
273 | if test $fu_result = yes; then | ||
274 | ac_list_mounted_fs=found | ||
275 | AC_DEFINE(MOUNTED_FS_STAT_DEV, 1, | ||
276 | [Define if there are functions named next_dev and fs_stat_dev for | ||
277 | reading the list of mounted file systems. (BeOS)]) | ||
278 | fi | ||
279 | fi | ||
280 | |||
281 | if test -z "$ac_list_mounted_fs"; then | ||
282 | # SVR2 | ||
283 | AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab]) | ||
284 | AC_CACHE_VAL(fu_cv_sys_mounted_fread, | ||
285 | [AC_TRY_CPP([#include <mnttab.h>], | ||
286 | fu_cv_sys_mounted_fread=yes, | ||
287 | fu_cv_sys_mounted_fread=no)]) | ||
288 | AC_MSG_RESULT($fu_cv_sys_mounted_fread) | ||
289 | if test $fu_cv_sys_mounted_fread = yes; then | ||
290 | ac_list_mounted_fs=found | ||
291 | AC_DEFINE(MOUNTED_FREAD, 1, | ||
292 | [Define if there is no specific function for reading the list of | ||
293 | mounted file systems. fread will be used to read /etc/mnttab. | ||
294 | (SVR2) ]) | ||
295 | fi | ||
296 | fi | ||
297 | |||
298 | if test -z "$ac_list_mounted_fs"; then | ||
299 | AC_MSG_ERROR([could not determine how to read list of mounted file systems]) | ||
300 | # FIXME -- no need to abort building the whole package | ||
301 | # Can't build mountlist.c or anything that needs its functions | ||
302 | fi | ||
303 | |||
304 | AS_IF([test $ac_list_mounted_fs = found], [$1], [$2]) | ||
305 | |||
306 | ]) | ||