Add AC_SYS_LARGEFILE to configure.ac
inode numbers in modern filesystems often exceed the 32-bit address
space. If that happens, calling 32-bit stat (as would be the case on
a 32-bit machine when largefile support is not enabled) fails with
EOVERFLOW despite us not needing those values at all.
AC_SYS_LARGEFILE enables largefile support if possible. This defines
_FILE_OFFSET_BITS in config.h, so that file needs to be included in
files that use stat.
diff --git a/configure.ac b/configure.ac
index 525efaa..91c2136 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# -*- Autoconf -*-
# This file is part of ltrace.
-# Copyright (C) 2010,2012 Petr Machata, Red Hat Inc.
+# Copyright (C) 2010,2012,2013 Petr Machata, Red Hat Inc.
# Copyright (C) 2010,2011 Joe Damato
# Copyright (C) 2010 Marc Kleine-Budde
# Copyright (C) 2010 Zachary T Welch
@@ -57,6 +57,15 @@
AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2])
AM_MAINTAINER_MODE
+#
+# We use stat(2). Even though we don't care about the file size or
+# inode number, stat will fail with EOVERFLOW if either of these
+# exceeds 32 bits. We therefore ask for stat64 if available. Do this
+# test as soon as possible, as large file support may influence
+# whether other headers are available.
+#
+AC_SYS_LARGEFILE
+
AC_ARG_WITH([libelf],
AS_HELP_STRING([--with-libelf], [Prefix of libelf headers/library]),
[case "${withval}" in