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