1 2dnl 3dnl posix_allocate() function detection 4dnl 5 6AC_DEFUN([gl_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 #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 ]) 21]) 22 23dnl 24dnl Get from the coreutils package (stat-prog.m4 serial 7) 25dnl 26 27AC_DEFUN([mc_cu_PREREQ_STAT_PROG], 28[ 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]) 32 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])]) 39 40 statvfs_includes="\ 41AC_INCLUDES_DEFAULT 42#include <sys/statvfs.h> 43" 44 statfs_includes="\ 45AC_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 59" 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 91]) 92 93 94dnl 95dnl Filesystem information detection 96dnl 97dnl To get information about the disk, mount points, etc. 98dnl 99 100AC_DEFUN([mc_GET_FS_INFO], [ 101 AC_CHECK_HEADERS([fcntl.h utime.h]) 102 103 gl_MOUNTLIST 104 if test $gl_cv_list_mounted_fs = yes; then 105 gl_PREREQ_MOUNTLIST_EXTRA 106 AC_DEFINE(HAVE_INFOMOUNT_LIST, 1, 107 [Define if the list of mounted filesystems can be determined]) 108 else 109 AC_MSG_WARN([could not determine how to read list of mounted fs]); 110 fi 111 112 gl_FSUSAGE 113 if test $gl_cv_fs_space = yes; then 114 gl_PREREQ_FSUSAGE_EXTRA 115 fi 116 gl_FSTYPENAME 117 118 gl_POSIX_FALLOCATE 119 120 mc_cu_PREREQ_STAT_PROG 121]) 122