don't need to lookup our own name in open_socket_in()
[rsync/rsync.git] / aclocal.m4
CommitLineData
8de330a3
AT
1dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2dnl if the cache file is inconsistent with the current host,
3dnl target and build system types, execute CMD or print a default
4dnl error message.
5AC_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])
3fa64fd0
MP
24
25#serial 12
26
27dnl By default, many hosts won't let programs access large files;
28dnl one must use special compiler options to get large-file access to work.
29dnl For more details about this brain damage please see:
30dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
31
32dnl Written by Paul Eggert <eggert@twinsun.com>.
33
34dnl Internal subroutine of AC_SYS_LARGEFILE.
35dnl AC_SYS_LARGEFILE_TEST_INCLUDES
36AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
37 [[#include <sys/types.h>
38 int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
39 ]])
40
41dnl Internal subroutine of AC_SYS_LARGEFILE.
42dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
76d4988d 43AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE],
3fa64fd0
MP
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]
52AC_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
76d4988d 61AC_DEFUN([AC_SYS_LARGEFILE],
3fa64fd0
MP
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 ])
12458878
MP
99
100dnl Check for socklen_t: historically on BSD it is an int, and in
101dnl POSIX 1g it is a type of its own, but some platforms use different
102dnl types for the argument to getsockopt, getpeername, etc. So we
103dnl have to test to find something that will work.
104
105dnl This test originally comes from lftp, by way of Albert Chin at The
106dnl Written Word. Thanks!
107
108AC_DEFUN([TYPE_SOCKLEN_T],
109[
110 AC_MSG_CHECKING([for socklen_t])
111 AC_CACHE_VAL([lftp_cv_socklen_t],
112 [
113 lftp_cv_socklen_t=no
114 AC_TRY_COMPILE([
115 #include <sys/types.h>
116 #include <sys/socket.h>
117 ],
118 [
119 socklen_t len;
120 getpeername(0,0,&len);
121 ],
122 [
123 lftp_cv_socklen_t=yes
124 ])
125 ])
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],
130 [
131 lftp_cv_socklen_t_equiv=int
132 AC_LANG_SAVE
133 for t in int size_t unsigned long "unsigned long"; do
134 AC_TRY_COMPILE([
135 #include <sys/types.h>
136 #include <sys/socket.h>
137 ],
138 [
139 $t len;
140 getpeername(0,0,&len);
141 ],
142 [
143 lftp_cv_socklen_t_equiv="$t"
144 break
145 ])
146 done
147 ])
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])
151 fi
152])
153