1dnl ###################################################################### 2dnl check the string type of the name of a filesystem mount table entry. 3dnl Usage: AC_CHECK_MOUNT_TYPE(<fs>, [fssymbol]) 4dnl Check if there is an entry for MNTTYPE_<fs> in sys/mntent.h and mntent.h 5dnl define MOUNT_TYPE_<fs> to the string name (e.g., "nfs"). If <fssymbol> 6dnl exist, then define MOUNT_TYPE_<fssymbol> instead. If <fssymbol> is 7dnl defined, then <fs> can be a list of fs strings to look for. 8dnl If no symbols have been defined, but the filesystem has been found 9dnl earlier, then set the mount-table type to "<fs>" anyway... 10AC_DEFUN([AMU_CHECK_MOUNT_TYPE], 11[ 12# find what name to give to the fs 13if test -n "$2" 14then 15 ac_fs_name=$2 16else 17 ac_fs_name=$1 18fi 19# prepare upper-case name of filesystem 20ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 21############################################################################## 22# check for cache and set it if needed 23AMU_CACHE_CHECK_DYNAMIC(for mount(2) type/name for $ac_fs_name filesystem, 24ac_cv_mount_type_$ac_fs_name, 25[ 26# undefine by default 27eval "ac_cv_mount_type_$ac_fs_name=notfound" 28# and look to see if it was found 29for ac_fs_tmp in $1 30do 31 32 ac_upcase_fs_symbol=`echo $ac_fs_tmp | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | tr -d '.'` 33 34 # first look for MNTTYPE_<fs> 35 AC_EGREP_CPP(yes, 36 AMU_MOUNT_HEADERS( 37 [ 38#ifdef MNTTYPE_$ac_upcase_fs_symbol 39 yes 40#endif /* MNTTYPE_$ac_upcase_fs_symbol */ 41 ]), [eval "ac_cv_mount_type_$ac_fs_name=MNTTYPE_$ac_upcase_fs_symbol"], 42 [eval "ac_cv_mount_type_$ac_fs_name=notfound"] ) 43 # check if need to terminate "for" loop 44 if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" != notfound 45 then 46 break 47 fi 48 49 # next look for MOUNT_<fs> 50 AC_EGREP_CPP(yes, 51 AMU_MOUNT_HEADERS( 52 [ 53#ifdef MOUNT_$ac_upcase_fs_symbol 54 yes 55#endif /* MOUNT_$ac_upcase_fs_symbol */ 56 ]), [eval "ac_cv_mount_type_$ac_fs_name=MOUNT_$ac_upcase_fs_symbol"], 57 [eval "ac_cv_mount_type_$ac_fs_name=notfound"] ) 58 # check if need to terminate "for" loop 59 if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" != notfound 60 then 61 break 62 fi 63 64 # next look for MNT_<fs> 65 AC_EGREP_CPP(yes, 66 AMU_MOUNT_HEADERS( 67 [ 68#ifdef MNT_$ac_upcase_fs_symbol 69 yes 70#endif /* MNT_$ac_upcase_fs_symbol */ 71 ]), [eval "ac_cv_mount_type_$ac_fs_name=MNT_$ac_upcase_fs_symbol"], 72 [eval "ac_cv_mount_type_$ac_fs_name=notfound"] ) 73 # check if need to terminate "for" loop 74 if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" != notfound 75 then 76 break 77 fi 78 79 # next look for GT_<fs> (ultrix) 80 AC_EGREP_CPP(yes, 81 AMU_MOUNT_HEADERS( 82 [ 83#ifdef GT_$ac_upcase_fs_symbol 84 yes 85#endif /* GT_$ac_upcase_fs_symbol */ 86 ]), [eval "ac_cv_mount_type_$ac_fs_name=GT_$ac_upcase_fs_symbol"], 87 [eval "ac_cv_mount_type_$ac_fs_name=notfound"] ) 88 # check if need to terminate "for" loop 89 if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" != notfound 90 then 91 break 92 fi 93 94 # look for a loadable filesystem module (linux) 95 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.ko 96 then 97 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 98 break 99 fi 100 if test -f /lib/modules/$host_os_version/fs/$ac_fs_tmp.o 101 then 102 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 103 break 104 fi 105 106 # look for a loadable filesystem module (linux 2.4+) 107 if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.ko 108 then 109 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 110 break 111 fi 112 if test -f /lib/modules/$host_os_version/kernel/fs/$ac_fs_tmp/$ac_fs_tmp.o 113 then 114 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 115 break 116 fi 117 118 # look for a loadable filesystem module (linux redhat-5.1) 119 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.ko 120 then 121 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 122 break 123 fi 124 if test -f /lib/modules/preferred/fs/$ac_fs_tmp.o 125 then 126 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 127 break 128 fi 129 130 # in addition look for statically compiled filesystem (linux) 131 if egrep "[[^a-zA-Z0-9_]]$ac_fs_tmp$" /proc/filesystems >/dev/null 2>&1 132 then 133 eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 134 break 135 fi 136 137 # run a test program for bsdi3 138 AC_TRY_RUN( 139 [ 140#include <sys/param.h> 141#include <sys/mount.h> 142main() 143{ 144 int i; 145 struct vfsconf vf; 146 i = getvfsbyname("$ac_fs_tmp", &vf); 147 if (i < 0) 148 exit(1); 149 else 150 exit(0); 151} 152 ], [eval "ac_cv_mount_type_$ac_fs_name=\\\"$ac_fs_tmp\\\"" 153 break 154 ] 155 ) 156 157done 158# check if not defined, yet the filesystem is defined 159if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" = notfound 160then 161# this should test if $ac_cv_fs_<fsname> is "yes" 162 if test "`eval echo '$''{ac_cv_fs_'$ac_fs_name'}'`" = yes || 163 test "`eval echo '$''{ac_cv_fs_header_'$ac_fs_name'}'`" = yes 164 then 165 eval "ac_cv_mount_type_$ac_fs_name=MNTTYPE_$ac_upcase_fs_name" 166 fi 167fi 168]) 169# end of cache check for ac_cv_mount_type_$ac_fs_name 170############################################################################## 171# check if need to define variable 172if test "`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'`" != notfound 173then 174 ac_safe=MOUNT_TYPE_$ac_upcase_fs_name 175 ac_tmp=`eval echo '$''{ac_cv_mount_type_'$ac_fs_name'}'` 176 AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp) 177fi 178]) 179dnl ====================================================================== 180