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