Mention need of wildcard support in make.
[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
49 AC_MSG_WARN([rsync requires an ANSI C compiler and you don't seem to have one])
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
WD
201 AC_HELP_STRING([--disable-ipv6],
202 [don't even try to use IPv6]))
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
WD
315AH_TEMPLATE([CONFIG_LOCALE],
316[Undefine if you don't want locale features. By default this is defined.])
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
WD
447
448# Solaris and HP-UX weirdness:
449# Search for libiconv_open (not iconv_open) to discover if -liconv is needed!
450AC_SEARCH_LIBS(libiconv_open, iconv)
8f694072 451
f9b66bc4
WD
452AC_MSG_CHECKING([for iconv declaration])
453AC_CACHE_VAL(am_cv_proto_iconv, [
454 AC_TRY_COMPILE([
3ebdd3c7
WD
455#include <stdlib.h>
456#include <iconv.h>
457extern
458#ifdef __cplusplus
459"C"
460#endif
461#if defined(__STDC__) || defined(__cplusplus)
462size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
463#else
464size_t iconv();
465#endif
466], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
467 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);"])
468 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
f9b66bc4 469AC_MSG_RESULT([$]{ac_t:-
3ebdd3c7 470 }[$]am_cv_proto_iconv)
f9b66bc4
WD
471AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
472 [Define as const if the declaration of iconv() needs const.])
3ebdd3c7 473
99f106d1 474dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
e94989fe 475
2ef2e822
WD
476AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)])
477AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)])
356bbb83 478
4021aa45 479AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
2213961e
WD
480AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/types.h>
481#include <sys/socket.h>])
4021aa45 482
824f1c79
DD
483# Irix 6.5 has getaddrinfo but not the corresponding defines, so use
484# builtin getaddrinfo if one of the defines don't exist
184dede9
DD
485AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
486 rsync_cv_HAVE_GETADDR_DEFINES,[
487 AC_EGREP_CPP(yes, [
488 #include <sys/types.h>
489 #include <sys/socket.h>
490 #include <netdb.h>
491 #ifdef AI_PASSIVE
492 yes
2ef2e822 493 #endif],
184dede9
DD
494 rsync_cv_HAVE_GETADDR_DEFINES=yes,
495 rsync_cv_HAVE_GETADDR_DEFINES=no)])
4021aa45 496if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then
824f1c79
DD
497 # Tru64 UNIX has getaddrinfo() but has it renamed in libc as
498 # something else so we must include <netdb.h> to get the
499 # redefinition.
500 AC_CHECK_FUNCS(getaddrinfo, ,
501 [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
502 AC_TRY_LINK([#include <sys/types.h>
503 #include <sys/socket.h>
504 #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
505 [AC_MSG_RESULT([yes])
506 AC_DEFINE(HAVE_GETADDRINFO, 1,
4021aa45 507 [Define to 1 if you have the "getaddrinfo" function and required types.])],
824f1c79
DD
508 [AC_MSG_RESULT([no])
509 AC_LIBOBJ(lib/getaddrinfo)])])
184dede9 510else
d2cc0323 511 AC_LIBOBJ(lib/getaddrinfo)
184dede9 512fi
824f1c79 513
2ef2e822 514AC_CHECK_MEMBER([struct sockaddr.sa_len],
b4b90120 515 [ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
0042f818
WD
516 [],
517 [
518#include <sys/types.h>
519#include <sys/socket.h>
520])
521
b4b90120
WD
522AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
523 [ AC_DEFINE(HAVE_SOCKADDR_IN_LEN, 1, [Do we have sockaddr_in.sin_len?]) ],
356bbb83
MP
524 [],
525 [
526#include <sys/types.h>
527#include <sys/socket.h>
b4b90120 528#include <netinet/in.h>
356bbb83
MP
529])
530
e49d7200
WD
531AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
532 [ AC_DEFINE(HAVE_SOCKADDR_UN_LEN, 1, [Do we have sockaddr_un.sun_len?]) ],
533 [],
534 [
535#include <sys/types.h>
536#include <sys/socket.h>
537#include <netinet/in.h>
538])
539
bc2b4963 540AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id],
a1d8f29a 541 [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID, 1, [Do we have sockaddr_in6.sin6_scope_id?]) ],
bc2b4963
DD
542 [],
543 [
544#include <sys/types.h>
545#include <sys/socket.h>
546#include <netinet/in.h>
547])
548
4021aa45 549AC_HAVE_TYPE([struct stat64], [#include <stdio.h>
c83a2c8e
WD
550#if HAVE_SYS_TYPES_H
551# include <sys/types.h>
552#endif
553#if HAVE_SYS_STAT_H
554# include <sys/stat.h>
555#endif
556#if STDC_HEADERS
557# include <stdlib.h>
558# include <stddef.h>
559#else
560# if HAVE_STDLIB_H
561# include <stdlib.h>
562# endif
563#endif
4021aa45 564])
c83a2c8e 565
a784e10d
DD
566# if we can't find strcasecmp, look in -lresolv (for Unixware at least)
567#
568AC_CHECK_FUNCS(strcasecmp)
569if test x"$ac_cv_func_strcasecmp" = x"no"; then
570 AC_CHECK_LIB(resolv, strcasecmp)
571fi
572
1c3344a1
WD
573AC_CHECK_FUNCS(aclsort)
574if test x"$ac_cv_func_aclsort" = x"no"; then
575 AC_CHECK_LIB(sec, aclsort)
576fi
577
87fcb639
MP
578dnl At the moment we don't test for a broken memcmp(), because all we
579dnl need to do is test for equality, not comparison, and it seems that
2ef2e822 580dnl every platform has a memcmp that can do at least that.
87fcb639
MP
581dnl AC_FUNC_MEMCMP
582
c627d613 583AC_FUNC_UTIME_NULL
7fc08908 584AC_FUNC_ALLOCA
8ce65463
WD
585AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
586 fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
4d30f176 587 memmove lchown vsnprintf snprintf vasprintf asprintf setsid strpbrk \
84e1a698 588 strlcat strlcpy strtol mallinfo getgroups setgroups geteuid getegid \
8ce65463 589 setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
cece2e3f 590 seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
7f367bb1 591 extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
1a2e41af 592 initgroups utimensat)
24c857f1 593
b6800a0b
WD
594dnl cygwin iconv.h defines iconv_open as libiconv_open
595if test x"$ac_cv_func_iconv_open" != x"yes"; then
596 AC_CHECK_FUNC(libiconv_open, [ac_cv_func_iconv_open=yes; AC_DEFINE(HAVE_ICONV_OPEN, 1)])
597fi
598
21524e30
WD
599AC_CHECK_FUNCS(getpgrp tcgetpgrp)
600if test $ac_cv_func_getpgrp = yes; then
601 AC_FUNC_GETPGRP
602fi
603
49c24071
WD
604AC_ARG_ENABLE(iconv-open,
605 AC_HELP_STRING([--disable-iconv-open],
606 [disable all use of iconv_open() function]),
607 [], [enable_iconv_open=$ac_cv_func_iconv_open])
608
609if test x"$enable_iconv_open" != x"no"; then
610 AC_DEFINE(USE_ICONV_OPEN, 1, [Define to 1 if you want rsync to make use of iconv_open()])
611fi
612
332cf6df
WD
613AC_ARG_ENABLE(iconv,
614 AC_HELP_STRING([--disable-iconv],
615 [disable rsync's --iconv option]),
49c24071 616 [], [enable_iconv=$enable_iconv_open])
332cf6df
WD
617AH_TEMPLATE([ICONV_OPTION],
618[Define if you want the --iconv option. Specifing a value will set the
619default iconv setting (a NULL means no --iconv processing by default).])
620if test x"$enable_iconv" != x"no"; then
621 if test x"$enable_iconv" = x"yes"; then
622 AC_DEFINE(ICONV_OPTION, NULL)
623 else
624 AC_DEFINE_UNQUOTED(ICONV_OPTION, "$enable_iconv")
625 fi
626 AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
627fi
628
0037bf23 629AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
21524e30
WD
630 AC_TRY_RUN([
631#if HAVE_UNISTD_H
632# include <unistd.h>
633#endif
634#include <stdlib.h>
635#include <errno.h>
636 main() {
637 char const *dangling_symlink = "conftest.dangle";
638 unlink(dangling_symlink);
639 if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
0037bf23
WD
640 if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
641 exit(0);
21524e30 642 }],
0037bf23
WD
643 rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
644if test $rsync_cv_chown_modifies_symlink = yes; then
0d2aa5d9 645 AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
21524e30
WD
646fi
647
0037bf23
WD
648AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
649 AC_TRY_RUN([
650#if HAVE_UNISTD_H
651# include <unistd.h>
652#endif
653#include <stdlib.h>
654#include <errno.h>
655#define FILENAME "conftest.dangle"
656 main() {
657 unlink(FILENAME);
658 if (symlink("conftest.no-such", FILENAME) < 0) abort();
659 if (link(FILENAME, FILENAME "2") < 0) exit(1);
660 exit(0);
661 }],
662 rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
663if test $rsync_cv_can_hardlink_symlink = yes; then
664 AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
665fi
666
667AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
668 AC_TRY_RUN([
669#if HAVE_UNISTD_H
670# include <unistd.h>
671#endif
672#include <stdlib.h>
673#include <errno.h>
674#define FILENAME "conftest.fifi"
675 main() {
676 unlink(FILENAME);
677 if (mkfifo(FILENAME, 0777) < 0) abort();
678 if (link(FILENAME, FILENAME "2") < 0) exit(1);
679 exit(0);
680 }],
681 rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
682if test $rsync_cv_can_hardlink_special = yes; then
683 AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
684fi
685
24c857f1 686AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
6a5ef41f
MP
687AC_TRY_RUN([
688#include <sys/types.h>
689#include <sys/socket.h>
690
691main() {
692 int fd[2];
693 exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
694}],
24c857f1
DD
695rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
696if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
0d2aa5d9 697 AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
24c857f1 698fi
c627d613 699
79f48760 700if test x"$with_included_popt" != x"yes"; then
1ac15cd8
MP
701 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
702fi
8afaef42
WD
703if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
704 # If the system has /usr/include/popt/popt.h, we enable the
705 # included popt because an attempt to "#include <popt/popt.h>"
706 # would use our included header file anyway (due to -I.), and
d7b6774d 707 # might conflict with the system popt.
8afaef42 708 with_included_popt=yes
6de417d9
WD
709elif test x"$ac_cv_header_popt_h" != x"yes"; then
710 with_included_popt=yes
8afaef42 711fi
2d1ebe9c 712
12458878 713AC_MSG_CHECKING([whether to use included libpopt])
79f48760 714if test x"$with_included_popt" = x"yes"; then
12458878 715 AC_MSG_RESULT($srcdir/popt)
1ac15cd8 716 BUILD_POPT='$(popt_OBJS)'
26ef00bd 717 CFLAGS="$CFLAGS -I$srcdir/popt"
5216de37 718 if test x"$ALLOCA" != x
7fc08908 719 then
5216de37
DD
720 # this can be removed when/if we add an included alloca.c;
721 # see autoconf documentation on AC_FUNC_ALLOCA
8af534a5 722 AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
7fc08908 723 fi
2d1ebe9c
MP
724else
725 AC_MSG_RESULT(no)
79fc6bdb 726fi
c627d613 727
0d2aa5d9
WD
728AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
729AC_TRY_COMPILE([],[signed char *s = ""],
730rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
731if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
732 AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
7597e1a9 733fi
bcacc18b 734
7b3d4257 735AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
59503278
AT
736AC_TRY_RUN([#include <sys/types.h>
737#include <dirent.h>
738main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
739if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
7597e1a9 740di->d_name[0] == 0) exit(0); exit(1);} ],
7b3d4257
AT
741rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
742if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
0d2aa5d9 743 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
7597e1a9 744fi
1e9f155a 745
4021aa45 746AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
d6e6ecbd
AT
747AC_TRY_COMPILE([#include <sys/types.h>
748#include <utime.h>],
7597e1a9 749[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
4021aa45
WD
750rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
751if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
752 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
7597e1a9 753fi
d6e6ecbd 754
3060d4aa 755AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
0d2aa5d9
WD
756AC_TRY_COMPILE([#include <sys/time.h>
757#include <unistd.h>],
758[struct timeval tv; exit(gettimeofday(&tv, NULL));],
759rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
a20a88d2 760if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
0d2aa5d9 761 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
3060d4aa
AT
762fi
763
8950ac03
AT
764AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
765AC_TRY_RUN([
766#include <sys/types.h>
767#include <stdarg.h>
2ef2e822 768void foo(const char *format, ...) {
8950ac03
AT
769 va_list ap;
770 int len;
771 char buf[5];
772
773 va_start(ap, format);
774 len = vsnprintf(0, 0, format, ap);
775 va_end(ap);
776 if (len != 5) exit(1);
777
778 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
779
780 exit(0);
781}
782main() { foo("hello"); }
783],
784rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
785if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
0d2aa5d9 786 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
8950ac03
AT
787fi
788
789
f62c17e3
AT
790AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
791AC_TRY_RUN([#include <stdlib.h>
792#include <sys/types.h>
793#include <sys/stat.h>
794#include <unistd.h>
2ef2e822 795main() {
f62c17e3 796 struct stat st;
2ef2e822
WD
797 char tpl[20]="/tmp/test.XXXXXX";
798 int fd = mkstemp(tpl);
f62c17e3
AT
799 if (fd == -1) exit(1);
800 unlink(tpl);
801 if (fstat(fd, &st) != 0) exit(1);
802 if ((st.st_mode & 0777) != 0600) exit(1);
803 exit(0);
804}],
805rsync_cv_HAVE_SECURE_MKSTEMP=yes,
806rsync_cv_HAVE_SECURE_MKSTEMP=no,
807rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
808if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
83238ed0 809 case $host_os in
5f2c5bf1
WD
810 hpux*)
811 dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
812 dnl so we noisily skip using it. See HP change request JAGaf34426
813 dnl for details. (sbonds)
814 AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
815 ;;
816 *)
817 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
818 ;;
819 esac
f62c17e3
AT
820fi
821
3060d4aa 822
e49d7200
WD
823AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
824AC_TRY_RUN([
825#include <stdio.h>
826#include <sys/stat.h>
827#include <errno.h>
828main() { int rc, ec; char *fn = "fifo-test";
829unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
12a01be1 830if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
831return 0;}],
832 rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
833if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
834 AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
835fi
836
837AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
838AC_TRY_RUN([
839#include <stdio.h>
840#include <sys/stat.h>
841#include <errno.h>
842main() { int rc, ec; char *fn = "sock-test";
843unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
12a01be1 844if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
845return 0;}],
846 rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
847if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
848 AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
849fi
850
692da0b5
DD
851#
852# The following test was mostly taken from the tcl/tk plus patches
853#
79fc6bdb 854AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
692da0b5
DD
855rm -rf conftest*
856cat > conftest.$ac_ext <<EOF
857int main() { return 0; }
858EOF
859${CC-cc} -c -o conftest..o conftest.$ac_ext
860if test -f conftest..o; then
79fc6bdb
DD
861 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
862else
863 rsync_cv_DASHC_WORKS_WITH_DASHO=no
864fi
865rm -rf conftest*
866])
867if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
692da0b5
DD
868 OBJ_SAVE="#"
869 OBJ_RESTORE="#"
870 CC_SHOBJ_FLAG='-o $@'
692da0b5
DD
871else
872 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
873 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'
874 CC_SHOBJ_FLAG=""
692da0b5 875fi
79fc6bdb 876
692da0b5
DD
877AC_SUBST(OBJ_SAVE)
878AC_SUBST(OBJ_RESTORE)
879AC_SUBST(CC_SHOBJ_FLAG)
1ac15cd8 880AC_SUBST(BUILD_POPT)
225787a4 881AC_SUBST(MAKE_MAN)
7d29d4ba 882
1c3344a1
WD
883AC_CHECK_FUNCS(_acl __acl _facl __facl)
884#################################################
885# check for ACL support
886
887AC_MSG_CHECKING([whether to support ACLs])
888AC_ARG_ENABLE(acl-support,
889 AC_HELP_STRING([--disable-acl-support],
e8c64ffd 890 [disable ACL support]))
1c3344a1
WD
891
892if test x"$enable_acl_support" = x"no"; then
893 AC_MSG_RESULT(no)
894else
1c3344a1
WD
895 case "$host_os" in
896 *sysv5*)
897 AC_MSG_RESULT(Using UnixWare ACLs)
898 AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
545584cb 899 AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
1c3344a1
WD
900 ;;
901 *solaris*|*cygwin*)
902 AC_MSG_RESULT(Using solaris ACLs)
903 AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
987838fd 904 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
905 ;;
906 *hpux*)
907 AC_MSG_RESULT(Using HPUX ACLs)
908 AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
987838fd 909 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
910 ;;
911 *irix*)
912 AC_MSG_RESULT(Using IRIX ACLs)
913 AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
987838fd 914 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
915 ;;
916 *aix*)
917 AC_MSG_RESULT(Using AIX ACLs)
918 AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
987838fd 919 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
920 ;;
921 *osf*)
922 AC_MSG_RESULT(Using Tru64 ACLs)
923 AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
987838fd 924 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
925 LIBS="$LIBS -lpacl"
926 ;;
16edf865 927 darwin*)
49ea69b3
WD
928 AC_MSG_RESULT(Using OS X ACLs)
929 AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
930 AC_DEFINE(SUPPORT_ACLS, 1)
88467ec4 931 ;;
1c3344a1
WD
932 *)
933 AC_MSG_RESULT(running tests:)
934 AC_CHECK_LIB(acl,acl_get_file)
935 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
936 AC_TRY_LINK([#include <sys/types.h>
937#include <sys/acl.h>],
938[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
939samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
940 AC_MSG_CHECKING(ACL test results)
941 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
942 AC_MSG_RESULT(Using posix ACLs)
943 AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
987838fd 944 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
945 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
946 AC_TRY_LINK([#include <sys/types.h>
947#include <sys/acl.h>],
948[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
949samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
950 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
951 AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
952 fi
953 else
987838fd
WD
954 if test x"$enable_acl_support" = x"yes"; then
955 AC_MSG_ERROR(Failed to find ACL support)
956 else
957 AC_MSG_RESULT(No ACL support found)
1c3344a1
WD
958 fi
959 fi
960 ;;
961 esac
962fi
963
16edf865
WD
964#################################################
965# check for extended attribute support
966AC_MSG_CHECKING(whether to support extended attributes)
967AC_ARG_ENABLE(xattr-support,
e8c64ffd
WD
968 AC_HELP_STRING([--disable-xattr-support],
969 [disable extended attributes]),
6b5a8f80
WD
970 [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
971 *yes*) enable_xattr_support=maybe ;;
972 *) enable_xattr_support=no ;;
973 esac])
e8c64ffd
WD
974AH_TEMPLATE([SUPPORT_XATTRS],
975[Define to 1 to add support for extended attributes])
16edf865
WD
976if test x"$enable_xattr_support" = x"no"; then
977 AC_MSG_RESULT(no)
978else
979 case "$host_os" in
980 *linux*)
981 AC_MSG_RESULT(Using Linux xattrs)
982 AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
e8c64ffd 983 AC_DEFINE(SUPPORT_XATTRS, 1)
16edf865
WD
984 ;;
985 darwin*)
986 AC_MSG_RESULT(Using OS X xattrs)
987 AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
988 AC_DEFINE(SUPPORT_XATTRS, 1)
989 ;;
990 freebsd*)
991 AC_MSG_RESULT(Using FreeBSD extattrs)
992 AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
993 AC_DEFINE(SUPPORT_XATTRS, 1)
994 ;;
05a652d0
WD
995 solaris*)
996 AC_MSG_RESULT(Using Solaris xattrs)
997 AC_DEFINE(HAVE_SOLARIS_XATTRS, 1, [True if you have Solaris xattrs])
998 AC_DEFINE(SUPPORT_XATTRS, 1)
999 AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks don't support xattrs])
1000 ;;
16edf865
WD
1001 *)
1002 if test x"$enable_xattr_support" = x"yes"; then
1003 AC_MSG_ERROR(Failed to find extended attribute support)
1004 else
1005 AC_MSG_RESULT(No extended attribute support found)
1006 fi
1007 ;;
1008 esac
1009fi
1010
f4901024
WD
1011if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
1012 AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
1013 OLD_CFLAGS="$CFLAGS"
1014 CFLAGS="$CFLAGS -Wno-unused-parameter"
fc4bb123 1015 AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
f4901024
WD
1016 AC_MSG_RESULT([$rsync_warn_flag])
1017 if test x"$rsync_warn_flag" = x"no"; then
1018 CFLAGS="$OLD_CFLAGS"
1019 fi
1020fi
1021
aa0e6b99 1022case "$CC" in
d4c5cb2b 1023' checker'*|checker*)
aa0e6b99
WD
1024 AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
1025 ;;
1026esac
1027
bf5c2bf6
MP
1028AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
1029AC_OUTPUT
a4677968
MP
1030
1031AC_MSG_RESULT()
1032AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
1033AC_MSG_RESULT()