1
by brian
clean slate |
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
|
|
5 |
||
6 |
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
|
7 |
||
8 |
dnl Internal subroutine of AC_SYS_LARGEFILE.
|
|
9 |
dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
|
|
10 |
AC_DEFUN([AC_SYS_LARGEFILE_FLAGS],
|
|
11 |
[AC_CACHE_CHECK([for $1 value to request large file support],
|
|
12 |
ac_cv_sys_largefile_$1,
|
|
13 |
[if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
|
|
14 |
then
|
|
15 |
ac_cv_sys_largefile_$1=`cat conftest.1`
|
|
16 |
else
|
|
17 |
ac_cv_sys_largefile_$1=no
|
|
18 |
ifelse($1, CFLAGS,
|
|
19 |
[case "$host_os" in
|
|
20 |
# HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
|
|
21 |
changequote(, )dnl
|
|
22 |
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
|
23 |
changequote([, ])dnl
|
|
24 |
if test "$GCC" = yes; then
|
|
25 |
case `$CC --version 2>/dev/null` in
|
|
26 |
2.95.*) ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__ ;;
|
|
27 |
esac
|
|
28 |
fi
|
|
29 |
;;
|
|
30 |
# IRIX 6.2 and later require cc -n32.
|
|
31 |
changequote(, )dnl
|
|
32 |
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
|
|
33 |
changequote([, ])dnl
|
|
34 |
if test "$GCC" != yes; then
|
|
35 |
ac_cv_sys_largefile_CFLAGS=-n32
|
|
36 |
fi
|
|
37 |
esac
|
|
38 |
if test "$ac_cv_sys_largefile_CFLAGS" != no; then
|
|
39 |
ac_save_CC="$CC"
|
|
40 |
CC="$CC $ac_cv_sys_largefile_CFLAGS"
|
|
41 |
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
|
|
42 |
CC="$ac_save_CC"
|
|
43 |
fi])
|
|
44 |
fi
|
|
45 |
rm -f conftest*])])
|
|
46 |
||
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],
|
|
50 |
[case $2 in
|
|
51 |
no) ;;
|
|
52 |
?*)
|
|
53 |
case "[$]$1" in
|
|
54 |
'') $1=$2 ;;
|
|
55 |
*) $1=[$]$1' '$2 ;; |
|
56 |
esac ;;
|
|
57 |
esac])
|
|
58 |
||
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,
|
|
63 |
[$2=no
|
|
64 |
changequote(, )dnl
|
|
65 |
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
|
66 |
case "$ac_flag" in
|
|
67 |
-D$1)
|
|
68 |
$2=1 ;;
|
|
69 |
-D$1=*)
|
|
70 |
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;; |
|
71 |
esac
|
|
72 |
done
|
|
73 |
$4
|
|
74 |
changequote([, ])dnl
|
|
75 |
])
|
|
76 |
if test "[$]$2" != no; then
|
|
77 |
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
|
78 |
fi])
|
|
79 |
||
80 |
AC_DEFUN([MYSQL_SYS_LARGEFILE],
|
|
81 |
[AC_REQUIRE([AC_CANONICAL_HOST])
|
|
82 |
AC_ARG_ENABLE(largefile,
|
|
83 |
[ --disable-largefile Omit support for large files])
|
|
84 |
if test "$enable_largefile" != no; then
|
|
85 |
AC_CHECK_TOOL(GETCONF, getconf)
|
|
86 |
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
|
|
87 |
AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
|
|
88 |
AC_SYS_LARGEFILE_FLAGS(LIBS)
|
|
89 |
||
90 |
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
|
91 |
case "$ac_flag" in
|
|
92 |
no) ;;
|
|
93 |
-D_FILE_OFFSET_BITS=*) ;;
|
|
94 |
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
|
|
95 |
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
|
|
96 |
-D?* | -I?*)
|
|
97 |
AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
|
|
98 |
*)
|
|
99 |
AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
|
|
100 |
esac
|
|
101 |
done
|
|
102 |
AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
|
|
103 |
AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
|
|
104 |
||
105 |
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
|
106 |
ac_cv_sys_file_offset_bits,
|
|
107 |
[Number of bits in a file offset, on hosts where this is settable.],
|
|
108 |
[case "$host_os" in
|
|
109 |
# HP-UX 10.20 and later
|
|
110 |
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
|
111 |
ac_cv_sys_file_offset_bits=64 ;;
|
|
112 |
# We can't declare _FILE_OFFSET_BITS here as this will cause |
|
113 |
# compile errors as AC_PROG_CC adds include files in confdefs.h |
|
114 |
# We solve this (until autoconf is fixed) by instead declaring it |
|
115 |
# as define instead |
|
116 |
solaris2.[8,9]) |
|
117 |
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" |
|
118 |
CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=64" |
|
119 |
ac_cv_sys_file_offset_bits=no ;; |
|
120 |
esac]) |
|
121 |
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, |
|
122 |
ac_cv_sys_largefile_source, |
|
123 |
[makes fseeko etc. visible, on some hosts.], |
|
124 |
[case "$host_os" in |
|
125 |
# HP-UX 10.20 and later
|
|
126 |
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*) |
|
127 |
ac_cv_sys_largefile_source=1 ;; |
|
128 |
esac]) |
|
129 |
||
130 |
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, |
|
131 |
ac_cv_sys_large_files, |
|
132 |
[Large files support on AIX-style hosts.], |
|
133 |
[case "$host_os" in |
|
134 |
# Large file support on AIX is available starting from version 4.2
|
|
135 |
# Tested only on 5.2 and up
|
|
136 |
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*) |
|
137 |
ac_cv_sys_large_files=1 ;; |
|
138 |
esac]) |
|
139 |
fi |
|
140 |
]) |
|
141 |
||
142 |