diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-24 01:18:15 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-03-24 01:18:15 +0000 |
commit | 56a314b28370a6939c0dfbd7e31a30cd8af6fdff (patch) | |
tree | 596b53c28e0dd2ee575109aa139049ba7692538f /lib/ls-mntd-fs.m4 | |
parent | 68ce85806201204136a9064cd4935acc8737dff5 (diff) | |
download | monitoring-plugins-56a314b28370a6939c0dfbd7e31a30cd8af6fdff.tar.gz |
Using coreutils 4.5.11 version to fix Darwin problem
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@453 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/ls-mntd-fs.m4')
-rw-r--r-- | lib/ls-mntd-fs.m4 | 139 |
1 files changed, 85 insertions, 54 deletions
diff --git a/lib/ls-mntd-fs.m4 b/lib/ls-mntd-fs.m4 index ec13e965..3ba42a31 100644 --- a/lib/ls-mntd-fs.m4 +++ b/lib/ls-mntd-fs.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | #serial 10 | 1 | #serial 12 |
2 | 2 | ||
3 | dnl From Jim Meyering. | 3 | dnl From Jim Meyering. |
4 | dnl | 4 | dnl |
@@ -7,10 +7,26 @@ dnl it in an AC_DEFUN. | |||
7 | dnl | 7 | dnl |
8 | 8 | ||
9 | # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | 9 | # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
10 | AC_DEFUN(jm_LIST_MOUNTED_FILESYSTEMS, | 10 | AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS], |
11 | [ | 11 | [ |
12 | AC_CHECK_FUNCS(listmntent getmntinfo) | 12 | AC_CHECK_FUNCS(listmntent getmntinfo) |
13 | AC_CHECK_HEADERS(mntent.h) | 13 | AC_CHECK_HEADERS(mntent.h sys/param.h sys/ucred.h sys/mount.h sys/fs_types.h) |
14 | getfsstat_includes="\ | ||
15 | $ac_includes_default | ||
16 | #if HAVE_SYS_PARAM_H | ||
17 | # include <sys/param.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
18 | #endif | ||
19 | #if HAVE_SYS_UCRED_H | ||
20 | # include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
21 | #endif | ||
22 | #if HAVE_SYS_MOUNT_H | ||
23 | # include <sys/mount.h> | ||
24 | #endif | ||
25 | #if HAVE_SYS_FS_TYPES_H | ||
26 | # include <sys/fs_types.h> /* needed by powerpc-apple-darwin1.3.7 */ | ||
27 | #endif | ||
28 | " | ||
29 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) | ||
14 | 30 | ||
15 | # Determine how to get the list of mounted filesystems. | 31 | # Determine how to get the list of mounted filesystems. |
16 | ac_list_mounted_fs= | 32 | ac_list_mounted_fs= |
@@ -45,12 +61,29 @@ yes | |||
45 | AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) | 61 | AC_MSG_RESULT($fu_cv_sys_mounted_cray_listmntent) |
46 | if test $fu_cv_sys_mounted_cray_listmntent = yes; then | 62 | if test $fu_cv_sys_mounted_cray_listmntent = yes; then |
47 | ac_list_mounted_fs=found | 63 | ac_list_mounted_fs=found |
48 | AC_DEFINE_UNQUOTED(MOUNTED_LISTMNTENT, 1, | 64 | AC_DEFINE(MOUNTED_LISTMNTENT, 1, |
49 | [Define if there is a function named listmntent that can be used to | 65 | [Define if there is a function named listmntent that can be used to |
50 | list all mounted filesystems. (UNICOS)]) | 66 | list all mounted filesystems. (UNICOS)]) |
51 | fi | 67 | fi |
52 | fi | 68 | fi |
53 | 69 | ||
70 | if test -z "$ac_list_mounted_fs"; then | ||
71 | # AIX. | ||
72 | AC_MSG_CHECKING([for mntctl function and struct vmount]) | ||
73 | AC_CACHE_VAL(fu_cv_sys_mounted_vmount, | ||
74 | [AC_TRY_CPP([#include <fshelp.h>], | ||
75 | fu_cv_sys_mounted_vmount=yes, | ||
76 | fu_cv_sys_mounted_vmount=no)]) | ||
77 | AC_MSG_RESULT($fu_cv_sys_mounted_vmount) | ||
78 | if test $fu_cv_sys_mounted_vmount = yes; then | ||
79 | ac_list_mounted_fs=found | ||
80 | AC_DEFINE(MOUNTED_VMOUNT, 1, | ||
81 | [Define if there is a function named mntctl that can be used to read | ||
82 | the list of mounted filesystems, and there is a system header file | ||
83 | that declares `struct vmount.' (AIX)]) | ||
84 | fi | ||
85 | fi | ||
86 | |||
54 | if test $ac_cv_func_getmntent = yes; then | 87 | if test $ac_cv_func_getmntent = yes; then |
55 | 88 | ||
56 | # This system has the getmntent function. | 89 | # This system has the getmntent function. |
@@ -60,13 +93,30 @@ if test $ac_cv_func_getmntent = yes; then | |||
60 | # 4.3BSD, SunOS, HP-UX, Dynix, Irix | 93 | # 4.3BSD, SunOS, HP-UX, Dynix, Irix |
61 | AC_MSG_CHECKING([for one-argument getmntent function]) | 94 | AC_MSG_CHECKING([for one-argument getmntent function]) |
62 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, | 95 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntent1, |
63 | [test $ac_cv_header_mntent_h = yes \ | 96 | [AC_TRY_COMPILE([ |
64 | && fu_cv_sys_mounted_getmntent1=yes \ | 97 | /* SunOS 4.1.x /usr/include/mntent.h needs this for FILE */ |
65 | || fu_cv_sys_mounted_getmntent1=no]) | 98 | #include <stdio.h> |
99 | |||
100 | #include <mntent.h> | ||
101 | #if !defined MOUNTED | ||
102 | # if defined _PATH_MOUNTED /* GNU libc */ | ||
103 | # define MOUNTED _PATH_MOUNTED | ||
104 | # endif | ||
105 | # if defined MNT_MNTTAB /* HP-UX. */ | ||
106 | # define MOUNTED MNT_MNTTAB | ||
107 | # endif | ||
108 | # if defined MNTTABNAME /* Dynix. */ | ||
109 | # define MOUNTED MNTTABNAME | ||
110 | # endif | ||
111 | #endif | ||
112 | ], | ||
113 | [ struct mntent *mnt = 0; char *table = MOUNTED; ], | ||
114 | fu_cv_sys_mounted_getmntent1=yes, | ||
115 | fu_cv_sys_mounted_getmntent1=no)]) | ||
66 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) | 116 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent1) |
67 | if test $fu_cv_sys_mounted_getmntent1 = yes; then | 117 | if test $fu_cv_sys_mounted_getmntent1 = yes; then |
68 | ac_list_mounted_fs=found | 118 | ac_list_mounted_fs=found |
69 | AC_DEFINE_UNQUOTED(MOUNTED_GETMNTENT1, 1, | 119 | AC_DEFINE(MOUNTED_GETMNTENT1, 1, |
70 | [Define if there is a function named getmntent for reading the list | 120 | [Define if there is a function named getmntent for reading the list |
71 | of mounted filesystems, and that function takes a single argument. | 121 | of mounted filesystems, and that function takes a single argument. |
72 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) | 122 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) |
@@ -83,57 +133,44 @@ if test $ac_cv_func_getmntent = yes; then | |||
83 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) | 133 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntent2) |
84 | if test $fu_cv_sys_mounted_getmntent2 = yes; then | 134 | if test $fu_cv_sys_mounted_getmntent2 = yes; then |
85 | ac_list_mounted_fs=found | 135 | ac_list_mounted_fs=found |
86 | AC_DEFINE_UNQUOTED(MOUNTED_GETMNTENT2, 1, | 136 | AC_DEFINE(MOUNTED_GETMNTENT2, 1, |
87 | [Define if there is a function named getmntent for reading the list of | 137 | [Define if there is a function named getmntent for reading the list of |
88 | mounted filesystems, and that function takes two arguments. (SVR4)]) | 138 | mounted filesystems, and that function takes two arguments. (SVR4)]) |
89 | fi | 139 | fi |
90 | fi | 140 | fi |
91 | 141 | ||
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 | |||
96 | fi | 142 | fi |
97 | 143 | ||
98 | if test -z "$ac_list_mounted_fs"; then | 144 | if test -z "$ac_list_mounted_fs"; then |
99 | # DEC Alpha running OSF/1. | 145 | # DEC Alpha running OSF/1, and Apple Darwin 1.3. |
146 | # powerpc-apple-darwin1.3.7 needs sys/param.h sys/ucred.h sys/fs_types.h | ||
147 | |||
100 | AC_MSG_CHECKING([for getfsstat function]) | 148 | AC_MSG_CHECKING([for getfsstat function]) |
101 | AC_CACHE_VAL(fu_cv_sys_mounted_getsstat, | 149 | AC_CACHE_VAL(fu_cv_sys_mounted_getfsstat, |
102 | [AC_TRY_LINK([ | 150 | [AC_TRY_LINK([ |
103 | #include <sys/types.h> | 151 | #include <sys/types.h> |
104 | #include <sys/mount.h> | 152 | #if HAVE_STRUCT_FSSTAT_F_FSTYPENAME |
105 | #include <sys/fs_types.h>], | 153 | # define FS_TYPE(Ent) ((Ent).f_fstypename) |
154 | #else | ||
155 | # define FS_TYPE(Ent) mnt_names[(Ent).f_type] | ||
156 | #endif | ||
157 | ]$getfsstat_includes | ||
158 | , | ||
106 | [struct statfs *stats; | 159 | [struct statfs *stats; |
107 | int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); ], | 160 | int numsys = getfsstat ((struct statfs *)0, 0L, MNT_WAIT); |
108 | fu_cv_sys_mounted_getsstat=yes, | 161 | char *t = FS_TYPE (*stats); ], |
109 | fu_cv_sys_mounted_getsstat=no)]) | 162 | fu_cv_sys_mounted_getfsstat=yes, |
110 | AC_MSG_RESULT($fu_cv_sys_mounted_getsstat) | 163 | fu_cv_sys_mounted_getfsstat=no)]) |
111 | if test $fu_cv_sys_mounted_getsstat = yes; then | 164 | AC_MSG_RESULT($fu_cv_sys_mounted_getfsstat) |
165 | if test $fu_cv_sys_mounted_getfsstat = yes; then | ||
112 | ac_list_mounted_fs=found | 166 | ac_list_mounted_fs=found |
113 | AC_DEFINE_UNQUOTED(MOUNTED_GETFSSTAT, 1, | 167 | AC_DEFINE(MOUNTED_GETFSSTAT, 1, |
114 | [Define if there is a function named getfsstat for reading the | 168 | [Define if there is a function named getfsstat for reading the |
115 | list of mounted filesystems. (DEC Alpha running OSF/1)]) | 169 | list of mounted filesystems. (DEC Alpha running OSF/1)]) |
116 | fi | 170 | fi |
117 | fi | 171 | fi |
118 | 172 | ||
119 | if test -z "$ac_list_mounted_fs"; then | 173 | if 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_UNQUOTED(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 | ||
134 | fi | ||
135 | |||
136 | if test -z "$ac_list_mounted_fs"; then | ||
137 | # SVR3 | 174 | # SVR3 |
138 | AC_MSG_CHECKING([for FIXME existence of three headers]) | 175 | AC_MSG_CHECKING([for FIXME existence of three headers]) |
139 | AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, | 176 | AC_CACHE_VAL(fu_cv_sys_mounted_fread_fstyp, |
@@ -146,7 +183,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
146 | AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) | 183 | AC_MSG_RESULT($fu_cv_sys_mounted_fread_fstyp) |
147 | if test $fu_cv_sys_mounted_fread_fstyp = yes; then | 184 | if test $fu_cv_sys_mounted_fread_fstyp = yes; then |
148 | ac_list_mounted_fs=found | 185 | ac_list_mounted_fs=found |
149 | AC_DEFINE_UNQUOTED(MOUNTED_FREAD_FSTYP, 1, | 186 | AC_DEFINE(MOUNTED_FREAD_FSTYP, 1, |
150 | [Define if (like SVR2) there is no specific function for reading the | 187 | [Define if (like SVR2) there is no specific function for reading the |
151 | list of mounted filesystems, and your system has these header files: | 188 | list of mounted filesystems, and your system has these header files: |
152 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) | 189 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) |
@@ -158,21 +195,16 @@ if test -z "$ac_list_mounted_fs"; then | |||
158 | AC_MSG_CHECKING([for getmntinfo function]) | 195 | AC_MSG_CHECKING([for getmntinfo function]) |
159 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, | 196 | AC_CACHE_VAL(fu_cv_sys_mounted_getmntinfo, |
160 | [ | 197 | [ |
161 | ok= | 198 | test "$ac_cv_func_getmntinfo" = yes \ |
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 \ | 199 | && fu_cv_sys_mounted_getmntinfo=yes \ |
168 | || fu_cv_sys_mounted_getmntinfo=no | 200 | || fu_cv_sys_mounted_getmntinfo=no |
169 | ]) | 201 | ]) |
170 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) | 202 | AC_MSG_RESULT($fu_cv_sys_mounted_getmntinfo) |
171 | if test $fu_cv_sys_mounted_getmntinfo = yes; then | 203 | if test $fu_cv_sys_mounted_getmntinfo = yes; then |
172 | ac_list_mounted_fs=found | 204 | ac_list_mounted_fs=found |
173 | AC_DEFINE_UNQUOTED(MOUNTED_GETMNTINFO, 1, | 205 | AC_DEFINE(MOUNTED_GETMNTINFO, 1, |
174 | [Define if there is a function named getmntinfo for reading the | 206 | [Define if there is a function named getmntinfo for reading the |
175 | list of mounted filesystems. (4.4BSD)]) | 207 | list of mounted filesystems. (4.4BSD, Darwin)]) |
176 | fi | 208 | fi |
177 | fi | 209 | fi |
178 | 210 | ||
@@ -188,7 +220,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
188 | AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) | 220 | AC_MSG_RESULT($fu_cv_sys_mounted_getmnt) |
189 | if test $fu_cv_sys_mounted_getmnt = yes; then | 221 | if test $fu_cv_sys_mounted_getmnt = yes; then |
190 | ac_list_mounted_fs=found | 222 | ac_list_mounted_fs=found |
191 | AC_DEFINE_UNQUOTED(MOUNTED_GETMNT, 1, | 223 | AC_DEFINE(MOUNTED_GETMNT, 1, |
192 | [Define if there is a function named getmnt for reading the list of | 224 | [Define if there is a function named getmnt for reading the list of |
193 | mounted filesystems. (Ultrix)]) | 225 | mounted filesystems. (Ultrix)]) |
194 | fi | 226 | fi |
@@ -209,7 +241,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
209 | AC_MSG_RESULT($fu_result) | 241 | AC_MSG_RESULT($fu_result) |
210 | if test $fu_result = yes; then | 242 | if test $fu_result = yes; then |
211 | ac_list_mounted_fs=found | 243 | ac_list_mounted_fs=found |
212 | AC_DEFINE_UNQUOTED(MOUNTED_FS_STAT_DEV, 1, | 244 | AC_DEFINE(MOUNTED_FS_STAT_DEV, 1, |
213 | [Define if there are functions named next_dev and fs_stat_dev for | 245 | [Define if there are functions named next_dev and fs_stat_dev for |
214 | reading the list of mounted filesystems. (BeOS)]) | 246 | reading the list of mounted filesystems. (BeOS)]) |
215 | fi | 247 | fi |
@@ -225,7 +257,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
225 | AC_MSG_RESULT($fu_cv_sys_mounted_fread) | 257 | AC_MSG_RESULT($fu_cv_sys_mounted_fread) |
226 | if test $fu_cv_sys_mounted_fread = yes; then | 258 | if test $fu_cv_sys_mounted_fread = yes; then |
227 | ac_list_mounted_fs=found | 259 | ac_list_mounted_fs=found |
228 | AC_DEFINE_UNQUOTED(MOUNTED_FREAD, 1, | 260 | AC_DEFINE(MOUNTED_FREAD, 1, |
229 | [Define if there is no specific function for reading the list of | 261 | [Define if there is no specific function for reading the list of |
230 | mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ]) | 262 | mounted filesystems. fread will be used to read /etc/mnttab. (SVR2) ]) |
231 | fi | 263 | fi |
@@ -237,7 +269,6 @@ if test -z "$ac_list_mounted_fs"; then | |||
237 | # Can't build mountlist.c or anything that needs its functions | 269 | # Can't build mountlist.c or anything that needs its functions |
238 | fi | 270 | fi |
239 | 271 | ||
240 | dnl AS_IF([test $ac_list_mounted_fs = found], [$1], [$2]) | 272 | AS_IF([test $ac_list_mounted_fs = found], [$1], [$2]) |
241 | if test $ac_list_mounted_fs = found ; then [$1] ; else [$2] ; fi | ||
242 | 273 | ||
243 | ]) | 274 | ]) |