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_FLAGS(FLAGSNAME)
12 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
13 [AC_CACHE_CHECK([for $1 value to request large file support],
14 ac_cv_sys_largefile_$1,
15 [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
17 ac_cv_sys_largefile_$1=`cat conftest.1`
19 ac_cv_sys_largefile_$1=no
22 # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
23 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
24 if test "$GCC" = yes; then
25 ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
28 # IRIX 6.2 and later do not support large files by default,
29 # so use the -n32 ABI unless the installer said otherwise.
30 [ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)]
31 if test "$GCC" != yes; then
32 case "$CC $CFLAGS " in
33 *' -o32 '*|*' -n32 '*|*' -64 '*) ;;
34 *) ac_cv_sys_largefile_CFLAGS=-n32 ;;
38 if test "$ac_cv_sys_largefile_CFLAGS" != no; then
40 CC="$CC $ac_cv_sys_largefile_CFLAGS"
41 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
47 dnl Internal subroutine of AC_SYS_LARGEFILE.
48 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
49 AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
59 dnl Internal subroutine of AC_SYS_LARGEFILE.
60 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
61 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
62 [AC_CACHE_CHECK([for $1], $2,
65 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
70 $2=`expr " $ac_flag" : '[[^=]]*=\(.*\)'` ;;
74 if test "[$]$2" != no; then
75 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
78 AC_DEFUN(AC_SYS_LARGEFILE,
79 [AC_REQUIRE([AC_CANONICAL_HOST])
80 AC_ARG_ENABLE(largefile,
81 [ --disable-largefile omit support for large files])
82 if test "$enable_largefile" != no; then
83 AC_CHECK_TOOL(GETCONF, getconf)
84 AC_SYS_LARGEFILE_FLAGS(CFLAGS)
85 AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
86 AC_SYS_LARGEFILE_FLAGS(LIBS)
88 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
91 -D_FILE_OFFSET_BITS=*) ;;
92 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
93 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
95 AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
97 AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
100 AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
101 AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
102 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
103 ac_cv_sys_file_offset_bits,
104 [Number of bits in a file offset, on hosts where this is settable.],
106 # HP-UX 10.20 and later
107 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
108 ac_cv_sys_file_offset_bits=64 ;;
110 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
111 ac_cv_sys_largefile_source,
112 [Define to make fseeko etc. visible, on some hosts.],
114 # HP-UX 10.20 and later
115 [ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
116 ac_cv_sys_largefile_source=1 ;;
118 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
119 ac_cv_sys_large_files,
120 [Define for large files, on AIX-style hosts.],
123 [ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)]
124 ac_cv_sys_large_files=1 ;;