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