xref: /netbsd-src/external/bsd/am-utils/dist/m4/macros/check_mnttab_file_name.m4 (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1dnl ######################################################################
2dnl Find name of mount table file, and define it as MNTTAB_FILE_NAME
3dnl
4dnl Solaris defines MNTTAB as /etc/mnttab, the file where /sbin/mount
5dnl stores its cache of mounted filesystems.  But under SunOS, the same
6dnl macro MNTTAB, is defined as the _source_ of filesystems to mount, and
7dnl is set to /etc/fstab.  That is why I have to first check out
8dnl if MOUNTED exists, and if not, check for the MNTTAB macro.
9dnl
10AC_DEFUN([AMU_CHECK_MNTTAB_FILE_NAME],
11[
12AC_CACHE_CHECK(for name of mount table file name,
13ac_cv_mnttab_file_name,
14[
15# expand cpp value for MNTTAB
16AMU_EXPAND_CPP_STRING(
17AMU_MOUNT_HEADERS(
18[
19/* see M4 comment at the top of the definition of this macro */
20#ifdef MOUNTED
21# define _MNTTAB_FILE_NAME MOUNTED
22# else /* not MOUNTED */
23# ifdef MNTTAB
24#  define _MNTTAB_FILE_NAME MNTTAB
25# endif /* MNTTAB */
26#endif /* not MOUNTED */
27]),
28_MNTTAB_FILE_NAME,
29[ ac_cv_mnttab_file_name=$value
30],
31[
32ac_cv_mnttab_file_name=notfound
33# check explicitly for /etc/mnttab
34if test "$ac_cv_mnttab_file_name" = notfound
35then
36  if test -f /etc/mnttab
37  then
38    ac_cv_mnttab_file_name="/etc/mnttab"
39  fi
40fi
41# check explicitly for /etc/mtab
42if test "$ac_cv_mnttab_file_name" = notfound
43then
44  if test -f /etc/mtab
45  then
46    ac_cv_mnttab_file_name="/etc/mtab"
47  fi
48fi
49])
50])
51# test value and create macro as needed
52if test "$ac_cv_mnttab_file_name" != notfound
53then
54  AC_DEFINE_UNQUOTED(MNTTAB_FILE_NAME, "$ac_cv_mnttab_file_name")
55fi
56])
57dnl ======================================================================
58