1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at http://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 #***************************************************************************
22 dnl Process this file with autoconf to produce a configure script.
26 dnl We don't know the version number "statically" so we use a dash here
27 AC_INIT([curl], [-], [a suitable curl mailing list: http://curl.haxx.se/mail/])
29 CURL_OVERRIDE_AUTOCONF
31 dnl configure script copyright
32 AC_COPYRIGHT([Copyright (c) 1998 - 2010 Daniel Stenberg, <daniel@haxx.se>
33 This configure script may be copied, distributed and modified under the
34 terms of the curl license; see COPYING for more details])
36 AC_CONFIG_SRCDIR([lib/urldata.h])
37 AM_CONFIG_HEADER(lib/curl_config.h src/curl_config.h include/curl/curlbuild.h)
40 CURL_CHECK_OPTION_DEBUG
41 CURL_CHECK_OPTION_OPTIMIZE
42 CURL_CHECK_OPTION_WARNINGS
43 CURL_CHECK_OPTION_WERROR
44 CURL_CHECK_OPTION_CURLDEBUG
45 CURL_CHECK_OPTION_ARES
47 CURL_CHECK_PATH_SEPARATOR_REQUIRED
50 # save the configure arguments
52 CONFIGURE_OPTIONS="\"$ac_configure_args\""
53 AC_SUBST(CONFIGURE_OPTIONS)
56 if test X"$want_werror" = Xyes; then
57 CURL_CFLAG_EXTRAS="-Werror"
59 AC_SUBST(CURL_CFLAG_EXTRAS)
61 dnl SED is mandatory for configure process and libtool.
62 dnl Set it now, allowing it to be changed later.
63 if test -z "$SED"; then
64 dnl allow it to be overridden
65 AC_PATH_PROG([SED], [sed], [not_found],
66 [$PATH:/usr/bin:/usr/local/bin])
67 if test -z "$SED" || test "$SED" = "not_found"; then
68 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
73 dnl GREP is mandatory for configure process and libtool.
74 dnl Set it now, allowing it to be changed later.
75 if test -z "$GREP"; then
76 dnl allow it to be overridden
77 AC_PATH_PROG([GREP], [grep], [not_found],
78 [$PATH:/usr/bin:/usr/local/bin])
79 if test -z "$GREP" || test "$GREP" = "not_found"; then
80 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
85 dnl EGREP is mandatory for configure process and libtool.
86 dnl Set it now, allowing it to be changed later.
87 if test -z "$EGREP"; then
88 dnl allow it to be overridden
89 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
90 AC_MSG_CHECKING([for egrep])
92 AC_MSG_RESULT([$EGREP])
94 AC_PATH_PROG([EGREP], [egrep], [not_found],
95 [$PATH:/usr/bin:/usr/local/bin])
98 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
99 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
103 dnl AR is mandatory for configure process and libtool.
104 dnl This is target dependent, so check it as a tool.
105 if test -z "$AR"; then
106 dnl allow it to be overridden
107 AC_PATH_TOOL([AR], [ar], [not_found],
108 [$PATH:/usr/bin:/usr/local/bin])
109 if test -z "$AR" || test "$AR" = "not_found"; then
110 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
117 dnl Remove non-configure distributed curlbuild.h
118 if test -f ${srcdir}/include/curl/curlbuild.h; then
119 rm -f ${srcdir}/include/curl/curlbuild.h
122 dnl figure out the libcurl version
123 VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
124 AM_INIT_AUTOMAKE(curl,$VERSION)
125 AC_MSG_CHECKING([curl version])
126 AC_MSG_RESULT($VERSION)
129 dnl we extract the numerical version for curl-config only
130 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
133 dnl Solaris pkgadd support definitions
134 PKGADD_PKG="HAXXcurl"
135 PKGADD_NAME="cURL - a client that groks URLs"
136 PKGADD_VENDOR="curl.haxx.se"
138 AC_SUBST(PKGADD_NAME)
139 AC_SUBST(PKGADD_VENDOR)
142 dnl initialize all the info variables
143 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl} )"
144 curl_ssh_msg="no (--with-libssh2)"
145 curl_zlib_msg="no (--with-zlib)"
146 curl_krb4_msg="no (--with-krb4*)"
147 curl_gss_msg="no (--with-gssapi)"
148 curl_spnego_msg="no (--with-spnego)"
149 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
150 curl_ipv6_msg="no (--enable-ipv6)"
151 curl_idn_msg="no (--with-libidn)"
152 curl_manual_msg="no (--enable-manual)"
153 curl_verbose_msg="enabled (--disable-verbose)"
154 curl_sspi_msg="no (--enable-sspi)"
155 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
156 curl_ldaps_msg="no (--enable-ldaps)"
157 curl_rtsp_msg="no (--enable-rtsp)"
158 curl_rtmp_msg="no (--with-librtmp)"
161 dnl Save anything in $LIBS for later
166 dnl Detect the canonical host and target build environment
170 dnl Get system canonical name
171 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
173 dnl Checks for programs.
176 dnl Our curl_off_t internal and external configure settings
177 CURL_CONFIGURE_CURL_OFF_T
179 dnl This defines _ALL_SOURCE for AIX
180 CURL_CHECK_AIX_ALL_SOURCE
182 dnl Our configure and build reentrant settings
183 CURL_CONFIGURE_THREAD_SAFE
184 CURL_CONFIGURE_REENTRANT
186 dnl check for how to do large files
189 dnl support building of Windows DLLs
192 dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
193 AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
195 x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
204 AC_MSG_CHECKING([if compiler is icc (to build with PIC)])
218 AC_MSG_CHECKING([if we need -mimpure-text])
222 if test "$GCC" = "yes"; then
229 AC_MSG_RESULT($mimpure)
230 AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
232 dnl 'STATICLIB' is, in spite of its name, not generic but only for static-only
233 dnl builds on Windows
234 AM_CONDITIONAL(STATICLIB, false)
236 AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
239 AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
241 AC_MSG_CHECKING([if we need CURL_STATICLIB])
242 if test "X$enable_shared" = "Xno"
244 AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
246 AM_CONDITIONAL(STATICLIB, true)
256 # Determine whether all dependent libraries must be specified when linking
257 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
263 AC_SUBST(REQUIRE_LIB_DEPS)
265 dnl The install stuff has already been taken care of by the automake stuff
269 dnl check if there's a way to force code inline
272 dnl **********************************************************************
273 dnl platform/compiler/architecture specific checks/flags
274 dnl **********************************************************************
277 CURL_SET_COMPILER_BASIC_OPTS
278 CURL_SET_COMPILER_DEBUG_OPTS
279 CURL_SET_COMPILER_OPTIMIZE_OPTS
280 CURL_SET_COMPILER_WARNING_OPTS
282 if test "$compiler_id" = "INTEL_UNIX_C"; then
284 if test "$compiler_num" -ge "1000"; then
285 dnl icc 10.X or later
286 CFLAGS="$CFLAGS -shared-intel"
287 elif test "$compiler_num" -ge "900"; then
289 CFLAGS="$CFLAGS -i-dynamic"
294 CURL_CHECK_COMPILER_HALT_ON_ERROR
295 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
297 CURL_CHECK_NO_UNDEFINED
298 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
301 AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
303 dnl **********************************************************************
304 dnl Compilation based checks should not be done before this point.
305 dnl **********************************************************************
307 dnl **********************************************************************
308 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
309 dnl and ws2tcpip.h take precedence over any other further checks which
310 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
311 dnl this specific header files. And do them before its results are used.
312 dnl **********************************************************************
314 CURL_CHECK_HEADER_WINDOWS
315 CURL_CHECK_NATIVE_WINDOWS
316 case X-"$ac_cv_native_windows" in
318 CURL_CHECK_HEADER_WINSOCK
319 CURL_CHECK_HEADER_WINSOCK2
320 CURL_CHECK_HEADER_WS2TCPIP
321 CURL_CHECK_HEADER_WINLDAP
322 CURL_CHECK_HEADER_WINBER
325 ac_cv_header_winsock_h="no"
326 ac_cv_header_winsock2_h="no"
327 ac_cv_header_ws2tcpip_h="no"
328 ac_cv_header_winldap_h="no"
329 ac_cv_header_winber_h="no"
332 CURL_CHECK_WIN32_LARGEFILE
334 dnl ************************************************************
335 dnl switch off particular protocols
337 AC_MSG_CHECKING([whether to support http])
339 AC_HELP_STRING([--enable-http],[Enable HTTP support])
340 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
341 [ case "$enableval" in
344 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
345 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
346 AC_SUBST(CURL_DISABLE_HTTP, [1])
347 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
348 AC_SUBST(CURL_DISABLE_RTSP, [1])
350 *) AC_MSG_RESULT(yes)
355 AC_MSG_CHECKING([whether to support ftp])
357 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
358 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
359 [ case "$enableval" in
362 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
363 AC_SUBST(CURL_DISABLE_FTP, [1])
365 *) AC_MSG_RESULT(yes)
370 AC_MSG_CHECKING([whether to support file])
372 AC_HELP_STRING([--enable-file],[Enable FILE support])
373 AC_HELP_STRING([--disable-file],[Disable FILE support]),
374 [ case "$enableval" in
377 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
378 AC_SUBST(CURL_DISABLE_FILE, [1])
380 *) AC_MSG_RESULT(yes)
385 AC_MSG_CHECKING([whether to support ldap])
387 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
388 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
389 [ case "$enableval" in
392 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
393 AC_SUBST(CURL_DISABLE_LDAP, [1])
401 AC_MSG_CHECKING([whether to support ldaps])
403 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
404 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
405 [ case "$enableval" in
408 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
409 AC_SUBST(CURL_DISABLE_LDAPS, [1])
411 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
412 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
413 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
414 AC_SUBST(CURL_DISABLE_LDAPS, [1])
417 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
418 AC_SUBST(HAVE_LDAP_SSL, [1])
422 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
424 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
425 AC_SUBST(CURL_DISABLE_LDAPS, [1])
428 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
429 AC_SUBST(HAVE_LDAP_SSL, [1])
433 AC_MSG_CHECKING([whether to support rtsp])
435 AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
436 AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
437 [ case "$enableval" in
440 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
441 AC_SUBST(CURL_DISABLE_RTSP, [1])
443 *) if test x$CURL_DISABLE_HTTP = x1 ; then
444 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
447 curl_rtsp_msg="enabled"
451 if test "x$CURL_DISABLE_HTTP" != "x1"; then
453 curl_rtsp_msg="enabled"
459 AC_MSG_CHECKING([whether to support proxies])
461 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
462 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
463 [ case "$enableval" in
466 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
467 AC_SUBST(CURL_DISABLE_PROXY, [1])
469 *) AC_MSG_RESULT(yes)
475 AC_MSG_CHECKING([whether to support dict])
477 AC_HELP_STRING([--enable-dict],[Enable DICT support])
478 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
479 [ case "$enableval" in
482 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
483 AC_SUBST(CURL_DISABLE_DICT, [1])
485 *) AC_MSG_RESULT(yes)
490 AC_MSG_CHECKING([whether to support telnet])
491 AC_ARG_ENABLE(telnet,
492 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
493 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
494 [ case "$enableval" in
497 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
498 AC_SUBST(CURL_DISABLE_TELNET, [1])
500 *) AC_MSG_RESULT(yes)
505 AC_MSG_CHECKING([whether to support tftp])
507 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
508 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
509 [ case "$enableval" in
512 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
513 AC_SUBST(CURL_DISABLE_TFTP, [1])
515 *) AC_MSG_RESULT(yes)
521 AC_MSG_CHECKING([whether to support pop3])
523 AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
524 AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
525 [ case "$enableval" in
528 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
529 AC_SUBST(CURL_DISABLE_POP3, [1])
531 *) AC_MSG_RESULT(yes)
538 AC_MSG_CHECKING([whether to support imap])
540 AC_HELP_STRING([--enable-imap],[Enable IMAP support])
541 AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
542 [ case "$enableval" in
545 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
546 AC_SUBST(CURL_DISABLE_IMAP, [1])
548 *) AC_MSG_RESULT(yes)
555 AC_MSG_CHECKING([whether to support smtp])
557 AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
558 AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
559 [ case "$enableval" in
562 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
563 AC_SUBST(CURL_DISABLE_SMTP, [1])
565 *) AC_MSG_RESULT(yes)
571 AC_MSG_CHECKING([whether to support gopher])
572 AC_ARG_ENABLE(gopher,
573 AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
574 AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
575 [ case "$enableval" in
578 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
579 AC_SUBST(CURL_DISABLE_GOPHER, [1])
581 *) AC_MSG_RESULT(yes)
588 dnl **********************************************************************
589 dnl Check for built-in manual
590 dnl **********************************************************************
592 AC_MSG_CHECKING([whether to provide built-in manual])
593 AC_ARG_ENABLE(manual,
594 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
595 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
596 [ case "$enableval" in
600 *) AC_MSG_RESULT(yes)
607 dnl The actual use of the USE_MANUAL variable is done much later in this
608 dnl script to allow other actions to disable it as well.
610 dnl **********************************************************************
611 dnl Checks for libraries.
612 dnl **********************************************************************
616 dnl gethostbyname without lib or in the nsl lib?
617 AC_CHECK_FUNC(gethostbyname,
618 [HAVE_GETHOSTBYNAME="1"
620 [ AC_CHECK_LIB(nsl, gethostbyname,
621 [HAVE_GETHOSTBYNAME="1"
626 if test "$HAVE_GETHOSTBYNAME" != "1"
628 dnl gethostbyname in the socket lib?
629 AC_CHECK_LIB(socket, gethostbyname,
630 [HAVE_GETHOSTBYNAME="1"
631 LIBS="$LIBS -lsocket"
635 dnl At least one system has been identified to require BOTH nsl and socket
636 dnl libs at the same time to link properly.
637 if test "$HAVE_GETHOSTBYNAME" != "1"
639 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
640 my_ac_save_LIBS=$LIBS
641 LIBS="-lnsl -lsocket $LIBS"
649 HAVE_GETHOSTBYNAME="1"
652 LIBS=$my_ac_save_LIBS
656 if test "$HAVE_GETHOSTBYNAME" != "1"
658 dnl This is for winsock systems
659 if test "$ac_cv_header_windows_h" = "yes"; then
660 if test "$ac_cv_header_winsock_h" = "yes"; then
663 winsock_LIB="-lwinsock"
666 winsock_LIB="-lwsock32"
670 if test "$ac_cv_header_winsock2_h" = "yes"; then
671 winsock_LIB="-lws2_32"
673 if test ! -z "$winsock_LIB"; then
674 my_ac_save_LIBS=$LIBS
675 LIBS="$winsock_LIB $LIBS"
676 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
679 #ifdef HAVE_WINDOWS_H
680 #ifndef WIN32_LEAN_AND_MEAN
681 #define WIN32_LEAN_AND_MEAN
684 #ifdef HAVE_WINSOCK2_H
685 #include <winsock2.h>
687 #ifdef HAVE_WINSOCK_H
693 gethostbyname("www.dummysite.com");
697 HAVE_GETHOSTBYNAME="1"
701 LIBS=$my_ac_save_LIBS
707 if test "$HAVE_GETHOSTBYNAME" != "1"
709 dnl This is for Minix 3.1
710 AC_MSG_CHECKING([for gethostbyname for Minix 3])
713 /* Older Minix versions may need <net/gen/netdb.h> here instead */
716 gethostbyname("www.dummysite.com");
720 HAVE_GETHOSTBYNAME="1"
726 if test "$HAVE_GETHOSTBYNAME" != "1"
728 dnl This is for eCos with a stubbed DNS implementation
729 AC_MSG_CHECKING([for gethostbyname for eCos])
735 gethostbyname("www.dummysite.com");
739 HAVE_GETHOSTBYNAME="1"
745 if test "$HAVE_GETHOSTBYNAME" != "1"
747 dnl gethostbyname in the network lib - for Haiku OS
748 AC_CHECK_LIB(network, gethostbyname,
749 [HAVE_GETHOSTBYNAME="1"
750 LIBS="$LIBS -lnetwork"
754 if test "$HAVE_GETHOSTBYNAME" != "1"
756 dnl gethostbyname in the net lib - for BeOS
757 AC_CHECK_LIB(net, gethostbyname,
758 [HAVE_GETHOSTBYNAME="1"
764 if test "$HAVE_GETHOSTBYNAME" != "1"; then
765 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
769 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
771 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
772 AC_CHECK_LIB(resolve, strcasecmp,
773 [LIBS="-lresolve $LIBS"],
777 ac_cv_func_strcasecmp="no"
779 CURL_CHECK_LIBS_CONNECT
781 CURL_NETWORK_LIBS=$LIBS
783 dnl **********************************************************************
784 dnl In case that function clock_gettime with monotonic timer is available,
785 dnl check for additional required libraries.
786 dnl **********************************************************************
787 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
789 dnl **********************************************************************
790 dnl The preceding library checks are all potentially useful for test
791 dnl servers (for providing networking support). Save the list of required
792 dnl libraries at this point for use while linking those test servers.
793 dnl **********************************************************************
794 TEST_SERVER_LIBS=$LIBS
796 dnl **********************************************************************
797 AC_MSG_CHECKING([whether to use libgcc])
798 AC_ARG_ENABLE(libgcc,
799 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
800 [ case "$enableval" in
802 ALL_LIBS="$ALL_LIBS -lgcc"
811 dnl **********************************************************************
813 dnl **********************************************************************
816 AC_ARG_WITH(ldap-lib,
817 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
818 [LDAPLIBNAME="$withval"])
821 AC_ARG_WITH(lber-lib,
822 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
823 [LBERLIBNAME="$withval"])
825 if test x$CURL_DISABLE_LDAP != x1 ; then
827 CURL_CHECK_HEADER_LBER
828 CURL_CHECK_HEADER_LDAP
829 CURL_CHECK_HEADER_LDAPSSL
830 CURL_CHECK_HEADER_LDAP_SSL
832 if test -z "$LDAPLIBNAME" ; then
833 if test "$ac_cv_native_windows" = "yes"; then
834 dnl Windows uses a single and unique LDAP library name
835 LDAPLIBNAME="wldap32"
840 if test "$LDAPLIBNAME" ; then
841 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
842 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
843 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
844 AC_SUBST(CURL_DISABLE_LDAP, [1])])
845 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
846 AC_SUBST(CURL_DISABLE_LDAPS, [1])
848 dnl Try to find the right ldap libraries for this system
850 case X-"$curl_cv_ldap_LIBS" in
852 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
853 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
854 AC_SUBST(CURL_DISABLE_LDAP, [1])
855 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
856 AC_SUBST(CURL_DISABLE_LDAPS, [1])
862 if test x$CURL_DISABLE_LDAP != x1 ; then
864 if test "$LBERLIBNAME" ; then
865 dnl If name is "no" then don't define this library at all
866 dnl (it's only needed if libldap.so's dependencies are broken).
867 if test "$LBERLIBNAME" != "no" ; then
868 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
869 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
870 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
871 AC_SUBST(CURL_DISABLE_LDAP, [1])])
872 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
873 AC_SUBST(CURL_DISABLE_LDAPS, [1])
878 if test x$CURL_DISABLE_LDAP != x1 ; then
879 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
881 if test "$LDAPLIBNAME" = "wldap32"; then
882 curl_ldap_msg="enabled (winldap)"
883 AC_DEFINE(CURL_LDAP_WIN, 1, [Use Windows LDAP implementation])
885 curl_ldap_msg="enabled (OpenLDAP)"
886 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
887 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
888 AC_SUBST(USE_OPENLDAP, [1])
893 if test x$CURL_DISABLE_LDAPS != x1 ; then
894 curl_ldaps_msg="enabled"
897 dnl **********************************************************************
899 dnl **********************************************************************
901 AC_MSG_CHECKING([whether to enable ipv6])
903 AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
904 AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
905 [ case "$enableval" in
910 *) AC_MSG_RESULT(yes)
915 AC_TRY_RUN([ /* is AF_INET6 available? */
916 #include <sys/types.h>
917 #include <sys/socket.h>
920 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
934 if test "$ipv6" = "yes"; then
935 curl_ipv6_msg="enabled"
938 # Check if struct sockaddr_in6 have sin6_scope_id member
939 if test "$ipv6" = yes; then
940 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
942 #include <sys/types.h>
943 #include <netinet/in.h>] ,
944 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
945 if test "$have_sin6_scope_id" = yes; then
947 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
953 dnl **********************************************************************
954 dnl Check if the operating system allows programs to write to their own argv[]
955 dnl **********************************************************************
957 AC_MSG_CHECKING([if argv can be written to])
960 int main(int argc, char ** argv) {
962 return (argv[0][0] == ' ')?0:1;
966 curl_cv_writable_argv=yes
968 curl_cv_writable_argv=no
970 curl_cv_writable_argv=cross
972 case $curl_cv_writable_argv in
974 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
982 AC_MSG_WARN([the previous check could not be made default was used])
986 dnl **********************************************************************
987 dnl Check for the presence of Kerberos4 libraries and headers
988 dnl **********************************************************************
990 AC_ARG_WITH(krb4-includes,
991 AC_HELP_STRING([--with-krb4-includes=DIR],
992 [Specify location of kerberos4 headers]),[
993 CPPFLAGS="$CPPFLAGS -I$withval"
998 AC_ARG_WITH(krb4-libs,
999 AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
1000 LDFLAGS="$LDFLAGS -L$withval"
1007 AC_ARG_WITH(krb4,dnl
1008 AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
1010 if test X"$OPT_KRB4" != Xno; then
1012 if test X"$OPT_KRB4" != Xyes; then
1013 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
1014 KRB4LIB="$OPT_KRB4/lib$libsuff"
1015 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
1016 KRB4INC="$OPT_KRB4/include"
1021 AC_MSG_CHECKING([if Kerberos4 support is requested])
1023 if test "$want_krb4" = yes
1025 if test "$ipv6" = "yes"; then
1026 echo krb4 is not compatible with IPv6
1031 dnl Check for & handle argument to --with-krb4
1033 AC_MSG_CHECKING(where to look for Kerberos4)
1034 if test X"$OPT_KRB4" = Xyes
1036 AC_MSG_RESULT([defaults])
1038 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
1041 dnl Check for DES library
1042 AC_CHECK_LIB(des, des_pcbc_encrypt,
1044 AC_CHECK_HEADERS(des.h)
1047 AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
1049 dnl Check for the Kerberos4 library
1050 AC_CHECK_LIB(krb, krb_net_read,
1052 dnl Check for header files
1053 AC_CHECK_HEADERS(krb.h)
1055 dnl we found the required libraries, add to LIBS
1056 LIBS="-lkrb -lcom_err -ldes $LIBS"
1058 dnl Check for function krb_get_our_ip_for_realm
1059 dnl this is needed for NAT networks
1060 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
1063 AC_DEFINE(HAVE_KRB4, 1,
1064 [if you have the Kerberos4 libraries (including -ldes)])
1066 dnl substitute it too!
1068 AC_SUBST(KRB4_ENABLED)
1070 curl_krb4_msg="enabled"
1072 dnl the krb4 stuff needs a strlcpy()
1073 AC_CHECK_FUNCS(strlcpy)
1081 dnl **********************************************************************
1082 dnl Check for FBopenssl(SPNEGO) libraries
1083 dnl **********************************************************************
1086 AC_HELP_STRING([--with-spnego=DIR],
1087 [Specify location of SPNEGO library fbopenssl]), [
1088 SPNEGO_ROOT="$withval"
1089 if test x"$SPNEGO_ROOT" != xno; then
1094 AC_MSG_CHECKING([if SPNEGO support is requested])
1095 if test x"$want_spnego" = xyes; then
1097 if test X"$SPNEGO_ROOT" = Xyes; then
1098 AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
1101 if test -z "$SPNEGO_LIB_DIR"; then
1102 LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
1104 LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
1108 AC_DEFINE(HAVE_SPNEGO, 1,
1109 [Define this if you have the SPNEGO library fbopenssl])
1110 curl_spnego_msg="enabled"
1116 dnl **********************************************************************
1117 dnl Check for GSS-API libraries
1118 dnl **********************************************************************
1120 dnl check for gss stuff in the /usr as default
1123 AC_ARG_WITH(gssapi-includes,
1124 AC_HELP_STRING([--with-gssapi-includes=DIR],
1125 [Specify location of GSSAPI header]),
1126 [ GSSAPI_INCS="-I$withval"
1130 AC_ARG_WITH(gssapi-libs,
1131 AC_HELP_STRING([--with-gssapi-libs=DIR],
1132 [Specify location of GSSAPI libs]),
1133 [ GSSAPI_LIB_DIR="-L$withval"
1138 AC_HELP_STRING([--with-gssapi=DIR],
1139 [Where to look for GSSAPI]), [
1140 GSSAPI_ROOT="$withval"
1141 if test x"$GSSAPI_ROOT" != xno; then
1143 if test x"$GSSAPI_ROOT" = xyes; then
1144 dnl if yes, then use default root
1150 save_CPPFLAGS="$CPPFLAGS"
1151 AC_MSG_CHECKING([if GSSAPI support is requested])
1152 if test x"$want_gss" = xyes; then
1155 if test -z "$GSSAPI_INCS"; then
1156 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1157 GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1158 elif test "$GSSAPI_ROOT" != "yes"; then
1159 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1163 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1165 AC_CHECK_HEADER(gss.h,
1167 dnl found in the given dirs
1168 AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
1172 dnl not found, check Heimdal or MIT
1173 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1175 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1180 #ifdef HAVE_GSSAPI_GSSAPI_H
1181 #include <gssapi/gssapi.h>
1184 if test "x$not_mit" = "x1"; then
1185 dnl MIT not found, check for Heimdal
1186 AC_CHECK_HEADER(gssapi.h,
1189 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
1192 dnl no header found, disabling GSS
1194 AC_MSG_WARN(disabling GSSAPI since no header files was found)
1199 AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
1200 dnl check if we have a really old MIT kerberos (<= 1.2)
1201 AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1204 #include <gssapi/gssapi.h>
1205 #include <gssapi/gssapi_generic.h>
1206 #include <gssapi/gssapi_krb5.h>
1211 GSS_C_NT_HOSTBASED_SERVICE,
1215 AC_MSG_RESULT([yes])
1218 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
1219 [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1227 if test x"$want_gss" = xyes; then
1228 AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
1230 curl_gss_msg="enabled (MIT/Heimdal)"
1232 if test -n "$gnu_gss"; then
1233 curl_gss_msg="enabled (GNU GSS)"
1234 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1236 elif test -z "$GSSAPI_LIB_DIR"; then
1239 LIBS="$LIBS -lgssapi_krb5 -lresolv"
1242 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1243 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1245 gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1246 # LIBS="$LIBS $gss_libs"
1247 LIBS="$LIBS -lgssapi_krb5"
1248 elif test "$GSSAPI_ROOT" != "yes"; then
1249 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1250 LIBS="$LIBS -lgssapi"
1252 LIBS="$LIBS -lgssapi"
1257 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1258 LIBS="$LIBS -lgssapi"
1261 CPPFLAGS="$save_CPPFLAGS"
1264 dnl **********************************************************************
1265 dnl Check for the presence of SSL libraries and headers
1266 dnl **********************************************************************
1268 dnl Default to compiler & linker defaults for SSL files & libraries.
1270 dnl Default to no CA bundle
1273 AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1274 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1277 if test X"$OPT_SSL" != Xno; then
1278 dnl backup the pre-ssl variables
1279 CLEANLDFLAGS="$LDFLAGS"
1280 CLEANCPPFLAGS="$CPPFLAGS"
1285 dnl --with-ssl (without path) used
1286 if test x$cross_compiling != xyes; then
1287 dnl only do pkg-config magic when not cross-compiling
1290 PREFIX_OPENSSL=/usr/local/ssl
1291 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1294 dnl no --with-ssl option given, just check default places
1295 if test x$cross_compiling != xyes; then
1296 dnl only do pkg-config magic when not cross-compiling
1302 dnl check the given --with-ssl spot
1304 PREFIX_OPENSSL=$OPT_SSL
1306 dnl Try pkg-config even when cross-compiling. Since we
1307 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1308 dnl the user told us to look
1309 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1310 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
1311 if test -e "$OPENSSL_PCDIR/openssl.pc"; then
1315 dnl in case pkg-config comes up empty, use what we got
1317 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1318 if test "$PREFIX_OPENSSL" != "/usr" ; then
1319 SSL_LDFLAGS="-L$LIB_OPENSSL"
1320 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1322 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1326 if test "$PKGTEST" = "yes"; then
1328 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1330 if test "$PKGCONFIG" != "no" ; then
1331 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1332 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1334 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1335 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1337 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1338 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1340 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1341 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1342 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1344 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1346 dnl use the values pkg-config reported. This is here
1347 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1348 dnl learn about this via pkg-config. If we only have
1349 dnl the argument to --with-ssl we don't know what
1350 dnl additional libs may be necessary. Hope that we
1352 LIBS="$LIBS $SSL_LIBS"
1356 dnl finally, set flags to use SSL
1357 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1358 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1360 dnl This is for Msys/Mingw
1362 *-*-msys* | *-*-mingw*)
1363 AC_MSG_CHECKING([for gdi32])
1364 my_ac_save_LIBS=$LIBS
1365 LIBS="-lgdi32 $LIBS"
1366 AC_TRY_LINK([#include <windef.h>
1367 #include <wingdi.h>],
1370 AC_MSG_RESULT([yes])],
1371 [ dnl failed, restore LIBS
1372 LIBS=$my_ac_save_LIBS
1378 AC_CHECK_LIB(crypto, CRYPTO_lock,[
1380 LIBS="-lcrypto $LIBS"
1382 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1383 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1384 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
1386 LIBS="-lcrypto $LIBS"], [
1387 LDFLAGS="$CLEANLDFLAGS"
1388 CPPFLAGS="$CLEANCPPFLAGS"
1394 if test X"$HAVECRYPTO" = X"yes"; then
1395 dnl This is only reasonable to do if crypto actually is there: check for
1396 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1398 AC_CHECK_LIB(ssl, SSL_connect)
1400 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1401 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1402 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1404 LIBS="$LIBS -lRSAglue -lrsaref"
1405 AC_CHECK_LIB(ssl, SSL_connect)
1406 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1407 dnl still no SSL_connect
1416 dnl Have the libraries--check for SSLeay/OpenSSL headers
1417 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1418 openssl/pem.h openssl/ssl.h openssl/err.h,
1419 curl_ssl_msg="enabled (OpenSSL)"
1421 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1423 if test $ac_cv_header_openssl_x509_h = no; then
1424 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1425 dnl since 'err.h' might in fact find a krb4 header with the same
1427 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1429 if test $ac_cv_header_x509_h = yes &&
1430 test $ac_cv_header_crypto_h = yes &&
1431 test $ac_cv_header_ssl_h = yes; then
1433 curl_ssl_msg="enabled (OpenSSL)"
1439 if test X"$OPENSSL_ENABLED" = X"1"; then
1440 AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
1442 dnl is there a pkcs12.h header present?
1443 AC_CHECK_HEADERS(openssl/pkcs12.h)
1447 dnl USE_SSLEAY is the historical name for what configure calls
1448 dnl OPENSSL_ENABLED; the names should really be unified
1449 USE_SSLEAY="$OPENSSL_ENABLED"
1450 AC_SUBST(USE_SSLEAY)
1452 if test X"$OPT_SSL" != Xoff &&
1453 test "$OPENSSL_ENABLED" != "1"; then
1454 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1458 if test X"$OPENSSL_ENABLED" = X"1"; then
1459 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1460 dnl stuff, it is kind of "separated" from the main SSL check
1461 AC_CHECK_FUNC(ENGINE_init,
1463 AC_CHECK_HEADERS(openssl/engine.h)
1464 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1467 dnl these can only exist if openssl exists
1468 dnl yassl doesn't have SSL_get_shutdown
1470 AC_CHECK_FUNCS( RAND_status \
1474 CRYPTO_cleanup_all_ex_data \
1477 dnl Make an attempt to detect if this is actually yassl's headers and
1478 dnl OpenSSL emulation layer. We still leave everything else believing
1479 dnl and acting like OpenSSL.
1481 AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
1484 #include <openssl/ssl.h>
1486 #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
1487 int dummy = SSL_ERROR_NONE;
1489 Not the yaSSL OpenSSL compatibility header.
1493 AC_MSG_RESULT([yes])
1494 AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
1495 [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
1496 curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
1502 if test "$OPENSSL_ENABLED" = "1"; then
1503 if test -n "$LIB_OPENSSL"; then
1504 dnl when the ssl shared libs were found in a path that the run-time
1505 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1506 dnl to prevent further configure tests to fail due to this
1508 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1509 export LD_LIBRARY_PATH
1510 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1516 dnl **********************************************************************
1517 dnl Check for the presence of ZLIB libraries and headers
1518 dnl **********************************************************************
1520 dnl Check for & handle argument to --with-zlib.
1525 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
1526 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
1527 [OPT_ZLIB="$withval"])
1529 if test "$OPT_ZLIB" = "no" ; then
1530 AC_MSG_WARN([zlib disabled])
1532 if test "$OPT_ZLIB" = "yes" ; then
1536 if test -z "$OPT_ZLIB" ; then
1537 dnl check for the lib first without setting any new path, since many
1538 dnl people have it in the default path
1540 AC_CHECK_LIB(z, inflateEnd,
1541 dnl libz found, set the variable
1543 dnl if no lib found, try /usr/local
1544 [OPT_ZLIB="/usr/local"])
1548 dnl Add a nonempty path to the compiler flags
1549 if test -n "$OPT_ZLIB"; then
1550 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
1551 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
1554 AC_CHECK_HEADER(zlib.h,
1556 dnl zlib.h was found
1558 dnl if the lib wasn't found already, try again with the new paths
1559 if test "$HAVE_LIBZ" != "1"; then
1560 AC_CHECK_LIB(z, gzread,
1562 dnl the lib was found!
1565 [ CPPFLAGS=$_cppflags
1570 dnl zlib.h was not found, restore the flags
1575 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
1577 AC_MSG_WARN([configure found only the libz lib, not the header file!])
1579 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
1581 AC_MSG_WARN([configure found only the libz header file, not the lib!])
1582 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
1584 dnl both header and lib were found!
1586 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
1587 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
1589 CURL_LIBS="$CURL_LIBS -lz"
1592 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1594 AC_MSG_NOTICE([found both libz and libz.h header])
1595 curl_zlib_msg="enabled"
1599 dnl set variable for use in automakefile(s)
1600 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1602 dnl **********************************************************************
1603 dnl Check for the random seed preferences
1604 dnl **********************************************************************
1606 if test X"$OPENSSL_ENABLED" = X"1"; then
1607 AC_ARG_WITH(egd-socket,
1608 AC_HELP_STRING([--with-egd-socket=FILE],
1609 [Entropy Gathering Daemon socket pathname]),
1610 [ EGD_SOCKET="$withval" ]
1612 if test -n "$EGD_SOCKET" ; then
1613 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1614 [your Entropy Gathering Daemon socket pathname] )
1617 dnl Check for user-specified random device
1619 AC_HELP_STRING([--with-random=FILE],
1620 [read randomness from FILE (default=/dev/urandom)]),
1621 [ RANDOM_FILE="$withval" ],
1623 dnl Check for random device
1624 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1627 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1628 AC_SUBST(RANDOM_FILE)
1629 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1630 [a suitable file to read random data from])
1634 dnl ----------------------------------------------------
1635 dnl check for GnuTLS
1636 dnl ----------------------------------------------------
1638 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1641 AC_ARG_WITH(gnutls,dnl
1642 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
1643 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1644 OPT_GNUTLS=$withval)
1646 if test "$OPENSSL_ENABLED" != "1"; then
1648 if test X"$OPT_GNUTLS" != Xno; then
1651 if test "x$OPT_GNUTLS" = "xyes"; then
1652 dnl this is with no partiular path given
1653 CURL_CHECK_PKGCONFIG(gnutls)
1655 if test "$PKGCONFIG" != "no" ; then
1656 addlib=`$PKGCONFIG --libs-only-l gnutls`
1657 addld=`$PKGCONFIG --libs-only-L gnutls`
1658 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1659 version=`$PKGCONFIG --modversion gnutls`
1660 gtlslib=`echo $addld | $SED -e 's/-L//'`
1662 dnl without pkg-config, we try libgnutls-config as that was how it
1664 check=`libgnutls-config --version 2>/dev/null`
1665 if test -n "$check"; then
1666 addlib=`libgnutls-config --libs`
1667 addcflags=`libgnutls-config --cflags`
1668 version=`libgnutls-config --version`
1669 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1673 dnl this is with a given path, first check if there's a libgnutls-config
1674 dnl there and if not, make an educated guess
1675 cfg=$OPT_GNUTLS/bin/libgnutls-config
1676 check=`$cfg --version 2>/dev/null`
1677 if test -n "$check"; then
1678 addlib=`$cfg --libs`
1679 addcflags=`$cfg --cflags`
1680 version=`$cfg --version`
1681 gtlslib=`$cfg --prefix`/lib$libsuff
1683 dnl without pkg-config and libgnutls-config, we guess a lot!
1685 addld=-L$OPT_GNUTLS/lib$libsuff
1686 addcflags=-I$OPT_GNUTLS/include
1687 version="" # we just don't know
1688 gtlslib=$OPT_GNUTLS/lib$libsuff
1692 if test -z "$version"; then
1693 dnl lots of efforts, still no go
1697 if test -n "$addlib"; then
1700 CLEANCPPFLAGS="$CPPFLAGS"
1701 CLEADLDFLAGS="$LDFLAGS"
1703 LIBS="$LIBS $addlib"
1704 LDFLAGS="$LDFLAGS $addld"
1705 if test "$addcflags" != "-I/usr/include"; then
1706 CPPFLAGS="$CPPFLAGS $addcflags"
1709 AC_CHECK_LIB(gnutls, gnutls_check_version,
1711 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1712 AC_SUBST(USE_GNUTLS, [1])
1715 curl_ssl_msg="enabled (GnuTLS)"
1719 CPPFLAGS="$CLEANCPPFLAGS"
1722 if test "x$USE_GNUTLS" = "xyes"; then
1723 AC_MSG_NOTICE([detected GnuTLS version $version])
1725 if test -n "$gtlslib"; then
1726 dnl when shared libs were found in a path that the run-time
1727 dnl linker doesn't search through, we need to add it to
1728 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1731 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1732 export LD_LIBRARY_PATH
1733 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1739 fi dnl GNUTLS not disabled
1744 dnl If GnuTLS is enabled, we MUST verify that it uses libgcrypt since
1745 dnl curl code relies on that but recent GnuTLS versions can in fact build
1746 dnl with different crypto libraries which curl right now cannot handle
1749 if test "$GNUTLS_ENABLED" = "1"; then
1750 AC_CHECK_LIB(gcrypt,
1753 AC_MSG_ERROR([need GnuTLS built with gcrypt to function with GnuTLS])
1757 dnl ----------------------------------------------------
1758 dnl check for PolarSSL
1759 dnl ----------------------------------------------------
1761 dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1766 AC_ARG_WITH(polarssl,dnl
1767 AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root (default: /usr/local/)])
1768 AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1769 OPT_POLARSSL=$withval)
1771 if test "$OPENSSL_ENABLED" != "1"; then
1773 if test X"$OPT_POLARSSL" != Xno; then
1775 if test "$OPT_POLARSSL" = "yes"; then
1779 if test -z "$OPT_POLARSSL" ; then
1780 dnl check for lib first without setting any new path
1782 AC_CHECK_LIB(polarssl, havege_init,
1783 dnl libpolarssl found, set the variable
1785 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1786 AC_SUBST(USE_POLARSSL, [1])
1789 curl_ssl_msg="enabled (PolarSSL)"
1793 if test "x$USE_POLARSSL" != "xyes"; then
1794 dnl add the path and test again
1795 addld=-L$OPT_POLARSSL/lib$libsuff
1796 addcflags=-I$OPT_POLARSSL/include
1797 polarssllib=$OPT_POLARSSL/lib$libsuff
1799 LDFLAGS="$LDFLAGS $addld"
1800 if test "$addcflags" != "-I/usr/include"; then
1801 CPPFLAGS="$CPPFLAGS $addcflags"
1804 AC_CHECK_LIB(polarssl, ssl_init,
1806 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1807 AC_SUBST(USE_POLARSSL, [1])
1810 curl_ssl_msg="enabled (PolarSSL)"
1818 if test "x$USE_POLARSSL" = "xyes"; then
1819 AC_MSG_NOTICE([detected PolarSSL])
1821 CURL_LIBS="$CURL_LIBS -lpolarssl"
1822 LIBS="$LIBS -lpolarssl"
1824 if test -n "$polarssllib"; then
1825 dnl when shared libs were found in a path that the run-time
1826 dnl linker doesn't search through, we need to add it to
1827 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1830 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
1831 export LD_LIBRARY_PATH
1832 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
1837 fi dnl PolarSSL not disabled
1841 dnl ----------------------------------------------------
1842 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
1843 dnl ----------------------------------------------------
1845 dnl Default to compiler & linker defaults for NSS files & libraries.
1849 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)])
1850 AC_HELP_STRING([--without-nss], [disable NSS detection]),
1853 if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
1855 if test X"$OPT_NSS" != Xno; then
1856 if test "x$OPT_NSS" = "xyes"; then
1858 CURL_CHECK_PKGCONFIG(nss)
1860 if test "$PKGCONFIG" != "no" ; then
1861 addlib=`$PKGCONFIG --libs nss`
1862 addcflags=`$PKGCONFIG --cflags nss`
1863 version=`$PKGCONFIG --modversion nss`
1864 nssprefix=`$PKGCONFIG --variable=prefix nss`
1866 dnl Without pkg-config, we check for nss-config
1868 check=`nss-config --version 2>/dev/null`
1869 if test -n "$check"; then
1870 addlib=`nss-config --libs`
1871 addcflags=`nss-config --cflags`
1872 version=`nss-config --version`
1873 nssprefix=`nss-config --prefix`
1881 # Without pkg-config, we'll kludge in some defaults
1882 addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
1883 addcflags="-I$OPT_NSS/include"
1888 dnl Check for functionPK11_CreateGenericObject
1889 dnl this is needed for using the PEM PKCS#11 module
1890 AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
1892 AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject])
1893 AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1])
1895 if test -n "$addlib"; then
1898 CLEANCPPFLAGS="$CPPFLAGS"
1900 LIBS="$LIBS $addlib"
1901 if test "$addcflags" != "-I/usr/include"; then
1902 CPPFLAGS="$CPPFLAGS $addcflags"
1905 AC_CHECK_LIB(nss3, NSS_Initialize,
1907 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
1908 AC_SUBST(USE_NSS, [1])
1911 curl_ssl_msg="enabled (NSS)"
1915 CPPFLAGS="$CLEANCPPFLAGS"
1918 if test "x$USE_NSS" = "xyes"; then
1919 AC_MSG_NOTICE([detected NSS version $version])
1921 dnl when shared libs were found in a path that the run-time
1922 dnl linker doesn't search through, we need to add it to
1923 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1926 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
1927 export LD_LIBRARY_PATH
1928 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
1933 fi dnl NSS not disabled
1935 fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
1937 if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED" = "x"; then
1938 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
1939 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl or --with-nss to address this.])
1941 # SSL is enabled, genericly
1942 AC_SUBST(SSL_ENABLED)
1946 dnl **********************************************************************
1947 dnl Check for the CA bundle
1948 dnl **********************************************************************
1950 CURL_CHECK_CA_BUNDLE
1952 dnl **********************************************************************
1953 dnl Check for the presence of LIBSSH2 libraries and headers
1954 dnl **********************************************************************
1956 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
1958 AC_ARG_WITH(libssh2,dnl
1959 AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1960 AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
1961 OPT_LIBSSH2=$withval)
1963 if test X"$OPT_LIBSSH2" != Xno; then
1964 dnl backup the pre-libssh2 variables
1965 CLEANLDFLAGS="$LDFLAGS"
1966 CLEANCPPFLAGS="$CPPFLAGS"
1969 case "$OPT_LIBSSH2" in
1971 dnl --with-libssh2 (without path) used
1972 CURL_CHECK_PKGCONFIG(libssh2)
1974 if test "$PKGCONFIG" != "no" ; then
1975 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
1976 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
1977 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
1978 version=`$PKGCONFIG --modversion libssh2`
1979 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
1984 dnl no --with-libssh2 option given, just check default places
1987 dnl use the given --with-libssh2 spot
1988 PREFIX_SSH2=$OPT_LIBSSH2
1992 dnl if given with a prefix, we set -L and -I based on that
1993 if test -n "$PREFIX_SSH2"; then
1994 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
1995 CPP_SSH2=-I${PREFIX_SSH2}/include
1996 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
1999 LDFLAGS="$LDFLAGS $LD_SSH2"
2000 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
2001 LIBS="$LIBS $LIB_SSH2"
2003 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2005 AC_CHECK_HEADERS(libssh2.h,
2006 curl_ssh_msg="enabled (libSSH2)"
2008 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2009 AC_SUBST(USE_LIBSSH2, [1])
2012 if test X"$OPT_LIBSSH2" != Xoff &&
2013 test "$LIBSSH2_ENABLED" != "1"; then
2014 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2017 if test "$LIBSSH2_ENABLED" = "1"; then
2018 if test -n "$DIR_SSH2"; then
2019 dnl when the libssh2 shared libs were found in a path that the run-time
2020 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2021 dnl to prevent further configure tests to fail due to this
2023 dnl libssh2_version is a post 1.0 addition
2024 dnl libssh2_init and libssh2_exit were added in 1.2.5
2025 dnl libssh2_scp_send64 was added in 1.2.6
2026 dnl libssh2_session_handshake was added in 1.2.8
2027 AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
2028 libssh2_scp_send64 libssh2_session_handshake)
2030 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2031 export LD_LIBRARY_PATH
2032 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2035 dnl no libssh2, revert back to clean variables
2036 LDFLAGS=$CLEANLDFLAGS
2037 CPPFLAGS=$CLEANCPPFLAGS
2042 dnl **********************************************************************
2043 dnl Check for the presence of LIBRTMP libraries and headers
2044 dnl **********************************************************************
2046 dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2048 AC_ARG_WITH(librtmp,dnl
2049 AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
2050 AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2051 OPT_LIBRTMP=$withval)
2053 if test X"$OPT_LIBRTMP" != Xno; then
2054 dnl backup the pre-librtmp variables
2055 CLEANLDFLAGS="$LDFLAGS"
2056 CLEANCPPFLAGS="$CPPFLAGS"
2059 case "$OPT_LIBRTMP" in
2061 dnl --with-librtmp (without path) used
2062 CURL_CHECK_PKGCONFIG(librtmp)
2064 if test "$PKGCONFIG" != "no" ; then
2065 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2066 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2067 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2068 version=`$PKGCONFIG --modversion librtmp`
2069 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
2071 dnl To avoid link errors, we do not allow --librtmp without
2072 dnl a pkgconfig file
2073 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
2078 dnl no --with-librtmp option given, just check default places
2082 dnl use the given --with-librtmp spot
2083 PREFIX_RTMP=$OPT_LIBRTMP
2087 dnl if given with a prefix, we set -L and -I based on that
2088 if test -n "$PREFIX_RTMP"; then
2089 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2090 CPP_RTMP=-I${PREFIX_RTMP}/include
2091 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2094 LDFLAGS="$LDFLAGS $LD_RTMP"
2095 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
2096 LIBS="$LIBS $LIB_RTMP"
2098 AC_CHECK_LIB(rtmp, RTMP_Init,
2100 AC_CHECK_HEADERS(librtmp/rtmp.h,
2101 curl_rtmp_msg="enabled (librtmp)"
2103 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2104 AC_SUBST(USE_LIBRTMP, [1])
2107 dnl not found, revert back to clean variables
2108 LDFLAGS=$CLEANLDFLAGS
2109 CPPFLAGS=$CLEANCPPFLAGS
2113 if test X"$OPT_LIBRTMP" != Xoff &&
2114 test "$LIBRTMP_ENABLED" != "1"; then
2115 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2120 dnl **********************************************************************
2121 dnl Check for linker switch for versioned symbols
2122 dnl **********************************************************************
2124 AC_MSG_CHECKING([if libraries can be versioned])
2125 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2126 if test -z "$GLD"; then
2127 versioned_symbols_flavour=
2130 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
2135 AC_MSG_CHECKING([whether versioned symbols are wanted])
2136 versioned_symbols_flavour=
2138 AC_ARG_ENABLE(versioned-symbols,
2139 AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2140 AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2141 [ case "$enableval" in
2142 yes) AC_MSG_RESULT(yes)
2143 if test "$OPENSSL_ENABLED" = "1"; then
2144 versioned_symbols_flavour="OPENSSL_"
2146 if test "$OPT_GNUTLS" != "no"; then
2147 versioned_symbols_flavour="GNUTLS_"
2150 versioned_symbols="yes"
2153 *) AC_MSG_RESULT(no)
2162 AC_SUBST(VERSIONED_FLAVOUR, ["$versioned_symbols_flavour"])
2163 AM_CONDITIONAL(VERSIONED_SYMBOLS, test "$versioned_symbols" = "yes")
2166 dnl **********************************************************************
2167 dnl Check for the presence of IDN libraries and headers
2168 dnl **********************************************************************
2170 AC_MSG_CHECKING([whether to build with libidn])
2172 AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
2173 AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
2174 [LIBIDN="$withval"])
2180 *) AC_MSG_RESULT(yes)
2183 dnl if there is a given path, check that FIRST
2184 if test -n "$LIBIDN"; then
2185 if test "x$LIBIDN" != "xyes"; then
2187 oldCPPFLAGS=$CPPFLAGS
2188 LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
2189 CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
2191 AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
2194 CPPFLAGS=$oldCPPFLAGS)
2198 if test "x$idn" != "xyes"; then
2199 dnl check with default paths
2201 AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
2205 if test "x$idn" = "xyes"; then
2206 curl_idn_msg="enabled"
2207 AC_SUBST(IDN_ENABLED, [1])
2208 dnl different versions of libidn have different setups of these:
2209 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
2210 AC_CHECK_HEADERS( idn-free.h tld.h )
2217 dnl Let's hope this split URL remains working:
2218 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
2219 dnl genprogc/thread_quick_ref.htm
2222 dnl **********************************************************************
2223 dnl Back to "normal" configuring
2224 dnl **********************************************************************
2226 dnl Checks for header files.
2229 CURL_CHECK_HEADER_MALLOC
2230 CURL_CHECK_HEADER_MEMORY
2232 dnl Now check for the very most basic headers. Then we can use these
2233 dnl ones as default-headers when checking for the rest!
2275 dnl to do if not found
2279 dnl default includes
2281 #ifdef HAVE_SYS_TYPES_H
2282 #include <sys/types.h>
2284 #ifdef HAVE_SYS_TIME_H
2285 #include <sys/time.h>
2287 #ifdef HAVE_SYS_SELECT_H
2288 #include <sys/select.h>
2290 #ifdef HAVE_SYS_SOCKET_H
2291 #include <sys/socket.h>
2293 #ifdef HAVE_NETINET_IN_H
2294 #include <netinet/in.h>
2296 #ifdef HAVE_SYS_UN_H
2302 dnl Checks for typedefs, structures, and compiler characteristics.
2304 CURL_CHECK_VARIADIC_MACROS
2307 CURL_CHECK_STRUCT_TIMEVAL
2308 CURL_VERIFY_RUNTIMELIBS
2310 AC_CHECK_SIZEOF(size_t)
2311 AC_CHECK_SIZEOF(long)
2312 AC_CHECK_SIZEOF(int)
2313 AC_CHECK_SIZEOF(short)
2315 AC_CHECK_SIZEOF(time_t)
2316 AC_CHECK_SIZEOF(off_t)
2319 if test x"$ac_cv_native_windows" != "xyes" &&
2320 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2321 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2322 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2327 AC_CHECK_TYPE(long long,
2328 [AC_DEFINE(HAVE_LONGLONG, 1,
2329 [Define to 1 if the compiler supports the 'long long' data type.])]
2333 if test "xyes" = "x$longlong"; then
2334 AC_MSG_CHECKING([if numberLL works])
2338 long long val = 1000LL;
2341 AC_MSG_RESULT([yes])
2342 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
2350 AC_CHECK_TYPE(ssize_t, ,
2351 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
2353 # check for bool type
2354 AC_CHECK_TYPE([bool],[
2355 AC_DEFINE(HAVE_BOOL_T, 1,
2356 [Define to 1 if bool is an available type.])
2358 #ifdef HAVE_SYS_TYPES_H
2359 #include <sys/types.h>
2361 #ifdef HAVE_STDBOOL_H
2362 #include <stdbool.h>
2366 CURL_CONFIGURE_CURL_SOCKLEN_T
2370 TYPE_SOCKADDR_STORAGE
2376 CURL_CHECK_FUNC_SELECT
2378 CURL_CHECK_FUNC_RECV
2379 CURL_CHECK_FUNC_RECVFROM
2380 CURL_CHECK_FUNC_SEND
2381 CURL_CHECK_MSG_NOSIGNAL
2383 CURL_CHECK_FUNC_ALARM
2384 CURL_CHECK_FUNC_BASENAME
2385 CURL_CHECK_FUNC_CLOSESOCKET
2386 CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
2387 CURL_CHECK_FUNC_CONNECT
2388 CURL_CHECK_FUNC_FCNTL
2389 CURL_CHECK_FUNC_FDOPEN
2390 CURL_CHECK_FUNC_FREEADDRINFO
2391 CURL_CHECK_FUNC_FREEIFADDRS
2392 CURL_CHECK_FUNC_FSETXATTR
2393 CURL_CHECK_FUNC_FTRUNCATE
2394 CURL_CHECK_FUNC_GETADDRINFO
2395 CURL_CHECK_FUNC_GETHOSTBYADDR
2396 CURL_CHECK_FUNC_GETHOSTBYADDR_R
2397 CURL_CHECK_FUNC_GETHOSTBYNAME
2398 CURL_CHECK_FUNC_GETHOSTBYNAME_R
2399 CURL_CHECK_FUNC_GETHOSTNAME
2400 CURL_CHECK_FUNC_GETIFADDRS
2401 CURL_CHECK_FUNC_GETSERVBYPORT_R
2402 CURL_CHECK_FUNC_GMTIME_R
2403 CURL_CHECK_FUNC_INET_NTOA_R
2404 CURL_CHECK_FUNC_INET_NTOP
2405 CURL_CHECK_FUNC_INET_PTON
2406 CURL_CHECK_FUNC_IOCTL
2407 CURL_CHECK_FUNC_IOCTLSOCKET
2408 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
2409 CURL_CHECK_FUNC_LOCALTIME_R
2410 CURL_CHECK_FUNC_MEMRCHR
2411 CURL_CHECK_FUNC_POLL
2412 CURL_CHECK_FUNC_SETSOCKOPT
2413 CURL_CHECK_FUNC_SIGACTION
2414 CURL_CHECK_FUNC_SIGINTERRUPT
2415 CURL_CHECK_FUNC_SIGNAL
2416 CURL_CHECK_FUNC_SIGSETJMP
2417 CURL_CHECK_FUNC_SOCKET
2418 CURL_CHECK_FUNC_STRCASECMP
2419 CURL_CHECK_FUNC_STRCASESTR
2420 CURL_CHECK_FUNC_STRCMPI
2421 CURL_CHECK_FUNC_STRDUP
2422 CURL_CHECK_FUNC_STRERROR_R
2423 CURL_CHECK_FUNC_STRICMP
2424 CURL_CHECK_FUNC_STRLCAT
2425 CURL_CHECK_FUNC_STRNCASECMP
2426 CURL_CHECK_FUNC_STRNCMPI
2427 CURL_CHECK_FUNC_STRNICMP
2428 CURL_CHECK_FUNC_STRSTR
2429 CURL_CHECK_FUNC_STRTOK_R
2430 CURL_CHECK_FUNC_STRTOLL
2431 CURL_CHECK_FUNC_WRITEV
2437 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
2441 AC_CHECK_FUNCS([fork \
2460 eval skipcheck=\$skipcheck_$func
2461 if test "x$skipcheck" != "xyes"; then
2462 AC_MSG_CHECKING([deeper for $func])
2469 AC_MSG_RESULT([yes])
2470 eval "ac_cv_func_$func=yes"
2471 AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$func]), [1],
2472 [Define to 1 if you have the $func function.])
2474 AC_MSG_RESULT([but still no])
2479 dnl Check if the getnameinfo function is available
2480 dnl and get the types of five of its arguments.
2481 CURL_CHECK_FUNC_GETNAMEINFO
2483 if test "$ipv6" = "yes"; then
2484 if test "$ac_cv_func_getaddrinfo" = "yes"; then
2485 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
2487 AC_SUBST(IPV6_ENABLED)
2489 CURL_CHECK_NI_WITHSCOPEID
2492 dnl ************************************************************
2493 dnl enable non-blocking communications
2495 CURL_CHECK_OPTION_NONBLOCKING
2496 CURL_CHECK_NONBLOCKING_SOCKET
2498 dnl ************************************************************
2499 dnl nroff tool stuff
2502 AC_PATH_PROG( PERL, perl, ,
2503 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
2506 AC_PATH_PROGS( NROFF, gnroff nroff, ,
2507 $PATH:/usr/bin/:/usr/local/bin )
2510 if test -n "$NROFF"; then
2511 dnl only check for nroff options if an nroff command was found
2513 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
2515 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2516 if test -z "$mancheck"; then
2518 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2519 if test -z "$mancheck"; then
2521 AC_MSG_RESULT([failed])
2522 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
2524 AC_MSG_RESULT([$MANOPT])
2527 AC_MSG_RESULT([$MANOPT])
2532 if test -z "$MANOPT"
2534 dnl if no nroff tool was found, or no option that could convert man pages
2535 dnl was found, then disable the built-in manual stuff
2536 AC_MSG_WARN([disabling built-in manual])
2540 dnl *************************************************************************
2541 dnl If the manual variable still is set, then we go with providing a built-in
2544 if test "$USE_MANUAL" = "1"; then
2545 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
2546 curl_manual_msg="enabled"
2549 dnl set variable for use in automakefile(s)
2550 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
2553 AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
2555 if test "x$enable_shared" = "xyes"; then
2556 build_libhostname=yes
2558 build_libhostname=no
2560 AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
2562 CURL_CHECK_OPTION_THREADED_RESOLVER
2564 if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
2566 [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
2569 if test "$want_thres" = "yes"; then
2570 AC_CHECK_HEADER(pthread.h,
2571 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
2572 save_CFLAGS="$CFLAGS"
2573 CFLAGS="$CFLAGS -pthread"
2574 AC_CHECK_LIB(pthread, pthread_create,
2575 [ AC_MSG_NOTICE([using POSIX threaded DNS lookup])
2576 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
2578 curl_res_msg="threaded"
2580 [ CFLAGS="$save_CFLAGS"])
2584 dnl ************************************************************
2585 dnl disable verbose text strings
2587 AC_MSG_CHECKING([whether to enable verbose strings])
2588 AC_ARG_ENABLE(verbose,
2589 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
2590 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
2591 [ case "$enableval" in
2594 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
2595 curl_verbose_msg="no"
2597 *) AC_MSG_RESULT(yes)
2603 dnl ************************************************************
2604 dnl enable SSPI support
2606 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
2608 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
2609 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
2610 [ case "$enableval" in
2612 if test "$ac_cv_native_windows" = "yes"; then
2614 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
2615 AC_SUBST(USE_WINDOWS_SSPI, [1])
2616 curl_sspi_msg="enabled"
2619 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
2629 dnl ************************************************************
2630 dnl disable cryptographic authentication
2632 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
2633 AC_ARG_ENABLE(crypto-auth,
2634 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
2635 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
2636 [ case "$enableval" in
2639 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
2641 *) AC_MSG_RESULT(yes)
2647 dnl ************************************************************
2648 dnl disable cookies support
2650 AC_MSG_CHECKING([whether to enable support for cookies])
2651 AC_ARG_ENABLE(cookies,
2652 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
2653 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
2654 [ case "$enableval" in
2657 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
2659 *) AC_MSG_RESULT(yes)
2665 dnl ************************************************************
2666 dnl Enable hiding of internal symbols in library to reduce its size and
2667 dnl speed dynamic linking of applications. This currently is only supported
2668 dnl on gcc >= 4.0 and SunPro C.
2670 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
2671 AC_ARG_ENABLE(hidden-symbols,
2672 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
2673 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
2674 [ case "$enableval" in
2679 AC_MSG_CHECKING([whether $CC supports it])
2680 if test "$GCC" = yes ; then
2681 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ||
2682 dnl clang always supports -fvisibility= but it doesn't show up
2684 test "$compiler_id" = "CLANG"; then
2686 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2687 AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
2688 CFLAGS="$CFLAGS -fvisibility=hidden"
2694 dnl Test for SunPro cc
2695 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
2697 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2698 AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
2699 CFLAGS="$CFLAGS -xldscope=hidden"
2709 dnl ************************************************************
2710 dnl enforce SONAME bump
2713 AC_MSG_CHECKING([whether to enforce SONAME bump])
2714 AC_ARG_ENABLE(soname-bump,
2715 AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
2716 AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
2717 [ case "$enableval" in
2718 yes) AC_MSG_RESULT(yes)
2725 AC_MSG_RESULT($soname_bump)
2727 AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
2730 dnl ************************************************************
2731 if test ! -z "$winsock_LIB"; then
2733 dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
2734 dnl things work when built with c-ares). But we can't just move it last
2735 dnl since then other stuff (SSL) won't build. So we simply append it to the
2738 LIBS="$LIBS $winsock_LIB"
2739 TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
2744 dnl All the library dependencies put into $LIB apply to libcurl only.
2745 dnl Those in $CURL_LIBS apply to the curl command-line client only.
2746 dnl Those in $TEST_SERVER_LIBS apply to test servers only.
2747 dnl Those in $ALL_LIBS apply to all targets, including test targets.
2751 AC_SUBST(LIBCURL_LIBS)
2753 AC_SUBST(TEST_SERVER_LIBS)
2754 AC_SUBST(CURL_NETWORK_LIBS)
2755 LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
2757 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
2760 ENABLE_SHARED="$enable_shared"
2761 AC_SUBST(ENABLE_SHARED)
2764 dnl For keeping supported features and protocols also in pkg-config file
2765 dnl since it is more cross-compile frient than curl-config
2768 if test "x$USE_SSLEAY" = "x1"; then
2769 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2770 elif test -n "$SSL_ENABLED"; then
2771 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2773 if test "@KRB4_ENABLED@" = "x1"; then
2774 SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
2776 if test "x$IPV6_ENABLED" = "x1"; then
2777 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
2779 if test "x$HAVE_LIBZ" = "x1"; then
2780 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
2782 if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
2783 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
2785 if test "x$IDN_ENABLED" = "x1"; then
2786 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
2788 if test "x$USE_WINDOWS_SSPI" = "x1"; then
2789 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
2791 if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
2792 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then
2793 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
2796 AC_SUBST(SUPPORT_FEATURES)
2798 dnl For supported protocols in pkg-config file
2799 if test "x$CURL_DISABLE_HTTP" != "x1"; then
2800 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
2801 if test "x$SSL_ENABLED" = "x1"; then
2802 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
2805 if test "x$CURL_DISABLE_FTP" != "x1"; then
2806 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
2807 if test "x$SSL_ENABLED" = "x1"; then
2808 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
2811 if test "x$CURL_DISABLE_FILE" != "x1"; then
2812 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
2814 if test "x$CURL_DISABLE_TELNET" != "x1"; then
2815 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
2817 if test "x$CURL_DISABLE_LDAP" != "x1"; then
2818 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
2819 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
2820 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
2821 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
2822 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
2826 if test "x$CURL_DISABLE_DICT" != "x1"; then
2827 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
2829 if test "x$CURL_DISABLE_TFTP" != "x1"; then
2830 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
2832 if test "x$CURL_DISABLE_GOPHER" != "x1"; then
2833 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
2835 if test "x$CURL_DISABLE_POP3" != "x1"; then
2836 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
2837 if test "x$SSL_ENABLED" = "x1"; then
2838 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
2841 if test "x$CURL_DISABLE_IMAP" != "x1"; then
2842 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
2843 if test "x$SSL_ENABLED" = "x1"; then
2844 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
2847 if test "x$CURL_DISABLE_SMTP" != "x1"; then
2848 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
2849 if test "x$SSL_ENABLED" = "x1"; then
2850 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
2853 if test "x$USE_LIBSSH2" = "x1"; then
2854 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
2855 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
2857 if test "x$CURL_DISABLE_RTSP" != "x1"; then
2858 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
2860 if test "x$USE_LIBRTMP" = "x1"; then
2861 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
2864 dnl replace spaces with newlines
2866 dnl replace the newlines back to spaces
2867 SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
2869 AC_SUBST(SUPPORT_PROTOCOLS)
2871 dnl squeeze whitespace out of some variables
2880 squeeze LIBCURL_LIBS
2881 squeeze TEST_SERVER_LIBS
2882 squeeze CURL_NETWORK_LIBS
2884 squeeze SUPPORT_FEATURES
2885 squeeze SUPPORT_PROTOCOLS
2887 if test "x$want_curldebug_assumed" = "xyes" &&
2888 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
2889 ac_configure_args="$ac_configure_args --enable-curldebug"
2892 AC_CONFIG_FILES([Makefile \
2894 docs/examples/Makefile \
2895 docs/libcurl/Makefile \
2897 include/curl/Makefile \
2902 tests/data/Makefile \
2903 tests/server/Makefile \
2904 tests/libtest/Makefile \
2906 packages/Win32/Makefile \
2907 packages/Win32/cygwin/Makefile \
2908 packages/Linux/Makefile \
2909 packages/Linux/RPM/Makefile \
2910 packages/Linux/RPM/curl.spec \
2911 packages/Linux/RPM/curl-ssl.spec \
2912 packages/Solaris/Makefile \
2913 packages/EPM/curl.list \
2914 packages/EPM/Makefile \
2915 packages/vms/Makefile \
2916 packages/AIX/Makefile \
2917 packages/AIX/RPM/Makefile \
2918 packages/AIX/RPM/curl.spec \
2924 CURL_GENERATE_CONFIGUREHELP_PM
2926 AC_MSG_NOTICE([Configured to build curl/libcurl:
2928 curl version: ${VERSION}
2930 Install prefix: ${prefix}
2932 SSL support: ${curl_ssl_msg}
2933 SSH support: ${curl_ssh_msg}
2934 zlib support: ${curl_zlib_msg}
2935 krb4 support: ${curl_krb4_msg}
2936 GSSAPI support: ${curl_gss_msg}
2937 SPNEGO support: ${curl_spnego_msg}
2938 resolver: ${curl_res_msg}
2939 ipv6 support: ${curl_ipv6_msg}
2940 IDN support: ${curl_idn_msg}
2941 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
2942 Built-in manual: ${curl_manual_msg}
2943 Verbose errors: ${curl_verbose_msg}
2944 SSPI support: ${curl_sspi_msg}
2945 ca cert bundle: ${ca}
2946 ca cert path: ${capath}
2947 LDAP support: ${curl_ldap_msg}
2948 LDAPS support: ${curl_ldaps_msg}
2949 RTSP support: ${curl_rtsp_msg}
2950 RTMP support: ${curl_rtmp_msg}
2951 Protocols: ${SUPPORT_PROTOCOLS}
2954 if test "x$soname_bump" = "xyes"; then
2957 SONAME bump: yes - WARNING: this library will be built with the SONAME
2958 number bumped due to (a detected) ABI breakage.
2959 See lib/README.curl_off_t for details on this.