1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2017, 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 https://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: https://curl.haxx.se/mail/])
31 CURL_OVERRIDE_AUTOCONF
33 dnl configure script copyright
34 AC_COPYRIGHT([Copyright (c) 1998 - 2017 Daniel Stenberg, <daniel@haxx.se>
35 This configure script may be copied, distributed and modified under the
36 terms of the curl license; see COPYING for more details])
38 AC_CONFIG_SRCDIR([lib/urldata.h])
39 AC_CONFIG_HEADERS(lib/curl_config.h)
40 AC_CONFIG_MACRO_DIR([m4])
42 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
44 CURL_CHECK_OPTION_DEBUG
45 CURL_CHECK_OPTION_OPTIMIZE
46 CURL_CHECK_OPTION_WARNINGS
47 CURL_CHECK_OPTION_WERROR
48 CURL_CHECK_OPTION_CURLDEBUG
49 CURL_CHECK_OPTION_SYMBOL_HIDING
50 CURL_CHECK_OPTION_ARES
53 XC_CHECK_PATH_SEPARATOR
57 # save the configure arguments
59 CONFIGURE_OPTIONS="\"$ac_configure_args\""
60 AC_SUBST(CONFIGURE_OPTIONS)
63 if test X"$want_werror" = Xyes; then
64 CURL_CFLAG_EXTRAS="-Werror"
66 AC_SUBST(CURL_CFLAG_EXTRAS)
68 dnl SED is mandatory for configure process and libtool.
69 dnl Set it now, allowing it to be changed later.
70 if test -z "$SED"; then
71 dnl allow it to be overridden
72 AC_PATH_PROG([SED], [sed], [not_found],
73 [$PATH:/usr/bin:/usr/local/bin])
74 if test -z "$SED" || test "$SED" = "not_found"; then
75 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
80 dnl GREP is mandatory for configure process and libtool.
81 dnl Set it now, allowing it to be changed later.
82 if test -z "$GREP"; then
83 dnl allow it to be overridden
84 AC_PATH_PROG([GREP], [grep], [not_found],
85 [$PATH:/usr/bin:/usr/local/bin])
86 if test -z "$GREP" || test "$GREP" = "not_found"; then
87 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
92 dnl EGREP is mandatory for configure process and libtool.
93 dnl Set it now, allowing it to be changed later.
94 if test -z "$EGREP"; then
95 dnl allow it to be overridden
96 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
97 AC_MSG_CHECKING([for egrep])
99 AC_MSG_RESULT([$EGREP])
101 AC_PATH_PROG([EGREP], [egrep], [not_found],
102 [$PATH:/usr/bin:/usr/local/bin])
105 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
106 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
110 dnl AR is mandatory for configure process and libtool.
111 dnl This is target dependent, so check it as a tool.
112 if test -z "$AR"; then
113 dnl allow it to be overridden
114 AC_PATH_TOOL([AR], [ar], [not_found],
115 [$PATH:/usr/bin:/usr/local/bin])
116 if test -z "$AR" || test "$AR" = "not_found"; then
117 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
124 dnl figure out the libcurl version
125 CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
128 AC_MSG_CHECKING([curl version])
129 AC_MSG_RESULT($CURLVERSION)
131 AC_SUBST(CURLVERSION)
134 dnl we extract the numerical version for curl-config only
135 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\([0-9A-Fa-f]*\).*/\1/p' ${srcdir}/include/curl/curlver.h`
138 dnl Solaris pkgadd support definitions
139 PKGADD_PKG="HAXXcurl"
140 PKGADD_NAME="curl - a client that groks URLs"
141 PKGADD_VENDOR="curl.haxx.se"
143 AC_SUBST(PKGADD_NAME)
144 AC_SUBST(PKGADD_VENDOR)
147 dnl initialize all the info variables
148 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )"
149 curl_ssh_msg="no (--with-libssh2)"
150 curl_zlib_msg="no (--with-zlib)"
151 curl_gss_msg="no (--with-gssapi)"
152 curl_tls_srp_msg="no (--enable-tls-srp)"
153 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
154 curl_ipv6_msg="no (--enable-ipv6)"
155 curl_unix_sockets_msg="no (--enable-unix-sockets)"
156 curl_idn_msg="no (--with-{libidn2,winidn})"
157 curl_manual_msg="no (--enable-manual)"
158 curl_libcurl_msg="enabled (--disable-libcurl-option)"
159 curl_verbose_msg="enabled (--disable-verbose)"
160 curl_sspi_msg="no (--enable-sspi)"
161 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
162 curl_ldaps_msg="no (--enable-ldaps)"
163 curl_rtsp_msg="no (--enable-rtsp)"
164 curl_rtmp_msg="no (--with-librtmp)"
165 curl_mtlnk_msg="no (--with-libmetalink)"
166 curl_psl_msg="no (--with-libpsl)"
171 dnl Save some initial values the user might have provided
173 INITIAL_LDFLAGS=$LDFLAGS
177 dnl Detect the canonical host and target build environment
181 dnl Get system canonical name
182 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
184 dnl Checks for programs.
186 dnl This defines _ALL_SOURCE for AIX
187 CURL_CHECK_AIX_ALL_SOURCE
189 dnl Our configure and build reentrant settings
190 CURL_CONFIGURE_THREAD_SAFE
191 CURL_CONFIGURE_REENTRANT
193 dnl check for how to do large files
199 # Automake conditionals based on libtool related checks
202 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
203 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
204 AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
205 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
206 AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
207 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
210 # Due to libtool and automake machinery limitations of not allowing
211 # specifying separate CPPFLAGS or CFLAGS when compiling objects for
212 # inclusion of these in shared or static libraries, we are forced to
213 # build using separate configure runs for shared and static libraries
214 # on systems where different CPPFLAGS or CFLAGS are mandatory in order
215 # to compile objects for each kind of library. Notice that relying on
216 # the '-DPIC' CFLAG that libtool provides is not valid given that the
217 # user might for example choose to build static libraries with PIC.
221 # Make our Makefile.am files use the staticlib CPPFLAG only when strictly
222 # targeting a static library and not building its shared counterpart.
225 AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
226 [test "x$xc_lt_build_static_only" = 'xyes'])
229 # Make staticlib CPPFLAG variable and its definition visible in output
230 # files unconditionally, providing an empty definition unless strictly
231 # targeting a static library and not building its shared counterpart.
234 CPPFLAG_CURL_STATICLIB=
235 if test "x$xc_lt_build_static_only" = 'xyes'; then
236 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
238 AC_SUBST([CPPFLAG_CURL_STATICLIB])
241 # Determine whether all dependent libraries must be specified when linking
242 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
248 AC_SUBST(REQUIRE_LIB_DEPS)
249 AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
251 dnl check if there's a way to force code inline
254 dnl **********************************************************************
255 dnl platform/compiler/architecture specific checks/flags
256 dnl **********************************************************************
259 CURL_SET_COMPILER_BASIC_OPTS
260 CURL_SET_COMPILER_DEBUG_OPTS
261 CURL_SET_COMPILER_OPTIMIZE_OPTS
262 CURL_SET_COMPILER_WARNING_OPTS
264 if test "$compiler_id" = "INTEL_UNIX_C"; then
266 if test "$compiler_num" -ge "1000"; then
267 dnl icc 10.X or later
268 CFLAGS="$CFLAGS -shared-intel"
269 elif test "$compiler_num" -ge "900"; then
271 CFLAGS="$CFLAGS -i-dynamic"
276 CURL_CHECK_COMPILER_HALT_ON_ERROR
277 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
278 CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
279 CURL_CHECK_COMPILER_SYMBOL_HIDING
282 AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
284 supports_unittests=yes
285 # cross-compilation of unit tests static library/programs fails when
286 # libcurl shared library is built. This might be due to a libtool or
287 # automake issue. In this case we disable unit tests.
288 if test "x$cross_compiling" != "xno" &&
289 test "x$enable_shared" != "xno"; then
290 supports_unittests=no
293 # IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
294 # a problem related with OpenSSL headers and library versions not matching.
295 # Disable unit tests while time to further investigate this is found.
298 if test "$compiler_id" = "GNU_C"; then
299 supports_unittests=no
304 # All AIX autobuilds fails unit tests linking against unittests library
305 # due to unittests library being built with no symbols or members. Libtool ?
306 # Disable unit tests while time to further investigate this is found.
309 supports_unittests=no
313 dnl Build unit tests when option --enable-debug is given.
314 if test "x$want_debug" = "xyes" &&
315 test "x$supports_unittests" = "xyes"; then
320 AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
322 dnl **********************************************************************
323 dnl Compilation based checks should not be done before this point.
324 dnl **********************************************************************
326 dnl **********************************************************************
327 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
328 dnl and ws2tcpip.h take precedence over any other further checks which
329 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
330 dnl this specific header files. And do them before its results are used.
331 dnl **********************************************************************
333 CURL_CHECK_HEADER_WINDOWS
334 CURL_CHECK_NATIVE_WINDOWS
335 case X-"$curl_cv_native_windows" in
337 CURL_CHECK_HEADER_WINSOCK
338 CURL_CHECK_HEADER_WINSOCK2
339 CURL_CHECK_HEADER_WS2TCPIP
340 CURL_CHECK_HEADER_WINLDAP
341 CURL_CHECK_HEADER_WINBER
344 curl_cv_header_winsock_h="no"
345 curl_cv_header_winsock2_h="no"
346 curl_cv_header_ws2tcpip_h="no"
347 curl_cv_header_winldap_h="no"
348 curl_cv_header_winber_h="no"
351 CURL_CHECK_WIN32_LARGEFILE
354 CURL_SUPPORTS_BUILTIN_AVAILABLE
356 dnl ************************************************************
357 dnl switch off particular protocols
359 AC_MSG_CHECKING([whether to support http])
361 AC_HELP_STRING([--enable-http],[Enable HTTP support])
362 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
363 [ case "$enableval" in
366 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
368 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
369 AC_SUBST(CURL_DISABLE_HTTP, [1])
370 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
371 AC_SUBST(CURL_DISABLE_RTSP, [1])
373 *) AC_MSG_RESULT(yes)
378 AC_MSG_CHECKING([whether to support ftp])
380 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
381 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
382 [ case "$enableval" in
385 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
386 AC_SUBST(CURL_DISABLE_FTP, [1])
388 *) AC_MSG_RESULT(yes)
393 AC_MSG_CHECKING([whether to support file])
395 AC_HELP_STRING([--enable-file],[Enable FILE support])
396 AC_HELP_STRING([--disable-file],[Disable FILE support]),
397 [ case "$enableval" in
400 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
401 AC_SUBST(CURL_DISABLE_FILE, [1])
403 *) AC_MSG_RESULT(yes)
408 AC_MSG_CHECKING([whether to support ldap])
410 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
411 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
412 [ case "$enableval" in
415 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
416 AC_SUBST(CURL_DISABLE_LDAP, [1])
424 AC_MSG_CHECKING([whether to support ldaps])
426 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
427 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
428 [ case "$enableval" in
431 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
432 AC_SUBST(CURL_DISABLE_LDAPS, [1])
434 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
435 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
436 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
437 AC_SUBST(CURL_DISABLE_LDAPS, [1])
440 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
441 AC_SUBST(HAVE_LDAP_SSL, [1])
445 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
447 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
448 AC_SUBST(CURL_DISABLE_LDAPS, [1])
451 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
452 AC_SUBST(HAVE_LDAP_SSL, [1])
456 AC_MSG_CHECKING([whether to support rtsp])
458 AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
459 AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
460 [ case "$enableval" in
463 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
464 AC_SUBST(CURL_DISABLE_RTSP, [1])
466 *) if test x$CURL_DISABLE_HTTP = x1 ; then
467 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
470 curl_rtsp_msg="enabled"
474 if test "x$CURL_DISABLE_HTTP" != "x1"; then
476 curl_rtsp_msg="enabled"
482 AC_MSG_CHECKING([whether to support proxies])
484 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
485 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
486 [ case "$enableval" in
489 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
490 AC_SUBST(CURL_DISABLE_PROXY, [1])
492 *) AC_MSG_RESULT(yes)
498 AC_MSG_CHECKING([whether to support dict])
500 AC_HELP_STRING([--enable-dict],[Enable DICT support])
501 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
502 [ case "$enableval" in
505 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
506 AC_SUBST(CURL_DISABLE_DICT, [1])
508 *) AC_MSG_RESULT(yes)
513 AC_MSG_CHECKING([whether to support telnet])
514 AC_ARG_ENABLE(telnet,
515 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
516 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
517 [ case "$enableval" in
520 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
521 AC_SUBST(CURL_DISABLE_TELNET, [1])
523 *) AC_MSG_RESULT(yes)
528 AC_MSG_CHECKING([whether to support tftp])
530 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
531 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
532 [ case "$enableval" in
535 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
536 AC_SUBST(CURL_DISABLE_TFTP, [1])
538 *) AC_MSG_RESULT(yes)
544 AC_MSG_CHECKING([whether to support pop3])
546 AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
547 AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
548 [ case "$enableval" in
551 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
552 AC_SUBST(CURL_DISABLE_POP3, [1])
554 *) AC_MSG_RESULT(yes)
561 AC_MSG_CHECKING([whether to support imap])
563 AC_HELP_STRING([--enable-imap],[Enable IMAP support])
564 AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
565 [ case "$enableval" in
568 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
569 AC_SUBST(CURL_DISABLE_IMAP, [1])
571 *) AC_MSG_RESULT(yes)
578 AC_MSG_CHECKING([whether to support smb])
580 AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
581 AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
582 [ case "$enableval" in
585 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
586 AC_SUBST(CURL_DISABLE_SMB, [1])
588 *) AC_MSG_RESULT(yes)
594 AC_MSG_CHECKING([whether to support smtp])
596 AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
597 AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
598 [ case "$enableval" in
601 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
602 AC_SUBST(CURL_DISABLE_SMTP, [1])
604 *) AC_MSG_RESULT(yes)
610 AC_MSG_CHECKING([whether to support gopher])
611 AC_ARG_ENABLE(gopher,
612 AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
613 AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
614 [ case "$enableval" in
617 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
618 AC_SUBST(CURL_DISABLE_GOPHER, [1])
620 *) AC_MSG_RESULT(yes)
627 dnl **********************************************************************
628 dnl Check for built-in manual
629 dnl **********************************************************************
631 AC_MSG_CHECKING([whether to provide built-in manual])
632 AC_ARG_ENABLE(manual,
633 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
634 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
635 [ case "$enableval" in
639 *) AC_MSG_RESULT(yes)
646 dnl The actual use of the USE_MANUAL variable is done much later in this
647 dnl script to allow other actions to disable it as well.
649 dnl ************************************************************
650 dnl disable C code generation support
652 AC_MSG_CHECKING([whether to enable generation of C code])
653 AC_ARG_ENABLE(libcurl_option,
654 AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
655 AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
656 [ case "$enableval" in
659 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
660 curl_libcurl_msg="no"
662 *) AC_MSG_RESULT(yes)
668 dnl **********************************************************************
669 dnl Checks for libraries.
670 dnl **********************************************************************
672 AC_MSG_CHECKING([whether to use libgcc])
673 AC_ARG_ENABLE(libgcc,
674 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
675 [ case "$enableval" in
688 dnl gethostbyname without lib or in the nsl lib?
689 AC_CHECK_FUNC(gethostbyname,
690 [HAVE_GETHOSTBYNAME="1"
692 [ AC_CHECK_LIB(nsl, gethostbyname,
693 [HAVE_GETHOSTBYNAME="1"
698 if test "$HAVE_GETHOSTBYNAME" != "1"
700 dnl gethostbyname in the socket lib?
701 AC_CHECK_LIB(socket, gethostbyname,
702 [HAVE_GETHOSTBYNAME="1"
703 LIBS="-lsocket $LIBS"
707 if test "$HAVE_GETHOSTBYNAME" != "1"
709 dnl gethostbyname in the watt lib?
710 AC_CHECK_LIB(watt, gethostbyname,
711 [HAVE_GETHOSTBYNAME="1"
712 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
713 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
718 dnl At least one system has been identified to require BOTH nsl and socket
719 dnl libs at the same time to link properly.
720 if test "$HAVE_GETHOSTBYNAME" != "1"
722 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
723 my_ac_save_LIBS=$LIBS
724 LIBS="-lnsl -lsocket $LIBS"
732 HAVE_GETHOSTBYNAME="1"
735 LIBS=$my_ac_save_LIBS
739 if test "$HAVE_GETHOSTBYNAME" != "1"
741 dnl This is for winsock systems
742 if test "$curl_cv_header_windows_h" = "yes"; then
743 if test "$curl_cv_header_winsock_h" = "yes"; then
746 winsock_LIB="-lwinsock"
749 winsock_LIB="-lwsock32"
753 if test "$curl_cv_header_winsock2_h" = "yes"; then
754 winsock_LIB="-lws2_32"
756 if test ! -z "$winsock_LIB"; then
757 my_ac_save_LIBS=$LIBS
758 LIBS="$winsock_LIB $LIBS"
759 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
762 #ifdef HAVE_WINDOWS_H
763 #ifndef WIN32_LEAN_AND_MEAN
764 #define WIN32_LEAN_AND_MEAN
767 #ifdef HAVE_WINSOCK2_H
768 #include <winsock2.h>
770 #ifdef HAVE_WINSOCK_H
776 gethostbyname("www.dummysite.com");
780 HAVE_GETHOSTBYNAME="1"
784 LIBS=$my_ac_save_LIBS
790 if test "$HAVE_GETHOSTBYNAME" != "1"
792 dnl This is for Minix 3.1
793 AC_MSG_CHECKING([for gethostbyname for Minix 3])
796 /* Older Minix versions may need <net/gen/netdb.h> here instead */
799 gethostbyname("www.dummysite.com");
803 HAVE_GETHOSTBYNAME="1"
809 if test "$HAVE_GETHOSTBYNAME" != "1"
811 dnl This is for eCos with a stubbed DNS implementation
812 AC_MSG_CHECKING([for gethostbyname for eCos])
818 gethostbyname("www.dummysite.com");
822 HAVE_GETHOSTBYNAME="1"
828 if test "$HAVE_GETHOSTBYNAME" != "1"
830 dnl gethostbyname in the network lib - for Haiku OS
831 AC_CHECK_LIB(network, gethostbyname,
832 [HAVE_GETHOSTBYNAME="1"
833 LIBS="-lnetwork $LIBS"
837 if test "$HAVE_GETHOSTBYNAME" != "1"
839 dnl gethostbyname in the net lib - for BeOS
840 AC_CHECK_LIB(net, gethostbyname,
841 [HAVE_GETHOSTBYNAME="1"
847 if test "$HAVE_GETHOSTBYNAME" != "1"; then
848 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
851 CURL_CHECK_LIBS_CONNECT
853 CURL_NETWORK_LIBS=$LIBS
855 dnl **********************************************************************
856 dnl In case that function clock_gettime with monotonic timer is available,
857 dnl check for additional required libraries.
858 dnl **********************************************************************
859 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
861 dnl **********************************************************************
862 dnl The preceding library checks are all potentially useful for test
863 dnl servers and libtest cases which require networking and clock_gettime
864 dnl support. Save the list of required libraries at this point for use
865 dnl while linking those test servers and programs.
866 dnl **********************************************************************
867 CURL_NETWORK_AND_TIME_LIBS=$LIBS
869 dnl **********************************************************************
870 dnl Check for the presence of ZLIB libraries and headers
871 dnl **********************************************************************
873 dnl Check for & handle argument to --with-zlib.
875 clean_CPPFLAGS=$CPPFLAGS
876 clean_LDFLAGS=$LDFLAGS
880 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
881 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
882 [OPT_ZLIB="$withval"])
884 if test "$OPT_ZLIB" = "no" ; then
885 AC_MSG_WARN([zlib disabled])
887 if test "$OPT_ZLIB" = "yes" ; then
891 if test -z "$OPT_ZLIB" ; then
892 CURL_CHECK_PKGCONFIG(zlib)
894 if test "$PKGCONFIG" != "no" ; then
895 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
896 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
897 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
902 if test -z "$HAVE_LIBZ"; then
904 dnl Check for the lib without setting any new path, since many
905 dnl people have it in the default path
907 AC_CHECK_LIB(z, inflateEnd,
908 dnl libz found, set the variable
911 dnl if no lib found, try /usr/local
912 [OPT_ZLIB="/usr/local"])
916 dnl Add a nonempty path to the compiler flags
917 if test -n "$OPT_ZLIB"; then
918 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
919 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
922 AC_CHECK_HEADER(zlib.h,
926 dnl if the lib wasn't found already, try again with the new paths
927 if test "$HAVE_LIBZ" != "1"; then
928 AC_CHECK_LIB(z, gzread,
930 dnl the lib was found!
934 [ CPPFLAGS=$clean_CPPFLAGS
935 LDFLAGS=$clean_LDFLAGS])
939 dnl zlib.h was not found, restore the flags
940 CPPFLAGS=$clean_CPPFLAGS
941 LDFLAGS=$clean_LDFLAGS]
944 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
946 AC_MSG_WARN([configure found only the libz lib, not the header file!])
948 CPPFLAGS=$clean_CPPFLAGS
949 LDFLAGS=$clean_LDFLAGS
951 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
953 AC_MSG_WARN([configure found only the libz header file, not the lib!])
954 CPPFLAGS=$clean_CPPFLAGS
955 LDFLAGS=$clean_LDFLAGS
957 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
959 dnl both header and lib were found!
961 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
962 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
965 LIBS="-lz $clean_LIBS"
967 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
969 AC_MSG_NOTICE([found both libz and libz.h header])
970 curl_zlib_msg="enabled"
974 dnl set variable for use in automakefile(s)
975 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
978 dnl **********************************************************************
980 dnl **********************************************************************
983 AC_ARG_WITH(ldap-lib,
984 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
985 [LDAPLIBNAME="$withval"])
988 AC_ARG_WITH(lber-lib,
989 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
990 [LBERLIBNAME="$withval"])
992 if test x$CURL_DISABLE_LDAP != x1 ; then
994 CURL_CHECK_HEADER_LBER
995 CURL_CHECK_HEADER_LDAP
996 CURL_CHECK_HEADER_LDAPSSL
997 CURL_CHECK_HEADER_LDAP_SSL
999 if test -z "$LDAPLIBNAME" ; then
1000 if test "$curl_cv_native_windows" = "yes"; then
1001 dnl Windows uses a single and unique LDAP library name
1002 LDAPLIBNAME="wldap32"
1007 if test "$LDAPLIBNAME" ; then
1008 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1009 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1010 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1011 AC_SUBST(CURL_DISABLE_LDAP, [1])
1012 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1013 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
1015 dnl Try to find the right ldap libraries for this system
1016 CURL_CHECK_LIBS_LDAP
1017 case X-"$curl_cv_ldap_LIBS" in
1019 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1020 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1021 AC_SUBST(CURL_DISABLE_LDAP, [1])
1022 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1023 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1029 if test x$CURL_DISABLE_LDAP != x1 ; then
1031 if test "$LBERLIBNAME" ; then
1032 dnl If name is "no" then don't define this library at all
1033 dnl (it's only needed if libldap.so's dependencies are broken).
1034 if test "$LBERLIBNAME" != "no" ; then
1035 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1036 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1037 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1038 AC_SUBST(CURL_DISABLE_LDAP, [1])
1039 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1040 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
1045 if test x$CURL_DISABLE_LDAP != x1 ; then
1046 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1048 if test "$LDAPLIBNAME" = "wldap32"; then
1049 curl_ldap_msg="enabled (winldap)"
1050 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
1052 curl_ldap_msg="enabled (OpenLDAP)"
1053 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1054 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1055 AC_SUBST(USE_OPENLDAP, [1])
1060 if test x$CURL_DISABLE_LDAPS != x1 ; then
1061 curl_ldaps_msg="enabled"
1064 dnl **********************************************************************
1066 dnl **********************************************************************
1068 AC_MSG_CHECKING([whether to enable IPv6])
1070 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1071 AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
1072 [ case "$enableval" in
1077 *) AC_MSG_RESULT(yes)
1082 AC_TRY_RUN([ /* is AF_INET6 available? */
1083 #include <sys/types.h>
1084 #ifdef HAVE_WINSOCK2_H
1085 #include <winsock2.h>
1087 #include <sys/socket.h>
1089 #include <stdlib.h> /* for exit() */
1092 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1106 if test "$ipv6" = "yes"; then
1107 curl_ipv6_msg="enabled"
1110 # Check if struct sockaddr_in6 have sin6_scope_id member
1111 if test "$ipv6" = yes; then
1112 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1114 #include <sys/types.h>
1115 #ifdef HAVE_WINSOCK2_H
1116 #include <winsock2.h>
1117 #include <ws2tcpip.h>
1119 #include <netinet/in.h>
1121 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1122 if test "$have_sin6_scope_id" = yes; then
1123 AC_MSG_RESULT([yes])
1124 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1130 dnl **********************************************************************
1131 dnl Check if the operating system allows programs to write to their own argv[]
1132 dnl **********************************************************************
1134 AC_MSG_CHECKING([if argv can be written to])
1137 int main(int argc, char ** argv) {
1139 return (argv[0][0] == ' ')?0:1;
1143 curl_cv_writable_argv=yes
1145 curl_cv_writable_argv=no
1147 curl_cv_writable_argv=cross
1149 case $curl_cv_writable_argv in
1151 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1159 AC_MSG_WARN([the previous check could not be made default was used])
1163 dnl **********************************************************************
1164 dnl Check for GSS-API libraries
1165 dnl **********************************************************************
1167 dnl check for GSS-API stuff in the /usr as default
1170 AC_ARG_WITH(gssapi-includes,
1171 AC_HELP_STRING([--with-gssapi-includes=DIR],
1172 [Specify location of GSS-API headers]),
1173 [ GSSAPI_INCS="-I$withval"
1177 AC_ARG_WITH(gssapi-libs,
1178 AC_HELP_STRING([--with-gssapi-libs=DIR],
1179 [Specify location of GSS-API libs]),
1180 [ GSSAPI_LIB_DIR="-L$withval"
1185 AC_HELP_STRING([--with-gssapi=DIR],
1186 [Where to look for GSS-API]), [
1187 GSSAPI_ROOT="$withval"
1188 if test x"$GSSAPI_ROOT" != xno; then
1190 if test x"$GSSAPI_ROOT" = xyes; then
1191 dnl if yes, then use default root
1197 : ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1199 save_CPPFLAGS="$CPPFLAGS"
1200 AC_MSG_CHECKING([if GSS-API support is requested])
1201 if test x"$want_gss" = xyes; then
1204 if test -z "$GSSAPI_INCS"; then
1205 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1206 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1207 elif test -f "$KRB5CONFIG"; then
1208 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
1209 elif test "$GSSAPI_ROOT" != "yes"; then
1210 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1214 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1216 AC_CHECK_HEADER(gss.h,
1218 dnl found in the given dirs
1219 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
1223 dnl not found, check Heimdal or MIT
1224 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1226 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1231 #ifdef HAVE_GSSAPI_GSSAPI_H
1232 #include <gssapi/gssapi.h>
1235 if test "x$not_mit" = "x1"; then
1236 dnl MIT not found, check for Heimdal
1237 AC_CHECK_HEADER(gssapi.h,
1240 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
1243 dnl no header found, disabling GSS
1245 AC_MSG_WARN(disabling GSS-API support since no header files were found)
1250 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1251 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1252 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
1255 #include <gssapi/gssapi.h>
1256 #include <gssapi/gssapi_generic.h>
1257 #include <gssapi/gssapi_krb5.h>
1262 GSS_C_NT_HOSTBASED_SERVICE,
1266 AC_MSG_RESULT([yes])
1269 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
1270 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
1278 if test x"$want_gss" = xyes; then
1279 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1281 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
1283 if test -n "$gnu_gss"; then
1284 curl_gss_msg="enabled (GNU GSS)"
1285 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1287 elif test -z "$GSSAPI_LIB_DIR"; then
1290 LIBS="-lgssapi_krb5 -lresolv $LIBS"
1293 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1294 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1296 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1297 LIBS="$gss_libs $LIBS"
1298 elif test -f "$KRB5CONFIG"; then
1299 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1301 gss_libs=`$KRB5CONFIG --libs gssapi`
1302 LIBS="$gss_libs $LIBS"
1309 gss_libname="gssapi"
1313 if test "$GSSAPI_ROOT" != "yes"; then
1314 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1315 LIBS="-l$gss_libname $LIBS"
1317 LIBS="-l$gss_libname $LIBS"
1323 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1329 LIBS="-lgssapi $LIBS"
1334 CPPFLAGS="$save_CPPFLAGS"
1338 if test x"$want_gss" = "xyes"; then
1339 build_libstubgss=yes
1342 AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1344 dnl -------------------------------------------------------------
1345 dnl parse --with-default-ssl-backend so it can be validated below
1346 dnl -------------------------------------------------------------
1348 DEFAULT_SSL_BACKEND=no
1349 VALID_DEFAULT_SSL_BACKEND=
1350 AC_ARG_WITH(default-ssl-backend,
1351 AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1352 AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1353 [DEFAULT_SSL_BACKEND=$withval])
1354 case "$DEFAULT_SSL_BACKEND" in
1356 dnl --without-default-ssl-backend option used
1359 dnl --with-default-ssl-backend option used without name
1360 AC_MSG_ERROR([The name of the default SSL backend is required.])
1363 dnl --with-default-ssl-backend option used with name
1364 AC_SUBST(DEFAULT_SSL_BACKEND)
1365 dnl needs to be validated below
1366 VALID_DEFAULT_SSL_BACKEND=no
1370 dnl **********************************************************************
1372 dnl -------------------------------------------------
1373 dnl check winssl option before other SSL libraries
1374 dnl -------------------------------------------------
1377 AC_ARG_WITH(winssl,dnl
1378 AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1379 AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1380 OPT_WINSSL=$withval)
1382 AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
1383 if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1385 if test "x$OPT_WINSSL" != "xno" &&
1386 test "x$curl_cv_native_windows" = "xyes"; then
1388 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1389 AC_SUBST(USE_SCHANNEL, [1])
1390 ssl_msg="Windows-native"
1391 test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1393 # --with-winssl implies --enable-sspi
1394 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1395 AC_SUBST(USE_WINDOWS_SSPI, [1])
1396 curl_sspi_msg="enabled"
1397 LIBS="-lcrypt32 $LIBS"
1401 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1407 AC_ARG_WITH(darwinssl,dnl
1408 AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1409 AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
1410 OPT_DARWINSSL=$withval)
1412 AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS])
1413 if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then
1414 if test "x$OPT_DARWINSSL" != "xno" &&
1415 test -d "/System/Library/Frameworks/Security.framework"; then
1417 AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support])
1418 AC_SUBST(USE_DARWINSSL, [1])
1419 ssl_msg="Apple OS-native"
1420 test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1422 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1426 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1431 dnl **********************************************************************
1432 dnl Check for the presence of SSL libraries and headers
1433 dnl **********************************************************************
1435 dnl Default to compiler & linker defaults for SSL files & libraries.
1437 dnl Default to no CA bundle
1440 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])
1441 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1444 if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1445 test X"$OPT_SSL" != Xno; then
1448 dnl backup the pre-ssl variables
1449 CLEANLDFLAGS="$LDFLAGS"
1450 CLEANCPPFLAGS="$CPPFLAGS"
1453 dnl This is for Msys/Mingw
1455 *-*-msys* | *-*-mingw*)
1456 AC_MSG_CHECKING([for gdi32])
1457 my_ac_save_LIBS=$LIBS
1458 LIBS="-lgdi32 $LIBS"
1459 AC_TRY_LINK([#include <windef.h>
1460 #include <wingdi.h>],
1463 AC_MSG_RESULT([yes])],
1464 [ dnl failed, restore LIBS
1465 LIBS=$my_ac_save_LIBS
1473 dnl --with-ssl (without path) used
1474 if test x$cross_compiling != xyes; then
1475 dnl only do pkg-config magic when not cross-compiling
1478 PREFIX_OPENSSL=/usr/local/ssl
1479 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1482 dnl no --with-ssl option given, just check default places
1483 if test x$cross_compiling != xyes; then
1484 dnl only do pkg-config magic when not cross-compiling
1490 dnl check the given --with-ssl spot
1492 PREFIX_OPENSSL=$OPT_SSL
1494 dnl Try pkg-config even when cross-compiling. Since we
1495 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1496 dnl the user told us to look
1497 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1498 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
1499 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
1503 dnl in case pkg-config comes up empty, use what we got
1505 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1506 if test "$PREFIX_OPENSSL" != "/usr" ; then
1507 SSL_LDFLAGS="-L$LIB_OPENSSL"
1508 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1510 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1514 if test "$PKGTEST" = "yes"; then
1516 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1518 if test "$PKGCONFIG" != "no" ; then
1519 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1520 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1522 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1523 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1525 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1526 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1529 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1530 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1531 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1533 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1535 dnl use the values pkg-config reported. This is here
1536 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1537 dnl learn about this via pkg-config. If we only have
1538 dnl the argument to --with-ssl we don't know what
1539 dnl additional libs may be necessary. Hope that we
1541 LIBS="$SSL_LIBS $LIBS"
1545 dnl finally, set flags to use SSL
1546 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1547 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1549 AC_CHECK_LIB(crypto, HMAC_Update,[
1551 LIBS="-lcrypto $LIBS"
1553 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1554 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1555 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
1557 LIBS="-lcrypto $LIBS"], [
1559 dnl still no, but what about with -ldl?
1560 AC_MSG_CHECKING([OpenSSL linking with -ldl])
1564 #include <openssl/err.h>
1575 dnl ok, so what about bouth -ldl and -lpthread?
1577 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
1578 LIBS="-lpthread $LIBS"
1581 #include <openssl/err.h>
1592 LDFLAGS="$CLEANLDFLAGS"
1593 CPPFLAGS="$CLEANCPPFLAGS"
1603 if test X"$HAVECRYPTO" = X"yes"; then
1604 dnl This is only reasonable to do if crypto actually is there: check for
1605 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1607 AC_CHECK_LIB(ssl, SSL_connect)
1609 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1610 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1611 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1613 LIBS="-lRSAglue -lrsaref $LIBS"
1614 AC_CHECK_LIB(ssl, SSL_connect)
1615 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1616 dnl still no SSL_connect
1625 dnl Have the libraries--check for OpenSSL headers
1626 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1627 openssl/pem.h openssl/ssl.h openssl/err.h,
1629 test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1631 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1633 if test $ac_cv_header_openssl_x509_h = no; then
1634 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1635 dnl since 'err.h' might in fact find a krb4 header with the same
1637 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1639 if test $ac_cv_header_x509_h = yes &&
1640 test $ac_cv_header_crypto_h = yes &&
1641 test $ac_cv_header_ssl_h = yes; then
1649 if test X"$OPENSSL_ENABLED" != X"1"; then
1653 if test X"$OPT_SSL" != Xoff &&
1654 test "$OPENSSL_ENABLED" != "1"; then
1655 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1659 if test X"$OPENSSL_ENABLED" = X"1"; then
1660 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1661 dnl stuff, it is kind of "separated" from the main SSL check
1662 AC_CHECK_FUNC(ENGINE_init,
1664 AC_CHECK_HEADERS(openssl/engine.h)
1665 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1668 dnl These can only exist if OpenSSL exists
1669 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1670 dnl SSL_get_shutdown (but this check won't actually detect it there
1671 dnl as it's a macro that needs the header files be included)
1673 AC_CHECK_FUNCS( RAND_egd \
1676 SSLv2_client_method )
1678 AC_MSG_CHECKING([for BoringSSL])
1681 #include <openssl/base.h>
1683 #ifndef OPENSSL_IS_BORINGSSL
1684 #error not boringssl
1688 AC_MSG_RESULT([yes])
1689 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1690 [Define to 1 if using BoringSSL.])
1696 AC_MSG_CHECKING([for libressl])
1699 #include <openssl/opensslv.h>
1701 int dummy = LIBRESSL_VERSION_NUMBER;
1704 AC_MSG_RESULT([yes])
1705 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1706 [Define to 1 if using libressl.])
1713 if test "$OPENSSL_ENABLED" = "1"; then
1714 if test -n "$LIB_OPENSSL"; then
1715 dnl when the ssl shared libs were found in a path that the run-time
1716 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1717 dnl to prevent further configure tests to fail due to this
1718 if test "x$cross_compiling" != "xyes"; then
1719 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1720 export LD_LIBRARY_PATH
1721 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1724 CURL_CHECK_OPENSSL_API
1727 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1730 dnl **********************************************************************
1731 dnl Check for the random seed preferences
1732 dnl **********************************************************************
1734 if test X"$OPENSSL_ENABLED" = X"1"; then
1735 AC_ARG_WITH(egd-socket,
1736 AC_HELP_STRING([--with-egd-socket=FILE],
1737 [Entropy Gathering Daemon socket pathname]),
1738 [ EGD_SOCKET="$withval" ]
1740 if test -n "$EGD_SOCKET" ; then
1741 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1742 [your Entropy Gathering Daemon socket pathname] )
1745 dnl Check for user-specified random device
1747 AC_HELP_STRING([--with-random=FILE],
1748 [read randomness from FILE (default=/dev/urandom)]),
1749 [ RANDOM_FILE="$withval" ],
1751 if test x$cross_compiling != xyes; then
1752 dnl Check for random device
1753 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1755 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1759 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1760 AC_SUBST(RANDOM_FILE)
1761 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1762 [a suitable file to read random data from])
1767 dnl We require OpenSSL with SRP support.
1769 if test "$OPENSSL_ENABLED" = "1"; then
1770 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1772 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1773 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1777 dnl ----------------------------------------------------
1778 dnl check for GnuTLS
1779 dnl ----------------------------------------------------
1781 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1784 AC_ARG_WITH(gnutls,dnl
1785 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
1786 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1787 OPT_GNUTLS=$withval)
1789 if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1792 if test X"$OPT_GNUTLS" != Xno; then
1800 if test "x$OPT_GNUTLS" = "xyes"; then
1801 dnl this is with no partiular path given
1802 CURL_CHECK_PKGCONFIG(gnutls)
1804 if test "$PKGCONFIG" != "no" ; then
1805 addlib=`$PKGCONFIG --libs-only-l gnutls`
1806 addld=`$PKGCONFIG --libs-only-L gnutls`
1807 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1808 version=`$PKGCONFIG --modversion gnutls`
1809 gtlslib=`echo $addld | $SED -e 's/-L//'`
1811 dnl without pkg-config, we try libgnutls-config as that was how it
1813 check=`libgnutls-config --version 2>/dev/null`
1814 if test -n "$check"; then
1815 addlib=`libgnutls-config --libs`
1816 addcflags=`libgnutls-config --cflags`
1817 version=`libgnutls-config --version`
1818 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1822 dnl this is with a given path, first check if there's a libgnutls-config
1823 dnl there and if not, make an educated guess
1824 cfg=$OPT_GNUTLS/bin/libgnutls-config
1825 check=`$cfg --version 2>/dev/null`
1826 if test -n "$check"; then
1827 addlib=`$cfg --libs`
1828 addcflags=`$cfg --cflags`
1829 version=`$cfg --version`
1830 gtlslib=`$cfg --prefix`/lib$libsuff
1832 dnl without pkg-config and libgnutls-config, we guess a lot!
1834 addld=-L$OPT_GNUTLS/lib$libsuff
1835 addcflags=-I$OPT_GNUTLS/include
1836 version="" # we just don't know
1837 gtlslib=$OPT_GNUTLS/lib$libsuff
1841 if test -z "$version"; then
1842 dnl lots of efforts, still no go
1846 if test -n "$addlib"; then
1849 CLEANCPPFLAGS="$CPPFLAGS"
1850 CLEANLDFLAGS="$LDFLAGS"
1852 LIBS="$addlib $LIBS"
1853 LDFLAGS="$LDFLAGS $addld"
1854 if test "$addcflags" != "-I/usr/include"; then
1855 CPPFLAGS="$CPPFLAGS $addcflags"
1858 AC_CHECK_LIB(gnutls, gnutls_check_version,
1860 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1861 AC_SUBST(USE_GNUTLS, [1])
1865 test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1869 CPPFLAGS="$CLEANCPPFLAGS"
1872 if test "x$USE_GNUTLS" = "xyes"; then
1873 AC_MSG_NOTICE([detected GnuTLS version $version])
1875 if test -n "$gtlslib"; then
1876 dnl when shared libs were found in a path that the run-time
1877 dnl linker doesn't search through, we need to add it to
1878 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1880 if test "x$cross_compiling" != "xyes"; then
1881 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1882 export LD_LIBRARY_PATH
1883 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1886 AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
1891 fi dnl GNUTLS not disabled
1893 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1897 dnl Check which crypto backend GnuTLS uses
1900 if test "$GNUTLS_ENABLED" = "1"; then
1902 # First check if we can detect either crypto library via transitive linking
1903 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1904 if test "$USE_GNUTLS_NETTLE" = ""; then
1905 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1907 # If not, try linking directly to both of them to see if they are available
1908 if test "$USE_GNUTLS_NETTLE" = ""; then
1909 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1911 if test "$USE_GNUTLS_NETTLE" = ""; then
1912 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1914 if test "$USE_GNUTLS_NETTLE" = ""; then
1915 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
1917 if test "$USE_GNUTLS_NETTLE" = "1"; then
1918 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
1919 AC_SUBST(USE_GNUTLS_NETTLE, [1])
1920 LIBS="-lnettle $LIBS"
1922 LIBS="-lgcrypt $LIBS"
1927 dnl We require GnuTLS with SRP support.
1929 if test "$GNUTLS_ENABLED" = "1"; then
1930 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
1932 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
1933 AC_SUBST(HAVE_GNUTLS_SRP, [1])
1937 dnl ----------------------------------------------------
1938 dnl check for PolarSSL
1939 dnl ----------------------------------------------------
1941 dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1946 AC_ARG_WITH(polarssl,dnl
1947 AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
1948 AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1949 OPT_POLARSSL=$withval)
1951 if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then
1954 if test X"$OPT_POLARSSL" != Xno; then
1956 if test "$OPT_POLARSSL" = "yes"; then
1960 if test -z "$OPT_POLARSSL" ; then
1961 dnl check for lib first without setting any new path
1963 AC_CHECK_LIB(polarssl, havege_init,
1964 dnl libpolarssl found, set the variable
1966 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1967 AC_SUBST(USE_POLARSSL, [1])
1971 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1980 if test "x$USE_POLARSSL" != "xyes"; then
1981 dnl add the path and test again
1982 addld=-L$OPT_POLARSSL/lib$libsuff
1983 addcflags=-I$OPT_POLARSSL/include
1984 polarssllib=$OPT_POLARSSL/lib$libsuff
1986 LDFLAGS="$LDFLAGS $addld"
1987 if test "$addcflags" != "-I/usr/include"; then
1988 CPPFLAGS="$CPPFLAGS $addcflags"
1991 AC_CHECK_LIB(polarssl, ssl_init,
1993 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1994 AC_SUBST(USE_POLARSSL, [1])
1998 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2006 if test "x$USE_POLARSSL" = "xyes"; then
2007 AC_MSG_NOTICE([detected PolarSSL])
2009 LIBS="-lpolarssl $LIBS"
2011 if test -n "$polarssllib"; then
2012 dnl when shared libs were found in a path that the run-time
2013 dnl linker doesn't search through, we need to add it to
2014 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2016 if test "x$cross_compiling" != "xyes"; then
2017 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
2018 export LD_LIBRARY_PATH
2019 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
2024 fi dnl PolarSSL not disabled
2026 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2029 dnl ----------------------------------------------------
2030 dnl check for mbedTLS
2031 dnl ----------------------------------------------------
2037 AC_ARG_WITH(mbedtls,dnl
2038 AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2039 AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2040 OPT_MBEDTLS=$withval)
2042 if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2045 if test X"$OPT_MBEDTLS" != Xno; then
2047 if test "$OPT_MBEDTLS" = "yes"; then
2051 if test -z "$OPT_MBEDTLS" ; then
2052 dnl check for lib first without setting any new path
2054 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2055 dnl libmbedtls found, set the variable
2057 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2058 AC_SUBST(USE_MBEDTLS, [1])
2062 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2063 ], [], -lmbedx509 -lmbedcrypto)
2071 if test "x$USE_MBEDTLS" != "xyes"; then
2072 dnl add the path and test again
2073 addld=-L$OPT_MBEDTLS/lib$libsuff
2074 addcflags=-I$OPT_MBEDTLS/include
2075 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2077 LDFLAGS="$LDFLAGS $addld"
2078 if test "$addcflags" != "-I/usr/include"; then
2079 CPPFLAGS="$CPPFLAGS $addcflags"
2082 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2084 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2085 AC_SUBST(USE_MBEDTLS, [1])
2089 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2094 ], -lmbedx509 -lmbedcrypto)
2097 if test "x$USE_MBEDTLS" = "xyes"; then
2098 AC_MSG_NOTICE([detected mbedTLS])
2100 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2102 if test -n "$mbedtlslib"; then
2103 dnl when shared libs were found in a path that the run-time
2104 dnl linker doesn't search through, we need to add it to
2105 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2107 if test "x$cross_compiling" != "xyes"; then
2108 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib"
2109 export LD_LIBRARY_PATH
2110 AC_MSG_NOTICE([Added $mbedtlslib to LD_LIBRARY_PATH])
2115 fi dnl mbedTLS not disabled
2117 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2120 dnl ----------------------------------------------------
2121 dnl check for CyaSSL
2122 dnl ----------------------------------------------------
2124 dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2129 AC_ARG_WITH(cyassl,dnl
2130 AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2131 AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2132 OPT_CYASSL=$withval)
2134 if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then
2137 if test X"$OPT_CYASSL" != Xno; then
2139 if test "$OPT_CYASSL" = "yes"; then
2143 dnl This should be reworked to use pkg-config instead
2145 cyassllibname=cyassl
2147 if test -z "$OPT_CYASSL" ; then
2148 dnl check for lib in system default first
2150 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2151 dnl libcyassl found, set the variable
2153 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2154 AC_SUBST(USE_CYASSL, [1])
2158 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2167 if test "x$USE_CYASSL" != "xyes"; then
2168 dnl add the path and test again
2169 addld=-L$OPT_CYASSL/lib$libsuff
2170 addcflags=-I$OPT_CYASSL/include
2171 cyassllib=$OPT_CYASSL/lib$libsuff
2173 LDFLAGS="$LDFLAGS $addld"
2174 if test "$addcflags" != "-I/usr/include"; then
2175 CPPFLAGS="$CPPFLAGS $addcflags"
2178 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2180 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2181 AC_SUBST(USE_CYASSL, [1])
2185 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2198 if test "x$USE_CYASSL" != "xyes"; then
2199 dnl libcyassl renamed to libwolfssl as of 3.4.0
2200 addld=-L$OPT_CYASSL/lib$libsuff
2201 addcflags=-I$OPT_CYASSL/include
2202 cyassllib=$OPT_CYASSL/lib$libsuff
2204 LDFLAGS="$LDFLAGS $addld"
2205 if test "$addcflags" != "-I/usr/include"; then
2206 CPPFLAGS="$CPPFLAGS $addcflags"
2209 cyassllibname=wolfssl
2210 my_ac_save_LIBS="$LIBS"
2211 LIBS="-l$cyassllibname -lm $LIBS"
2213 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2216 /* These aren't needed for detection and confuse WolfSSL.
2217 They are set up properly later if it is detected. */
2219 #undef SIZEOF_LONG_LONG
2220 #include <cyassl/ssl.h>
2222 return CyaSSL_Init();
2226 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
2227 AC_SUBST(USE_CYASSL, [1])
2231 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2239 LIBS="$my_ac_save_LIBS"
2242 if test "x$USE_CYASSL" = "xyes"; then
2243 AC_MSG_NOTICE([detected $cyassllibname])
2245 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2246 AC_CHECK_SIZEOF(long long)
2248 dnl Versions since at least 2.6.0 may have options.h
2249 AC_CHECK_HEADERS(cyassl/options.h)
2251 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2252 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2254 LIBS="-l$cyassllibname -lm $LIBS"
2256 if test "x$cyassllibname" = "xwolfssl"; then
2257 dnl Recent WolfSSL versions build without SSLv3 by default
2258 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2259 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2260 wolfSSL_CTX_UseSupportedCurve \
2261 wolfSSL_get_peer_certificate \
2264 dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2265 AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2266 CyaSSL_get_peer_certificate)
2269 if test -n "$cyassllib"; then
2270 dnl when shared libs were found in a path that the run-time
2271 dnl linker doesn't search through, we need to add it to
2272 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2274 if test "x$cross_compiling" != "xyes"; then
2275 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
2276 export LD_LIBRARY_PATH
2277 AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
2283 fi dnl CyaSSL not disabled
2285 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2288 dnl ----------------------------------------------------
2289 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2290 dnl ----------------------------------------------------
2292 dnl Default to compiler & linker defaults for NSS files & libraries.
2296 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
2297 AC_HELP_STRING([--without-nss], [disable NSS detection]),
2300 if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2303 if test X"$OPT_NSS" != Xno; then
2311 if test "x$OPT_NSS" = "xyes"; then
2313 CURL_CHECK_PKGCONFIG(nss)
2315 if test "$PKGCONFIG" != "no" ; then
2316 addlib=`$PKGCONFIG --libs nss`
2317 addcflags=`$PKGCONFIG --cflags nss`
2318 version=`$PKGCONFIG --modversion nss`
2319 nssprefix=`$PKGCONFIG --variable=prefix nss`
2321 dnl Without pkg-config, we check for nss-config
2323 check=`nss-config --version 2>/dev/null`
2324 if test -n "$check"; then
2325 addlib=`nss-config --libs`
2326 addcflags=`nss-config --cflags`
2327 version=`nss-config --version`
2328 nssprefix=`nss-config --prefix`
2336 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2337 if test -f "$NSS_PCDIR/nss.pc"; then
2338 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2339 if test "$PKGCONFIG" != "no" ; then
2340 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2341 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2342 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2343 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2344 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2349 if test -z "$addlib"; then
2350 # Without pkg-config, we'll kludge in some defaults
2351 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2352 addld="-L$OPT_NSS/lib"
2353 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2354 addcflags="-I$OPT_NSS/include"
2359 CLEANLDFLAGS="$LDFLAGS"
2361 CLEANCPPFLAGS="$CPPFLAGS"
2363 LDFLAGS="$addld $LDFLAGS"
2364 LIBS="$addlib $LIBS"
2365 if test "$addcflags" != "-I/usr/include"; then
2366 CPPFLAGS="$CPPFLAGS $addcflags"
2369 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2370 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
2372 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2373 AC_SUBST(USE_NSS, [1])
2377 test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2380 LDFLAGS="$CLEANLDFLAGS"
2382 CPPFLAGS="$CLEANCPPFLAGS"
2385 if test "x$USE_NSS" = "xyes"; then
2386 AC_MSG_NOTICE([detected NSS version $version])
2388 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2390 AC_SUBST([NSS_LIBS])
2392 dnl when shared libs were found in a path that the run-time
2393 dnl linker doesn't search through, we need to add it to
2394 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2396 if test "x$cross_compiling" != "xyes"; then
2397 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2398 export LD_LIBRARY_PATH
2399 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2404 fi dnl NSS not disabled
2406 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2411 AC_ARG_WITH(axtls,dnl
2412 AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local). Ignored if another SSL engine is selected.])
2413 AC_HELP_STRING([--without-axtls], [disable axTLS]),
2416 if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then
2418 if test X"$OPT_AXTLS" != Xno; then
2419 dnl backup the pre-axtls variables
2420 CLEANLDFLAGS="$LDFLAGS"
2421 CLEANCPPFLAGS="$CPPFLAGS"
2424 case "$OPT_AXTLS" in
2426 dnl --with-axtls (without path) used
2427 PREFIX_AXTLS=/usr/local
2428 LIB_AXTLS="$PREFIX_AXTLS/lib"
2429 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2430 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2433 dnl no --with-axtls option given, just check default places
2437 dnl check the given --with-axtls spot
2438 PREFIX_AXTLS=$OPT_AXTLS
2439 LIB_AXTLS="$PREFIX_AXTLS/lib"
2440 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2441 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2445 AC_CHECK_LIB(axtls, ssl_version,[
2446 LIBS="-laxtls $LIBS"
2447 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2448 AC_SUBST(USE_AXTLS, [1])
2452 test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2454 if test "x$cross_compiling" != "xyes"; then
2455 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2456 export LD_LIBRARY_PATH
2457 AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2460 LDFLAGS="$CLEANLDFLAGS"
2461 CPPFLAGS="$CLEANCPPFLAGS"
2465 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2468 case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in
2470 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
2471 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
2474 # one SSL backend is enabled
2475 AC_SUBST(SSL_ENABLED)
2477 AC_MSG_NOTICE([built with one SSL backend])
2480 # more than one SSL backend is enabled
2481 AC_SUBST(SSL_ENABLED)
2483 AC_SUBST(CURL_WITH_MULTI_SSL)
2484 CURL_WITH_MULTI_SSL="1"
2485 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2486 AC_MSG_NOTICE([built with multiple SSL backends])
2490 if test -n "$ssl_backends"; then
2491 curl_ssl_msg="enabled ($ssl_backends)"
2494 if test no = "$VALID_DEFAULT_SSL_BACKEND"
2496 if test -n "$SSL_ENABLED"
2498 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2500 AC_MSG_ERROR([Default SSL backend requires SSL!])
2502 elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2504 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
2507 dnl **********************************************************************
2508 dnl Check for the CA bundle
2509 dnl **********************************************************************
2511 CURL_CHECK_CA_BUNDLE
2513 dnl **********************************************************************
2514 dnl Check for libpsl
2515 dnl **********************************************************************
2518 AS_HELP_STRING([--without-libpsl],
2519 [disable support for libpsl cookie checking]),
2520 with_libpsl=$withval,
2522 if test $with_libpsl != "no"; then
2523 AC_SEARCH_LIBS(psl_builtin, psl,
2524 [curl_psl_msg="yes";
2525 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2527 [curl_psl_msg="no (libpsl not found)";
2528 AC_MSG_WARN([libpsl was not found])
2532 AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2534 dnl **********************************************************************
2535 dnl Check for libmetalink
2536 dnl **********************************************************************
2540 AC_ARG_WITH(libmetalink,dnl
2541 AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2542 AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2543 OPT_LIBMETALINK=$withval)
2545 if test X"$OPT_LIBMETALINK" != Xno; then
2554 if test "x$OPT_LIBMETALINK" = "xyes"; then
2555 dnl this is with no partiular path given
2557 CURL_CHECK_PKGCONFIG(libmetalink)
2559 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2560 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2561 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2562 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2565 if test "$PKGTEST" = "yes"; then
2566 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2569 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2570 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2571 $PKGCONFIG --libs-only-l libmetalink`
2572 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2573 $PKGCONFIG --libs-only-L libmetalink`
2574 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2575 $PKGCONFIG --cflags-only-I libmetalink`
2576 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2577 $PKGCONFIG --modversion libmetalink`
2578 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2580 if test -n "$addlib"; then
2582 clean_CPPFLAGS="$CPPFLAGS"
2583 clean_LDFLAGS="$LDFLAGS"
2585 CPPFLAGS="$clean_CPPFLAGS $addcflags"
2586 LDFLAGS="$clean_LDFLAGS $addld"
2587 LIBS="$addlib $clean_LIBS"
2588 AC_MSG_CHECKING([if libmetalink is recent enough])
2591 # include <metalink/metalink.h>
2593 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2597 AC_MSG_RESULT([yes ($version)])
2600 AC_MSG_RESULT([no ($version)])
2601 AC_MSG_NOTICE([libmetalink library defective or too old])
2604 CPPFLAGS="$clean_CPPFLAGS"
2605 LDFLAGS="$clean_LDFLAGS"
2607 if test "$want_metalink" = "yes"; then
2608 dnl finally libmetalink will be used
2609 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2610 LIBMETALINK_LIBS=$addlib
2611 LIBMETALINK_LDFLAGS=$addld
2612 LIBMETALINK_CPPFLAGS=$addcflags
2613 AC_SUBST([LIBMETALINK_LIBS])
2614 AC_SUBST([LIBMETALINK_LDFLAGS])
2615 AC_SUBST([LIBMETALINK_CPPFLAGS])
2616 curl_mtlnk_msg="enabled"
2622 dnl **********************************************************************
2623 dnl Check for the presence of LIBSSH2 libraries and headers
2624 dnl **********************************************************************
2626 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2628 AC_ARG_WITH(libssh2,dnl
2629 AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
2630 AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2631 OPT_LIBSSH2=$withval)
2633 if test X"$OPT_LIBSSH2" != Xno; then
2634 dnl backup the pre-libssh2 variables
2635 CLEANLDFLAGS="$LDFLAGS"
2636 CLEANCPPFLAGS="$CPPFLAGS"
2639 case "$OPT_LIBSSH2" in
2641 dnl --with-libssh2 (without path) used
2642 CURL_CHECK_PKGCONFIG(libssh2)
2644 if test "$PKGCONFIG" != "no" ; then
2645 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2646 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2647 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2648 version=`$PKGCONFIG --modversion libssh2`
2649 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2654 dnl no --with-libssh2 option given, just check default places
2657 dnl use the given --with-libssh2 spot
2658 PREFIX_SSH2=$OPT_LIBSSH2
2662 dnl if given with a prefix, we set -L and -I based on that
2663 if test -n "$PREFIX_SSH2"; then
2665 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2666 CPP_SSH2=-I${PREFIX_SSH2}/include
2667 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2670 LDFLAGS="$LDFLAGS $LD_SSH2"
2671 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
2672 LIBS="$LIB_SSH2 $LIBS"
2674 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2676 AC_CHECK_HEADERS(libssh2.h,
2677 curl_ssh_msg="enabled (libSSH2)"
2679 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2680 AC_SUBST(USE_LIBSSH2, [1])
2683 if test X"$OPT_LIBSSH2" != Xoff &&
2684 test "$LIBSSH2_ENABLED" != "1"; then
2685 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2688 if test "$LIBSSH2_ENABLED" = "1"; then
2689 if test -n "$DIR_SSH2"; then
2690 dnl when the libssh2 shared libs were found in a path that the run-time
2691 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2692 dnl to prevent further configure tests to fail due to this
2694 if test "x$cross_compiling" != "xyes"; then
2695 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2696 export LD_LIBRARY_PATH
2697 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2701 dnl no libssh2, revert back to clean variables
2702 LDFLAGS=$CLEANLDFLAGS
2703 CPPFLAGS=$CLEANCPPFLAGS
2708 dnl **********************************************************************
2709 dnl Check for the presence of LIBRTMP libraries and headers
2710 dnl **********************************************************************
2712 dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2714 AC_ARG_WITH(librtmp,dnl
2715 AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
2716 AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2717 OPT_LIBRTMP=$withval)
2719 if test X"$OPT_LIBRTMP" != Xno; then
2720 dnl backup the pre-librtmp variables
2721 CLEANLDFLAGS="$LDFLAGS"
2722 CLEANCPPFLAGS="$CPPFLAGS"
2725 case "$OPT_LIBRTMP" in
2727 dnl --with-librtmp (without path) used
2728 CURL_CHECK_PKGCONFIG(librtmp)
2730 if test "$PKGCONFIG" != "no" ; then
2731 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2732 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2733 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2734 version=`$PKGCONFIG --modversion librtmp`
2735 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
2737 dnl To avoid link errors, we do not allow --librtmp without
2738 dnl a pkgconfig file
2739 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
2744 dnl no --with-librtmp option given, just check default places
2748 dnl use the given --with-librtmp spot
2750 PREFIX_RTMP=$OPT_LIBRTMP
2754 dnl if given with a prefix, we set -L and -I based on that
2755 if test -n "$PREFIX_RTMP"; then
2756 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2757 CPP_RTMP=-I${PREFIX_RTMP}/include
2758 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2761 LDFLAGS="$LDFLAGS $LD_RTMP"
2762 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
2763 LIBS="$LIB_RTMP $LIBS"
2765 AC_CHECK_LIB(rtmp, RTMP_Init,
2767 AC_CHECK_HEADERS(librtmp/rtmp.h,
2768 curl_rtmp_msg="enabled (librtmp)"
2770 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2771 AC_SUBST(USE_LIBRTMP, [1])
2774 dnl not found, revert back to clean variables
2775 LDFLAGS=$CLEANLDFLAGS
2776 CPPFLAGS=$CLEANCPPFLAGS
2780 if test X"$OPT_LIBRTMP" != Xoff &&
2781 test "$LIBRTMP_ENABLED" != "1"; then
2782 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2787 dnl **********************************************************************
2788 dnl Check for linker switch for versioned symbols
2789 dnl **********************************************************************
2791 versioned_symbols_flavour=
2792 AC_MSG_CHECKING([whether versioned symbols are wanted])
2793 AC_ARG_ENABLE(versioned-symbols,
2794 AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2795 AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2796 [ case "$enableval" in
2797 yes) AC_MSG_RESULT(yes)
2798 AC_MSG_CHECKING([if libraries can be versioned])
2799 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2800 if test -z "$GLD"; then
2802 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2805 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
2806 versioned_symbols_flavour="MULTISSL_"
2807 elif test "x$OPENSSL_ENABLED" = "x1"; then
2808 versioned_symbols_flavour="OPENSSL_"
2809 elif test "x$GNUTLS_ENABLED" = "x1"; then
2810 versioned_symbols_flavour="GNUTLS_"
2811 elif test "x$NSS_ENABLED" = "x1"; then
2812 versioned_symbols_flavour="NSS_"
2813 elif test "x$POLARSSL_ENABLED" = "x1"; then
2814 versioned_symbols_flavour="POLARSSL_"
2815 elif test "x$CYASSL_ENABLED" = "x1"; then
2816 versioned_symbols_flavour="CYASSL_"
2817 elif test "x$AXTLS_ENABLED" = "x1"; then
2818 versioned_symbols_flavour="AXTLS_"
2819 elif test "x$WINSSL_ENABLED" = "x1"; then
2820 versioned_symbols_flavour="WINSSL_"
2821 elif test "x$DARWINSSL_ENABLED" = "x1"; then
2822 versioned_symbols_flavour="DARWINSSL_"
2824 versioned_symbols_flavour=""
2826 versioned_symbols="yes"
2830 *) AC_MSG_RESULT(no)
2838 AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2839 ["$versioned_symbols_flavour"])
2840 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2841 [test "x$versioned_symbols" = 'xyes'])
2843 dnl -------------------------------------------------
2844 dnl check winidn option before other IDN libraries
2845 dnl -------------------------------------------------
2847 AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2848 OPT_WINIDN="default"
2850 AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2851 AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
2852 OPT_WINIDN=$withval)
2853 case "$OPT_WINIDN" in
2855 dnl --without-winidn option used or configure option not specified
2860 dnl --with-winidn option used without path
2862 want_winidn_path="default"
2863 AC_MSG_RESULT([yes])
2866 dnl --with-winidn option used with path
2868 want_winidn_path="$withval"
2869 AC_MSG_RESULT([yes ($withval)])
2873 if test "$want_winidn" = "yes"; then
2874 dnl winidn library support has been requested
2875 clean_CPPFLAGS="$CPPFLAGS"
2876 clean_LDFLAGS="$LDFLAGS"
2878 WINIDN_LIBS="-lnormaliz"
2879 WINIDN_CPPFLAGS="-DWINVER=0x0600"
2881 if test "$want_winidn_path" != "default"; then
2882 dnl path has been specified
2883 dnl pkg-config not available or provides no info
2884 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2885 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2886 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2889 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
2890 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
2891 LIBS="$WINIDN_LIBS $LIBS"
2893 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2896 #include <windows.h>
2898 IdnToUnicode(0, NULL, 0, NULL, 0);
2901 AC_MSG_RESULT([yes])
2902 tst_links_winidn="yes"
2905 tst_links_winidn="no"
2908 if test "$tst_links_winidn" = "yes"; then
2909 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2910 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
2911 AC_SUBST([IDN_ENABLED], [1])
2912 curl_idn_msg="enabled (Windows-native)"
2914 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2915 CPPFLAGS="$clean_CPPFLAGS"
2916 LDFLAGS="$clean_LDFLAGS"
2921 dnl **********************************************************************
2922 dnl Check for the presence of IDN libraries and headers
2923 dnl **********************************************************************
2925 AC_MSG_CHECKING([whether to build with libidn2])
2927 AC_ARG_WITH(libidn2,
2928 AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
2929 AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
2933 dnl --without-libidn2 option used
2938 dnl configure option not specified
2940 want_idn_path="default"
2941 AC_MSG_RESULT([(assumed) yes])
2944 dnl --with-libidn2 option used without path
2946 want_idn_path="default"
2947 AC_MSG_RESULT([yes])
2950 dnl --with-libidn2 option used with path
2952 want_idn_path="$withval"
2953 AC_MSG_RESULT([yes ($withval)])
2957 if test "$want_idn" = "yes"; then
2958 dnl idn library support has been requested
2959 clean_CPPFLAGS="$CPPFLAGS"
2960 clean_LDFLAGS="$LDFLAGS"
2964 if test "$want_idn_path" != "default"; then
2965 dnl path has been specified
2966 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
2967 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
2968 if test "$PKGCONFIG" != "no"; then
2969 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2970 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
2971 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2972 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
2973 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2974 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
2975 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2977 dnl pkg-config not available or provides no info
2979 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
2980 IDN_CPPFLAGS="-I$want_idn_path/include"
2981 IDN_DIR="$want_idn_path/lib$libsuff"
2984 dnl path not specified
2985 CURL_CHECK_PKGCONFIG(libidn2)
2986 if test "$PKGCONFIG" != "no"; then
2987 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
2988 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
2989 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
2990 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2992 dnl pkg-config not available or provides no info
2997 if test "$PKGCONFIG" != "no"; then
2998 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
2999 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3000 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3001 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3003 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3004 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3005 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3006 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3009 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3010 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
3011 LIBS="$IDN_LIBS $LIBS"
3013 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
3015 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
3017 AC_MSG_RESULT([yes])
3018 tst_links_libidn="yes"
3021 tst_links_libidn="no"
3024 AC_CHECK_HEADERS( idn2.h )
3026 if test "$tst_links_libidn" = "yes"; then
3027 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
3028 dnl different versions of libidn have different setups of these:
3030 AC_SUBST([IDN_ENABLED], [1])
3031 curl_idn_msg="enabled (libidn2)"
3032 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
3033 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
3034 export LD_LIBRARY_PATH
3035 AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
3038 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3039 CPPFLAGS="$clean_CPPFLAGS"
3040 LDFLAGS="$clean_LDFLAGS"
3046 dnl Let's hope this split URL remains working:
3047 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
3048 dnl genprogc/thread_quick_ref.htm
3051 dnl **********************************************************************
3052 dnl Check for nghttp2
3053 dnl **********************************************************************
3057 if test "x$disable_http" = "xyes"; then
3058 # without HTTP, nghttp2 is no use
3062 AC_ARG_WITH(nghttp2,
3063 AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3064 AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3068 dnl --without-nghttp2 option used
3072 dnl --with-nghttp2 option used without path
3077 dnl --with-nghttp2 option used with path
3079 want_h2_path="$withval/lib/pkgconfig"
3083 curl_h2_msg="disabled (--with-nghttp2)"
3084 if test X"$want_h2" != Xno; then
3085 dnl backup the pre-nghttp2 variables
3086 CLEANLDFLAGS="$LDFLAGS"
3087 CLEANCPPFLAGS="$CPPFLAGS"
3090 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3092 if test "$PKGCONFIG" != "no" ; then
3093 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3094 $PKGCONFIG --libs-only-l libnghttp2`
3095 AC_MSG_NOTICE([-l is $LIB_H2])
3097 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3098 $PKGCONFIG --cflags-only-I libnghttp2`
3099 AC_MSG_NOTICE([-I is $CPP_H2])
3101 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3102 $PKGCONFIG --libs-only-L libnghttp2`
3103 AC_MSG_NOTICE([-L is $LD_H2])
3105 LDFLAGS="$LDFLAGS $LD_H2"
3106 CPPFLAGS="$CPPFLAGS $CPP_H2"
3107 LIBS="$LIB_H2 $LIBS"
3109 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3111 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3113 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3114 curl_h2_msg="enabled (nghttp2)"
3116 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3117 AC_SUBST(USE_NGHTTP2, [1])
3120 dnl not found, revert back to clean variables
3121 LDFLAGS=$CLEANLDFLAGS
3122 CPPFLAGS=$CLEANCPPFLAGS
3127 dnl no nghttp2 pkg-config found, deal with it
3128 if test X"$want_h2" != Xdefault; then
3129 dnl To avoid link errors, we do not allow --with-nghttp2 without
3130 dnl a pkgconfig file
3131 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3137 dnl **********************************************************************
3138 dnl Check for zsh completion path
3139 dnl **********************************************************************
3141 OPT_ZSH_FPATH=default
3142 AC_ARG_WITH(zsh-functions-dir,
3143 AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3144 AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3145 [OPT_ZSH_FPATH=$withval])
3146 case "$OPT_ZSH_FPATH" in
3148 dnl --without-zsh-functions-dir option used
3151 dnl --with-zsh-functions-dir option used without path
3152 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3153 AC_SUBST(ZSH_FUNCTIONS_DIR)
3156 dnl --with-zsh-functions-dir option used with path
3157 ZSH_FUNCTIONS_DIR="$withval"
3158 AC_SUBST(ZSH_FUNCTIONS_DIR)
3162 dnl **********************************************************************
3163 dnl Back to "normal" configuring
3164 dnl **********************************************************************
3166 dnl Checks for header files.
3169 CURL_CHECK_HEADER_MALLOC
3170 CURL_CHECK_HEADER_MEMORY
3172 dnl Now check for the very most basic headers. Then we can use these
3173 dnl ones as default-headers when checking for the rest!
3216 dnl to do if not found
3220 dnl default includes
3222 #ifdef HAVE_SYS_TYPES_H
3223 #include <sys/types.h>
3225 #ifdef HAVE_SYS_TIME_H
3226 #include <sys/time.h>
3228 #ifdef HAVE_SYS_SELECT_H
3229 #include <sys/select.h>
3231 #ifdef HAVE_SYS_SOCKET_H
3232 #include <sys/socket.h>
3234 #ifdef HAVE_NETINET_IN_H
3235 #include <netinet/in.h>
3237 #ifdef HAVE_SYS_UN_H
3243 dnl Checks for typedefs, structures, and compiler characteristics.
3245 CURL_CHECK_VARIADIC_MACROS
3248 CURL_CHECK_STRUCT_TIMEVAL
3249 CURL_VERIFY_RUNTIMELIBS
3251 AC_CHECK_SIZEOF(size_t)
3252 AC_CHECK_SIZEOF(long)
3253 AC_CHECK_SIZEOF(int)
3254 AC_CHECK_SIZEOF(short)
3255 AC_CHECK_SIZEOF(time_t)
3256 AC_CHECK_SIZEOF(off_t)
3259 CPPFLAGS="-I$srcdir/include $CPPFLAGS"
3260 AC_CHECK_SIZEOF(curl_off_t, unused , [
3261 #include <curl/system.h>
3265 AC_CHECK_TYPE(long long,
3266 [AC_DEFINE(HAVE_LONGLONG, 1,
3267 [Define to 1 if the compiler supports the 'long long' data type.])]
3271 if test "xyes" = "x$longlong"; then
3272 AC_MSG_CHECKING([if numberLL works])
3276 long long val = 1000LL;
3279 AC_MSG_RESULT([yes])
3280 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3288 AC_CHECK_TYPE(ssize_t, ,
3289 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3291 # check for bool type
3292 AC_CHECK_TYPE([bool],[
3293 AC_DEFINE(HAVE_BOOL_T, 1,
3294 [Define to 1 if bool is an available type.])
3296 #ifdef HAVE_SYS_TYPES_H
3297 #include <sys/types.h>
3299 #ifdef HAVE_STDBOOL_H
3300 #include <stdbool.h>
3304 CURL_CONFIGURE_CURL_SOCKLEN_T
3306 CURL_CONFIGURE_PULL_SYS_POLL
3310 TYPE_SOCKADDR_STORAGE
3316 CURL_CHECK_FUNC_SELECT
3318 CURL_CHECK_FUNC_RECV
3319 CURL_CHECK_FUNC_SEND
3320 CURL_CHECK_MSG_NOSIGNAL
3322 CURL_CHECK_FUNC_ALARM
3323 CURL_CHECK_FUNC_BASENAME
3324 CURL_CHECK_FUNC_CLOSESOCKET
3325 CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3326 CURL_CHECK_FUNC_CONNECT
3327 CURL_CHECK_FUNC_FCNTL
3328 CURL_CHECK_FUNC_FDOPEN
3329 CURL_CHECK_FUNC_FREEADDRINFO
3330 CURL_CHECK_FUNC_FREEIFADDRS
3331 CURL_CHECK_FUNC_FSETXATTR
3332 CURL_CHECK_FUNC_FTRUNCATE
3333 CURL_CHECK_FUNC_GETADDRINFO
3334 CURL_CHECK_FUNC_GAI_STRERROR
3335 CURL_CHECK_FUNC_GETHOSTBYADDR
3336 CURL_CHECK_FUNC_GETHOSTBYADDR_R
3337 CURL_CHECK_FUNC_GETHOSTBYNAME
3338 CURL_CHECK_FUNC_GETHOSTBYNAME_R
3339 CURL_CHECK_FUNC_GETHOSTNAME
3340 CURL_CHECK_FUNC_GETIFADDRS
3341 CURL_CHECK_FUNC_GETSERVBYPORT_R
3342 CURL_CHECK_FUNC_GMTIME_R
3343 CURL_CHECK_FUNC_INET_NTOA_R
3344 CURL_CHECK_FUNC_INET_NTOP
3345 CURL_CHECK_FUNC_INET_PTON
3346 CURL_CHECK_FUNC_IOCTL
3347 CURL_CHECK_FUNC_IOCTLSOCKET
3348 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3349 CURL_CHECK_FUNC_LOCALTIME_R
3350 CURL_CHECK_FUNC_MEMRCHR
3351 CURL_CHECK_FUNC_POLL
3352 CURL_CHECK_FUNC_SETSOCKOPT
3353 CURL_CHECK_FUNC_SIGACTION
3354 CURL_CHECK_FUNC_SIGINTERRUPT
3355 CURL_CHECK_FUNC_SIGNAL
3356 CURL_CHECK_FUNC_SIGSETJMP
3357 CURL_CHECK_FUNC_SOCKET
3358 CURL_CHECK_FUNC_SOCKETPAIR
3359 CURL_CHECK_FUNC_STRCASECMP
3360 CURL_CHECK_FUNC_STRCMPI
3361 CURL_CHECK_FUNC_STRDUP
3362 CURL_CHECK_FUNC_STRERROR_R
3363 CURL_CHECK_FUNC_STRICMP
3364 CURL_CHECK_FUNC_STRNCASECMP
3365 CURL_CHECK_FUNC_STRNCMPI
3366 CURL_CHECK_FUNC_STRNICMP
3367 CURL_CHECK_FUNC_STRSTR
3368 CURL_CHECK_FUNC_STRTOK_R
3369 CURL_CHECK_FUNC_STRTOLL
3370 CURL_CHECK_FUNC_WRITEV
3376 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3380 AC_CHECK_FUNCS([geteuid \
3397 eval skipcheck=\$skipcheck_$func
3398 if test "x$skipcheck" != "xyes"; then
3399 AC_MSG_CHECKING([deeper for $func])
3406 AC_MSG_RESULT([yes])
3407 eval "ac_cv_func_$func=yes"
3408 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
3409 [Define to 1 if you have the $func function.])
3411 AC_MSG_RESULT([but still no])
3416 dnl Check if the getnameinfo function is available
3417 dnl and get the types of five of its arguments.
3418 CURL_CHECK_FUNC_GETNAMEINFO
3420 if test "$ipv6" = "yes"; then
3421 if test "$curl_cv_func_getaddrinfo" = "yes"; then
3422 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3424 AC_SUBST(IPV6_ENABLED)
3426 CURL_CHECK_NI_WITHSCOPEID
3429 CURL_CHECK_NONBLOCKING_SOCKET
3431 dnl ************************************************************
3432 dnl nroff tool stuff
3435 AC_PATH_PROG( PERL, perl, ,
3436 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3439 AC_PATH_PROGS( NROFF, gnroff nroff, ,
3440 $PATH:/usr/bin/:/usr/local/bin )
3443 if test -n "$NROFF"; then
3444 dnl only check for nroff options if an nroff command was found
3446 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3448 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3449 if test -z "$mancheck"; then
3451 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3452 if test -z "$mancheck"; then
3454 AC_MSG_RESULT([failed])
3455 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3457 AC_MSG_RESULT([$MANOPT])
3460 AC_MSG_RESULT([$MANOPT])
3465 if test -z "$MANOPT"
3467 dnl if no nroff tool was found, or no option that could convert man pages
3468 dnl was found, then disable the built-in manual stuff
3469 AC_MSG_WARN([disabling built-in manual])
3473 dnl *************************************************************************
3474 dnl If the manual variable still is set, then we go with providing a built-in
3477 if test "$USE_MANUAL" = "1"; then
3478 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3479 curl_manual_msg="enabled"
3482 dnl set variable for use in automakefile(s)
3483 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3486 AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3488 if test "x$curl_cv_native_windows" != "xyes" &&
3489 test "x$enable_shared" = "xyes"; then
3490 build_libhostname=yes
3492 build_libhostname=no
3494 AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3496 if test "x$want_ares" != xyes; then
3497 CURL_CHECK_OPTION_THREADED_RESOLVER
3500 dnl ************************************************************
3501 dnl disable POSIX threads
3503 AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3504 AC_ARG_ENABLE(pthreads,
3505 AC_HELP_STRING([--enable-pthreads],
3506 [Enable POSIX threads (default for threaded resolver)])
3507 AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
3508 [ case "$enableval" in
3509 no) AC_MSG_RESULT(no)
3512 *) AC_MSG_RESULT(yes)
3521 dnl turn off pthreads if rt is disabled
3522 if test "$want_pthreads" != "no"; then
3523 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
3524 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
3526 if test "$dontwant_rt" != "no"; then
3527 dnl if --enable-pthreads was explicit then warn it's being ignored
3528 if test "$want_pthreads" = "yes"; then
3529 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
3535 dnl turn off pthreads if no threaded resolver
3536 if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
3541 if test "$want_pthreads" != "no"; then
3542 AC_CHECK_HEADER(pthread.h,
3543 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3544 save_CFLAGS="$CFLAGS"
3546 dnl first check for function without lib
3547 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3549 dnl if it wasn't found without lib, search for it in pthread lib
3550 if test "$USE_THREADS_POSIX" != "1"
3552 CFLAGS="$CFLAGS -pthread"
3553 AC_CHECK_LIB(pthread, pthread_create,
3554 [USE_THREADS_POSIX=1],
3555 [ CFLAGS="$save_CFLAGS"])
3558 if test "x$USE_THREADS_POSIX" = "x1"
3560 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3561 curl_res_msg="POSIX threaded"
3566 dnl threaded resolver check
3567 if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
3568 if test "$want_pthreads" = "yes"; then
3569 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
3571 dnl If native Windows fallback on Win32 threads since no POSIX threads
3572 if test "$curl_cv_native_windows" = "yes"; then
3574 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
3575 curl_res_msg="Win32 threaded"
3577 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
3581 dnl ************************************************************
3582 dnl disable verbose text strings
3584 AC_MSG_CHECKING([whether to enable verbose strings])
3585 AC_ARG_ENABLE(verbose,
3586 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3587 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3588 [ case "$enableval" in
3591 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3592 curl_verbose_msg="no"
3594 *) AC_MSG_RESULT(yes)
3600 dnl ************************************************************
3601 dnl enable SSPI support
3603 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3605 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3606 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3607 [ case "$enableval" in
3609 if test "$curl_cv_native_windows" = "yes"; then
3611 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3612 AC_SUBST(USE_WINDOWS_SSPI, [1])
3613 curl_sspi_msg="enabled"
3616 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3620 if test "x$WINSSL_ENABLED" = "x1"; then
3621 # --with-winssl implies --enable-sspi
3628 if test "x$WINSSL_ENABLED" = "x1"; then
3629 # --with-winssl implies --enable-sspi
3636 dnl ************************************************************
3637 dnl disable cryptographic authentication
3639 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3640 AC_ARG_ENABLE(crypto-auth,
3641 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3642 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3643 [ case "$enableval" in
3646 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
3647 CURL_DISABLE_CRYPTO_AUTH=1
3649 *) AC_MSG_RESULT(yes)
3655 CURL_CHECK_OPTION_NTLM_WB
3659 dnl ************************************************************
3660 dnl disable TLS-SRP authentication
3662 AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3663 AC_ARG_ENABLE(tls-srp,
3664 AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3665 AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3666 [ case "$enableval" in
3669 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3672 *) AC_MSG_RESULT(yes)
3680 if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3681 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3683 curl_tls_srp_msg="enabled"
3686 dnl ************************************************************
3687 dnl disable Unix domain sockets support
3689 AC_MSG_CHECKING([whether to enable Unix domain sockets])
3690 AC_ARG_ENABLE(unix-sockets,
3691 AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3692 AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3693 [ case "$enableval" in
3694 no) AC_MSG_RESULT(no)
3695 want_unix_sockets=no
3697 *) AC_MSG_RESULT(yes)
3698 want_unix_sockets=yes
3702 want_unix_sockets=auto
3705 if test "x$want_unix_sockets" != "xno"; then
3706 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3707 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3708 AC_SUBST(USE_UNIX_SOCKETS, [1])
3709 curl_unix_sockets_msg="enabled"
3711 if test "x$want_unix_sockets" = "xyes"; then
3712 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3719 dnl ************************************************************
3720 dnl disable cookies support
3722 AC_MSG_CHECKING([whether to enable support for cookies])
3723 AC_ARG_ENABLE(cookies,
3724 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3725 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3726 [ case "$enableval" in
3729 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3731 *) AC_MSG_RESULT(yes)
3737 dnl ************************************************************
3738 dnl hiding of library internal symbols
3740 CURL_CONFIGURE_SYMBOL_HIDING
3743 dnl All the library dependencies put into $LIB apply to libcurl only.
3747 AC_SUBST(LIBCURL_LIBS)
3748 AC_SUBST(CURL_NETWORK_LIBS)
3749 AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3751 dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3752 dnl LIBS variable used in generated makefile at makefile processing
3753 dnl time. Doing this functionally prevents LIBS from being used for
3754 dnl all link targets in given makefile.
3756 AC_SUBST(BLANK_AT_MAKETIME)
3758 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3761 ENABLE_SHARED="$enable_shared"
3762 AC_SUBST(ENABLE_SHARED)
3764 dnl to let curl-config output the static libraries correctly
3765 ENABLE_STATIC="$enable_static"
3766 AC_SUBST(ENABLE_STATIC)
3770 dnl For keeping supported features and protocols also in pkg-config file
3771 dnl since it is more cross-compile friendly than curl-config
3774 if test "x$OPENSSL_ENABLED" = "x1"; then
3775 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3776 elif test -n "$SSL_ENABLED"; then
3777 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3779 if test "x$IPV6_ENABLED" = "x1"; then
3780 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3782 if test "x$USE_UNIX_SOCKETS" = "x1"; then
3783 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3785 if test "x$HAVE_LIBZ" = "x1"; then
3786 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3788 if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
3789 -o "x$USE_THREADS_WIN32" = "x1"; then
3790 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3792 if test "x$IDN_ENABLED" = "x1"; then
3793 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3795 if test "x$USE_WINDOWS_SSPI" = "x1"; then
3796 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3799 if test "x$HAVE_GSSAPI" = "x1"; then
3800 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3803 if test "x$curl_psl_msg" = "xyes"; then
3804 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
3807 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3808 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3809 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3812 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3813 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3814 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3817 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3818 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3819 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
3820 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then
3821 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3823 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3824 "x$NTLM_WB_ENABLED" = "x1"; then
3825 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3830 if test "x$USE_TLS_SRP" = "x1"; then
3831 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3834 if test "x$USE_NGHTTP2" = "x1"; then
3835 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
3838 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3839 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
3842 if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
3843 -o "x$NSS_ENABLED" = "x1"; then
3844 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
3847 AC_SUBST(SUPPORT_FEATURES)
3849 dnl For supported protocols in pkg-config file
3850 if test "x$CURL_DISABLE_HTTP" != "x1"; then
3851 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3852 if test "x$SSL_ENABLED" = "x1"; then
3853 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3856 if test "x$CURL_DISABLE_FTP" != "x1"; then
3857 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3858 if test "x$SSL_ENABLED" = "x1"; then
3859 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3862 if test "x$CURL_DISABLE_FILE" != "x1"; then
3863 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3865 if test "x$CURL_DISABLE_TELNET" != "x1"; then
3866 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3868 if test "x$CURL_DISABLE_LDAP" != "x1"; then
3869 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3870 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3871 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3872 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3873 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3877 if test "x$CURL_DISABLE_DICT" != "x1"; then
3878 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3880 if test "x$CURL_DISABLE_TFTP" != "x1"; then
3881 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3883 if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3884 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3886 if test "x$CURL_DISABLE_POP3" != "x1"; then
3887 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3888 if test "x$SSL_ENABLED" = "x1"; then
3889 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3892 if test "x$CURL_DISABLE_IMAP" != "x1"; then
3893 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3894 if test "x$SSL_ENABLED" = "x1"; then
3895 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3898 if test "x$CURL_DISABLE_SMB" != "x1" \
3899 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3900 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3901 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
3902 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then
3903 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3904 if test "x$SSL_ENABLED" = "x1"; then
3905 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
3908 if test "x$CURL_DISABLE_SMTP" != "x1"; then
3909 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3910 if test "x$SSL_ENABLED" = "x1"; then
3911 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3914 if test "x$USE_LIBSSH2" = "x1"; then
3915 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3916 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3918 if test "x$CURL_DISABLE_RTSP" != "x1"; then
3919 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3921 if test "x$USE_LIBRTMP" = "x1"; then
3922 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3925 dnl replace spaces with newlines
3927 dnl replace the newlines back to spaces
3928 SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3930 AC_SUBST(SUPPORT_PROTOCOLS)
3932 dnl squeeze whitespace out of some variables
3940 squeeze LIBCURL_LIBS
3941 squeeze CURL_NETWORK_LIBS
3942 squeeze CURL_NETWORK_AND_TIME_LIBS
3944 squeeze SUPPORT_FEATURES
3945 squeeze SUPPORT_PROTOCOLS
3947 XC_CHECK_BUILD_FLAGS
3949 if test "x$want_curldebug_assumed" = "xyes" &&
3950 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3951 ac_configure_args="$ac_configure_args --enable-curldebug"
3954 AC_CONFIG_FILES([Makefile \
3956 docs/examples/Makefile \
3957 docs/libcurl/Makefile \
3958 docs/libcurl/opts/Makefile \
3959 docs/cmdline-opts/Makefile \
3961 include/curl/Makefile \
3967 tests/certs/Makefile \
3968 tests/certs/scripts/Makefile \
3969 tests/data/Makefile \
3970 tests/server/Makefile \
3971 tests/libtest/Makefile \
3972 tests/unit/Makefile \
3974 packages/Win32/Makefile \
3975 packages/Win32/cygwin/Makefile \
3976 packages/Linux/Makefile \
3977 packages/Linux/RPM/Makefile \
3978 packages/Linux/RPM/curl.spec \
3979 packages/Linux/RPM/curl-ssl.spec \
3980 packages/Solaris/Makefile \
3981 packages/EPM/curl.list \
3982 packages/EPM/Makefile \
3983 packages/vms/Makefile \
3984 packages/AIX/Makefile \
3985 packages/AIX/RPM/Makefile \
3986 packages/AIX/RPM/curl.spec \
3992 CURL_GENERATE_CONFIGUREHELP_PM
3994 XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
3996 AC_MSG_NOTICE([Configured to build curl/libcurl:
3998 curl version: ${CURLVERSION}
4000 Install prefix: ${prefix}
4002 SSL support: ${curl_ssl_msg}
4003 SSH support: ${curl_ssh_msg}
4004 zlib support: ${curl_zlib_msg}
4005 GSS-API support: ${curl_gss_msg}
4006 TLS-SRP support: ${curl_tls_srp_msg}
4007 resolver: ${curl_res_msg}
4008 IPv6 support: ${curl_ipv6_msg}
4009 Unix sockets support: ${curl_unix_sockets_msg}
4010 IDN support: ${curl_idn_msg}
4011 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4012 Built-in manual: ${curl_manual_msg}
4013 --libcurl option: ${curl_libcurl_msg}
4014 Verbose errors: ${curl_verbose_msg}
4015 SSPI support: ${curl_sspi_msg}
4016 ca cert bundle: ${ca}${ca_warning}
4017 ca cert path: ${capath}${capath_warning}
4018 ca fallback: ${with_ca_fallback}
4019 LDAP support: ${curl_ldap_msg}
4020 LDAPS support: ${curl_ldaps_msg}
4021 RTSP support: ${curl_rtsp_msg}
4022 RTMP support: ${curl_rtmp_msg}
4023 metalink support: ${curl_mtlnk_msg}
4024 PSL support: ${curl_psl_msg}
4025 HTTP2 support: ${curl_h2_msg}
4026 Protocols: ${SUPPORT_PROTOCOLS}