Commit | Line | Data |
---|---|---|
c627d613 | 1 | dnl Process this file with autoconf to produce a configure script. |
06963d0f | 2 | |
c627d613 AT |
3 | AC_INIT(byteorder.h) |
4 | AC_CONFIG_HEADER(config.h) | |
7ca6e856 | 5 | AC_PREREQ(2.52) |
c627d613 | 6 | |
6a48ca56 | 7 | LDFLAGS=${LDFLAGS-""} |
50abd20b | 8 | |
8de330a3 AT |
9 | AC_CANONICAL_SYSTEM |
10 | AC_VALIDATE_CACHE_SYSTEM_TYPE | |
11 | ||
2d1ebe9c MP |
12 | # compile with optimisation and without debugging by default, unless |
13 | # --debug is given. We must decide this before testing the compiler. | |
14 | ||
15 | AC_ARG_ENABLE(debug, | |
16 | [ --enable-debug including debugging symbols and features]) | |
17 | ||
18 | AC_MSG_CHECKING([whether to include debugging symbols]) | |
19 | if test x"$enable_debug" = x"yes" | |
20 | then | |
21 | AC_MSG_RESULT(yes) | |
22 | # leave CFLAGS alone; AC_PROG_CC will try to include -g if it can | |
23 | AC_DEFINE(DEBUG, 1, [Define to turn on debugging code that may slow normal operation]) | |
24 | CFLAGS=${CFLAGS-"-g"} | |
25 | else | |
26 | AC_MSG_RESULT(no) | |
27 | CFLAGS=${CFLAGS-"-O"} | |
28 | fi | |
29 | ||
1ac15cd8 MP |
30 | CFLAGS="$CFLAGS -DHAVE_CONFIG_H" |
31 | ||
2d1ebe9c MP |
32 | AC_ARG_WITH(included-popt, |
33 | [ --with-included-popt use bundled popt library, not from system]) | |
34 | ||
41bd28fe | 35 | AC_ARG_WITH(rsync-path, |
ddd491d4 | 36 | [ --with-rsync-path=PATH set default --rsync-path to PATH (default: \"rsync\")], |
8642efd0 | 37 | [ RSYNC_PATH="$with_rsync_path" ], |
41bd28fe | 38 | [ RSYNC_PATH="rsync" ]) |
c6a7f2f4 | 39 | AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [ ]) |
41bd28fe | 40 | |
c627d613 AT |
41 | dnl Checks for programs. |
42 | AC_PROG_CC | |
06963d0f | 43 | AC_PROG_CPP |
c627d613 AT |
44 | AC_PROG_INSTALL |
45 | AC_SUBST(SHELL) | |
46 | ||
7b8356d0 | 47 | AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0) |
d4e4cbe1 | 48 | AC_DEFINE_UNQUOTED(HAVE_REMSH, $HAVE_REMSH, [ ]) |
7b8356d0 | 49 | |
f0af1e5e AT |
50 | |
51 | # arrgh. libc in the current debian stable screws up the largefile | |
52 | # stuff, getting byte range locking wrong | |
53 | AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[ | |
54 | AC_TRY_RUN([ | |
55 | #define _FILE_OFFSET_BITS 64 | |
56 | #include <stdio.h> | |
57 | #include <fcntl.h> | |
58 | #include <sys/types.h> | |
59 | #include <sys/wait.h> | |
60 | ||
61 | int main(void) | |
62 | { | |
63 | struct flock lock; | |
64 | int status; | |
65 | int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600); | |
66 | lock.l_type = F_WRLCK; | |
67 | lock.l_whence = SEEK_SET; | |
68 | lock.l_start = 0; | |
69 | lock.l_len = 1; | |
70 | lock.l_pid = 0; | |
71 | ||
72 | fcntl(fd,F_SETLK,&lock); | |
73 | if (fork() == 0) { | |
74 | lock.l_start = 1; | |
75 | exit(fcntl(fd,F_SETLK,&lock) == 0); | |
76 | } | |
77 | wait(&status); | |
78 | unlink("conftest.dat"); | |
79 | exit(WEXITSTATUS(status)); | |
80 | } | |
81 | ], | |
82 | rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)]) | |
83 | if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then | |
84 | AC_SYS_LARGEFILE | |
85 | fi | |
86 | ||
87 | ||
88 | ||
06963d0f MP |
89 | AC_DEFINE(ss_family, __ss_family) |
90 | AC_DEFINE(ss_len, __ss_len) | |
91 | CFLAGS="$CFLAGS" | |
92 | AC_MSG_CHECKING([whether to enable ipv6]) | |
93 | AC_ARG_ENABLE(ipv6, | |
94 | [ --enable-ipv6 Enable ipv6 (with ipv4) support | |
95 | --disable-ipv6 Disable ipv6 support], | |
96 | [ case "$enableval" in | |
97 | no) | |
98 | AC_MSG_RESULT(no) | |
99 | ipv6=no | |
100 | ;; | |
101 | *) AC_MSG_RESULT(yes) | |
102 | AC_DEFINE(ENABLE_IPV6) | |
103 | ipv6=yes | |
104 | ;; | |
105 | esac ], | |
106 | ||
107 | AC_TRY_COMPILE([ /* AF_INET6 avalable check */ | |
108 | #include <sys/types.h> | |
109 | #include <sys/socket.h> | |
110 | main() | |
111 | { | |
112 | if (socket(AF_INET6, SOCK_STREAM, 0) < 0) | |
113 | exit(1); | |
114 | else | |
115 | exit(0); | |
116 | } | |
117 | ], | |
118 | AC_MSG_RESULT(yes) | |
119 | AC_DEFINE(ENABLE_IPV6) | |
120 | ipv6=yes, | |
121 | AC_MSG_RESULT(no) | |
122 | ipv6=no, | |
123 | AC_MSG_RESULT(no) | |
124 | ipv6=no | |
125 | )) | |
126 | ||
127 | ipv6type=unknown | |
128 | ipv6lib=none | |
129 | ipv6trylibc=no | |
130 | ||
131 | if test "$ipv6" = "yes"; then | |
132 | AC_MSG_CHECKING([ipv6 stack type]) | |
133 | for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do | |
134 | case $i in | |
135 | inria) | |
136 | # http://www.kame.net/ | |
137 | AC_EGREP_CPP(yes, [ | |
138 | #include <netinet/in.h> | |
139 | #ifdef IPV6_INRIA_VERSION | |
140 | yes | |
141 | #endif], | |
142 | [ipv6type=$i; | |
143 | CFLAGS="-DINET6 $CFLAGS"]) | |
144 | ;; | |
145 | kame) | |
146 | # http://www.kame.net/ | |
147 | AC_EGREP_CPP(yes, [ | |
148 | #include <netinet/in.h> | |
149 | #ifdef __KAME__ | |
150 | yes | |
151 | #endif], | |
152 | [ipv6type=$i; | |
153 | CFLAGS="-DINET6 $CFLAGS"]) | |
154 | ;; | |
155 | linux-glibc) | |
156 | # http://www.v6.linux.or.jp/ | |
157 | AC_EGREP_CPP(yes, [ | |
158 | #include <features.h> | |
159 | #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 | |
160 | yes | |
161 | #endif], | |
162 | [ipv6type=$i; | |
163 | CFLAGS="-DINET6 $CFLAGS"]) | |
164 | ;; | |
165 | linux-inet6) | |
166 | # http://www.v6.linux.or.jp/ | |
167 | if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then | |
168 | ipv6type=$i | |
169 | ipv6lib=inet6 | |
170 | ipv6libdir=/usr/inet6/lib | |
171 | ipv6trylibc=yes; | |
172 | CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS" | |
173 | fi | |
174 | ;; | |
175 | toshiba) | |
176 | AC_EGREP_CPP(yes, [ | |
177 | #include <sys/param.h> | |
178 | #ifdef _TOSHIBA_INET6 | |
179 | yes | |
180 | #endif], | |
181 | [ipv6type=$i; | |
182 | ipv6lib=inet6; | |
183 | ipv6libdir=/usr/local/v6/lib; | |
184 | CFLAGS="-DINET6 $CFLAGS"]) | |
185 | ;; | |
186 | v6d) | |
187 | AC_EGREP_CPP(yes, [ | |
188 | #include </usr/local/v6/include/sys/v6config.h> | |
189 | #ifdef __V6D__ | |
190 | yes | |
191 | #endif], | |
192 | [ipv6type=$i; | |
193 | ipv6lib=v6; | |
194 | ipv6libdir=/usr/local/v6/lib; | |
195 | CFLAGS="-I/usr/local/v6/include $CFLAGS"]) | |
196 | ;; | |
197 | zeta) | |
198 | AC_EGREP_CPP(yes, [ | |
199 | #include <sys/param.h> | |
200 | #ifdef _ZETA_MINAMI_INET6 | |
201 | yes | |
202 | #endif], | |
203 | [ipv6type=$i; | |
204 | ipv6lib=inet6; | |
205 | ipv6libdir=/usr/local/v6/lib; | |
206 | CFLAGS="-DINET6 $CFLAGS"]) | |
207 | ;; | |
208 | esac | |
209 | if test "$ipv6type" != "unknown"; then | |
210 | break | |
211 | fi | |
212 | done | |
213 | AC_MSG_RESULT($ipv6type) | |
214 | fi | |
215 | ||
216 | if test "$ipv6" = "yes" -a -f /usr/local/v6/lib/libinet6.a; then | |
217 | ac_inet6_LDFLAGS="inet6" | |
218 | ipv6libdir=/usr/local/v6/lib | |
219 | LDFLAGS="$LDFLAGS -L/usr/local/v6/lib" | |
220 | AC_CHECK_LIB(inet6, getaddrinfo, , ipv6lib="$ac_inet6_LDFLAGS") | |
221 | fi | |
222 | ||
223 | if test "$ipv6" = "yes" -a -f /usr/lib/libinet6.a; then | |
224 | ac_inet6_LDFLAGS="inet6" | |
225 | AC_CHECK_LIB(inet6, getaddrinfo, , ipv6lib="$ac_inet6_LDFLAGS") | |
226 | fi | |
227 | ||
228 | if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then | |
229 | if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then | |
230 | LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" | |
231 | echo "You have $ipv6lib library, using it" | |
232 | else | |
233 | if test "$ipv6trylibc" = "yes"; then | |
234 | echo "You do not have $ipv6lib library, using libc" | |
235 | else | |
236 | echo 'Fatal: no $ipv6lib library found. cannot continue.' | |
237 | echo "You need to fetch lib$ipv6lib.a from appropriate" | |
238 | echo 'ipv6 kit and compile beforehand.' | |
239 | exit 1 | |
240 | fi | |
241 | fi | |
242 | fi | |
243 | ||
244 | ||
245 | AC_MSG_CHECKING(getaddrinfo bug) | |
246 | AC_TRY_RUN([ | |
247 | #include <sys/types.h> | |
248 | #include <netdb.h> | |
249 | #include <string.h> | |
250 | #include <sys/socket.h> | |
251 | #include <netinet/in.h> | |
252 | ||
253 | main() | |
254 | { | |
255 | int passive, gaierr, inet4 = 0, inet6 = 0; | |
256 | struct addrinfo hints, *ai, *aitop; | |
257 | char straddr[INET6_ADDRSTRLEN], strport[16]; | |
258 | ||
259 | for (passive = 0; passive <= 1; passive++) { | |
260 | memset(&hints, 0, sizeof(hints)); | |
261 | hints.ai_family = AF_UNSPEC; | |
262 | hints.ai_flags = passive ? AI_PASSIVE : 0; | |
263 | hints.ai_socktype = SOCK_STREAM; | |
264 | if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { | |
265 | (void)gai_strerror(gaierr); | |
266 | goto bad; | |
267 | } | |
268 | for (ai = aitop; ai; ai = ai->ai_next) { | |
269 | if (ai->ai_addr == NULL || | |
270 | ai->ai_addrlen == 0 || | |
271 | getnameinfo(ai->ai_addr, ai->ai_addrlen, | |
272 | straddr, sizeof(straddr), strport, sizeof(strport), | |
273 | NI_NUMERICHOST|NI_NUMERICSERV) != 0) { | |
274 | goto bad; | |
275 | } | |
276 | switch (ai->ai_family) { | |
277 | case AF_INET: | |
278 | if (strcmp(strport, "54321") != 0) { | |
279 | goto bad; | |
280 | } | |
281 | if (passive) { | |
282 | if (strcmp(straddr, "0.0.0.0") != 0) { | |
283 | goto bad; | |
284 | } | |
285 | } else { | |
286 | if (strcmp(straddr, "127.0.0.1") != 0) { | |
287 | goto bad; | |
288 | } | |
289 | } | |
290 | inet4++; | |
291 | break; | |
292 | case AF_INET6: | |
293 | if (strcmp(strport, "54321") != 0) { | |
294 | goto bad; | |
295 | } | |
296 | if (passive) { | |
297 | if (strcmp(straddr, "::") != 0) { | |
298 | goto bad; | |
299 | } | |
300 | } else { | |
301 | if (strcmp(straddr, "::1") != 0) { | |
302 | goto bad; | |
303 | } | |
304 | } | |
305 | inet6++; | |
306 | break; | |
307 | case AF_UNSPEC: | |
308 | goto bad; | |
309 | break; | |
310 | default: | |
311 | /* another family support? */ | |
312 | break; | |
313 | } | |
314 | } | |
315 | } | |
316 | ||
317 | if (!(inet4 == 0 || inet4 == 2)) | |
318 | goto bad; | |
319 | if (!(inet6 == 0 || inet6 == 2)) | |
320 | goto bad; | |
321 | ||
322 | if (aitop) | |
323 | freeaddrinfo(aitop); | |
324 | exit(0); | |
325 | ||
326 | bad: | |
327 | if (aitop) | |
328 | freeaddrinfo(aitop); | |
329 | exit(1); | |
330 | } | |
331 | ], | |
332 | AC_MSG_RESULT(good) | |
333 | buggygetaddrinfo=no, | |
334 | AC_MSG_RESULT(buggy) | |
335 | buggygetaddrinfo=yes, | |
336 | AC_MSG_RESULT(buggy) | |
337 | buggygetaddrinfo=yes) | |
338 | ||
339 | if test "$buggygetaddrinfo" = "yes"; then | |
340 | if test "$ipv6" = "yes" -a "$ipv6type" != "linux"; then | |
341 | echo 'Fatal: You must get working getaddrinfo() function.' | |
342 | echo ' or you can specify "--disable-ipv6"'. | |
343 | exit 1 | |
344 | elif test "$ipv6type" = "linux"; then | |
345 | echo 'Warning: getaddrinfo() implementation on your system seems be buggy.' | |
346 | echo ' Better upgreade your system library to newest version' | |
347 | echo ' of GNU C library (aka glibc).' | |
348 | fi | |
349 | fi | |
350 | AC_REPLACE_FUNCS(getaddrinfo getnameinfo) | |
351 | ||
352 | AC_MSG_CHECKING([whether struct sockaddr has sa_len]) | |
353 | AC_TRY_COMPILE([ | |
354 | #include <sys/types.h> | |
355 | #include <sys/socket.h> | |
356 | ],[ | |
357 | struct sockaddr s; | |
358 | int i = s.sa_len; | |
359 | ], | |
360 | [ AC_MSG_RESULT(yes) | |
361 | AC_DEFINE(HAVE_SOCKADDR_LEN)], | |
362 | [ AC_MSG_RESULT(no), | |
363 | ], | |
364 | [ AC_MSG_RESULT(unknown), | |
365 | ]) | |
366 | ||
367 | ||
cd957c70 | 368 | AC_C_BIGENDIAN |
c627d613 | 369 | AC_HEADER_DIRENT |
c627d613 AT |
370 | AC_HEADER_TIME |
371 | AC_HEADER_SYS_WAIT | |
8bf73749 | 372 | AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) |
94481d91 | 373 | AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) |
fdd71e17 | 374 | AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h) |
8ee3d639 | 375 | AC_CHECK_HEADERS(glob.h alloca.h mcheck.h) |
c627d613 AT |
376 | |
377 | AC_CHECK_SIZEOF(int) | |
378 | AC_CHECK_SIZEOF(long) | |
379 | AC_CHECK_SIZEOF(short) | |
380 | ||
381 | AC_C_INLINE | |
382 | ||
383 | AC_TYPE_SIGNAL | |
384 | AC_TYPE_UID_T | |
385 | AC_TYPE_MODE_T | |
386 | AC_TYPE_OFF_T | |
387 | AC_TYPE_SIZE_T | |
388 | AC_TYPE_PID_T | |
9422bb3f | 389 | AC_TYPE_GETGROUPS |
c627d613 | 390 | AC_STRUCT_ST_RDEV |
e2ba16cc | 391 | AC_CHECK_TYPE([ino_t], [unsigned]) |
7ca6e856 | 392 | TYPE_SOCKLEN_T |
c627d613 | 393 | |
7b3d4257 | 394 | AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [ |
7597e1a9 | 395 | AC_TRY_COMPILE([#include <errno.h>],[int i = errno], |
7b3d4257 AT |
396 | rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)]) |
397 | if test x"$rsync_cv_errno" = x"yes"; then | |
d4e4cbe1 | 398 | AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ]) |
7597e1a9 | 399 | fi |
c627d613 | 400 | |
a784e10d DD |
401 | # The following test taken from the cvs sources |
402 | # If we can't find connect, try looking in -lsocket, -lnsl, and -linet. | |
403 | # These need checks to be before checks for any other functions that | |
404 | # might be in the same libraries. | |
405 | # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has | |
406 | # libsocket.so which has a bad implementation of gethostbyname (it | |
407 | # only looks in /etc/hosts), so we only look for -lsocket if we need | |
408 | # it. | |
409 | AC_CHECK_FUNCS(connect) | |
410 | if test x"$ac_cv_func_connect" = x"no"; then | |
411 | case "$LIBS" in | |
412 | *-lnsl*) ;; | |
413 | *) AC_CHECK_LIB(nsl_s, printf) ;; | |
414 | esac | |
415 | case "$LIBS" in | |
416 | *-lnsl*) ;; | |
417 | *) AC_CHECK_LIB(nsl, printf) ;; | |
418 | esac | |
419 | case "$LIBS" in | |
420 | *-lsocket*) ;; | |
421 | *) AC_CHECK_LIB(socket, connect) ;; | |
422 | esac | |
423 | case "$LIBS" in | |
424 | *-linet*) ;; | |
425 | *) AC_CHECK_LIB(inet, connect) ;; | |
426 | esac | |
427 | dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value | |
428 | dnl has been cached. | |
429 | if test x"$ac_cv_lib_socket_connect" = x"yes" || | |
430 | test x"$ac_cv_lib_inet_connect" = x"yes"; then | |
431 | # ac_cv_func_connect=yes | |
432 | # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run | |
d4e4cbe1 | 433 | AC_DEFINE(HAVE_CONNECT, 1, [ ]) |
a784e10d DD |
434 | fi |
435 | fi | |
436 | ||
437 | # | |
438 | # if we can't find strcasecmp, look in -lresolv (for Unixware at least) | |
439 | # | |
440 | AC_CHECK_FUNCS(strcasecmp) | |
441 | if test x"$ac_cv_func_strcasecmp" = x"no"; then | |
442 | AC_CHECK_LIB(resolv, strcasecmp) | |
443 | fi | |
444 | ||
c627d613 | 445 | AC_FUNC_MEMCMP |
c627d613 | 446 | AC_FUNC_UTIME_NULL |
e68f3481 | 447 | AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod) |
e0414f42 | 448 | AC_CHECK_FUNCS(fchmod fstat strchr readlink link utime utimes strftime) |
8950ac03 | 449 | AC_CHECK_FUNCS(memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk) |
8ee3d639 | 450 | AC_CHECK_FUNCS(strlcat strlcpy mtrace) |
24c857f1 DD |
451 | |
452 | AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ | |
453 | AC_TRY_RUN([#include <sys/types.h> | |
454 | #include <sys/socket.h> | |
455 | main() { | |
456 | int fd[2]; | |
457 | exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); | |
458 | }], | |
459 | rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) | |
460 | if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then | |
d4e4cbe1 | 461 | AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ]) |
24c857f1 | 462 | fi |
c627d613 | 463 | |
79fc6bdb | 464 | AC_CACHE_CHECK([for working fnmatch],rsync_cv_HAVE_FNMATCH,[ |
c627d613 | 465 | AC_TRY_RUN([#include <fnmatch.h> |
e7d6e0aa AT |
466 | main() { exit((fnmatch("*.o", "x.o", FNM_PATHNAME) == 0 && |
467 | fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME) != 0) ? 0: 1); }], | |
79fc6bdb DD |
468 | rsync_cv_HAVE_FNMATCH=yes,rsync_cv_HAVE_FNMATCH=no,rsync_cv_HAVE_FNMATCH=cross)]) |
469 | if test x"$rsync_cv_HAVE_FNMATCH" = x"yes"; then | |
d4e4cbe1 | 470 | AC_DEFINE(HAVE_FNMATCH, 1, [ ]) |
79fc6bdb DD |
471 | fi |
472 | ||
1ac15cd8 MP |
473 | if test x"$with_included_popt" != x"yes" |
474 | then | |
475 | AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) | |
476 | fi | |
2d1ebe9c | 477 | |
12458878 | 478 | AC_MSG_CHECKING([whether to use included libpopt]) |
2d1ebe9c MP |
479 | if test x"$with_included_popt" = x"yes" |
480 | then | |
12458878 | 481 | AC_MSG_RESULT($srcdir/popt) |
1ac15cd8 | 482 | BUILD_POPT='$(popt_OBJS)' |
26ef00bd | 483 | CFLAGS="$CFLAGS -I$srcdir/popt" |
2d1ebe9c MP |
484 | else |
485 | AC_MSG_RESULT(no) | |
79fc6bdb | 486 | fi |
c627d613 | 487 | |
79fc6bdb | 488 | AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[ |
0d0e2e93 | 489 | AC_TRY_RUN([#include <stdio.h> |
efb2f6bf | 490 | main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }], |
79fc6bdb DD |
491 | rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)]) |
492 | if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then | |
d4e4cbe1 | 493 | AC_DEFINE(HAVE_LONGLONG, 1, [ ]) |
7597e1a9 | 494 | fi |
0d0e2e93 | 495 | |
7b3d4257 | 496 | AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[ |
bcacc18b AT |
497 | AC_TRY_RUN([#include <stdio.h> |
498 | #include <sys/stat.h> | |
7597e1a9 | 499 | 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 |
500 | rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)]) |
501 | if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then | |
d4e4cbe1 | 502 | AC_DEFINE(HAVE_OFF64_T, 1, [ ]) |
7597e1a9 | 503 | fi |
debb4505 | 504 | |
79fc6bdb | 505 | AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[ |
c29ee43d AT |
506 | AC_TRY_RUN([#include <stdio.h> |
507 | #include <sys/types.h> | |
508 | #include <sys/stat.h> | |
509 | main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }], | |
79fc6bdb DD |
510 | rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)]) |
511 | if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then | |
d4e4cbe1 | 512 | AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ]) |
79fc6bdb | 513 | fi |
c29ee43d | 514 | |
7b3d4257 | 515 | AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[ |
debb4505 AT |
516 | AC_TRY_RUN([#include <stdio.h> |
517 | main() { char c; c=250; exit((c > 0)?0:1); }], | |
7b3d4257 AT |
518 | rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)]) |
519 | if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then | |
d4e4cbe1 | 520 | AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ]) |
7597e1a9 | 521 | fi |
bcacc18b | 522 | |
7b3d4257 | 523 | AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ |
59503278 AT |
524 | AC_TRY_RUN([#include <sys/types.h> |
525 | #include <dirent.h> | |
526 | main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); | |
527 | if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && | |
7597e1a9 | 528 | di->d_name[0] == 0) exit(0); exit(1);} ], |
7b3d4257 AT |
529 | rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) |
530 | if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then | |
d4e4cbe1 | 531 | AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ]) |
7597e1a9 | 532 | fi |
1e9f155a | 533 | |
7b3d4257 | 534 | AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[ |
d6e6ecbd AT |
535 | AC_TRY_COMPILE([#include <sys/types.h> |
536 | #include <utime.h>], | |
7597e1a9 | 537 | [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));], |
7b3d4257 AT |
538 | rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)]) |
539 | if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then | |
d4e4cbe1 | 540 | AC_DEFINE(HAVE_UTIMBUF, 1, [ ]) |
7597e1a9 | 541 | fi |
d6e6ecbd | 542 | |
3060d4aa AT |
543 | AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ |
544 | AC_TRY_RUN([ | |
545 | #include <sys/time.h> | |
546 | #include <unistd.h> | |
547 | main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}], | |
548 | rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)]) | |
549 | if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then | |
d4e4cbe1 | 550 | AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ]) |
3060d4aa AT |
551 | fi |
552 | ||
8950ac03 AT |
553 | AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |
554 | AC_TRY_RUN([ | |
555 | #include <sys/types.h> | |
556 | #include <stdarg.h> | |
557 | void foo(const char *format, ...) { | |
558 | va_list ap; | |
559 | int len; | |
560 | char buf[5]; | |
561 | ||
562 | va_start(ap, format); | |
563 | len = vsnprintf(0, 0, format, ap); | |
564 | va_end(ap); | |
565 | if (len != 5) exit(1); | |
566 | ||
567 | if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); | |
568 | ||
569 | exit(0); | |
570 | } | |
571 | main() { foo("hello"); } | |
572 | ], | |
573 | rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) | |
574 | if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then | |
d4e4cbe1 | 575 | AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) |
8950ac03 AT |
576 | fi |
577 | ||
578 | ||
f62c17e3 AT |
579 | AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ |
580 | AC_TRY_RUN([#include <stdlib.h> | |
581 | #include <sys/types.h> | |
582 | #include <sys/stat.h> | |
583 | #include <unistd.h> | |
584 | main() { | |
585 | struct stat st; | |
586 | char tpl[20]="/tmp/test.XXXXXX"; | |
587 | int fd = mkstemp(tpl); | |
588 | if (fd == -1) exit(1); | |
589 | unlink(tpl); | |
590 | if (fstat(fd, &st) != 0) exit(1); | |
591 | if ((st.st_mode & 0777) != 0600) exit(1); | |
592 | exit(0); | |
593 | }], | |
594 | rsync_cv_HAVE_SECURE_MKSTEMP=yes, | |
595 | rsync_cv_HAVE_SECURE_MKSTEMP=no, | |
596 | rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) | |
597 | if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then | |
d4e4cbe1 | 598 | AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ]) |
f62c17e3 AT |
599 | fi |
600 | ||
3060d4aa | 601 | |
7b3d4257 AT |
602 | AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[ |
603 | AC_TRY_RUN([ | |
604 | #include <stdio.h> | |
605 | #include <sys/types.h> | |
606 | #include <netinet/in.h> | |
607 | #include <arpa/inet.h> | |
608 | main() { struct in_addr ip; ip.s_addr = 0x12345678; | |
609 | if (strcmp(inet_ntoa(ip),"18.52.86.120") && | |
fca3ef06 AT |
610 | strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); } |
611 | exit(0);}], | |
612 | rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)]) | |
7b3d4257 | 613 | if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then |
d4e4cbe1 | 614 | AC_DEFINE(REPLACE_INET_NTOA, 1, [ ]) |
7b3d4257 AT |
615 | fi |
616 | ||
fca3ef06 AT |
617 | |
618 | AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[ | |
619 | AC_TRY_RUN([ | |
620 | #include <stdio.h> | |
621 | #include <sys/types.h> | |
622 | #include <netinet/in.h> | |
623 | #include <arpa/inet.h> | |
624 | main() { struct in_addr ip; | |
625 | if (inet_aton("example", &ip) == 0) exit(0); exit(1);}], | |
626 | rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)]) | |
627 | if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then | |
d4e4cbe1 | 628 | AC_DEFINE(REPLACE_INET_ATON, 1, [ ]) |
fca3ef06 AT |
629 | fi |
630 | ||
692da0b5 DD |
631 | # |
632 | # The following test was mostly taken from the tcl/tk plus patches | |
633 | # | |
79fc6bdb | 634 | AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[ |
692da0b5 DD |
635 | rm -rf conftest* |
636 | cat > conftest.$ac_ext <<EOF | |
637 | int main() { return 0; } | |
638 | EOF | |
639 | ${CC-cc} -c -o conftest..o conftest.$ac_ext | |
640 | if test -f conftest..o; then | |
79fc6bdb DD |
641 | rsync_cv_DASHC_WORKS_WITH_DASHO=yes |
642 | else | |
643 | rsync_cv_DASHC_WORKS_WITH_DASHO=no | |
644 | fi | |
645 | rm -rf conftest* | |
646 | ]) | |
647 | if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then | |
692da0b5 DD |
648 | OBJ_SAVE="#" |
649 | OBJ_RESTORE="#" | |
650 | CC_SHOBJ_FLAG='-o $@' | |
692da0b5 DD |
651 | else |
652 | OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;' | |
653 | 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' | |
654 | CC_SHOBJ_FLAG="" | |
692da0b5 | 655 | fi |
79fc6bdb | 656 | |
692da0b5 DD |
657 | AC_SUBST(OBJ_SAVE) |
658 | AC_SUBST(OBJ_RESTORE) | |
659 | AC_SUBST(CC_SHOBJ_FLAG) | |
1ac15cd8 | 660 | AC_SUBST(BUILD_POPT) |
7d29d4ba | 661 | |
d2e02b7d | 662 | AC_OUTPUT(Makefile lib/dummy zlib/dummy popt/dummy shconfig) |