xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_mnt2_pcfs_opt.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1dnl ######################################################################
2dnl Find PCFS-specific mount(2) options (hex numbers)
3dnl Usage: AMU_CHECK_MNT2_PCFS_OPT(<fs>)
4dnl Check if there is an entry for MS_<fs> or M_<fs> in sys/mntent.h or
5dnl mntent.h, then define MNT2_PCFS_OPT_<fs> to the hex number.
6AC_DEFUN([AMU_CHECK_MNT2_PCFS_OPT],
7[
8# what name to give to the fs
9ac_fs_name=$1
10# store variable name of fs
11ac_upcase_fs_name=`echo $ac_fs_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
12ac_safe=MNT2_PCFS_OPT_$ac_upcase_fs_name
13# check for cache and set it if needed
14AMU_CACHE_CHECK_DYNAMIC(for PCFS-specific mount(2) option $ac_fs_name,
15ac_cv_mnt2_pcfs_opt_$ac_fs_name,
16[
17# undefine by default
18eval "ac_cv_mnt2_pcfs_opt_$ac_fs_name=notfound"
19value=notfound
20
21# first, try MS_* (most systems).  Must be the first test!
22if test "$value" = notfound
23then
24AMU_EXPAND_CPP_HEX(
25AMU_MOUNT_HEADERS
26, MS_$ac_upcase_fs_name)
27fi
28
29# if failed, try MNT_* (bsd44 systems)
30if test "$value" = notfound
31then
32AMU_EXPAND_CPP_HEX(
33AMU_MOUNT_HEADERS
34, MNT_$ac_upcase_fs_name)
35fi
36
37# if failed, try MS_*  as an integer (linux systems)
38if test "$value" = notfound
39then
40AMU_EXPAND_CPP_INT(
41AMU_MOUNT_HEADERS
42, MS_$ac_upcase_fs_name)
43fi
44
45# If failed try M_* (must be last test since svr4 systems define M_DATA etc.
46# in <sys/stream.h>
47# This test was off for now, because of the conflicts with other systems.
48# but I turned it back on by faking the inclusion of <sys/stream.h> already.
49if test "$value" = notfound
50then
51AMU_EXPAND_CPP_HEX(
52#ifndef _sys_stream_h
53# define _sys_stream_h
54#endif /* not _sys_stream_h */
55#ifndef _SYS_STREAM_H
56# define _SYS_STREAM_H
57#endif	/* not _SYS_STREAM_H */
58AMU_MOUNT_HEADERS
59, M_$ac_upcase_fs_name)
60fi
61
62# if failed, try MSDOSFSMNT_* as a hex (bsd44 systems)
63if test "$value" = notfound
64then
65AMU_EXPAND_CPP_HEX(
66AMU_MOUNT_HEADERS
67, MSDOSFSMNT_$ac_upcase_fs_name)
68fi
69
70# set cache variable to value
71eval "ac_cv_mnt2_pcfs_opt_$ac_fs_name=$value"
72])
73# outside cache check, if ok, define macro
74ac_tmp=`eval echo '$''{ac_cv_mnt2_pcfs_opt_'$ac_fs_name'}'`
75if test "${ac_tmp}" != notfound
76then
77  AC_DEFINE_UNQUOTED($ac_safe, $ac_tmp)
78fi
79])
80dnl ======================================================================
81
82dnl ######################################################################
83dnl run AMU_CHECK_MNT2_PCFS_OPT on each argument given
84dnl Usage: AMU_CHECK_MNT2_PCFS_OPTS(arg arg arg ...)
85AC_DEFUN([AMU_CHECK_MNT2_PCFS_OPTS],
86[
87for ac_tmp_arg in $1
88do
89AMU_CHECK_MNT2_PCFS_OPT($ac_tmp_arg)
90done
91])
92dnl ======================================================================
93