When re-using a connection, the path pointers were not setup properly so
[platform/upstream/curl.git] / acinclude.m4
1 #serial 19
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_TEST_INCLUDES
12 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
13   [[#include <sys/types.h>
14     /* Check that off_t can represent 2**63 - 1 correctly.
15        We can't simply "#define LARGE_OFF_T 9223372036854775807",
16        since some C++ compilers masquerading as C compilers
17        incorrectly reject 9223372036854775807.  */
18 #   define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
19     int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
20                         && LARGE_OFF_T % 2147483647 == 1)
21                        ? 1 : -1];
22   ]])
23
24 dnl Internal subroutine of AC_SYS_LARGEFILE.
25 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
26 AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
27   [AC_CACHE_CHECK([for $1 value needed for large files], $3,
28      [$3=no
29       AC_TRY_COMPILE([$5],
30         [$6], 
31         ,
32         [AC_TRY_COMPILE([#define $1 $2]
33 [$5]
34            ,
35            [$6],
36            [$3=$2])])])
37    if test "[$]$3" != no; then
38      AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
39    fi])
40
41 AC_DEFUN(AC_SYS_LARGEFILE,
42   [AC_REQUIRE([AC_PROG_CC])
43    AC_ARG_ENABLE(largefile,
44      [  --disable-largefile     omit support for large files])
45    if test "$enable_largefile" != no; then
46
47      AC_CACHE_CHECK([for special C compiler options needed for large files],
48        ac_cv_sys_largefile_CC,
49        [ac_cv_sys_largefile_CC=no
50         if test "$GCC" != yes; then
51           # IRIX 6.2 and later do not support large files by default,
52           # so use the C compiler's -n32 option if that helps.
53           AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
54             [ac_save_CC="$CC"
55              CC="$CC -n32"
56              AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
57                ac_cv_sys_largefile_CC=' -n32')
58              CC="$ac_save_CC"])
59         fi])
60      if test "$ac_cv_sys_largefile_CC" != no; then
61        CC="$CC$ac_cv_sys_largefile_CC"
62      fi
63
64      AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
65        ac_cv_sys_file_offset_bits,
66        [Number of bits in a file offset, on hosts where this is settable.],
67        AC_SYS_LARGEFILE_TEST_INCLUDES)
68      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
69        ac_cv_sys_large_files,
70        [Define for large files, on AIX-style hosts.],
71        AC_SYS_LARGEFILE_TEST_INCLUDES)
72    fi
73   ])
74
75 AC_DEFUN(AC_FUNC_FSEEKO,
76   [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
77      ac_cv_sys_largefile_source,
78      [Define to make fseeko visible on some hosts (e.g. glibc 2.2).],
79      [#include <stdio.h>], [return !fseeko;])
80    # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
81    # in glibc 2.1.3, but that breaks too many other things.
82    # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
83
84    AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
85      [ac_cv_func_fseeko=no
86       AC_TRY_LINK([#include <stdio.h>],
87         [return fseeko && fseeko (stdin, 0, 0);],
88         [ac_cv_func_fseeko=yes])])
89    if test $ac_cv_func_fseeko != no; then
90      AC_DEFINE(HAVE_FSEEKO, 1,
91        [Define if fseeko (and presumably ftello) exists and is declared.])
92    fi])