mc-get-fs-info.m4 3.6 KB

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