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