2
dnl By default, many hosts wont let programs access large files;
3
dnl one must use special compiler options to get large-file access to work.
4
dnl For more details about this brain damage please see:
5
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
7
dnl Written by Paul Eggert <eggert@twinsun.com>.
9
dnl Internal subroutine of AC_SYS_LARGEFILE.
10
dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
11
AC_DEFUN([AC_SYS_LARGEFILE_FLAGS],
12
[AC_CACHE_CHECK([for $1 value to request large file support],
13
ac_cv_sys_largefile_$1,
14
[if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
16
ac_cv_sys_largefile_$1=`cat conftest.1`
18
ac_cv_sys_largefile_$1=no
21
# 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]*)
25
if test "$GCC" = yes; then
26
case `$CC --version 2>/dev/null` in
27
2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
31
# IRIX 6.2 and later require cc -n32.
33
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
35
if test "$GCC" != yes; then
36
ac_cv_sys_largefile_CFLAGS=-n32
39
if test "$ac_cv_sys_largefile_CFLAGS" != no; then
41
CC="$CC $ac_cv_sys_largefile_CFLAGS"
42
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
48
dnl Internal subroutine of AC_SYS_LARGEFILE.
49
dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
50
AC_DEFUN([AC_SYS_LARGEFILE_SPACE_APPEND],
60
dnl Internal subroutine of AC_SYS_LARGEFILE.
61
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
62
AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
63
[AC_CACHE_CHECK([for $1], $2,
66
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
71
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
77
if test "[$]$2" != no; then
78
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
81
AC_DEFUN([DRIZZLE_SYS_LARGEFILE],
82
[AC_REQUIRE([AC_CANONICAL_HOST])
83
AC_ARG_ENABLE([largefile],
84
[AS_HELP_STRING([--disable-largefile],
85
[Omit support for large files])])
86
if test "$enable_largefile" != no; then
87
AC_CHECK_TOOL(GETCONF, getconf)
88
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
89
AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
90
AC_SYS_LARGEFILE_FLAGS(LIBS)
92
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
95
-D_FILE_OFFSET_BITS=*) ;;
96
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
97
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
99
AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
101
AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
104
AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
105
AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
107
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
108
ac_cv_sys_file_offset_bits,
109
[Number of bits in a file offset, on hosts where this is settable.],
111
# HP-UX 10.20 and later
112
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
113
ac_cv_sys_file_offset_bits=64 ;;
114
# We can't declare _FILE_OFFSET_BITS here as this will cause
115
# compile errors as AC_PROG_CC adds include files in confdefs.h
116
# We solve this (until autoconf is fixed) by instead declaring it
119
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
120
CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
121
ac_cv_sys_file_offset_bits=no ;;
123
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
124
ac_cv_sys_largefile_source,
125
[makes fseeko etc. visible, on some hosts.],
127
# HP-UX 10.20 and later
128
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
129
ac_cv_sys_largefile_source=1 ;;
132
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
133
ac_cv_sys_large_files,
134
[Large files support on AIX-style hosts.],
136
# Large file support on AIX is available starting from version 4.2
137
# Tested only on 5.2 and up
138
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
139
ac_cv_sys_large_files=1 ;;