summaryrefslogtreecommitdiffstats
path: root/lib/ls-mntd-fs.m4
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-03-18 07:47:37 +0000
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-03-18 07:47:37 +0000
commitcc7522b25bfc0157eb51777f8345812e79760179 (patch)
tree94e4eb2d572c352315c39d48e25925f9605fa19a /lib/ls-mntd-fs.m4
parentb4bb59cd9bd16e3f3c1df907b8802e7e476d2ec8 (diff)
downloadmonitoring-plugins-cc7522b25bfc0157eb51777f8345812e79760179.tar.gz
from GNU fileutils for check_disk
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@429 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/ls-mntd-fs.m4')
-rw-r--r--lib/ls-mntd-fs.m4243
1 files changed, 243 insertions, 0 deletions
diff --git a/lib/ls-mntd-fs.m4 b/lib/ls-mntd-fs.m4
new file mode 100644
index 00000000..695b3ba6
--- /dev/null
+++ b/lib/ls-mntd-fs.m4
@@ -0,0 +1,243 @@
1#serial 10
2
3dnl From Jim Meyering.
4dnl
5dnl This is not pretty. I've just taken the autoconf code and wrapped
6dnl it in an AC_DEFUN.
7dnl
8
9# jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
10AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS,
11 [
12AC_CHECK_FUNCS(listmntent getmntinfo)
13AC_CHECK_HEADERS(mntent.h)
14
15# Determine how to get the list of mounted filesystems.
16ac_list_mounted_fs=
17
18# If the getmntent function is available but not in the standard library,
19# make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX).
20AC_FUNC_GETMNTENT
21
22# This test must precede the ones for getmntent because Unicos-9 is
23# reported to have the getmntent function, but its support is incompatible
24# with other getmntent implementations.
25
26# NOTE: Normally, I wouldn't use a check for system type as I've done for
27# `CRAY' below since that goes against the whole autoconf philosophy. But
28# I think there is too great a chance that some non-Cray system has a
29# function named listmntent to risk the false positive.
30
31if test -z "$ac_list_mounted_fs"; then
32 # Cray UNICOS 9
33 AC_MSG_CHECKING([for listmntent of Cray/Unicos-9])
34 AC_CACHE_VAL(fu_cv_sys_mounted_cray_listmntent,
35 [fu_cv_sys_mounted_cray_listmntent=no
36 AC_EGREP_CPP(yes,
37 [#ifdef _CRAY
38yes
39#endif
40 ], [test $ac_cv_func_listmntent = yes \
41 && fu_cv_sys_mounted_cray_listmntent=yes]
42 )
43 ]
44 )
45 AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent)
46 if test $fu_cv_sys_mounted_cray_listmntent = yes; then
47 ac_list_mounted_fs=found
48 AC_DEFINE(MOUNTED_LISTMNTENT, 1,
49 [Define if there is a function named listmntent that can be used to
50 list all mounted filesystems. (UNICOS)])
51 fi
52fi
53
54if test $ac_cv_func_getmntent = yes; then
55
56 # This system has the getmntent function.
57 # Determine whether it's the one-argument variant or the two-argument one.
58
59 if test -z "$ac_list_mounted_fs"; then
60 # 4.3BSD, SunOS, HP-UX, Dynix, Irix
61 AC_MSG_CHECKING([for one-argument getmntent function])
62 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1,
63 [test $ac_cv_header_mntent_h = yes \
64 && fu_cv_sys_mounted_getmntent1=yes \
65 || fu_cv_sys_mounted_getmntent1=no])
66 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1)
67 if test $fu_cv_sys_mounted_getmntent1 = yes; then
68 ac_list_mounted_fs=found
69 AC_DEFINE(MOUNTED_GETMNTENT1, 1,
70 [Define if there is a function named getmntent for reading the list
71 of mounted filesystems, and that function takes a single argument.
72 (4.3BSD, SunOS, HP-UX, Dynix, Irix)])
73 fi
74 fi
75
76 if test -z "$ac_list_mounted_fs"; then
77 # SVR4
78 AC_MSG_CHECKING([for two-argument getmntent function])
79 AC_CACHE_VAL(fu_cv_sys_mounted_getmntent2,
80 [AC_EGREP_HEADER(getmntent, sys/mnttab.h,
81 fu_cv_sys_mounted_getmntent2=yes,
82 fu_cv_sys_mounted_getmntent2=no)])
83 AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2)
84 if test $fu_cv_sys_mounted_getmntent2 = yes; then
85 ac_list_mounted_fs=found
86 AC_DEFINE(MOUNTED_GETMNTENT2, 1,
87 [Define if there is a function named getmntent for reading the list of
88 mounted filesystems, and that function takes two arguments. (SVR4)])
89 fi
90 fi
91
92 if test -z "$ac_list_mounted_fs"; then
93 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
94 fi
95
96fi
97
98if test -z "$ac_list_mounted_fs"; then
99 # DEC Alpha running OSF/1.
100 AC_MSG_CHECKING([for getfsstat function])
101 AC_CACHE_VAL(fu_cv_sys_mounted_getsstat,
102 [AC_TRY_LINK([
103#include <sys/types.h>
104#include <sys/mount.h>
105#include <sys/fs_types.h>],
106 [struct statfs *stats;
107 int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ],
108 fu_cv_sys_mounted_getsstat=yes,
109 fu_cv_sys_mounted_getsstat=no)])
110 AC_MSG_RESULT($fu_cv_sys_mounted_getsstat)
111 if test $fu_cv_sys_mounted_getsstat = yes; then
112 ac_list_mounted_fs=found
113 AC_DEFINE(MOUNTED_GETFSSTAT, 1,
114 [Define if there is a function named getfsstat for reading the
115 list of mounted filesystems. (DEC Alpha running OSF/1)])
116 fi
117fi
118
119if test -z "$ac_list_mounted_fs"; then
120 # AIX.
121 AC_MSG_CHECKING([for mntctl function and struct vmount])
122 AC_CACHE_VAL(fu_cv_sys_mounted_vmount,
123 [AC_TRY_CPP([#include <fshelp.h>],
124 fu_cv_sys_mounted_vmount=yes,
125 fu_cv_sys_mounted_vmount=no)])
126 AC_MSG_RESULT($fu_cv_sys_mounted_vmount)
127 if test $fu_cv_sys_mounted_vmount = yes; then
128 ac_list_mounted_fs=found
129 AC_DEFINE(MOUNTED_VMOUNT, 1,
130 [Define if there is a function named mntctl that can be used to read
131 the list of mounted filesystems, and there is a system header file
132 that declares `struct vmount.' (AIX)])
133 fi
134fi
135
136if test -z "$ac_list_mounted_fs"; then
137 # SVR3
138 AC_MSG_CHECKING([for FIXME existence of three headers])
139 AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp,
140 [AC_TRY_CPP([
141#include <sys/statfs.h>
142#include <sys/fstyp.h>
143#include <mnttab.h>],
144 fu_cv_sys_mounted_fread_fstyp=yes,
145 fu_cv_sys_mounted_fread_fstyp=no)])
146 AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp)
147 if test $fu_cv_sys_mounted_fread_fstyp = yes; then
148 ac_list_mounted_fs=found
149 AC_DEFINE(MOUNTED_FREAD_FSTYP, 1,
150[Define if (like SVR2) there is no specific function for reading the
151 list of mounted filesystems, and your system has these header files:
152 <sys/fstyp.h> and <sys/statfs.h>. (SVR3)])
153 fi
154fi
155
156if test -z "$ac_list_mounted_fs"; then
157 # 4.4BSD and DEC OSF/1.
158 AC_MSG_CHECKING([for getmntinfo function])
159 AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo,
160 [
161 ok=
162 if test $ac_cv_func_getmntinfo = yes; then
163 AC_EGREP_HEADER(f_type;, sys/mount.h,
164 ok=yes)
165 fi
166 test -n "$ok" \
167 && fu_cv_sys_mounted_getmntinfo=yes \
168 || fu_cv_sys_mounted_getmntinfo=no
169 ])
170 AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo)
171 if test $fu_cv_sys_mounted_getmntinfo = yes; then
172 ac_list_mounted_fs=found
173 AC_DEFINE(MOUNTED_GETMNTINFO, 1,
174 [Define if there is a function named getmntinfo for reading the
175 list of mounted filesystems. (4.4BSD)])
176 fi
177fi
178
179if test -z "$ac_list_mounted_fs"; then
180 # Ultrix
181 AC_MSG_CHECKING([for getmnt function])
182 AC_CACHE_VAL(fu_cv_sys_mounted_getmnt,
183 [AC_TRY_CPP([
184#include <sys/fs_types.h>
185#include <sys/mount.h>],
186 fu_cv_sys_mounted_getmnt=yes,
187 fu_cv_sys_mounted_getmnt=no)])
188 AC_MSG_RESULT($fu_cv_sys_mounted_getmnt)
189 if test $fu_cv_sys_mounted_getmnt = yes; then
190 ac_list_mounted_fs=found
191 AC_DEFINE(MOUNTED_GETMNT, 1,
192 [Define if there is a function named getmnt for reading the list of
193 mounted filesystems. (Ultrix)])
194 fi
195fi
196
197if test -z "$ac_list_mounted_fs"; then
198 # BeOS
199 AC_CHECK_FUNCS(next_dev fs_stat_dev)
200 AC_CHECK_HEADERS(fs_info.h)
201 AC_MSG_CHECKING([for BEOS mounted file system support functions])
202 if test $ac_cv_header_fs_info_h = yes \
203 && test $ac_cv_func_next_dev = yes \
204 && test $ac_cv_func_fs_stat_dev = yes; then
205 fu_result=yes
206 else
207 fu_result=no
208 fi
209 AC_MSG_RESULT($fu_result)
210 if test $fu_result = yes; then
211 ac_list_mounted_fs=found
212 AC_DEFINE(MOUNTED_FS_STAT_DEV, 1,
213 [Define if there are functions named next_dev and fs_stat_dev for
214 reading the list of mounted filesystems. (BeOS)])
215 fi
216fi
217
218if test -z "$ac_list_mounted_fs"; then
219 # SVR2
220 AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
221 AC_CACHE_VAL(fu_cv_sys_mounted_fread,
222 [AC_TRY_CPP([#include <mnttab.h>],
223 fu_cv_sys_mounted_fread=yes,
224 fu_cv_sys_mounted_fread=no)])
225 AC_MSG_RESULT($fu_cv_sys_mounted_fread)
226 if test $fu_cv_sys_mounted_fread = yes; then
227 ac_list_mounted_fs=found
228 AC_DEFINE(MOUNTED_FREAD, 1,
229 [Define if there is no specific function for reading the list of
230 mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ])
231 fi
232fi
233
234if test -z "$ac_list_mounted_fs"; then
235 AC_MSG_ERROR([could not determine how to read list of mounted filesystems])
236 # FIXME -- no need to abort building the whole package
237 # Can't build mountlist.c or anything that needs its functions
238fi
239
240dnl AS_IF([test $ac_list_mounted_fs = found], [$1], [$2])
241if test $ac_list_mounted_fs = found ; then [$1] ; else [$2] ; fi
242
243 ])