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