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