Added a couple extra character devices to be copied.
[rsync/rsync.git] / configure.in
... / ...
CommitLineData
1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT()
4AC_CONFIG_SRCDIR([byteorder.h])
5AC_CONFIG_HEADER(config.h)
6AC_PREREQ(2.52)
7
8RSYNC_VERSION=2.6.1pre-1
9AC_SUBST(RSYNC_VERSION)
10AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
11
12AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version])
13
14LDFLAGS=${LDFLAGS-""}
15
16AC_CANONICAL_TARGET([])
17
18dnl Checks for programs.
19AC_PROG_CC
20AC_PROG_CPP
21AC_PROG_EGREP
22AC_PROG_INSTALL
23AC_PROG_CC_STDC
24AC_SUBST(SHELL)
25
26AC_DEFINE([_GNU_SOURCE], 1,
27 [Define _GNU_SOURCE so that we get all necessary prototypes])
28
29if test "x$ac_cv_prog_cc_stdc" = xno
30then
31 AC_MSG_WARN([rsync requires an ANSI C compiler and you don't seem to have one])
32fi
33
34# We must decide this before testing the compiler.
35
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
39AC_MSG_CHECKING([whether to include debugging symbols])
40AC_ARG_ENABLE(debug,
41 AC_HELP_STRING([--enable-debug],
42 [including debugging symbols and features (default yes)]),
43 [], [])
44
45if test x"$enable_debug" = x"no"
46then
47 AC_MSG_RESULT(no)
48 CFLAGS=${CFLAGS-"-O"}
49else
50 AC_MSG_RESULT([yes])
51 # leave CFLAGS alone; AC_PROG_CC will try to include -g if it can
52 dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation])
53 dnl CFLAGS=${CFLAGS-"-g"}
54fi
55
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# Specifically, this turns on panic_action handling.
70AC_ARG_ENABLE(maintainer-mode,
71 AC_HELP_STRING([--enable-maintainer-mode],
72 [turn on extra debug features],
73 [], []))
74if test x"$enable_maintainer_mode" = xyes
75then
76 CFLAGS="$CFLAGS -DMAINTAINER_MODE"
77fi
78
79
80# This is needed for our included version of popt. Kind of silly, but
81# I don't want our version too far out of sync.
82CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
83
84# If GCC, turn on warnings.
85if test "x$GCC" = "xyes"
86then
87 CFLAGS="$CFLAGS -Wall -W"
88fi
89
90AC_ARG_WITH(included-popt,
91 [ --with-included-popt use bundled popt library, not from system])
92
93AC_ARG_WITH(rsync-path,
94 [ --with-rsync-path=PATH set default --rsync-path to PATH (default: rsync)],
95 [ RSYNC_PATH="$with_rsync_path" ],
96 [ RSYNC_PATH="rsync" ])
97
98AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
99
100AC_ARG_WITH(rsyncd-conf,
101 AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
102 [ if test ! -z "$with_rsyncd_conf" ; then
103 case $with_rsyncd_conf in
104 yes|no)
105 RSYNCD_SYSCONF="/etc/rsyncd.conf"
106 ;;
107 /*)
108 RSYNCD_SYSCONF="$with_rsyncd_conf"
109 ;;
110 *)
111 AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-conf=PATH)
112 ;;
113 esac
114 else
115 RSYNCD_SYSCONF="/etc/rsyncd.conf"
116 fi ],
117 [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ])
118
119AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
120
121AC_ARG_WITH(rsh,
122 AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)]))
123
124AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
125AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [remote shell is remsh not rsh])
126
127if test x"$with_rsh" != x
128then
129 RSYNC_RSH="$with_rsh"
130else
131 RSYNC_RSH="ssh"
132fi
133
134AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
135
136# arrgh. libc in the current debian stable screws up the largefile
137# stuff, getting byte range locking wrong
138AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
139AC_TRY_RUN([
140#define _FILE_OFFSET_BITS 64
141#include <stdio.h>
142#include <fcntl.h>
143#include <sys/types.h>
144#include <sys/wait.h>
145
146int main(void)
147{
148 struct flock lock;
149 int status;
150 int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600);
151 lock.l_type = F_WRLCK;
152 lock.l_whence = SEEK_SET;
153 lock.l_start = 0;
154 lock.l_len = 1;
155 lock.l_pid = 0;
156
157 fcntl(fd,F_SETLK,&lock);
158 if (fork() == 0) {
159 lock.l_start = 1;
160 exit(fcntl(fd,F_SETLK,&lock) == 0);
161 }
162 wait(&status);
163 unlink("conftest.dat");
164 exit(WEXITSTATUS(status));
165}
166],
167rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)])
168if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
169 AC_SYS_LARGEFILE
170fi
171
172ipv6type=unknown
173ipv6lib=none
174ipv6trylibc=yes
175
176AC_ARG_ENABLE(ipv6,
177 AC_HELP_STRING([--disable-ipv6], [don't even try to use IPv6]))
178
179if test "x$enable_ipv6" != xno
180then
181 AC_MSG_CHECKING([ipv6 stack type])
182 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
183 case $i in
184 inria)
185 # http://www.kame.net/
186 AC_EGREP_CPP(yes, [
187#include <netinet/in.h>
188#ifdef IPV6_INRIA_VERSION
189yes
190#endif],
191 [ipv6type=$i;
192 AC_DEFINE(INET6, 1, [true if you have IPv6])
193 ])
194 ;;
195 kame)
196 # http://www.kame.net/
197 AC_EGREP_CPP(yes, [
198#include <netinet/in.h>
199#ifdef __KAME__
200yes
201#endif],
202 [ipv6type=$i;
203 AC_DEFINE(INET6, 1, [true if you have IPv6])])
204 ;;
205 linux-glibc)
206 # http://www.v6.linux.or.jp/
207 AC_EGREP_CPP(yes, [
208#include <features.h>
209#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
210yes
211#endif],
212 [ipv6type=$i;
213AC_DEFINE(INET6, 1, [true if you have IPv6])])
214 ;;
215 linux-inet6)
216 # http://www.v6.linux.or.jp/
217 if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
218 ipv6type=$i
219 ipv6lib=inet6
220 ipv6libdir=/usr/inet6/lib
221 ipv6trylibc=yes;
222 AC_DEFINE(INET6, 1, [true if you have IPv6])
223 CFLAGS="-I/usr/inet6/include $CFLAGS"
224 fi
225 ;;
226 toshiba)
227 AC_EGREP_CPP(yes, [
228#include <sys/param.h>
229#ifdef _TOSHIBA_INET6
230yes
231#endif],
232 [ipv6type=$i;
233 ipv6lib=inet6;
234 ipv6libdir=/usr/local/v6/lib;
235 AC_DEFINE(INET6, 1, [true if you have IPv6])])
236 ;;
237 v6d)
238 AC_EGREP_CPP(yes, [
239#include </usr/local/v6/include/sys/v6config.h>
240#ifdef __V6D__
241yes
242#endif],
243 [ipv6type=$i;
244 ipv6lib=v6;
245 ipv6libdir=/usr/local/v6/lib;
246 AC_DEFINE(INET6, 1, [true if you have IPv6])])
247 ;;
248 zeta)
249 AC_EGREP_CPP(yes, [
250#include <sys/param.h>
251#ifdef _ZETA_MINAMI_INET6
252yes
253#endif],
254 [ipv6type=$i;
255 ipv6lib=inet6;
256 ipv6libdir=/usr/local/v6/lib;
257 AC_DEFINE(INET6, 1, [true if you have IPv6])])
258 ;;
259 esac
260 if test "$ipv6type" != "unknown"; then
261 break
262 fi
263 done
264 AC_MSG_RESULT($ipv6type)
265
266 AC_SEARCH_LIBS(getaddrinfo, inet6)
267fi
268
269AC_MSG_CHECKING([whether to call shutdown on all sockets])
270case $host_os in
271 *cygwin* ) AC_MSG_RESULT(yes)
272 AC_DEFINE(SHUTDOWN_ALL_SOCKETS, 1,
273 [Define if sockets need to be shutdown])
274 ;;
275 * ) AC_MSG_RESULT(no);;
276esac
277
278AC_C_BIGENDIAN
279AC_HEADER_DIRENT
280AC_HEADER_TIME
281AC_HEADER_SYS_WAIT
282AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h)
283AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h)
284AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h sys/un.h)
285AC_CHECK_HEADERS(glob.h mcheck.h sys/sysctl.h arpa/inet.h arpa/nameser.h)
286AC_CHECK_HEADERS(netdb.h)
287AC_CHECK_HEADERS(malloc.h)
288AC_CHECK_HEADERS(float.h)
289
290AC_CHECK_SIZEOF(int)
291AC_CHECK_SIZEOF(long)
292AC_CHECK_SIZEOF(short)
293
294AC_C_INLINE
295
296AC_TYPE_SIGNAL
297AC_TYPE_UID_T
298AC_TYPE_MODE_T
299AC_TYPE_OFF_T
300AC_TYPE_SIZE_T
301AC_TYPE_PID_T
302AC_TYPE_GETGROUPS
303AC_CHECK_MEMBERS([struct stat.st_rdev])
304
305AC_CHECK_TYPE([ino_t], [unsigned])
306TYPE_SOCKLEN_T
307
308AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
309 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
310 rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)])
311if test x"$rsync_cv_errno" = x"yes"; then
312 AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ])
313fi
314
315# The following test taken from the cvs sources
316# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
317# These need checks to be before checks for any other functions that
318# might be in the same libraries.
319# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
320# libsocket.so which has a bad implementation of gethostbyname (it
321# only looks in /etc/hosts), so we only look for -lsocket if we need
322# it.
323AC_CHECK_FUNCS(connect)
324if test x"$ac_cv_func_connect" = x"no"; then
325 case "$LIBS" in
326 *-lnsl*) ;;
327 *) AC_CHECK_LIB(nsl_s, printf) ;;
328 esac
329 case "$LIBS" in
330 *-lnsl*) ;;
331 *) AC_CHECK_LIB(nsl, printf) ;;
332 esac
333 case "$LIBS" in
334 *-lsocket*) ;;
335 *) AC_CHECK_LIB(socket, connect) ;;
336 esac
337 case "$LIBS" in
338 *-linet*) ;;
339 *) AC_CHECK_LIB(inet, connect) ;;
340 esac
341 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
342 dnl has been cached.
343 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
344 test x"$ac_cv_lib_inet_connect" = x"yes"; then
345 # ac_cv_func_connect=yes
346 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
347 AC_DEFINE(HAVE_CONNECT, 1, [ ])
348 fi
349fi
350
351AC_CHECK_LIB(resolv, inet_ntop)
352
353dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
354
355AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)])
356AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)])
357
358# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
359# builtin getaddrinfo if one of the defines don't exist
360AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
361 rsync_cv_HAVE_GETADDR_DEFINES,[
362 AC_EGREP_CPP(yes, [
363 #include <sys/types.h>
364 #include <sys/socket.h>
365 #include <netdb.h>
366 #ifdef AI_PASSIVE
367 yes
368 #endif],
369 rsync_cv_HAVE_GETADDR_DEFINES=yes,
370 rsync_cv_HAVE_GETADDR_DEFINES=no)])
371if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes"; then
372 # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
373 # something else so we must include <netdb.h> to get the
374 # redefinition.
375 AC_CHECK_FUNCS(getaddrinfo, ,
376 [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
377 AC_TRY_LINK([#include <sys/types.h>
378 #include <sys/socket.h>
379 #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
380 [AC_MSG_RESULT([yes])
381 AC_DEFINE(HAVE_GETADDRINFO, 1,
382 [Define if you have the `getaddrinfo' function.])],
383 [AC_MSG_RESULT([no])
384 AC_LIBOBJ(lib/getaddrinfo)])])
385 AC_CHECK_FUNCS(getnameinfo, , [AC_LIBOBJ(lib/getnameinfo)])
386else
387 AC_LIBOBJ(lib/getaddrinfo)
388 AC_LIBOBJ(lib/getnameinfo)
389fi
390
391AC_CHECK_MEMBER([struct sockaddr.sa_len],
392 [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
393 [],
394 [
395#include <sys/types.h>
396#include <sys/socket.h>
397])
398
399AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
400 [ AC_DEFINE(HAVE_SOCKADDR_IN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ],
401 [],
402 [
403#include <sys/types.h>
404#include <sys/socket.h>
405#include <netinet/in.h>
406])
407
408AC_MSG_CHECKING(struct sockaddr_storage)
409AC_TRY_COMPILE([#include <sys/types.h>
410#include <sys/socket.h>],
411[struct sockaddr_storage x;],
412 AC_MSG_RESULT(yes)
413 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1,
414 [Define if you have strct sockaddr_storage.] ),
415 AC_MSG_RESULT(no))
416
417AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
418 [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID, 1, [Do we have sockaddr_in6.sin6_scope_id?]) ],
419 [],
420 [
421#include <sys/types.h>
422#include <sys/socket.h>
423#include <netinet/in.h>
424])
425
426# if we can't find strcasecmp, look in -lresolv (for Unixware at least)
427#
428AC_CHECK_FUNCS(strcasecmp)
429if test x"$ac_cv_func_strcasecmp" = x"no"; then
430 AC_CHECK_LIB(resolv, strcasecmp)
431fi
432
433dnl At the moment we don't test for a broken memcmp(), because all we
434dnl need to do is test for equality, not comparison, and it seems that
435dnl every platform has a memcmp that can do at least that.
436dnl AC_FUNC_MEMCMP
437
438AC_FUNC_UTIME_NULL
439AC_FUNC_ALLOCA
440AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod mkfifo \
441 fchmod fstat strchr readlink link utime utimes strftime mtrace \
442 memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk \
443 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid)
444
445AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
446AC_TRY_RUN([
447#include <sys/types.h>
448#include <sys/socket.h>
449
450main() {
451 int fd[2];
452 exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
453}],
454rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
455if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
456 AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ])
457fi
458
459if test x"$with_included_popt" != x"yes"
460then
461 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
462fi
463
464AC_MSG_CHECKING([whether to use included libpopt])
465if test x"$with_included_popt" = x"yes"
466then
467 AC_MSG_RESULT($srcdir/popt)
468 BUILD_POPT='$(popt_OBJS)'
469 CFLAGS="$CFLAGS -I$srcdir/popt"
470 if test x"$ALLOCA" != x
471 then
472 # this can be removed when/if we add an included alloca.c;
473 # see autoconf documentation on AC_FUNC_ALLOCA
474 AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
475 fi
476else
477 AC_MSG_RESULT(no)
478fi
479
480AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[
481AC_TRY_RUN([#include <stdio.h>
482main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
483rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)])
484if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then
485 AC_DEFINE(HAVE_LONGLONG, 1, [ ])
486fi
487
488AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[
489AC_TRY_RUN([#include <stdio.h>
490#include <sys/stat.h>
491main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
492rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)])
493if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then
494 AC_DEFINE(HAVE_OFF64_T, 1, [ ])
495fi
496
497AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[
498AC_TRY_RUN([#include <stdio.h>
499#include <sys/types.h>
500#include <sys/stat.h>
501main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }],
502rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)])
503if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then
504 AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ])
505fi
506
507AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[
508AC_TRY_RUN([#include <stdio.h>
509main() { char c; c=250; exit((c > 0)?0:1); }],
510rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)])
511if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
512 AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ])
513fi
514
515AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
516AC_TRY_RUN([#include <sys/types.h>
517#include <dirent.h>
518main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
519if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
520di->d_name[0] == 0) exit(0); exit(1);} ],
521rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
522if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
523 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ])
524fi
525
526AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[
527AC_TRY_COMPILE([#include <sys/types.h>
528#include <utime.h>],
529[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
530rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)])
531if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then
532 AC_DEFINE(HAVE_UTIMBUF, 1, [ ])
533fi
534
535AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
536AC_TRY_RUN([
537#include <sys/time.h>
538#include <unistd.h>
539main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
540 rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
541if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
542 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ])
543fi
544
545AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
546AC_TRY_RUN([
547#include <sys/types.h>
548#include <stdarg.h>
549void foo(const char *format, ...) {
550 va_list ap;
551 int len;
552 char buf[5];
553
554 va_start(ap, format);
555 len = vsnprintf(0, 0, format, ap);
556 va_end(ap);
557 if (len != 5) exit(1);
558
559 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
560
561 exit(0);
562}
563main() { foo("hello"); }
564],
565rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
566if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
567 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ])
568fi
569
570
571AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
572AC_TRY_RUN([#include <stdlib.h>
573#include <sys/types.h>
574#include <sys/stat.h>
575#include <unistd.h>
576main() {
577 struct stat st;
578 char tpl[20]="/tmp/test.XXXXXX";
579 int fd = mkstemp(tpl);
580 if (fd == -1) exit(1);
581 unlink(tpl);
582 if (fstat(fd, &st) != 0) exit(1);
583 if ((st.st_mode & 0777) != 0600) exit(1);
584 exit(0);
585}],
586rsync_cv_HAVE_SECURE_MKSTEMP=yes,
587rsync_cv_HAVE_SECURE_MKSTEMP=no,
588rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
589if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
590 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ])
591fi
592
593
594AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[
595AC_TRY_RUN([
596#include <stdio.h>
597#include <sys/types.h>
598#include <netinet/in.h>
599#include <arpa/inet.h>
600main() { struct in_addr ip; ip.s_addr = 0x12345678;
601if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
602 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); }
603exit(0);}],
604 rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)])
605if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then
606 AC_DEFINE(REPLACE_INET_NTOA, 1, [ ])
607fi
608
609
610AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[
611AC_TRY_RUN([
612#include <stdio.h>
613#include <sys/types.h>
614#include <netinet/in.h>
615#include <arpa/inet.h>
616main() { struct in_addr ip;
617if (inet_aton("example", &ip) == 0) exit(0); exit(1);}],
618 rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)])
619if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then
620 AC_DEFINE(REPLACE_INET_ATON, 1, [ ])
621fi
622
623#
624# The following test was mostly taken from the tcl/tk plus patches
625#
626AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
627rm -rf conftest*
628cat > conftest.$ac_ext <<EOF
629int main() { return 0; }
630EOF
631${CC-cc} -c -o conftest..o conftest.$ac_ext
632if test -f conftest..o; then
633 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
634else
635 rsync_cv_DASHC_WORKS_WITH_DASHO=no
636fi
637rm -rf conftest*
638])
639if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
640 OBJ_SAVE="#"
641 OBJ_RESTORE="#"
642 CC_SHOBJ_FLAG='-o $@'
643else
644 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
645 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'
646 CC_SHOBJ_FLAG=""
647fi
648
649AC_SUBST(OBJ_SAVE)
650AC_SUBST(OBJ_RESTORE)
651AC_SUBST(CC_SHOBJ_FLAG)
652AC_SUBST(BUILD_POPT)
653
654AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
655AC_OUTPUT
656
657if test x"$with_rsh" = x; then
658 if test x"$HAVE_REMSH" = x1; then
659 rmsh1='remsh:'
660 rmsh2='=remsh'
661 else
662 rmsh1='rsh: '
663 rmsh2='=rsh '
664 fi
665 AC_MSG_RESULT()
666 AC_MSG_RESULT([ **********************************************************************])
667 AC_MSG_RESULT([ * As of v2.6.0, the default remote shell is ssh instead of rsh!! *])
668 AC_MSG_RESULT([ * To use previous default of $rmsh1 ./configure --with-rsh$rmsh2 *])
669 AC_MSG_RESULT([ **********************************************************************])
670fi
671
672AC_MSG_RESULT()
673AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
674AC_MSG_RESULT()