summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-22 10:07:18 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-22 10:08:33 -0700
commit64f62ee592856b418fa3e23c584796beac537af4 (patch)
tree5f8d5008113376271be32238084c81c3c72c1616 /m4
parenta25d7cf2e7374bd4444e34ca51e19a18004f7212 (diff)
downloadgnulib-64f62ee592856b418fa3e23c584796beac537af4.tar.gz
fsusage: port to MacOS X 10.7 with 4 TiB file systems
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Reject statvfs implementations that use only 32 bits to count blocks. On typical hosts with 1024-byte blocks, this fails with file systems as small as 4 TiB. Problem reported by Herb Wartens <http://debbugs.gnu.org/9140> and this should also fix a similar problem reported by Tim Spriggs <http://debbugs.gnu.org/7355>.
Diffstat (limited to 'm4')
-rw-r--r--m4/fsusage.m418
1 files changed, 13 insertions, 5 deletions
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index 3459e63b37..41c06bc9e8 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -40,7 +40,7 @@ ac_fsusage_space=no
# systems. That system is reported to work fine with STAT_STATFS4 which
# is what it gets when this test fails.
if test $ac_fsusage_space = no; then
- # glibc/{Hurd,kFreeBSD}, MacOS X >= 10.4, FreeBSD >= 5.0, NetBSD >= 3.0,
+ # glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
# OpenBSD >= 4.4, AIX, HP-UX, IRIX, Solaris, Cygwin, Interix, BeOS.
AC_CACHE_CHECK([for statvfs function (SVR4)], [fu_cv_sys_stat_statvfs],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
@@ -56,8 +56,16 @@ a system call.
"Do not use Tru64's statvfs implementation"
#endif
-#include <sys/statvfs.h>]],
- [[struct statvfs fsd; statvfs (0, &fsd);]])],
+#include <limits.h>
+#include <sys/statvfs.h>
+
+/* Reject implementations, such as MacOS X 10.7, where f_blocks is a
+ 32-bit quantity; that commonly limits file systems to 4 TiB, a
+ ridiculously small limit these days. */
+struct statvfs fsd;
+int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 32 ? -1 : 1];
+]],
+ [[statvfs (0, &fsd);]])],
[fu_cv_sys_stat_statvfs=yes],
[fu_cv_sys_stat_statvfs=no])])
if test $fu_cv_sys_stat_statvfs = yes; then
@@ -94,8 +102,8 @@ if test $ac_fsusage_space = no; then
fi
if test $ac_fsusage_space = no; then
- # glibc/Linux, MacOS X < 10.4, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
- # (glibc/{Hurd,kFreeBSD}, MacOS X >= 10.4, FreeBSD >= 5.0, NetBSD >= 3.0,
+ # glibc/Linux, MacOS X, FreeBSD < 5.0, NetBSD < 3.0, OpenBSD < 4.4.
+ # (glibc/{Hurd,kFreeBSD}, FreeBSD >= 5.0, NetBSD >= 3.0,
# OpenBSD >= 4.4, AIX, HP-UX, OSF/1, Cygwin already handled above.)
# (On IRIX you need to include <sys/statfs.h>, not only <sys/mount.h> and
# <sys/vfs.h>.)