Ticket #3828: syntax: Apache Hive query language
[midnight-commander.git] / m4.include / mc-get-fs-info.m4
blob8b61ef296da93d60aff4aafc6d035217b2096106
2 dnl
3 dnl posix_allocate() function detection
4 dnl
6 AC_DEFUN([gl_POSIX_FALLOCATE], [
7     dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
8     AC_TRY_LINK([
9         #define _XOPEN_SOURCE 600
10         #include <stdlib.h>
11         #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
12             possibly broken posix_fallocate
13         #endif
14     ],
15     [posix_fallocate(0, 0, 0);],
16     [AC_DEFINE(
17         [HAVE_POSIX_FALLOCATE],
18         [1],
19         [Define if you have a working posix_fallocate()])
20     ])
23 dnl
24 dnl Get from the coreutils package (stat-prog.m4 serial 7)
25 dnl
27 AC_DEFUN([mc_cu_PREREQ_STAT_PROG],
29   AC_REQUIRE([gl_FSUSAGE])
30   AC_REQUIRE([gl_FSTYPENAME])
31   AC_CHECK_HEADERS_ONCE([OS.h netinet/in.h sys/param.h sys/vfs.h])
33   dnl Check for vfs.h first, since this avoids a warning with nfs_client.h
34   dnl on Solaris 8.
35   test $ac_cv_header_sys_param_h = yes &&
36   test $ac_cv_header_sys_mount_h = yes &&
37   AC_CHECK_HEADERS([nfs/vfs.h],
38     [AC_CHECK_HEADERS([nfs/nfs_client.h])])
40   statvfs_includes="\
41 AC_INCLUDES_DEFAULT
42 #include <sys/statvfs.h>
44   statfs_includes="\
45 AC_INCLUDES_DEFAULT
46 #ifdef HAVE_SYS_VFS_H
47 # include <sys/vfs.h>
48 #elif defined HAVE_SYS_MOUNT_H && defined HAVE_SYS_PARAM_H
49 # include <sys/param.h>
50 # include <sys/mount.h>
51 # if defined HAVE_NETINET_IN_H && defined HAVE_NFS_NFS_CLNT_H && defined HAVE_NFS_VFS_H
52 #  include <netinet/in.h>
53 #  include <nfs/nfs_clnt.h>
54 #  include <nfs/vfs.h>
55 # endif
56 #elif defined HAVE_OS_H
57 # include <fs_info.h>
58 #endif
60   if case "$fu_cv_sys_stat_statvfs$fu_cv_sys_stat_statvfs64" in
61        *yes*) ;; *) false;; esac &&
62      { AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [$statvfs_includes])
63        test $ac_cv_member_struct_statvfs_f_basetype = yes ||
64        { AC_CHECK_MEMBERS([struct statvfs.f_fstypename],,, [$statvfs_includes])
65          test $ac_cv_member_struct_statvfs_f_fstypename = yes ||
66          { test $ac_cv_member_struct_statfs_f_fstypename != yes &&
67            { AC_CHECK_MEMBERS([struct statvfs.f_type],,, [$statvfs_includes])
68              test $ac_cv_member_struct_statvfs_f_type = yes; }; }; }; }
69   then
70     AC_CHECK_MEMBERS([struct statvfs.f_namemax],,, [$statvfs_includes])
71     AC_COMPILE_IFELSE(
72       [AC_LANG_PROGRAM(
73          [$statvfs_includes],
74          [static statvfs s;
75           return (s.s_fsid ^ 0) == 0;])],
76       [AC_DEFINE([STRUCT_STATVFS_F_FSID_IS_INTEGER], [1],
77          [Define to 1 if the f_fsid member of struct statvfs is an integer.])])
78   else
79     AC_CHECK_MEMBERS([struct statfs.f_namelen, struct statfs.f_type,
80                      struct statfs.f_frsize],,, [$statfs_includes])
81     if test $ac_cv_header_OS_h != yes; then
82       AC_COMPILE_IFELSE(
83         [AC_LANG_PROGRAM(
84            [$statfs_includes],
85            [static statfs s;
86             return (s.s_fsid ^ 0) == 0;])],
87         [AC_DEFINE([STRUCT_STATFS_F_FSID_IS_INTEGER], [1],
88            [Define to 1 if the f_fsid member of struct statfs is an integer.])])
89     fi
90   fi
94 dnl
95 dnl Filesystem information detection
96 dnl
97 dnl To get information about the disk, mount points, etc.
98 dnl
100 AC_DEFUN([mc_AC_GET_FS_INFO], [
101     gl_MOUNTLIST
102     if test $gl_cv_list_mounted_fs = yes; then
103       gl_PREREQ_MOUNTLIST_EXTRA
104     fi
106     AC_CHECK_HEADERS([fcntl.h utime.h])
108     gl_LIST_MOUNTED_FILE_SYSTEMS([
109         AC_DEFINE(HAVE_INFOMOUNT_LIST, 1,
110             [Define if the list of mounted filesystems can be determined])],
111         [AC_MSG_WARN([could not determine how to read list of mounted fs])])
113     gl_FSUSAGE
114     if test $gl_cv_fs_space = yes; then
115         gl_PREREQ_FSUSAGE_EXTRA
116     fi
117     gl_FSTYPENAME
119     gl_POSIX_FALLOCATE
121     mc_cu_PREREQ_STAT_PROG