Tweak dir xattrs after the writability fudging.
[rsync/rsync.git] / configure.ac
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)
e32db5c9 6AC_PREREQ(2.59)
c627d613 7
93f3fbf7 8RSYNC_VERSION=3.1.0dev
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
83238ed0 16AC_CANONICAL_HOST
bf5c2bf6 17
03b1cddc 18# We must decide this before testing the compiler.
2d1ebe9c 19
47759343
MP
20# Please allow this to default to yes, so that your users have more
21# chance of getting a useful stack trace if problems occur.
22
bf5c2bf6 23AC_MSG_CHECKING([whether to include debugging symbols])
2d1ebe9c 24AC_ARG_ENABLE(debug,
79f48760 25 AC_HELP_STRING([--disable-debug],
e8c64ffd 26 [disable debugging symbols and features]))
2d1ebe9c 27
79f48760 28if test x"$enable_debug" = x"no"; then
2d1ebe9c 29 AC_MSG_RESULT(no)
44ae5411 30 ac_cv_prog_cc_g=no
bf5c2bf6
MP
31else
32 AC_MSG_RESULT([yes])
23bf32f7 33 dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation])
44ae5411 34 # leave ac_cv_prog_cc_g alone; AC_PROG_CC will try to include -g if it can
2d1ebe9c
MP
35fi
36
44ae5411
WD
37dnl Checks for programs.
38AC_PROG_CC
39AC_PROG_CPP
40AC_PROG_EGREP
41AC_PROG_INSTALL
42AC_PROG_CC_STDC
43AC_SUBST(SHELL)
44
45AC_DEFINE([_GNU_SOURCE], 1,
46 [Define _GNU_SOURCE so that we get all necessary prototypes])
47
48if test x"$ac_cv_prog_cc_stdc" = x"no"; then
3f770ab0 49 AC_MSG_WARN([rsync requires an ANSI C compiler and you do not seem to have one])
44ae5411 50fi
da7b6397 51
da7b6397 52AC_ARG_ENABLE(profile,
c83a2c8e 53 AC_HELP_STRING([--enable-profile],
79f48760
WD
54 [turn on CPU profiling]))
55if test x"$enable_profile" = x"yes"; then
da7b6397
MP
56 CFLAGS="$CFLAGS -pg"
57fi
58
59
c0531332
MP
60# Specifically, this turns on panic_action handling.
61AC_ARG_ENABLE(maintainer-mode,
c83a2c8e 62 AC_HELP_STRING([--enable-maintainer-mode],
79f48760
WD
63 [turn on extra debug features]))
64if test x"$enable_maintainer_mode" = x"yes"; then
c0531332
MP
65 CFLAGS="$CFLAGS -DMAINTAINER_MODE"
66fi
67
68
da7b6397
MP
69# This is needed for our included version of popt. Kind of silly, but
70# I don't want our version too far out of sync.
1ac15cd8
MP
71CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
72
47759343 73# If GCC, turn on warnings.
79f48760 74if test x"$GCC" = x"yes"; then
99f106d1 75 CFLAGS="$CFLAGS -Wall -W"
47759343
MP
76fi
77
2d1ebe9c 78AC_ARG_WITH(included-popt,
d64c2b22 79 AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system]))
2d1ebe9c 80
4c4a2962
WD
81AC_ARG_WITH(protected-args,
82 AC_HELP_STRING([--with-protected-args], [make --protected-args option the default]))
83if test x"$with_protected_args" = x"yes"; then
84 AC_DEFINE_UNQUOTED(RSYNC_USE_PROTECTED_ARGS, 1, [Define to 1 if --protected-args should be the default])
85fi
86
41bd28fe 87AC_ARG_WITH(rsync-path,
d64c2b22 88 AC_HELP_STRING([--with-rsync-path=PATH], [set default --rsync-path to PATH (default: rsync)]),
8642efd0 89 [ RSYNC_PATH="$with_rsync_path" ],
41bd28fe 90 [ RSYNC_PATH="rsync" ])
81c652d5
MP
91
92AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
93
cd3fe9fb
WD
94AC_ARG_WITH(rsyncd-conf,
95 AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
96 [ if test ! -z "$with_rsyncd_conf" ; then
97 case $with_rsyncd_conf in
98 yes|no)
99 RSYNCD_SYSCONF="/etc/rsyncd.conf"
100 ;;
101 /*)
102 RSYNCD_SYSCONF="$with_rsyncd_conf"
103 ;;
104 *)
105 AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-conf=PATH)
106 ;;
107 esac
108 else
109 RSYNCD_SYSCONF="/etc/rsyncd.conf"
110 fi ],
111 [ RSYNCD_SYSCONF="/etc/rsyncd.conf" ])
112
113AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
114
81c652d5 115AC_ARG_WITH(rsh,
f40f2fc8 116 AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)]))
41bd28fe 117
7b8356d0 118AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
89ec535a
WD
119if test x$HAVE_REMSH = x1; then
120 AC_DEFINE(HAVE_REMSH, 1, [Define to 1 if remote shell is remsh, not rsh])
121fi
81c652d5 122
79f48760 123if test x"$with_rsh" != x; then
81c652d5 124 RSYNC_RSH="$with_rsh"
81c652d5 125else
f40f2fc8 126 RSYNC_RSH="ssh"
81c652d5 127fi
81c652d5 128AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command])
f0af1e5e 129
225787a4
WD
130AC_CHECK_PROG(HAVE_YODL2MAN, yodl2man, 1, 0)
131if test x$HAVE_YODL2MAN = x1; then
132 MAKE_MAN=man
133fi
134
cc1b4f77
WD
135AC_ARG_WITH(nobody-group,
136 AC_HELP_STRING([--with-nobody-group=GROUP],
137 [set the default unprivileged group (default nobody or nogroup)]),
138 [ NOBODY_GROUP="$with_nobody_group" ])
139
140if test x"$with_nobody_group" = x; then
141 AC_MSG_CHECKING([the group for user "nobody"])
142 if grep '^nobody:' /etc/group >/dev/null 2>&1; then
143 NOBODY_GROUP=nobody
144 elif grep '^nogroup:' /etc/group >/dev/null 2>&1; then
145 NOBODY_GROUP=nogroup
146 else
147 NOBODY_GROUP=nobody # test for others?
148 fi
149 AC_MSG_RESULT($NOBODY_GROUP)
58418cb0 150fi
cc1b4f77 151
58418cb0
WD
152AC_DEFINE_UNQUOTED(NOBODY_USER, "nobody", [unprivileged user--e.g. nobody])
153AC_DEFINE_UNQUOTED(NOBODY_GROUP, "$NOBODY_GROUP", [unprivileged group for unprivileged user])
154
03e23e07 155# arrgh. libc in some old debian version screwed up the largefile
f0af1e5e
AT
156# stuff, getting byte range locking wrong
157AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
158AC_TRY_RUN([
159#define _FILE_OFFSET_BITS 64
160#include <stdio.h>
161#include <fcntl.h>
162#include <sys/types.h>
163#include <sys/wait.h>
164
2ef2e822 165int main(void)
f0af1e5e
AT
166{
167 struct flock lock;
9eac94a4
WD
168 int status;
169 char tpl[32] = "/tmp/locktest.XXXXXX";
170 int fd = mkstemp(tpl);
171 if (fd < 0) {
172 strcpy(tpl, "conftest.dat");
173 fd = open(tpl, O_CREAT|O_RDWR, 0600);
174 }
175
f0af1e5e
AT
176 lock.l_type = F_WRLCK;
177 lock.l_whence = SEEK_SET;
178 lock.l_start = 0;
179 lock.l_len = 1;
180 lock.l_pid = 0;
f0af1e5e
AT
181 fcntl(fd,F_SETLK,&lock);
182 if (fork() == 0) {
9eac94a4
WD
183 lock.l_start = 1;
184 _exit(fcntl(fd,F_SETLK,&lock) == 0);
185 }
186 wait(&status);
187 unlink(tpl);
f0af1e5e
AT
188 exit(WEXITSTATUS(status));
189}
190],
191rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)])
192if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
193 AC_SYS_LARGEFILE
194fi
195
06963d0f
MP
196ipv6type=unknown
197ipv6lib=none
22cd0063 198ipv6trylibc=yes
06963d0f 199
2ef2e822 200AC_ARG_ENABLE(ipv6,
79f48760 201 AC_HELP_STRING([--disable-ipv6],
3f770ab0 202 [do not even try to use IPv6]))
79f48760 203if test x"$enable_ipv6" != x"no"; then
06963d0f 204 AC_MSG_CHECKING([ipv6 stack type])
8a68cad1 205 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
06963d0f
MP
206 case $i in
207 inria)
208 # http://www.kame.net/
209 AC_EGREP_CPP(yes, [
210#include <netinet/in.h>
211#ifdef IPV6_INRIA_VERSION
212yes
213#endif],
214 [ipv6type=$i;
a358449a
MP
215 AC_DEFINE(INET6, 1, [true if you have IPv6])
216 ])
06963d0f
MP
217 ;;
218 kame)
219 # http://www.kame.net/
220 AC_EGREP_CPP(yes, [
221#include <netinet/in.h>
222#ifdef __KAME__
223yes
224#endif],
2ef2e822 225 [ipv6type=$i;
a358449a 226 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
227 ;;
228 linux-glibc)
229 # http://www.v6.linux.or.jp/
230 AC_EGREP_CPP(yes, [
231#include <features.h>
232#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
233yes
234#endif],
235 [ipv6type=$i;
a358449a 236AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
237 ;;
238 linux-inet6)
239 # http://www.v6.linux.or.jp/
240 if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then
241 ipv6type=$i
242 ipv6lib=inet6
243 ipv6libdir=/usr/inet6/lib
244 ipv6trylibc=yes;
a358449a
MP
245 AC_DEFINE(INET6, 1, [true if you have IPv6])
246 CFLAGS="-I/usr/inet6/include $CFLAGS"
06963d0f
MP
247 fi
248 ;;
62342430
WD
249 solaris)
250 # http://www.sun.com
251 AC_EGREP_CPP(yes, [
252#include <netinet/ip6.h>
253#ifdef __sun
254yes
255#endif],
256 [ipv6type=$i;
257 AC_DEFINE(INET6, 1, [true if you have IPv6])])
258 ;;
06963d0f
MP
259 toshiba)
260 AC_EGREP_CPP(yes, [
261#include <sys/param.h>
262#ifdef _TOSHIBA_INET6
263yes
264#endif],
265 [ipv6type=$i;
266 ipv6lib=inet6;
267 ipv6libdir=/usr/local/v6/lib;
a358449a 268 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
269 ;;
270 v6d)
271 AC_EGREP_CPP(yes, [
272#include </usr/local/v6/include/sys/v6config.h>
273#ifdef __V6D__
274yes
275#endif],
276 [ipv6type=$i;
277 ipv6lib=v6;
278 ipv6libdir=/usr/local/v6/lib;
a358449a 279 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f
MP
280 ;;
281 zeta)
282 AC_EGREP_CPP(yes, [
283#include <sys/param.h>
284#ifdef _ZETA_MINAMI_INET6
285yes
286#endif],
287 [ipv6type=$i;
288 ipv6lib=inet6;
289 ipv6libdir=/usr/local/v6/lib;
a358449a 290 AC_DEFINE(INET6, 1, [true if you have IPv6])])
06963d0f 291 ;;
8a68cad1
WD
292 cygwin)
293 AC_EGREP_CPP(yes, [
294#include <netinet/in.h>
295#ifdef _CYGWIN_IN6_H
296yes
297#endif],
298 [ipv6type=$i;
299 AC_DEFINE(INET6, 1, [true if you have IPv6])])
300 ;;
06963d0f
MP
301 esac
302 if test "$ipv6type" != "unknown"; then
303 break
304 fi
305 done
306 AC_MSG_RESULT($ipv6type)
06963d0f 307
17d5a07e
MP
308 AC_SEARCH_LIBS(getaddrinfo, inet6)
309fi
06963d0f 310
79f48760
WD
311dnl Do you want to disable use of locale functions
312AC_ARG_ENABLE([locale],
313 AC_HELP_STRING([--disable-locale],
e8c64ffd 314 [disable locale features]))
79f48760 315AH_TEMPLATE([CONFIG_LOCALE],
3f770ab0 316[Undefine if you do not want locale features. By default this is defined.])
79f48760
WD
317if test x"$enable_locale" != x"no"; then
318 AC_DEFINE(CONFIG_LOCALE)
319fi
320
9f639210
DD
321AC_MSG_CHECKING([whether to call shutdown on all sockets])
322case $host_os in
323 *cygwin* ) AC_MSG_RESULT(yes)
2ef2e822 324 AC_DEFINE(SHUTDOWN_ALL_SOCKETS, 1,
0d2aa5d9 325 [Define to 1 if sockets need to be shutdown])
8ed16deb
DD
326 ;;
327 * ) AC_MSG_RESULT(no);;
328esac
329
cd957c70 330AC_C_BIGENDIAN
c627d613 331AC_HEADER_DIRENT
c627d613
AT
332AC_HEADER_TIME
333AC_HEADER_SYS_WAIT
1cb6f3bf
WD
334AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
335 unistd.h utime.h grp.h compat.h sys/param.h ctype.h sys/wait.h \
336 sys/ioctl.h sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h \
4d30f176 337 sys/un.h sys/attr.h mcheck.h arpa/inet.h arpa/nameser.h locale.h \
8afaef42
WD
338 netdb.h malloc.h float.h limits.h iconv.h libcharset.h langinfo.h \
339 sys/acl.h acl/libacl.h attr/xattr.h sys/xattr.h sys/extattr.h \
6de417d9 340 popt.h popt/popt.h)
3c3791e8 341AC_HEADER_MAJOR
c627d613 342
e8d97006
WD
343AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
344AC_TRY_RUN([
345#include <sys/types.h>
346#ifdef MAJOR_IN_MKDEV
347#include <sys/mkdev.h>
348# if !defined makedev && (defined mkdev || defined _WIN32 || defined __WIN32__)
349# define makedev mkdev
350# endif
351#elif defined MAJOR_IN_SYSMACROS
352#include <sys/sysmacros.h>
353#endif
354
355int main(void)
356{
357 dev_t dev = makedev(0, 5, 7);
358 if (major(dev) != 5 || minor(dev) != 7)
359 exit(1);
360 return 0;
361}
362],
363rsync_cv_MAKEDEV_TAKES_3_ARGS=yes,rsync_cv_MAKEDEV_TAKES_3_ARGS=no,rsync_cv_MAKEDEV_TAKES_3_ARGS=no)])
364if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then
365 AC_DEFINE(MAKEDEV_TAKES_3_ARGS, 1, [Define to 1 if makedev() takes 3 args])
366fi
367
c627d613
AT
368AC_CHECK_SIZEOF(int)
369AC_CHECK_SIZEOF(long)
e32db5c9 370AC_CHECK_SIZEOF(long long)
c627d613 371AC_CHECK_SIZEOF(short)
edb4ba5f
WD
372AC_CHECK_SIZEOF(int16_t)
373AC_CHECK_SIZEOF(uint16_t)
374AC_CHECK_SIZEOF(int32_t)
375AC_CHECK_SIZEOF(uint32_t)
376AC_CHECK_SIZEOF(int64_t)
e32db5c9
WD
377AC_CHECK_SIZEOF(off_t)
378AC_CHECK_SIZEOF(off64_t)
f3c93b17 379AC_CHECK_SIZEOF(time_t)
c627d613
AT
380
381AC_C_INLINE
a6c15e9a 382AC_C_LONG_DOUBLE
c627d613
AT
383
384AC_TYPE_SIGNAL
385AC_TYPE_UID_T
a1f7c8e2 386AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t])
9422bb3f 387AC_TYPE_GETGROUPS
1a2e41af
WD
388AC_CHECK_MEMBERS([struct stat.st_rdev,
389 struct stat.st_mtimensec,
390 struct stat.st_mtim.tv_nsec],,,[
391#ifdef HAVE_SYS_TYPES_H
392#include <sys/types.h>
393#endif
394#ifdef HAVE_SYS_STAT_H
395#include <sys/stat.h>
396#endif
397#ifdef HAVE_UNISTD_H
398#include <unistd.h>
399#endif])
bf5c2bf6 400
7ca6e856 401TYPE_SOCKLEN_T
c627d613 402
7b3d4257 403AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
7597e1a9 404 AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
7b3d4257
AT
405 rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)])
406if test x"$rsync_cv_errno" = x"yes"; then
0d2aa5d9 407 AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define to 1 if errno is declared in errno.h])
7597e1a9 408fi
c627d613 409
a784e10d
DD
410# The following test taken from the cvs sources
411# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
412# These need checks to be before checks for any other functions that
413# might be in the same libraries.
414# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
415# libsocket.so which has a bad implementation of gethostbyname (it
416# only looks in /etc/hosts), so we only look for -lsocket if we need
417# it.
418AC_CHECK_FUNCS(connect)
419if test x"$ac_cv_func_connect" = x"no"; then
420 case "$LIBS" in
421 *-lnsl*) ;;
422 *) AC_CHECK_LIB(nsl_s, printf) ;;
423 esac
424 case "$LIBS" in
425 *-lnsl*) ;;
426 *) AC_CHECK_LIB(nsl, printf) ;;
427 esac
428 case "$LIBS" in
429 *-lsocket*) ;;
430 *) AC_CHECK_LIB(socket, connect) ;;
431 esac
432 case "$LIBS" in
433 *-linet*) ;;
434 *) AC_CHECK_LIB(inet, connect) ;;
435 esac
436 dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
437 dnl has been cached.
2ef2e822 438 if test x"$ac_cv_lib_socket_connect" = x"yes" ||
a784e10d
DD
439 test x"$ac_cv_lib_inet_connect" = x"yes"; then
440 # ac_cv_func_connect=yes
441 # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
0d2aa5d9 442 AC_DEFINE(HAVE_CONNECT, 1, [Define to 1 if you have the "connect" function])
a784e10d
DD
443 fi
444fi
445
10a1d6b4 446AC_SEARCH_LIBS(inet_ntop, resolv)
f9cfaae9 447
d699d815
WD
448# For OS X, Solaris, HP-UX, etc.: figure out if -liconv is needed. We'll
449# accept either iconv_open or libiconv_open, since some include files map
450# the former to the latter.
451AC_SEARCH_LIBS(iconv_open, iconv)
f9cfaae9 452AC_SEARCH_LIBS(libiconv_open, iconv)
8f694072 453
f9b66bc4
WD
454AC_MSG_CHECKING([for iconv declaration])
455AC_CACHE_VAL(am_cv_proto_iconv, [
456 AC_TRY_COMPILE([
3ebdd3c7
WD
457#include <stdlib.h>
458#include <iconv.h>
459extern
460#ifdef __cplusplus
461"C"
462#endif
463#if defined(__STDC__) || defined(__cplusplus)
464size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
465#else
466size_t iconv();
467#endif
468], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
469 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);"])
470 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
f9b66bc4 471AC_MSG_RESULT([$]{ac_t:-
3ebdd3c7 472 }[$]am_cv_proto_iconv)
f9b66bc4
WD
473AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
474 [Define as const if the declaration of iconv() needs const.])
3ebdd3c7 475
99f106d1 476dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
e94989fe 477
2ef2e822
WD
478AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)])
479AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)])
356bbb83 480
4021aa45 481AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
2213961e
WD
482AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/types.h>
483#include <sys/socket.h>])
4021aa45 484
824f1c79
DD
485# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
486# builtin getaddrinfo if one of the defines don't exist
184dede9
DD
487AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
488 rsync_cv_HAVE_GETADDR_DEFINES,[
489 AC_EGREP_CPP(yes, [
490 #include <sys/types.h>
491 #include <sys/socket.h>
492 #include <netdb.h>
493 #ifdef AI_PASSIVE
494 yes
2ef2e822 495 #endif],
184dede9
DD
496 rsync_cv_HAVE_GETADDR_DEFINES=yes,
497 rsync_cv_HAVE_GETADDR_DEFINES=no)])
4021aa45 498if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then
824f1c79
DD
499 # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
500 # something else so we must include <netdb.h> to get the
501 # redefinition.
502 AC_CHECK_FUNCS(getaddrinfo, ,
503 [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
504 AC_TRY_LINK([#include <sys/types.h>
505 #include <sys/socket.h>
506 #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
507 [AC_MSG_RESULT([yes])
508 AC_DEFINE(HAVE_GETADDRINFO, 1,
4021aa45 509 [Define to 1 if you have the "getaddrinfo" function and required types.])],
824f1c79
DD
510 [AC_MSG_RESULT([no])
511 AC_LIBOBJ(lib/getaddrinfo)])])
184dede9 512else
d2cc0323 513 AC_LIBOBJ(lib/getaddrinfo)
184dede9 514fi
824f1c79 515
2ef2e822 516AC_CHECK_MEMBER([struct sockaddr.sa_len],
b4b90120 517 [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
0042f818
WD
518 [],
519 [
520#include <sys/types.h>
521#include <sys/socket.h>
522])
523
b4b90120
WD
524AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
525 [ AC_DEFINE(HAVE_SOCKADDR_IN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ],
356bbb83
MP
526 [],
527 [
528#include <sys/types.h>
529#include <sys/socket.h>
b4b90120 530#include <netinet/in.h>
356bbb83
MP
531])
532
e49d7200
WD
533AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
534 [ AC_DEFINE(HAVE_SOCKADDR_UN_LEN, 1, [Do we have sockaddr_un.sun_len?]) ],
535 [],
536 [
537#include <sys/types.h>
538#include <sys/socket.h>
539#include <netinet/in.h>
540])
541
bc2b4963 542AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
a1d8f29a 543 [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID, 1, [Do we have sockaddr_in6.sin6_scope_id?]) ],
bc2b4963
DD
544 [],
545 [
546#include <sys/types.h>
547#include <sys/socket.h>
548#include <netinet/in.h>
549])
550
4021aa45 551AC_HAVE_TYPE([struct stat64], [#include <stdio.h>
c83a2c8e
WD
552#if HAVE_SYS_TYPES_H
553# include <sys/types.h>
554#endif
555#if HAVE_SYS_STAT_H
556# include <sys/stat.h>
557#endif
558#if STDC_HEADERS
559# include <stdlib.h>
560# include <stddef.h>
561#else
562# if HAVE_STDLIB_H
563# include <stdlib.h>
564# endif
565#endif
4021aa45 566])
c83a2c8e 567
a784e10d
DD
568# if we can't find strcasecmp, look in -lresolv (for Unixware at least)
569#
570AC_CHECK_FUNCS(strcasecmp)
571if test x"$ac_cv_func_strcasecmp" = x"no"; then
572 AC_CHECK_LIB(resolv, strcasecmp)
573fi
574
1c3344a1
WD
575AC_CHECK_FUNCS(aclsort)
576if test x"$ac_cv_func_aclsort" = x"no"; then
577 AC_CHECK_LIB(sec, aclsort)
578fi
579
87fcb639
MP
580dnl At the moment we don't test for a broken memcmp(), because all we
581dnl need to do is test for equality, not comparison, and it seems that
2ef2e822 582dnl every platform has a memcmp that can do at least that.
87fcb639
MP
583dnl AC_FUNC_MEMCMP
584
c627d613 585AC_FUNC_UTIME_NULL
7fc08908 586AC_FUNC_ALLOCA
8ce65463
WD
587AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
588 fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
4d30f176 589 memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \
84e1a698 590 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
8ce65463 591 setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
cece2e3f 592 seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
7f367bb1 593 extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
1a2e41af 594 initgroups utimensat)
24c857f1 595
b6800a0b
WD
596dnl cygwin iconv.h defines iconv_open as libiconv_open
597if test x"$ac_cv_func_iconv_open" != x"yes"; then
598 AC_CHECK_FUNC(libiconv_open, [ac_cv_func_iconv_open=yes; AC_DEFINE(HAVE_ICONV_OPEN, 1)])
599fi
600
21524e30
WD
601AC_CHECK_FUNCS(getpgrp tcgetpgrp)
602if test $ac_cv_func_getpgrp = yes; then
603 AC_FUNC_GETPGRP
604fi
605
49c24071
WD
606AC_ARG_ENABLE(iconv-open,
607 AC_HELP_STRING([--disable-iconv-open],
608 [disable all use of iconv_open() function]),
609 [], [enable_iconv_open=$ac_cv_func_iconv_open])
610
611if test x"$enable_iconv_open" != x"no"; then
612 AC_DEFINE(USE_ICONV_OPEN, 1, [Define to 1 if you want rsync to make use of iconv_open()])
613fi
614
332cf6df
WD
615AC_ARG_ENABLE(iconv,
616 AC_HELP_STRING([--disable-iconv],
617 [disable rsync's --iconv option]),
49c24071 618 [], [enable_iconv=$enable_iconv_open])
332cf6df
WD
619AH_TEMPLATE([ICONV_OPTION],
620[Define if you want the --iconv option. Specifing a value will set the
621default iconv setting (a NULL means no --iconv processing by default).])
622if test x"$enable_iconv" != x"no"; then
623 if test x"$enable_iconv" = x"yes"; then
624 AC_DEFINE(ICONV_OPTION, NULL)
625 else
626 AC_DEFINE_UNQUOTED(ICONV_OPTION, "$enable_iconv")
627 fi
628 AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
629fi
630
0037bf23 631AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
21524e30
WD
632 AC_TRY_RUN([
633#if HAVE_UNISTD_H
634# include <unistd.h>
635#endif
636#include <stdlib.h>
637#include <errno.h>
638 main() {
639 char const *dangling_symlink = "conftest.dangle";
640 unlink(dangling_symlink);
641 if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
0037bf23
WD
642 if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
643 exit(0);
21524e30 644 }],
0037bf23
WD
645 rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
646if test $rsync_cv_chown_modifies_symlink = yes; then
0d2aa5d9 647 AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
21524e30
WD
648fi
649
0037bf23
WD
650AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
651 AC_TRY_RUN([
652#if HAVE_UNISTD_H
653# include <unistd.h>
654#endif
655#include <stdlib.h>
656#include <errno.h>
657#define FILENAME "conftest.dangle"
658 main() {
659 unlink(FILENAME);
660 if (symlink("conftest.no-such", FILENAME) < 0) abort();
661 if (link(FILENAME, FILENAME "2") < 0) exit(1);
662 exit(0);
663 }],
664 rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
665if test $rsync_cv_can_hardlink_symlink = yes; then
666 AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
667fi
668
669AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
670 AC_TRY_RUN([
671#if HAVE_UNISTD_H
672# include <unistd.h>
673#endif
674#include <stdlib.h>
675#include <errno.h>
676#define FILENAME "conftest.fifi"
677 main() {
678 unlink(FILENAME);
679 if (mkfifo(FILENAME, 0777) < 0) abort();
680 if (link(FILENAME, FILENAME "2") < 0) exit(1);
681 exit(0);
682 }],
683 rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
684if test $rsync_cv_can_hardlink_special = yes; then
685 AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
686fi
687
24c857f1 688AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
6a5ef41f
MP
689AC_TRY_RUN([
690#include <sys/types.h>
691#include <sys/socket.h>
692
693main() {
694 int fd[2];
695 exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
696}],
24c857f1
DD
697rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
698if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
0d2aa5d9 699 AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
24c857f1 700fi
c627d613 701
79f48760 702if test x"$with_included_popt" != x"yes"; then
1ac15cd8
MP
703 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
704fi
8afaef42
WD
705if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
706 # If the system has /usr/include/popt/popt.h, we enable the
707 # included popt because an attempt to "#include <popt/popt.h>"
708 # would use our included header file anyway (due to -I.), and
d7b6774d 709 # might conflict with the system popt.
8afaef42 710 with_included_popt=yes
6de417d9
WD
711elif test x"$ac_cv_header_popt_h" != x"yes"; then
712 with_included_popt=yes
8afaef42 713fi
2d1ebe9c 714
12458878 715AC_MSG_CHECKING([whether to use included libpopt])
79f48760 716if test x"$with_included_popt" = x"yes"; then
12458878 717 AC_MSG_RESULT($srcdir/popt)
1ac15cd8 718 BUILD_POPT='$(popt_OBJS)'
26ef00bd 719 CFLAGS="$CFLAGS -I$srcdir/popt"
5216de37 720 if test x"$ALLOCA" != x
7fc08908 721 then
5216de37
DD
722 # this can be removed when/if we add an included alloca.c;
723 # see autoconf documentation on AC_FUNC_ALLOCA
8af534a5 724 AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
7fc08908 725 fi
2d1ebe9c
MP
726else
727 AC_MSG_RESULT(no)
79fc6bdb 728fi
c627d613 729
0d2aa5d9
WD
730AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
731AC_TRY_COMPILE([],[signed char *s = ""],
732rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
733if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
734 AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
7597e1a9 735fi
bcacc18b 736
7b3d4257 737AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
59503278
AT
738AC_TRY_RUN([#include <sys/types.h>
739#include <dirent.h>
740main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
741if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
7597e1a9 742di->d_name[0] == 0) exit(0); exit(1);} ],
7b3d4257
AT
743rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
744if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
0d2aa5d9 745 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
7597e1a9 746fi
1e9f155a 747
4021aa45 748AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
d6e6ecbd
AT
749AC_TRY_COMPILE([#include <sys/types.h>
750#include <utime.h>],
7597e1a9 751[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
4021aa45
WD
752rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
753if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
754 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
7597e1a9 755fi
d6e6ecbd 756
3060d4aa 757AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
0d2aa5d9
WD
758AC_TRY_COMPILE([#include <sys/time.h>
759#include <unistd.h>],
760[struct timeval tv; exit(gettimeofday(&tv, NULL));],
761rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
a20a88d2 762if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
0d2aa5d9 763 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
3060d4aa
AT
764fi
765
8950ac03
AT
766AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
767AC_TRY_RUN([
768#include <sys/types.h>
769#include <stdarg.h>
2ef2e822 770void foo(const char *format, ...) {
8950ac03
AT
771 va_list ap;
772 int len;
773 char buf[5];
774
775 va_start(ap, format);
776 len = vsnprintf(0, 0, format, ap);
777 va_end(ap);
778 if (len != 5) exit(1);
779
780 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
781
782 exit(0);
783}
784main() { foo("hello"); }
785],
786rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
787if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
0d2aa5d9 788 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
8950ac03
AT
789fi
790
791
f62c17e3
AT
792AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
793AC_TRY_RUN([#include <stdlib.h>
794#include <sys/types.h>
795#include <sys/stat.h>
796#include <unistd.h>
2ef2e822 797main() {
f62c17e3 798 struct stat st;
2ef2e822
WD
799 char tpl[20]="/tmp/test.XXXXXX";
800 int fd = mkstemp(tpl);
f62c17e3
AT
801 if (fd == -1) exit(1);
802 unlink(tpl);
803 if (fstat(fd, &st) != 0) exit(1);
804 if ((st.st_mode & 0777) != 0600) exit(1);
805 exit(0);
806}],
807rsync_cv_HAVE_SECURE_MKSTEMP=yes,
808rsync_cv_HAVE_SECURE_MKSTEMP=no,
809rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
810if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
83238ed0 811 case $host_os in
5f2c5bf1
WD
812 hpux*)
813 dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
814 dnl so we noisily skip using it. See HP change request JAGaf34426
815 dnl for details. (sbonds)
816 AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
817 ;;
818 *)
819 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
820 ;;
821 esac
f62c17e3
AT
822fi
823
3060d4aa 824
e49d7200
WD
825AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
826AC_TRY_RUN([
827#include <stdio.h>
828#include <sys/stat.h>
829#include <errno.h>
830main() { int rc, ec; char *fn = "fifo-test";
831unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
12a01be1 832if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
833return 0;}],
834 rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
835if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
836 AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
837fi
838
839AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
840AC_TRY_RUN([
841#include <stdio.h>
842#include <sys/stat.h>
843#include <errno.h>
844main() { int rc, ec; char *fn = "sock-test";
845unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
12a01be1 846if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
847return 0;}],
848 rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
849if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
850 AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
851fi
852
692da0b5
DD
853#
854# The following test was mostly taken from the tcl/tk plus patches
855#
79fc6bdb 856AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
692da0b5
DD
857rm -rf conftest*
858cat > conftest.$ac_ext <<EOF
859int main() { return 0; }
860EOF
861${CC-cc} -c -o conftest..o conftest.$ac_ext
862if test -f conftest..o; then
79fc6bdb
DD
863 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
864else
865 rsync_cv_DASHC_WORKS_WITH_DASHO=no
866fi
867rm -rf conftest*
868])
869if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
692da0b5
DD
870 OBJ_SAVE="#"
871 OBJ_RESTORE="#"
872 CC_SHOBJ_FLAG='-o $@'
692da0b5
DD
873else
874 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
875 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'
876 CC_SHOBJ_FLAG=""
692da0b5 877fi
79fc6bdb 878
692da0b5
DD
879AC_SUBST(OBJ_SAVE)
880AC_SUBST(OBJ_RESTORE)
881AC_SUBST(CC_SHOBJ_FLAG)
1ac15cd8 882AC_SUBST(BUILD_POPT)
225787a4 883AC_SUBST(MAKE_MAN)
7d29d4ba 884
1c3344a1
WD
885AC_CHECK_FUNCS(_acl __acl _facl __facl)
886#################################################
887# check for ACL support
888
889AC_MSG_CHECKING([whether to support ACLs])
890AC_ARG_ENABLE(acl-support,
891 AC_HELP_STRING([--disable-acl-support],
e8c64ffd 892 [disable ACL support]))
1c3344a1
WD
893
894if test x"$enable_acl_support" = x"no"; then
895 AC_MSG_RESULT(no)
896else
1c3344a1
WD
897 case "$host_os" in
898 *sysv5*)
899 AC_MSG_RESULT(Using UnixWare ACLs)
900 AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
545584cb 901 AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
1c3344a1
WD
902 ;;
903 *solaris*|*cygwin*)
904 AC_MSG_RESULT(Using solaris ACLs)
905 AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
987838fd 906 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
907 ;;
908 *hpux*)
909 AC_MSG_RESULT(Using HPUX ACLs)
910 AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
987838fd 911 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
912 ;;
913 *irix*)
914 AC_MSG_RESULT(Using IRIX ACLs)
915 AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
987838fd 916 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
917 ;;
918 *aix*)
919 AC_MSG_RESULT(Using AIX ACLs)
920 AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
987838fd 921 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
922 ;;
923 *osf*)
924 AC_MSG_RESULT(Using Tru64 ACLs)
925 AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
987838fd 926 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
927 LIBS="$LIBS -lpacl"
928 ;;
16edf865 929 darwin*)
49ea69b3
WD
930 AC_MSG_RESULT(Using OS X ACLs)
931 AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
932 AC_DEFINE(SUPPORT_ACLS, 1)
88467ec4 933 ;;
1c3344a1
WD
934 *)
935 AC_MSG_RESULT(running tests:)
936 AC_CHECK_LIB(acl,acl_get_file)
937 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
938 AC_TRY_LINK([#include <sys/types.h>
939#include <sys/acl.h>],
940[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
941samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
942 AC_MSG_CHECKING(ACL test results)
943 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
944 AC_MSG_RESULT(Using posix ACLs)
945 AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
987838fd 946 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
947 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
948 AC_TRY_LINK([#include <sys/types.h>
949#include <sys/acl.h>],
950[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
951samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
952 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
953 AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
954 fi
955 else
987838fd
WD
956 if test x"$enable_acl_support" = x"yes"; then
957 AC_MSG_ERROR(Failed to find ACL support)
958 else
959 AC_MSG_RESULT(No ACL support found)
1c3344a1
WD
960 fi
961 fi
962 ;;
963 esac
964fi
965
16edf865
WD
966#################################################
967# check for extended attribute support
968AC_MSG_CHECKING(whether to support extended attributes)
969AC_ARG_ENABLE(xattr-support,
e8c64ffd
WD
970 AC_HELP_STRING([--disable-xattr-support],
971 [disable extended attributes]),
6b5a8f80
WD
972 [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
973 *yes*) enable_xattr_support=maybe ;;
974 *) enable_xattr_support=no ;;
975 esac])
e8c64ffd
WD
976AH_TEMPLATE([SUPPORT_XATTRS],
977[Define to 1 to add support for extended attributes])
16edf865
WD
978if test x"$enable_xattr_support" = x"no"; then
979 AC_MSG_RESULT(no)
980else
981 case "$host_os" in
982 *linux*)
983 AC_MSG_RESULT(Using Linux xattrs)
984 AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
e8c64ffd 985 AC_DEFINE(SUPPORT_XATTRS, 1)
3f770ab0 986 AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
16edf865
WD
987 ;;
988 darwin*)
989 AC_MSG_RESULT(Using OS X xattrs)
990 AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
991 AC_DEFINE(SUPPORT_XATTRS, 1)
6500e076
WD
992 AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
993 AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
16edf865
WD
994 ;;
995 freebsd*)
996 AC_MSG_RESULT(Using FreeBSD extattrs)
997 AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
998 AC_DEFINE(SUPPORT_XATTRS, 1)
999 ;;
05a652d0
WD
1000 solaris*)
1001 AC_MSG_RESULT(Using Solaris xattrs)
1002 AC_DEFINE(HAVE_SOLARIS_XATTRS, 1, [True if you have Solaris xattrs])
1003 AC_DEFINE(SUPPORT_XATTRS, 1)
3f770ab0 1004 AC_DEFINE(NO_SYMLINK_XATTRS, 1)
05a652d0 1005 ;;
16edf865
WD
1006 *)
1007 if test x"$enable_xattr_support" = x"yes"; then
1008 AC_MSG_ERROR(Failed to find extended attribute support)
1009 else
1010 AC_MSG_RESULT(No extended attribute support found)
1011 fi
1012 ;;
1013 esac
1014fi
1015
f4901024
WD
1016if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
1017 AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
1018 OLD_CFLAGS="$CFLAGS"
1019 CFLAGS="$CFLAGS -Wno-unused-parameter"
fc4bb123 1020 AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
f4901024
WD
1021 AC_MSG_RESULT([$rsync_warn_flag])
1022 if test x"$rsync_warn_flag" = x"no"; then
1023 CFLAGS="$OLD_CFLAGS"
1024 fi
1025fi
1026
aa0e6b99 1027case "$CC" in
d4c5cb2b 1028' checker'*|checker*)
aa0e6b99
WD
1029 AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
1030 ;;
1031esac
1032
bf5c2bf6
MP
1033AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
1034AC_OUTPUT
a4677968
MP
1035
1036AC_MSG_RESULT()
1037AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
1038AC_MSG_RESULT()