1 dnl By default, many hosts won't let programs access large files;
2 dnl one must use special compiler options to get large-file access to work.
3 dnl For more details about this brain damage please see:
4 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
6 dnl Written by Paul Eggert <eggert@twinsun.com>.
8 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
9 dnl MN_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
10 AC_DEFUN([MN_SYS_EXTRA_LARGEFILE_FLAGS],
11 [AC_CACHE_CHECK([for $1 value to request large file support],
12 ac_cv_sys_largefile_$1,
13 [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
14 ac_cv_sys_largefile_$1=no
17 # IRIX 6.2 and later require cc -n32.
19 irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
21 if test "$GCC" != yes; then
22 ac_cv_sys_largefile_CFLAGS=-n32
25 CC="$CC $ac_cv_sys_largefile_CFLAGS"
26 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
31 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
32 dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
33 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
43 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
44 dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
45 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
46 [AC_CACHE_CHECK([for $1], $2,
50 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
55 $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
60 if test "[$]$2" != no; then
61 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
64 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
65 [AC_REQUIRE([AC_CANONICAL_HOST])
66 AC_ARG_ENABLE(largefile,
67 [ --disable-largefile omit support for large files])
68 if test "$enable_largefile" != no; then
69 AC_CHECK_TOOL(GETCONF, getconf)
70 MN_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
71 MN_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
72 MN_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
74 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
77 -D_FILE_OFFSET_BITS=*) ;;
78 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
79 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
81 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
83 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
86 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
87 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
88 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
89 ac_cv_sys_file_offset_bits,
90 [Number of bits in a file offset, on hosts where this is settable.])
92 # HP-UX 10.20 and later
93 hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
94 ac_cv_sys_file_offset_bits=64 ;;
96 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
97 ac_cv_sys_largefile_source,
98 [Define to make fseeko etc. visible, on some hosts.],
100 # HP-UX 10.20 and later
101 hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
102 ac_cv_sys_largefile_source=1 ;;
104 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
105 ac_cv_sys_large_files,
106 [Define for large files, on AIX-style hosts.],
109 aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
110 ac_cv_sys_large_files=1 ;;