1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
dnl ######################################################################
dnl check if a filesystem type exists (if its header files exist)
dnl Usage: AC_CHECK_FS_MNTENT(<filesystem>, [<fssymbol>])
dnl
dnl Check in some headers for MNTTYPE_<filesystem> macro. If that exist,
dnl then define HAVE_FS_<filesystem>. If <fssymbol> exits, then define
dnl HAVE_FS_<fssymbol> instead...
AC_DEFUN(AMU_CHECK_FS_MNTENT,
[
# find what name to give to the fs
if test -n "$2"
then
ac_fs_name=$2
ac_fs_as_name=" (from: $1)"
else
ac_fs_name=$1
ac_fs_as_name=""
fi
# store variable name of filesystem
ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
ac_safe=HAVE_FS_$ac_upcase_fs_name
# check for cache and set it if needed
AMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name$ac_fs_as_name mntent definition,
ac_cv_fs_$ac_fs_name,
[
# assume not found
eval "ac_cv_fs_$ac_fs_name=no"
for ac_fs_tmp in $1
do
ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
# first look for MNTTYPE_*
AC_EGREP_CPP(yes,
AMU_MOUNT_HEADERS(
[
#ifdef MNTTYPE_$ac_upcase_fs_symbol
yes
#endif /* MNTTYPE_$ac_upcase_fs_symbol */
]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
# check if need to terminate "for" loop
if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
then
break
fi
# now try to look for MOUNT_ macro
AC_EGREP_CPP(yes,
AMU_MOUNT_HEADERS(
[
#ifdef MOUNT_$ac_upcase_fs_symbol
yes
#endif /* MOUNT_$ac_upcase_fs_symbol */
]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
# check if need to terminate "for" loop
if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
then
break
fi
# now try to look for MNT_ macro
AC_EGREP_CPP(yes,
AMU_MOUNT_HEADERS(
[
#ifdef MNT_$ac_upcase_fs_symbol
yes
#endif /* MNT_$ac_upcase_fs_symbol */
]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
# check if need to terminate "for" loop
if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
then
break
fi
# now try to look for GT_ macro (ultrix)
AC_EGREP_CPP(yes,
AMU_MOUNT_HEADERS(
[
#ifdef GT_$ac_upcase_fs_symbol
yes
#endif /* GT_$ac_upcase_fs_symbol */
]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
# check if need to terminate "for" loop
if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
then
break
fi
# look for a loadable filesystem module (linux)
if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o
then
eval "ac_cv_fs_$ac_fs_name=yes"
break
fi
# look for a loadable filesystem module (linux 2.4+)
if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o
then
eval "ac_cv_fs_$ac_fs_name=yes"
break
fi
# look for a loadable filesystem module (linux redhat-5.1)
if test -f /lib/modules/preferred/fs/$ac_fs_tmp.o
then
eval "ac_cv_fs_$ac_fs_name=yes"
break
fi
# in addition look for statically compiled filesystem (linux)
if egrep "[[^a-zA-Z0-9_]]$ac_fs_tmp$" /proc/filesystems >/dev/null 2>&1
then
eval "ac_cv_fs_$ac_fs_name=yes"
break
fi
if test "$ac_fs_tmp" = "nfs3" -a "$ac_cv_header_linux_nfs_mount_h" = "yes"
then
# hack hack hack
# in 6.1, which has fallback to v2/udp, we might want
# to always use version 4.
# in 6.0 we do not have much choice
#
let nfs_mount_version="`grep NFS_MOUNT_VERSION /usr/include/linux/nfs_mount.h | awk '{print $''3;}'`"
if test $nfs_mount_version -ge 4
then
eval "ac_cv_fs_$ac_fs_name=yes"
break
fi
fi
# run a test program for bsdi3
AC_TRY_RUN(
[
#include <sys/param.h>
#include <sys/mount.h>
main()
{
int i;
struct vfsconf vf;
i = getvfsbyname("$ac_fs_tmp", &vf);
if (i < 0)
exit(1);
else
exit(0);
}
], [eval "ac_cv_fs_$ac_fs_name=yes"
break
]
)
done
])
# check if need to define variable
if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" = yes
then
AC_DEFINE_UNQUOTED($ac_safe)
# append ops_<fs>.o object to AMD_FS_OBJS for automatic compilation
# if first time we add something to this list, then also tell autoconf
# to replace instances of it in Makefiles.
if test -z "$AMD_FS_OBJS"
then
AMD_FS_OBJS="ops_${ac_fs_name}.o"
AC_SUBST(AMD_FS_OBJS)
else
# since this object file could have already been added before
# we need to ensure we do not add it twice.
case "${AMD_FS_OBJS}" in
*ops_${ac_fs_name}.o* ) ;;
* )
AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o"
;;
esac
fi
fi
])
dnl ======================================================================
|