]>
Commit | Line | Data |
---|---|---|
ae1912cb DS |
1 | dnl $Id$ |
2 | dnl Process this file with autoconf to produce a configure script. | |
93c53424 DS |
3 | AC_INIT |
4 | AC_CONFIG_SRCDIR([lib/urldata.h]) | |
f6163b37 | 5 | AM_CONFIG_HEADER(config.h src/config.h) |
8f5ffd94 | 6 | |
784f57f9 | 7 | VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h` |
8f5ffd94 | 8 | AM_INIT_AUTOMAKE(curl,$VERSION) |
caf8c01e | 9 | |
1e5e0f9a DS |
10 | dnl |
11 | dnl we extract the numerical version for curl-config only | |
12 | VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h` | |
13 | AC_SUBST(VERSIONNUM) | |
14 | ||
c503930b CB |
15 | dnl Solaris pkgadd support definitions |
16 | PKGADD_PKG="HAXXcurl" | |
17 | PKGADD_NAME="cURL - a client that groks URLs" | |
18 | PKGADD_VENDOR="curl.haxx.se" | |
19 | AC_SUBST(PKGADD_PKG) | |
20 | AC_SUBST(PKGADD_NAME) | |
21 | AC_SUBST(PKGADD_VENDOR) | |
22 | ||
23 | ||
caf8c01e DS |
24 | dnl |
25 | dnl Detect the canonical host and target build environment | |
26 | dnl | |
ae1912cb | 27 | |
c77f77a1 | 28 | AC_CANONICAL_HOST |
93c53424 DS |
29 | dnl Get system canonical name |
30 | AC_DEFINE_UNQUOTED(OS, "${host}") | |
1b1f143c DS |
31 | |
32 | dnl Check for AIX weirdos | |
33 | AC_AIX | |
34 | ||
93c53424 DS |
35 | dnl Checks for programs. |
36 | AC_PROG_CC | |
37 | ||
d4ffc5ef | 38 | dnl check for how to do large files |
1b1f143c | 39 | AC_SYS_LARGEFILE |
d4ffc5ef | 40 | |
93c53424 DS |
41 | AM_PROG_LIBTOOL |
42 | ||
d1a1fcc6 DS |
43 | dnl The install stuff has already been taken care of by the automake stuff |
44 | dnl AC_PROG_INSTALL | |
ae1912cb DS |
45 | AC_PROG_MAKE_SET |
46 | ||
572c29a4 DS |
47 | dnl ************************************************************ |
48 | dnl lame option to switch on debug options | |
49 | dnl | |
50 | AC_MSG_CHECKING([whether to enable debug options]) | |
51 | AC_ARG_ENABLE(debug, | |
52 | [ --enable-debug Enable pedantic debug options | |
53 | --disable-debug Disable debug options], | |
54 | [ case "$enableval" in | |
55 | no) | |
56 | AC_MSG_RESULT(no) | |
57 | ;; | |
58 | *) AC_MSG_RESULT(yes) | |
59 | ||
60 | CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG" | |
61 | CFLAGS="-Wall -pedantic -g" | |
62 | ;; | |
63 | esac ], | |
64 | AC_MSG_RESULT(no) | |
65 | ) | |
c0c02833 | 66 | |
116462a5 DS |
67 | dnl ************************************************************ |
68 | dnl check for "localhost", if it doesn't exist, we can't do the | |
69 | dnl gethostbyname_r tests! | |
70 | dnl | |
c0c02833 | 71 | |
116462a5 DS |
72 | AC_DEFUN(CURL_CHECK_WORKING_RESOLVER,[ |
73 | AC_MSG_CHECKING([if "localhost" resolves]) | |
74 | AC_TRY_RUN([ | |
75 | #include <string.h> | |
76 | #include <sys/types.h> | |
77 | #include <netdb.h> | |
78 | ||
79 | int | |
80 | main () { | |
81 | struct hostent *h; | |
82 | h = gethostbyname("localhost"); | |
83 | exit (h == NULL ? 1 : 0); }],[ | |
84 | AC_MSG_RESULT(yes)],[ | |
85 | AC_MSG_RESULT(no) | |
86 | AC_MSG_ERROR([can't figure out gethostbyname_r() since localhost doesn't resolve]) | |
87 | ||
88 | ] | |
89 | ) | |
90 | ]) | |
91 | ||
92 | dnl ************************************************************ | |
c0c02833 DS |
93 | dnl check for working getaddrinfo() |
94 | dnl | |
95 | AC_DEFUN(CURL_CHECK_WORKING_GETADDRINFO,[ | |
96 | AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[ | |
97 | AC_TRY_RUN( [ | |
c0c02833 | 98 | #include <netdb.h> |
f6e2bfd4 | 99 | #include <sys/types.h> |
c0c02833 | 100 | #include <sys/socket.h> |
c0c02833 DS |
101 | |
102 | void main(void) { | |
103 | struct addrinfo hints, *ai; | |
104 | int error; | |
105 | ||
106 | memset(&hints, 0, sizeof(hints)); | |
107 | hints.ai_family = AF_UNSPEC; | |
108 | hints.ai_socktype = SOCK_STREAM; | |
109 | error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); | |
110 | if (error) { | |
111 | exit(1); | |
112 | } | |
113 | else { | |
114 | exit(0); | |
115 | } | |
116 | } | |
117 | ],[ | |
118 | ac_cv_working_getaddrinfo="yes" | |
119 | ],[ | |
120 | ac_cv_working_getaddrinfo="no" | |
121 | ],[ | |
122 | ac_cv_working_getaddrinfo="yes" | |
123 | ])]) | |
124 | if test "$ac_cv_working_getaddrinfo" = "yes"; then | |
125 | AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works]) | |
126 | AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support]) | |
1ee7f92c DS |
127 | |
128 | IPV6_ENABLED=1 | |
129 | AC_SUBST(IPV6_ENABLED) | |
c0c02833 DS |
130 | fi |
131 | ]) | |
132 | ||
133 | ||
61fb8fea DS |
134 | AC_DEFUN(CURL_CHECK_LOCALTIME_R, |
135 | [ | |
136 | dnl check for a few thread-safe functions | |
137 | AC_CHECK_FUNCS(localtime_r,[ | |
138 | AC_MSG_CHECKING(whether localtime_r is declared) | |
139 | AC_EGREP_CPP(localtime_r,[ | |
140 | #include <time.h>],[ | |
141 | AC_MSG_RESULT(yes)],[ | |
142 | AC_MSG_RESULT(no) | |
143 | AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared) | |
144 | AC_EGREP_CPP(localtime_r,[ | |
145 | #define _REENTRANT | |
146 | #include <time.h>],[ | |
147 | AC_DEFINE(NEED_REENTRANT) | |
148 | AC_MSG_RESULT(yes)], | |
149 | AC_MSG_RESULT(no))])]) | |
150 | ]) | |
151 | ||
152 | AC_DEFUN(CURL_CHECK_INET_NTOA_R, | |
153 | [ | |
154 | dnl determine if function definition for inet_ntoa_r exists. | |
155 | AC_CHECK_FUNCS(inet_ntoa_r,[ | |
156 | AC_MSG_CHECKING(whether inet_ntoa_r is declared) | |
157 | AC_EGREP_CPP(inet_ntoa_r,[ | |
158 | #include <arpa/inet.h>],[ | |
159 | AC_DEFINE(HAVE_INET_NTOA_R_DECL) | |
160 | AC_MSG_RESULT(yes)],[ | |
161 | AC_MSG_RESULT(no) | |
162 | AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared) | |
163 | AC_EGREP_CPP(inet_ntoa_r,[ | |
164 | #define _REENTRANT | |
165 | #include <arpa/inet.h>],[ | |
166 | AC_DEFINE(HAVE_INET_NTOA_R_DECL) | |
167 | AC_DEFINE(NEED_REENTRANT) | |
168 | AC_MSG_RESULT(yes)], | |
169 | AC_MSG_RESULT(no))])]) | |
170 | ||
171 | ]) | |
172 | ||
173 | AC_DEFUN(CURL_CHECK_GETHOSTBYADDR_R, | |
174 | [ | |
175 | dnl check for number of arguments to gethostbyaddr_r. it might take | |
176 | dnl either 5, 7, or 8 arguments. | |
177 | AC_CHECK_FUNCS(gethostbyaddr_r,[ | |
178 | AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments) | |
179 | AC_TRY_COMPILE([ | |
180 | #include <sys/types.h> | |
181 | #include <netdb.h>],[ | |
182 | char * address; | |
183 | int length; | |
184 | int type; | |
185 | struct hostent h; | |
186 | struct hostent_data hdata; | |
187 | int rc; | |
188 | rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ | |
189 | AC_MSG_RESULT(yes) | |
190 | AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) | |
191 | ac_cv_gethostbyaddr_args=5],[ | |
192 | AC_MSG_RESULT(no) | |
193 | AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments) | |
194 | AC_TRY_COMPILE([ | |
195 | #define _REENTRANT | |
196 | #include <sys/types.h> | |
197 | #include <netdb.h>],[ | |
198 | char * address; | |
199 | int length; | |
200 | int type; | |
201 | struct hostent h; | |
202 | struct hostent_data hdata; | |
203 | int rc; | |
204 | rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ | |
205 | AC_MSG_RESULT(yes) | |
206 | AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) | |
207 | AC_DEFINE(NEED_REENTRANT) | |
208 | ac_cv_gethostbyaddr_args=5],[ | |
209 | AC_MSG_RESULT(no) | |
210 | AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments) | |
211 | AC_TRY_COMPILE([ | |
212 | #include <sys/types.h> | |
213 | #include <netdb.h>],[ | |
214 | char * address; | |
215 | int length; | |
216 | int type; | |
217 | struct hostent h; | |
218 | char buffer[8192]; | |
219 | int h_errnop; | |
220 | struct hostent * hp; | |
221 | ||
222 | hp = gethostbyaddr_r(address, length, type, &h, | |
223 | buffer, 8192, &h_errnop);],[ | |
224 | AC_MSG_RESULT(yes) | |
225 | AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) | |
226 | ac_cv_gethostbyaddr_args=7],[ | |
227 | AC_MSG_RESULT(no) | |
228 | AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments) | |
229 | AC_TRY_COMPILE([ | |
230 | #include <sys/types.h> | |
231 | #include <netdb.h>],[ | |
232 | char * address; | |
233 | int length; | |
234 | int type; | |
235 | struct hostent h; | |
236 | char buffer[8192]; | |
237 | int h_errnop; | |
238 | struct hostent * hp; | |
239 | int rc; | |
240 | ||
241 | rc = gethostbyaddr_r(address, length, type, &h, | |
242 | buffer, 8192, &hp, &h_errnop);],[ | |
243 | AC_MSG_RESULT(yes) | |
244 | AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) | |
245 | ac_cv_gethostbyaddr_args=8],[ | |
246 | AC_MSG_RESULT(no) | |
247 | have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])]) | |
248 | ||
249 | ||
250 | ]) | |
251 | ||
252 | AC_DEFUN(CURL_CHECK_GETHOSTBYNAME_R, | |
253 | [ | |
254 | dnl check for number of arguments to gethostbyname_r. it might take | |
255 | dnl either 3, 5, or 6 arguments. | |
256 | AC_CHECK_FUNCS(gethostbyname_r,[ | |
257 | AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments) | |
258 | AC_TRY_RUN([ | |
259 | #include <string.h> | |
260 | #include <sys/types.h> | |
261 | #include <netdb.h> | |
262 | ||
263 | int | |
264 | main () { | |
265 | struct hostent h; | |
266 | struct hostent_data hdata; | |
267 | char *name = "localhost"; | |
268 | int rc; | |
269 | memset(&h, 0, sizeof(struct hostent)); | |
270 | memset(&hdata, 0, sizeof(struct hostent_data)); | |
271 | rc = gethostbyname_r(name, &h, &hdata); | |
272 | exit (rc != 0 ? 1 : 0); }],[ | |
273 | AC_MSG_RESULT(yes) | |
274 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) | |
275 | ac_cv_gethostbyname_args=3],[ | |
276 | AC_MSG_RESULT(no) | |
277 | AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments) | |
278 | AC_TRY_RUN([ | |
279 | #define _REENTRANT | |
280 | ||
281 | #include <string.h> | |
282 | #include <sys/types.h> | |
283 | #include <netdb.h> | |
284 | ||
285 | int | |
286 | main () { | |
287 | struct hostent h; | |
288 | struct hostent_data hdata; | |
289 | char *name = "localhost"; | |
290 | int rc; | |
291 | memset(&h, 0, sizeof(struct hostent)); | |
292 | memset(&hdata, 0, sizeof(struct hostent_data)); | |
293 | rc = gethostbyname_r(name, &h, &hdata); | |
294 | exit (rc != 0 ? 1 : 0); }],[ | |
295 | AC_MSG_RESULT(yes) | |
296 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) | |
297 | AC_DEFINE(NEED_REENTRANT) | |
298 | ac_cv_gethostbyname_args=3],[ | |
299 | AC_MSG_RESULT(no) | |
300 | AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments) | |
301 | AC_TRY_RUN([ | |
302 | #include <sys/types.h> | |
303 | #include <netdb.h> | |
304 | ||
305 | int | |
306 | main () { | |
307 | struct hostent *hp; | |
308 | struct hostent h; | |
309 | char *name = "localhost"; | |
310 | char buffer[8192]; | |
311 | int h_errno; | |
312 | hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno); | |
313 | exit (hp == NULL ? 1 : 0); }],[ | |
314 | AC_MSG_RESULT(yes) | |
315 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) | |
316 | ac_cv_gethostbyname_args=5],[ | |
317 | AC_MSG_RESULT(no) | |
318 | AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments) | |
319 | AC_TRY_RUN([ | |
320 | #include <sys/types.h> | |
321 | #include <netdb.h> | |
322 | ||
323 | int | |
324 | main () { | |
325 | struct hostent h; | |
326 | struct hostent *hp; | |
327 | char *name = "localhost"; | |
328 | char buf[8192]; | |
329 | int rc; | |
330 | int h_errno; | |
331 | rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno); | |
332 | exit (rc != 0 ? 1 : 0); }],[ | |
333 | AC_MSG_RESULT(yes) | |
334 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) | |
335 | ac_cv_gethostbyname_args=6],[ | |
336 | AC_MSG_RESULT(no) | |
337 | have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"], | |
338 | [ac_cv_gethostbyname_args=0])], | |
339 | [ac_cv_gethostbyname_args=0])], | |
340 | [ac_cv_gethostbyname_args=0])], | |
341 | [ac_cv_gethostbyname_args=0])]) | |
342 | ||
ad1abee4 DS |
343 | if test "$ac_cv_func_gethostbyname_r" = "yes"; then |
344 | if test "$ac_cv_gethostbyname_args" = "0"; then | |
345 | dnl there's a gethostbyname_r() function, but we don't know how | |
346 | dnl many arguments it wants! | |
347 | AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()]) | |
348 | fi | |
349 | fi | |
350 | ||
61fb8fea DS |
351 | ]) |
352 | ||
65840f1f DS |
353 | dnl ********************************************************************** |
354 | dnl Checks for IPv6 | |
355 | dnl ********************************************************************** | |
356 | ||
357 | AC_MSG_CHECKING([whether to enable ipv6]) | |
358 | AC_ARG_ENABLE(ipv6, | |
359 | [ --enable-ipv6 Enable ipv6 (with ipv4) support | |
360 | --disable-ipv6 Disable ipv6 support], | |
361 | [ case "$enableval" in | |
362 | no) | |
363 | AC_MSG_RESULT(no) | |
364 | ipv6=no | |
365 | ;; | |
366 | *) AC_MSG_RESULT(yes) | |
65840f1f DS |
367 | ipv6=yes |
368 | ;; | |
369 | esac ], | |
370 | ||
371 | AC_TRY_RUN([ /* is AF_INET6 available? */ | |
372 | #include <sys/types.h> | |
373 | #include <sys/socket.h> | |
374 | main() | |
375 | { | |
376 | if (socket(AF_INET6, SOCK_STREAM, 0) < 0) | |
377 | exit(1); | |
378 | else | |
379 | exit(0); | |
380 | } | |
381 | ], | |
382 | AC_MSG_RESULT(yes) | |
65840f1f DS |
383 | ipv6=yes, |
384 | AC_MSG_RESULT(no) | |
385 | ipv6=no, | |
386 | AC_MSG_RESULT(no) | |
387 | ipv6=no | |
388 | )) | |
ae1912cb | 389 | |
c0c02833 DS |
390 | if test "$ipv6" = "yes"; then |
391 | CURL_CHECK_WORKING_GETADDRINFO | |
392 | fi | |
393 | ||
394 | ||
ae1912cb DS |
395 | dnl ********************************************************************** |
396 | dnl Checks for libraries. | |
397 | dnl ********************************************************************** | |
398 | ||
61fb8fea | 399 | dnl gethostbyname in the nsl lib? |
ae1912cb DS |
400 | AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) |
401 | ||
61fb8fea DS |
402 | if test "$ac_cv_lib_nsl_gethostbyname" != "yes" -a "$ac_cv_func_gethostbyname" != "yes"; then |
403 | dnl gethostbyname in the socket lib? | |
404 | AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(socket, gethostbyname)) | |
405 | fi | |
406 | ||
caf8c01e DS |
407 | dnl At least one system has been identified to require BOTH nsl and |
408 | dnl socket libs to link properly. | |
409 | if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then | |
410 | AC_MSG_CHECKING([trying both nsl and socket libs]) | |
411 | my_ac_save_LIBS=$LIBS | |
412 | LIBS="-lnsl -lsocket $LIBS" | |
413 | AC_TRY_LINK( , | |
414 | [gethostbyname();], | |
415 | my_ac_link_result=success, | |
416 | my_ac_link_result=failure ) | |
417 | ||
418 | if test "$my_ac_link_result" = "failure"; then | |
419 | AC_MSG_RESULT([no]) | |
420 | AC_MSG_ERROR([couldn't find libraries for gethostbyname()]) | |
421 | dnl restore LIBS | |
422 | LIBS=$my_ac_save_LIBS | |
423 | else | |
424 | AC_MSG_RESULT([yes]) | |
425 | fi | |
426 | fi | |
427 | ||
ae1912cb DS |
428 | dnl resolve lib? |
429 | AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp)) | |
430 | ||
b174aeaa DS |
431 | if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then |
432 | AC_CHECK_LIB(resolve, strcasecmp, | |
433 | [LIBS="-lresolve $LIBS"], | |
434 | , | |
435 | -lnsl) | |
436 | fi | |
437 | ||
ae1912cb DS |
438 | dnl socket lib? |
439 | AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect)) | |
440 | ||
441 | dnl ucb lib? | |
442 | AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname)) | |
443 | ||
444 | dnl dl lib? | |
43d0d756 | 445 | AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen)) |
ae1912cb | 446 | |
2ef13230 DS |
447 | dnl ********************************************************************** |
448 | dnl Check for the random seed preferences | |
449 | dnl ********************************************************************** | |
450 | ||
451 | AC_ARG_WITH(egd-socket, | |
452 | [ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname], | |
453 | [ EGD_SOCKET="$withval" ] | |
454 | ) | |
455 | if test -n "$EGD_SOCKET" ; then | |
456 | AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET") | |
457 | fi | |
458 | ||
459 | dnl Check for user-specified random device | |
460 | AC_ARG_WITH(random, | |
461 | [ --with-random=FILE read randomness from FILE (default=/dev/urandom)], | |
462 | [ RANDOM_FILE="$withval" ], | |
463 | [ | |
464 | dnl Check for random device | |
465 | AC_CHECK_FILE("/dev/urandom", | |
466 | [ | |
467 | RANDOM_FILE="/dev/urandom"; | |
468 | ] | |
469 | ) | |
470 | ] | |
471 | ) | |
472 | if test -n "$RANDOM_FILE" ; then | |
473 | AC_SUBST(RANDOM_FILE) | |
474 | AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE") | |
475 | fi | |
476 | ||
00505c92 DS |
477 | dnl ********************************************************************** |
478 | dnl Check for the presence of Kerberos4 libraries and headers | |
479 | dnl ********************************************************************** | |
480 | ||
481 | AC_ARG_WITH(krb4-includes, | |
482 | [ --with-krb4-includes[=DIR] Specify location of kerberos4 headers],[ | |
483 | CPPFLAGS="$CPPFLAGS -I$withval" | |
484 | KRB4INC="$withval" | |
485 | want_krb4=yes | |
486 | ]) | |
487 | ||
488 | AC_ARG_WITH(krb4-libs, | |
489 | [ --with-krb4-libs[=DIR] Specify location of kerberos4 libs],[ | |
490 | LDFLAGS="$LDFLAGS -L$withval" | |
491 | KRB4LIB="$withval" | |
492 | want_krb4=yes | |
493 | ]) | |
494 | ||
495 | ||
496 | OPT_KRB4=off | |
497 | AC_ARG_WITH(krb4,dnl | |
498 | [ --with-krb4[=DIR] where to look for Kerberos4],[ | |
499 | OPT_KRB4="$withval" | |
500 | if test X"$OPT_KRB4" != Xyes | |
501 | then | |
502 | LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib" | |
503 | KRB4LIB="$OPT_KRB4/lib" | |
504 | CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include" | |
505 | KRB4INC="$OPT_KRB4/include" | |
506 | fi | |
507 | want_krb4="yes" | |
508 | ]) | |
509 | ||
510 | AC_MSG_CHECKING([if Kerberos4 support is requested]) | |
511 | ||
512 | if test "$want_krb4" = yes | |
513 | then | |
f6e2bfd4 DS |
514 | if test "$ipv6" = "yes"; then |
515 | echo krb4 is not compatible with IPv6 | |
516 | exit 1 | |
517 | fi | |
00505c92 DS |
518 | AC_MSG_RESULT(yes) |
519 | ||
520 | dnl Check for & handle argument to --with-krb4 | |
521 | ||
522 | AC_MSG_CHECKING(where to look for Kerberos4) | |
523 | if test X"$OPT_KRB4" = Xyes | |
524 | then | |
525 | AC_MSG_RESULT([defaults]) | |
526 | else | |
527 | AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC]) | |
528 | fi | |
529 | ||
530 | dnl Check for DES library | |
531 | AC_CHECK_LIB(des, des_pcbc_encrypt, | |
532 | [ | |
533 | AC_CHECK_HEADERS(des.h) | |
534 | ||
535 | dnl resolv lib? | |
536 | AC_CHECK_FUNC(res_search, , AC_CHECK_LIB(resolv, res_search)) | |
537 | ||
538 | dnl Check for the Kerberos4 library | |
539 | AC_CHECK_LIB(krb, krb_net_read, | |
540 | [ | |
541 | dnl Check for header files | |
542 | AC_CHECK_HEADERS(krb.h) | |
543 | ||
544 | dnl we found the required libraries, add to LIBS | |
545 | LIBS="-lkrb -ldes $LIBS" | |
546 | ||
547 | dnl Check for function krb_get_our_ip_for_realm | |
548 | dnl this is needed for NAT networks | |
549 | AC_CHECK_FUNCS(krb_get_our_ip_for_realm) | |
550 | ||
551 | dnl add define KRB4 | |
552 | AC_DEFINE(KRB4) | |
553 | ||
1ee7f92c DS |
554 | dnl substitute it too! |
555 | KRB4_ENABLED=1 | |
556 | AC_SUBST(KRB4_ENABLED) | |
557 | ||
00505c92 DS |
558 | dnl the krb4 stuff needs a strlcpy() |
559 | AC_CHECK_FUNCS(strlcpy) | |
560 | ||
561 | ]) | |
562 | ]) | |
563 | else | |
564 | AC_MSG_RESULT(no) | |
565 | fi | |
566 | ||
23903306 | 567 | |
ae1912cb DS |
568 | dnl ********************************************************************** |
569 | dnl Check for the presence of SSL libraries and headers | |
570 | dnl ********************************************************************** | |
571 | ||
572 | dnl Default to compiler & linker defaults for SSL files & libraries. | |
573 | OPT_SSL=off | |
574 | AC_ARG_WITH(ssl,dnl | |
575 | [ --with-ssl[=DIR] where to look for SSL [compiler/linker default paths] | |
576 | DIR points to the SSL installation [/usr/local/ssl]], | |
577 | OPT_SSL=$withval | |
578 | ) | |
579 | ||
580 | if test X"$OPT_SSL" = Xno | |
581 | then | |
582 | AC_MSG_WARN(SSL/https support disabled) | |
583 | else | |
584 | ||
4836154c DS |
585 | dnl Check for and handle argument to --with-ssl. |
586 | EXTRA_SSL= | |
587 | ||
588 | case "$OPT_SSL" in | |
589 | yes) | |
590 | EXTRA_SSL=/usr/local/ssl ;; | |
591 | *) | |
592 | EXTRA_SSL=$OPT_SSL ;; | |
593 | esac | |
594 | ||
595 | AC_CHECK_LIB(crypto, CRYPTO_lock,[ | |
596 | HAVECRYPTO="yes" | |
597 | ],[ | |
598 | OLDLDFLAGS="$LDFLAGS" | |
599 | OLDCPPFLAGS="$CPPFLAGS" | |
600 | LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib" | |
601 | CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include" | |
602 | AC_CHECK_LIB(crypto, CRYPTO_add_lock,[ | |
603 | HAVECRYPTO="yes" ], [ | |
604 | LDFLAGS="$OLDLDFLAGS" | |
605 | CPPFLAGS="$OLDCPPFLAGS" | |
606 | ]) | |
607 | ]) | |
ae1912cb | 608 | |
ae1912cb | 609 | |
4836154c | 610 | if test "$HAVECRYPTO" = "yes"; then |
ae1912cb DS |
611 | dnl This is only reasonable to do if crypto actually is there: check for |
612 | dnl SSL libs NOTE: it is important to do this AFTER the crypto lib | |
4836154c | 613 | |
1b9e26a2 | 614 | AC_CHECK_LIB(crypto, CRYPTO_add_lock) |
ae1912cb DS |
615 | AC_CHECK_LIB(ssl, SSL_connect) |
616 | ||
b32bf427 DS |
617 | if test "$ac_cv_lib_ssl_SSL_connect" != yes; then |
618 | dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff | |
619 | AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use); | |
620 | OLIBS=$LIBS | |
621 | LIBS="$LIBS -lRSAglue -lrsaref" | |
622 | AC_CHECK_LIB(ssl, SSL_connect) | |
623 | if test "$ac_cv_lib_ssl_SSL_connect" != yes; then | |
624 | dnl still no SSL_connect | |
625 | AC_MSG_RESULT(no) | |
626 | LIBS=$OLIBS | |
627 | else | |
628 | AC_MSG_RESULT(yes) | |
629 | fi | |
630 | fi | |
631 | ||
632 | ||
ae1912cb | 633 | dnl Check for SSLeay headers |
1ee7f92c | 634 | AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \ |
23903306 DS |
635 | openssl/pem.h openssl/ssl.h openssl/err.h, |
636 | OPENSSL_ENABLED=1) | |
ae1912cb DS |
637 | |
638 | if test $ac_cv_header_openssl_x509_h = no; then | |
23903306 DS |
639 | AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h, |
640 | OPENSSL_ENABLED=1) | |
1ee7f92c DS |
641 | fi |
642 | ||
643 | AC_SUBST(OPENSSL_ENABLED) | |
644 | ||
ae1912cb | 645 | fi |
00505c92 | 646 | |
1ee7f92c DS |
647 | if test X"$OPT_SSL" != Xoff && |
648 | test "$OPENSSL_ENABLED" != "1"; then | |
649 | AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!]) | |
650 | fi | |
651 | ||
652 | ||
00505c92 DS |
653 | dnl these can only exist if openssl exists |
654 | ||
655 | AC_CHECK_FUNCS( RAND_status \ | |
2ef13230 DS |
656 | RAND_screen \ |
657 | RAND_egd ) | |
00505c92 | 658 | |
ae1912cb DS |
659 | fi |
660 | ||
661 | dnl ********************************************************************** | |
662 | dnl Check for the presence of ZLIB libraries and headers | |
663 | dnl ********************************************************************** | |
664 | ||
665 | dnl Default to compiler & linker defaults for files & libraries. | |
666 | dnl OPT_ZLIB=no | |
667 | dnl AC_ARG_WITH(zlib,dnl | |
668 | dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths] | |
669 | dnl DIR points to the ZLIB installation prefix [/usr/local]], | |
670 | dnl OPT_ZLIB=$withval, | |
671 | dnl ) | |
672 | ||
673 | dnl Check for & handle argument to --with-zlib. | |
674 | dnl | |
675 | dnl NOTE: We *always* look for ZLIB headers & libraries, all this option | |
676 | dnl does is change where we look (by adjusting LIBS and CPPFLAGS.) | |
677 | dnl | |
678 | ||
679 | dnl AC_MSG_CHECKING(where to look for ZLIB) | |
680 | dnl if test X"$OPT_ZLIB" = Xno | |
681 | dnl then | |
682 | dnl AC_MSG_RESULT([defaults (or given in environment)]) | |
683 | dnl else | |
684 | dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local | |
685 | dnl LIBS="$LIBS -L$OPT_ZLIB/lib" | |
686 | dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include" | |
687 | dnl AC_MSG_RESULT([$OPT_ZLIB]) | |
688 | dnl fi | |
689 | ||
690 | dnl z lib? | |
691 | dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread)) | |
692 | ||
b174aeaa DS |
693 | |
694 | dnl Default is to try the thread-safe versions of a few functions | |
695 | OPT_THREAD=on | |
696 | AC_ARG_ENABLE(thread,dnl | |
697 | [ --disable-thread tell configure to not look for thread-safe functions], | |
698 | OPT_THREAD=off | |
699 | ) | |
700 | ||
701 | if test X"$OPT_THREAD" = Xoff | |
702 | then | |
703 | AC_MSG_WARN(libcurl will not get built using thread-safe functions) | |
704 | AC_DEFINE(DISABLED_THREADSAFE, 1, \ | |
705 | Set to explicitly specify we don't want to use thread-safe functions) | |
706 | else | |
707 | ||
116462a5 DS |
708 | dnl check that 'localhost' resolves first |
709 | CURL_CHECK_WORKING_RESOLVER | |
710 | ||
61fb8fea DS |
711 | dnl dig around for gethostbyname_r() |
712 | CURL_CHECK_GETHOSTBYNAME_R() | |
d4731b70 | 713 | |
61fb8fea DS |
714 | dnl dig around for gethostbyaddr_r() |
715 | CURL_CHECK_GETHOSTBYADDR_R() | |
d4731b70 | 716 | |
61fb8fea DS |
717 | dnl poke around for inet_ntoa_r() |
718 | CURL_CHECK_INET_NTOA_R() | |
d4731b70 | 719 | |
61fb8fea DS |
720 | dnl is there a localtime_r() |
721 | CURL_CHECK_LOCALTIME_R() | |
d4731b70 | 722 | |
b174aeaa DS |
723 | fi |
724 | ||
ae1912cb DS |
725 | dnl ********************************************************************** |
726 | dnl Back to "normal" configuring | |
727 | dnl ********************************************************************** | |
728 | ||
729 | dnl Checks for header files. | |
730 | AC_HEADER_STDC | |
731 | AC_CHECK_HEADERS( \ | |
732 | unistd.h \ | |
8898ff9e DS |
733 | malloc.h \ |
734 | stdlib.h \ | |
ae1912cb DS |
735 | arpa/inet.h \ |
736 | net/if.h \ | |
737 | netinet/in.h \ | |
d4731b70 | 738 | netinet/if_ether.h \ |
ae1912cb DS |
739 | netdb.h \ |
740 | sys/select.h \ | |
741 | sys/socket.h \ | |
742 | sys/sockio.h \ | |
743 | sys/stat.h \ | |
744 | sys/types.h \ | |
d5bc98fc | 745 | sys/time.h \ |
ae1912cb DS |
746 | getopt.h \ |
747 | sys/param.h \ | |
748 | termios.h \ | |
749 | termio.h \ | |
750 | sgtty.h \ | |
751 | fcntl.h \ | |
752 | dlfcn.h \ | |
753 | alloca.h \ | |
754 | winsock.h \ | |
755 | time.h \ | |
756 | io.h \ | |
92186dc3 | 757 | pwd.h |
ae1912cb DS |
758 | ) |
759 | ||
760 | dnl Check for libz header | |
761 | dnl AC_CHECK_HEADERS(zlib.h) | |
762 | ||
763 | dnl Checks for typedefs, structures, and compiler characteristics. | |
764 | AC_C_CONST | |
765 | AC_TYPE_SIZE_T | |
766 | AC_HEADER_TIME | |
767 | ||
768 | # mprintf() checks: | |
769 | ||
770 | # check for 'long double' | |
771 | AC_CHECK_SIZEOF(long double, 8) | |
772 | # check for 'long long' | |
773 | AC_CHECK_SIZEOF(long long, 4) | |
774 | ||
61e2a810 DS |
775 | # check for ssize_t |
776 | AC_CHECK_TYPE(ssize_t, int) | |
777 | ||
11693c0f DS |
778 | dnl |
779 | dnl We can't just AC_CHECK_TYPE() for socklen_t since it doesn't appear | |
780 | dnl in the standard headers. We egrep for it in the socket headers and | |
781 | dnl if it is used there we assume we have the type defined, otherwise | |
782 | dnl we search for it with AC_CHECK_TYPE() the "normal" way | |
783 | dnl | |
784 | ||
785 | if test "$ac_cv_header_sys_socket_h" = "yes"; then | |
786 | AC_MSG_CHECKING(for socklen_t in sys/socket.h) | |
787 | AC_EGREP_HEADER(socklen_t, | |
788 | sys/socket.h, | |
789 | socklen_t=yes | |
790 | AC_MSG_RESULT(yes), | |
791 | AC_MSG_RESULT(no)) | |
792 | fi | |
793 | ||
794 | if test "$socklen_t" != "yes"; then | |
795 | # check for socklen_t the standard way if it wasn't found before | |
796 | AC_CHECK_TYPE(socklen_t, int) | |
797 | fi | |
798 | ||
ae1912cb DS |
799 | dnl Checks for library functions. |
800 | dnl AC_PROG_GCC_TRADITIONAL | |
801 | AC_TYPE_SIGNAL | |
f8e916db | 802 | dnl AC_FUNC_VPRINTF |
ae1912cb DS |
803 | AC_CHECK_FUNCS( socket \ |
804 | select \ | |
805 | strdup \ | |
806 | strstr \ | |
4e376a2f | 807 | strtok_r \ |
ae1912cb DS |
808 | strftime \ |
809 | uname \ | |
810 | strcasecmp \ | |
95c2534a DS |
811 | stricmp \ |
812 | strcmpi \ | |
ae1912cb DS |
813 | gethostname \ |
814 | gethostbyaddr \ | |
815 | getservbyname \ | |
816 | gettimeofday \ | |
817 | inet_addr \ | |
818 | inet_ntoa \ | |
819 | tcsetattr \ | |
820 | tcgetattr \ | |
821 | perror \ | |
0e31dadf | 822 | closesocket \ |
3264ce04 | 823 | setvbuf \ |
852b664e | 824 | sigaction \ |
1ff573c6 | 825 | signal \ |
f6e2bfd4 | 826 | getpass_r \ |
92186dc3 DS |
827 | strlcat \ |
828 | getpwuid \ | |
43d0d756 DS |
829 | geteuid \ |
830 | dlopen | |
ae1912cb DS |
831 | ) |
832 | ||
cdfb83e0 DS |
833 | dnl removed 'getpass' check on October 26, 2000 |
834 | ||
f8e916db | 835 | if test "$ac_cv_func_select" != "yes"; then |
4f255ffb DS |
836 | AC_MSG_ERROR(Can't work without an existing select() function) |
837 | fi | |
838 | if test "$ac_cv_func_socket" != "yes"; then | |
f8e916db DS |
839 | AC_MSG_ERROR(Can't work without an existing socket() function) |
840 | fi | |
841 | ||
7dc36344 DS |
842 | AC_PATH_PROG( PERL, perl, , |
843 | $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin ) | |
844 | AC_SUBST(PERL) | |
ae1912cb | 845 | |
90719eb3 | 846 | AC_PATH_PROGS( NROFF, gnroff nroff, , |
ae1912cb | 847 | $PATH:/usr/bin/:/usr/local/bin ) |
96dde76b | 848 | AC_SUBST(NROFF) |
ae1912cb | 849 | |
ae1912cb DS |
850 | AC_PROG_YACC |
851 | ||
852 | dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib, | |
853 | dnl $PATH:/usr/bin/:/usr/local/bin ) | |
854 | dnl AC_SUBST(RANLIB) | |
855 | ||
93c53424 | 856 | AC_CONFIG_FILES([Makefile \ |
f71a1485 | 857 | docs/Makefile \ |
d54cdf29 | 858 | docs/examples/Makefile \ |
c3c77398 DS |
859 | include/Makefile \ |
860 | include/curl/Makefile \ | |
ae1912cb | 861 | src/Makefile \ |
172f0ba1 | 862 | lib/Makefile \ |
044ca343 | 863 | tests/Makefile \ |
b915ca68 | 864 | tests/data/Makefile \ |
9ade752f DS |
865 | packages/Makefile \ |
866 | packages/Win32/Makefile \ | |
867 | packages/Linux/Makefile \ | |
868 | packages/Linux/RPM/Makefile \ | |
d54cdf29 | 869 | packages/Linux/RPM/curl.spec \ |
aa860990 | 870 | packages/Linux/RPM/curl-ssl.spec \ |
c503930b | 871 | packages/Solaris/Makefile \ |
aa860990 DS |
872 | perl/Makefile \ |
873 | perl/Curl_easy/Makefile \ | |
874 | php/Makefile \ | |
5ab751f5 DS |
875 | php/examples/Makefile \ |
876 | curl-config | |
93c53424 DS |
877 | ]) |
878 | AC_OUTPUT | |
d54cdf29 | 879 |