1 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2 dnl if the cache file is inconsistent with the current host,
3 dnl target and build system types, execute CMD or print a default
5 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6 AC_REQUIRE([AC_CANONICAL_SYSTEM])
7 AC_MSG_CHECKING([config.cache system type])
8 if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9 test x"$ac_cv_host_system_type" != x"$host"; } ||
10 { test x"${ac_cv_build_system_type+set}" = x"set" &&
11 test x"$ac_cv_build_system_type" != x"$build"; } ||
12 { test x"${ac_cv_target_system_type+set}" = x"set" &&
13 test x"$ac_cv_target_system_type" != x"$target"; }; then
14 AC_MSG_RESULT([different])
16 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
20 ac_cv_host_system_type="$host"
21 ac_cv_build_system_type="$build"
22 ac_cv_target_system_type="$target"
27 dnl By default, many hosts won't let programs access large files;
28 dnl one must use special compiler options to get large-file access to work.
29 dnl For more details about this brain damage please see:
30 dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
32 dnl Written by Paul Eggert <eggert@twinsun.com>.
34 dnl Internal subroutine of AC_SYS_LARGEFILE.
35 dnl AC_SYS_LARGEFILE_TEST_INCLUDES
36 AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
37 [[#include <sys/types.h>
38 int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
41 dnl Internal subroutine of AC_SYS_LARGEFILE.
42 dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
43 AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
44 [AC_CACHE_CHECK([for $1 value needed for large files], $3,
46 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES
51 [AC_TRY_COMPILE([#define $1 $2]
52 AC_SYS_LARGEFILE_TEST_INCLUDES
57 if test "[$]$3" != no; then
58 AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
61 AC_DEFUN([AC_SYS_LARGEFILE],
62 [AC_ARG_ENABLE(largefile,
63 [ --disable-largefile omit support for large files])
64 if test "$enable_largefile" != no; then
66 AC_CACHE_CHECK([for special C compiler options needed for large files],
67 ac_cv_sys_largefile_CC,
68 [ac_cv_sys_largefile_CC=no
69 if test "$GCC" != yes; then
70 # IRIX 6.2 and later do not support large files by default,
71 # so use the C compiler's -n32 option if that helps.
72 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
75 AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
76 ac_cv_sys_largefile_CC=' -n32')
79 if test "$ac_cv_sys_largefile_CC" != no; then
80 CC="$CC$ac_cv_sys_largefile_CC"
83 AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
84 ac_cv_sys_file_offset_bits,
85 [Number of bits in a file offset, on hosts where this is settable.])
86 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
87 ac_cv_sys_largefile_source,
88 [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
89 [#include <stdio.h>], [return !ftello;])
90 AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
91 ac_cv_sys_large_files,
92 [Define for large files, on AIX-style hosts.])
93 AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
94 ac_cv_sys_xopen_source,
95 [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
96 [#include <stdio.h>], [return !ftello;])
100 dnl Check for socklen_t: historically on BSD it is an int, and in
101 dnl POSIX 1g it is a type of its own, but some platforms use different
102 dnl types for the argument to getsockopt, getpeername, etc. So we
103 dnl have to test to find something that will work.
105 dnl This test originally comes from lftp, by way of Albert Chin at The
106 dnl Written Word. Thanks!
108 AC_DEFUN([TYPE_SOCKLEN_T],
110 AC_MSG_CHECKING([for socklen_t])
111 AC_CACHE_VAL([lftp_cv_socklen_t],
115 #include <sys/types.h>
116 #include <sys/socket.h>
120 getpeername(0,0,&len);
123 lftp_cv_socklen_t=yes
126 AC_MSG_RESULT($lftp_cv_socklen_t)
127 if test $lftp_cv_socklen_t = no; then
128 AC_MSG_CHECKING([for socklen_t equivalent])
129 AC_CACHE_VAL([lftp_cv_socklen_t_equiv],
131 lftp_cv_socklen_t_equiv=int
133 for t in int size_t unsigned long "unsigned long"; do
135 #include <sys/types.h>
136 #include <sys/socket.h>
140 getpeername(0,0,&len);
143 lftp_cv_socklen_t_equiv="$t"
148 AC_MSG_RESULT($lftp_cv_socklen_t_equiv)
149 AC_DEFINE_UNQUOTED(socklen_t, $lftp_cv_socklen_t_equiv,
150 [type to use in place of socklen_t if not defined])