1 dnl ######################################################################
2 dnl check if a filesystem type exists (if its header files exist)
3 dnl Usage: AC_CHECK_FS_MNTENT(<filesystem>, [<fssymbol>])
5 dnl Check in some headers for MNTTYPE_<filesystem> macro. If that exist,
6 dnl then define HAVE_FS_<filesystem>. If <fssymbol> exits, then define
7 dnl HAVE_FS_<fssymbol> instead...
8 AC_DEFUN([AMU_CHECK_FS_MNTENT],
10 # find what name to give to the fs
14 ac_fs_as_name=" (from: $1)"
19 # store variable name of filesystem
20 ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
21 ac_safe=HAVE_FS_$ac_upcase_fs_name
22 # check for cache and set it if needed
23 AMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name$ac_fs_as_name mntent definition,
27 eval "ac_cv_fs_$ac_fs_name=no"
30 ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
32 # first look for MNTTYPE_*
36 #ifdef MNTTYPE_$ac_upcase_fs_symbol
38 #endif /* MNTTYPE_$ac_upcase_fs_symbol */
39 ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
40 # check if need to terminate "for" loop
41 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
46 # now try to look for MOUNT_ macro
50 #ifdef MOUNT_$ac_upcase_fs_symbol
52 #endif /* MOUNT_$ac_upcase_fs_symbol */
53 ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
54 # check if need to terminate "for" loop
55 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
60 # now try to look for MNT_ macro
64 #ifdef MNT_$ac_upcase_fs_symbol
66 #endif /* MNT_$ac_upcase_fs_symbol */
67 ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
68 # check if need to terminate "for" loop
69 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
74 # now try to look for GT_ macro (ultrix)
78 #ifdef GT_$ac_upcase_fs_symbol
80 #endif /* GT_$ac_upcase_fs_symbol */
81 ]), [eval "ac_cv_fs_$ac_fs_name=yes"], [eval "ac_cv_fs_$ac_fs_name=no"] )
82 # check if need to terminate "for" loop
83 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" != no
88 # look for a loadable filesystem module (linux)
89 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.ko
91 eval "ac_cv_fs_$ac_fs_name=yes"
94 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o
96 eval "ac_cv_fs_$ac_fs_name=yes"
100 # look for a loadable filesystem module (linux 2.4+)
101 if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.ko
103 eval "ac_cv_fs_$ac_fs_name=yes"
106 if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o
108 eval "ac_cv_fs_$ac_fs_name=yes"
112 # look for a loadable filesystem module (linux redhat-5.1)
113 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.ko
115 eval "ac_cv_fs_$ac_fs_name=yes"
118 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.o
120 eval "ac_cv_fs_$ac_fs_name=yes"
124 # in addition look for statically compiled filesystem (linux)
125 if egrep "[[^a-zA-Z0-9_]]$ac_fs_tmp$" /proc/filesystems >/dev/null 2>&1
127 eval "ac_cv_fs_$ac_fs_name=yes"
131 if test "$ac_fs_tmp" = "nfs3" -a "$ac_cv_header_linux_nfs_mount_h" = "yes"
134 # in 6.1, which has fallback to v2/udp, we might want
135 # to always use version 4.
136 # in 6.0 we do not have much choice
138 let nfs_mount_version="`grep NFS_MOUNT_VERSION /usr/include/linux/nfs_mount.h | awk '{print $''3;}'`"
139 if test $nfs_mount_version -ge 4
141 eval "ac_cv_fs_$ac_fs_name=yes"
146 # run a test program for bsdi3
149 #include <sys/param.h>
150 #include <sys/mount.h>
155 i = getvfsbyname("$ac_fs_tmp", &vf);
161 ], [eval "ac_cv_fs_$ac_fs_name=yes"
168 # check if need to define variable
169 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" = yes
171 AC_DEFINE_UNQUOTED($ac_safe)
172 # append ops_<fs>.o object to AMD_FS_OBJS for automatic compilation
173 # if first time we add something to this list, then also tell autoconf
174 # to replace instances of it in Makefiles.
175 if test -z "$AMD_FS_OBJS"
177 AMD_FS_OBJS="ops_${ac_fs_name}.o"
178 AC_SUBST(AMD_FS_OBJS)
180 # since this object file could have already been added before
181 # we need to ensure we do not add it twice.
182 case "${AMD_FS_OBJS}" in
183 *ops_${ac_fs_name}.o* ) ;;
185 AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o"
191 dnl ======================================================================