Chris@0
|
1 dnl By default, many hosts won't let programs access large files;
|
Chris@0
|
2 dnl one must use special compiler options to get large-file access to work.
|
Chris@0
|
3 dnl For more details about this brain damage please see:
|
Chris@0
|
4 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
Chris@0
|
5
|
Chris@0
|
6 dnl Written by Paul Eggert <eggert@twinsun.com>.
|
Chris@0
|
7
|
Chris@0
|
8 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
Chris@0
|
9 dnl MN_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
|
Chris@0
|
10 AC_DEFUN([MN_SYS_EXTRA_LARGEFILE_FLAGS],
|
Chris@0
|
11 [AC_CACHE_CHECK([for $1 value to request large file support],
|
Chris@0
|
12 ac_cv_sys_largefile_$1,
|
Chris@0
|
13 [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
|
Chris@0
|
14 ac_cv_sys_largefile_$1=no
|
Chris@0
|
15 ifelse($1, CFLAGS,
|
Chris@0
|
16 [case "$host_os" in
|
Chris@0
|
17 # IRIX 6.2 and later require cc -n32.
|
Chris@0
|
18 changequote(, )dnl
|
Chris@0
|
19 irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
|
Chris@0
|
20 changequote([, ])dnl
|
Chris@0
|
21 if test "$GCC" != yes; then
|
Chris@0
|
22 ac_cv_sys_largefile_CFLAGS=-n32
|
Chris@0
|
23 fi
|
Chris@0
|
24 ac_save_CC="$CC"
|
Chris@0
|
25 CC="$CC $ac_cv_sys_largefile_CFLAGS"
|
Chris@0
|
26 AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
|
Chris@0
|
27 CC="$ac_save_CC"
|
Chris@0
|
28 esac])
|
Chris@0
|
29 }])])
|
Chris@0
|
30
|
Chris@0
|
31 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
Chris@0
|
32 dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
|
Chris@0
|
33 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
|
Chris@0
|
34 [case $2 in
|
Chris@0
|
35 no) ;;
|
Chris@0
|
36 ?*)
|
Chris@0
|
37 case "[$]$1" in
|
Chris@0
|
38 '') $1=$2 ;;
|
Chris@0
|
39 *) $1=[$]$1' '$2 ;;
|
Chris@0
|
40 esac ;;
|
Chris@0
|
41 esac])
|
Chris@0
|
42
|
Chris@0
|
43 dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
Chris@0
|
44 dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
|
Chris@0
|
45 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
|
Chris@0
|
46 [AC_CACHE_CHECK([for $1], $2,
|
Chris@0
|
47 [$2=no
|
Chris@0
|
48 changequote(, )dnl
|
Chris@0
|
49 $4
|
Chris@0
|
50 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
Chris@0
|
51 case "$ac_flag" in
|
Chris@0
|
52 -D$1)
|
Chris@0
|
53 $2=1 ;;
|
Chris@0
|
54 -D$1=*)
|
Chris@0
|
55 $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
|
Chris@0
|
56 esac
|
Chris@0
|
57 done
|
Chris@0
|
58 changequote([, ])dnl
|
Chris@0
|
59 ])
|
Chris@0
|
60 if test "[$]$2" != no; then
|
Chris@0
|
61 AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
Chris@0
|
62 fi])
|
Chris@0
|
63
|
Chris@0
|
64 AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
|
Chris@0
|
65 [AC_REQUIRE([AC_CANONICAL_HOST])
|
Chris@0
|
66 AC_ARG_ENABLE(largefile,
|
Chris@0
|
67 [ --disable-largefile omit support for large files])
|
Chris@0
|
68 if test "$enable_largefile" != no; then
|
Chris@0
|
69 AC_CHECK_TOOL(GETCONF, getconf)
|
Chris@0
|
70 MN_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
|
Chris@0
|
71 MN_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
|
Chris@0
|
72 MN_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
|
Chris@0
|
73
|
Chris@0
|
74 for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
Chris@0
|
75 case "$ac_flag" in
|
Chris@0
|
76 no) ;;
|
Chris@0
|
77 -D_FILE_OFFSET_BITS=*) ;;
|
Chris@0
|
78 -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
|
Chris@0
|
79 -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
|
Chris@0
|
80 -D?* | -I?*)
|
Chris@0
|
81 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
|
Chris@0
|
82 *)
|
Chris@0
|
83 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
|
Chris@0
|
84 esac
|
Chris@0
|
85 done
|
Chris@0
|
86 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
|
Chris@0
|
87 AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
|
Chris@0
|
88 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
Chris@0
|
89 ac_cv_sys_file_offset_bits,
|
Chris@0
|
90 [Number of bits in a file offset, on hosts where this is settable.])
|
Chris@0
|
91 [case "$host_os" in
|
Chris@0
|
92 # HP-UX 10.20 and later
|
Chris@0
|
93 hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
Chris@0
|
94 ac_cv_sys_file_offset_bits=64 ;;
|
Chris@0
|
95 esac]
|
Chris@0
|
96 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
Chris@0
|
97 ac_cv_sys_largefile_source,
|
Chris@0
|
98 [Define to make fseeko etc. visible, on some hosts.],
|
Chris@0
|
99 [case "$host_os" in
|
Chris@0
|
100 # HP-UX 10.20 and later
|
Chris@0
|
101 hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
Chris@0
|
102 ac_cv_sys_largefile_source=1 ;;
|
Chris@0
|
103 esac])
|
Chris@0
|
104 AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
Chris@0
|
105 ac_cv_sys_large_files,
|
Chris@0
|
106 [Define for large files, on AIX-style hosts.],
|
Chris@0
|
107 [case "$host_os" in
|
Chris@0
|
108 # AIX 4.2 and later
|
Chris@0
|
109 aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
Chris@0
|
110 ac_cv_sys_large_files=1 ;;
|
Chris@0
|
111 esac])
|
Chris@0
|
112 fi
|
Chris@0
|
113 ])
|
Chris@0
|
114
|