1 dnl Process this file with autoconf to produce a configure script.
4 AC_CONFIG_SRCDIR([byteorder.h])
5 AC_CONFIG_HEADER(config.h)
10 AC_CANONICAL_TARGET([])
12 dnl Checks for programs.
18 RSYNC_VERSION=2.4.7pre3
19 AC_SUBST(RSYNC_VERSION)
20 AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version])
22 # compile with optimisation and without debugging by default, unless
23 # --debug is given. We must decide this before testing the compiler.
25 AC_MSG_CHECKING([whether to include debugging symbols])
27 AC_HELP_STRING([--enable-debug],
28 [including debugging symbols and features (default yes)]),
31 if test x"$enable_debug" = x"no"
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"}
42 CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
44 AC_ARG_WITH(included-popt,
45 [ --with-included-popt use bundled popt library, not from system])
47 AC_ARG_WITH(rsync-path,
48 [ --with-rsync-path=PATH set default --rsync-path to PATH (default: \"rsync\")],
49 [ RSYNC_PATH="$with_rsync_path" ],
50 [ RSYNC_PATH="rsync" ])
51 AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [ ])
53 AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
54 AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [ ])
57 # arrgh. libc in the current debian stable screws up the largefile
58 # stuff, getting byte range locking wrong
59 AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
61 #define _FILE_OFFSET_BITS 64
64 #include <sys/types.h>
71 int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600);
72 lock.l_type = F_WRLCK;
73 lock.l_whence = SEEK_SET;
78 fcntl(fd,F_SETLK,&lock);
81 exit(fcntl(fd,F_SETLK,&lock) == 0);
84 unlink("conftest.dat");
85 exit(WEXITSTATUS(status));
88 rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)])
89 if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
97 AC_MSG_CHECKING([ipv6 stack type])
98 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
101 # http://www.kame.net/
103 #include <netinet/in.h>
104 #ifdef IPV6_INRIA_VERSION
108 AC_DEFINE(INET6, 1, [true if you have IPv6])
112 # http://www.kame.net/
114 #include <netinet/in.h>
119 AC_DEFINE(INET6, 1, [true if you have IPv6])])
122 # http://www.v6.linux.or.jp/
124 #include <features.h>
125 #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
129 AC_DEFINE(INET6, 1, [true if you have IPv6])])
132 # http://www.v6.linux.or.jp/
133 if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
136 ipv6libdir=/usr/inet6/lib
138 AC_DEFINE(INET6, 1, [true if you have IPv6])
139 CFLAGS="-I/usr/inet6/include $CFLAGS"
144 #include <sys/param.h>
145 #ifdef _TOSHIBA_INET6
150 ipv6libdir=/usr/local/v6/lib;
151 AC_DEFINE(INET6, 1, [true if you have IPv6])])
155 #include </usr/local/v6/include/sys/v6config.h>
161 ipv6libdir=/usr/local/v6/lib;
162 AC_DEFINE(INET6, 1, [true if you have IPv6])])
166 #include <sys/param.h>
167 #ifdef _ZETA_MINAMI_INET6
172 ipv6libdir=/usr/local/v6/lib;
173 AC_DEFINE(INET6, 1, [true if you have IPv6])])
176 if test "$ipv6type" != "unknown"; then
180 AC_MSG_RESULT($ipv6type)
182 AC_SEARCH_LIBS(getaddrinfo, inet6)
188 AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h)
189 AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h)
190 AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h)
191 AC_CHECK_HEADERS(glob.h alloca.h mcheck.h sys/sysctl.h arpa/inet.h arpa/nameser.h)
192 AC_CHECK_HEADERS(netdb.h)
195 AC_CHECK_SIZEOF(long)
196 AC_CHECK_SIZEOF(short)
207 AC_CHECK_MEMBERS([struct stat.st_rdev])
209 AC_CHECK_TYPE([ino_t], [unsigned])
212 AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
213 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
214 rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)])
215 if test x"$rsync_cv_errno" = x"yes"; then
216 AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ])
219 # The following test taken from the cvs sources
220 # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
221 # These need checks to be before checks for any other functions that
222 # might be in the same libraries.
223 # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
224 # libsocket.so which has a bad implementation of gethostbyname (it
225 # only looks in /etc/hosts), so we only look for -lsocket if we need
227 AC_CHECK_FUNCS(connect)
228 if test x"$ac_cv_func_connect" = x"no"; then
231 *) AC_CHECK_LIB(nsl_s, printf) ;;
235 *) AC_CHECK_LIB(nsl, printf) ;;
239 *) AC_CHECK_LIB(socket, connect) ;;
243 *) AC_CHECK_LIB(inet, connect) ;;
245 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
247 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
248 test x"$ac_cv_lib_inet_connect" = x"yes"; then
249 # ac_cv_func_connect=yes
250 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
251 AC_DEFINE(HAVE_CONNECT, 1, [ ])
255 AC_CHECK_LIB(resolv, inet_ntop)
257 AC_MSG_NOTICE([Looking in libraries: $LIBS])
259 AC_CHECK_FUNC(inet_ntop, , AC_LIBOBJ(lib/inet_ntop))
260 AC_CHECK_FUNC(inet_pton, , AC_LIBOBJ(lib/inet_pton))
262 AC_CHECK_FUNC(getaddrinfo, , AC_LIBOBJ(lib/getaddrinfo))
263 AC_CHECK_FUNC(getnameinfo, , AC_LIBOBJ(lib/getnameinfo))
265 AC_CHECK_MEMBER([struct sockaddr.sa_len],
266 [ AC_DEFINE(HAVE_SOCKADDR_LEN) ],
269 #include <sys/types.h>
270 #include <sys/socket.h>
273 # if we can't find strcasecmp, look in -lresolv (for Unixware at least)
275 AC_CHECK_FUNCS(strcasecmp)
276 if test x"$ac_cv_func_strcasecmp" = x"no"; then
277 AC_CHECK_LIB(resolv, strcasecmp)
282 AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod)
283 AC_CHECK_FUNCS(fchmod fstat strchr readlink link utime utimes strftime)
284 AC_CHECK_FUNCS(memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk)
285 AC_CHECK_FUNCS(strlcat strlcpy mtrace)
287 AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
288 AC_TRY_RUN([#include <sys/types.h>
289 #include <sys/socket.h>
292 exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
294 rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
295 if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
296 AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ])
299 AC_CACHE_CHECK([for working fnmatch],rsync_cv_HAVE_FNMATCH,[
300 AC_TRY_RUN([#include <fnmatch.h>
301 main() { exit((fnmatch("*.o", "x.o", FNM_PATHNAME) == 0 &&
302 fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME) != 0) ? 0: 1); }],
303 rsync_cv_HAVE_FNMATCH=yes,rsync_cv_HAVE_FNMATCH=no,rsync_cv_HAVE_FNMATCH=cross)])
304 if test x"$rsync_cv_HAVE_FNMATCH" = x"yes"; then
305 AC_DEFINE(HAVE_FNMATCH, 1, [ ])
308 if test x"$with_included_popt" != x"yes"
310 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
313 AC_MSG_CHECKING([whether to use included libpopt])
314 if test x"$with_included_popt" = x"yes"
316 AC_MSG_RESULT($srcdir/popt)
317 BUILD_POPT='$(popt_OBJS)'
318 CFLAGS="$CFLAGS -I$srcdir/popt"
323 AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[
324 AC_TRY_RUN([#include <stdio.h>
325 main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
326 rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)])
327 if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then
328 AC_DEFINE(HAVE_LONGLONG, 1, [ ])
331 AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[
332 AC_TRY_RUN([#include <stdio.h>
333 #include <sys/stat.h>
334 main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
335 rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)])
336 if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then
337 AC_DEFINE(HAVE_OFF64_T, 1, [ ])
340 AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[
341 AC_TRY_RUN([#include <stdio.h>
342 #include <sys/types.h>
343 #include <sys/stat.h>
344 main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }],
345 rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)])
346 if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then
347 AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ])
350 AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[
351 AC_TRY_RUN([#include <stdio.h>
352 main() { char c; c=250; exit((c > 0)?0:1); }],
353 rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)])
354 if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then
355 AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ])
358 AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
359 AC_TRY_RUN([#include <sys/types.h>
361 main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
362 if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
363 di->d_name[0] == 0) exit(0); exit(1);} ],
364 rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
365 if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
366 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ])
369 AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[
370 AC_TRY_COMPILE([#include <sys/types.h>
372 [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
373 rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)])
374 if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then
375 AC_DEFINE(HAVE_UTIMBUF, 1, [ ])
378 AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
380 #include <sys/time.h>
382 main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
383 rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)])
384 if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then
385 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ])
388 AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
390 #include <sys/types.h>
392 void foo(const char *format, ...) {
397 va_start(ap, format);
398 len = vsnprintf(0, 0, format, ap);
400 if (len != 5) exit(1);
402 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
406 main() { foo("hello"); }
408 rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
409 if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
410 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ])
414 AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
415 AC_TRY_RUN([#include <stdlib.h>
416 #include <sys/types.h>
417 #include <sys/stat.h>
421 char tpl[20]="/tmp/test.XXXXXX";
422 int fd = mkstemp(tpl);
423 if (fd == -1) exit(1);
425 if (fstat(fd, &st) != 0) exit(1);
426 if ((st.st_mode & 0777) != 0600) exit(1);
429 rsync_cv_HAVE_SECURE_MKSTEMP=yes,
430 rsync_cv_HAVE_SECURE_MKSTEMP=no,
431 rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
432 if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
433 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ])
437 AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[
440 #include <sys/types.h>
441 #include <netinet/in.h>
442 #include <arpa/inet.h>
443 main() { struct in_addr ip; ip.s_addr = 0x12345678;
444 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
445 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); }
447 rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)])
448 if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then
449 AC_DEFINE(REPLACE_INET_NTOA, 1, [ ])
453 AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[
456 #include <sys/types.h>
457 #include <netinet/in.h>
458 #include <arpa/inet.h>
459 main() { struct in_addr ip;
460 if (inet_aton("example", &ip) == 0) exit(0); exit(1);}],
461 rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)])
462 if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then
463 AC_DEFINE(REPLACE_INET_ATON, 1, [ ])
467 # The following test was mostly taken from the tcl/tk plus patches
469 AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
471 cat > conftest.$ac_ext <<EOF
472 int main() { return 0; }
474 ${CC-cc} -c -o conftest..o conftest.$ac_ext
475 if test -f conftest..o; then
476 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
478 rsync_cv_DASHC_WORKS_WITH_DASHO=no
482 if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
485 CC_SHOBJ_FLAG='-o $@'
487 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
488 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'
493 AC_SUBST(OBJ_RESTORE)
494 AC_SUBST(CC_SHOBJ_FLAG)
497 AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])