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