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