xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_fs_headers.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristosdnl ######################################################################
2*a53f50b9Schristosdnl check if a filesystem exists (if any of its header files exist).
3*a53f50b9Schristosdnl Usage: AC_CHECK_FS_HEADERS(<headers>..., <fs>, [<fssymbol>])
4*a53f50b9Schristosdnl Check if any of the headers <headers> exist.  If any exist, then
5*a53f50b9Schristosdnl define HAVE_FS_<fs>.  If <fssymbol> exits, then define
6*a53f50b9Schristosdnl HAVE_FS_<fssymbol> instead...
7*a53f50b9SchristosAC_DEFUN([AMU_CHECK_FS_HEADERS],
8*a53f50b9Schristos[
9*a53f50b9Schristos# find what name to give to the fs
10*a53f50b9Schristosif test -n "$3"
11*a53f50b9Schristosthen
12*a53f50b9Schristos  ac_fs_name=$3
13*a53f50b9Schristoselse
14*a53f50b9Schristos  ac_fs_name=$2
15*a53f50b9Schristosfi
16*a53f50b9Schristos# store variable name of fs
17*a53f50b9Schristosac_upcase_fs_name=`echo $2 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
18*a53f50b9Schristosac_fs_headers_safe=HAVE_FS_$ac_upcase_fs_name
19*a53f50b9Schristos# check for cache and set it if needed
20*a53f50b9SchristosAMU_CACHE_CHECK_DYNAMIC(for $ac_fs_name filesystem in <$1>,
21*a53f50b9Schristosac_cv_fs_header_$ac_fs_name,
22*a53f50b9Schristos[
23*a53f50b9Schristos# define to "no" by default
24*a53f50b9Schristoseval "ac_cv_fs_header_$ac_fs_name=no"
25*a53f50b9Schristos# and look to see if it was found
26*a53f50b9SchristosAC_CHECK_HEADERS($1,
27*a53f50b9Schristos[ eval "ac_cv_fs_header_$ac_fs_name=yes"
28*a53f50b9Schristos  break
29*a53f50b9Schristos])])
30*a53f50b9Schristos# check if need to define variable
31*a53f50b9Schristosif test "`eval echo '$''{ac_cv_fs_header_'$ac_fs_name'}'`" = yes
32*a53f50b9Schristosthen
33*a53f50b9Schristos  AC_DEFINE_UNQUOTED($ac_fs_headers_safe)
34*a53f50b9Schristos# append ops_<fs>.o object to AMD_FS_OBJS for automatic compilation
35*a53f50b9Schristos# if first time we add something to this list, then also tell autoconf
36*a53f50b9Schristos# to replace instances of it in Makefiles.
37*a53f50b9Schristos  if test -z "$AMD_FS_OBJS"
38*a53f50b9Schristos  then
39*a53f50b9Schristos    AMD_FS_OBJS="ops_${ac_fs_name}.o"
40*a53f50b9Schristos    AC_SUBST(AMD_FS_OBJS)
41*a53f50b9Schristos  else
42*a53f50b9Schristos    # since this object file could have already been added before
43*a53f50b9Schristos    # we need to ensure we do not add it twice.
44*a53f50b9Schristos    case "${AMD_FS_OBJS}" in
45*a53f50b9Schristos      *ops_${ac_fs_name}.o* ) ;;
46*a53f50b9Schristos      * )
47*a53f50b9Schristos        AMD_FS_OBJS="$AMD_FS_OBJS ops_${ac_fs_name}.o"
48*a53f50b9Schristos      ;;
49*a53f50b9Schristos    esac
50*a53f50b9Schristos  fi
51*a53f50b9Schristosfi
52*a53f50b9Schristos])
53*a53f50b9Schristosdnl ======================================================================
54