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