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