2 dnl ========= Large File Support ==============
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 Modified by Kern Sibbald to turn on the large file
11 dnl flags on all machines. Otherwise functions such as
12 dnl fseek are not large file capable.
15 dnl Internal subroutine of AC_SYS_LARGEFILE.
16 dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
17 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
18 [AC_CACHE_CHECK([for $1 value to request large file support],
19 ac_cv_sys_largefile_$1,
20 [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
21 ac_cv_sys_largefile_$1=no
24 # IRIX 6.2 and later require cc -n32.
26 irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
28 if test "$GCC" != yes; then
29 ac_cv_sys_largefile_CFLAGS=-n32
32 CC="$CC $ac_cv_sys_largefile_CFLAGS"
33 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
38 dnl Internal subroutine of AC_SYS_LARGEFILE.
39 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
40 AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
50 dnl Internal subroutine of AC_SYS_LARGEFILE.
51 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
52 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
53 [AC_CACHE_CHECK([for $1], $2,
57 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
62 $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
67 if test "[$]$2" != no; then
68 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
71 AC_DEFUN(AC_BAC_LARGEFILE,
72 [AC_REQUIRE([AC_CANONICAL_HOST])
73 AC_ARG_ENABLE(largefile,
74 [ --disable-largefile omit support for large files])
75 if test "$enable_largefile" != no; then
76 AC_CHECK_TOOL(GETCONF, getconf)
77 AC_SYS_LARGEFILE_FLAGS(CFLAGS)
78 AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
79 AC_SYS_LARGEFILE_FLAGS(LIBS)
81 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
84 -D_FILE_OFFSET_BITS=*) ;;
85 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
86 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
88 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
90 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
93 AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
94 AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
95 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
96 ac_cv_sys_file_offset_bits,
97 [Number of bits in a file offset, on hosts where this is settable.],
98 [ac_cv_sys_file_offset_bits=64])
99 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
100 ac_cv_sys_largefile_source,
101 [Define to make fseeko etc. visible, on some hosts.],
102 [ac_cv_sys_largefile_source=1])
103 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
104 ac_cv_sys_large_files,
105 [Define for large files, on AIX-style hosts.],
106 [ac_cv_sys_large_files=1])
109 dnl ==========================================================