2
dnl By default, many hosts won't 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([MYSQL_SYS_LARGEFILE],
82
[AC_REQUIRE([AC_CANONICAL_HOST])
83
AC_ARG_ENABLE(largefile,
84
[ --disable-largefile Omit support for large files])
85
if test "$enable_largefile" != no; then
86
AC_CHECK_TOOL(GETCONF, getconf)
87
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
88
AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
89
AC_SYS_LARGEFILE_FLAGS(LIBS)
91
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
94
-D_FILE_OFFSET_BITS=*) ;;
95
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
96
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
98
AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
100
AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
103
AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
104
AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
106
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
107
ac_cv_sys_file_offset_bits,
108
[Number of bits in a file offset, on hosts where this is settable.],
110
# HP-UX 10.20 and later
111
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
112
ac_cv_sys_file_offset_bits=64 ;;
113
# We can't declare _FILE_OFFSET_BITS here as this will cause
114
# compile errors as AC_PROG_CC adds include files in confdefs.h
115
# We solve this (until autoconf is fixed) by instead declaring it
118
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
119
CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64"
120
ac_cv_sys_file_offset_bits=no ;;
122
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
123
ac_cv_sys_largefile_source,
124
[makes fseeko etc. visible, on some hosts.],
126
# HP-UX 10.20 and later
127
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
128
ac_cv_sys_largefile_source=1 ;;
131
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
132
ac_cv_sys_large_files,
133
[Large files support on AIX-style hosts.],
135
# Large file support on AIX is available starting from version 4.2
136
# Tested only on 5.2 and up
137
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
138
ac_cv_sys_large_files=1 ;;