xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_amu_fs.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristosdnl ######################################################################
2*a53f50b9Schristosdnl check if an automounter filesystem exists (it almost always does).
3*a53f50b9Schristosdnl Usage: AC_CHECK_AMU_FS(<fs>, <msg>, [<depfs>])
4*a53f50b9Schristosdnl Print the message in <msg>, and declare HAVE_AMU_FS_<fs> true.
5*a53f50b9Schristosdnl If <depfs> is defined, then define this filesystem as tru only of the
6*a53f50b9Schristosdnl filesystem for <depfs> is true.
7*a53f50b9SchristosAC_DEFUN([AMU_CHECK_AMU_FS],
8*a53f50b9Schristos[
9*a53f50b9Schristos# store variable name of fs
10*a53f50b9Schristosac_upcase_am_fs_name=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
11*a53f50b9Schristosac_safe=HAVE_AMU_FS_$ac_upcase_am_fs_name
12*a53f50b9Schristos# check for cache and set it if needed
13*a53f50b9SchristosAMU_CACHE_CHECK_DYNAMIC(for $2 filesystem ($1),
14*a53f50b9Schristosac_cv_am_fs_$1,
15*a53f50b9Schristos[
16*a53f50b9Schristos# true by default
17*a53f50b9Schristoseval "ac_cv_am_fs_$1=yes"
18*a53f50b9Schristos# if <depfs> exists but is defined to "no", set this filesystem to no.
19*a53f50b9Schristosif test -n "$3"
20*a53f50b9Schristosthen
21*a53f50b9Schristos  # flse by default if arg 3 was supplied
22*a53f50b9Schristos  eval "ac_cv_am_fs_$1=no"
23*a53f50b9Schristos  if test "`eval echo '$''{ac_cv_fs_'$3'}'`" = yes
24*a53f50b9Schristos  then
25*a53f50b9Schristos    eval "ac_cv_am_fs_$1=yes"
26*a53f50b9Schristos  fi
27*a53f50b9Schristos  # some filesystems do not have a mnttab entry, but exist based on headers
28*a53f50b9Schristos  if test "`eval echo '$''{ac_cv_fs_header_'$3'}'`" = yes
29*a53f50b9Schristos  then
30*a53f50b9Schristos    eval "ac_cv_am_fs_$1=yes"
31*a53f50b9Schristos  fi
32*a53f50b9Schristosfi
33*a53f50b9Schristos])
34*a53f50b9Schristos# check if need to define variable
35*a53f50b9Schristosif test "`eval echo '$''{ac_cv_am_fs_'$1'}'`" = yes
36*a53f50b9Schristosthen
37*a53f50b9Schristos  AC_DEFINE_UNQUOTED($ac_safe)
38*a53f50b9Schristosfi
39*a53f50b9Schristos])
40*a53f50b9Schristosdnl ======================================================================
41