]>
Commit | Line | Data |
---|---|---|
c627d613 | 1 | dnl Process this file with autoconf to produce a configure script. |
06963d0f | 2 | |
bf5c2bf6 MP |
3 | AC_INIT() |
4 | AC_CONFIG_SRCDIR([byteorder.h]) | |
c627d613 | 5 | AC_CONFIG_HEADER(config.h) |
7ca6e856 | 6 | AC_PREREQ(2.52) |
c627d613 | 7 | |
19119cbd | 8 | RSYNC_VERSION=2.6.1cvs |
68b2cc55 MP |
9 | AC_SUBST(RSYNC_VERSION) |
10 | AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION]) | |
11 | ||
12 | AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version]) | |
13 | ||
6a48ca56 | 14 | LDFLAGS=${LDFLAGS-""} |
50abd20b | 15 | |
bf5c2bf6 MP |
16 | AC_CANONICAL_TARGET([]) |
17 | ||
18 | dnl Checks for programs. | |
19 | AC_PROG_CC | |
20 | AC_PROG_CPP | |
bbfb1d01 | 21 | AC_PROG_EGREP |
bf5c2bf6 | 22 | AC_PROG_INSTALL |
68b2cc55 | 23 | AC_PROG_CC_STDC |
bf5c2bf6 | 24 | AC_SUBST(SHELL) |
8de330a3 | 25 | |
70ed474b MP |
26 | AC_DEFINE([_GNU_SOURCE], 1, |
27 | [Define _GNU_SOURCE so that we get all necessary prototypes]) | |
28 | ||
5216de37 | 29 | if test "x$ac_cv_prog_cc_stdc" = xno |
68b2cc55 MP |
30 | then |
31 | AC_MSG_WARN([rsync requires an ANSI C compiler and you don't seem to have one]) | |
32 | fi | |
a358449a | 33 | |
03b1cddc | 34 | # We must decide this before testing the compiler. |
2d1ebe9c | 35 | |
47759343 MP |
36 | # Please allow this to default to yes, so that your users have more |
37 | # chance of getting a useful stack trace if problems occur. | |
38 | ||
bf5c2bf6 | 39 | AC_MSG_CHECKING([whether to include debugging symbols]) |
2d1ebe9c | 40 | AC_ARG_ENABLE(debug, |
bf5c2bf6 MP |
41 | AC_HELP_STRING([--enable-debug], |
42 | [including debugging symbols and features (default yes)]), | |
43 | [], []) | |
2d1ebe9c | 44 | |
bf5c2bf6 | 45 | if test x"$enable_debug" = x"no" |
2d1ebe9c | 46 | then |
2d1ebe9c MP |
47 | AC_MSG_RESULT(no) |
48 | CFLAGS=${CFLAGS-"-O"} | |
bf5c2bf6 MP |
49 | else |
50 | AC_MSG_RESULT([yes]) | |
51 | # leave CFLAGS alone; AC_PROG_CC will try to include -g if it can | |
23bf32f7 | 52 | dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation]) |
bf5c2bf6 | 53 | dnl CFLAGS=${CFLAGS-"-g"} |
2d1ebe9c MP |
54 | fi |
55 | ||
da7b6397 MP |
56 | |
57 | ||
58 | ||
59 | AC_ARG_ENABLE(profile, | |
60 | AC_HELP_STRING([--enable-profile], | |
61 | [turn on CPU profiling (default no)], | |
62 | [], [])) | |
63 | if test x"$enable_profile" = xyes | |
64 | then | |
65 | CFLAGS="$CFLAGS -pg" | |
66 | fi | |
67 | ||
68 | ||
c0531332 MP |
69 | # Specifically, this turns on panic_action handling. |
70 | AC_ARG_ENABLE(maintainer-mode, | |
71 | AC_HELP_STRING([--enable-maintainer-mode], | |
72 | [turn on extra debug features], | |
73 | [], [])) | |
74 | if test x"$enable_maintainer_mode" = xyes | |
75 | then | |
76 | CFLAGS="$CFLAGS -DMAINTAINER_MODE" | |
77 | fi | |
78 | ||
79 | ||
da7b6397 MP |
80 | # This is needed for our included version of popt. Kind of silly, but |
81 | # I don't want our version too far out of sync. | |
1ac15cd8 MP |
82 | CFLAGS="$CFLAGS -DHAVE_CONFIG_H" |
83 | ||
47759343 MP |
84 | # If GCC, turn on warnings. |
85 | if test "x$GCC" = "xyes" | |
86 | then | |
99f106d1 | 87 | CFLAGS="$CFLAGS -Wall -W" |
47759343 MP |
88 | fi |
89 | ||
2d1ebe9c MP |
90 | AC_ARG_WITH(included-popt, |
91 | [ --with-included-popt use bundled popt library, not from system]) | |
92 | ||
41bd28fe | 93 | AC_ARG_WITH(rsync-path, |
f40f2fc8 | 94 | [ --with-rsync-path=PATH set default --rsync-path to PATH (default: rsync)], |
8642efd0 | 95 | [ RSYNC_PATH="$with_rsync_path" ], |
41bd28fe | 96 | [ RSYNC_PATH="rsync" ]) |
81c652d5 MP |
97 | |
98 | AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine]) | |
99 | ||
cd3fe9fb WD |
100 | AC_ARG_WITH(rsyncd-conf, |
101 | AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]), | |
102 | [ if test ! -z "$with_rsyncd_conf" ; then | |
103 | case $with_rsyncd_conf in | |
104 | yes|no) | |
105 | RSYNCD_SYSCONF="/etc/rsyncd.conf" | |
106 | ;; | |
107 | /*) | |
108 | RSYNCD_SYSCONF="$with_rsyncd_conf" | |
109 | ;; | |
110 | *) | |
111 | AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-conf=PATH) | |
112 | ;; | |
113 | esac | |
114 | else | |
115 | RSYNCD_SYSCONF="/etc/rsyncd.conf" | |
116 | fi ], | |
117 | [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ]) | |
118 | ||
119 | AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server]) | |
120 | ||
81c652d5 | 121 | AC_ARG_WITH(rsh, |
f40f2fc8 | 122 | AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)])) |
41bd28fe | 123 | |
7b8356d0 | 124 | AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0) |
81c652d5 MP |
125 | AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [remote shell is remsh not rsh]) |
126 | ||
127 | if test x"$with_rsh" != x | |
128 | then | |
129 | RSYNC_RSH="$with_rsh" | |
81c652d5 | 130 | else |
f40f2fc8 | 131 | RSYNC_RSH="ssh" |
81c652d5 | 132 | fi |
7b8356d0 | 133 | |
81c652d5 | 134 | AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command]) |
f0af1e5e AT |
135 | |
136 | # arrgh. libc in the current debian stable screws up the largefile | |
137 | # stuff, getting byte range locking wrong | |
138 | AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[ | |
139 | AC_TRY_RUN([ | |
140 | #define _FILE_OFFSET_BITS 64 | |
141 | #include <stdio.h> | |
142 | #include <fcntl.h> | |
143 | #include <sys/types.h> | |
144 | #include <sys/wait.h> | |
145 | ||
2ef2e822 | 146 | int main(void) |
f0af1e5e AT |
147 | { |
148 | struct flock lock; | |
149 | int status; | |
150 | int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600); | |
151 | lock.l_type = F_WRLCK; | |
152 | lock.l_whence = SEEK_SET; | |
153 | lock.l_start = 0; | |
154 | lock.l_len = 1; | |
155 | lock.l_pid = 0; | |
156 | ||
157 | fcntl(fd,F_SETLK,&lock); | |
158 | if (fork() == 0) { | |
159 | lock.l_start = 1; | |
160 | exit(fcntl(fd,F_SETLK,&lock) == 0); | |
161 | } | |
162 | wait(&status); | |
163 | unlink("conftest.dat"); | |
164 | exit(WEXITSTATUS(status)); | |
165 | } | |
166 | ], | |
167 | rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)]) | |
168 | if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then | |
169 | AC_SYS_LARGEFILE | |
170 | fi | |
171 | ||
06963d0f MP |
172 | ipv6type=unknown |
173 | ipv6lib=none | |
22cd0063 | 174 | ipv6trylibc=yes |
06963d0f | 175 | |
2ef2e822 | 176 | AC_ARG_ENABLE(ipv6, |
17d5a07e MP |
177 | AC_HELP_STRING([--disable-ipv6], [don't even try to use IPv6])) |
178 | ||
179 | if test "x$enable_ipv6" != xno | |
180 | then | |
06963d0f MP |
181 | AC_MSG_CHECKING([ipv6 stack type]) |
182 | for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do | |
183 | case $i in | |
184 | inria) | |
185 | # http://www.kame.net/ | |
186 | AC_EGREP_CPP(yes, [ | |
187 | #include <netinet/in.h> | |
188 | #ifdef IPV6_INRIA_VERSION | |
189 | yes | |
190 | #endif], | |
191 | [ipv6type=$i; | |
a358449a MP |
192 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
193 | ]) | |
06963d0f MP |
194 | ;; |
195 | kame) | |
196 | # http://www.kame.net/ | |
197 | AC_EGREP_CPP(yes, [ | |
198 | #include <netinet/in.h> | |
199 | #ifdef __KAME__ | |
200 | yes | |
201 | #endif], | |
2ef2e822 | 202 | [ipv6type=$i; |
a358449a | 203 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
204 | ;; |
205 | linux-glibc) | |
206 | # http://www.v6.linux.or.jp/ | |
207 | AC_EGREP_CPP(yes, [ | |
208 | #include <features.h> | |
209 | #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 | |
210 | yes | |
211 | #endif], | |
212 | [ipv6type=$i; | |
a358449a | 213 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
214 | ;; |
215 | linux-inet6) | |
216 | # http://www.v6.linux.or.jp/ | |
217 | if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then | |
218 | ipv6type=$i | |
219 | ipv6lib=inet6 | |
220 | ipv6libdir=/usr/inet6/lib | |
221 | ipv6trylibc=yes; | |
a358449a MP |
222 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
223 | CFLAGS="-I/usr/inet6/include $CFLAGS" | |
06963d0f MP |
224 | fi |
225 | ;; | |
226 | toshiba) | |
227 | AC_EGREP_CPP(yes, [ | |
228 | #include <sys/param.h> | |
229 | #ifdef _TOSHIBA_INET6 | |
230 | yes | |
231 | #endif], | |
232 | [ipv6type=$i; | |
233 | ipv6lib=inet6; | |
234 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 235 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
236 | ;; |
237 | v6d) | |
238 | AC_EGREP_CPP(yes, [ | |
239 | #include </usr/local/v6/include/sys/v6config.h> | |
240 | #ifdef __V6D__ | |
241 | yes | |
242 | #endif], | |
243 | [ipv6type=$i; | |
244 | ipv6lib=v6; | |
245 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 246 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
247 | ;; |
248 | zeta) | |
249 | AC_EGREP_CPP(yes, [ | |
250 | #include <sys/param.h> | |
251 | #ifdef _ZETA_MINAMI_INET6 | |
252 | yes | |
253 | #endif], | |
254 | [ipv6type=$i; | |
255 | ipv6lib=inet6; | |
256 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 257 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
258 | ;; |
259 | esac | |
260 | if test "$ipv6type" != "unknown"; then | |
261 | break | |
262 | fi | |
263 | done | |
264 | AC_MSG_RESULT($ipv6type) | |
06963d0f | 265 | |
17d5a07e MP |
266 | AC_SEARCH_LIBS(getaddrinfo, inet6) |
267 | fi | |
06963d0f | 268 | |
9f639210 DD |
269 | AC_MSG_CHECKING([whether to call shutdown on all sockets]) |
270 | case $host_os in | |
271 | *cygwin* ) AC_MSG_RESULT(yes) | |
2ef2e822 | 272 | AC_DEFINE(SHUTDOWN_ALL_SOCKETS, 1, |
8ed16deb DD |
273 | [Define if sockets need to be shutdown]) |
274 | ;; | |
275 | * ) AC_MSG_RESULT(no);; | |
276 | esac | |
277 | ||
cd957c70 | 278 | AC_C_BIGENDIAN |
c627d613 | 279 | AC_HEADER_DIRENT |
c627d613 AT |
280 | AC_HEADER_TIME |
281 | AC_HEADER_SYS_WAIT | |
8bf73749 | 282 | AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) |
94481d91 | 283 | AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) |
1433e6da | 284 | AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h sys/un.h) |
7fc08908 | 285 | AC_CHECK_HEADERS(glob.h mcheck.h sys/sysctl.h arpa/inet.h arpa/nameser.h) |
15c17078 | 286 | AC_CHECK_HEADERS(netdb.h) |
e5a2b854 | 287 | AC_CHECK_HEADERS(malloc.h) |
7c66b860 | 288 | AC_CHECK_HEADERS(float.h) |
c627d613 AT |
289 | |
290 | AC_CHECK_SIZEOF(int) | |
291 | AC_CHECK_SIZEOF(long) | |
292 | AC_CHECK_SIZEOF(short) | |
293 | ||
294 | AC_C_INLINE | |
295 | ||
296 | AC_TYPE_SIGNAL | |
297 | AC_TYPE_UID_T | |
298 | AC_TYPE_MODE_T | |
299 | AC_TYPE_OFF_T | |
300 | AC_TYPE_SIZE_T | |
301 | AC_TYPE_PID_T | |
9422bb3f | 302 | AC_TYPE_GETGROUPS |
bf5c2bf6 MP |
303 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
304 | ||
e2ba16cc | 305 | AC_CHECK_TYPE([ino_t], [unsigned]) |
7ca6e856 | 306 | TYPE_SOCKLEN_T |
c627d613 | 307 | |
7b3d4257 | 308 | AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [ |
7597e1a9 | 309 | AC_TRY_COMPILE([#include <errno.h>],[int i = errno], |
7b3d4257 AT |
310 | rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)]) |
311 | if test x"$rsync_cv_errno" = x"yes"; then | |
d4e4cbe1 | 312 | AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ]) |
7597e1a9 | 313 | fi |
c627d613 | 314 | |
a784e10d DD |
315 | # The following test taken from the cvs sources |
316 | # If we can't find connect, try looking in -lsocket, -lnsl, and -linet. | |
317 | # These need checks to be before checks for any other functions that | |
318 | # might be in the same libraries. | |
319 | # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has | |
320 | # libsocket.so which has a bad implementation of gethostbyname (it | |
321 | # only looks in /etc/hosts), so we only look for -lsocket if we need | |
322 | # it. | |
323 | AC_CHECK_FUNCS(connect) | |
324 | if test x"$ac_cv_func_connect" = x"no"; then | |
325 | case "$LIBS" in | |
326 | *-lnsl*) ;; | |
327 | *) AC_CHECK_LIB(nsl_s, printf) ;; | |
328 | esac | |
329 | case "$LIBS" in | |
330 | *-lnsl*) ;; | |
331 | *) AC_CHECK_LIB(nsl, printf) ;; | |
332 | esac | |
333 | case "$LIBS" in | |
334 | *-lsocket*) ;; | |
335 | *) AC_CHECK_LIB(socket, connect) ;; | |
336 | esac | |
337 | case "$LIBS" in | |
338 | *-linet*) ;; | |
339 | *) AC_CHECK_LIB(inet, connect) ;; | |
340 | esac | |
341 | dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value | |
342 | dnl has been cached. | |
2ef2e822 | 343 | if test x"$ac_cv_lib_socket_connect" = x"yes" || |
a784e10d DD |
344 | test x"$ac_cv_lib_inet_connect" = x"yes"; then |
345 | # ac_cv_func_connect=yes | |
346 | # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run | |
d4e4cbe1 | 347 | AC_DEFINE(HAVE_CONNECT, 1, [ ]) |
a784e10d DD |
348 | fi |
349 | fi | |
350 | ||
8f694072 MP |
351 | AC_CHECK_LIB(resolv, inet_ntop) |
352 | ||
99f106d1 | 353 | dnl AC_MSG_NOTICE([Looking in libraries: $LIBS]) |
e94989fe | 354 | |
2ef2e822 WD |
355 | AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)]) |
356 | AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)]) | |
356bbb83 | 357 | |
824f1c79 DD |
358 | # Irix 6.5 has getaddrinfo but not the corresponding defines, so use |
359 | # builtin getaddrinfo if one of the defines don't exist | |
184dede9 DD |
360 | AC_CACHE_CHECK([whether defines needed by getaddrinfo exist], |
361 | rsync_cv_HAVE_GETADDR_DEFINES,[ | |
362 | AC_EGREP_CPP(yes, [ | |
363 | #include <sys/types.h> | |
364 | #include <sys/socket.h> | |
365 | #include <netdb.h> | |
366 | #ifdef AI_PASSIVE | |
367 | yes | |
2ef2e822 | 368 | #endif], |
184dede9 DD |
369 | rsync_cv_HAVE_GETADDR_DEFINES=yes, |
370 | rsync_cv_HAVE_GETADDR_DEFINES=no)]) | |
371 | if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes"; then | |
824f1c79 DD |
372 | # Tru64 UNIX has getaddrinfo() but has it renamed in libc as |
373 | # something else so we must include <netdb.h> to get the | |
374 | # redefinition. | |
375 | AC_CHECK_FUNCS(getaddrinfo, , | |
376 | [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>]) | |
377 | AC_TRY_LINK([#include <sys/types.h> | |
378 | #include <sys/socket.h> | |
379 | #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);], | |
380 | [AC_MSG_RESULT([yes]) | |
381 | AC_DEFINE(HAVE_GETADDRINFO, 1, | |
382 | [Define if you have the `getaddrinfo' function.])], | |
383 | [AC_MSG_RESULT([no]) | |
384 | AC_LIBOBJ(lib/getaddrinfo)])]) | |
2ef2e822 | 385 | AC_CHECK_FUNCS(getnameinfo, , [AC_LIBOBJ(lib/getnameinfo)]) |
184dede9 | 386 | else |
d2cc0323 | 387 | AC_LIBOBJ(lib/getaddrinfo) |
184dede9 DD |
388 | AC_LIBOBJ(lib/getnameinfo) |
389 | fi | |
824f1c79 | 390 | |
82923068 | 391 | |
2ef2e822 | 392 | AC_CHECK_MEMBER([struct sockaddr.sa_len], |
356bbb83 MP |
393 | [ AC_DEFINE(HAVE_SOCKADDR_LEN) ], |
394 | [], | |
395 | [ | |
396 | #include <sys/types.h> | |
397 | #include <sys/socket.h> | |
398 | ]) | |
399 | ||
2d6dbe29 MP |
400 | AC_MSG_CHECKING(struct sockaddr_storage) |
401 | AC_TRY_COMPILE([#include <sys/types.h> | |
402 | #include <sys/socket.h>], | |
403 | [struct sockaddr_storage x;], | |
404 | AC_MSG_RESULT(yes) | |
2ef2e822 | 405 | AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, |
9fecec5e | 406 | [Define if you have strct sockaddr_storage.] ), |
2d6dbe29 MP |
407 | AC_MSG_RESULT(no)) |
408 | ||
bc2b4963 DD |
409 | AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id], |
410 | [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID) ], | |
411 | [], | |
412 | [ | |
413 | #include <sys/types.h> | |
414 | #include <sys/socket.h> | |
415 | #include <netinet/in.h> | |
416 | ]) | |
417 | ||
a784e10d DD |
418 | # if we can't find strcasecmp, look in -lresolv (for Unixware at least) |
419 | # | |
420 | AC_CHECK_FUNCS(strcasecmp) | |
421 | if test x"$ac_cv_func_strcasecmp" = x"no"; then | |
422 | AC_CHECK_LIB(resolv, strcasecmp) | |
423 | fi | |
424 | ||
87fcb639 MP |
425 | dnl At the moment we don't test for a broken memcmp(), because all we |
426 | dnl need to do is test for equality, not comparison, and it seems that | |
2ef2e822 | 427 | dnl every platform has a memcmp that can do at least that. |
87fcb639 MP |
428 | dnl AC_FUNC_MEMCMP |
429 | ||
c627d613 | 430 | AC_FUNC_UTIME_NULL |
7fc08908 | 431 | AC_FUNC_ALLOCA |
5fdf2e70 WD |
432 | AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod mkfifo \ |
433 | fchmod fstat strchr readlink link utime utimes strftime mtrace \ | |
434 | memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk \ | |
435 | strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid) | |
24c857f1 DD |
436 | |
437 | AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ | |
6a5ef41f MP |
438 | AC_TRY_RUN([ |
439 | #include <sys/types.h> | |
440 | #include <sys/socket.h> | |
441 | ||
442 | main() { | |
443 | int fd[2]; | |
444 | exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); | |
445 | }], | |
24c857f1 DD |
446 | rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) |
447 | if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then | |
d4e4cbe1 | 448 | AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ]) |
24c857f1 | 449 | fi |
c627d613 | 450 | |
1ac15cd8 MP |
451 | if test x"$with_included_popt" != x"yes" |
452 | then | |
453 | AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) | |
454 | fi | |
2d1ebe9c | 455 | |
12458878 | 456 | AC_MSG_CHECKING([whether to use included libpopt]) |
2d1ebe9c MP |
457 | if test x"$with_included_popt" = x"yes" |
458 | then | |
12458878 | 459 | AC_MSG_RESULT($srcdir/popt) |
1ac15cd8 | 460 | BUILD_POPT='$(popt_OBJS)' |
26ef00bd | 461 | CFLAGS="$CFLAGS -I$srcdir/popt" |
5216de37 | 462 | if test x"$ALLOCA" != x |
7fc08908 | 463 | then |
5216de37 DD |
464 | # this can be removed when/if we add an included alloca.c; |
465 | # see autoconf documentation on AC_FUNC_ALLOCA | |
8af534a5 | 466 | AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)]) |
7fc08908 | 467 | fi |
2d1ebe9c MP |
468 | else |
469 | AC_MSG_RESULT(no) | |
79fc6bdb | 470 | fi |
c627d613 | 471 | |
79fc6bdb | 472 | AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[ |
0d0e2e93 | 473 | AC_TRY_RUN([#include <stdio.h> |
efb2f6bf | 474 | main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }], |
79fc6bdb DD |
475 | rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)]) |
476 | if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then | |
d4e4cbe1 | 477 | AC_DEFINE(HAVE_LONGLONG, 1, [ ]) |
7597e1a9 | 478 | fi |
0d0e2e93 | 479 | |
7b3d4257 | 480 | AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[ |
bcacc18b AT |
481 | AC_TRY_RUN([#include <stdio.h> |
482 | #include <sys/stat.h> | |
7597e1a9 | 483 | main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }], |
7b3d4257 AT |
484 | rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)]) |
485 | if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then | |
d4e4cbe1 | 486 | AC_DEFINE(HAVE_OFF64_T, 1, [ ]) |
7597e1a9 | 487 | fi |
debb4505 | 488 | |
79fc6bdb | 489 | AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[ |
c29ee43d AT |
490 | AC_TRY_RUN([#include <stdio.h> |
491 | #include <sys/types.h> | |
492 | #include <sys/stat.h> | |
493 | main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }], | |
79fc6bdb DD |
494 | rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)]) |
495 | if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then | |
d4e4cbe1 | 496 | AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ]) |
79fc6bdb | 497 | fi |
c29ee43d | 498 | |
7b3d4257 | 499 | AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[ |
debb4505 AT |
500 | AC_TRY_RUN([#include <stdio.h> |
501 | main() { char c; c=250; exit((c > 0)?0:1); }], | |
7b3d4257 AT |
502 | rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)]) |
503 | if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then | |
d4e4cbe1 | 504 | AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ]) |
7597e1a9 | 505 | fi |
bcacc18b | 506 | |
7b3d4257 | 507 | AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ |
59503278 AT |
508 | AC_TRY_RUN([#include <sys/types.h> |
509 | #include <dirent.h> | |
510 | main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); | |
511 | if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && | |
7597e1a9 | 512 | di->d_name[0] == 0) exit(0); exit(1);} ], |
7b3d4257 AT |
513 | rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) |
514 | if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then | |
d4e4cbe1 | 515 | AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ]) |
7597e1a9 | 516 | fi |
1e9f155a | 517 | |
7b3d4257 | 518 | AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[ |
d6e6ecbd AT |
519 | AC_TRY_COMPILE([#include <sys/types.h> |
520 | #include <utime.h>], | |
7597e1a9 | 521 | [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));], |
7b3d4257 AT |
522 | rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)]) |
523 | if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then | |
d4e4cbe1 | 524 | AC_DEFINE(HAVE_UTIMBUF, 1, [ ]) |
7597e1a9 | 525 | fi |
d6e6ecbd | 526 | |
3060d4aa AT |
527 | AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ |
528 | AC_TRY_RUN([ | |
529 | #include <sys/time.h> | |
530 | #include <unistd.h> | |
531 | main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}], | |
532 | rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)]) | |
533 | if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then | |
d4e4cbe1 | 534 | AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ]) |
3060d4aa AT |
535 | fi |
536 | ||
8950ac03 AT |
537 | AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |
538 | AC_TRY_RUN([ | |
539 | #include <sys/types.h> | |
540 | #include <stdarg.h> | |
2ef2e822 | 541 | void foo(const char *format, ...) { |
8950ac03 AT |
542 | va_list ap; |
543 | int len; | |
544 | char buf[5]; | |
545 | ||
546 | va_start(ap, format); | |
547 | len = vsnprintf(0, 0, format, ap); | |
548 | va_end(ap); | |
549 | if (len != 5) exit(1); | |
550 | ||
551 | if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); | |
552 | ||
553 | exit(0); | |
554 | } | |
555 | main() { foo("hello"); } | |
556 | ], | |
557 | rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) | |
558 | if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then | |
d4e4cbe1 | 559 | AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) |
8950ac03 AT |
560 | fi |
561 | ||
562 | ||
f62c17e3 AT |
563 | AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ |
564 | AC_TRY_RUN([#include <stdlib.h> | |
565 | #include <sys/types.h> | |
566 | #include <sys/stat.h> | |
567 | #include <unistd.h> | |
2ef2e822 | 568 | main() { |
f62c17e3 | 569 | struct stat st; |
2ef2e822 WD |
570 | char tpl[20]="/tmp/test.XXXXXX"; |
571 | int fd = mkstemp(tpl); | |
f62c17e3 AT |
572 | if (fd == -1) exit(1); |
573 | unlink(tpl); | |
574 | if (fstat(fd, &st) != 0) exit(1); | |
575 | if ((st.st_mode & 0777) != 0600) exit(1); | |
576 | exit(0); | |
577 | }], | |
578 | rsync_cv_HAVE_SECURE_MKSTEMP=yes, | |
579 | rsync_cv_HAVE_SECURE_MKSTEMP=no, | |
580 | rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) | |
581 | if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then | |
d4e4cbe1 | 582 | AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ]) |
f62c17e3 AT |
583 | fi |
584 | ||
3060d4aa | 585 | |
7b3d4257 AT |
586 | AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[ |
587 | AC_TRY_RUN([ | |
588 | #include <stdio.h> | |
589 | #include <sys/types.h> | |
590 | #include <netinet/in.h> | |
591 | #include <arpa/inet.h> | |
592 | main() { struct in_addr ip; ip.s_addr = 0x12345678; | |
593 | if (strcmp(inet_ntoa(ip),"18.52.86.120") && | |
2ef2e822 | 594 | strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); } |
fca3ef06 AT |
595 | exit(0);}], |
596 | rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)]) | |
7b3d4257 | 597 | if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then |
d4e4cbe1 | 598 | AC_DEFINE(REPLACE_INET_NTOA, 1, [ ]) |
7b3d4257 AT |
599 | fi |
600 | ||
fca3ef06 AT |
601 | |
602 | AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[ | |
603 | AC_TRY_RUN([ | |
604 | #include <stdio.h> | |
605 | #include <sys/types.h> | |
606 | #include <netinet/in.h> | |
607 | #include <arpa/inet.h> | |
2ef2e822 | 608 | main() { struct in_addr ip; |
fca3ef06 AT |
609 | if (inet_aton("example", &ip) == 0) exit(0); exit(1);}], |
610 | rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)]) | |
611 | if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then | |
d4e4cbe1 | 612 | AC_DEFINE(REPLACE_INET_ATON, 1, [ ]) |
fca3ef06 AT |
613 | fi |
614 | ||
692da0b5 DD |
615 | # |
616 | # The following test was mostly taken from the tcl/tk plus patches | |
617 | # | |
79fc6bdb | 618 | AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[ |
692da0b5 DD |
619 | rm -rf conftest* |
620 | cat > conftest.$ac_ext <<EOF | |
621 | int main() { return 0; } | |
622 | EOF | |
623 | ${CC-cc} -c -o conftest..o conftest.$ac_ext | |
624 | if test -f conftest..o; then | |
79fc6bdb DD |
625 | rsync_cv_DASHC_WORKS_WITH_DASHO=yes |
626 | else | |
627 | rsync_cv_DASHC_WORKS_WITH_DASHO=no | |
628 | fi | |
629 | rm -rf conftest* | |
630 | ]) | |
631 | if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then | |
692da0b5 DD |
632 | OBJ_SAVE="#" |
633 | OBJ_RESTORE="#" | |
634 | CC_SHOBJ_FLAG='-o $@' | |
692da0b5 DD |
635 | else |
636 | OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;' | |
637 | OBJ_RESTORE=' @b=`basename $@ .o`;if test "$$b.o" != "$@"; then mv $$b.o $@; if test -f $$b.o.sav; then mv $$b.o.sav $$b.o; fi; fi' | |
638 | CC_SHOBJ_FLAG="" | |
692da0b5 | 639 | fi |
79fc6bdb | 640 | |
692da0b5 DD |
641 | AC_SUBST(OBJ_SAVE) |
642 | AC_SUBST(OBJ_RESTORE) | |
643 | AC_SUBST(CC_SHOBJ_FLAG) | |
1ac15cd8 | 644 | AC_SUBST(BUILD_POPT) |
7d29d4ba | 645 | |
bf5c2bf6 MP |
646 | AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) |
647 | AC_OUTPUT | |
a4677968 | 648 | |
18ced146 WD |
649 | if test x"$with_rsh" = x; then |
650 | if test x"$HAVE_REMSH" = x1; then | |
651 | rmsh1='remsh:' | |
652 | rmsh2='=remsh' | |
653 | else | |
654 | rmsh1='rsh: ' | |
655 | rmsh2='=rsh ' | |
656 | fi | |
657 | AC_MSG_RESULT() | |
658 | AC_MSG_RESULT([ **********************************************************************]) | |
659 | AC_MSG_RESULT([ * As of v2.6.0, the default remote shell is ssh instead of rsh!! *]) | |
660 | AC_MSG_RESULT([ * To use previous default of $rmsh1 ./configure --with-rsh$rmsh2 *]) | |
661 | AC_MSG_RESULT([ **********************************************************************]) | |
662 | fi | |
663 | ||
a4677968 MP |
664 | AC_MSG_RESULT() |
665 | AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful]) | |
666 | AC_MSG_RESULT() |