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