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