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