| 1 | dnl @synopsis AX_CHECK_MOUNT_POINT([ACTION-IF-TRUE], [ACTION-IF-FALSE]) |
|---|
| 2 | dnl |
|---|
| 3 | dnl This macro will find out how to get mount point information if possible. |
|---|
| 4 | dnl |
|---|
| 5 | dnl The following defines will be set as appropriate: |
|---|
| 6 | dnl HAVE_MOUNTS |
|---|
| 7 | dnl HAVE_MNTENT_H |
|---|
| 8 | dnl HAVE_SYS_MNTTAB_H |
|---|
| 9 | dnl HAVE_SYS_MOUNT_H |
|---|
| 10 | dnl HAVE_STRUCT_MNTENT_MNT_DIR |
|---|
| 11 | dnl HAVE_STRUCT_MNTTAB_MNT_MOUNTP |
|---|
| 12 | dnl HAVE_STRUCT_STATFS_F_MNTONNAME |
|---|
| 13 | dnl HAVE_STRUCT_STATVFS_F_MNTONNAME |
|---|
| 14 | dnl Also ACTION-IF-TRUE and ACTION-IF-FALSE are run as appropriate |
|---|
| 15 | dnl |
|---|
| 16 | dnl @category C |
|---|
| 17 | dnl @author Martin Ebourne |
|---|
| 18 | dnl @version 2005/07/01 |
|---|
| 19 | dnl @license AllPermissive |
|---|
| 20 | |
|---|
| 21 | AC_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 |
|---|