Commit | Line | Data |
---|---|---|
c627d613 | 1 | dnl Process this file with autoconf to produce a configure script. |
06963d0f | 2 | |
bf5c2bf6 MP |
3 | AC_INIT() |
4 | AC_CONFIG_SRCDIR([byteorder.h]) | |
c627d613 | 5 | AC_CONFIG_HEADER(config.h) |
e32db5c9 | 6 | AC_PREREQ(2.59) |
c627d613 | 7 | |
93f3fbf7 | 8 | RSYNC_VERSION=3.1.0dev |
68b2cc55 MP |
9 | AC_SUBST(RSYNC_VERSION) |
10 | AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION]) | |
11 | ||
12 | AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version]) | |
13 | ||
6a48ca56 | 14 | LDFLAGS=${LDFLAGS-""} |
50abd20b | 15 | |
83238ed0 | 16 | AC_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 | 23 | AC_MSG_CHECKING([whether to include debugging symbols]) |
2d1ebe9c | 24 | AC_ARG_ENABLE(debug, |
79f48760 | 25 | AC_HELP_STRING([--disable-debug], |
e8c64ffd | 26 | [disable debugging symbols and features])) |
2d1ebe9c | 27 | |
79f48760 | 28 | if test x"$enable_debug" = x"no"; then |
2d1ebe9c | 29 | AC_MSG_RESULT(no) |
44ae5411 | 30 | ac_cv_prog_cc_g=no |
bf5c2bf6 MP |
31 | else |
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 |
35 | fi |
36 | ||
44ae5411 WD |
37 | dnl Checks for programs. |
38 | AC_PROG_CC | |
39 | AC_PROG_CPP | |
40 | AC_PROG_EGREP | |
41 | AC_PROG_INSTALL | |
42 | AC_PROG_CC_STDC | |
43 | AC_SUBST(SHELL) | |
44 | ||
45 | AC_DEFINE([_GNU_SOURCE], 1, | |
46 | [Define _GNU_SOURCE so that we get all necessary prototypes]) | |
47 | ||
48 | if 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]) | |
50 | fi | |
da7b6397 | 51 | |
da7b6397 | 52 | AC_ARG_ENABLE(profile, |
c83a2c8e | 53 | AC_HELP_STRING([--enable-profile], |
79f48760 WD |
54 | [turn on CPU profiling])) |
55 | if test x"$enable_profile" = x"yes"; then | |
da7b6397 MP |
56 | CFLAGS="$CFLAGS -pg" |
57 | fi | |
58 | ||
59 | ||
c0531332 MP |
60 | # Specifically, this turns on panic_action handling. |
61 | AC_ARG_ENABLE(maintainer-mode, | |
c83a2c8e | 62 | AC_HELP_STRING([--enable-maintainer-mode], |
79f48760 WD |
63 | [turn on extra debug features])) |
64 | if test x"$enable_maintainer_mode" = x"yes"; then | |
c0531332 MP |
65 | CFLAGS="$CFLAGS -DMAINTAINER_MODE" |
66 | fi | |
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 |
71 | CFLAGS="$CFLAGS -DHAVE_CONFIG_H" |
72 | ||
47759343 | 73 | # If GCC, turn on warnings. |
79f48760 | 74 | if test x"$GCC" = x"yes"; then |
99f106d1 | 75 | CFLAGS="$CFLAGS -Wall -W" |
47759343 MP |
76 | fi |
77 | ||
2d1ebe9c | 78 | AC_ARG_WITH(included-popt, |
d64c2b22 | 79 | AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system])) |
2d1ebe9c | 80 | |
4c4a2962 WD |
81 | AC_ARG_WITH(protected-args, |
82 | AC_HELP_STRING([--with-protected-args], [make --protected-args option the default])) | |
83 | if 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]) | |
85 | fi | |
86 | ||
41bd28fe | 87 | AC_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 | |
92 | AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine]) | |
93 | ||
cd3fe9fb WD |
94 | AC_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 | ||
113 | AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server]) | |
114 | ||
81c652d5 | 115 | AC_ARG_WITH(rsh, |
f40f2fc8 | 116 | AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)])) |
41bd28fe | 117 | |
7b8356d0 | 118 | AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0) |
89ec535a WD |
119 | if test x$HAVE_REMSH = x1; then |
120 | AC_DEFINE(HAVE_REMSH, 1, [Define to 1 if remote shell is remsh, not rsh]) | |
121 | fi | |
81c652d5 | 122 | |
79f48760 | 123 | if test x"$with_rsh" != x; then |
81c652d5 | 124 | RSYNC_RSH="$with_rsh" |
81c652d5 | 125 | else |
f40f2fc8 | 126 | RSYNC_RSH="ssh" |
81c652d5 | 127 | fi |
81c652d5 | 128 | AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command]) |
f0af1e5e | 129 | |
225787a4 WD |
130 | AC_CHECK_PROG(HAVE_YODL2MAN, yodl2man, 1, 0) |
131 | if test x$HAVE_YODL2MAN = x1; then | |
132 | MAKE_MAN=man | |
133 | fi | |
134 | ||
cc1b4f77 WD |
135 | AC_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 | ||
140 | if 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 | 150 | fi |
cc1b4f77 | 151 | |
58418cb0 WD |
152 | AC_DEFINE_UNQUOTED(NOBODY_USER, "nobody", [unprivileged user--e.g. nobody]) |
153 | AC_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 |
157 | AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[ | |
158 | AC_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 | 165 | int 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 | ], | |
191 | rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)]) | |
192 | if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then | |
193 | AC_SYS_LARGEFILE | |
194 | fi | |
195 | ||
06963d0f MP |
196 | ipv6type=unknown |
197 | ipv6lib=none | |
22cd0063 | 198 | ipv6trylibc=yes |
06963d0f | 199 | |
2ef2e822 | 200 | AC_ARG_ENABLE(ipv6, |
79f48760 WD |
201 | AC_HELP_STRING([--disable-ipv6], |
202 | [don't even try to use IPv6])) | |
203 | if 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 | |
212 | yes | |
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__ | |
223 | yes | |
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 | |
233 | yes | |
234 | #endif], | |
235 | [ipv6type=$i; | |
a358449a | 236 | AC_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 | |
254 | yes | |
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 | |
263 | yes | |
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__ | |
274 | yes | |
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 | |
285 | yes | |
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 | |
296 | yes | |
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) |
309 | fi | |
06963d0f | 310 | |
79f48760 WD |
311 | dnl Do you want to disable use of locale functions |
312 | AC_ARG_ENABLE([locale], | |
313 | AC_HELP_STRING([--disable-locale], | |
e8c64ffd | 314 | [disable locale features])) |
79f48760 WD |
315 | AH_TEMPLATE([CONFIG_LOCALE], |
316 | [Undefine if you don't want locale features. By default this is defined.]) | |
317 | if test x"$enable_locale" != x"no"; then | |
318 | AC_DEFINE(CONFIG_LOCALE) | |
319 | fi | |
320 | ||
9f639210 DD |
321 | AC_MSG_CHECKING([whether to call shutdown on all sockets]) |
322 | case $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);; | |
328 | esac | |
329 | ||
cd957c70 | 330 | AC_C_BIGENDIAN |
c627d613 | 331 | AC_HEADER_DIRENT |
c627d613 AT |
332 | AC_HEADER_TIME |
333 | AC_HEADER_SYS_WAIT | |
1cb6f3bf WD |
334 | AC_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 | 341 | AC_HEADER_MAJOR |
c627d613 | 342 | |
e8d97006 WD |
343 | AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[ |
344 | AC_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 | ||
355 | int 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 | ], | |
363 | rsync_cv_MAKEDEV_TAKES_3_ARGS=yes,rsync_cv_MAKEDEV_TAKES_3_ARGS=no,rsync_cv_MAKEDEV_TAKES_3_ARGS=no)]) | |
364 | if 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]) | |
366 | fi | |
367 | ||
c627d613 AT |
368 | AC_CHECK_SIZEOF(int) |
369 | AC_CHECK_SIZEOF(long) | |
e32db5c9 | 370 | AC_CHECK_SIZEOF(long long) |
c627d613 | 371 | AC_CHECK_SIZEOF(short) |
edb4ba5f WD |
372 | AC_CHECK_SIZEOF(int16_t) |
373 | AC_CHECK_SIZEOF(uint16_t) | |
374 | AC_CHECK_SIZEOF(int32_t) | |
375 | AC_CHECK_SIZEOF(uint32_t) | |
376 | AC_CHECK_SIZEOF(int64_t) | |
e32db5c9 WD |
377 | AC_CHECK_SIZEOF(off_t) |
378 | AC_CHECK_SIZEOF(off64_t) | |
f3c93b17 | 379 | AC_CHECK_SIZEOF(time_t) |
c627d613 AT |
380 | |
381 | AC_C_INLINE | |
a6c15e9a | 382 | AC_C_LONG_DOUBLE |
c627d613 AT |
383 | |
384 | AC_TYPE_SIGNAL | |
385 | AC_TYPE_UID_T | |
a1f7c8e2 | 386 | AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t]) |
9422bb3f | 387 | AC_TYPE_GETGROUPS |
1a2e41af WD |
388 | AC_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 | 401 | TYPE_SOCKLEN_T |
c627d613 | 402 | |
7b3d4257 | 403 | AC_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)]) |
406 | if 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 | 408 | fi |
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. | |
418 | AC_CHECK_FUNCS(connect) | |
419 | if 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 |
444 | fi | |
445 | ||
10a1d6b4 | 446 | AC_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! | |
450 | AC_SEARCH_LIBS(libiconv_open, iconv) | |
8f694072 | 451 | |
f9b66bc4 WD |
452 | AC_MSG_CHECKING([for iconv declaration]) |
453 | AC_CACHE_VAL(am_cv_proto_iconv, [ | |
454 | AC_TRY_COMPILE([ | |
3ebdd3c7 WD |
455 | #include <stdlib.h> |
456 | #include <iconv.h> | |
457 | extern | |
458 | #ifdef __cplusplus | |
459 | "C" | |
460 | #endif | |
461 | #if defined(__STDC__) || defined(__cplusplus) | |
462 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | |
463 | #else | |
464 | size_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 | 469 | AC_MSG_RESULT([$]{ac_t:- |
3ebdd3c7 | 470 | }[$]am_cv_proto_iconv) |
f9b66bc4 WD |
471 | AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, |
472 | [Define as const if the declaration of iconv() needs const.]) | |
3ebdd3c7 | 473 | |
99f106d1 | 474 | dnl AC_MSG_NOTICE([Looking in libraries: $LIBS]) |
e94989fe | 475 | |
2ef2e822 WD |
476 | AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)]) |
477 | AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)]) | |
356bbb83 | 478 | |
4021aa45 | 479 | AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>]) |
2213961e WD |
480 | AC_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 |
485 | AC_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 | 496 | if 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 | 510 | else |
d2cc0323 | 511 | AC_LIBOBJ(lib/getaddrinfo) |
184dede9 | 512 | fi |
824f1c79 | 513 | |
2ef2e822 | 514 | AC_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 |
522 | AC_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 |
531 | AC_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 | 540 | AC_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 | 549 | AC_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 | # | |
568 | AC_CHECK_FUNCS(strcasecmp) | |
569 | if test x"$ac_cv_func_strcasecmp" = x"no"; then | |
570 | AC_CHECK_LIB(resolv, strcasecmp) | |
571 | fi | |
572 | ||
1c3344a1 WD |
573 | AC_CHECK_FUNCS(aclsort) |
574 | if test x"$ac_cv_func_aclsort" = x"no"; then | |
575 | AC_CHECK_LIB(sec, aclsort) | |
576 | fi | |
577 | ||
87fcb639 MP |
578 | dnl At the moment we don't test for a broken memcmp(), because all we |
579 | dnl need to do is test for equality, not comparison, and it seems that | |
2ef2e822 | 580 | dnl every platform has a memcmp that can do at least that. |
87fcb639 MP |
581 | dnl AC_FUNC_MEMCMP |
582 | ||
c627d613 | 583 | AC_FUNC_UTIME_NULL |
7fc08908 | 584 | AC_FUNC_ALLOCA |
8ce65463 WD |
585 | AC_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 |
594 | dnl cygwin iconv.h defines iconv_open as libiconv_open |
595 | if 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)]) | |
597 | fi | |
598 | ||
21524e30 WD |
599 | AC_CHECK_FUNCS(getpgrp tcgetpgrp) |
600 | if test $ac_cv_func_getpgrp = yes; then | |
601 | AC_FUNC_GETPGRP | |
602 | fi | |
603 | ||
49c24071 WD |
604 | AC_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 | ||
609 | if 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()]) | |
611 | fi | |
612 | ||
332cf6df WD |
613 | AC_ARG_ENABLE(iconv, |
614 | AC_HELP_STRING([--disable-iconv], | |
615 | [disable rsync's --iconv option]), | |
49c24071 | 616 | [], [enable_iconv=$enable_iconv_open]) |
332cf6df WD |
617 | AH_TEMPLATE([ICONV_OPTION], |
618 | [Define if you want the --iconv option. Specifing a value will set the | |
619 | default iconv setting (a NULL means no --iconv processing by default).]) | |
620 | if 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.]) | |
627 | fi | |
628 | ||
0037bf23 | 629 | AC_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)]) |
644 | if 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 |
646 | fi |
647 | ||
0037bf23 WD |
648 | AC_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)]) | |
663 | if test $rsync_cv_can_hardlink_symlink = yes; then | |
664 | AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.]) | |
665 | fi | |
666 | ||
667 | AC_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)]) | |
682 | if 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.]) | |
684 | fi | |
685 | ||
24c857f1 | 686 | AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ |
6a5ef41f MP |
687 | AC_TRY_RUN([ |
688 | #include <sys/types.h> | |
689 | #include <sys/socket.h> | |
690 | ||
691 | main() { | |
692 | int fd[2]; | |
693 | exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); | |
694 | }], | |
24c857f1 DD |
695 | rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) |
696 | if 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 | 698 | fi |
c627d613 | 699 | |
79f48760 | 700 | if test x"$with_included_popt" != x"yes"; then |
1ac15cd8 MP |
701 | AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) |
702 | fi | |
8afaef42 WD |
703 | if 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 |
709 | elif test x"$ac_cv_header_popt_h" != x"yes"; then |
710 | with_included_popt=yes | |
8afaef42 | 711 | fi |
2d1ebe9c | 712 | |
12458878 | 713 | AC_MSG_CHECKING([whether to use included libpopt]) |
79f48760 | 714 | if 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 |
724 | else |
725 | AC_MSG_RESULT(no) | |
79fc6bdb | 726 | fi |
c627d613 | 727 | |
0d2aa5d9 WD |
728 | AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[ |
729 | AC_TRY_COMPILE([],[signed char *s = ""], | |
730 | rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)]) | |
731 | if 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 | 733 | fi |
bcacc18b | 734 | |
7b3d4257 | 735 | AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ |
59503278 AT |
736 | AC_TRY_RUN([#include <sys/types.h> |
737 | #include <dirent.h> | |
738 | main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); | |
739 | if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && | |
7597e1a9 | 740 | di->d_name[0] == 0) exit(0); exit(1);} ], |
7b3d4257 AT |
741 | rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) |
742 | if 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 | 744 | fi |
1e9f155a | 745 | |
4021aa45 | 746 | AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[ |
d6e6ecbd AT |
747 | AC_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 |
750 | rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)]) |
751 | if 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 | 753 | fi |
d6e6ecbd | 754 | |
3060d4aa | 755 | AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ |
0d2aa5d9 WD |
756 | AC_TRY_COMPILE([#include <sys/time.h> |
757 | #include <unistd.h>], | |
758 | [struct timeval tv; exit(gettimeofday(&tv, NULL));], | |
759 | rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)]) | |
a20a88d2 | 760 | if 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 |
762 | fi |
763 | ||
8950ac03 AT |
764 | AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |
765 | AC_TRY_RUN([ | |
766 | #include <sys/types.h> | |
767 | #include <stdarg.h> | |
2ef2e822 | 768 | void 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 | } | |
782 | main() { foo("hello"); } | |
783 | ], | |
784 | rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) | |
785 | if 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 |
787 | fi |
788 | ||
789 | ||
f62c17e3 AT |
790 | AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ |
791 | AC_TRY_RUN([#include <stdlib.h> | |
792 | #include <sys/types.h> | |
793 | #include <sys/stat.h> | |
794 | #include <unistd.h> | |
2ef2e822 | 795 | main() { |
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 | }], | |
805 | rsync_cv_HAVE_SECURE_MKSTEMP=yes, | |
806 | rsync_cv_HAVE_SECURE_MKSTEMP=no, | |
807 | rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) | |
808 | if 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 |
820 | fi |
821 | ||
3060d4aa | 822 | |
e49d7200 WD |
823 | AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[ |
824 | AC_TRY_RUN([ | |
825 | #include <stdio.h> | |
826 | #include <sys/stat.h> | |
827 | #include <errno.h> | |
828 | main() { int rc, ec; char *fn = "fifo-test"; | |
829 | unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn); | |
12a01be1 | 830 | if (rc) {printf("(%d %d) ",rc,ec); return ec;} |
e49d7200 WD |
831 | return 0;}], |
832 | rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)]) | |
833 | if 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.]) | |
835 | fi | |
836 | ||
837 | AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[ | |
838 | AC_TRY_RUN([ | |
839 | #include <stdio.h> | |
840 | #include <sys/stat.h> | |
841 | #include <errno.h> | |
842 | main() { int rc, ec; char *fn = "sock-test"; | |
843 | unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn); | |
12a01be1 | 844 | if (rc) {printf("(%d %d) ",rc,ec); return ec;} |
e49d7200 WD |
845 | return 0;}], |
846 | rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)]) | |
847 | if 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.]) | |
849 | fi | |
850 | ||
692da0b5 DD |
851 | # |
852 | # The following test was mostly taken from the tcl/tk plus patches | |
853 | # | |
79fc6bdb | 854 | AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[ |
692da0b5 DD |
855 | rm -rf conftest* |
856 | cat > conftest.$ac_ext <<EOF | |
857 | int main() { return 0; } | |
858 | EOF | |
859 | ${CC-cc} -c -o conftest..o conftest.$ac_ext | |
860 | if test -f conftest..o; then | |
79fc6bdb DD |
861 | rsync_cv_DASHC_WORKS_WITH_DASHO=yes |
862 | else | |
863 | rsync_cv_DASHC_WORKS_WITH_DASHO=no | |
864 | fi | |
865 | rm -rf conftest* | |
866 | ]) | |
867 | if 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 |
871 | else |
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 | 875 | fi |
79fc6bdb | 876 | |
692da0b5 DD |
877 | AC_SUBST(OBJ_SAVE) |
878 | AC_SUBST(OBJ_RESTORE) | |
879 | AC_SUBST(CC_SHOBJ_FLAG) | |
1ac15cd8 | 880 | AC_SUBST(BUILD_POPT) |
225787a4 | 881 | AC_SUBST(MAKE_MAN) |
7d29d4ba | 882 | |
1c3344a1 WD |
883 | AC_CHECK_FUNCS(_acl __acl _facl __facl) |
884 | ################################################# | |
885 | # check for ACL support | |
886 | ||
887 | AC_MSG_CHECKING([whether to support ACLs]) | |
888 | AC_ARG_ENABLE(acl-support, | |
889 | AC_HELP_STRING([--disable-acl-support], | |
e8c64ffd | 890 | [disable ACL support])) |
1c3344a1 WD |
891 | |
892 | if test x"$enable_acl_support" = x"no"; then | |
893 | AC_MSG_RESULT(no) | |
894 | else | |
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);], | |
939 | samba_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);], | |
949 | samba_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 | |
962 | fi | |
963 | ||
16edf865 WD |
964 | ################################################# |
965 | # check for extended attribute support | |
966 | AC_MSG_CHECKING(whether to support extended attributes) | |
967 | AC_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 |
974 | AH_TEMPLATE([SUPPORT_XATTRS], |
975 | [Define to 1 to add support for extended attributes]) | |
16edf865 WD |
976 | if test x"$enable_xattr_support" = x"no"; then |
977 | AC_MSG_RESULT(no) | |
978 | else | |
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 | |
1009 | fi | |
1010 | ||
f4901024 WD |
1011 | if 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" | |
1015 | AC_COMPILE_IFELSE([ ], [rsync_warn_flag=yes], [rsync_warn_flag=no]) | |
1016 | AC_MSG_RESULT([$rsync_warn_flag]) | |
1017 | if test x"$rsync_warn_flag" = x"no"; then | |
1018 | CFLAGS="$OLD_CFLAGS" | |
1019 | fi | |
1020 | fi | |
1021 | ||
aa0e6b99 | 1022 | case "$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 | ;; | |
1026 | esac | |
1027 | ||
bf5c2bf6 MP |
1028 | AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) |
1029 | AC_OUTPUT | |
a4677968 MP |
1030 | |
1031 | AC_MSG_RESULT() | |
1032 | AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful]) | |
1033 | AC_MSG_RESULT() |