| 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 |
| 4 | dnl error message. |
| 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]) |
| 15 | ifelse($#, 1, [$1], |
| 16 | [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) |
| 17 | else |
| 18 | AC_MSG_RESULT([same]) |
| 19 | fi |
| 20 | ac_cv_host_system_type="$host" |
| 21 | ac_cv_build_system_type="$build" |
| 22 | ac_cv_target_system_type="$target" |
| 23 | ]) |
| 24 | |
| 25 | #serial 12 |
| 26 | |
| 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 |
| 31 | |
| 32 | dnl Written by Paul Eggert <eggert@twinsun.com>. |
| 33 | |
| 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]; |
| 39 | ]]) |
| 40 | |
| 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, |
| 45 | [$3=no |
| 46 | AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES |
| 47 | $5 |
| 48 | , |
| 49 | [$6], |
| 50 | , |
| 51 | [AC_TRY_COMPILE([#define $1 $2] |
| 52 | AC_SYS_LARGEFILE_TEST_INCLUDES |
| 53 | $5 |
| 54 | , |
| 55 | [$6], |
| 56 | [$3=$2])])]) |
| 57 | if test "[$]$3" != no; then |
| 58 | AC_DEFINE_UNQUOTED([$1], [$]$3, [$4]) |
| 59 | fi]) |
| 60 | |
| 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 |
| 65 | |
| 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, , , |
| 73 | [ac_save_CC="$CC" |
| 74 | CC="$CC -n32" |
| 75 | AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , |
| 76 | ac_cv_sys_largefile_CC=' -n32') |
| 77 | CC="$ac_save_CC"]) |
| 78 | fi]) |
| 79 | if test "$ac_cv_sys_largefile_CC" != no; then |
| 80 | CC="$CC$ac_cv_sys_largefile_CC" |
| 81 | fi |
| 82 | |
| 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;]) |
| 97 | fi |
| 98 | ]) |
| 99 | |
| 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. |
| 104 | |
| 105 | dnl This is no good, because passing the wrong pointer on C compilers is |
| 106 | dnl likely to only generate a warning, not an error. We don't call this at |
| 107 | dnl the moment. |
| 108 | |
| 109 | AC_DEFUN([TYPE_SOCKLEN_T], |
| 110 | [ |
| 111 | AC_MSG_CHECKING([for socklen_t]) |
| 112 | AC_CACHE_VAL([lftp_cv_socklen_t], |
| 113 | [ |
| 114 | lftp_cv_socklen_t=no |
| 115 | AC_TRY_COMPILE([ |
| 116 | #include <sys/types.h> |
| 117 | #include <sys/socket.h> |
| 118 | ], |
| 119 | [ |
| 120 | socklen_t len; |
| 121 | getpeername(0,0,&len); |
| 122 | ], |
| 123 | [ |
| 124 | lftp_cv_socklen_t=yes |
| 125 | ]) |
| 126 | ]) |
| 127 | AC_MSG_RESULT($lftp_cv_socklen_t) |
| 128 | if test $lftp_cv_socklen_t = no; then |
| 129 | AC_MSG_CHECKING([for socklen_t equivalent]) |
| 130 | AC_CACHE_VAL([lftp_cv_socklen_t_equiv], |
| 131 | [ |
| 132 | lftp_cv_socklen_t_equiv=int |
| 133 | AC_LANG_SAVE |
| 134 | for t in int size_t unsigned long "unsigned long"; do |
| 135 | AC_TRY_COMPILE([ |
| 136 | #include <sys/types.h> |
| 137 | #include <sys/socket.h> |
| 138 | ], |
| 139 | [ |
| 140 | $t len; |
| 141 | getpeername(0,0,&len); |
| 142 | ], |
| 143 | [ |
| 144 | lftp_cv_socklen_t_equiv="$t" |
| 145 | break |
| 146 | ], |
| 147 | [ |
| 148 | AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |
| 149 | ]) |
| 150 | done |
| 151 | ]) |
| 152 | AC_MSG_RESULT($lftp_cv_socklen_t_equiv) |
| 153 | AC_DEFINE_UNQUOTED(socklen_t, $lftp_cv_socklen_t_equiv, |
| 154 | [type to use in place of socklen_t if not defined]) |
| 155 | fi |
| 156 | ]) |
| 157 | |