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