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 | |
56901bc7 | 18 | RSYNC_VERSION=2.4.7pre3 |
a358449a MP |
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 | ||
06963d0f MP |
93 | ipv6type=unknown |
94 | ipv6lib=none | |
22cd0063 | 95 | ipv6trylibc=yes |
06963d0f | 96 | |
06963d0f MP |
97 | AC_MSG_CHECKING([ipv6 stack type]) |
98 | for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do | |
99 | case $i in | |
100 | inria) | |
101 | # http://www.kame.net/ | |
102 | AC_EGREP_CPP(yes, [ | |
103 | #include <netinet/in.h> | |
104 | #ifdef IPV6_INRIA_VERSION | |
105 | yes | |
106 | #endif], | |
107 | [ipv6type=$i; | |
a358449a MP |
108 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
109 | ]) | |
06963d0f MP |
110 | ;; |
111 | kame) | |
112 | # http://www.kame.net/ | |
113 | AC_EGREP_CPP(yes, [ | |
114 | #include <netinet/in.h> | |
115 | #ifdef __KAME__ | |
116 | yes | |
117 | #endif], | |
a358449a MP |
118 | [ipv6type=$i; |
119 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) | |
06963d0f MP |
120 | ;; |
121 | linux-glibc) | |
122 | # http://www.v6.linux.or.jp/ | |
123 | AC_EGREP_CPP(yes, [ | |
124 | #include <features.h> | |
125 | #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 | |
126 | yes | |
127 | #endif], | |
128 | [ipv6type=$i; | |
a358449a | 129 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
130 | ;; |
131 | linux-inet6) | |
132 | # http://www.v6.linux.or.jp/ | |
133 | if test -d /usr/inet6 -o -f /usr/inet6/lib/libinet6.a; then | |
134 | ipv6type=$i | |
135 | ipv6lib=inet6 | |
136 | ipv6libdir=/usr/inet6/lib | |
137 | ipv6trylibc=yes; | |
a358449a MP |
138 | AC_DEFINE(INET6, 1, [true if you have IPv6]) |
139 | CFLAGS="-I/usr/inet6/include $CFLAGS" | |
06963d0f MP |
140 | fi |
141 | ;; | |
142 | toshiba) | |
143 | AC_EGREP_CPP(yes, [ | |
144 | #include <sys/param.h> | |
145 | #ifdef _TOSHIBA_INET6 | |
146 | yes | |
147 | #endif], | |
148 | [ipv6type=$i; | |
149 | ipv6lib=inet6; | |
150 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 151 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
152 | ;; |
153 | v6d) | |
154 | AC_EGREP_CPP(yes, [ | |
155 | #include </usr/local/v6/include/sys/v6config.h> | |
156 | #ifdef __V6D__ | |
157 | yes | |
158 | #endif], | |
159 | [ipv6type=$i; | |
160 | ipv6lib=v6; | |
161 | ipv6libdir=/usr/local/v6/lib; | |
a358449a | 162 | AC_DEFINE(INET6, 1, [true if you have IPv6])]) |
06963d0f MP |
163 | ;; |
164 | zeta) | |
165 | AC_EGREP_CPP(yes, [ | |
166 | #include <sys/param.h> | |
167 | #ifdef _ZETA_MINAMI_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 | esac | |
176 | if test "$ipv6type" != "unknown"; then | |
177 | break | |
178 | fi | |
179 | done | |
180 | AC_MSG_RESULT($ipv6type) | |
06963d0f | 181 | |
22cd0063 | 182 | AC_SEARCH_LIBS(getaddrinfo, inet6) |
06963d0f | 183 | |
cd957c70 | 184 | AC_C_BIGENDIAN |
c627d613 | 185 | AC_HEADER_DIRENT |
c627d613 AT |
186 | AC_HEADER_TIME |
187 | AC_HEADER_SYS_WAIT | |
8bf73749 | 188 | AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h unistd.h utime.h grp.h) |
94481d91 | 189 | AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h) |
fdd71e17 | 190 | AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h) |
9dec7aa9 | 191 | AC_CHECK_HEADERS(glob.h alloca.h mcheck.h sys/sysctl.h arpa/inet.h arpa/nameser.h) |
15c17078 | 192 | AC_CHECK_HEADERS(netdb.h) |
c627d613 AT |
193 | |
194 | AC_CHECK_SIZEOF(int) | |
195 | AC_CHECK_SIZEOF(long) | |
196 | AC_CHECK_SIZEOF(short) | |
197 | ||
198 | AC_C_INLINE | |
199 | ||
200 | AC_TYPE_SIGNAL | |
201 | AC_TYPE_UID_T | |
202 | AC_TYPE_MODE_T | |
203 | AC_TYPE_OFF_T | |
204 | AC_TYPE_SIZE_T | |
205 | AC_TYPE_PID_T | |
9422bb3f | 206 | AC_TYPE_GETGROUPS |
bf5c2bf6 MP |
207 | AC_CHECK_MEMBERS([struct stat.st_rdev]) |
208 | ||
e2ba16cc | 209 | AC_CHECK_TYPE([ino_t], [unsigned]) |
7ca6e856 | 210 | TYPE_SOCKLEN_T |
c627d613 | 211 | |
7b3d4257 | 212 | AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [ |
7597e1a9 | 213 | AC_TRY_COMPILE([#include <errno.h>],[int i = errno], |
7b3d4257 AT |
214 | rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)]) |
215 | if test x"$rsync_cv_errno" = x"yes"; then | |
d4e4cbe1 | 216 | AC_DEFINE(HAVE_ERRNO_DECL, 1, [ ]) |
7597e1a9 | 217 | fi |
c627d613 | 218 | |
a784e10d DD |
219 | # The following test taken from the cvs sources |
220 | # If we can't find connect, try looking in -lsocket, -lnsl, and -linet. | |
221 | # These need checks to be before checks for any other functions that | |
222 | # might be in the same libraries. | |
223 | # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has | |
224 | # libsocket.so which has a bad implementation of gethostbyname (it | |
225 | # only looks in /etc/hosts), so we only look for -lsocket if we need | |
226 | # it. | |
227 | AC_CHECK_FUNCS(connect) | |
228 | if test x"$ac_cv_func_connect" = x"no"; then | |
229 | case "$LIBS" in | |
230 | *-lnsl*) ;; | |
231 | *) AC_CHECK_LIB(nsl_s, printf) ;; | |
232 | esac | |
233 | case "$LIBS" in | |
234 | *-lnsl*) ;; | |
235 | *) AC_CHECK_LIB(nsl, printf) ;; | |
236 | esac | |
237 | case "$LIBS" in | |
238 | *-lsocket*) ;; | |
239 | *) AC_CHECK_LIB(socket, connect) ;; | |
240 | esac | |
241 | case "$LIBS" in | |
242 | *-linet*) ;; | |
243 | *) AC_CHECK_LIB(inet, connect) ;; | |
244 | esac | |
245 | dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value | |
246 | dnl has been cached. | |
247 | if test x"$ac_cv_lib_socket_connect" = x"yes" || | |
248 | test x"$ac_cv_lib_inet_connect" = x"yes"; then | |
249 | # ac_cv_func_connect=yes | |
250 | # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run | |
d4e4cbe1 | 251 | AC_DEFINE(HAVE_CONNECT, 1, [ ]) |
a784e10d DD |
252 | fi |
253 | fi | |
254 | ||
8f694072 MP |
255 | AC_CHECK_LIB(resolv, inet_ntop) |
256 | ||
a037edac | 257 | AC_MSG_NOTICE([Looking in libraries: $LIBS]) |
e94989fe MP |
258 | |
259 | AC_CHECK_FUNC(inet_ntop, , AC_LIBOBJ(lib/inet_ntop)) | |
260 | AC_CHECK_FUNC(inet_pton, , AC_LIBOBJ(lib/inet_pton)) | |
356bbb83 | 261 | |
82923068 MP |
262 | AC_CHECK_FUNC(getaddrinfo, , AC_LIBOBJ(lib/getaddrinfo)) |
263 | AC_CHECK_FUNC(getnameinfo, , AC_LIBOBJ(lib/getnameinfo)) | |
264 | ||
356bbb83 MP |
265 | AC_CHECK_MEMBER([struct sockaddr.sa_len], |
266 | [ AC_DEFINE(HAVE_SOCKADDR_LEN) ], | |
267 | [], | |
268 | [ | |
269 | #include <sys/types.h> | |
270 | #include <sys/socket.h> | |
271 | ]) | |
272 | ||
a784e10d DD |
273 | # if we can't find strcasecmp, look in -lresolv (for Unixware at least) |
274 | # | |
275 | AC_CHECK_FUNCS(strcasecmp) | |
276 | if test x"$ac_cv_func_strcasecmp" = x"no"; then | |
277 | AC_CHECK_LIB(resolv, strcasecmp) | |
278 | fi | |
279 | ||
c627d613 | 280 | AC_FUNC_MEMCMP |
c627d613 | 281 | AC_FUNC_UTIME_NULL |
e68f3481 | 282 | AC_CHECK_FUNCS(waitpid wait4 getcwd strdup strerror chown chmod mknod) |
e0414f42 | 283 | AC_CHECK_FUNCS(fchmod fstat strchr readlink link utime utimes strftime) |
8950ac03 | 284 | AC_CHECK_FUNCS(memmove lchown vsnprintf snprintf asprintf setsid glob strpbrk) |
8ee3d639 | 285 | AC_CHECK_FUNCS(strlcat strlcpy mtrace) |
24c857f1 DD |
286 | |
287 | AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[ | |
6a5ef41f MP |
288 | AC_TRY_RUN([ |
289 | #include <sys/types.h> | |
290 | #include <sys/socket.h> | |
291 | ||
292 | main() { | |
293 | int fd[2]; | |
294 | exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1); | |
295 | }], | |
24c857f1 DD |
296 | rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)]) |
297 | if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then | |
d4e4cbe1 | 298 | AC_DEFINE(HAVE_SOCKETPAIR, 1, [ ]) |
24c857f1 | 299 | fi |
c627d613 | 300 | |
79fc6bdb | 301 | AC_CACHE_CHECK([for working fnmatch],rsync_cv_HAVE_FNMATCH,[ |
c627d613 | 302 | AC_TRY_RUN([#include <fnmatch.h> |
e7d6e0aa AT |
303 | main() { exit((fnmatch("*.o", "x.o", FNM_PATHNAME) == 0 && |
304 | fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME) != 0) ? 0: 1); }], | |
79fc6bdb DD |
305 | rsync_cv_HAVE_FNMATCH=yes,rsync_cv_HAVE_FNMATCH=no,rsync_cv_HAVE_FNMATCH=cross)]) |
306 | if test x"$rsync_cv_HAVE_FNMATCH" = x"yes"; then | |
d4e4cbe1 | 307 | AC_DEFINE(HAVE_FNMATCH, 1, [ ]) |
79fc6bdb DD |
308 | fi |
309 | ||
1ac15cd8 MP |
310 | if test x"$with_included_popt" != x"yes" |
311 | then | |
312 | AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes]) | |
313 | fi | |
2d1ebe9c | 314 | |
12458878 | 315 | AC_MSG_CHECKING([whether to use included libpopt]) |
2d1ebe9c MP |
316 | if test x"$with_included_popt" = x"yes" |
317 | then | |
12458878 | 318 | AC_MSG_RESULT($srcdir/popt) |
1ac15cd8 | 319 | BUILD_POPT='$(popt_OBJS)' |
26ef00bd | 320 | CFLAGS="$CFLAGS -I$srcdir/popt" |
2d1ebe9c MP |
321 | else |
322 | AC_MSG_RESULT(no) | |
79fc6bdb | 323 | fi |
c627d613 | 324 | |
79fc6bdb | 325 | AC_CACHE_CHECK([for long long],rsync_cv_HAVE_LONGLONG,[ |
0d0e2e93 | 326 | AC_TRY_RUN([#include <stdio.h> |
efb2f6bf | 327 | main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }], |
79fc6bdb DD |
328 | rsync_cv_HAVE_LONGLONG=yes,rsync_cv_HAVE_LONGLONG=no,rsync_cv_HAVE_LONGLONG=cross)]) |
329 | if test x"$rsync_cv_HAVE_LONGLONG" = x"yes"; then | |
d4e4cbe1 | 330 | AC_DEFINE(HAVE_LONGLONG, 1, [ ]) |
7597e1a9 | 331 | fi |
0d0e2e93 | 332 | |
7b3d4257 | 333 | AC_CACHE_CHECK([for off64_t],rsync_cv_HAVE_OFF64_T,[ |
bcacc18b AT |
334 | AC_TRY_RUN([#include <stdio.h> |
335 | #include <sys/stat.h> | |
7597e1a9 | 336 | 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 |
337 | rsync_cv_HAVE_OFF64_T=yes,rsync_cv_HAVE_OFF64_T=no,rsync_cv_HAVE_OFF64_T=cross)]) |
338 | if test x"$rsync_cv_HAVE_OFF64_T" = x"yes"; then | |
d4e4cbe1 | 339 | AC_DEFINE(HAVE_OFF64_T, 1, [ ]) |
7597e1a9 | 340 | fi |
debb4505 | 341 | |
79fc6bdb | 342 | AC_CACHE_CHECK([for short ino_t],rsync_cv_HAVE_SHORT_INO_T,[ |
c29ee43d AT |
343 | AC_TRY_RUN([#include <stdio.h> |
344 | #include <sys/types.h> | |
345 | #include <sys/stat.h> | |
346 | main() { if (sizeof(ino_t) < sizeof(unsigned int)) return 0; return 1; }], | |
79fc6bdb DD |
347 | rsync_cv_HAVE_SHORT_INO_T=yes,rsync_cv_HAVE_SHORT_INO_T=no,rsync_cv_HAVE_SHORT_INO_T=cross)]) |
348 | if test x"$rsync_cv_HAVE_SHORT_INO_T" = x"yes"; then | |
d4e4cbe1 | 349 | AC_DEFINE(HAVE_SHORT_INO_T, 1, [ ]) |
79fc6bdb | 350 | fi |
c29ee43d | 351 | |
7b3d4257 | 352 | AC_CACHE_CHECK([for unsigned char],rsync_cv_HAVE_UNSIGNED_CHAR,[ |
debb4505 AT |
353 | AC_TRY_RUN([#include <stdio.h> |
354 | main() { char c; c=250; exit((c > 0)?0:1); }], | |
7b3d4257 AT |
355 | rsync_cv_HAVE_UNSIGNED_CHAR=yes,rsync_cv_HAVE_UNSIGNED_CHAR=no,rsync_cv_HAVE_UNSIGNED_CHAR=cross)]) |
356 | if test x"$rsync_cv_HAVE_UNSIGNED_CHAR" = x"yes"; then | |
d4e4cbe1 | 357 | AC_DEFINE(HAVE_UNSIGNED_CHAR, 1, [ ]) |
7597e1a9 | 358 | fi |
bcacc18b | 359 | |
7b3d4257 | 360 | AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[ |
59503278 AT |
361 | AC_TRY_RUN([#include <sys/types.h> |
362 | #include <dirent.h> | |
363 | main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d); | |
364 | if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 && | |
7597e1a9 | 365 | di->d_name[0] == 0) exit(0); exit(1);} ], |
7b3d4257 AT |
366 | rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)]) |
367 | if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then | |
d4e4cbe1 | 368 | AC_DEFINE(HAVE_BROKEN_READDIR, 1, [ ]) |
7597e1a9 | 369 | fi |
1e9f155a | 370 | |
7b3d4257 | 371 | AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_UTIMBUF,[ |
d6e6ecbd AT |
372 | AC_TRY_COMPILE([#include <sys/types.h> |
373 | #include <utime.h>], | |
7597e1a9 | 374 | [struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));], |
7b3d4257 AT |
375 | rsync_cv_HAVE_UTIMBUF=yes,rsync_cv_HAVE_UTIMBUF=no,rsync_cv_HAVE_UTIMBUF=cross)]) |
376 | if test x"$rsync_cv_HAVE_UTIMBUF" = x"yes"; then | |
d4e4cbe1 | 377 | AC_DEFINE(HAVE_UTIMBUF, 1, [ ]) |
7597e1a9 | 378 | fi |
d6e6ecbd | 379 | |
3060d4aa AT |
380 | AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[ |
381 | AC_TRY_RUN([ | |
382 | #include <sys/time.h> | |
383 | #include <unistd.h> | |
384 | main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}], | |
385 | rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no,rsync_cv_HAVE_GETTIMEOFDAY_TZ=cross)]) | |
386 | if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" = x"yes"; then | |
d4e4cbe1 | 387 | AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [ ]) |
3060d4aa AT |
388 | fi |
389 | ||
8950ac03 AT |
390 | AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |
391 | AC_TRY_RUN([ | |
392 | #include <sys/types.h> | |
393 | #include <stdarg.h> | |
394 | void foo(const char *format, ...) { | |
395 | va_list ap; | |
396 | int len; | |
397 | char buf[5]; | |
398 | ||
399 | va_start(ap, format); | |
400 | len = vsnprintf(0, 0, format, ap); | |
401 | va_end(ap); | |
402 | if (len != 5) exit(1); | |
403 | ||
404 | if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1); | |
405 | ||
406 | exit(0); | |
407 | } | |
408 | main() { foo("hello"); } | |
409 | ], | |
410 | rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)]) | |
411 | if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then | |
d4e4cbe1 | 412 | AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [ ]) |
8950ac03 AT |
413 | fi |
414 | ||
415 | ||
f62c17e3 AT |
416 | AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[ |
417 | AC_TRY_RUN([#include <stdlib.h> | |
418 | #include <sys/types.h> | |
419 | #include <sys/stat.h> | |
420 | #include <unistd.h> | |
421 | main() { | |
422 | struct stat st; | |
423 | char tpl[20]="/tmp/test.XXXXXX"; | |
424 | int fd = mkstemp(tpl); | |
425 | if (fd == -1) exit(1); | |
426 | unlink(tpl); | |
427 | if (fstat(fd, &st) != 0) exit(1); | |
428 | if ((st.st_mode & 0777) != 0600) exit(1); | |
429 | exit(0); | |
430 | }], | |
431 | rsync_cv_HAVE_SECURE_MKSTEMP=yes, | |
432 | rsync_cv_HAVE_SECURE_MKSTEMP=no, | |
433 | rsync_cv_HAVE_SECURE_MKSTEMP=cross)]) | |
434 | if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then | |
d4e4cbe1 | 435 | AC_DEFINE(HAVE_SECURE_MKSTEMP, 1, [ ]) |
f62c17e3 AT |
436 | fi |
437 | ||
3060d4aa | 438 | |
7b3d4257 AT |
439 | AC_CACHE_CHECK([for broken inet_ntoa],rsync_cv_REPLACE_INET_NTOA,[ |
440 | AC_TRY_RUN([ | |
441 | #include <stdio.h> | |
442 | #include <sys/types.h> | |
443 | #include <netinet/in.h> | |
444 | #include <arpa/inet.h> | |
445 | main() { struct in_addr ip; ip.s_addr = 0x12345678; | |
446 | if (strcmp(inet_ntoa(ip),"18.52.86.120") && | |
fca3ef06 AT |
447 | strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(1); } |
448 | exit(0);}], | |
449 | rsync_cv_REPLACE_INET_NTOA=no,rsync_cv_REPLACE_INET_NTOA=yes,rsync_cv_REPLACE_INET_NTOA=cross)]) | |
7b3d4257 | 450 | if test x"$rsync_cv_REPLACE_INET_NTOA" = x"yes"; then |
d4e4cbe1 | 451 | AC_DEFINE(REPLACE_INET_NTOA, 1, [ ]) |
7b3d4257 AT |
452 | fi |
453 | ||
fca3ef06 AT |
454 | |
455 | AC_CACHE_CHECK([for broken inet_aton],rsync_cv_REPLACE_INET_ATON,[ | |
456 | AC_TRY_RUN([ | |
457 | #include <stdio.h> | |
458 | #include <sys/types.h> | |
459 | #include <netinet/in.h> | |
460 | #include <arpa/inet.h> | |
461 | main() { struct in_addr ip; | |
462 | if (inet_aton("example", &ip) == 0) exit(0); exit(1);}], | |
463 | rsync_cv_REPLACE_INET_ATON=no,rsync_cv_REPLACE_INET_ATON=yes,rsync_cv_REPLACE_INET_ATON=cross)]) | |
464 | if test x"$rsync_cv_REPLACE_INET_ATON" = x"yes"; then | |
d4e4cbe1 | 465 | AC_DEFINE(REPLACE_INET_ATON, 1, [ ]) |
fca3ef06 AT |
466 | fi |
467 | ||
692da0b5 DD |
468 | # |
469 | # The following test was mostly taken from the tcl/tk plus patches | |
470 | # | |
79fc6bdb | 471 | AC_CACHE_CHECK([whether -c -o works],rsync_cv_DASHC_WORKS_WITH_DASHO,[ |
692da0b5 DD |
472 | rm -rf conftest* |
473 | cat > conftest.$ac_ext <<EOF | |
474 | int main() { return 0; } | |
475 | EOF | |
476 | ${CC-cc} -c -o conftest..o conftest.$ac_ext | |
477 | if test -f conftest..o; then | |
79fc6bdb DD |
478 | rsync_cv_DASHC_WORKS_WITH_DASHO=yes |
479 | else | |
480 | rsync_cv_DASHC_WORKS_WITH_DASHO=no | |
481 | fi | |
482 | rm -rf conftest* | |
483 | ]) | |
484 | if test x"$rsync_cv_DASHC_WORKS_WITH_DASHO" = x"yes"; then | |
692da0b5 DD |
485 | OBJ_SAVE="#" |
486 | OBJ_RESTORE="#" | |
487 | CC_SHOBJ_FLAG='-o $@' | |
692da0b5 DD |
488 | else |
489 | OBJ_SAVE=' @b=`basename $@ .o`;rm -f $$b.o.sav;if test -f $$b.o; then mv $$b.o $$b.o.sav;fi;' | |
490 | 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' | |
491 | CC_SHOBJ_FLAG="" | |
692da0b5 | 492 | fi |
79fc6bdb | 493 | |
692da0b5 DD |
494 | AC_SUBST(OBJ_SAVE) |
495 | AC_SUBST(OBJ_RESTORE) | |
496 | AC_SUBST(CC_SHOBJ_FLAG) | |
1ac15cd8 | 497 | AC_SUBST(BUILD_POPT) |
7d29d4ba | 498 | |
bf5c2bf6 MP |
499 | AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig]) |
500 | AC_OUTPUT |