1 | #serial 6
|
---|
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 | [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
|
---|
16 | then
|
---|
17 | ac_cv_sys_largefile_$1=`cat conftest.1`
|
---|
18 | else
|
---|
19 | ac_cv_sys_largefile_$1=no
|
---|
20 | ifelse($1, CFLAGS,
|
---|
21 | [case "$host_os" in
|
---|
22 | # HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
|
---|
23 | changequote(, )dnl
|
---|
24 | hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
---|
25 | changequote([, ])dnl
|
---|
26 | if test "$GCC" = yes; then
|
---|
27 | ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
|
---|
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 | $4
|
---|
66 | for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
---|
67 | case "$ac_flag" in
|
---|
68 | -D$1)
|
---|
69 | $2=1 ;;
|
---|
70 | -D$1=*)
|
---|
71 | $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
|
---|
72 | esac
|
---|
73 | done
|
---|
74 | changequote([, ])dnl
|
---|
75 | ])
|
---|
76 | if test "[$]$2" != no; then
|
---|
77 | AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
---|
78 | fi])
|
---|
79 |
|
---|
80 | AC_DEFUN([AC_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 | AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
---|
105 | ac_cv_sys_file_offset_bits,
|
---|
106 | [Number of bits in a file offset, on hosts where this is settable.],
|
---|
107 | [case "$host_os" in
|
---|
108 | # HP-UX 10.20 and later
|
---|
109 | hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
---|
110 | ac_cv_sys_file_offset_bits=64 ;;
|
---|
111 | esac])
|
---|
112 | AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
---|
113 | ac_cv_sys_largefile_source,
|
---|
114 | [Define to make fseeko etc. visible, on some hosts.],
|
---|
115 | [case "$host_os" in
|
---|
116 | # HP-UX 10.20 and later
|
---|
117 | hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
---|
118 | ac_cv_sys_largefile_source=1 ;;
|
---|
119 | esac])
|
---|
120 | AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
---|
121 | ac_cv_sys_large_files,
|
---|
122 | [Define for large files, on AIX-style hosts.],
|
---|
123 | [case "$host_os" in
|
---|
124 | # AIX 4.2 and later
|
---|
125 | aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
---|
126 | ac_cv_sys_large_files=1 ;;
|
---|
127 | esac])
|
---|
128 | fi
|
---|
129 | ])
|
---|