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) |
7ca6e856 | 6 | AC_PREREQ(2.52) |
c627d613 | 7 | |
e3cd2645 | 8 | RSYNC_VERSION=2.5.6pre3cvs |
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 | |
bf5c2bf6 MP |
16 | AC_CANONICAL_TARGET([]) |
17 | ||
18 | dnl Checks for programs. | |
19 | AC_PROG_CC | |
20 | AC_PROG_CPP | |
21 | AC_PROG_INSTALL | |
68b2cc55 | 22 | AC_PROG_CC_STDC |
bf5c2bf6 | 23 | AC_SUBST(SHELL) |
8de330a3 | 24 | |
70ed474b MP |
25 | AC_DEFINE([_GNU_SOURCE], 1, |
26 | [Define _GNU_SOURCE so that we get all necessary prototypes]) | |
27 | ||
5216de37 | 28 | if test "x$ac_cv_prog_cc_stdc" = xno |
68b2cc55 MP |
29 | then |
30 | AC_MSG_WARN([rsync requires an ANSI C compiler and you don't seem to have one]) | |
31 | fi | |
a358449a | 32 | |
03b1cddc | 33 | # We must decide this before testing the compiler. |
2d1ebe9c | 34 | |
47759343 MP |
35 | # Please allow this to default to yes, so that your users have more |
36 | # chance of getting a useful stack trace if problems occur. | |
37 | ||
bf5c2bf6 | 38 | AC_MSG_CHECKING([whether to include debugging symbols]) |
2d1ebe9c | 39 | AC_ARG_ENABLE(debug, |
bf5c2bf6 MP |
40 | AC_HELP_STRING([--enable-debug], |
41 | [including debugging symbols and features (default yes)]), | |
42 | [], []) | |
2d1ebe9c | 43 | |
bf5c2bf6 | 44 | if test x"$enable_debug" = x"no" |
2d1ebe9c | 45 | then |
2d1ebe9c MP |
46 | AC_MSG_RESULT(no) |
47 | CFLAGS=${CFLAGS-"-O"} | |
bf5c2bf6 MP |
48 | else |
49 | AC_MSG_RESULT([yes]) | |
50 | # leave CFLAGS alone; AC_PROG_CC will try to include -g if it can | |
23bf32f7 | 51 | dnl AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation]) |
bf5c2bf6 | 52 | dnl CFLAGS=${CFLAGS-"-g"} |
2d1ebe9c MP |
53 | fi |
54 | ||
da7b6397 MP |
55 | |
56 | ||
57 | ||
58 | AC_ARG_ENABLE(profile, | |
59 | AC_HELP_STRING([--enable-profile], | |
60 | [turn on CPU profiling (default no)], | |
61 | [], [])) | |
62 | if test x"$enable_profile" = xyes | |
63 | then | |
64 | CFLAGS="$CFLAGS -pg" | |
65 | fi | |
66 | ||
67 | ||
c0531332 MP |
68 | # Specifically, this turns on panic_action handling. |
69 | AC_ARG_ENABLE(maintainer-mode, | |
70 | AC_HELP_STRING([--enable-maintainer-mode], | |
71 | [turn on extra debug features], | |
72 | [], [])) | |
73 | if test x"$enable_maintainer_mode" = xyes | |
74 | then | |
75 | CFLAGS="$CFLAGS -DMAINTAINER_MODE" | |
76 | fi | |
77 | ||
78 | ||
da7b6397 MP |
79 | # This is needed for our included version of popt. Kind of silly, but |
80 | # I don't want our version too far out of sync. | |
1ac15cd8 MP |
81 | CFLAGS="$CFLAGS -DHAVE_CONFIG_H" |
82 | ||
47759343 MP |
83 | # If GCC, turn on warnings. |
84 | if test "x$GCC" = "xyes" | |
85 | then | |
99f106d1 | 86 | CFLAGS="$CFLAGS -Wall -W" |
47759343 MP |
87 | fi |
88 | ||
2d1ebe9c MP |
89 | AC_ARG_WITH(included-popt, |
90 | [ --with-included-popt use bundled popt library, not from system]) | |
91 | ||
41bd28fe | 92 | AC_ARG_WITH(rsync-path, |
ddd491d4 | 93 | [ --with-rsync-path=PATH set default --rsync-path to PATH (default: \"rsync\")], |
8642efd0 | 94 | [ RSYNC_PATH="$with_rsync_path" ], |
41bd28fe | 95 | [ RSYNC_PATH="rsync" ]) |
81c652d5 MP |
96 | |
97 | AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine]) | |
98 | ||
99 | AC_ARG_WITH(rsh, | |
100 | AC_HELP_STRING([--with-rsh=CMD], [set rsh command to CMD (default: \"remsh\" or \"rsh\")])) | |
41bd28fe | 101 | |
7b8356d0 | 102 | AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0) |
81c652d5 MP |
103 | AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [remote shell is remsh not rsh]) |
104 | ||
105 | if test x"$with_rsh" != x | |
106 | then | |
107 | RSYNC_RSH="$with_rsh" | |
108 | elif test x"$HAVE_REMSH" = x1 | |
109 | then | |
110 | RSYNC_RSH="remsh" | |
111 | else | |
112 | RSYNC_RSH="rsh" | |
113 | fi | |
7b8356d0 | 114 | |
81c652d5 | 115 | AC_DEFINE_UNQUOTED(RSYNC_RSH, "$RSYNC_RSH", [default -e command]) |
f0af1e5e AT |
116 | |
117 | # arrgh. libc in the current debian stable screws up the largefile | |
118 | # stuff, getting byte range locking wrong | |
119 | AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[ | |
120 | AC_TRY_RUN([ | |
121 | #define _FILE_OFFSET_BITS 64 | |
122 | #include <stdio.h> | |
123 | #include <fcntl.h> | |
124 | #include <sys/types.h> | |
125 | #include <sys/wait.h> | |
126 | ||
127 | int main(void) | |
128 | { | |
129 | struct flock lock; | |
130 | int status; | |
131 | int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600); | |
132 | lock.l_type = F_WRLCK; | |
133 | lock.l_whence = SEEK_SET; | |
134 | lock.l_start = 0; | |
135 | lock.l_len = 1; | |
136 | lock.l_pid = 0; | |
137 | ||
138 | fcntl(fd,F_SETLK,&lock); | |
139 | if (fork() == 0) { | |
140 | lock.l_start = 1; | |
141 | exit(fcntl(fd,F_SETLK,&lock) == 0); | |
142 | } | |
143 | wait(&status); | |
144 | unlink("conftest.dat"); | |
145 | exit(WEXITSTATUS(status)); | |
146 | } | |
147 | ], | |
148 | rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)]) | |
149 | if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then | |
150 | AC_SYS_LARGEFILE | |
151 | fi | |
152 | ||
06963d0f MP |
153 | ipv6type=unknown |
154 | ipv6lib=none | |
22cd0063 | 155 | ipv6trylibc=yes |
06963d0f | 156 | |
17d5a07e MP |
157 | AC_ARG_ENABLE(ipv6, |
158 | AC_HELP_STRING([--disable-ipv6], [don't even try to use IPv6])) | |
159 | ||
160 | if test "x$enable_ipv6" != xno | |
161 | then | |
06963d0f MP |
162 | AC_MSG_CHECKING([ipv6 stack type]) |
163 | for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do | |
164 | case $i in | |
165 | inria) | |
166 | # http://www.kame.net/ | |
167 | AC_EGREP_CPP(yes, [ | |
168 | #include <netinet/in.h> | |
169 | #ifdef IPV6_INRIA_VERSION | |
170 | yes | |
171 | #endif], | |
172 | [ipv6type=$i; | |
a358449a MP |
173 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
174 | ]) | |
06963d0f MP |
175 | ;; |
176 | kame) | |
177 | # http://www.kame.net/ | |
178 | AC_EGREP_CPP(yes, [ | |
179 | #include <netinet/in.h> | |
180 | #ifdef __KAME__ | |
181 | yes | |
182 | #endif], | |
a358449a MP |
183 | [ipv6type=$i; |
184 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) | |
06963d0f MP |
185 | ;; |
186 | linux-glibc) | |
187 | # http://www.v6.linux.or.jp/ | |
188 | AC_EGREP_CPP(yes, [ | |
189 | #include <features.h> | |
190 | #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 | |
191 | yes | |
192 | #endif], | |
193 | [ipv6type=$i; | |
a358449a | 194 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
195 | ;; |
196 | linux-inet6) | |
197 | # http://www.v6.linux.or.jp/ | |
198 | if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then | |
199 | ipv6type=$i | |
200 | ipv6lib=inet6 | |
201 | ipv6libdir=/usr/inet6/lib | |
202 | ipv6trylibc=yes; | |
a358449a MP |
203 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
204 | CFLAGS="-I/usr/inet6/include $CFLAGS" | |
06963d0f MP |
205 | fi |
206 | ;; | |
207 | toshiba) | |
208 | AC_EGREP_CPP(yes, [ | |
209 | #include <sys/param.h> | |
210 | #ifdef _TOSHIBA_INET6 | |
211 | yes | |
212 | #endif], | |
213 | [ipv6type=$i; | |
214 | ipv6lib=inet6; | |
215 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 216 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
217 | ;; |
218 | v6d) | |
219 | AC_EGREP_CPP(yes, [ | |
220 | #include </usr/local/v6/include/sys/v6config.h> | |
221 | #ifdef __V6D__ | |
222 | yes | |
223 | #endif], | |
224 | [ipv6type=$i; | |
225 | ipv6lib=v6; | |
226 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 227 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
228 | ;; |
229 | zeta) | |
230 | AC_EGREP_CPP(yes, [ | |
231 | #include <sys/param.h> | |
232 | #ifdef _ZETA_MINAMI_INET6 | |
233 | yes | |
234 | #endif], | |
235 | [ipv6type=$i; | |
236 | ipv6lib=inet6; | |
237 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 238 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
239 | ;; |
240 | esac | |
241 | if test "$ipv6type" != "unknown"; then | |
242 | break | |
243 | fi | |
244 | done | |
245 | AC_MSG_RESULT($ipv6type) | |
06963d0f | 246 | |
17d5a07e MP |
247 | AC_SEARCH_LIBS(getaddrinfo, inet6) |
248 | fi | |
06963d0f | 249 | |
688d5732 DD |
250 | AC_MSG_CHECKING([default value for --modify-window]) |
251 | case $host_os in | |
252 | *cygwin* ) DEFAULT_MODIFY_WINDOW=${DEFAULT_MODIFY_WINDOW:-2};; | |
253 | * ) DEFAULT_MODIFY_WINDOW=${DEFAULT_MODIFY_WINDOW:-0};; | |
254 | esac | |
255 | AC_MSG_RESULT($DEFAULT_MODIFY_WINDOW) | |
256 | AC_DEFINE_UNQUOTED(DEFAULT_MODIFY_WINDOW, $DEFAULT_MODIFY_WINDOW, | |
257 | [Set to the default value for the --modify-window option]) | |
258 | ||
cd957c70 | 259 | AC_C_BIGENDIAN |
c627d613 | 260 | AC_HEADER_DIRENT |
c627d613 AT |
261 | AC_HEADER_TIME |
262 | AC_HEADER_SYS_WAIT | |
8bf73749 | 263 | AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) |
94481d91 | 264 | AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) |
1433e6da | 265 | AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h sys/un.h) |
7fc08908 | 266 | AC_CHECK_HEADERS(glob.h mcheck.h sys/sysctl.h arpa/inet.h arpa/nameser.h) |
15c17078 | 267 | AC_CHECK_HEADERS(netdb.h) |
e5a2b854 | 268 | AC_CHECK_HEADERS(malloc.h) |
7c66b860 | 269 | AC_CHECK_HEADERS(float.h) |
c627d613 AT |
270 | |
271 | AC_CHECK_SIZEOF(int) | |
272 | AC_CHECK_SIZEOF(long) | |
273 | AC_CHECK_SIZEOF(short) | |
274 | ||
275 | AC_C_INLINE | |
276 | ||
277 | AC_TYPE_SIGNAL | |
278 | AC_TYPE_UID_T | |
279 | AC_TYPE_MODE_T | |
280 | AC_TYPE_OFF_T | |
281 | AC_TYPE_SIZE_T | |
282 | AC_TYPE_PID_T | |
9422bb3f | 283 | AC_TYPE_GETGROUPS |
bf5c2bf6 MP |
284 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
285 | ||
e2ba16cc | 286 | AC_CHECK_TYPE([ino_t], [unsigned]) |
7ca6e856 | 287 | TYPE_SOCKLEN_T |
c627d613 | 288 | |
7b3d4257 | 289 | AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [ |
7597e1a9 | 290 | AC_TRY_COMPILE([#include <errno.h>],[int i = errno], |
7b3d4257 AT |
291 | rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)]) |
292 | if test x"$rsync_cv_errno" = x"yes"; then | |
d4e4cbe1 | 293 | AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ]) |
7597e1a9 | 294 | fi |
c627d613 | 295 | |
a784e10d DD |
296 | # The following test taken from the cvs sources |
297 | # If we can't find connect, try looking in -lsocket, -lnsl, and -linet. | |
298 | # These need checks to be before checks for any other functions that | |
299 | # might be in the same libraries. | |
300 | # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has | |
301 | # libsocket.so which has a bad implementation of gethostbyname (it | |
302 | # only looks in /etc/hosts), so we only look for -lsocket if we need | |
303 | # it. | |
304 | AC_CHECK_FUNCS(connect) | |
305 | if test x"$ac_cv_func_connect" = x"no"; then | |
306 | case "$LIBS" in | |
307 | *-lnsl*) ;; | |
308 | *) AC_CHECK_LIB(nsl_s, printf) ;; | |
309 | esac | |
310 | case "$LIBS" in | |
311 | *-lnsl*) ;; | |
312 | *) AC_CHECK_LIB(nsl, printf) ;; | |
313 | esac | |
314 | case "$LIBS" in | |
315 | *-lsocket*) ;; | |
316 | *) AC_CHECK_LIB(socket, connect) ;; | |
317 | esac | |
318 | case "$LIBS" in | |
319 | *-linet*) ;; | |
320 | *) AC_CHECK_LIB(inet, connect) ;; | |
321 | esac | |
322 | dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value | |
323 | dnl has been cached. | |
324 | if test x"$ac_cv_lib_socket_connect" = x"yes" || | |
325 | test x"$ac_cv_lib_inet_connect" = x"yes"; then | |
326 | # ac_cv_func_connect=yes | |
327 | # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run | |
d4e4cbe1 | 328 | AC_DEFINE(HAVE_CONNECT, 1, [ ]) |
a784e10d DD |
329 | fi |
330 | fi | |
331 | ||
8f694072 MP |
332 | AC_CHECK_LIB(resolv, inet_ntop) |
333 | ||
99f106d1 | 334 | dnl AC_MSG_NOTICE([Looking in libraries: $LIBS]) |
e94989fe | 335 | |
9fecec5e MP |
336 | AC_CHECK_FUNCS(inet_ntop, , AC_LIBOBJ(lib/inet_ntop)) |
337 | AC_CHECK_FUNCS(inet_pton, , AC_LIBOBJ(lib/inet_pton)) | |
356bbb83 | 338 | |
824f1c79 DD |
339 | # Irix 6.5 has getaddrinfo but not the corresponding defines, so use |
340 | # builtin getaddrinfo if one of the defines don't exist | |
184dede9 DD |
341 | AC_CACHE_CHECK([whether defines needed by getaddrinfo exist], |
342 | rsync_cv_HAVE_GETADDR_DEFINES,[ | |
343 | AC_EGREP_CPP(yes, [ | |
344 | #include <sys/types.h> | |
345 | #include <sys/socket.h> | |
346 | #include <netdb.h> | |
347 | #ifdef AI_PASSIVE | |
348 | yes | |
349 | #endif], | |
350 | rsync_cv_HAVE_GETADDR_DEFINES=yes, | |
351 | rsync_cv_HAVE_GETADDR_DEFINES=no)]) | |
352 | if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes"; then | |
824f1c79 DD |
353 | # Tru64 UNIX has getaddrinfo() but has it renamed in libc as |
354 | # something else so we must include <netdb.h> to get the | |
355 | # redefinition. | |
356 | AC_CHECK_FUNCS(getaddrinfo, , | |
357 | [AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>]) | |
358 | AC_TRY_LINK([#include <sys/types.h> | |
359 | #include <sys/socket.h> | |
360 | #include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);], | |
361 | [AC_MSG_RESULT([yes]) | |
362 | AC_DEFINE(HAVE_GETADDRINFO, 1, | |
363 | [Define if you have the `getaddrinfo' function.])], | |
364 | [AC_MSG_RESULT([no]) | |
365 | AC_LIBOBJ(lib/getaddrinfo)])]) | |
366 | AC_CHECK_FUNCS(getnameinfo, , AC_LIBOBJ(lib/getnameinfo)) | |
184dede9 | 367 | else |
d2cc0323 | 368 | AC_LIBOBJ(lib/getaddrinfo) |
184dede9 DD |
369 | AC_LIBOBJ(lib/getnameinfo) |
370 | fi | |
824f1c79 | 371 | |
82923068 | 372 | |
356bbb83 MP |
373 | AC_CHECK_MEMBER([struct sockaddr.sa_len], |
374 | [ AC_DEFINE(HAVE_SOCKADDR_LEN) ], | |
375 | [], | |
376 | [ | |
377 | #include <sys/types.h> | |
378 | #include <sys/socket.h> | |
379 | ]) | |
380 | ||
2d6dbe29 MP |
381 | AC_MSG_CHECKING(struct sockaddr_storage) |
382 | AC_TRY_COMPILE([#include <sys/types.h> | |
383 | #include <sys/socket.h>], | |
384 | [struct sockaddr_storage x;], | |
385 | AC_MSG_RESULT(yes) | |
9fecec5e MP |
386 | AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, |
387 | [Define if you have strct sockaddr_storage.] ), | |
2d6dbe29 MP |
388 | AC_MSG_RESULT(no)) |
389 | ||
bc2b4963 DD |
390 | AC_CHECK_MEMBER([struct sockaddr_in6.sin6_scope_id], |
391 | [ AC_DEFINE(HAVE_SOCKADDR_IN6_SCOPE_ID) ], | |
392 | [], | |
393 | [ | |
394 | #include <sys/types.h> | |
395 | #include <sys/socket.h> | |
396 | #include <netinet/in.h> | |
397 | ]) | |
398 | ||
a784e10d DD |
399 | # if we can't find strcasecmp, look in -lresolv (for Unixware at least) |
400 | # | |
401 | AC_CHECK_FUNCS(strcasecmp) | |
402 | if test x"$ac_cv_func_strcasecmp" = x"no"; then | |
403 | AC_CHECK_LIB(resolv, strcasecmp) | |
404 | fi | |
405 | ||
87fcb639 MP |
406 | dnl At the moment we don't test for a broken memcmp(), because all we |
407 | dnl need to do is test for equality, not comparison, and it seems that | |
408 | dnl every platform has a memcmp that can do at least that. | |
409 | dnl AC_FUNC_MEMCMP | |
410 | ||
c627d613 | 411 | AC_FUNC_UTIME_NULL |
7fc08908 | 412 | AC_FUNC_ALLOCA |
1433e6da | 413 | AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod mkfifo) |
e0414f42 | 414 | AC_CHECK_FUNCS(fchmod fstat strchr readlink link utime utimes strftime) |
8950ac03 | 415 | AC_CHECK_FUNCS(memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk) |
bc2b4963 | 416 | AC_CHECK_FUNCS(strlcat strlcpy strtol mtrace mallinfo setgroups) |
24c857f1 DD |
417 | |
418 | AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ | |
6a5ef41f MP |
419 | AC_TRY_RUN([ |
420 | #include <sys/types.h> | |
421 | #include <sys/socket.h> | |
422 | ||
423 | main() { | |
424 | int fd[2]; | |
425 | exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); | |
426 | }], | |
24c857f1 DD |
427 | rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) |
428 | if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then | |
d4e4cbe1 | 429 | AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ]) |
24c857f1 | 430 | fi |
c627d613 | 431 | |
79fc6bdb | 432 | AC_CACHE_CHECK([for working fnmatch],rsync_cv_HAVE_FNMATCH,[ |
c627d613 | 433 | AC_TRY_RUN([#include <fnmatch.h> |
e7d6e0aa AT |
434 | main() { exit((fnmatch("*.o", "x.o", FNM_PATHNAME) == 0 && |
435 | fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME) != 0) ? 0: 1); }], | |
79fc6bdb DD |
436 | rsync_cv_HAVE_FNMATCH=yes,rsync_cv_HAVE_FNMATCH=no,rsync_cv_HAVE_FNMATCH=cross)]) |
437 | if test x"$rsync_cv_HAVE_FNMATCH" = x"yes"; then | |
d4e4cbe1 | 438 | AC_DEFINE(HAVE_FNMATCH, 1, [ ]) |
79fc6bdb DD |
439 | fi |
440 | ||
1ac15cd8 MP |
441 | if test x"$with_included_popt" != x"yes" |
442 | then | |
443 | AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) | |
444 | fi | |
2d1ebe9c | 445 | |
12458878 | 446 | AC_MSG_CHECKING([whether to use included libpopt]) |
2d1ebe9c MP |
447 | if test x"$with_included_popt" = x"yes" |
448 | then | |
12458878 | 449 | AC_MSG_RESULT($srcdir/popt) |
1ac15cd8 | 450 | BUILD_POPT='$(popt_OBJS)' |
26ef00bd | 451 | CFLAGS="$CFLAGS -I$srcdir/popt" |
5216de37 | 452 | if test x"$ALLOCA" != x |
7fc08908 | 453 | then |
5216de37 DD |
454 | # this can be removed when/if we add an included alloca.c; |
455 | # see autoconf documentation on AC_FUNC_ALLOCA | |
8af534a5 | 456 | AC_MSG_WARN([included libpopt will use malloc, not alloca (which wastes a small amount of memory)]) |
7fc08908 | 457 | fi |
2d1ebe9c MP |
458 | else |
459 | AC_MSG_RESULT(no) | |
79fc6bdb | 460 | fi |
c627d613 | 461 | |
79fc6bdb | 462 | AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[ |
0d0e2e93 | 463 | AC_TRY_RUN([#include <stdio.h> |
efb2f6bf | 464 | main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }], |
79fc6bdb DD |
465 | rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)]) |
466 | if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then | |
d4e4cbe1 | 467 | AC_DEFINE(HAVE_LONGLONG, 1, [ ]) |
7597e1a9 | 468 | fi |
0d0e2e93 | 469 | |
7b3d4257 | 470 | AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[ |
bcacc18b AT |
471 | AC_TRY_RUN([#include <stdio.h> |
472 | #include <sys/stat.h> | |
7597e1a9 | 473 | main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }], |
7b3d4257 AT |
474 | rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)]) |
475 | if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then | |
d4e4cbe1 | 476 | AC_DEFINE(HAVE_OFF64_T, 1, [ ]) |
7597e1a9 | 477 | fi |
debb4505 | 478 | |
79fc6bdb | 479 | AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[ |
c29ee43d AT |
480 | AC_TRY_RUN([#include <stdio.h> |
481 | #include <sys/types.h> | |
482 | #include <sys/stat.h> | |
483 | main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }], | |
79fc6bdb DD |
484 | rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)]) |
485 | if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then | |
d4e4cbe1 | 486 | AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ]) |
79fc6bdb | 487 | fi |
c29ee43d | 488 | |
7b3d4257 | 489 | AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[ |
debb4505 AT |
490 | AC_TRY_RUN([#include <stdio.h> |
491 | main() { char c; c=250; exit((c > 0)?0:1); }], | |
7b3d4257 AT |
492 | rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)]) |
493 | if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then | |
d4e4cbe1 | 494 | AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ]) |
7597e1a9 | 495 | fi |
bcacc18b | 496 | |
7b3d4257 | 497 | AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ |
59503278 AT |
498 | AC_TRY_RUN([#include <sys/types.h> |
499 | #include <dirent.h> | |
500 | main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); | |
501 | if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && | |
7597e1a9 | 502 | di->d_name[0] == 0) exit(0); exit(1);} ], |
7b3d4257 AT |
503 | rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) |
504 | if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then | |
d4e4cbe1 | 505 | AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ]) |
7597e1a9 | 506 | fi |
1e9f155a | 507 | |
7b3d4257 | 508 | AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[ |
d6e6ecbd AT |
509 | AC_TRY_COMPILE([#include <sys/types.h> |
510 | #include <utime.h>], | |
7597e1a9 | 511 | [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));], |
7b3d4257 AT |
512 | rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)]) |
513 | if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then | |
d4e4cbe1 | 514 | AC_DEFINE(HAVE_UTIMBUF, 1, [ ]) |
7597e1a9 | 515 | fi |
d6e6ecbd | 516 | |
3060d4aa AT |
517 | AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ |
518 | AC_TRY_RUN([ | |
519 | #include <sys/time.h> | |
520 | #include <unistd.h> | |
521 | main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}], | |
522 | rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)]) | |
523 | if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then | |
d4e4cbe1 | 524 | AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ]) |
3060d4aa AT |
525 | fi |
526 | ||
8950ac03 AT |
527 | AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |
528 | AC_TRY_RUN([ | |
529 | #include <sys/types.h> | |
530 | #include <stdarg.h> | |
531 | void foo(const char *format, ...) { | |
532 | va_list ap; | |
533 | int len; | |
534 | char buf[5]; | |
535 | ||
536 | va_start(ap, format); | |
537 | len = vsnprintf(0, 0, format, ap); | |
538 | va_end(ap); | |
539 | if (len != 5) exit(1); | |
540 | ||
541 | if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); | |
542 | ||
543 | exit(0); | |
544 | } | |
545 | main() { foo("hello"); } | |
546 | ], | |
547 | rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) | |
548 | if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then | |
d4e4cbe1 | 549 | AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) |
8950ac03 AT |
550 | fi |
551 | ||
552 | ||
f62c17e3 AT |
553 | AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ |
554 | AC_TRY_RUN([#include <stdlib.h> | |
555 | #include <sys/types.h> | |
556 | #include <sys/stat.h> | |
557 | #include <unistd.h> | |
558 | main() { | |
559 | struct stat st; | |
560 | char tpl[20]="/tmp/test.XXXXXX"; | |
561 | int fd = mkstemp(tpl); | |
562 | if (fd == -1) exit(1); | |
563 | unlink(tpl); | |
564 | if (fstat(fd, &st) != 0) exit(1); | |
565 | if ((st.st_mode & 0777) != 0600) exit(1); | |
566 | exit(0); | |
567 | }], | |
568 | rsync_cv_HAVE_SECURE_MKSTEMP=yes, | |
569 | rsync_cv_HAVE_SECURE_MKSTEMP=no, | |
570 | rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) | |
571 | if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then | |
d4e4cbe1 | 572 | AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ]) |
f62c17e3 AT |
573 | fi |
574 | ||
3060d4aa | 575 | |
7b3d4257 AT |
576 | AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[ |
577 | AC_TRY_RUN([ | |
578 | #include <stdio.h> | |
579 | #include <sys/types.h> | |
580 | #include <netinet/in.h> | |
581 | #include <arpa/inet.h> | |
582 | main() { struct in_addr ip; ip.s_addr = 0x12345678; | |
583 | if (strcmp(inet_ntoa(ip),"18.52.86.120") && | |
fca3ef06 AT |
584 | strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); } |
585 | exit(0);}], | |
586 | rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)]) | |
7b3d4257 | 587 | if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then |
d4e4cbe1 | 588 | AC_DEFINE(REPLACE_INET_NTOA, 1, [ ]) |
7b3d4257 AT |
589 | fi |
590 | ||
fca3ef06 AT |
591 | |
592 | AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[ | |
593 | AC_TRY_RUN([ | |
594 | #include <stdio.h> | |
595 | #include <sys/types.h> | |
596 | #include <netinet/in.h> | |
597 | #include <arpa/inet.h> | |
598 | main() { struct in_addr ip; | |
599 | if (inet_aton("example", &ip) == 0) exit(0); exit(1);}], | |
600 | rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)]) | |
601 | if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then | |
d4e4cbe1 | 602 | AC_DEFINE(REPLACE_INET_ATON, 1, [ ]) |
fca3ef06 AT |
603 | fi |
604 | ||
692da0b5 DD |
605 | # |
606 | # The following test was mostly taken from the tcl/tk plus patches | |
607 | # | |
79fc6bdb | 608 | AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[ |
692da0b5 DD |
609 | rm -rf conftest* |
610 | cat > conftest.$ac_ext <<EOF | |
611 | int main() { return 0; } | |
612 | EOF | |
613 | ${CC-cc} -c -o conftest..o conftest.$ac_ext | |
614 | if test -f conftest..o; then | |
79fc6bdb DD |
615 | rsync_cv_DASHC_WORKS_WITH_DASHO=yes |
616 | else | |
617 | rsync_cv_DASHC_WORKS_WITH_DASHO=no | |
618 | fi | |
619 | rm -rf conftest* | |
620 | ]) | |
621 | if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then | |
692da0b5 DD |
622 | OBJ_SAVE="#" |
623 | OBJ_RESTORE="#" | |
624 | CC_SHOBJ_FLAG='-o $@' | |
692da0b5 DD |
625 | else |
626 | OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;' | |
627 | 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' | |
628 | CC_SHOBJ_FLAG="" | |
692da0b5 | 629 | fi |
79fc6bdb | 630 | |
692da0b5 DD |
631 | AC_SUBST(OBJ_SAVE) |
632 | AC_SUBST(OBJ_RESTORE) | |
633 | AC_SUBST(CC_SHOBJ_FLAG) | |
1ac15cd8 | 634 | AC_SUBST(BUILD_POPT) |
7d29d4ba | 635 | |
bf5c2bf6 MP |
636 | AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) |
637 | AC_OUTPUT | |
a4677968 MP |
638 | |
639 | AC_MSG_RESULT() | |
640 | AC_MSG_RESULT([ rsync ${RSYNC_VERSION} configuration successful]) | |
641 | AC_MSG_RESULT() |