3 dnl By default, many hosts won't let programs access large files;
4 dnl one must use special compiler options to get large-file access to work.
5 dnl For more details about this brain damage please see:
6 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
8 dnl Written by Paul Eggert <eggert@twinsun.com>.
10 dnl Internal subroutine of AC_SYS_LARGEFILE.
11 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
12 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
13 [[#include <sys/types.h>
14 int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
17 dnl Internal subroutine of AC_SYS_LARGEFILE.
18 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
19 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
20 [AC_CACHE_CHECK([for $1 value needed for large files], $3,
22 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES
27 [AC_TRY_COMPILE([#define $1 $2]
28 AC_SYS_LARGEFILE_TEST_INCLUDES
33 if test "[$]$3" != no; then
34 AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
37 AC_DEFUN(AC_SYS_LARGEFILE,
38 [AC_ARG_ENABLE(largefile,
39 [ --disable-largefile omit support for large files])
40 if test "$enable_largefile" != no; then
42 AC_CACHE_CHECK([for special C compiler options needed for large files],
43 ac_cv_sys_largefile_CC,
44 [ac_cv_sys_largefile_CC=no
45 if test "$GCC" != yes; then
46 # IRIX 6.2 and later do not support large files by default,
47 # so use the C compiler's -n32 option if that helps.
48 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
51 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
52 ac_cv_sys_largefile_CC=' -n32')
55 if test "$ac_cv_sys_largefile_CC" != no; then
56 CC="$CC$ac_cv_sys_largefile_CC"
59 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
60 ac_cv_sys_file_offset_bits,
61 [Number of bits in a file offset, on hosts where this is settable.])
62 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
63 ac_cv_sys_largefile_source,
64 [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
65 [#include <stdio.h>], [return !ftello;])
66 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
67 ac_cv_sys_large_files,
68 [Define for large files, on AIX-style hosts.])
69 AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
70 ac_cv_sys_xopen_source,
71 [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
72 [#include <stdio.h>], [return !ftello;])