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