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