1dnl ###################################################################### 2dnl check if a filesystem type exists (if its header files exist) 3dnl Usage: AC_CHECK_FS_MNTENT(<filesystem>, [<fssymbol>]) 4dnl 5dnl Check in some headers for MNTTYPE_<filesystem> macro. If that exist, 6dnl then define HAVE_FS_<filesystem>. If <fssymbol> exits, then define 7dnl HAVE_FS_<fssymbol> instead... 8AC_DEFUN([AMU_CHECK_FS_MNTENT], 9[ 10# find what name to give to the fs 11if test -n "$2" 12then 13 ac_fs_name=$2 14 ac_fs_as_name=" (from: $1)" 15else 16 ac_fs_name=$1 17 ac_fs_as_name="" 18fi 19# store variable name of filesystem 20ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 21ac_safe=HAVE_FS_$ac_upcase_fs_name 22# check for cache and set it if needed 23AMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name$ac_fs_as_name mntent definition, 24ac_cv_fs_$ac_fs_name, 25[ 26# assume not found 27eval "ac_cv_fs_$ac_fs_name=no" 28for ac_fs_tmp in $1 29do 30 ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 31 32 # first look for MNTTYPE_* 33 AC_EGREP_CPP(yes, 34 AMU_MOUNT_HEADERS( 35 [ 36#ifdef MNTTYPE_$ac_upcase_fs_symbol 37 yes 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 42 then 43 break 44 fi 45 46 # now try to look for MOUNT_ macro 47 AC_EGREP_CPP(yes, 48 AMU_MOUNT_HEADERS( 49 [ 50#ifdef MOUNT_$ac_upcase_fs_symbol 51 yes 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 56 then 57 break 58 fi 59 60 # now try to look for MNT_ macro 61 AC_EGREP_CPP(yes, 62 AMU_MOUNT_HEADERS( 63 [ 64#ifdef MNT_$ac_upcase_fs_symbol 65 yes 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 70 then 71 break 72 fi 73 74 # now try to look for GT_ macro (ultrix) 75 AC_EGREP_CPP(yes, 76 AMU_MOUNT_HEADERS( 77 [ 78#ifdef GT_$ac_upcase_fs_symbol 79 yes 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 84 then 85 break 86 fi 87 88 # look for a loadable filesystem module (linux) 89 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.ko 90 then 91 eval "ac_cv_fs_$ac_fs_name=yes" 92 break 93 fi 94 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o 95 then 96 eval "ac_cv_fs_$ac_fs_name=yes" 97 break 98 fi 99 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 102 then 103 eval "ac_cv_fs_$ac_fs_name=yes" 104 break 105 fi 106 if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o 107 then 108 eval "ac_cv_fs_$ac_fs_name=yes" 109 break 110 fi 111 112 # look for a loadable filesystem module (linux redhat-5.1) 113 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.ko 114 then 115 eval "ac_cv_fs_$ac_fs_name=yes" 116 break 117 fi 118 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.o 119 then 120 eval "ac_cv_fs_$ac_fs_name=yes" 121 break 122 fi 123 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 126 then 127 eval "ac_cv_fs_$ac_fs_name=yes" 128 break 129 fi 130 131 if test "$ac_fs_tmp" = "nfs3" -a "$ac_cv_header_linux_nfs_mount_h" = "yes" 132 then 133 # hack hack hack 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 137 # 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 140 then 141 eval "ac_cv_fs_$ac_fs_name=yes" 142 break 143 fi 144 fi 145 146 # run a test program for bsdi3 147 AC_TRY_RUN( 148 [ 149#include <sys/param.h> 150#include <sys/mount.h> 151main() 152{ 153 int i; 154 struct vfsconf vf; 155 i = getvfsbyname("$ac_fs_tmp", &vf); 156 if (i < 0) 157 exit(1); 158 else 159 exit(0); 160} 161 ], [eval "ac_cv_fs_$ac_fs_name=yes" 162 break 163 ] 164 ) 165 166done 167]) 168# check if need to define variable 169if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" = yes 170then 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" 176 then 177 AMD_FS_OBJS="ops_${ac_fs_name}.o" 178 AC_SUBST(AMD_FS_OBJS) 179 else 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* ) ;; 184 * ) 185 AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o" 186 ;; 187 esac 188 fi 189fi 190]) 191dnl ====================================================================== 192