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