2 dnl Process this file with autoconf to produce a configure script.
6 dnl We don't know the version number "staticly" so we use a dash here
7 AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
9 dnl configure script copyright
10 AC_COPYRIGHT([Copyright (c) 1998 - 2004 Daniel Stenberg, <daniel@haxx.se>
11 This configure script may be copied, distributed and modified under the
12 terms of the curl license; see COPYING for more details])
14 AC_CONFIG_SRCDIR([lib/urldata.h])
15 AM_CONFIG_HEADER(lib/config.h src/config.h)
18 dnl SED is needed by some of the tools
19 AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
20 $PATH:/usr/bin:/usr/local/bin)
23 if test "x$SED" = "xsed-was-not-found-by-configure"; then
24 AC_MSG_WARN([sed was not found, this may ruin your chances to build fine])
27 dnl AR is used by libtool, and try the odd Solaris path too
28 dnl we use AC_CHECK_TOOL since this should make a library for the target
31 ar-was-not-found-by-configure,
32 $PATH:/usr/bin:/usr/local/bin:/usr/ccs/bin)
34 if test "x$AR" = "xar-was-not-found-by-configure"; then
35 AC_MSG_WARN([ar was not found, this may ruin your chances to build fine])
38 dnl figure out the libcurl version
39 VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
40 AM_INIT_AUTOMAKE(curl,$VERSION)
41 AC_MSG_CHECKING([curl version])
42 AC_MSG_RESULT($VERSION)
45 dnl we extract the numerical version for curl-config only
46 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
49 dnl Solaris pkgadd support definitions
51 PKGADD_NAME="cURL - a client that groks URLs"
52 PKGADD_VENDOR="curl.haxx.se"
55 AC_SUBST(PKGADD_VENDOR)
58 dnl initialize all the info variables
59 curl_ssl_msg="no (--with-ssl)"
60 curl_zlib_msg="no (--with-zlib)"
61 curl_krb4_msg="no (--with-krb4*)"
62 curl_gss_msg="no (--with-gssapi)"
63 curl_spnego_msg="no (--with-spnego)"
64 curl_ares_msg="no (--enable-ares)"
65 curl_ipv6_msg="no (--enable-ipv6)"
66 curl_idn_msg="no (--with-libidn)"
67 curl_manual_msg="no (--enable-manual)"
68 curl_verbose_msg="enabled (--disable-verbose)"
71 dnl Detect the canonical host and target build environment
75 dnl Get system canonical name
76 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
78 dnl Check for AIX weirdos
81 dnl Checks for programs.
84 dnl check for how to do large files
87 dnl check for cygwin stuff
93 AC_MSG_CHECKING([if we need -no-undefined])
95 *-*-cygwin | *-*-mingw* | *-*-pw32*)
102 AC_MSG_RESULT($need_no_undefined)
103 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
105 AC_MSG_CHECKING([if we need -mimpure-text])
109 if test "$GCC" = "yes"; then
116 AC_MSG_RESULT($mimpure)
117 AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
119 dnl The install stuff has already been taken care of by the automake stuff
123 dnl ************************************************************
124 dnl switch off particular protocols
126 AC_MSG_CHECKING([whether to support http])
128 AC_HELP_STRING([--enable-http],[Enable HTTP support])
129 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
130 [ case "$enableval" in
133 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
134 AC_MSG_WARN([disable HTTP disables FTP over proxy and GOPHER too])
135 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable GOPHER])
136 AC_SUBST(CURL_DISABLE_HTTP)
137 AC_SUBST(CURL_DISABLE_GOPHER)
139 *) AC_MSG_RESULT(yes)
144 AC_MSG_CHECKING([whether to support ftp])
146 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
147 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
148 [ case "$enableval" in
151 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
152 AC_SUBST(CURL_DISABLE_FTP)
154 *) AC_MSG_RESULT(yes)
159 AC_MSG_CHECKING([whether to support gopher])
160 AC_ARG_ENABLE(gopher,
161 AC_HELP_STRING([--enable-gopher],[Enable GOPHER support])
162 AC_HELP_STRING([--disable-gopher],[Disable GOPHER support]),
163 [ case "$enableval" in
166 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable GOPHER])
167 AC_SUBST(CURL_DISABLE_GOPHER)
169 *) AC_MSG_RESULT(yes)
174 AC_MSG_CHECKING([whether to support file])
176 AC_HELP_STRING([--enable-file],[Enable FILE support])
177 AC_HELP_STRING([--disable-file],[Disable FILE support]),
178 [ case "$enableval" in
181 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
182 AC_SUBST(CURL_DISABLE_FILE)
184 *) AC_MSG_RESULT(yes)
189 AC_MSG_CHECKING([whether to support ldap])
191 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
192 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
193 [ case "$enableval" in
196 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
197 AC_SUBST(CURL_DISABLE_LDAP)
199 *) AC_MSG_RESULT(yes)
204 AC_MSG_CHECKING([whether to support dict])
206 AC_HELP_STRING([--enable-dict],[Enable DICT support])
207 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
208 [ case "$enableval" in
211 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
212 AC_SUBST(CURL_DISABLE_DICT)
214 *) AC_MSG_RESULT(yes)
219 AC_MSG_CHECKING([whether to support telnet])
220 AC_ARG_ENABLE(telnet,
221 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
222 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
223 [ case "$enableval" in
226 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
227 AC_SUBST(CURL_DISABLE_TELNET)
229 *) AC_MSG_RESULT(yes)
235 dnl **********************************************************************
236 dnl Check for built-in manual
237 dnl **********************************************************************
239 AC_MSG_CHECKING([whether to provide built-in manual])
240 AC_ARG_ENABLE(manual,
241 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
242 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
243 [ case "$enableval" in
247 *) AC_MSG_RESULT(yes)
254 dnl The actual use of the USE_MANUAL variable is done much later in this
255 dnl script to allow other actions to disable it as well.
258 dnl **********************************************************************
259 dnl Checks for libraries.
260 dnl **********************************************************************
262 dnl gethostbyname without lib or in the nsl lib?
263 AC_CHECK_FUNC(gethostbyname,
264 [HAVE_GETHOSTBYNAME="1"
266 [ AC_CHECK_LIB(nsl, gethostbyname,
267 [HAVE_GETHOSTBYNAME="1"
272 if test "$HAVE_GETHOSTBYNAME" != "1"
274 dnl gethostbyname in the socket lib?
275 AC_CHECK_LIB(socket, gethostbyname,
276 [HAVE_GETHOSTBYNAME="1"
277 LIBS="$LIBS -lsocket"
281 dnl At least one system has been identified to require BOTH nsl and socket
282 dnl libs at the same time to link properly.
283 if test "$HAVE_GETHOSTBYNAME" != "1"
285 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
286 my_ac_save_LIBS=$LIBS
287 LIBS="-lnsl -lsocket $LIBS"
291 HAVE_GETHOSTBYNAME="1"
292 AC_MSG_RESULT([yes])],
296 LIBS=$my_ac_save_LIBS]
300 if test "$HAVE_GETHOSTBYNAME" != "1"
302 dnl This is for Msys/Mingw
303 AC_MSG_CHECKING([for gethostbyname in ws2_32])
304 my_ac_save_LIBS=$LIBS
305 LIBS="-lws2_32 $LIBS"
306 AC_TRY_LINK([#include <winsock2.h>],
307 [gethostbyname("www.dummysite.com");],
310 HAVE_GETHOSTBYNAME="1"],
311 [ dnl failed, restore LIBS
312 LIBS=$my_ac_save_LIBS
317 if test "$HAVE_GETHOSTBYNAME" = "1"; then
318 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
320 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
324 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
326 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
327 AC_CHECK_LIB(resolve, strcasecmp,
328 [LIBS="-lresolve $LIBS"],
334 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
337 AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
339 AC_MSG_CHECKING([whether to use libgcc])
340 AC_ARG_ENABLE(libgcc,
341 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
342 [ case "$enableval" in
353 dnl **********************************************************************
354 dnl Check for the presence of the winmm library.
355 dnl **********************************************************************
357 AC_MSG_CHECKING([for timeGetTime in winmm])
358 my_ac_save_LIBS=$LIBS
360 AC_TRY_LINK([#include <windef.h>
361 #include <mmsystem.h>
367 [ dnl failed, restore LIBS
368 LIBS=$my_ac_save_LIBS
372 dnl **********************************************************************
374 dnl **********************************************************************
376 AC_MSG_CHECKING([whether to enable ipv6])
378 AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
379 AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
380 [ case "$enableval" in
385 *) AC_MSG_RESULT(yes)
390 AC_TRY_RUN([ /* is AF_INET6 available? */
391 #include <sys/types.h>
392 #include <sys/socket.h>
395 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
409 if test "$ipv6" = "yes"; then
410 curl_ipv6_msg="enabled"
412 CURL_CHECK_WORKING_GETADDRINFO
414 CURL_CHECK_NI_WITHSCOPEID
417 dnl **********************************************************************
418 dnl Check how non-blocking sockets are set
419 dnl **********************************************************************
420 AC_ARG_ENABLE(nonblocking,
421 AC_HELP_STRING([--enable-nonblocking],[Enable detecting how to do it])
422 AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
424 if test "$enableval" = "no" ; then
425 AC_MSG_WARN([non-blocking sockets disabled])
426 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
427 [to disable NON-BLOCKING connections])
429 CURL_CHECK_NONBLOCKING_SOCKET
433 CURL_CHECK_NONBLOCKING_SOCKET
436 dnl **********************************************************************
437 dnl Check for the random seed preferences
438 dnl **********************************************************************
440 AC_ARG_WITH(egd-socket,
441 AC_HELP_STRING([--with-egd-socket=FILE],
442 [Entropy Gathering Daemon socket pathname]),
443 [ EGD_SOCKET="$withval" ]
445 if test -n "$EGD_SOCKET" ; then
446 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
447 [your Entropy Gathering Daemon socket pathname] )
450 dnl Check for user-specified random device
452 AC_HELP_STRING([--with-random=FILE],[read randomness from FILE (default=/dev/urandom)]),
453 [ RANDOM_FILE="$withval" ],
455 dnl Check for random device
456 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
459 if test -n "$RANDOM_FILE" ; then
460 AC_SUBST(RANDOM_FILE)
461 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
462 [a suitable file to read random data from])
465 dnl **********************************************************************
466 dnl Check if the operating system allows programs to write to their own argv[]
467 dnl **********************************************************************
469 AC_MSG_CHECKING([if argv can be written to])
470 AC_CACHE_VAL(curl_cv_writable_argv, [
472 int main(int argc, char ** argv) {
474 return (argv[0][0] == ' ')?0:1;
477 curl_cv_writable_argv=yes,
478 curl_cv_writable_argv=no,
479 curl_cv_writable_argv=cross)
481 case $curl_cv_writable_argv in
483 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
491 AC_MSG_WARN([the previous check could not be made default was used])
495 dnl **********************************************************************
496 dnl Check for the presence of Kerberos4 libraries and headers
497 dnl **********************************************************************
499 AC_ARG_WITH(krb4-includes,
500 AC_HELP_STRING([--with-krb4-includes=DIR],
501 [Specify location of kerberos4 headers]),[
502 CPPFLAGS="$CPPFLAGS -I$withval"
507 AC_ARG_WITH(krb4-libs,
508 AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
509 LDFLAGS="$LDFLAGS -L$withval"
517 AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
519 if test X"$OPT_KRB4" != Xyes
521 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
522 KRB4LIB="$OPT_KRB4/lib$libsuff"
523 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
524 KRB4INC="$OPT_KRB4/include"
529 AC_MSG_CHECKING([if Kerberos4 support is requested])
531 if test "$want_krb4" = yes
533 if test "$ipv6" = "yes"; then
534 echo krb4 is not compatible with IPv6
539 dnl Check for & handle argument to --with-krb4
541 AC_MSG_CHECKING(where to look for Kerberos4)
542 if test X"$OPT_KRB4" = Xyes
544 AC_MSG_RESULT([defaults])
546 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
549 dnl Check for DES library
550 AC_CHECK_LIB(des, des_pcbc_encrypt,
552 AC_CHECK_HEADERS(des.h)
555 AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
557 dnl Check for the Kerberos4 library
558 AC_CHECK_LIB(krb, krb_net_read,
560 dnl Check for header files
561 AC_CHECK_HEADERS(krb.h)
563 dnl we found the required libraries, add to LIBS
564 LIBS="-lkrb -lcom_err -ldes $LIBS"
566 dnl Check for function krb_get_our_ip_for_realm
567 dnl this is needed for NAT networks
568 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
571 AC_DEFINE(HAVE_KRB4, 1,
572 [if you have the Kerberos4 libraries (including -ldes)])
574 dnl substitute it too!
576 AC_SUBST(KRB4_ENABLED)
578 curl_krb4_msg="enabled"
580 dnl the krb4 stuff needs a strlcpy()
581 AC_CHECK_FUNCS(strlcpy)
589 dnl **********************************************************************
590 dnl Check for FBopenssl(SPNEGO) libraries
591 dnl **********************************************************************
594 AC_HELP_STRING([--with-spnego=DIR],
595 [Specify location of SPNEGO library fbopenssl]),
596 [ SPNEGO_ROOT="$withval"
599 AC_MSG_CHECKING([if SPNEGO support is requested])
600 if test x"$want_spnego" = xyes; then
602 if test X"$SPNEGO_ROOT" = Xyes; then
603 AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
606 if test -z "$SPNEGO_LIB_DIR"; then
607 LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
609 LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
613 AC_DEFINE(HAVE_SPNEGO, 1,
614 [Define this if you have the SPNEGO library fbopenssl])
615 curl_spnego_msg="enabled"
621 dnl **********************************************************************
622 dnl Check for GSS-API libraries
623 dnl **********************************************************************
625 AC_ARG_WITH(gssapi-includes,
626 AC_HELP_STRING([--with-gssapi-includes=DIR],
627 [Specify location of GSSAPI header]),
628 [ GSSAPI_INCS="-I$withval"
632 AC_ARG_WITH(gssapi-libs,
633 AC_HELP_STRING([--with-gssapi-libs=DIR],
634 [Specify location of GSSAPI libs]),
635 [ GSSAPI_LIBS="-L$withval -lgssapi"
640 AC_HELP_STRING([--with-gssapi=DIR],
641 [Where to look for GSSAPI]),
642 [ GSSAPI_ROOT="$withval"
646 AC_MSG_CHECKING([if GSSAPI support is requested])
647 if test x"$want_gss" = xyes; then
648 if test -z "$GSSAPI_INCS"; then
649 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
650 GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
651 elif test "$GSSAPI_ROOT" != "yes"; then
652 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
655 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
657 if test -z "$GSSAPI_LIB_DIR"; then
658 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
659 gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
660 LDFLAGS="$LDFLAGS $gss_ldflags"
661 elif test "$GSSAPI_ROOT" != "yes"; then
662 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff -lgssapi"
664 LDFLAGS="$LDFLAGS -lgssapi"
667 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
671 AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
673 curl_gss_msg="enabled"
675 AC_CHECK_HEADER(gssapi.h,
677 dnl found in the given dirs
678 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
681 dnl not found, check in gssapi/ subdir
682 AC_CHECK_HEADER(gssapi/gssapi.h,
684 AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
694 dnl **********************************************************************
695 dnl Check for the presence of SSL libraries and headers
696 dnl **********************************************************************
698 dnl Default to compiler & linker defaults for SSL files & libraries.
700 dnl Default to no CA bundle
703 AC_HELP_STRING([--with-ssl=PATH],[where to look for SSL, PATH points to the SSL installation (default: /usr/local/ssl)])
704 AC_HELP_STRING([--without-ssl], [disable SSL]),
707 if test X"$OPT_SSL" = Xno
709 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more])
712 dnl backup the pre-ssl variables
713 CLEANLDFLAGS="$LDFLAGS"
714 CLEANCPPFLAGS="$CPPFLAGS"
719 dnl --with-ssl (without path) used
720 if test x$cross_compiling != xyes; then
721 dnl only do pkg-config magic when not cross-compiling
724 EXTRA_SSL=/usr/local/ssl ;;
726 dnl no --with-ssl option given, just check default places
727 if test x$cross_compiling != xyes; then
728 dnl only do pkg-config magic when not cross-compiling
733 dnl check the given --with-ssl spot
736 LDFLAGS="$LDFLAGS -L$EXTRA_SSL/lib$libsuff"
737 CPPFLAGS="$CPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
741 if test "$PKGTEST" = "yes"; then
743 dnl Detect the pkg-config tool, as it may have extra info about the
744 dnl openssl installation we can use. I *believe* this is what we are
745 dnl expected to do on really recent Redhat Linux hosts.
747 AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
748 if test "$PKGCONFIG" != "no" ; then
749 AC_MSG_CHECKING([OpenSSL options with pkg-config])
751 $PKGCONFIG --exists openssl
754 if test "$SSL_EXISTS" -eq "0"; then
755 SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
756 SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
757 SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
759 dnl use the values pkg-config reported
760 LIBS="$LIBS $SSL_LIBS"
761 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
762 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
763 AC_MSG_RESULT([found])
770 AC_CHECK_LIB(crypto, CRYPTO_lock,[
773 LDFLAGS="$CLEANLDFLAGS -L$EXTRA_SSL/lib$libsuff"
774 CPPFLAGS="$CLEANCPPFLAGS -I$EXTRA_SSL/include/openssl -I$EXTRA_SSL/include"
775 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
776 HAVECRYPTO="yes" ], [
777 LDFLAGS="$CLEANLDFLAGS"
778 CPPFLAGS="$CLEANCPPFLAGS"
784 if test "$HAVECRYPTO" = "yes"; then
785 dnl This is only reasonable to do if crypto actually is there: check for
786 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
788 dnl This is for Msys/Mingw
789 AC_MSG_CHECKING([for gdi32])
790 my_ac_save_LIBS=$LIBS
792 AC_TRY_LINK([#include <windef.h>
793 #include <wingdi.h>],
796 AC_MSG_RESULT([yes])],
797 [ dnl failed, restore LIBS
798 LIBS=$my_ac_save_LIBS
802 AC_CHECK_LIB(crypto, CRYPTO_add_lock)
803 AC_CHECK_LIB(ssl, SSL_connect)
805 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
806 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
807 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
809 LIBS="$LIBS -lRSAglue -lrsaref"
810 AC_CHECK_LIB(ssl, SSL_connect)
811 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
812 dnl still no SSL_connect
821 dnl Check for SSLeay headers
822 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
823 openssl/pem.h openssl/ssl.h openssl/err.h,
824 curl_ssl_msg="enabled"
827 if test $ac_cv_header_openssl_x509_h = no; then
828 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h,
829 curl_ssl_msg="enabled"
833 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
834 dnl header, it is kind of "separated" from the main SSL check
835 AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
837 AC_SUBST(OPENSSL_ENABLED)
839 AC_MSG_CHECKING([CA cert bundle install path])
841 AC_ARG_WITH(ca-bundle,
842 AC_HELP_STRING([--with-ca-bundle=FILE], [File name to install the CA bundle as])
843 AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
846 if test "x$prefix" != xNONE; then
847 ca="\${prefix}/share/curl/curl-ca-bundle.crt"
849 ca="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
853 if test X"$OPT_SSL" = Xno; then
857 if test "x$ca" != "xno"; then
858 CURL_CA_BUNDLE='"'$ca'"'
859 AC_SUBST(CURL_CA_BUNDLE)
863 dnl these can only exist if openssl exists
865 AC_CHECK_FUNCS( RAND_status \
868 CRYPTO_cleanup_all_ex_data )
872 if test X"$OPT_SSL" != Xoff &&
873 test "$OPENSSL_ENABLED" != "1"; then
874 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
875 elif test "$OPENSSL_ENABLED" = "1"; then
876 dnl when the ssl shared libs were found in a path that the run-time linker
877 dnl doesn't search through, we need to add it to LD_LIBRARY_PATH to
878 dnl prevent further configure tests to fail due to this
879 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$EXTRA_SSL/lib$libsuff"
880 export LD_LIBRARY_PATH
885 AM_CONDITIONAL(CABUNDLE, test x$ca != xno)
887 dnl **********************************************************************
888 dnl Check for the presence of ZLIB libraries and headers
889 dnl **********************************************************************
891 dnl Check for & handle argument to --with-zlib.
895 OPT_ZLIB="/usr/local"
897 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
898 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
899 [OPT_ZLIB="$withval"])
903 AC_MSG_WARN([zlib disabled]) ;;
905 dnl check for the lib first without setting any new path, since many
906 dnl people have it in the default path
908 AC_CHECK_LIB(z, inflateEnd,
909 dnl libz found, set the variable
911 dnl if no lib found, try to add the given library
912 [if test -d "$OPT_ZLIB"; then
913 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
914 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
917 AC_CHECK_HEADER(zlib.h,
921 dnl if the lib wasn't found already, try again with the new paths
922 if test "$HAVE_LIBZ" != "1"; then
923 AC_CHECK_LIB(z, gzread,
925 dnl the lib was found!
928 [ CPPFLAGS=$_cppflags
933 dnl zlib.h was not found, restore the flags
938 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
940 AC_MSG_WARN([configure found only the libz lib, not the header file!])
941 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
943 AC_MSG_WARN([configure found only the libz header file, not the lib!])
944 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
946 dnl both header and lib were found!
948 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
949 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
953 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
955 AC_MSG_NOTICE([found both libz and libz.h header])
956 curl_zlib_msg="enabled"
961 dnl set variable for use in automakefile(s)
962 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
964 AC_MSG_CHECKING([whether to build with libidn])
966 AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
967 AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
974 *) AC_MSG_RESULT(yes)
977 dnl if there is a given path, check that FIRST
978 if test -n "$LIBIDN"; then
979 if test "x$LIBIDN" != "xyes"; then
980 AC_MSG_WARN([moo moo $LIBIDN])
982 oldCPPFLAGS=$CPPFLAGS
983 LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
984 CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
986 AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
989 CPPFLAGS=$oldCPPFLAGS)
993 if test "x$idn" != "xyes"; then
994 dnl check with default paths
996 AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
1000 if test "x$idn" = "xyes"; then
1001 curl_idn_msg="enabled"
1002 dnl different versions of libidn have different setups of these:
1003 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
1004 AC_CHECK_HEADERS( idn-free.h tld.h )
1010 dnl Default is to try the thread-safe versions of a few functions
1013 dnl detect AIX 4.3 or later
1014 dnl see full docs on this reasoning in the lib/hostip.c source file
1015 AC_MSG_CHECKING([AIX 4.3 or later])
1017 #if defined(_AIX) && defined(_AIX43)
1018 printf("just fine");
1020 #error "this is not AIX 4.3 or later"
1023 [ AC_MSG_RESULT([yes])
1026 [ AC_MSG_RESULT([no]) ]
1029 AC_ARG_ENABLE(thread,dnl
1030 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
1031 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
1032 [ case "$enableval" in
1035 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
1043 if test X"$OPT_THREAD" = Xoff
1045 AC_DEFINE(DISABLED_THREADSAFE, 1, \
1046 Set to explicitly specify we don't want to use thread-safe functions)
1048 if test "$ipv6" != "yes"; then
1049 dnl dig around for gethostbyname_r()
1050 CURL_CHECK_GETHOSTBYNAME_R()
1052 dnl dig around for gethostbyaddr_r()
1053 dnl CURL_CHECK_GETHOSTBYADDR_R()
1056 dnl poke around for inet_ntoa_r()
1057 CURL_CHECK_INET_NTOA_R()
1059 dnl is there a localtime_r()
1060 CURL_CHECK_LOCALTIME_R()
1062 dnl is there a strerror_r()
1063 CURL_CHECK_STRERROR_R()
1065 AC_CHECK_FUNCS( gmtime_r )
1068 dnl for recent AIX versions, we skip all the thread-safe checks above since
1069 dnl they claim a thread-safe libc using the standard API. But there are
1070 dnl some functions still not thread-safe. Check for these!
1072 dnl Let's hope this split URL remains working:
1073 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
1074 dnl genprogc/thread_quick_ref.htm
1076 if test "x$RECENTAIX" = "xyes"; then
1078 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
1080 dnl check if this is the IMB xlc compiler
1081 dnl Details thanks to => http://predef.sourceforge.net/
1082 AC_MSG_CHECKING([if this is the xlc compiler])
1083 AC_EGREP_CPP([^__xlC__], [__xlC__],
1084 dnl action if the text is found, this it has not been replaced by the
1087 AC_MSG_RESULT([no]),
1088 dnl the text was not found, it was replaced by the cpp
1090 AC_MSG_RESULT([yes])
1091 CFLAGS="$CFLAGS -qthreaded"
1095 dnl is there a localtime_r()
1096 CURL_CHECK_LOCALTIME_R()
1098 dnl is there a strerror_r()
1099 CURL_CHECK_STRERROR_R()
1101 AC_CHECK_FUNCS( gmtime_r )
1105 dnl **********************************************************************
1106 dnl Back to "normal" configuring
1107 dnl **********************************************************************
1109 dnl Checks for header files.
1112 dnl First check for the very most basic headers. Then we can use these
1113 dnl ones as default-headers when checking for the rest!
1151 dnl to do if not found
1155 dnl default includes
1157 #ifdef HAVE_SYS_TYPES_H
1158 #include <sys/types.h>
1160 #ifdef HAVE_SYS_TIME_H
1161 #include <sys/time.h>
1163 #ifdef HAVE_SYS_SELECT_H
1164 #include <sys/select.h>
1166 #ifdef HAVE_SYS_SOCKET_H
1167 #include <sys/socket.h>
1169 #ifdef HAVE_NETINET_IN_H
1170 #include <netinet/in.h>
1175 dnl Checks for typedefs, structures, and compiler characteristics.
1180 AC_CHECK_SIZEOF(curl_off_t, ,[
1182 #include "$srcdir/include/curl/curl.h"
1184 AC_CHECK_SIZEOF(size_t)
1185 AC_CHECK_SIZEOF(long)
1186 AC_CHECK_SIZEOF(time_t)
1188 AC_CHECK_TYPE(long long,
1189 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
1193 if test "xyes" = "x$longlong"; then
1194 AC_MSG_CHECKING([if numberLL works])
1195 AC_COMPILE_IFELSE([long long val = 1000LL;],
1196 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
1204 AC_CHECK_TYPE(ssize_t, ,
1205 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
1210 AC_FUNC_SELECT_ARGTYPES
1212 dnl Checks for library functions.
1213 dnl AC_PROG_GCC_TRADITIONAL
1216 AC_CHECK_FUNCS( strtoll \
1255 dnl if not found, $ac_func is the name we check for
1257 AC_MSG_CHECKING([deeper for $func])
1261 eval "ac_cv_func_$func=yes"
1262 def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
1263 AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
1264 AC_MSG_RESULT(but still no)
1269 dnl For some reason, the check above doesn't properly detect select() with
1271 if test "$ac_cv_func_select" != "yes"; then
1272 AC_MSG_CHECKING([for select in ws2_32])
1273 AC_TRY_LINK([#include <winsock2.h>],
1274 [select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);],
1276 AC_MSG_RESULT([yes])
1278 AC_DEFINE_UNQUOTED(HAVE_SELECT,1)],
1279 [AC_MSG_ERROR(You can't compile without a select)]
1283 dnl sigsetjmp() might be a macro and no function so if it isn't found already
1284 dnl we make an extra check here!
1285 if test "$ac_cv_func_sigsetjmp" != "yes"; then
1286 AC_MSG_CHECKING([for sigsetjmp defined as macro])
1287 AC_TRY_LINK( [#include <setjmp.h>],
1289 sigsetjmp(jmpenv, 1);],
1291 AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]),
1296 AC_CHECK_DECL(basename, ,
1297 AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
1298 #ifdef HAVE_STRING_H
1301 #ifdef HAVE_LIBGEN_H
1306 dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
1307 dnl to find out we make an extra check here!
1308 if test "$ac_cv_func_poll" = "yes"; then
1309 AC_MSG_CHECKING([if poll works with NULL inputs])
1311 #ifdef HAVE_SYS_POLL_H
1312 #include <sys/poll.h>
1317 /* make this return 0 == timeout since there's nothing to read from */
1318 return poll((void *)0, 0, 10 /*ms*/);
1322 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
1324 AC_MSG_RESULT(cross-compiling assumes yes)
1325 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
1326 ) dnl end of AC_RUN_IFELSE
1331 AC_PATH_PROG( PERL, perl, ,
1332 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
1335 AC_PATH_PROGS( NROFF, gnroff nroff, ,
1336 $PATH:/usr/bin/:/usr/local/bin )
1339 if test -n "$NROFF"; then
1340 dnl only check for nroff options if an nroff command was found
1342 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
1344 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
1345 if test -z "$mancheck"; then
1347 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
1348 if test -z "$mancheck"; then
1350 AC_MSG_RESULT([failed])
1351 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
1353 AC_MSG_RESULT([$MANOPT])
1356 AC_MSG_RESULT([$MANOPT])
1361 if test -z "$MANOPT"
1363 dnl if no nroff tool was found, or no option that could convert man pages
1364 dnl was found, then disable the built-in manual stuff
1365 AC_MSG_WARN([disabling built-in manual])
1369 dnl *************************************************************************
1370 dnl If the manual variable still is set, then we go with providing a built-in
1373 if test "$USE_MANUAL" = "1"; then
1374 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
1375 curl_manual_msg="enabled"
1378 dnl set variable for use in automakefile(s)
1379 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
1381 AC_MSG_CHECKING([whether to enable ares])
1383 AC_HELP_STRING([--enable-ares=PATH],[Enable ares for name lookups])
1384 AC_HELP_STRING([--disable-ares],[Disable ares for name lookups]),
1385 [ case "$enableval" in
1389 *) AC_MSG_RESULT(yes)
1391 if test "x$IPV6_ENABLED" = "x1"; then
1392 AC_MSG_ERROR([ares doesn't work with ipv6, disable ipv6 to use ares])
1395 AC_DEFINE(USE_ARES, 1, [Define if you want to enable ares support])
1396 dnl substitute HAVE_ARES for curl-config and similar
1399 curl_ares_msg="enabled"
1401 LIBS="$LIBS -lcares"
1403 dnl For backwards compatibility default to includes/lib in srcdir/ares
1404 dnl If a value is specified it is assumed that the libs are in $val/lib
1405 dnl and the includes are in $val/include. This is the default setup for
1406 dnl ares so it should not be a problem.
1407 if test "x$enableval" = "xyes" ; then
1408 if test -d "$srcdir/ares"; then
1410 AC_CONFIG_SUBDIRS(ares)
1411 aresinc=`cd $srcdir/ares && pwd`
1412 CPPFLAGS="$CPPFLAGS -I$aresinc"
1414 dnl the pwd= below cannot 'cd' into the ares dir to get the full
1415 dnl path to it, since it may not exist yet if we build outside of
1418 LDFLAGS="$LDFLAGS -L$pwd/ares"
1421 CPPFLAGS="$CPPFLAGS -I$enableval/include"
1422 LDFLAGS="$LDFLAGS -L$enableval/lib"
1425 if test -z "$aresembedded"; then
1426 dnl verify that a sufficient c-ares is here if we have pointed one
1427 dnl out and don't use the "embedded" ares dir (in which case we don't
1428 dnl check it because it might not have been built yet)
1429 AC_MSG_CHECKING([that c-ares is good and recent enough])
1432 /* provide a set of dummy functions in case c-ares was built with debug */
1433 void curl_dofree() { }
1434 void curl_sclose() { }
1435 void curl_domalloc() { }
1439 ares_channel channel;
1440 ares_cancel(channel);
1446 AC_MSG_ERROR([c-ares library defective or too old])
1454 dnl ************************************************************
1455 dnl disable verbose text strings
1457 AC_MSG_CHECKING([whether to enable verbose strings])
1458 AC_ARG_ENABLE(verbose,
1459 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
1460 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
1461 [ case "$enableval" in
1464 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
1465 AC_SUBST(CURL_DISABLE_VERBOSE_STRINGS)
1466 curl_verbose_msg="no"
1468 *) AC_MSG_RESULT(yes)
1474 dnl ************************************************************
1475 dnl lame option to switch on debug options
1477 AC_MSG_CHECKING([whether to enable debug options])
1478 AC_ARG_ENABLE(debug,
1479 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
1480 AC_HELP_STRING([--disable-debug],[Disable debug options]),
1481 [ case "$enableval" in
1485 *) AC_MSG_RESULT(yes)
1487 CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
1490 dnl set compiler "debug" options to become more picky, and remove
1491 dnl optimize options from CFLAGS
1499 dnl ************************************************************
1500 dnl disable cryptographic authentication
1502 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
1503 AC_ARG_ENABLE(crypto-auth,
1504 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
1505 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
1506 [ case "$enableval" in
1509 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
1510 AC_SUBST(CURL_DISABLE_CRYPTO_AUTH)
1512 *) AC_MSG_RESULT(yes)
1518 dnl ************************************************************
1519 dnl disable cookies support
1521 AC_MSG_CHECKING([whether to enable support for cookies])
1522 AC_ARG_ENABLE(cookies,
1523 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
1524 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
1525 [ case "$enableval" in
1528 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
1529 AC_SUBST(CURL_DISABLE_COOKIES)
1531 *) AC_MSG_RESULT(yes)
1537 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
1539 AC_CONFIG_FILES([Makefile \
1541 docs/examples/Makefile \
1542 docs/libcurl/Makefile \
1544 include/curl/Makefile \
1548 tests/data/Makefile \
1549 tests/server/Makefile \
1550 tests/libtest/Makefile \
1552 packages/Win32/Makefile \
1553 packages/Win32/cygwin/Makefile \
1554 packages/Linux/Makefile \
1555 packages/Linux/RPM/Makefile \
1556 packages/Linux/RPM/curl.spec \
1557 packages/Linux/RPM/curl-ssl.spec \
1558 packages/Solaris/Makefile \
1559 packages/DOS/Makefile \
1560 packages/EPM/curl.list \
1561 packages/EPM/Makefile \
1562 packages/vms/Makefile \
1567 AC_MSG_NOTICE([Configured to build curl/libcurl:
1569 curl version: ${VERSION}
1571 Install prefix: ${prefix}
1573 SSL support: ${curl_ssl_msg}
1574 zlib support: ${curl_zlib_msg}
1575 krb4 support: ${curl_krb4_msg}
1576 GSSAPI support: ${curl_gss_msg}
1577 SPNEGO support: ${curl_spnego_msg}
1578 c-ares support: ${curl_ares_msg}
1579 ipv6 support: ${curl_ipv6_msg}
1580 IDN support: ${curl_idn_msg}
1581 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
1582 Built-in manual: ${curl_manual_msg}
1583 Verbose errors: ${curl_verbose_msg}