]> git.ipfire.org Git - thirdparty/curl.git/blame - configure.in
Added items we've discussed previously, and URLs to dev notes discussing
[thirdparty/curl.git] / configure.in
CommitLineData
ae1912cb
DS
1dnl $Id$
2dnl Process this file with autoconf to produce a configure script.
93c53424
DS
3AC_INIT
4AC_CONFIG_SRCDIR([lib/urldata.h])
f6163b37 5AM_CONFIG_HEADER(config.h src/config.h)
8f5ffd94 6
784f57f9 7VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
8f5ffd94 8AM_INIT_AUTOMAKE(curl,$VERSION)
caf8c01e 9
1e5e0f9a
DS
10dnl
11dnl we extract the numerical version for curl-config only
12VERSIONNUM=`sed -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curl.h`
13AC_SUBST(VERSIONNUM)
14
c503930b
CB
15dnl Solaris pkgadd support definitions
16PKGADD_PKG="HAXXcurl"
17PKGADD_NAME="cURL - a client that groks URLs"
18PKGADD_VENDOR="curl.haxx.se"
19AC_SUBST(PKGADD_PKG)
20AC_SUBST(PKGADD_NAME)
21AC_SUBST(PKGADD_VENDOR)
22
23
caf8c01e
DS
24dnl
25dnl Detect the canonical host and target build environment
26dnl
ae1912cb 27
c77f77a1 28AC_CANONICAL_HOST
93c53424
DS
29dnl Get system canonical name
30AC_DEFINE_UNQUOTED(OS, "${host}")
1b1f143c
DS
31
32dnl Check for AIX weirdos
33AC_AIX
34
93c53424
DS
35dnl Checks for programs.
36AC_PROG_CC
37
d4ffc5ef 38dnl check for how to do large files
1b1f143c 39AC_SYS_LARGEFILE
d4ffc5ef 40
93c53424
DS
41AM_PROG_LIBTOOL
42
d1a1fcc6
DS
43dnl The install stuff has already been taken care of by the automake stuff
44dnl AC_PROG_INSTALL
ae1912cb
DS
45AC_PROG_MAKE_SET
46
572c29a4
DS
47dnl ************************************************************
48dnl lame option to switch on debug options
49dnl
50AC_MSG_CHECKING([whether to enable debug options])
51AC_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
67dnl ************************************************************
68dnl check for "localhost", if it doesn't exist, we can't do the
69dnl gethostbyname_r tests!
70dnl
c0c02833 71
116462a5
DS
72AC_DEFUN(CURL_CHECK_WORKING_RESOLVER,[
73AC_MSG_CHECKING([if "localhost" resolves])
74AC_TRY_RUN([
75#include <string.h>
76#include <sys/types.h>
77#include <netdb.h>
78
79int
80main () {
81struct hostent *h;
82h = gethostbyname("localhost");
83exit (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
92dnl ************************************************************
c0c02833
DS
93dnl check for working getaddrinfo()
94dnl
95AC_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
102void 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])])
124if 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
130fi
131])
132
133
61fb8fea
DS
134AC_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
152AC_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
173AC_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>],[
182char * address;
183int length;
184int type;
185struct hostent h;
186struct hostent_data hdata;
187int rc;
188rc = 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>],[
198char * address;
199int length;
200int type;
201struct hostent h;
202struct hostent_data hdata;
203int rc;
204rc = 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>],[
214char * address;
215int length;
216int type;
217struct hostent h;
218char buffer[8192];
219int h_errnop;
220struct hostent * hp;
221
222hp = 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>],[
232char * address;
233int length;
234int type;
235struct hostent h;
236char buffer[8192];
237int h_errnop;
238struct hostent * hp;
239int rc;
240
241rc = 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
252AC_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
263int
264main () {
265struct hostent h;
266struct hostent_data hdata;
267char *name = "localhost";
268int rc;
269memset(&h, 0, sizeof(struct hostent));
270memset(&hdata, 0, sizeof(struct hostent_data));
271rc = gethostbyname_r(name, &h, &hdata);
272exit (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
285int
286main () {
287struct hostent h;
288struct hostent_data hdata;
289char *name = "localhost";
290int rc;
291memset(&h, 0, sizeof(struct hostent));
292memset(&hdata, 0, sizeof(struct hostent_data));
293rc = gethostbyname_r(name, &h, &hdata);
294exit (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
305int
306main () {
307struct hostent *hp;
308struct hostent h;
309char *name = "localhost";
310char buffer[8192];
311int h_errno;
312hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
313exit (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
323int
324main () {
325struct hostent h;
326struct hostent *hp;
327char *name = "localhost";
328char buf[8192];
329int rc;
330int h_errno;
331rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
332exit (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
343if 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
349fi
350
61fb8fea
DS
351])
352
65840f1f
DS
353dnl **********************************************************************
354dnl Checks for IPv6
355dnl **********************************************************************
356
357AC_MSG_CHECKING([whether to enable ipv6])
358AC_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>
374main()
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
390if test "$ipv6" = "yes"; then
391 CURL_CHECK_WORKING_GETADDRINFO
392fi
393
394
ae1912cb
DS
395dnl **********************************************************************
396dnl Checks for libraries.
397dnl **********************************************************************
398
61fb8fea 399dnl gethostbyname in the nsl lib?
ae1912cb
DS
400AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
401
61fb8fea
DS
402if 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))
405fi
406
caf8c01e
DS
407dnl At least one system has been identified to require BOTH nsl and
408dnl socket libs to link properly.
409if 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
426fi
427
ae1912cb
DS
428dnl resolve lib?
429AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
430
b174aeaa
DS
431if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
432 AC_CHECK_LIB(resolve, strcasecmp,
433 [LIBS="-lresolve $LIBS"],
434 ,
435 -lnsl)
436fi
437
ae1912cb
DS
438dnl socket lib?
439AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
440
441dnl ucb lib?
442AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
443
444dnl dl lib?
43d0d756 445AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
ae1912cb 446
2ef13230
DS
447dnl **********************************************************************
448dnl Check for the random seed preferences
449dnl **********************************************************************
450
451AC_ARG_WITH(egd-socket,
452 [ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname],
453 [ EGD_SOCKET="$withval" ]
454)
455if test -n "$EGD_SOCKET" ; then
456 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
457fi
458
459dnl Check for user-specified random device
460AC_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)
472if test -n "$RANDOM_FILE" ; then
473 AC_SUBST(RANDOM_FILE)
474 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
475fi
476
00505c92
DS
477dnl **********************************************************************
478dnl Check for the presence of Kerberos4 libraries and headers
479dnl **********************************************************************
480
481AC_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
488AC_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
496OPT_KRB4=off
497AC_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
510AC_MSG_CHECKING([if Kerberos4 support is requested])
511
512if test "$want_krb4" = yes
513then
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 ])
563else
564 AC_MSG_RESULT(no)
565fi
566
23903306 567
ae1912cb
DS
568dnl **********************************************************************
569dnl Check for the presence of SSL libraries and headers
570dnl **********************************************************************
571
572dnl Default to compiler & linker defaults for SSL files & libraries.
573OPT_SSL=off
574AC_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
580if test X"$OPT_SSL" = Xno
581then
582 AC_MSG_WARN(SSL/https support disabled)
583else
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
659fi
660
661dnl **********************************************************************
662dnl Check for the presence of ZLIB libraries and headers
663dnl **********************************************************************
664
665dnl Default to compiler & linker defaults for files & libraries.
666dnl OPT_ZLIB=no
667dnl AC_ARG_WITH(zlib,dnl
668dnl [ --with-zlib[=DIR] where to look for ZLIB [compiler/linker default paths]
669dnl DIR points to the ZLIB installation prefix [/usr/local]],
670dnl OPT_ZLIB=$withval,
671dnl )
672
673dnl Check for & handle argument to --with-zlib.
674dnl
675dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
676dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
677dnl
678
679dnl AC_MSG_CHECKING(where to look for ZLIB)
680dnl if test X"$OPT_ZLIB" = Xno
681dnl then
682dnl AC_MSG_RESULT([defaults (or given in environment)])
683dnl else
684dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
685dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
686dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
687dnl AC_MSG_RESULT([$OPT_ZLIB])
688dnl fi
689
690dnl z lib?
691dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
692
b174aeaa
DS
693
694dnl Default is to try the thread-safe versions of a few functions
695OPT_THREAD=on
696AC_ARG_ENABLE(thread,dnl
697[ --disable-thread tell configure to not look for thread-safe functions],
698 OPT_THREAD=off
699)
700
701if test X"$OPT_THREAD" = Xoff
702then
703 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
704 AC_DEFINE(DISABLED_THREADSAFE, 1, \
705Set to explicitly specify we don't want to use thread-safe functions)
706else
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
723fi
724
ae1912cb
DS
725dnl **********************************************************************
726dnl Back to "normal" configuring
727dnl **********************************************************************
728
729dnl Checks for header files.
730AC_HEADER_STDC
731AC_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
760dnl Check for libz header
761dnl AC_CHECK_HEADERS(zlib.h)
762
763dnl Checks for typedefs, structures, and compiler characteristics.
764AC_C_CONST
765AC_TYPE_SIZE_T
766AC_HEADER_TIME
767
768# mprintf() checks:
769
770# check for 'long double'
771AC_CHECK_SIZEOF(long double, 8)
772# check for 'long long'
773AC_CHECK_SIZEOF(long long, 4)
774
61e2a810
DS
775# check for ssize_t
776AC_CHECK_TYPE(ssize_t, int)
777
11693c0f
DS
778dnl
779dnl We can't just AC_CHECK_TYPE() for socklen_t since it doesn't appear
780dnl in the standard headers. We egrep for it in the socket headers and
781dnl if it is used there we assume we have the type defined, otherwise
782dnl we search for it with AC_CHECK_TYPE() the "normal" way
783dnl
784
785if 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))
792fi
793
794if 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)
797fi
798
ae1912cb
DS
799dnl Checks for library functions.
800dnl AC_PROG_GCC_TRADITIONAL
801AC_TYPE_SIGNAL
f8e916db 802dnl AC_FUNC_VPRINTF
ae1912cb
DS
803AC_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
833dnl removed 'getpass' check on October 26, 2000
834
f8e916db 835if test "$ac_cv_func_select" != "yes"; then
4f255ffb
DS
836 AC_MSG_ERROR(Can't work without an existing select() function)
837fi
838if test "$ac_cv_func_socket" != "yes"; then
f8e916db
DS
839 AC_MSG_ERROR(Can't work without an existing socket() function)
840fi
841
7dc36344
DS
842AC_PATH_PROG( PERL, perl, ,
843 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
844AC_SUBST(PERL)
ae1912cb 845
90719eb3 846AC_PATH_PROGS( NROFF, gnroff nroff, ,
ae1912cb 847 $PATH:/usr/bin/:/usr/local/bin )
96dde76b 848AC_SUBST(NROFF)
ae1912cb 849
ae1912cb
DS
850AC_PROG_YACC
851
852dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
853dnl $PATH:/usr/bin/:/usr/local/bin )
854dnl AC_SUBST(RANLIB)
855
93c53424 856AC_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])
878AC_OUTPUT
d54cdf29 879