source: box/trunk/infrastructure/m4/ax_check_mount_point.m4 @ 486

Revision 486, 1.8 KB checked in by martin, 6 years ago (diff)

Patch from Per Thomsen to detect statvfs. This is used by recent versions of NetBSD in preference to statfs.

  • Property svn:eol-style set to native
Line 
1dnl @synopsis AX_CHECK_MOUNT_POINT([ACTION-IF-TRUE], [ACTION-IF-FALSE])
2dnl
3dnl This macro will find out how to get mount point information if possible.
4dnl
5dnl The following defines will be set as appropriate:
6dnl HAVE_MOUNTS
7dnl HAVE_MNTENT_H
8dnl HAVE_SYS_MNTTAB_H
9dnl HAVE_SYS_MOUNT_H
10dnl HAVE_STRUCT_MNTENT_MNT_DIR
11dnl HAVE_STRUCT_MNTTAB_MNT_MOUNTP
12dnl HAVE_STRUCT_STATFS_F_MNTONNAME
13dnl HAVE_STRUCT_STATVFS_F_MNTONNAME
14dnl Also ACTION-IF-TRUE and ACTION-IF-FALSE are run as appropriate
15dnl
16dnl @category C
17dnl @author Martin Ebourne
18dnl @version 2005/07/01
19dnl @license AllPermissive
20
21AC_DEFUN([AX_CHECK_MOUNT_POINT], [
22  AC_CHECK_FUNCS([getmntent statfs])
23  AC_CHECK_HEADERS([sys/param.h])
24  AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/mount.h],,, [[
25    #include <stdio.h>
26    #ifdef HAVE_SYS_PARAM_H
27      #include <sys/param.h>
28    #endif
29    ]])
30  # BSD
31  AC_CHECK_MEMBERS([struct statfs.f_mntonname],,, [[
32    #ifdef HAVE_SYS_PARAM_H
33      #include <sys/param.h>
34    #endif
35    #include <sys/mount.h>
36    ]])
37  # NetBSD
38  AC_CHECK_MEMBERS([struct statvfs.f_mntonname],,, [[
39    #ifdef HAVE_SYS_PARAM_H
40      #include <sys/param.h>
41    #endif
42    #include <sys/mount.h>
43    ]])
44  # Linux
45  AC_CHECK_MEMBERS([struct mntent.mnt_dir],,, [[#include <mntent.h>]])
46  # Solaris
47  AC_CHECK_MEMBERS([struct mnttab.mnt_mountp],,, [[
48    #include <stdio.h>
49    #include <sys/mnttab.h>
50    ]])
51  if test "x$ac_cv_member_struct_statfs_f_mntonname" = "xyes" || \
52     test "x$ac_cv_member_struct_statvfs_f_mntonname" = "xyes" || \
53     test "x$ac_cv_member_struct_mntent_mnt_dir" = "xyes" || \
54     test "x$ac_cv_member_struct_mnttab_mnt_mountp" = "xyes"
55  then
56    AC_DEFINE([HAVE_MOUNTS], [1], [Define to 1 if this platform supports mounts])
57    m4_ifvaln([$1],[$1],[:])dnl
58    m4_ifvaln([$2],[else $2])dnl
59  fi
60  ])dnl
Note: See TracBrowser for help on using the repository browser.