Applying the preallocate patch.
[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 \
28b519c9 594 initgroups utimensat posix_fallocate)
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
28b519c9
WD
601dnl Preallocation stuff (also fallocate, posix_fallocate function tests above):
602
603AC_CACHE_CHECK([for useable fallocate],rsync_cv_have_fallocate,[
604AC_TRY_LINK([#include <fcntl.h>
605#include <sys/types.h>],
606[fallocate(0, 0, 0, 0);],
607rsync_cv_have_fallocate=yes,rsync_cv_have_fallocate=no)])
608if test x"$rsync_cv_have_fallocate" = x"yes"; then
609 AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the fallocate function and it compiles and links without error])
610fi
611
612AC_CACHE_CHECK([for SYS_fallocate],rsync_cv_have_sys_fallocate,[
613AC_TRY_COMPILE([#include <sys/syscall.h>
614#include <sys/types.h>],
615[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);],
616rsync_cv_have_sys_fallocate=yes,rsync_cv_have_sys_fallocate=no)])
617if test x"$rsync_cv_have_sys_fallocate" = x"yes"; then
618 AC_DEFINE(HAVE_SYS_FALLOCATE, 1, [Define to 1 if you have the SYS_fallocate syscall number])
619fi
620
621if test x"$ac_cv_func_posix_fallocate" = x"yes"; then
622 AC_MSG_CHECKING([whether posix_fallocate is efficient])
623 case $host_os in
624 *cygwin*)
625 AC_MSG_RESULT(yes)
626 AC_DEFINE(HAVE_EFFICIENT_POSIX_FALLOCATE, 1,
627 [Define if posix_fallocate is efficient (Cygwin)])
628 ;;
629 *)
630 AC_MSG_RESULT(no)
631 ;;
632 esac
633fi
634
635dnl End of preallocation stuff
636
21524e30
WD
637AC_CHECK_FUNCS(getpgrp tcgetpgrp)
638if test $ac_cv_func_getpgrp = yes; then
639 AC_FUNC_GETPGRP
640fi
641
49c24071
WD
642AC_ARG_ENABLE(iconv-open,
643 AC_HELP_STRING([--disable-iconv-open],
644 [disable all use of iconv_open() function]),
645 [], [enable_iconv_open=$ac_cv_func_iconv_open])
646
647if test x"$enable_iconv_open" != x"no"; then
648 AC_DEFINE(USE_ICONV_OPEN, 1, [Define to 1 if you want rsync to make use of iconv_open()])
649fi
650
332cf6df
WD
651AC_ARG_ENABLE(iconv,
652 AC_HELP_STRING([--disable-iconv],
653 [disable rsync's --iconv option]),
49c24071 654 [], [enable_iconv=$enable_iconv_open])
332cf6df
WD
655AH_TEMPLATE([ICONV_OPTION],
656[Define if you want the --iconv option. Specifing a value will set the
657default iconv setting (a NULL means no --iconv processing by default).])
658if test x"$enable_iconv" != x"no"; then
659 if test x"$enable_iconv" = x"yes"; then
660 AC_DEFINE(ICONV_OPTION, NULL)
661 else
662 AC_DEFINE_UNQUOTED(ICONV_OPTION, "$enable_iconv")
663 fi
664 AC_DEFINE(UTF8_CHARSET, "UTF-8", [String to pass to iconv() for the UTF-8 charset.])
665fi
666
0037bf23 667AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
21524e30
WD
668 AC_TRY_RUN([
669#if HAVE_UNISTD_H
670# include <unistd.h>
671#endif
672#include <stdlib.h>
673#include <errno.h>
674 main() {
675 char const *dangling_symlink = "conftest.dangle";
676 unlink(dangling_symlink);
677 if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
0037bf23
WD
678 if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
679 exit(0);
21524e30 680 }],
0037bf23
WD
681 rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
682if test $rsync_cv_chown_modifies_symlink = yes; then
0d2aa5d9 683 AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
21524e30
WD
684fi
685
0037bf23
WD
686AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
687 AC_TRY_RUN([
688#if HAVE_UNISTD_H
689# include <unistd.h>
690#endif
691#include <stdlib.h>
692#include <errno.h>
693#define FILENAME "conftest.dangle"
694 main() {
695 unlink(FILENAME);
696 if (symlink("conftest.no-such", FILENAME) < 0) abort();
697 if (link(FILENAME, FILENAME "2") < 0) exit(1);
698 exit(0);
699 }],
700 rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
701if test $rsync_cv_can_hardlink_symlink = yes; then
702 AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
703fi
704
705AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
706 AC_TRY_RUN([
707#if HAVE_UNISTD_H
708# include <unistd.h>
709#endif
710#include <stdlib.h>
711#include <errno.h>
712#define FILENAME "conftest.fifi"
713 main() {
714 unlink(FILENAME);
715 if (mkfifo(FILENAME, 0777) < 0) abort();
716 if (link(FILENAME, FILENAME "2") < 0) exit(1);
717 exit(0);
718 }],
719 rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
720if test $rsync_cv_can_hardlink_special = yes; then
721 AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
722fi
723
24c857f1 724AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
6a5ef41f
MP
725AC_TRY_RUN([
726#include <sys/types.h>
727#include <sys/socket.h>
728
729main() {
730 int fd[2];
731 exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
732}],
24c857f1
DD
733rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
734if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
0d2aa5d9 735 AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
24c857f1 736fi
c627d613 737
79f48760 738if test x"$with_included_popt" != x"yes"; then
1ac15cd8
MP
739 AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
740fi
8afaef42
WD
741if test x"$ac_cv_header_popt_popt_h" = x"yes"; then
742 # If the system has /usr/include/popt/popt.h, we enable the
743 # included popt because an attempt to "#include <popt/popt.h>"
744 # would use our included header file anyway (due to -I.), and
d7b6774d 745 # might conflict with the system popt.
8afaef42 746 with_included_popt=yes
6de417d9
WD
747elif test x"$ac_cv_header_popt_h" != x"yes"; then
748 with_included_popt=yes
8afaef42 749fi
2d1ebe9c 750
12458878 751AC_MSG_CHECKING([whether to use included libpopt])
79f48760 752if test x"$with_included_popt" = x"yes"; then
12458878 753 AC_MSG_RESULT($srcdir/popt)
1ac15cd8 754 BUILD_POPT='$(popt_OBJS)'
26ef00bd 755 CFLAGS="$CFLAGS -I$srcdir/popt"
5216de37 756 if test x"$ALLOCA" != x
7fc08908 757 then
5216de37
DD
758 # this can be removed when/if we add an included alloca.c;
759 # see autoconf documentation on AC_FUNC_ALLOCA
8af534a5 760 AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)])
7fc08908 761 fi
2d1ebe9c
MP
762else
763 AC_MSG_RESULT(no)
79fc6bdb 764fi
c627d613 765
0d2aa5d9
WD
766AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
767AC_TRY_COMPILE([],[signed char *s = ""],
768rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
769if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
770 AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
7597e1a9 771fi
bcacc18b 772
7b3d4257 773AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
59503278
AT
774AC_TRY_RUN([#include <sys/types.h>
775#include <dirent.h>
776main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
777if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
7597e1a9 778di->d_name[0] == 0) exit(0); exit(1);} ],
7b3d4257
AT
779rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
780if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
0d2aa5d9 781 AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
7597e1a9 782fi
1e9f155a 783
4021aa45 784AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
d6e6ecbd
AT
785AC_TRY_COMPILE([#include <sys/types.h>
786#include <utime.h>],
7597e1a9 787[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
4021aa45
WD
788rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
789if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
790 AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
7597e1a9 791fi
d6e6ecbd 792
3060d4aa 793AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
0d2aa5d9
WD
794AC_TRY_COMPILE([#include <sys/time.h>
795#include <unistd.h>],
796[struct timeval tv; exit(gettimeofday(&tv, NULL));],
797rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
a20a88d2 798if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
0d2aa5d9 799 AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
3060d4aa
AT
800fi
801
8950ac03
AT
802AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
803AC_TRY_RUN([
804#include <sys/types.h>
805#include <stdarg.h>
2ef2e822 806void foo(const char *format, ...) {
8950ac03
AT
807 va_list ap;
808 int len;
809 char buf[5];
810
811 va_start(ap, format);
812 len = vsnprintf(0, 0, format, ap);
813 va_end(ap);
814 if (len != 5) exit(1);
815
816 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
817
818 exit(0);
819}
820main() { foo("hello"); }
821],
822rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
823if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
0d2aa5d9 824 AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
8950ac03
AT
825fi
826
827
f62c17e3
AT
828AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
829AC_TRY_RUN([#include <stdlib.h>
830#include <sys/types.h>
831#include <sys/stat.h>
832#include <unistd.h>
2ef2e822 833main() {
f62c17e3 834 struct stat st;
2ef2e822
WD
835 char tpl[20]="/tmp/test.XXXXXX";
836 int fd = mkstemp(tpl);
f62c17e3
AT
837 if (fd == -1) exit(1);
838 unlink(tpl);
839 if (fstat(fd, &st) != 0) exit(1);
840 if ((st.st_mode & 0777) != 0600) exit(1);
841 exit(0);
842}],
843rsync_cv_HAVE_SECURE_MKSTEMP=yes,
844rsync_cv_HAVE_SECURE_MKSTEMP=no,
845rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
846if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
83238ed0 847 case $host_os in
5f2c5bf1
WD
848 hpux*)
849 dnl HP-UX has a broken mkstemp() implementation they refuse to fix,
850 dnl so we noisily skip using it. See HP change request JAGaf34426
851 dnl for details. (sbonds)
852 AC_MSG_WARN(Skipping broken HP-UX mkstemp() -- using mktemp() instead)
853 ;;
854 *)
855 AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [Define to 1 if mkstemp() is available and works right])
856 ;;
857 esac
f62c17e3
AT
858fi
859
3060d4aa 860
e49d7200
WD
861AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
862AC_TRY_RUN([
863#include <stdio.h>
864#include <sys/stat.h>
865#include <errno.h>
866main() { int rc, ec; char *fn = "fifo-test";
867unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
12a01be1 868if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
869return 0;}],
870 rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
871if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
872 AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
873fi
874
875AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
876AC_TRY_RUN([
877#include <stdio.h>
878#include <sys/stat.h>
879#include <errno.h>
880main() { int rc, ec; char *fn = "sock-test";
881unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
12a01be1 882if (rc) {printf("(%d %d) ",rc,ec); return ec;}
e49d7200
WD
883return 0;}],
884 rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
885if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
886 AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
887fi
888
692da0b5
DD
889#
890# The following test was mostly taken from the tcl/tk plus patches
891#
79fc6bdb 892AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[
692da0b5
DD
893rm -rf conftest*
894cat > conftest.$ac_ext <<EOF
895int main() { return 0; }
896EOF
897${CC-cc} -c -o conftest..o conftest.$ac_ext
898if test -f conftest..o; then
79fc6bdb
DD
899 rsync_cv_DASHC_WORKS_WITH_DASHO=yes
900else
901 rsync_cv_DASHC_WORKS_WITH_DASHO=no
902fi
903rm -rf conftest*
904])
905if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then
692da0b5
DD
906 OBJ_SAVE="#"
907 OBJ_RESTORE="#"
908 CC_SHOBJ_FLAG='-o $@'
692da0b5
DD
909else
910 OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;'
911 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'
912 CC_SHOBJ_FLAG=""
692da0b5 913fi
79fc6bdb 914
692da0b5
DD
915AC_SUBST(OBJ_SAVE)
916AC_SUBST(OBJ_RESTORE)
917AC_SUBST(CC_SHOBJ_FLAG)
1ac15cd8 918AC_SUBST(BUILD_POPT)
225787a4 919AC_SUBST(MAKE_MAN)
7d29d4ba 920
1c3344a1
WD
921AC_CHECK_FUNCS(_acl __acl _facl __facl)
922#################################################
923# check for ACL support
924
925AC_MSG_CHECKING([whether to support ACLs])
926AC_ARG_ENABLE(acl-support,
927 AC_HELP_STRING([--disable-acl-support],
e8c64ffd 928 [disable ACL support]))
1c3344a1
WD
929
930if test x"$enable_acl_support" = x"no"; then
931 AC_MSG_RESULT(no)
932else
1c3344a1
WD
933 case "$host_os" in
934 *sysv5*)
935 AC_MSG_RESULT(Using UnixWare ACLs)
936 AC_DEFINE(HAVE_UNIXWARE_ACLS, 1, [true if you have UnixWare ACLs])
545584cb 937 AC_DEFINE(SUPPORT_ACLS, 1, [Define to 1 to add support for ACLs])
1c3344a1
WD
938 ;;
939 *solaris*|*cygwin*)
940 AC_MSG_RESULT(Using solaris ACLs)
941 AC_DEFINE(HAVE_SOLARIS_ACLS, 1, [true if you have solaris ACLs])
987838fd 942 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
943 ;;
944 *hpux*)
945 AC_MSG_RESULT(Using HPUX ACLs)
946 AC_DEFINE(HAVE_HPUX_ACLS, 1, [true if you have HPUX ACLs])
987838fd 947 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
948 ;;
949 *irix*)
950 AC_MSG_RESULT(Using IRIX ACLs)
951 AC_DEFINE(HAVE_IRIX_ACLS, 1, [true if you have IRIX ACLs])
987838fd 952 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
953 ;;
954 *aix*)
955 AC_MSG_RESULT(Using AIX ACLs)
956 AC_DEFINE(HAVE_AIX_ACLS, 1, [true if you have AIX ACLs])
987838fd 957 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
958 ;;
959 *osf*)
960 AC_MSG_RESULT(Using Tru64 ACLs)
961 AC_DEFINE(HAVE_TRU64_ACLS, 1, [true if you have Tru64 ACLs])
987838fd 962 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
963 LIBS="$LIBS -lpacl"
964 ;;
16edf865 965 darwin*)
49ea69b3
WD
966 AC_MSG_RESULT(Using OS X ACLs)
967 AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
968 AC_DEFINE(SUPPORT_ACLS, 1)
88467ec4 969 ;;
1c3344a1
WD
970 *)
971 AC_MSG_RESULT(running tests:)
972 AC_CHECK_LIB(acl,acl_get_file)
973 AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
974 AC_TRY_LINK([#include <sys/types.h>
975#include <sys/acl.h>],
976[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
977samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
978 AC_MSG_CHECKING(ACL test results)
979 if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
980 AC_MSG_RESULT(Using posix ACLs)
981 AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
987838fd 982 AC_DEFINE(SUPPORT_ACLS, 1)
1c3344a1
WD
983 AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
984 AC_TRY_LINK([#include <sys/types.h>
985#include <sys/acl.h>],
986[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
987samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
988 if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
989 AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
990 fi
991 else
987838fd
WD
992 if test x"$enable_acl_support" = x"yes"; then
993 AC_MSG_ERROR(Failed to find ACL support)
994 else
995 AC_MSG_RESULT(No ACL support found)
1c3344a1
WD
996 fi
997 fi
998 ;;
999 esac
1000fi
1001
16edf865
WD
1002#################################################
1003# check for extended attribute support
1004AC_MSG_CHECKING(whether to support extended attributes)
1005AC_ARG_ENABLE(xattr-support,
e8c64ffd
WD
1006 AC_HELP_STRING([--disable-xattr-support],
1007 [disable extended attributes]),
6b5a8f80
WD
1008 [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
1009 *yes*) enable_xattr_support=maybe ;;
1010 *) enable_xattr_support=no ;;
1011 esac])
e8c64ffd
WD
1012AH_TEMPLATE([SUPPORT_XATTRS],
1013[Define to 1 to add support for extended attributes])
16edf865
WD
1014if test x"$enable_xattr_support" = x"no"; then
1015 AC_MSG_RESULT(no)
1016else
1017 case "$host_os" in
1018 *linux*)
1019 AC_MSG_RESULT(Using Linux xattrs)
1020 AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
e8c64ffd 1021 AC_DEFINE(SUPPORT_XATTRS, 1)
3f770ab0 1022 AC_DEFINE(NO_SYMLINK_XATTRS, 1, [True if symlinks do not support xattrs])
16edf865
WD
1023 ;;
1024 darwin*)
1025 AC_MSG_RESULT(Using OS X xattrs)
1026 AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
1027 AC_DEFINE(SUPPORT_XATTRS, 1)
6500e076
WD
1028 AC_DEFINE(NO_DEVICE_XATTRS, 1, [True if device files do not support xattrs])
1029 AC_DEFINE(NO_SPECIAL_XATTRS, 1, [True if special files do not support xattrs])
16edf865
WD
1030 ;;
1031 freebsd*)
1032 AC_MSG_RESULT(Using FreeBSD extattrs)
1033 AC_DEFINE(HAVE_FREEBSD_XATTRS, 1, [True if you have FreeBSD xattrs])
1034 AC_DEFINE(SUPPORT_XATTRS, 1)
1035 ;;
05a652d0
WD
1036 solaris*)
1037 AC_MSG_RESULT(Using Solaris xattrs)
1038 AC_DEFINE(HAVE_SOLARIS_XATTRS, 1, [True if you have Solaris xattrs])
1039 AC_DEFINE(SUPPORT_XATTRS, 1)
3f770ab0 1040 AC_DEFINE(NO_SYMLINK_XATTRS, 1)
05a652d0 1041 ;;
16edf865
WD
1042 *)
1043 if test x"$enable_xattr_support" = x"yes"; then
1044 AC_MSG_ERROR(Failed to find extended attribute support)
1045 else
1046 AC_MSG_RESULT(No extended attribute support found)
1047 fi
1048 ;;
1049 esac
1050fi
1051
f4901024
WD
1052if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"$enable_iconv" = x"no"; then
1053 AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
1054 OLD_CFLAGS="$CFLAGS"
1055 CFLAGS="$CFLAGS -Wno-unused-parameter"
fc4bb123 1056 AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
f4901024
WD
1057 AC_MSG_RESULT([$rsync_warn_flag])
1058 if test x"$rsync_warn_flag" = x"no"; then
1059 CFLAGS="$OLD_CFLAGS"
1060 fi
1061fi
1062
aa0e6b99 1063case "$CC" in
d4c5cb2b 1064' checker'*|checker*)
aa0e6b99
WD
1065 AC_DEFINE(FORCE_FD_ZERO_MEMSET, 1, [Used to make "checker" understand that FD_ZERO() clears memory.])
1066 ;;
1067esac
1068
bf5c2bf6
MP
1069AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
1070AC_OUTPUT
a4677968
MP
1071
1072AC_MSG_RESULT()
1073AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful])
1074AC_MSG_RESULT()