1 # Enable large files on systems where this is not the default.
3 # Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 # The following implementation works around a problem in autoconf <= 2.68;
9 # AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5.
10 m4_version_prereq([2.69], [] ,[
12 # _AC_SYS_LARGEFILE_TEST_INCLUDES
13 # -------------------------------
14 m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES],
15 [@%:@include <sys/types.h>
16 /* Check that off_t can represent 2**63 - 1 correctly.
17 We can't simply define LARGE_OFF_T to be 9223372036854775807,
18 since some C++ compilers masquerading as C compilers
19 incorrectly reject 9223372036854775807. */
20 @%:@define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
21 int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721
22 && LARGE_OFF_T % 2147483647 == 1)
27 # _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE,
30 # PROLOGUE, [FUNCTION-BODY])
31 # --------------------------------------------------------
32 m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE],
33 [AC_CACHE_CHECK([for $1 value needed for large files], [$3],
35 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
36 [AC_LANG_PROGRAM([$5], [$6])],
38 m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])(
39 [AC_LANG_PROGRAM([@%:@define $1 $2
47 *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);;
50 ])# _AC_SYS_LARGEFILE_MACRO_VALUE
55 # By default, many hosts won't let programs access large files;
56 # one must use special compiler options to get large-file access to work.
57 # For more details about this brain damage please see:
58 # http://www.unix-systems.org/version2/whatsnew/lfs20mar.html
59 AC_DEFUN([AC_SYS_LARGEFILE],
60 [AC_ARG_ENABLE(largefile,
61 [ --disable-largefile omit support for large files])
62 if test "$enable_largefile" != no; then
64 AC_CACHE_CHECK([for special C compiler options needed for large files],
65 ac_cv_sys_largefile_CC,
66 [ac_cv_sys_largefile_CC=no
67 if test "$GCC" != yes; then
70 # IRIX 6.2 and later do not support large files by default,
71 # so use the C compiler's -n32 option if that helps.
72 AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])])
73 AC_COMPILE_IFELSE([], [break])
75 AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break])
79 rm -f conftest.$ac_ext
81 if test "$ac_cv_sys_largefile_CC" != no; then
82 CC=$CC$ac_cv_sys_largefile_CC
85 _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
86 ac_cv_sys_file_offset_bits,
87 [Number of bits in a file offset, on hosts where this is settable.],
88 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
89 if test $ac_cv_sys_file_offset_bits = unknown; then
90 _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
91 ac_cv_sys_large_files,
92 [Define for large files, on AIX-style hosts.],
93 [_AC_SYS_LARGEFILE_TEST_INCLUDES])
96 AH_VERBATIM([_DARWIN_USE_64_BIT_INODE],
97 [/* Enable large inode numbers on Mac OS X. */
98 #ifndef _DARWIN_USE_64_BIT_INODE
99 # define _DARWIN_USE_64_BIT_INODE 1
104 ])# m4_version_prereq 2.69