]> git.ipfire.org Git - thirdparty/rsync.git/blame - configure.ac
Fix rebuilding configure.sh in an alternate build dir
[thirdparty/rsync.git] / configure.ac
CommitLineData
c627d613 1dnl Process this file with autoconf to produce a configure script.
06963d0f 2
dcbe005a 3AC_INIT([rsync],[3.2.2pre1],[https://rsync.samba.org/bugtracking.html])
066ad8c7
TM
4
5AC_CONFIG_MACRO_DIR([m4])
bf5c2bf6 6AC_CONFIG_SRCDIR([byteorder.h])
c627d613 7AC_CONFIG_HEADER(config.h)
23afe207 8AC_PREREQ([2.69])
c627d613 9
00694610
TM
10AC_SUBST(RSYNC_VERSION, $PACKAGE_VERSION)
11AC_MSG_NOTICE([Configuring rsync $PACKAGE_VERSION])
68b2cc55 12
00694610 13AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$PACKAGE_VERSION"], [rsync release version])
68b2cc55 14
6a48ca56 15LDFLAGS=${LDFLAGS-""}
50abd20b 16
83238ed0 17AC_CANONICAL_HOST
bf5c2bf6 18
317a0e8c
TM
19dnl define the directory for replacement function since AC_LIBOBJ does not
20dnl officially support subdirs and fails with automake
21AC_CONFIG_LIBOBJ_DIR([lib])
22
03b1cddc 23# We must decide this before testing the compiler.
2d1ebe9c 24
47759343
MP
25# Please allow this to default to yes, so that your users have more
26# chance of getting a useful stack trace if problems occur.
27
bf5c2bf6 28AC_MSG_CHECKING([whether to include debugging symbols])
2d1ebe9c 29AC_ARG_ENABLE(debug,
23afe207 30 AS_HELP_STRING([--disable-debug],[disable debugging symbols and features]))
2d1ebe9c 31
79f48760 32if test x"$enable_debug" = x"no"; then
2d1ebe9c 33 AC_MSG_RESULT(no)
44ae5411 34 ac_cv_prog_cc_g=no
bf5c2bf6
MP
35else
36 AC_MSG_RESULT([yes])
23bf32f7 37 dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation])
44ae5411 38 # leave ac_cv_prog_cc_g alone; AC_PROG_CC will try to include -g if it can
2d1ebe9c
MP
39fi
40
44ae5411
WD
41dnl Checks for programs.
42AC_PROG_CC
43AC_PROG_CPP
70c6b408 44AC_PROG_CXX
4965ccf2 45AC_PROG_AWK
44ae5411
WD
46AC_PROG_EGREP
47AC_PROG_INSTALL
70d4a945 48AC_PROG_MKDIR_P
44ae5411
WD
49AC_PROG_CC_STDC
50AC_SUBST(SHELL)
b560a96b 51AC_PATH_PROG([PERL], [perl])
29be5edd 52AC_PATH_PROG([PYTHON3], [python3])
44ae5411
WD
53
54AC_DEFINE([_GNU_SOURCE], 1,
55 [Define _GNU_SOURCE so that we get all necessary prototypes])
56
57if test x"$ac_cv_prog_cc_stdc" = x"no"; then
3f770ab0 58 AC_MSG_WARN([rsync requires an ANSI C compiler and you do not seem to have one])
44ae5411 59fi
da7b6397 60
da7b6397 61AC_ARG_ENABLE(profile,
23afe207 62 AS_HELP_STRING([--enable-profile],[turn on CPU profiling]))
79f48760 63if test x"$enable_profile" = x"yes"; then
da7b6397
MP
64 CFLAGS="$CFLAGS -pg"
65fi
66
29be5edd
WD
67AC_MSG_CHECKING([if md2man can create man pages])
68if test x"$ac_cv_path_PYTHON3" = x; then
69 AC_MSG_RESULT(no - python3 not found)
70 md2man_works=no
29be5edd 71else
f9aece89 72 md2man_out=`"$srcdir/md2man" --test "$srcdir/rsync-ssl.1.md" 2>&1`
111225a9
WD
73 if test $? = 0; then
74 AC_MSG_RESULT(yes)
75 md2man_works=yes
76 else
77 AC_MSG_RESULT(no)
78 md2man_works=no
79 echo "$md2man_out"
80 fi
29be5edd
WD
81fi
82
83AC_MSG_CHECKING([if we require man-page building])
84AC_ARG_ENABLE([md2man],
85 AS_HELP_STRING([--disable-md2man],[disable md2man for man page creation]))
86if test x"$enable_md2man" != x"no"; then
87 if test -f "$srcdir/rsync.1"; then
88 AC_MSG_RESULT(optional)
89 else
90 AC_MSG_RESULT(required)
91 if test x"$md2man_works" = x"no"; then
92 AC_MSG_ERROR(You need python3 and the cmarkgfm OR commonmark python3 lib in order to build man pages.
93You can specify --disable-md2man if you want to skip building them.)
94 fi
95 fi
beaf19c3 96 MAKE_MAN=man
29be5edd
WD
97else
98 AC_MSG_RESULT(no)
beaf19c3 99 MAKE_MAN=''
29be5edd 100fi
da7b6397 101
c0531332
MP
102# Specifically, this turns on panic_action handling.
103AC_ARG_ENABLE(maintainer-mode,
23afe207 104 AS_HELP_STRING([--enable-maintainer-mode],[turn on extra debug features]))
79f48760 105if test x"$enable_maintainer_mode" = x"yes"; then
c0531332
MP
106 CFLAGS="$CFLAGS -DMAINTAINER_MODE"
107fi
108
da7b6397
MP
109# This is needed for our included version of popt. Kind of silly, but
110# I don't want our version too far out of sync.
1ac15cd8
MP
111CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
112
47759343 113# If GCC, turn on warnings.
79f48760 114if test x"$GCC" = x"yes"; then
99f106d1 115 CFLAGS="$CFLAGS -Wall -W"
47759343
MP
116fi
117
2d1ebe9c 118AC_ARG_WITH(included-popt,
23afe207 119 AS_HELP_STRING([--with-included-popt],[use bundled popt library, not from system]))
2d1ebe9c 120
7da17144 121AC_ARG_WITH(included-zlib,
23afe207 122 AS_HELP_STRING([--with-included-zlib],[use bundled zlib library, not from system]))
7da17144 123
4c4a2962 124AC_ARG_WITH(protected-args,
23afe207 125 AS_HELP_STRING([--with-protected-args],[make --protected-args option the default]))
4c4a2962
WD
126if test x"$with_protected_args" = x"yes"; then
127 AC_DEFINE_UNQUOTED(RSYNC_USE_PROTECTED_ARGS, 1, [Define to 1 if --protected-args should be the default])
128fi
129
41bd28fe 130AC_ARG_WITH(rsync-path,
23afe207 131 AS_HELP_STRING([--with-rsync-path=PATH],[set default --rsync-path to PATH (default: rsync)]),
8642efd0 132 [ RSYNC_PATH="$with_rsync_path" ],
41bd28fe 133 [ RSYNC_PATH="rsync" ])
81c652d5
MP
134
135AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
136
cd3fe9fb 137AC_ARG_WITH(rsyncd-conf,
23afe207 138 AS_HELP_STRING([--with-rsyncd-conf=PATH],[set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
cd3fe9fb
WD
139 [ if test ! -z "$with_rsyncd_conf" ; then
140 case $with_rsyncd_conf in
141 yes|no)
142 RSYNCD_SYSCONF="/etc/rsyncd.conf"
143 ;;
144 /*)
145 RSYNCD_SYSCONF="$with_rsyncd_conf"
146 ;;
147 *)
148 AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-conf=PATH)
149 ;;
150 esac
151 else
152 RSYNCD_SYSCONF="/etc/rsyncd.conf"
153 fi ],
154 [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ])
155
156AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
157
81c652d5 158AC_ARG_WITH(rsh,
23afe207 159 AS_HELP_STRING([--with-rsh=CMD],[set remote shell command to CMD (default: ssh)]))
41bd28fe 160
7b8356d0 161AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
89ec535a
WD
162if test x$HAVE_REMSH = x1; then
163 AC_DEFINE(HAVE_REMSH, 1, [Define to 1 if remote shell is remsh, not rsh])
164fi
81c652d5 165
79f48760 166if test x"$with_rsh" != x; then
81c652d5 167 RSYNC_RSH="$with_rsh"
81c652d5 168else
f40f2fc8 169 RSYNC_RSH="ssh"
81c652d5 170fi
81c652d5 171AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
f0af1e5e 172
439d5d89
WD
173# Some programs on solaris are only found in /usr/xpg4/bin (or work better than others versions).
174AC_PATH_PROG(SHELL_PATH, sh, /bin/sh, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
175AC_PATH_PROG(FAKEROOT_PATH, fakeroot, /usr/bin/fakeroot, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
176
cc1b4f77 177AC_ARG_WITH(nobody-group,
23afe207 178 AS_HELP_STRING([--with-nobody-group=GROUP],[set the default unprivileged group (default nobody or nogroup)]),
cc1b4f77
WD
179 [ NOBODY_GROUP="$with_nobody_group" ])
180
181if test x"$with_nobody_group" = x; then
182 AC_MSG_CHECKING([the group for user "nobody"])
183 if grep '^nobody:' /etc/group >/dev/null 2>&1; then
184 NOBODY_GROUP=nobody
185 elif grep '^nogroup:' /etc/group >/dev/null 2>&1; then
186 NOBODY_GROUP=nogroup
187 else
188 NOBODY_GROUP=nobody # test for others?
189 fi
190 AC_MSG_RESULT($NOBODY_GROUP)
58418cb0 191fi
cc1b4f77 192
58418cb0
WD
193AC_DEFINE_UNQUOTED(NOBODY_USER, "nobody", [unprivileged user--e.g. nobody])
194AC_DEFINE_UNQUOTED(NOBODY_GROUP, "$NOBODY_GROUP", [unprivileged group for unprivileged user])
195
5fa4209c
JJ
196# SIMD optimizations
197SIMD=
70c6b408 198
5fa4209c
JJ
199AC_MSG_CHECKING([whether to enable SIMD optimizations])
200AC_ARG_ENABLE(simd,
7fd24bef 201 AS_HELP_STRING([--disable-simd],[disable SIMD optimizations (requires c++)]))
5fa4209c 202
bad97961
WD
203# Clag is crashing with -g -O2, so we'll get rid of -g for now.
204CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g //'`
205
7fd24bef 206if test x"$enable_simd" != x"no"; then
4f539ccf 207 # For x86-64 SIMD, g++ >=5 or clang++ >=7 is required
54b1ddc4 208 if test x"$build_cpu" = x"x86_64"; then
f9aece89 209 AC_LANG(C++)
1b5819ef 210 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
f9aece89 211#include <immintrin.h>
1b5819ef
WD
212__attribute__ ((target("default"))) int test_ssse3(int x) { return x; }
213__attribute__ ((target("default"))) int test_sse2(int x) { return x; }
214__attribute__ ((target("default"))) int test_avx2(int x) { return x; }
215__attribute__ ((target("ssse3"))) int test_ssse3(int x) { return x; }
216__attribute__ ((target("sse2"))) int test_sse2(int x) { return x; }
217__attribute__ ((target("avx2"))) int test_avx2(int x) { return x; }
29c7a455
WD
218typedef long long __m128i_u __attribute__((__vector_size__(16), __may_alias__, __aligned__(1)));
219typedef long long __m256i_u __attribute__((__vector_size__(32), __may_alias__, __aligned__(1)));
f86ceb55 220__attribute__ ((target("default"))) void more_testing(char* buf, int len) { }
e9e9fd0c 221__attribute__ ((target("ssse3"))) void more_testing(char* buf, int len)
29c7a455
WD
222{
223 int i;
224 for (i = 0; i < (len-32); i+=32) {
225 __m128i in8_1, in8_2;
226 in8_1 = _mm_lddqu_si128((__m128i_u*)&buf[i]);
227 in8_2 = _mm_lddqu_si128((__m128i_u*)&buf[i + 16]);
228 }
229}
1b5819ef 230]], [[if (test_ssse3(42) != 42 || test_sse2(42) != 42 || test_avx2(42) != 42) exit(1);]])],[CXX_OK=yes],[CXX_OK=no])
f9aece89 231 AC_LANG(C)
a93eb4cf
WD
232 if test x"$CXX_OK" = x"yes"; then
233 # AC_MSG_RESULT() is called below.
b37a1363 234 SIMD="x86_64"
f9aece89 235 elif test x"$enable_simd" = x"yes"; then
a93eb4cf 236 AC_MSG_RESULT(error)
f9aece89
WD
237 AC_MSG_ERROR(The SIMD compilation test failed.
238Omit --enable-simd to continue without it.)
4f539ccf 239 fi
7fd24bef 240 elif test x"$enable_simd" = x"yes"; then
c6f89cbf
WD
241 AC_MSG_RESULT(unavailable)
242 AC_MSG_ERROR(The SIMD optimizations are currently x86_64 only.
7fd24bef 243Omit --enable-simd to continue without it.)
5fa4209c
JJ
244 fi
245fi
246
247if test x"$SIMD" != x""; then
5fa4209c 248 AC_MSG_RESULT([yes ($SIMD)])
38ecf188 249 AC_DEFINE(HAVE_SIMD, 1, [Define to 1 to enable SIMD optimizations])
b37a1363 250 SIMD='$(SIMD_'"$SIMD)"
4f539ccf 251 # We only use c++ for its target attribute dispatching, disable unneeded bulky features
8cd9aa32 252 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"
d8d2d716
WD
253 # Apple often has "g++" as a symlink for clang. Try to find out the truth.
254 CXX_VERSION=`$CXX --version 2>/dev/null | head -n 2`
255 case "$CXX_VERSION" in
7e95ba87
WD
256 *clang*) CXXFLAGS="$CXXFLAGS -fno-slp-vectorize" ;; # avoid a performance hit
257 esac
70c6b408
JJ
258else
259 AC_MSG_RESULT(no)
260fi
261
5fa4209c
JJ
262AC_SUBST(SIMD)
263
1629b803
WD
264AC_MSG_CHECKING([if assembler accepts noexecstack])
265OLD_CFLAGS="$CFLAGS"
266CFLAGS="$CFLAGS -Wa,--noexecstack"
267AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[return 0;]])],
268[ NOEXECSTACK='-Wa,--noexecstack' ; AC_MSG_RESULT(yes) ],
269[ NOEXECSTACK='' ; AC_MSG_RESULT(no) ])
270CFLAGS="$OLD_CFLAGS"
271AC_SUBST(NOEXECSTACK)
272
273ASM=
274
275AC_MSG_CHECKING([whether to enable ASM optimizations])
276AC_ARG_ENABLE(asm,
277 AS_HELP_STRING([--disable-asm],[disable ASM optimizations]))
278
279if test x"$enable_asm" != x"no"; then
280 if test x"$build_cpu" = x"x86_64"; then
281 ASM="$build_cpu"
282 elif test x"$enable_asm" = x"yes"; then
283 AC_MSG_RESULT(unavailable)
284 AC_MSG_ERROR(The ASM optimizations are currently x86_64 only.
285Omit --enable-asm to continue without it.)
286 fi
287fi
288
289if test x"$ASM" != x""; then
290 AC_MSG_RESULT([yes ($ASM)])
291 AC_DEFINE(HAVE_ASM, 1, [Define to 1 to enable ASM optimizations])
292 ASM='$(ASM_'"$ASM)"
293else
294 AC_MSG_RESULT(no)
295fi
296
297AC_SUBST(ASM)
298
03e23e07 299# arrgh. libc in some old debian version screwed up the largefile
f0af1e5e
AT
300# stuff, getting byte range locking wrong
301AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
23afe207 302AC_RUN_IFELSE([AC_LANG_SOURCE([[
f0af1e5e
AT
303#define _FILE_OFFSET_BITS 64
304#include <stdio.h>
305#include <fcntl.h>
306#include <sys/types.h>
307#include <sys/wait.h>
daf8f7a6
WD
308#if HAVE_UNISTD_H
309#include <unistd.h>
310#endif
f0af1e5e 311
2ef2e822 312int main(void)
f0af1e5e
AT
313{
314 struct flock lock;
9eac94a4
WD
315 int status;
316 char tpl[32] = "/tmp/locktest.XXXXXX";
317 int fd = mkstemp(tpl);
318 if (fd < 0) {
319 strcpy(tpl, "conftest.dat");
320 fd = open(tpl, O_CREAT|O_RDWR, 0600);
321 }
322
f0af1e5e
AT
323 lock.l_type = F_WRLCK;
324 lock.l_whence = SEEK_SET;
325 lock.l_start = 0;
326 lock.l_len = 1;
327 lock.l_pid = 0;
f0af1e5e
AT
328 fcntl(fd,F_SETLK,&lock);
329 if (fork() == 0) {
9eac94a4
WD
330 lock.l_start = 1;
331 _exit(fcntl(fd,F_SETLK,&lock) == 0);
332 }
333 wait(&status);
334 unlink(tpl);
daf8f7a6 335 return WEXITSTATUS(status);
f0af1e5e 336}
23afe207 337]])],[rsync_cv_HAVE_BROKEN_LARGEFILE=yes],[rsync_cv_HAVE_BROKEN_LARGEFILE=no],[rsync_cv_HAVE_BROKEN_LARGEFILE=cross])])
f0af1e5e
AT
338if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
339 AC_SYS_LARGEFILE
340fi
341
06963d0f
MP
342ipv6type=unknown
343ipv6lib=none
22cd0063 344ipv6trylibc=yes
06963d0f 345
2ef2e822 346AC_ARG_ENABLE(ipv6,
1efeb591 347 AS_HELP_STRING([--disable-ipv6],[turn off IPv6 support]))
79f48760 348if test x"$enable_ipv6" != x"no"; then
06963d0f 349 AC_MSG_CHECKING([ipv6 stack type])
8a68cad1 350 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
06963d0f
MP
351 case $i in
352 inria)
353 # http://www.kame.net/
354 AC_EGREP_CPP(yes, [
355#include <netinet/in.h>
356#ifdef IPV6_INRIA_VERSION
357yes
358#endif],
359 [ipv6type=$i;
a358449a
MP
360 AC_DEFINE(INET6, 1, [true if you have IPv6])
361 ])
06963d0f
MP
362 ;;
363 kame)
364 # http://www.kame.net/
365 AC_EGREP_CPP(yes, [
366#include <netinet/in.h>
367#ifdef __KAME__
368yes
369#endif],
2ef2e822 370 [ipv6type=$i;
a358449a 371 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
372 ;;
373 linux-glibc)
374 # http://www.v6.linux.or.jp/
375 AC_EGREP_CPP(yes, [
376#include <features.h>
377#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
378yes
379#endif],
380 [ipv6type=$i;
a358449a 381AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
382 ;;
383 linux-inet6)
384 # http://www.v6.linux.or.jp/
385 if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
386 ipv6type=$i
387 ipv6lib=inet6
388 ipv6libdir=/usr/inet6/lib
389 ipv6trylibc=yes;
a358449a
MP
390 AC_DEFINE(INET6, 1, [true if you have IPv6])
391 CFLAGS="-I/usr/inet6/include $CFLAGS"
06963d0f
MP
392 fi
393 ;;
62342430
WD
394 solaris)
395 # http://www.sun.com
396 AC_EGREP_CPP(yes, [
397#include <netinet/ip6.h>
398#ifdef __sun
399yes
400#endif],
401 [ipv6type=$i;
402 AC_DEFINE(INET6, 1, [true if you have IPv6])])
403 ;;
06963d0f
MP
404 toshiba)
405 AC_EGREP_CPP(yes, [
406#include <sys/param.h>
407#ifdef _TOSHIBA_INET6
408yes
409#endif],
410 [ipv6type=$i;
411 ipv6lib=inet6;
412 ipv6libdir=/usr/local/v6/lib;
a358449a 413 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
414 ;;
415 v6d)
416 AC_EGREP_CPP(yes, [
417#include </usr/local/v6/include/sys/v6config.h>
418#ifdef __V6D__
419yes
420#endif],
421 [ipv6type=$i;
422 ipv6lib=v6;
423 ipv6libdir=/usr/local/v6/lib;
a358449a 424 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
425 ;;
426 zeta)
427 AC_EGREP_CPP(yes, [
428#include <sys/param.h>
429#ifdef _ZETA_MINAMI_INET6
430yes
431#endif],
432 [ipv6type=$i;
433 ipv6lib=inet6;
434 ipv6libdir=/usr/local/v6/lib;
a358449a 435 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f 436 ;;
8a68cad1
WD
437 cygwin)
438 AC_EGREP_CPP(yes, [
439#include <netinet/in.h>
440#ifdef _CYGWIN_IN6_H
441yes
442#endif],
443 [ipv6type=$i;
444 AC_DEFINE(INET6, 1, [true if you have IPv6])])
445 ;;
06963d0f
MP
446 esac
447 if test "$ipv6type" != "unknown"; then
448 break
449 fi
450 done
451 AC_MSG_RESULT($ipv6type)
06963d0f 452
17d5a07e
MP
453 AC_SEARCH_LIBS(getaddrinfo, inet6)
454fi
06963d0f 455
79f48760
WD
456dnl Do you want to disable use of locale functions
457AC_ARG_ENABLE([locale],
23afe207 458 AS_HELP_STRING([--disable-locale],[disable locale features]))
79f48760 459AH_TEMPLATE([CONFIG_LOCALE],
3f770ab0 460[Undefine if you do not want locale features. By default this is defined.])
79f48760
WD
461if test x"$enable_locale" != x"no"; then
462 AC_DEFINE(CONFIG_LOCALE)
463fi
464
9f639210
DD
465AC_MSG_CHECKING([whether to call shutdown on all sockets])
466case $host_os in
467 *cygwin* ) AC_MSG_RESULT(yes)
2ef2e822 468 AC_DEFINE(SHUTDOWN_ALL_SOCKETS, 1,
0d2aa5d9 469 [Define to 1 if sockets need to be shutdown])
8ed16deb
DD
470 ;;
471 * ) AC_MSG_RESULT(no);;
472esac
473
cd957c70 474AC_C_BIGENDIAN
c627d613 475AC_HEADER_DIRENT
c627d613
AT
476AC_HEADER_TIME
477AC_HEADER_SYS_WAIT
1cb6f3bf
WD
478AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
479 unistd.h utime.h grp.h compat.h sys/param.h ctype.h sys/wait.h \
480 sys/ioctl.h sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h \
4d30f176 481 sys/un.h sys/attr.h mcheck.h arpa/inet.h arpa/nameser.h locale.h \
8afaef42
WD
482 netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
483 sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
7da17144 484 popt.h popt/popt.h linux/falloc.h netinet/in_systm.h netinet/ip.h \
c394e861 485 zlib.h xxhash.h openssl/md4.h openssl/md5.h zstd.h lz4.h)
5e4a1441 486AC_HEADER_MAJOR_FIXED
c627d613 487
15c1162b
WD
488AC_MSG_CHECKING([whether to enable use of openssl crypto library])
489AC_ARG_ENABLE([openssl],
490 AS_HELP_STRING([--disable-openssl],[disable openssl crypto library]))
491AH_TEMPLATE([USE_OPENSSL],
492[Undefine if you do not want to use openssl crypto library. By default this is defined.])
6a22f4fe 493if test x"$enable_openssl" != x"no"; then
494 if test x"$ac_cv_header_openssl_md4_h" = x"yes" && test x"$ac_cv_header_openssl_md5_h" = x"yes"; then
495 AC_MSG_RESULT(yes)
496 AC_SEARCH_LIBS(MD5_Init, crypto,
497 [AC_DEFINE(USE_OPENSSL)],
498 [AC_MSG_ERROR(Failed to find MD5_Init function in openssl crypto lib.
499Use --disable-openssl to continue without openssl crypto lib support.)])
500 else
501 AC_MSG_RESULT(no)
502 AC_MSG_ERROR(Failed to find openssl/md4.h and openssl/md5.h for openssl crypto lib support.
503Use --disable-openssl to continue without it.)
504 fi
15c1162b
WD
505else
506 AC_MSG_RESULT(no)
507fi
508
4496e0e8 509AC_MSG_CHECKING([whether to enable xxhash checksum support])
a28bc3eb
WD
510AC_ARG_ENABLE([xxhash],
511 AS_HELP_STRING([--disable-xxhash],[disable xxhash checksums]))
512AH_TEMPLATE([SUPPORT_XXHASH],
513[Undefine if you do not want xxhash checksums. By default this is defined.])
54b1ddc4
WD
514if test x"$enable_xxhash" != x"no"; then
515 if test x"$ac_cv_header_xxhash_h" = x"yes"; then
516 AC_MSG_RESULT(yes)
517 AC_SEARCH_LIBS(XXH64_createState, xxhash,
518 [AC_DEFINE(SUPPORT_XXHASH)],
29be5edd
WD
519 [AC_MSG_ERROR(Failed to find XXH64_createState function in xxhash lib.
520Use --disable-xxhash to continue without xxhash checksums.)])
54b1ddc4
WD
521 else
522 AC_MSG_RESULT(no)
29be5edd
WD
523 AC_MSG_ERROR(Failed to find xxhash.h for xxhash checksum support.
524Use --disable-xxhash to continue without it.)
54b1ddc4 525 fi
15c1162b
WD
526else
527 AC_MSG_RESULT(no)
a28bc3eb
WD
528fi
529
4aaadc2f
WD
530AC_MSG_CHECKING([whether to enable zstd compression])
531AC_ARG_ENABLE([zstd],
532 AC_HELP_STRING([--disable-zstd], [disable zstd compression]))
533AH_TEMPLATE([SUPPORT_ZSTD],
534[Undefine if you do not want zstd compression. By default this is defined.])
54b1ddc4
WD
535if test x"$enable_zstd" != x"no"; then
536 if test x"$ac_cv_header_zstd_h" = x"yes"; then
537 AC_MSG_RESULT(yes)
538 AC_SEARCH_LIBS(ZSTD_minCLevel, zstd,
539 [AC_DEFINE(SUPPORT_ZSTD)],
29be5edd
WD
540 [AC_MSG_ERROR(Failed to find ZSTD_minCLevel function in zstd lib.
541Use --disable-zstd to continue without zstd compression.)])
54b1ddc4
WD
542 else
543 AC_MSG_RESULT(no)
29be5edd
WD
544 AC_MSG_ERROR(Failed to find zstd.h for zstd compression support.
545Use --disable-zstd to continue without it.)
54b1ddc4 546 fi
4aaadc2f
WD
547else
548 AC_MSG_RESULT(no)
549fi
550
c394e861
WD
551AC_MSG_CHECKING([whether to enable LZ4 compression])
552AC_ARG_ENABLE([lz4],
553 AC_HELP_STRING([--disable-lz4], [disable LZ4 compression]))
554AH_TEMPLATE([SUPPORT_LZ4],
555[Undefine if you do not want LZ4 compression. By default this is defined.])
54b1ddc4
WD
556if test x"$enable_lz4" != x"no"; then
557 if test x"$ac_cv_header_lz4_h" = x"yes"; then
558 AC_MSG_RESULT(yes)
559 AC_SEARCH_LIBS(LZ4_compress_default, lz4,
560 [AC_DEFINE(SUPPORT_LZ4)],
29be5edd
WD
561 [AC_MSG_ERROR(Failed to find LZ4_compress_default function in lz4 lib.
562Use --disable-lz4 to continue without lz4 compression.)])
54b1ddc4
WD
563 else
564 AC_MSG_RESULT(no)
29be5edd
WD
565 AC_MSG_ERROR(Failed to find lz4.h for lz4 compression support.
566Use --disable-lz4 to continue without it.)
54b1ddc4 567 fi
c394e861
WD
568else
569 AC_MSG_RESULT(no)
570fi
571
e8d97006 572AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
23afe207 573AC_RUN_IFELSE([AC_LANG_SOURCE([[
e8d97006
WD
574#include <sys/types.h>
575#ifdef MAJOR_IN_MKDEV
576#include <sys/mkdev.h>
577# if !defined makedev && (defined mkdev || defined _WIN32 || defined __WIN32__)
578# define makedev mkdev
579# endif
580#elif defined MAJOR_IN_SYSMACROS
581#include <sys/sysmacros.h>
582#endif
583
584int main(void)
585{
586 dev_t dev = makedev(0, 5, 7);
587 if (major(dev) != 5 || minor(dev) != 7)
daf8f7a6 588 return 1;
e8d97006
WD
589 return 0;
590}
23afe207 591]])],[rsync_cv_MAKEDEV_TAKES_3_ARGS=yes],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no])])
e8d97006
WD
592if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then
593 AC_DEFINE(MAKEDEV_TAKES_3_ARGS, 1, [Define to 1 if makedev() takes 3 args])
594fi
595
c627d613
AT
596AC_CHECK_SIZEOF(int)
597AC_CHECK_SIZEOF(long)
e32db5c9 598AC_CHECK_SIZEOF(long long)
c627d613 599AC_CHECK_SIZEOF(short)
edb4ba5f
WD
600AC_CHECK_SIZEOF(int16_t)
601AC_CHECK_SIZEOF(uint16_t)
602AC_CHECK_SIZEOF(int32_t)
603AC_CHECK_SIZEOF(uint32_t)
604AC_CHECK_SIZEOF(int64_t)
e32db5c9
WD
605AC_CHECK_SIZEOF(off_t)
606AC_CHECK_SIZEOF(off64_t)
f3c93b17 607AC_CHECK_SIZEOF(time_t)
1c82a1e1 608AC_CHECK_SIZEOF(char*)
c627d613
AT
609
610AC_C_INLINE
611
23afe207
WD
612AC_TYPE_LONG_DOUBLE_WIDER
613ac_cv_c_long_double=$ac_cv_type_long_double_wider
614if test $ac_cv_c_long_double = yes; then
615 AC_DEFINE([HAVE_LONG_DOUBLE],[1],[Define to 1 if the type `long double' works and has more range or precision than `double'.])
616fi
617
c627d613 618AC_TYPE_UID_T
a1f7c8e2 619AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t])
9422bb3f 620AC_TYPE_GETGROUPS
1a2e41af
WD
621AC_CHECK_MEMBERS([struct stat.st_rdev,
622 struct stat.st_mtimensec,
b7799aae 623 struct stat.st_mtimespec.tv_nsec,
1a2e41af
WD
624 struct stat.st_mtim.tv_nsec],,,[
625#ifdef HAVE_SYS_TYPES_H
626#include <sys/types.h>
627#endif
628#ifdef HAVE_SYS_STAT_H
629#include <sys/stat.h>
630#endif
631#ifdef HAVE_UNISTD_H
632#include <unistd.h>
633#endif])
bf5c2bf6 634
7ca6e856 635TYPE_SOCKLEN_T
c627d613 636
7b3d4257 637AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
23afe207 638 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[int i = errno]])],[rsync_cv_errno=yes],[rsync_cv_have_errno_decl=no])])
7b3d4257 639if test x"$rsync_cv_errno" = x"yes"; then
0d2aa5d9 640 AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define to 1 if errno is declared in errno.h])
7597e1a9 641fi
c627d613 642
a784e10d
DD
643# The following test taken from the cvs sources
644# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
645# These need checks to be before checks for any other functions that
646# might be in the same libraries.
647# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
648# libsocket.so which has a bad implementation of gethostbyname (it
649# only looks in /etc/hosts), so we only look for -lsocket if we need
650# it.
651AC_CHECK_FUNCS(connect)
652if test x"$ac_cv_func_connect" = x"no"; then
653 case "$LIBS" in
654 *-lnsl*) ;;
655 *) AC_CHECK_LIB(nsl_s, printf) ;;
656 esac
657 case "$LIBS" in
658 *-lnsl*) ;;
659 *) AC_CHECK_LIB(nsl, printf) ;;
660 esac
661 case "$LIBS" in
662 *-lsocket*) ;;
663 *) AC_CHECK_LIB(socket, connect) ;;
664 esac
665 case "$LIBS" in
666 *-linet*) ;;
667 *) AC_CHECK_LIB(inet, connect) ;;
668 esac
669 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
670 dnl has been cached.
2ef2e822 671 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
a784e10d
DD
672 test x"$ac_cv_lib_inet_connect" = x"yes"; then
673 # ac_cv_func_connect=yes
674 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
0d2aa5d9 675 AC_DEFINE(HAVE_CONNECT, 1, [Define to 1 if you have the "connect" function])
a784e10d
DD
676 fi
677fi
678
10a1d6b4 679AC_SEARCH_LIBS(inet_ntop, resolv)
f9cfaae9 680
d699d815
WD
681# For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll
682# accept either iconv_open or libiconv_open, since some include files map
683# the former to the latter.
684AC_SEARCH_LIBS(iconv_open, iconv)
f9cfaae9 685AC_SEARCH_LIBS(libiconv_open, iconv)
8f694072 686
f9b66bc4
WD
687AC_MSG_CHECKING([for iconv declaration])
688AC_CACHE_VAL(am_cv_proto_iconv, [
23afe207 689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3ebdd3c7
WD
690#include <stdlib.h>
691#include <iconv.h>
692extern
693#ifdef __cplusplus
694"C"
695#endif
696#if defined(__STDC__) || defined(__cplusplus)
697size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
698#else
699size_t iconv();
700#endif
23afe207 701]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
3ebdd3c7 702 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
cbed522e 703 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed 's/( /(/'`
f9b66bc4 704AC_MSG_RESULT([$]{ac_t:-
3ebdd3c7 705 }[$]am_cv_proto_iconv)
f9b66bc4
WD
706AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
707 [Define as const if the declaration of iconv() needs const.])
3ebdd3c7 708
99f106d1 709dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
e94989fe 710
317a0e8c 711AC_REPLACE_FUNCS([inet_ntop inet_pton])
356bbb83 712
4021aa45 713AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
2213961e
WD
714AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/types.h>
715#include <sys/socket.h>])
4021aa45 716
824f1c79
DD
717# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
718# builtin getaddrinfo if one of the defines don't exist
184dede9
DD
719AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
720 rsync_cv_HAVE_GETADDR_DEFINES,[
721 AC_EGREP_CPP(yes, [
722 #include <sys/types.h>
723 #include <sys/socket.h>
724 #include <netdb.h>
725 #ifdef AI_PASSIVE
726 yes
2ef2e822 727 #endif],
184dede9
DD
728 rsync_cv_HAVE_GETADDR_DEFINES=yes,
729 rsync_cv_HAVE_GETADDR_DEFINES=no)])
3bc31976 730AS_IF([test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"],[
824f1c79
DD
731 # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
732 # something else so we must include <netdb.h> to get the
733 # redefinition.
734 AC_CHECK_FUNCS(getaddrinfo, ,
735 [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
23afe207 736 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
824f1c79 737 #include <sys/socket.h>
23afe207 738 #include <netdb.h>]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],[AC_MSG_RESULT([yes])
824f1c79 739 AC_DEFINE(HAVE_GETADDRINFO, 1,
23afe207 740 [Define to 1 if you have the "getaddrinfo" function and required types.])],[AC_MSG_RESULT([no])
8e3a6db8 741 AC_LIBOBJ([getaddrinfo])])])
3bc31976 742 ],[AC_LIBOBJ([getaddrinfo])])
824f1c79 743
2ef2e822 744AC_CHECK_MEMBER([struct sockaddr.sa_len],
b4b90120 745 [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
0042f818
WD
746 [],
747 [
748#include <sys/types.h>
749#include <sys/socket.h>
750])
751
b4b90120
WD
752AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
753 [ AC_DEFINE(HAVE_SOCKADDR_IN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ],
356bbb83
MP
754 [],
755 [
756#include <sys/types.h>
757#include <sys/socket.h>
b4b90120 758#include <netinet/in.h>
356bbb83
MP
759])
760
e49d7200
WD
761AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
762 [ AC_DEFINE(HAVE_SOCKADDR_UN_LEN, 1, [Do we have sockaddr_un.sun_len?]) ],
763 [],
764 [
765#include <sys/types.h>
766#include <sys/socket.h>
767#include <netinet/in.h>
768])
769
bc2b4963 770AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
a1d8f29a 771 [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID, 1, [Do we have sockaddr_in6.sin6_scope_id?]) ],
bc2b4963
DD
772 [],
773 [
774#include <sys/types.h>
775#include <sys/socket.h>
776#include <netinet/in.h>
777])
778
4021aa45 779AC_HAVE_TYPE([struct stat64], [#include <stdio.h>
c83a2c8e
WD
780#if HAVE_SYS_TYPES_H
781# include <sys/types.h>
782#endif
783#if HAVE_SYS_STAT_H
784# include <sys/stat.h>
785#endif
786#if STDC_HEADERS
787# include <stdlib.h>
788# include <stddef.h>
789#else
790# if HAVE_STDLIB_H
791# include <stdlib.h>
792# endif
793#endif
4021aa45 794])
c83a2c8e 795
a784e10d
DD
796# if we can't find strcasecmp, look in -lresolv (for Unixware at least)
797#
798AC_CHECK_FUNCS(strcasecmp)
799if test x"$ac_cv_func_strcasecmp" = x"no"; then
800 AC_CHECK_LIB(resolv, strcasecmp)
801fi
802
1c3344a1
WD
803AC_CHECK_FUNCS(aclsort)
804if test x"$ac_cv_func_aclsort" = x"no"; then
805 AC_CHECK_LIB(sec, aclsort)
806fi
807
87fcb639
MP
808dnl At the moment we don't test for a broken memcmp(), because all we
809dnl need to do is test for equality, not comparison, and it seems that
2ef2e822 810dnl every platform has a memcmp that can do at least that.
87fcb639
MP
811dnl AC_FUNC_MEMCMP
812
c627d613 813AC_FUNC_UTIME_NULL
7fc08908 814AC_FUNC_ALLOCA
8ce65463
WD
815AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
816 fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
f7746d00 817 chflags getattrlist \
4d30f176 818 memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \
84e1a698 819 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
8ce65463 820 setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
cece2e3f 821 seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
7f367bb1 822 extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
51e23e0a 823 initgroups utimensat posix_fallocate attropen setvbuf nanosleep usleep)
24c857f1 824
b6800a0b
WD
825dnl cygwin iconv.h defines iconv_open as libiconv_open
826if test x"$ac_cv_func_iconv_open" != x"yes"; then
827 AC_CHECK_FUNC(libiconv_open, [ac_cv_func_iconv_open=yes; AC_DEFINE(HAVE_ICONV_OPEN, 1)])
828fi
829
28b519c9
WD
830dnl Preallocation stuff (also fallocate, posix_fallocate function tests above):
831
832AC_CACHE_CHECK([for useable fallocate],rsync_cv_have_fallocate,[
23afe207
WD
833AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
834#include <sys/types.h>]], [[fallocate(0, 0, 0, 0);]])],[rsync_cv_have_fallocate=yes],[rsync_cv_have_fallocate=no])])
28b519c9
WD
835if test x"$rsync_cv_have_fallocate" = x"yes"; then
836 AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the fallocate function and it compiles and links without error])
837fi
838
f3873b3d
WD
839AC_MSG_CHECKING([for FALLOC_FL_PUNCH_HOLE])
840AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
841 #define _GNU_SOURCE 1
842 #include <linux/falloc.h>
843 #ifndef FALLOC_FL_PUNCH_HOLE
844 #error FALLOC_FL_PUNCH_HOLE is missing
845 #endif
846 ]])], [
847 AC_MSG_RESULT([yes])
848 AC_DEFINE([HAVE_FALLOC_FL_PUNCH_HOLE], [1], [Define if FALLOC_FL_PUNCH_HOLE is available.])
849 ], [
850 AC_MSG_RESULT([no])
851 ]
852)
853
854AC_MSG_CHECKING([for FALLOC_FL_ZERO_RANGE])
855AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
856 #define _GNU_SOURCE 1
857 #include <linux/falloc.h>
858 #ifndef FALLOC_FL_ZERO_RANGE
859 #error FALLOC_FL_ZERO_RANGE is missing
860 #endif
861 ]])], [
862 AC_MSG_RESULT([yes])
863 AC_DEFINE([HAVE_FALLOC_FL_ZERO_RANGE], [1], [Define if FALLOC_FL_ZERO_RANGE is available.])
864 ], [
865 AC_MSG_RESULT([no])
866 ]
867)
868
28b519c9 869AC_CACHE_CHECK([for SYS_fallocate],rsync_cv_have_sys_fallocate,[
23afe207 870AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/syscall.h>
daf8f7a6 871#include <unistd.h>
23afe207 872#include <sys/types.h>]], [[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);]])],[rsync_cv_have_sys_fallocate=yes],[rsync_cv_have_sys_fallocate=no])])
28b519c9
WD
873if test x"$rsync_cv_have_sys_fallocate" = x"yes"; then
874 AC_DEFINE(HAVE_SYS_FALLOCATE, 1, [Define to 1 if you have the SYS_fallocate syscall number])
875fi
876
877if test x"$ac_cv_func_posix_fallocate" = x"yes"; then
878 AC_MSG_CHECKING([whether posix_fallocate is efficient])
879 case $host_os in
880 *cygwin*)
881 AC_MSG_RESULT(yes)
882 AC_DEFINE(HAVE_EFFICIENT_POSIX_FALLOCATE, 1,
883 [Define if posix_fallocate is efficient (Cygwin)])
884 ;;
885 *)
886 AC_MSG_RESULT(no)
887 ;;
888 esac
889fi
890
891dnl End of preallocation stuff
892
21524e30
WD
893AC_CHECK_FUNCS(getpgrp tcgetpgrp)
894if test $ac_cv_func_getpgrp = yes; then
895 AC_FUNC_GETPGRP
896fi
897
49c24071 898AC_ARG_ENABLE(iconv-open,
23afe207 899 AS_HELP_STRING([--disable-iconv-open],[disable all use of iconv_open() function]),
49c24071
WD
900 [], [enable_iconv_open=$ac_cv_func_iconv_open])
901
902if test x"$enable_iconv_open" != x"no"; then
903 AC_DEFINE(USE_ICONV_OPEN, 1, [Define to 1 if you want rsync to make use of iconv_open()])
904fi
905
332cf6df 906AC_ARG_ENABLE(iconv,
23afe207 907 AS_HELP_STRING([--disable-iconv],[disable rsync's --iconv option]),
49c24071 908 [], [enable_iconv=$enable_iconv_open])
332cf6df 909AH_TEMPLATE([ICONV_OPTION],
6efaa74d 910[Define if you want the --iconv option. Specifying a value will set the
332cf6df
WD
911default iconv setting (a NULL means no --iconv processing by default).])
912if test x"$enable_iconv" != x"no"; then
913 if test x"$enable_iconv" = x"yes"; then
914 AC_DEFINE(ICONV_OPTION, NULL)
915 else
916 AC_DEFINE_UNQUOTED(ICONV_OPTION, "$enable_iconv")
917 fi
918 AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
919fi
920
0037bf23 921AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
23afe207 922 AC_RUN_IFELSE([AC_LANG_SOURCE([[
21524e30
WD
923#if HAVE_UNISTD_H
924# include <unistd.h>
925#endif
926#include <stdlib.h>
927#include <errno.h>
daf8f7a6 928int main(void) {
21524e30
WD
929 char const *dangling_symlink = "conftest.dangle";
930 unlink(dangling_symlink);
931 if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
daf8f7a6
WD
932 if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) return 1;
933 return 0;
23afe207 934 }]])],[rsync_cv_chown_modifies_symlink=yes],[rsync_cv_chown_modifies_symlink=no],[rsync_cv_chown_modifies_symlink=no])])
0037bf23 935if test $rsync_cv_chown_modifies_symlink = yes; then
0d2aa5d9 936 AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
21524e30
WD
937fi
938
0037bf23 939AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
23afe207 940 AC_RUN_IFELSE([AC_LANG_SOURCE([[
0037bf23
WD
941#if HAVE_UNISTD_H
942# include <unistd.h>
943#endif
944#include <stdlib.h>
945#include <errno.h>
946#define FILENAME "conftest.dangle"
daf8f7a6 947int main(void) {
0037bf23
WD
948 unlink(FILENAME);
949 if (symlink("conftest.no-such", FILENAME) < 0) abort();
0466e46b 950 unlink(FILENAME "2");
daf8f7a6
WD
951 if (link(FILENAME, FILENAME "2") < 0) return 1;
952 return 0;
23afe207 953 }]])],[rsync_cv_can_hardlink_symlink=yes],[rsync_cv_can_hardlink_symlink=no],[rsync_cv_can_hardlink_symlink=no])])
0037bf23
WD
954if test $rsync_cv_can_hardlink_symlink = yes; then
955 AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
956fi
957
958AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
23afe207 959 AC_RUN_IFELSE([AC_LANG_SOURCE([[
0037bf23
WD
960#if HAVE_UNISTD_H
961# include <unistd.h>
962#endif
daf8f7a6
WD
963#ifdef HAVE_SYS_STAT_H
964#include <sys/stat.h>
965#endif
0037bf23
WD
966#include <stdlib.h>
967#include <errno.h>
968#define FILENAME "conftest.fifi"
daf8f7a6 969int main(void) {
0037bf23
WD
970 unlink(FILENAME);
971 if (mkfifo(FILENAME, 0777) < 0) abort();
0466e46b 972 unlink(FILENAME "2");
daf8f7a6
WD
973 if (link(FILENAME, FILENAME "2") < 0) return 1;
974 return 0;
23afe207 975 }]])],[rsync_cv_can_hardlink_special=yes],[rsync_cv_can_hardlink_special=no],[rsync_cv_can_hardlink_special=no])])
0037bf23
WD
976if test $rsync_cv_can_hardlink_special = yes; then
977 AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
978fi
979
24c857f1 980AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
23afe207 981AC_RUN_IFELSE([AC_LANG_SOURCE([[
6a5ef41f
MP
982#include <sys/types.h>
983#include <sys/socket.h>
984
daf8f7a6 985int main(void) {
6a5ef41f 986 int fd[2];
daf8f7a6 987 return (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1;
23afe207 988}]])],[rsync_cv_HAVE_SOCKETPAIR=yes],[rsync_cv_HAVE_SOCKETPAIR=no],[rsync_cv_HAVE_SOCKETPAIR=cross])])
24c857f1 989if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
0d2aa5d9 990 AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
24c857f1 991fi
c627d613 992
317a0e8c 993AC_REPLACE_FUNCS([getpass])
333e3a9f 994
79f48760 995if test x"$with_included_popt" != x"yes"; then
1ac15cd8
MP
996 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
997fi
8afaef42
WD
998if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
999 # If the system has /usr/include/popt/popt.h, we enable the
1000 # included popt because an attempt to "#include <popt/popt.h>"
1001 # would use our included header file anyway (due to -I.), and
d7b6774d 1002 # might conflict with the system popt.
8afaef42 1003 with_included_popt=yes
6de417d9
WD
1004elif test x"$ac_cv_header_popt_h" != x"yes"; then
1005 with_included_popt=yes
8afaef42 1006fi
2d1ebe9c 1007
12458878 1008AC_MSG_CHECKING([whether to use included libpopt])
79f48760 1009if test x"$with_included_popt" = x"yes"; then
12458878 1010 AC_MSG_RESULT($srcdir/popt)
1ac15cd8 1011 BUILD_POPT='$(popt_OBJS)'
6ffd8f21 1012 CFLAGS="-I$srcdir/popt $CFLAGS"
5216de37 1013 if test x"$ALLOCA" != x
7fc08908 1014 then
5216de37
DD
1015 # this can be removed when/if we add an included alloca.c;
1016 # see autoconf documentation on AC_FUNC_ALLOCA
8af534a5 1017 AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
7fc08908 1018 fi
2d1ebe9c
MP
1019else
1020 AC_MSG_RESULT(no)
79fc6bdb 1021fi
c627d613 1022
7da17144
WD
1023# We default to using our zlib unless --with-included-zlib=no is given.
1024if test x"$with_included_zlib" != x"no"; then
1025 with_included_zlib=yes
1026elif test x"$ac_cv_header_zlib_h" != x"yes"; then
1027 with_included_zlib=yes
1028fi
1029if test x"$with_included_zlib" != x"yes"; then
1030 AC_CHECK_LIB(z, deflateParams, , [with_included_zlib=yes])
1031fi
1032
1033AC_MSG_CHECKING([whether to use included zlib])
1034if test x"$with_included_zlib" = x"yes"; then
1035 AC_MSG_RESULT($srcdir/zlib)
1036 BUILD_ZLIB='$(zlib_OBJS)'
6ffd8f21 1037 CFLAGS="-I$srcdir/zlib $CFLAGS"
7da17144 1038else
22a3ac0b 1039 AC_DEFINE(EXTERNAL_ZLIB, 1, [Define to 1 if using external zlib])
7da17144
WD
1040 AC_MSG_RESULT(no)
1041fi
1042
0d2aa5d9 1043AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
23afe207 1044AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
0d2aa5d9
WD
1045if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
1046 AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
7597e1a9 1047fi
bcacc18b 1048
7b3d4257 1049AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
23afe207 1050AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/types.h>
59503278 1051#include <dirent.h>
daf8f7a6 1052int main(void) { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
59503278 1053if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
daf8f7a6 1054di->d_name[0] == 0) return 0; return 1;} ]])],[rsync_cv_HAVE_BROKEN_READDIR=yes],[rsync_cv_HAVE_BROKEN_READDIR=no],[rsync_cv_HAVE_BROKEN_READDIR=cross])])
7b3d4257 1055if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
0d2aa5d9 1056 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
7597e1a9 1057fi
1e9f155a 1058
4021aa45 1059AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
23afe207 1060AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
daf8f7a6 1061#include <utime.h>]], [[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; return utime("foo.c",&tbuf);]])],[rsync_cv_HAVE_STRUCT_UTIMBUF=yes],[rsync_cv_HAVE_STRUCT_UTIMBUF=no])])
4021aa45
WD
1062if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
1063 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
7597e1a9 1064fi
d6e6ecbd 1065
3060d4aa 1066AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
23afe207 1067AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
daf8f7a6 1068#include <unistd.h>]], [[struct timeval tv; return gettimeofday(&tv, NULL);]])],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=no])])
a20a88d2 1069if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
0d2aa5d9 1070 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
3060d4aa
AT
1071fi
1072
8950ac03 1073AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
23afe207 1074AC_RUN_IFELSE([AC_LANG_SOURCE([[
8950ac03
AT
1075#include <sys/types.h>
1076#include <stdarg.h>
daf8f7a6
WD
1077#include <stdio.h>
1078#include <stdlib.h>
1079#include <string.h>
2ef2e822 1080void foo(const char *format, ...) {
8950ac03
AT
1081 va_list ap;
1082 int len;
c66e08ac 1083 static char buf[] = "12345678901234567890";
8950ac03
AT
1084
1085 va_start(ap, format);
1086 len = vsnprintf(0, 0, format, ap);
1087 va_end(ap);
1088 if (len != 5) exit(1);
1089
1090 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
8950ac03 1091}
daf8f7a6 1092int main(void) { foo("hello"); return 0; }
23afe207 1093]])],[rsync_cv_HAVE_C99_VSNPRINTF=yes],[rsync_cv_HAVE_C99_VSNPRINTF=no],[rsync_cv_HAVE_C99_VSNPRINTF=cross])])
8950ac03 1094if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
0d2aa5d9 1095 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
8950ac03
AT
1096fi
1097
1098
f62c17e3 1099AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
23afe207 1100AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
f62c17e3
AT
1101#include <sys/types.h>
1102#include <sys/stat.h>
1103#include <unistd.h>
daf8f7a6 1104int main(void) {
f62c17e3 1105 struct stat st;
2ef2e822
WD
1106 char tpl[20]="/tmp/test.XXXXXX";
1107 int fd = mkstemp(tpl);
daf8f7a6 1108 if (fd == -1) return 1;
f62c17e3 1109 unlink(tpl);
daf8f7a6
WD
1110 if (fstat(fd, &st) != 0) return 1;
1111 if ((st.st_mode & 0777) != 0600) return 1;
1112 return 0;
23afe207 1113}]])],[rsync_cv_HAVE_SECURE_MKSTEMP=yes],[rsync_cv_HAVE_SECURE_MKSTEMP=no],[rsync_cv_HAVE_SECURE_MKSTEMP=cross])])
f62c17e3 1114if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
83238ed0 1115 case $host_os in
5f2c5bf1
WD
1116 hpux*)
1117 dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
1118 dnl so we noisily skip using it. See HP change request JAGaf34426
1119 dnl for details. (sbonds)
1120 AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
1121 ;;
1122 *)
1123 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
1124 ;;
1125 esac
f62c17e3
AT
1126fi
1127
3060d4aa 1128
e49d7200 1129AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
23afe207 1130AC_RUN_IFELSE([AC_LANG_SOURCE([[
e49d7200
WD
1131#include <stdio.h>
1132#include <sys/stat.h>
1133#include <errno.h>
daf8f7a6
WD
1134#if HAVE_UNISTD_H
1135# include <unistd.h>
1136#endif
1137int main(void) { int rc, ec; char *fn = "fifo-test";
e49d7200 1138unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
12a01be1 1139if (rc) {printf("(%d %d) ",rc,ec); return ec;}
23afe207 1140return 0;}]])],[rsync_cv_MKNOD_CREATES_FIFOS=yes],[rsync_cv_MKNOD_CREATES_FIFOS=no],[rsync_cv_MKNOD_CREATES_FIFOS=cross])])
e49d7200
WD
1141if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
1142 AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
1143fi
1144
1145AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
23afe207 1146AC_RUN_IFELSE([AC_LANG_SOURCE([[
e49d7200
WD
1147#include <stdio.h>
1148#include <sys/stat.h>
1149#include <errno.h>
daf8f7a6
WD
1150#if HAVE_UNISTD_H
1151# include <unistd.h>
1152#endif
1153int main(void) { int rc, ec; char *fn = "sock-test";
e49d7200 1154unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
12a01be1 1155if (rc) {printf("(%d %d) ",rc,ec); return ec;}
23afe207 1156return 0;}]])],[rsync_cv_MKNOD_CREATES_SOCKETS=yes],[rsync_cv_MKNOD_CREATES_SOCKETS=no],[rsync_cv_MKNOD_CREATES_SOCKETS=cross])])
e49d7200
WD
1157if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
1158 AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
1159fi
1160
692da0b5
DD
1161#
1162# The following test was mostly taken from the tcl/tk plus patches
1163#
79fc6bdb 1164AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
692da0b5
DD
1165rm -rf conftest*
1166cat > conftest.$ac_ext <<EOF
daf8f7a6 1167int main(void) { return 0; }
692da0b5
DD
1168EOF
1169${CC-cc} -c -o conftest..o conftest.$ac_ext
1170if test -f conftest..o; then
79fc6bdb
DD
1171 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
1172else
1173 rsync_cv_DASHC_WORKS_WITH_DASHO=no
1174fi
1175rm -rf conftest*
1176])
1177if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
692da0b5
DD
1178 OBJ_SAVE="#"
1179 OBJ_RESTORE="#"
1180 CC_SHOBJ_FLAG='-o $@'
692da0b5
DD
1181else
1182 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
1183 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'
1184 CC_SHOBJ_FLAG=""
692da0b5 1185fi
79fc6bdb 1186
692da0b5
DD
1187AC_SUBST(OBJ_SAVE)
1188AC_SUBST(OBJ_RESTORE)
1189AC_SUBST(CC_SHOBJ_FLAG)
1ac15cd8 1190AC_SUBST(BUILD_POPT)
7da17144 1191AC_SUBST(BUILD_ZLIB)
225787a4 1192AC_SUBST(MAKE_MAN)
7d29d4ba 1193
1c3344a1
WD
1194AC_CHECK_FUNCS(_acl __acl _facl __facl)
1195#################################################
1196# check for ACL support
1197
1198AC_MSG_CHECKING([whether to support ACLs])
1199AC_ARG_ENABLE(acl-support,
23afe207 1200 AS_HELP_STRING([--disable-acl-support],[disable ACL support]))
1c3344a1
WD
1201
1202if test x"$enable_acl_support" = x"no"; then
1203 AC_MSG_RESULT(no)
1204else
1c3344a1
WD
1205 case "$host_os" in
1206 *sysv5*)
1207 AC_MSG_RESULT(Using UnixWare ACLs)
1208 AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
545584cb 1209 AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
1c3344a1 1210 ;;
6af8e114 1211 solaris*)
1c3344a1
WD
1212 AC_MSG_RESULT(Using solaris ACLs)
1213 AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
987838fd 1214 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
1215 ;;
1216 *hpux*)
1217 AC_MSG_RESULT(Using HPUX ACLs)
1218 AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
987838fd 1219 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
1220 ;;
1221 *irix*)
1222 AC_MSG_RESULT(Using IRIX ACLs)
1223 AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
987838fd 1224 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
1225 ;;
1226 *aix*)
1227 AC_MSG_RESULT(Using AIX ACLs)
1228 AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
987838fd 1229 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
1230 ;;
1231 *osf*)
1232 AC_MSG_RESULT(Using Tru64 ACLs)
1233 AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
987838fd 1234 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
1235 LIBS="$LIBS -lpacl"
1236 ;;
16edf865 1237 darwin*)
49ea69b3
WD
1238 AC_MSG_RESULT(Using OS X ACLs)
1239 AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
1240 AC_DEFINE(SUPPORT_ACLS, 1)
88467ec4 1241 ;;
1c3344a1
WD
1242 *)
1243 AC_MSG_RESULT(running tests:)
1244 AC_CHECK_LIB(acl,acl_get_file)
677c6e14 1245 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
23afe207
WD
1246 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1247#include <sys/acl.h>]], [[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);]])],[samba_cv_HAVE_POSIX_ACLS=yes],[samba_cv_HAVE_POSIX_ACLS=no])])
1c3344a1
WD
1248 AC_MSG_CHECKING(ACL test results)
1249 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
1250 AC_MSG_RESULT(Using posix ACLs)
1251 AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
987838fd 1252 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1 1253 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
23afe207
WD
1254 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1255#include <sys/acl.h>]], [[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);]])],[samba_cv_HAVE_ACL_GET_PERM_NP=yes],[samba_cv_HAVE_ACL_GET_PERM_NP=no])])
1c3344a1
WD
1256 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
1257 AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
1258 fi
1259 else
987838fd
WD
1260 if test x"$enable_acl_support" = x"yes"; then
1261 AC_MSG_ERROR(Failed to find ACL support)
1262 else
1263 AC_MSG_RESULT(No ACL support found)
1c3344a1
WD
1264 fi
1265 fi
1266 ;;
1267 esac
1268fi
1269
16edf865
WD
1270#################################################
1271# check for extended attribute support
1272AC_MSG_CHECKING(whether to support extended attributes)
1273AC_ARG_ENABLE(xattr-support,
23afe207 1274 AS_HELP_STRING([--disable-xattr-support],[disable extended attributes]),
c4170cba 1275 [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_attropen" in
6b5a8f80
WD
1276 *yes*) enable_xattr_support=maybe ;;
1277 *) enable_xattr_support=no ;;
1278 esac])
e8c64ffd
WD
1279AH_TEMPLATE([SUPPORT_XATTRS],
1280[Define to 1 to add support for extended attributes])
16edf865
WD
1281if test x"$enable_xattr_support" = x"no"; then
1282 AC_MSG_RESULT(no)
1283else
1284 case "$host_os" in
19831980 1285 *linux*|*netbsd*)
16edf865 1286 AC_MSG_RESULT(Using Linux xattrs)
19831980 1287 AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs (or equivalent)])
e8c64ffd 1288 AC_DEFINE(SUPPORT_XATTRS, 1)
e2c1e482 1289 AC_DEFINE(NO_SYMLINK_USER_XATTRS, 1, [True if symlinks do not support user xattrs])
677c6e14 1290 AC_CHECK_LIB(attr,getxattr)
16edf865
WD
1291 ;;
1292 darwin*)
1293 AC_MSG_RESULT(Using OS X xattrs)
1294 AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
1295 AC_DEFINE(SUPPORT_XATTRS, 1)
6500e076
WD
1296 AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
1297 AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
16edf865
WD
1298 ;;
1299 freebsd*)
1300 AC_MSG_RESULT(Using FreeBSD extattrs)
1301 AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
1302 AC_DEFINE(SUPPORT_XATTRS, 1)
1303 ;;
05a652d0
WD
1304 solaris*)
1305 AC_MSG_RESULT(Using Solaris xattrs)
1306 AC_DEFINE(HAVE_SOLARIS_XATTRS, 1, [True if you have Solaris xattrs])
1307 AC_DEFINE(SUPPORT_XATTRS, 1)
a131954b 1308 AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
05a652d0 1309 ;;
16edf865
WD
1310 *)
1311 if test x"$enable_xattr_support" = x"yes"; then
1312 AC_MSG_ERROR(Failed to find extended attribute support)
1313 else
1314 AC_MSG_RESULT(No extended attribute support found)
1315 fi
1316 ;;
1317 esac
1318fi
1319
f4901024
WD
1320if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
1321 AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
1322 OLD_CFLAGS="$CFLAGS"
1323 CFLAGS="$CFLAGS -Wno-unused-parameter"
23afe207 1324 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("hello\n");]])],[rsync_warn_flag=yes],[rsync_warn_flag=no])
f4901024
WD
1325 AC_MSG_RESULT([$rsync_warn_flag])
1326 if test x"$rsync_warn_flag" = x"no"; then
1327 CFLAGS="$OLD_CFLAGS"
1328 fi
1329fi
1330
aa0e6b99 1331case "$CC" in
d4c5cb2b 1332' checker'*|checker*)
aa0e6b99
WD
1333 AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
1334 ;;
1335esac
1336
bf5c2bf6
MP
1337AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
1338AC_OUTPUT
a4677968
MP
1339
1340AC_MSG_RESULT()
1341AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
1342AC_MSG_RESULT()