39
39
AC_MSG_RESULT([${gawk_cv_c_stringize}])
43
dnl By default, many hosts won't let programs access large files;
44
dnl one must use special compiler options to get large-file access to work.
45
dnl For more details about this brain damage please see:
46
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
48
dnl Written by Paul Eggert <eggert@twinsun.com>.
50
dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
51
dnl GAWK_AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
52
AC_DEFUN(GAWK_AC_SYS_LARGEFILE_FLAGS,
53
[AC_CACHE_CHECK([for $1 value to request large file support],
54
gawk_cv_sys_largefile_$1,
55
[gawk_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
56
gawk_cv_sys_largefile_$1=no
59
# IRIX 6.2 and later require cc -n32.
61
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
63
if test "$GCC" != yes; then
64
gawk_cv_sys_largefile_CFLAGS=-n32
67
CC="$CC $gawk_cv_sys_largefile_CFLAGS"
68
AC_TRY_LINK(, , , gawk_cv_sys_largefile_CFLAGS=no)
73
dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
74
dnl GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
75
AC_DEFUN(GAWK_AC_SYS_LARGEFILE_SPACE_APPEND,
85
dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
86
dnl GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, CODE-TO-SET-DEFAULT)
87
AC_DEFUN(GAWK_AC_SYS_LARGEFILE_MACRO_VALUE,
88
[AC_CACHE_CHECK([for $1], $2,
92
for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
97
$2=`expr " $gawk_flag" : '[^=]*=\(.*\)'` ;;
102
if test "[$]$2" != no; then
103
AC_DEFINE_UNQUOTED([$1], [$]$2)
106
AC_DEFUN(GAWK_AC_SYS_LARGEFILE,
107
[AC_REQUIRE([AC_CANONICAL_HOST])
108
AC_ARG_ENABLE(largefile,
109
[ --disable-largefile omit support for large files])
110
if test "$enable_largefile" != no; then
111
AC_CHECK_TOOL(GETCONF, getconf)
112
GAWK_AC_SYS_LARGEFILE_FLAGS(CFLAGS)
113
GAWK_AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
114
GAWK_AC_SYS_LARGEFILE_FLAGS(LIBS)
116
for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
119
-D_FILE_OFFSET_BITS=*) ;;
120
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
121
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
123
GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$gawk_flag") ;;
125
GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$gawk_flag") ;;
128
GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$gawk_cv_sys_largefile_LDFLAGS")
129
GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$gawk_cv_sys_largefile_LIBS")
130
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
131
gawk_cv_sys_file_offset_bits,
133
# HP-UX 10.20 and later
134
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
135
gawk_cv_sys_file_offset_bits=64 ;;
137
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
138
gawk_cv_sys_largefile_source,
140
# HP-UX 10.20 and later
141
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
142
gawk_cv_sys_largefile_source=1 ;;
144
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
145
gawk_cv_sys_large_files,
148
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
149
gawk_cv_sys_large_files=1 ;;
154
dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED
155
AC_DEFUN(GAWK_AC_AIX_TWEAK, [
156
AC_MSG_CHECKING([for AIX compilation hacks])
157
AC_CACHE_VAL(gawk_cv_aix_hack, [
160
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
166
AC_MSG_RESULT([${gawk_cv_aix_hack}])