link missed library for DLP
[platform/upstream/curl.git] / configure.ac
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
9 #
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.
13 #
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.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 #***************************************************************************
22 dnl Process this file with autoconf to produce a configure script.
23
24 AC_PREREQ(2.57)
25
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/])
28
29 XC_OVR_ZZ50
30 XC_OVR_ZZ60
31 CURL_OVERRIDE_AUTOCONF
32
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])
37
38 AC_CONFIG_SRCDIR([lib/urldata.h])
39 AC_CONFIG_HEADERS(lib/curl_config.h)
40 AC_CONFIG_MACRO_DIR([m4])
41 AM_MAINTAINER_MODE
42 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
43
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
51 CURL_CHECK_OPTION_RT
52
53 XC_CHECK_PATH_SEPARATOR
54
55 #
56 # save the configure arguments
57 #
58 CONFIGURE_OPTIONS="\"$ac_configure_args\""
59 AC_SUBST(CONFIGURE_OPTIONS)
60
61 CURL_CFLAG_EXTRAS=""
62 if test X"$want_werror" = Xyes; then
63   CURL_CFLAG_EXTRAS="-Werror"
64   if test "$compiler_id" = "GNU_C"; then
65     dnl enable -pedantic-errors for GCC 5 and later,
66     dnl as before that it was the same as -Werror=pedantic
67     if test "$compiler_num" -ge "500"; then
68       CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
69     fi
70   fi
71 fi
72 AC_SUBST(CURL_CFLAG_EXTRAS)
73
74 dnl SED is mandatory for configure process and libtool.
75 dnl Set it now, allowing it to be changed later.
76 if test -z "$SED"; then
77   dnl allow it to be overridden
78   AC_PATH_PROG([SED], [sed], [not_found],
79     [$PATH:/usr/bin:/usr/local/bin])
80   if test -z "$SED" || test "$SED" = "not_found"; then
81     AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
82   fi
83 fi
84 AC_SUBST([SED])
85
86 dnl GREP is mandatory for configure process and libtool.
87 dnl Set it now, allowing it to be changed later.
88 if test -z "$GREP"; then
89   dnl allow it to be overridden
90   AC_PATH_PROG([GREP], [grep], [not_found],
91     [$PATH:/usr/bin:/usr/local/bin])
92   if test -z "$GREP" || test "$GREP" = "not_found"; then
93     AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
94   fi
95 fi
96 AC_SUBST([GREP])
97
98 dnl EGREP is mandatory for configure process and libtool.
99 dnl Set it now, allowing it to be changed later.
100 if test -z "$EGREP"; then
101   dnl allow it to be overridden
102   if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
103     AC_MSG_CHECKING([for egrep])
104     EGREP="$GREP -E"
105     AC_MSG_RESULT([$EGREP])
106   else
107     AC_PATH_PROG([EGREP], [egrep], [not_found],
108       [$PATH:/usr/bin:/usr/local/bin])
109   fi
110 fi
111 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
112   AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
113 fi
114 AC_SUBST([EGREP])
115
116 dnl AR is mandatory for configure process and libtool.
117 dnl This is target dependent, so check it as a tool.
118 if test -z "$AR"; then
119   dnl allow it to be overridden
120   AC_PATH_TOOL([AR], [ar], [not_found],
121     [$PATH:/usr/bin:/usr/local/bin])
122   if test -z "$AR" || test "$AR" = "not_found"; then
123     AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
124   fi
125 fi
126 AC_SUBST([AR])
127
128 AC_SUBST(libext)
129
130 dnl figure out the libcurl version
131 CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
132 XC_CHECK_PROG_CC
133
134 dnl Check if gcc is being used before adding AX_CODE_COVERAGE
135 AS_IF([ test "$GCC" = "yes" ], [AX_CODE_COVERAGE],
136   # not using GCC so pass a test below - CODE_COVERAGE_ENABLED_TRUE is not zero length
137   CODE_COVERAGE_ENABLED_TRUE='#'
138 )
139
140 XC_AUTOMAKE
141 AC_MSG_CHECKING([curl version])
142 AC_MSG_RESULT($CURLVERSION)
143
144 AC_SUBST(CURLVERSION)
145
146 dnl
147 dnl we extract the numerical version for curl-config only
148 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\([0-9A-Fa-f]*\).*/\1/p' ${srcdir}/include/curl/curlver.h`
149 AC_SUBST(VERSIONNUM)
150
151 dnl Solaris pkgadd support definitions
152 PKGADD_PKG="HAXXcurl"
153 PKGADD_NAME="curl - a client that groks URLs"
154 PKGADD_VENDOR="curl.haxx.se"
155 AC_SUBST(PKGADD_PKG)
156 AC_SUBST(PKGADD_NAME)
157 AC_SUBST(PKGADD_VENDOR)
158
159 dnl
160 dnl initialize all the info variables
161     curl_ssl_msg="no      (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl,mesalink} )"
162     curl_ssh_msg="no      (--with-libssh2)"
163    curl_zlib_msg="no      (--with-zlib)"
164  curl_brotli_msg="no      (--with-brotli)"
165     curl_gss_msg="no      (--with-gssapi)"
166 curl_tls_srp_msg="no      (--enable-tls-srp)"
167     curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
168    curl_ipv6_msg="no      (--enable-ipv6)"
169 curl_unix_sockets_msg="no      (--enable-unix-sockets)"
170     curl_idn_msg="no      (--with-{libidn2,winidn})"
171  curl_manual_msg="no      (--enable-manual)"
172 curl_libcurl_msg="enabled (--disable-libcurl-option)"
173 curl_verbose_msg="enabled (--disable-verbose)"
174    curl_sspi_msg="no      (--enable-sspi)"
175    curl_ldap_msg="no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
176   curl_ldaps_msg="no      (--enable-ldaps)"
177    curl_rtsp_msg="no      (--enable-rtsp)"
178    curl_rtmp_msg="no      (--with-librtmp)"
179   curl_mtlnk_msg="no      (--with-libmetalink)"
180     curl_psl_msg="no      (--with-libpsl)"
181
182     ssl_backends=
183
184 dnl
185 dnl Save some initial values the user might have provided
186 dnl
187 INITIAL_LDFLAGS=$LDFLAGS
188 INITIAL_LIBS=$LIBS
189
190 dnl
191 dnl Detect the canonical host and target build environment
192 dnl
193
194 AC_CANONICAL_HOST
195 dnl Get system canonical name
196 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
197
198 # Silence warning: ar: 'u' modifier ignored since 'D' is the default
199 AC_SUBST(AR_FLAGS, [cr])
200
201 dnl This defines _ALL_SOURCE for AIX
202 CURL_CHECK_AIX_ALL_SOURCE
203
204 dnl Our configure and build reentrant settings
205 CURL_CONFIGURE_THREAD_SAFE
206 CURL_CONFIGURE_REENTRANT
207
208 dnl check for how to do large files
209 AC_SYS_LARGEFILE
210
211 XC_LIBTOOL
212
213 #
214 # Automake conditionals based on libtool related checks
215 #
216
217 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
218   [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
219 AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
220   [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
221 AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
222   [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
223
224 #
225 # Due to libtool and automake machinery limitations of not allowing
226 # specifying separate CPPFLAGS or CFLAGS when compiling objects for
227 # inclusion of these in shared or static libraries, we are forced to
228 # build using separate configure runs for shared and static libraries
229 # on systems where different CPPFLAGS or CFLAGS are mandatory in order
230 # to compile objects for each kind of library. Notice that relying on
231 # the '-DPIC' CFLAG that libtool provides is not valid given that the
232 # user might for example choose to build static libraries with PIC.
233 #
234
235 #
236 # Make our Makefile.am files use the staticlib CPPFLAG only when strictly
237 # targeting a static library and not building its shared counterpart.
238 #
239
240 AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
241   [test "x$xc_lt_build_static_only" = 'xyes'])
242
243 #
244 # Make staticlib CPPFLAG variable and its definition visible in output
245 # files unconditionally, providing an empty definition unless strictly
246 # targeting a static library and not building its shared counterpart.
247 #
248
249 CPPFLAG_CURL_STATICLIB=
250 if test "x$xc_lt_build_static_only" = 'xyes'; then
251   CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
252 fi
253 AC_SUBST([CPPFLAG_CURL_STATICLIB])
254
255
256 # Determine whether all dependent libraries must be specified when linking
257 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
258 then
259     REQUIRE_LIB_DEPS=no
260 else
261     REQUIRE_LIB_DEPS=yes
262 fi
263 AC_SUBST(REQUIRE_LIB_DEPS)
264 AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
265
266 dnl check if there's a way to force code inline
267 AC_C_INLINE
268
269 dnl **********************************************************************
270 dnl platform/compiler/architecture specific checks/flags
271 dnl **********************************************************************
272
273 CURL_CHECK_COMPILER
274 CURL_SET_COMPILER_BASIC_OPTS
275 CURL_SET_COMPILER_DEBUG_OPTS
276 CURL_SET_COMPILER_OPTIMIZE_OPTS
277 CURL_SET_COMPILER_WARNING_OPTS
278
279 if test "$compiler_id" = "INTEL_UNIX_C"; then
280   #
281   if test "$compiler_num" -ge "1000"; then
282     dnl icc 10.X or later
283     CFLAGS="$CFLAGS -shared-intel"
284   elif test "$compiler_num" -ge "900"; then
285     dnl icc 9.X specific
286     CFLAGS="$CFLAGS -i-dynamic"
287   fi
288   #
289 fi
290
291 CURL_CHECK_COMPILER_HALT_ON_ERROR
292 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
293 CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
294 CURL_CHECK_COMPILER_SYMBOL_HIDING
295
296 CURL_CHECK_CURLDEBUG
297 AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
298
299 supports_unittests=yes
300 # cross-compilation of unit tests static library/programs fails when
301 # libcurl shared library is built. This might be due to a libtool or
302 # automake issue. In this case we disable unit tests.
303 if test "x$cross_compiling" != "xno" &&
304    test "x$enable_shared" != "xno"; then
305   supports_unittests=no
306 fi
307
308 # IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
309 # a problem related with OpenSSL headers and library versions not matching.
310 # Disable unit tests while time to further investigate this is found.
311 case $host in
312   mips-sgi-irix6.5)
313     if test "$compiler_id" = "GNU_C"; then
314       supports_unittests=no
315     fi
316     ;;
317 esac
318
319 # All AIX autobuilds fails unit tests linking against unittests library
320 # due to unittests library being built with no symbols or members. Libtool ?
321 # Disable unit tests while time to further investigate this is found.
322 case $host_os in
323   aix*)
324     supports_unittests=no
325     ;;
326 esac
327
328 dnl Build unit tests when option --enable-debug is given.
329 if test "x$want_debug" = "xyes" &&
330    test "x$supports_unittests" = "xyes"; then
331   want_unittests=yes
332 else
333   want_unittests=no
334 fi
335 AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
336
337 dnl **********************************************************************
338 dnl Compilation based checks should not be done before this point.
339 dnl **********************************************************************
340
341 dnl **********************************************************************
342 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
343 dnl and ws2tcpip.h take precedence over any other further checks which
344 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
345 dnl this specific header files. And do them before its results are used.
346 dnl **********************************************************************
347
348 CURL_CHECK_HEADER_WINDOWS
349 CURL_CHECK_NATIVE_WINDOWS
350 case X-"$curl_cv_native_windows" in
351   X-yes)
352     CURL_CHECK_HEADER_WINSOCK
353     CURL_CHECK_HEADER_WINSOCK2
354     CURL_CHECK_HEADER_WS2TCPIP
355     CURL_CHECK_HEADER_WINLDAP
356     CURL_CHECK_HEADER_WINBER
357     ;;
358   *)
359     curl_cv_header_winsock_h="no"
360     curl_cv_header_winsock2_h="no"
361     curl_cv_header_ws2tcpip_h="no"
362     curl_cv_header_winldap_h="no"
363     curl_cv_header_winber_h="no"
364     ;;
365 esac
366 CURL_CHECK_WIN32_LARGEFILE
367
368 CURL_MAC_CFLAGS
369 CURL_SUPPORTS_BUILTIN_AVAILABLE
370
371 dnl ************************************************************
372 dnl switch off particular protocols
373 dnl
374 AC_MSG_CHECKING([whether to support http])
375 AC_ARG_ENABLE(http,
376 AC_HELP_STRING([--enable-http],[Enable HTTP support])
377 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
378 [ case "$enableval" in
379   no)
380        AC_MSG_RESULT(no)
381        AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
382        disable_http="yes"
383        AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
384        AC_SUBST(CURL_DISABLE_HTTP, [1])
385        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
386        AC_SUBST(CURL_DISABLE_RTSP, [1])
387        ;;
388   *)   AC_MSG_RESULT(yes)
389        ;;
390   esac ],
391        AC_MSG_RESULT(yes)
392 )
393 AC_MSG_CHECKING([whether to support ftp])
394 AC_ARG_ENABLE(ftp,
395 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
396 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
397 [ case "$enableval" in
398   no)
399        AC_MSG_RESULT(no)
400        AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
401        AC_SUBST(CURL_DISABLE_FTP, [1])
402        ;;
403   *)   AC_MSG_RESULT(yes)
404        ;;
405   esac ],
406        AC_MSG_RESULT(yes)
407 )
408 AC_MSG_CHECKING([whether to support file])
409 AC_ARG_ENABLE(file,
410 AC_HELP_STRING([--enable-file],[Enable FILE support])
411 AC_HELP_STRING([--disable-file],[Disable FILE support]),
412 [ case "$enableval" in
413   no)
414        AC_MSG_RESULT(no)
415        AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
416        AC_SUBST(CURL_DISABLE_FILE, [1])
417        ;;
418   *)   AC_MSG_RESULT(yes)
419        ;;
420   esac ],
421        AC_MSG_RESULT(yes)
422 )
423 AC_MSG_CHECKING([whether to support ldap])
424 AC_ARG_ENABLE(ldap,
425 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
426 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
427 [ case "$enableval" in
428   no)
429        AC_MSG_RESULT(no)
430        AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
431        AC_SUBST(CURL_DISABLE_LDAP, [1])
432        ;;
433   *)
434        AC_MSG_RESULT(yes)
435        ;;
436   esac ],[
437        AC_MSG_RESULT(yes) ]
438 )
439 AC_MSG_CHECKING([whether to support ldaps])
440 AC_ARG_ENABLE(ldaps,
441 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
442 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
443 [ case "$enableval" in
444   no)
445        AC_MSG_RESULT(no)
446        AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
447        AC_SUBST(CURL_DISABLE_LDAPS, [1])
448        ;;
449   *)   if test "x$CURL_DISABLE_LDAP" = "x1" ; then
450          AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
451          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
452          AC_SUBST(CURL_DISABLE_LDAPS, [1])
453        else
454          AC_MSG_RESULT(yes)
455          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
456          AC_SUBST(HAVE_LDAP_SSL, [1])
457        fi
458        ;;
459   esac ],[
460        if test "x$CURL_DISABLE_LDAP" = "x1" ; then
461          AC_MSG_RESULT(no)
462          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
463          AC_SUBST(CURL_DISABLE_LDAPS, [1])
464        else
465          AC_MSG_RESULT(yes)
466          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
467          AC_SUBST(HAVE_LDAP_SSL, [1])
468        fi ]
469 )
470
471 AC_MSG_CHECKING([whether to support rtsp])
472 AC_ARG_ENABLE(rtsp,
473 AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
474 AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
475 [ case "$enableval" in
476   no)
477        AC_MSG_RESULT(no)
478        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
479        AC_SUBST(CURL_DISABLE_RTSP, [1])
480        ;;
481   *)   if test x$CURL_DISABLE_HTTP = x1 ; then
482           AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
483        else
484           AC_MSG_RESULT(yes)
485           curl_rtsp_msg="enabled"
486        fi
487        ;;
488   esac ],
489        if test "x$CURL_DISABLE_HTTP" != "x1"; then
490           AC_MSG_RESULT(yes)
491           curl_rtsp_msg="enabled"
492        else
493           AC_MSG_RESULT(no)
494        fi
495 )
496
497 AC_MSG_CHECKING([whether to support proxies])
498 AC_ARG_ENABLE(proxy,
499 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
500 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
501 [ case "$enableval" in
502   no)
503        AC_MSG_RESULT(no)
504        AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
505        AC_SUBST(CURL_DISABLE_PROXY, [1])
506        ;;
507   *)   AC_MSG_RESULT(yes)
508        ;;
509   esac ],
510        AC_MSG_RESULT(yes)
511 )
512
513 AC_MSG_CHECKING([whether to support dict])
514 AC_ARG_ENABLE(dict,
515 AC_HELP_STRING([--enable-dict],[Enable DICT support])
516 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
517 [ case "$enableval" in
518   no)
519        AC_MSG_RESULT(no)
520        AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
521        AC_SUBST(CURL_DISABLE_DICT, [1])
522        ;;
523   *)   AC_MSG_RESULT(yes)
524        ;;
525   esac ],
526        AC_MSG_RESULT(yes)
527 )
528 AC_MSG_CHECKING([whether to support telnet])
529 AC_ARG_ENABLE(telnet,
530 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
531 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
532 [ case "$enableval" in
533   no)
534        AC_MSG_RESULT(no)
535        AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
536        AC_SUBST(CURL_DISABLE_TELNET, [1])
537        ;;
538   *)   AC_MSG_RESULT(yes)
539        ;;
540   esac ],
541        AC_MSG_RESULT(yes)
542 )
543 AC_MSG_CHECKING([whether to support tftp])
544 AC_ARG_ENABLE(tftp,
545 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
546 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
547 [ case "$enableval" in
548   no)
549        AC_MSG_RESULT(no)
550        AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
551        AC_SUBST(CURL_DISABLE_TFTP, [1])
552        ;;
553   *)   AC_MSG_RESULT(yes)
554        ;;
555   esac ],
556        AC_MSG_RESULT(yes)
557 )
558
559 AC_MSG_CHECKING([whether to support pop3])
560 AC_ARG_ENABLE(pop3,
561 AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
562 AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
563 [ case "$enableval" in
564   no)
565        AC_MSG_RESULT(no)
566        AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
567        AC_SUBST(CURL_DISABLE_POP3, [1])
568        ;;
569   *)   AC_MSG_RESULT(yes)
570        ;;
571   esac ],
572        AC_MSG_RESULT(yes)
573 )
574
575
576 AC_MSG_CHECKING([whether to support imap])
577 AC_ARG_ENABLE(imap,
578 AC_HELP_STRING([--enable-imap],[Enable IMAP support])
579 AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
580 [ case "$enableval" in
581   no)
582        AC_MSG_RESULT(no)
583        AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
584        AC_SUBST(CURL_DISABLE_IMAP, [1])
585        ;;
586   *)   AC_MSG_RESULT(yes)
587        ;;
588   esac ],
589        AC_MSG_RESULT(yes)
590 )
591
592
593 AC_MSG_CHECKING([whether to support smb])
594 AC_ARG_ENABLE(smb,
595 AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
596 AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
597 [ case "$enableval" in
598   no)
599        AC_MSG_RESULT(no)
600        AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
601        AC_SUBST(CURL_DISABLE_SMB, [1])
602        ;;
603   *)   AC_MSG_RESULT(yes)
604        ;;
605   esac ],
606        AC_MSG_RESULT(yes)
607 )
608
609 AC_MSG_CHECKING([whether to support smtp])
610 AC_ARG_ENABLE(smtp,
611 AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
612 AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
613 [ case "$enableval" in
614   no)
615        AC_MSG_RESULT(no)
616        AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
617        AC_SUBST(CURL_DISABLE_SMTP, [1])
618        ;;
619   *)   AC_MSG_RESULT(yes)
620        ;;
621   esac ],
622        AC_MSG_RESULT(yes)
623 )
624
625 AC_MSG_CHECKING([whether to support gopher])
626 AC_ARG_ENABLE(gopher,
627 AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
628 AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
629 [ case "$enableval" in
630   no)
631        AC_MSG_RESULT(no)
632        AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
633        AC_SUBST(CURL_DISABLE_GOPHER, [1])
634        ;;
635   *)   AC_MSG_RESULT(yes)
636        ;;
637   esac ],
638        AC_MSG_RESULT(yes)
639 )
640
641
642 dnl **********************************************************************
643 dnl Check for built-in manual
644 dnl **********************************************************************
645
646 AC_MSG_CHECKING([whether to provide built-in manual])
647 AC_ARG_ENABLE(manual,
648 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
649 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
650 [ case "$enableval" in
651   no)
652        AC_MSG_RESULT(no)
653        ;;
654   *)   AC_MSG_RESULT(yes)
655        USE_MANUAL="1"
656        ;;
657   esac ],
658        AC_MSG_RESULT(yes)
659        USE_MANUAL="1"
660 )
661 dnl The actual use of the USE_MANUAL variable is done much later in this
662 dnl script to allow other actions to disable it as well.
663
664 dnl ************************************************************
665 dnl disable C code generation support
666 dnl
667 AC_MSG_CHECKING([whether to enable generation of C code])
668 AC_ARG_ENABLE(libcurl_option,
669 AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
670 AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
671 [ case "$enableval" in
672   no)
673        AC_MSG_RESULT(no)
674        AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
675        curl_libcurl_msg="no"
676        ;;
677   *)   AC_MSG_RESULT(yes)
678        ;;
679   esac ],
680        AC_MSG_RESULT(yes)
681 )
682
683 dnl **********************************************************************
684 dnl Checks for libraries.
685 dnl **********************************************************************
686
687 AC_MSG_CHECKING([whether to use libgcc])
688 AC_ARG_ENABLE(libgcc,
689 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
690 [ case "$enableval" in
691   yes)
692        LIBS="-lgcc $LIBS"
693        AC_MSG_RESULT(yes)
694        ;;
695   *)   AC_MSG_RESULT(no)
696        ;;
697   esac ],
698        AC_MSG_RESULT(no)
699 )
700
701 CURL_CHECK_LIB_XNET
702
703 dnl gethostbyname without lib or in the nsl lib?
704 AC_CHECK_FUNC(gethostbyname,
705               [HAVE_GETHOSTBYNAME="1"
706               ],
707               [ AC_CHECK_LIB(nsl, gethostbyname,
708                              [HAVE_GETHOSTBYNAME="1"
709                              LIBS="-lnsl $LIBS"
710                              ])
711               ])
712
713 if test "$HAVE_GETHOSTBYNAME" != "1"
714 then
715   dnl gethostbyname in the socket lib?
716   AC_CHECK_LIB(socket, gethostbyname,
717                [HAVE_GETHOSTBYNAME="1"
718                LIBS="-lsocket $LIBS"
719                ])
720 fi
721
722 if test "$HAVE_GETHOSTBYNAME" != "1"
723 then
724   dnl gethostbyname in the watt lib?
725   AC_CHECK_LIB(watt, gethostbyname,
726                [HAVE_GETHOSTBYNAME="1"
727                CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
728                LDFLAGS="-L/dev/env/WATT_ROOT/lib"
729                LIBS="-lwatt $LIBS"
730                ])
731 fi
732
733 dnl At least one system has been identified to require BOTH nsl and socket
734 dnl libs at the same time to link properly.
735 if test "$HAVE_GETHOSTBYNAME" != "1"
736 then
737   AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
738   my_ac_save_LIBS=$LIBS
739   LIBS="-lnsl -lsocket $LIBS"
740   AC_LINK_IFELSE([
741     AC_LANG_PROGRAM([[
742     ]],[[
743       gethostbyname();
744     ]])
745   ],[
746     AC_MSG_RESULT([yes])
747     HAVE_GETHOSTBYNAME="1"
748   ],[
749     AC_MSG_RESULT([no])
750     LIBS=$my_ac_save_LIBS
751   ])
752 fi
753
754 if test "$HAVE_GETHOSTBYNAME" != "1"
755 then
756   dnl This is for winsock systems
757   if test "$curl_cv_header_windows_h" = "yes"; then
758     if test "$curl_cv_header_winsock_h" = "yes"; then
759       case $host in
760         *-*-mingw32ce*)
761           winsock_LIB="-lwinsock"
762           ;;
763         *)
764           winsock_LIB="-lwsock32"
765           ;;
766       esac
767     fi
768     if test "$curl_cv_header_winsock2_h" = "yes"; then
769       winsock_LIB="-lws2_32"
770     fi
771     if test ! -z "$winsock_LIB"; then
772       my_ac_save_LIBS=$LIBS
773       LIBS="$winsock_LIB $LIBS"
774       AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
775       AC_LINK_IFELSE([
776         AC_LANG_PROGRAM([[
777 #ifdef HAVE_WINDOWS_H
778 #ifndef WIN32_LEAN_AND_MEAN
779 #define WIN32_LEAN_AND_MEAN
780 #endif
781 #include <windows.h>
782 #ifdef HAVE_WINSOCK2_H
783 #include <winsock2.h>
784 #else
785 #ifdef HAVE_WINSOCK_H
786 #include <winsock.h>
787 #endif
788 #endif
789 #endif
790         ]],[[
791           gethostbyname("www.dummysite.com");
792         ]])
793       ],[
794         AC_MSG_RESULT([yes])
795         HAVE_GETHOSTBYNAME="1"
796       ],[
797         AC_MSG_RESULT([no])
798         winsock_LIB=""
799         LIBS=$my_ac_save_LIBS
800       ])
801     fi
802   fi
803 fi
804
805 if test "$HAVE_GETHOSTBYNAME" != "1"
806 then
807   dnl This is for Minix 3.1
808   AC_MSG_CHECKING([for gethostbyname for Minix 3])
809   AC_LINK_IFELSE([
810     AC_LANG_PROGRAM([[
811 /* Older Minix versions may need <net/gen/netdb.h> here instead */
812 #include <netdb.h>
813     ]],[[
814       gethostbyname("www.dummysite.com");
815     ]])
816   ],[
817     AC_MSG_RESULT([yes])
818     HAVE_GETHOSTBYNAME="1"
819   ],[
820     AC_MSG_RESULT([no])
821   ])
822 fi
823
824 if test "$HAVE_GETHOSTBYNAME" != "1"
825 then
826   dnl This is for eCos with a stubbed DNS implementation
827   AC_MSG_CHECKING([for gethostbyname for eCos])
828   AC_LINK_IFELSE([
829     AC_LANG_PROGRAM([[
830 #include <stdio.h>
831 #include <netdb.h>
832     ]],[[
833       gethostbyname("www.dummysite.com");
834     ]])
835   ],[
836     AC_MSG_RESULT([yes])
837     HAVE_GETHOSTBYNAME="1"
838   ],[
839     AC_MSG_RESULT([no])
840   ])
841 fi
842
843 if test "$HAVE_GETHOSTBYNAME" != "1"
844 then
845   dnl gethostbyname in the network lib - for Haiku OS
846   AC_CHECK_LIB(network, gethostbyname,
847                [HAVE_GETHOSTBYNAME="1"
848                LIBS="-lnetwork $LIBS"
849                ])
850 fi
851
852 if test "$HAVE_GETHOSTBYNAME" != "1"
853 then
854   dnl gethostbyname in the net lib - for BeOS
855   AC_CHECK_LIB(net, gethostbyname,
856                [HAVE_GETHOSTBYNAME="1"
857                LIBS="-lnet $LIBS"
858                ])
859 fi
860
861
862 if test "$HAVE_GETHOSTBYNAME" != "1"; then
863   AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
864 fi
865
866 CURL_CHECK_LIBS_CONNECT
867
868 CURL_NETWORK_LIBS=$LIBS
869
870 dnl **********************************************************************
871 dnl In case that function clock_gettime with monotonic timer is available,
872 dnl check for additional required libraries.
873 dnl **********************************************************************
874 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
875
876 dnl **********************************************************************
877 dnl The preceding library checks are all potentially useful for test
878 dnl servers and libtest cases which require networking and clock_gettime
879 dnl support.  Save the list of required libraries at this point for use
880 dnl while linking those test servers and programs.
881 dnl **********************************************************************
882 CURL_NETWORK_AND_TIME_LIBS=$LIBS
883
884 dnl **********************************************************************
885 dnl Check for the presence of ZLIB libraries and headers
886 dnl **********************************************************************
887
888 dnl Check for & handle argument to --with-zlib.
889
890 clean_CPPFLAGS=$CPPFLAGS
891 clean_LDFLAGS=$LDFLAGS
892 clean_LIBS=$LIBS
893 ZLIB_LIBS=""
894 AC_ARG_WITH(zlib,
895 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
896 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
897                [OPT_ZLIB="$withval"])
898
899 if test "$OPT_ZLIB" = "no" ; then
900     AC_MSG_WARN([zlib disabled])
901 else
902   if test "$OPT_ZLIB" = "yes" ; then
903     OPT_ZLIB=""
904   fi
905
906   if test -z "$OPT_ZLIB" ; then
907     CURL_CHECK_PKGCONFIG(zlib)
908
909     if test "$PKGCONFIG" != "no" ; then
910       LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
911       LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
912       CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
913       OPT_ZLIB=""
914       HAVE_LIBZ="1"
915     fi
916
917     if test -z "$HAVE_LIBZ"; then
918
919       dnl Check for the lib without setting any new path, since many
920       dnl people have it in the default path
921
922       AC_CHECK_LIB(z, inflateEnd,
923                    dnl libz found, set the variable
924                    [HAVE_LIBZ="1"
925                     LIBS="-lz $LIBS"],
926                    dnl if no lib found, try /usr/local
927                    [OPT_ZLIB="/usr/local"])
928     fi
929   fi
930
931   dnl Add a nonempty path to the compiler flags
932   if test -n "$OPT_ZLIB"; then
933      CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
934      LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
935   fi
936
937   AC_CHECK_HEADER(zlib.h,
938     [
939     dnl zlib.h was found
940     HAVE_ZLIB_H="1"
941     dnl if the lib wasn't found already, try again with the new paths
942     if test "$HAVE_LIBZ" != "1"; then
943       AC_CHECK_LIB(z, gzread,
944                    [
945                    dnl the lib was found!
946                    HAVE_LIBZ="1"
947                    LIBS="-lz $LIBS"
948                    ],
949                    [ CPPFLAGS=$clean_CPPFLAGS
950                    LDFLAGS=$clean_LDFLAGS])
951     fi
952     ],
953     [
954       dnl zlib.h was not found, restore the flags
955       CPPFLAGS=$clean_CPPFLAGS
956       LDFLAGS=$clean_LDFLAGS]
957     )
958
959   if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
960   then
961     AC_MSG_WARN([configure found only the libz lib, not the header file!])
962     HAVE_LIBZ=""
963     CPPFLAGS=$clean_CPPFLAGS
964     LDFLAGS=$clean_LDFLAGS
965     LIBS=$clean_LIBS
966   elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
967   then
968     AC_MSG_WARN([configure found only the libz header file, not the lib!])
969     CPPFLAGS=$clean_CPPFLAGS
970     LDFLAGS=$clean_LDFLAGS
971     LIBS=$clean_LIBS
972   elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
973   then
974     dnl both header and lib were found!
975     AC_SUBST(HAVE_LIBZ)
976     AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
977     AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
978
979     ZLIB_LIBS="-lz"
980     LIBS="-lz $clean_LIBS"
981
982     dnl replace 'HAVE_LIBZ' in the automake makefile.ams
983     AMFIXLIB="1"
984     AC_MSG_NOTICE([found both libz and libz.h header])
985     curl_zlib_msg="enabled"
986   fi
987 fi
988
989 dnl set variable for use in automakefile(s)
990 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
991 AC_SUBST(ZLIB_LIBS)
992
993 dnl **********************************************************************
994 dnl Check for the presence of BROTLI decoder libraries and headers
995 dnl **********************************************************************
996
997 dnl Brotli project home page: https://github.com/google/brotli
998
999 dnl Default to compiler & linker defaults for BROTLI files & libraries.
1000 OPT_BROTLI=off
1001 AC_ARG_WITH(brotli,dnl
1002 AC_HELP_STRING([--with-brotli=PATH],[Where to look for brotli, PATH points to the BROTLI installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1003 AC_HELP_STRING([--without-brotli], [disable BROTLI]),
1004   OPT_BROTLI=$withval)
1005
1006 if test X"$OPT_BROTLI" != Xno; then
1007   dnl backup the pre-brotli variables
1008   CLEANLDFLAGS="$LDFLAGS"
1009   CLEANCPPFLAGS="$CPPFLAGS"
1010   CLEANLIBS="$LIBS"
1011
1012   case "$OPT_BROTLI" in
1013   yes)
1014     dnl --with-brotli (without path) used
1015     CURL_CHECK_PKGCONFIG(libbrotlidec)
1016
1017     if test "$PKGCONFIG" != "no" ; then
1018       LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1019       LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1020       CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1021       version=`$PKGCONFIG --modversion libbrotlidec`
1022       DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/-L//'`
1023     fi
1024
1025     ;;
1026   off)
1027     dnl no --with-brotli option given, just check default places
1028     ;;
1029   *)
1030     dnl use the given --with-brotli spot
1031     PREFIX_BROTLI=$OPT_BROTLI
1032     ;;
1033   esac
1034
1035   dnl if given with a prefix, we set -L and -I based on that
1036   if test -n "$PREFIX_BROTLI"; then
1037     LIB_BROTLI="-lbrotlidec"
1038     LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1039     CPP_BROTLI=-I${PREFIX_BROTLI}/include
1040     DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1041   fi
1042
1043   LDFLAGS="$LDFLAGS $LD_BROTLI"
1044   CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1045   LIBS="$LIB_BROTLI $LIBS"
1046
1047   AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1048
1049   AC_CHECK_HEADERS(brotli/decode.h,
1050     curl_brotli_msg="enabled (libbrotlidec)"
1051     HAVE_BROTLI=1
1052     AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1053     AC_SUBST(HAVE_BROTLI, [1])
1054   )
1055
1056   if test X"$OPT_BROTLI" != Xoff &&
1057      test "$HAVE_BROTLI" != "1"; then
1058     AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1059   fi
1060
1061   if test "$HAVE_BROTLI" = "1"; then
1062     if test -n "$DIR_BROTLI"; then
1063        dnl when the brotli shared libs were found in a path that the run-time
1064        dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
1065        dnl to prevent further configure tests to fail due to this
1066
1067        if test "x$cross_compiling" != "xyes"; then
1068          CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI"
1069          export CURL_LIBRARY_PATH
1070          AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH])
1071        fi
1072     fi
1073   else
1074     dnl no brotli, revert back to clean variables
1075     LDFLAGS=$CLEANLDFLAGS
1076     CPPFLAGS=$CLEANCPPFLAGS
1077     LIBS=$CLEANLIBS
1078   fi
1079 fi
1080
1081 dnl **********************************************************************
1082 dnl Check for LDAP
1083 dnl **********************************************************************
1084
1085 LDAPLIBNAME=""
1086 AC_ARG_WITH(ldap-lib,
1087 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
1088  [LDAPLIBNAME="$withval"])
1089
1090 LBERLIBNAME=""
1091 AC_ARG_WITH(lber-lib,
1092 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
1093  [LBERLIBNAME="$withval"])
1094
1095 if test x$CURL_DISABLE_LDAP != x1 ; then
1096
1097   CURL_CHECK_HEADER_LBER
1098   CURL_CHECK_HEADER_LDAP
1099   CURL_CHECK_HEADER_LDAPSSL
1100   CURL_CHECK_HEADER_LDAP_SSL
1101
1102   if test -z "$LDAPLIBNAME" ; then
1103     if test "$curl_cv_native_windows" = "yes"; then
1104       dnl Windows uses a single and unique LDAP library name
1105       LDAPLIBNAME="wldap32"
1106       LBERLIBNAME="no"
1107     fi
1108   fi
1109
1110   if test "$LDAPLIBNAME" ; then
1111     AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1112       AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1113       AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1114       AC_SUBST(CURL_DISABLE_LDAP, [1])
1115       AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1116       AC_SUBST(CURL_DISABLE_LDAPS, [1])])
1117   else
1118     dnl Try to find the right ldap libraries for this system
1119     CURL_CHECK_LIBS_LDAP
1120     case X-"$curl_cv_ldap_LIBS" in
1121       X-unknown)
1122         AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1123         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1124         AC_SUBST(CURL_DISABLE_LDAP, [1])
1125         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1126         AC_SUBST(CURL_DISABLE_LDAPS, [1])
1127         ;;
1128     esac
1129   fi
1130 fi
1131
1132 if test x$CURL_DISABLE_LDAP != x1 ; then
1133
1134   if test "$LBERLIBNAME" ; then
1135     dnl If name is "no" then don't define this library at all
1136     dnl (it's only needed if libldap.so's dependencies are broken).
1137     if test "$LBERLIBNAME" != "no" ; then
1138       AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1139         AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1140         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1141         AC_SUBST(CURL_DISABLE_LDAP, [1])
1142         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1143         AC_SUBST(CURL_DISABLE_LDAPS, [1])])
1144     fi
1145   fi
1146 fi
1147
1148 if test x$CURL_DISABLE_LDAP != x1 ; then
1149   AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1150
1151   if test "$LDAPLIBNAME" = "wldap32"; then
1152     curl_ldap_msg="enabled (winldap)"
1153     AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
1154   else
1155     curl_ldap_msg="enabled (OpenLDAP)"
1156     if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1157       AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1158       AC_SUBST(USE_OPENLDAP, [1])
1159     fi
1160   fi
1161 fi
1162
1163 if test x$CURL_DISABLE_LDAPS != x1 ; then
1164     curl_ldaps_msg="enabled"
1165 fi
1166
1167 dnl **********************************************************************
1168 dnl Checks for IPv6
1169 dnl **********************************************************************
1170
1171 AC_MSG_CHECKING([whether to enable IPv6])
1172 AC_ARG_ENABLE(ipv6,
1173 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1174 AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
1175 [ case "$enableval" in
1176   no)
1177        AC_MSG_RESULT(no)
1178        ipv6=no
1179        ;;
1180   *)   AC_MSG_RESULT(yes)
1181        ipv6=yes
1182        ;;
1183   esac ],
1184
1185   AC_TRY_RUN([ /* is AF_INET6 available? */
1186 #include <sys/types.h>
1187 #ifdef HAVE_WINSOCK2_H
1188 #include <winsock2.h>
1189 #else
1190 #include <sys/socket.h>
1191 #endif
1192 #include <stdlib.h> /* for exit() */
1193 main()
1194 {
1195  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1196    exit(1);
1197  else
1198    exit(0);
1199 }
1200 ],
1201   AC_MSG_RESULT(yes)
1202   ipv6=yes,
1203   AC_MSG_RESULT(no)
1204   ipv6=no,
1205   AC_MSG_RESULT(yes)
1206   ipv6=yes
1207 ))
1208
1209 if test "$ipv6" = "yes"; then
1210   curl_ipv6_msg="enabled"
1211 fi
1212
1213 # Check if struct sockaddr_in6 have sin6_scope_id member
1214 if test "$ipv6" = yes; then
1215   AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1216   AC_TRY_COMPILE([
1217 #include <sys/types.h>
1218 #ifdef HAVE_WINSOCK2_H
1219 #include <winsock2.h>
1220 #include <ws2tcpip.h>
1221 #else
1222 #include <netinet/in.h>
1223 #if defined (__TANDEM)
1224 # include <netinet/in6.h>
1225 #endif
1226 #endif] ,
1227   struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1228   if test "$have_sin6_scope_id" = yes; then
1229     AC_MSG_RESULT([yes])
1230     AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1231   else
1232     AC_MSG_RESULT([no])
1233   fi
1234 fi
1235
1236 dnl **********************************************************************
1237 dnl Check if the operating system allows programs to write to their own argv[]
1238 dnl **********************************************************************
1239
1240 AC_MSG_CHECKING([if argv can be written to])
1241 CURL_RUN_IFELSE([
1242 int main(int argc, char ** argv) {
1243     argv[0][0] = ' ';
1244     return (argv[0][0] == ' ')?0:1;
1245 }
1246 ],[
1247   curl_cv_writable_argv=yes
1248 ],[
1249   curl_cv_writable_argv=no
1250 ],[
1251   curl_cv_writable_argv=cross
1252 ])
1253 case $curl_cv_writable_argv in
1254 yes)
1255         AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1256         AC_MSG_RESULT(yes)
1257         ;;
1258 no)
1259         AC_MSG_RESULT(no)
1260         ;;
1261 *)
1262         AC_MSG_RESULT(no)
1263         AC_MSG_WARN([the previous check could not be made default was used])
1264         ;;
1265 esac
1266
1267 dnl **********************************************************************
1268 dnl Check for GSS-API libraries
1269 dnl **********************************************************************
1270
1271 dnl check for GSS-API stuff in the /usr as default
1272
1273 GSSAPI_ROOT="/usr"
1274 AC_ARG_WITH(gssapi-includes,
1275   AC_HELP_STRING([--with-gssapi-includes=DIR],
1276                  [Specify location of GSS-API headers]),
1277   [ GSSAPI_INCS="-I$withval"
1278     want_gss="yes" ]
1279 )
1280
1281 AC_ARG_WITH(gssapi-libs,
1282   AC_HELP_STRING([--with-gssapi-libs=DIR],
1283                  [Specify location of GSS-API libs]),
1284   [ GSSAPI_LIB_DIR="-L$withval"
1285     want_gss="yes" ]
1286 )
1287
1288 AC_ARG_WITH(gssapi,
1289   AC_HELP_STRING([--with-gssapi=DIR],
1290                  [Where to look for GSS-API]), [
1291   GSSAPI_ROOT="$withval"
1292   if test x"$GSSAPI_ROOT" != xno; then
1293     want_gss="yes"
1294     if test x"$GSSAPI_ROOT" = xyes; then
1295       dnl if yes, then use default root
1296       GSSAPI_ROOT="/usr"
1297     fi
1298   fi
1299 ])
1300
1301 : ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1302
1303 save_CPPFLAGS="$CPPFLAGS"
1304 AC_MSG_CHECKING([if GSS-API support is requested])
1305 if test x"$want_gss" = xyes; then
1306   AC_MSG_RESULT(yes)
1307
1308   if test -z "$GSSAPI_INCS"; then
1309      if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1310         GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1311      elif test -f "$KRB5CONFIG"; then
1312         GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
1313      elif test "$GSSAPI_ROOT" != "yes"; then
1314         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1315      fi
1316   fi
1317
1318   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1319
1320   AC_CHECK_HEADER(gss.h,
1321     [
1322       dnl found in the given dirs
1323       AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
1324       gnu_gss=yes
1325     ],
1326     [
1327       dnl not found, check Heimdal or MIT
1328       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1329       AC_CHECK_HEADERS(
1330         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1331         [],
1332         [not_mit=1],
1333         [
1334 AC_INCLUDES_DEFAULT
1335 #ifdef HAVE_GSSAPI_GSSAPI_H
1336 #include <gssapi/gssapi.h>
1337 #endif
1338         ])
1339       if test "x$not_mit" = "x1"; then
1340         dnl MIT not found, check for Heimdal
1341         AC_CHECK_HEADER(gssapi.h,
1342             [
1343               dnl found
1344               AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
1345             ],
1346             [
1347               dnl no header found, disabling GSS
1348               want_gss=no
1349               AC_MSG_WARN(disabling GSS-API support since no header files were found)
1350             ]
1351           )
1352       else
1353         dnl MIT found
1354         AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1355         dnl check if we have a really old MIT Kerberos version (<= 1.2)
1356         AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
1357         AC_COMPILE_IFELSE([
1358           AC_LANG_PROGRAM([[
1359 #include <gssapi/gssapi.h>
1360 #include <gssapi/gssapi_generic.h>
1361 #include <gssapi/gssapi_krb5.h>
1362           ]],[[
1363             gss_import_name(
1364                             (OM_uint32 *)0,
1365                             (gss_buffer_t)0,
1366                             GSS_C_NT_HOSTBASED_SERVICE,
1367                             (gss_name_t *)0);
1368           ]])
1369         ],[
1370           AC_MSG_RESULT([yes])
1371         ],[
1372           AC_MSG_RESULT([no])
1373           AC_DEFINE(HAVE_OLD_GSSMIT, 1,
1374             [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
1375         ])
1376       fi
1377     ]
1378   )
1379 else
1380   AC_MSG_RESULT(no)
1381 fi
1382 if test x"$want_gss" = xyes; then
1383   AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1384   HAVE_GSSAPI=1
1385   curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
1386
1387   if test -n "$gnu_gss"; then
1388     curl_gss_msg="enabled (GNU GSS)"
1389     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1390     LIBS="-lgss $LIBS"
1391   elif test -z "$GSSAPI_LIB_DIR"; then
1392      case $host in
1393      *-*-darwin*)
1394         LIBS="-lgssapi_krb5 -lresolv $LIBS"
1395         ;;
1396      *)
1397         if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1398            dnl krb5-config doesn't have --libs-only-L or similar, put everything
1399            dnl into LIBS
1400            gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1401            LIBS="$gss_libs $LIBS"
1402         elif test -f "$KRB5CONFIG"; then
1403            dnl krb5-config doesn't have --libs-only-L or similar, put everything
1404            dnl into LIBS
1405            gss_libs=`$KRB5CONFIG --libs gssapi`
1406            LIBS="$gss_libs $LIBS"
1407         else
1408            case $host in
1409            *-hp-hpux*)
1410               gss_libname="gss"
1411               ;;
1412            *)
1413               gss_libname="gssapi"
1414               ;;
1415            esac
1416
1417            if test "$GSSAPI_ROOT" != "yes"; then
1418               LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1419               LIBS="-l$gss_libname $LIBS"
1420            else
1421               LIBS="-l$gss_libname $LIBS"
1422            fi
1423         fi
1424         ;;
1425      esac
1426   else
1427      LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1428      case $host in
1429      *-hp-hpux*)
1430         LIBS="-lgss $LIBS"
1431         ;;
1432      *)
1433         LIBS="-lgssapi $LIBS"
1434         ;;
1435      esac
1436   fi
1437 else
1438   CPPFLAGS="$save_CPPFLAGS"
1439 fi
1440
1441 build_libstubgss=no
1442 if test x"$want_gss" = "xyes"; then
1443   build_libstubgss=yes
1444 fi
1445
1446 AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1447
1448 dnl -------------------------------------------------------------
1449 dnl parse --with-default-ssl-backend so it can be validated below
1450 dnl -------------------------------------------------------------
1451
1452 DEFAULT_SSL_BACKEND=no
1453 VALID_DEFAULT_SSL_BACKEND=
1454 AC_ARG_WITH(default-ssl-backend,
1455 AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1456 AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1457   [DEFAULT_SSL_BACKEND=$withval])
1458 case "$DEFAULT_SSL_BACKEND" in
1459   no)
1460     dnl --without-default-ssl-backend option used
1461     ;;
1462   default|yes)
1463     dnl --with-default-ssl-backend option used without name
1464     AC_MSG_ERROR([The name of the default SSL backend is required.])
1465     ;;
1466   *)
1467     dnl --with-default-ssl-backend option used with name
1468     AC_SUBST(DEFAULT_SSL_BACKEND)
1469     dnl needs to be validated below
1470     VALID_DEFAULT_SSL_BACKEND=no
1471     ;;
1472 esac
1473
1474 dnl **********************************************************************
1475
1476 dnl -------------------------------------------------
1477 dnl check winssl option before other SSL libraries
1478 dnl -------------------------------------------------
1479
1480 OPT_WINSSL=no
1481 AC_ARG_WITH(winssl,dnl
1482 AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1483 AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1484   OPT_WINSSL=$withval)
1485
1486 AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
1487 if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1488   ssl_msg=
1489   if test "x$OPT_WINSSL" != "xno"  &&
1490      test "x$curl_cv_native_windows" = "xyes"; then
1491     AC_MSG_RESULT(yes)
1492     AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1493     AC_SUBST(USE_SCHANNEL, [1])
1494     ssl_msg="Windows-native"
1495     test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1496     WINSSL_ENABLED=1
1497     # --with-winssl implies --enable-sspi
1498     AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1499     AC_SUBST(USE_WINDOWS_SSPI, [1])
1500     curl_sspi_msg="enabled"
1501     LIBS="-lcrypt32 $LIBS"
1502   else
1503     AC_MSG_RESULT(no)
1504   fi
1505   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1506 else
1507   AC_MSG_RESULT(no)
1508 fi
1509
1510 OPT_DARWINSSL=no
1511 AC_ARG_WITH(darwinssl,dnl
1512 AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1513 AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
1514   OPT_DARWINSSL=$withval)
1515
1516 AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS])
1517 if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then
1518   if test "x$OPT_DARWINSSL" != "xno" &&
1519      test -d "/System/Library/Frameworks/Security.framework"; then
1520     AC_MSG_RESULT(yes)
1521     AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support])
1522     AC_SUBST(USE_DARWINSSL, [1])
1523     ssl_msg="Apple OS-native"
1524     test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1525     DARWINSSL_ENABLED=1
1526     LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1527   else
1528     AC_MSG_RESULT(no)
1529   fi
1530   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1531 else
1532   AC_MSG_RESULT(no)
1533 fi
1534
1535 dnl **********************************************************************
1536 dnl Check for the presence of SSL libraries and headers
1537 dnl **********************************************************************
1538
1539 dnl Default to compiler & linker defaults for SSL files & libraries.
1540 OPT_SSL=off
1541 dnl Default to no CA bundle
1542 ca="no"
1543 AC_ARG_WITH(ssl,dnl
1544 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])
1545 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1546   OPT_SSL=$withval)
1547
1548 if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1549    test X"$OPT_SSL" != Xno; then
1550   ssl_msg=
1551
1552   dnl backup the pre-ssl variables
1553   CLEANLDFLAGS="$LDFLAGS"
1554   CLEANCPPFLAGS="$CPPFLAGS"
1555   CLEANLIBS="$LIBS"
1556
1557   dnl This is for Msys/Mingw
1558   case $host in
1559     *-*-msys* | *-*-mingw*)
1560       AC_MSG_CHECKING([for gdi32])
1561       my_ac_save_LIBS=$LIBS
1562       LIBS="-lgdi32 $LIBS"
1563       AC_TRY_LINK([#include <windef.h>
1564                    #include <wingdi.h>],
1565                    [GdiFlush();],
1566                    [ dnl worked!
1567                    AC_MSG_RESULT([yes])],
1568                    [ dnl failed, restore LIBS
1569                    LIBS=$my_ac_save_LIBS
1570                    AC_MSG_RESULT(no)]
1571                   )
1572       ;;
1573   esac
1574
1575   case "$OPT_SSL" in
1576   yes)
1577     dnl --with-ssl (without path) used
1578     if test x$cross_compiling != xyes; then
1579       dnl only do pkg-config magic when not cross-compiling
1580       PKGTEST="yes"
1581     fi
1582     PREFIX_OPENSSL=/usr/local/ssl
1583     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1584     ;;
1585   off)
1586     dnl no --with-ssl option given, just check default places
1587     if test x$cross_compiling != xyes; then
1588       dnl only do pkg-config magic when not cross-compiling
1589       PKGTEST="yes"
1590     fi
1591     PREFIX_OPENSSL=
1592     ;;
1593   *)
1594     dnl check the given --with-ssl spot
1595     PKGTEST="no"
1596     PREFIX_OPENSSL=$OPT_SSL
1597
1598     dnl Try pkg-config even when cross-compiling.  Since we
1599     dnl specify PKG_CONFIG_LIBDIR we're only looking where
1600     dnl the user told us to look
1601     OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1602     if test -f "$OPENSSL_PCDIR/openssl.pc"; then
1603       AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
1604       PKGTEST="yes"
1605     elif test ! -f "$PREFIX_OPENSSL/include/openssl/ssl.h"; then
1606       AC_MSG_ERROR([$PREFIX_OPENSSL is a bad --with-ssl prefix!])
1607     fi
1608
1609     dnl in case pkg-config comes up empty, use what we got
1610     dnl via --with-ssl
1611     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1612     if test "$PREFIX_OPENSSL" != "/usr" ; then
1613       SSL_LDFLAGS="-L$LIB_OPENSSL"
1614       SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1615     fi
1616     SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1617     ;;
1618   esac
1619
1620   if test "$PKGTEST" = "yes"; then
1621
1622     CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1623
1624     if test "$PKGCONFIG" != "no" ; then
1625       SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1626         $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1627
1628       SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1629         $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1630
1631       SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1632         $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1633
1634       AC_SUBST(SSL_LIBS)
1635       AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1636       AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1637       AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1638
1639       LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1640
1641       dnl use the values pkg-config reported.  This is here
1642       dnl instead of below with CPPFLAGS and LDFLAGS because we only
1643       dnl learn about this via pkg-config.  If we only have
1644       dnl the argument to --with-ssl we don't know what
1645       dnl additional libs may be necessary.  Hope that we
1646       dnl don't need any.
1647       LIBS="$SSL_LIBS $LIBS"
1648     fi
1649   fi
1650
1651   dnl finally, set flags to use SSL
1652   CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1653   LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1654
1655   AC_CHECK_LIB(crypto, HMAC_Update,[
1656      HAVECRYPTO="yes"
1657      LIBS="-lcrypto $LIBS"
1658      ],[
1659      LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1660      if test "$PKGCONFIG" = "no" ; then
1661        # only set this if pkg-config wasn't used
1662        CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1663      fi
1664      AC_CHECK_LIB(crypto, HMAC_Init_ex,[
1665        HAVECRYPTO="yes"
1666        LIBS="-lcrypto $LIBS"], [
1667
1668        dnl still no, but what about with -ldl?
1669        AC_MSG_CHECKING([OpenSSL linking with -ldl])
1670        LIBS="$CLEANLIBS -lcrypto -ldl"
1671        AC_TRY_LINK(
1672        [
1673          #include <openssl/err.h>
1674        ],
1675        [
1676          ERR_clear_error();
1677        ],
1678        [
1679          AC_MSG_RESULT(yes)
1680          HAVECRYPTO="yes"
1681        ],
1682        [
1683          AC_MSG_RESULT(no)
1684          dnl ok, so what about both -ldl and -lpthread?
1685
1686          AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
1687          LIBS="$CLEANLIBS -lcrypto -ldl -lpthread"
1688          AC_TRY_LINK(
1689          [
1690            #include <openssl/err.h>
1691          ],
1692          [
1693            ERR_clear_error();
1694          ],
1695          [
1696            AC_MSG_RESULT(yes)
1697            HAVECRYPTO="yes"
1698          ],
1699          [
1700            AC_MSG_RESULT(no)
1701            LDFLAGS="$CLEANLDFLAGS"
1702            CPPFLAGS="$CLEANCPPFLAGS"
1703            LIBS="$CLEANLIBS"
1704
1705          ])
1706
1707        ])
1708
1709      ])
1710   ])
1711
1712   if test X"$HAVECRYPTO" = X"yes"; then
1713     dnl This is only reasonable to do if crypto actually is there: check for
1714     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1715
1716     AC_CHECK_LIB(ssl, SSL_connect)
1717
1718     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1719         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1720         AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1721         OLIBS=$LIBS
1722         LIBS="-lRSAglue -lrsaref $LIBS"
1723         AC_CHECK_LIB(ssl, SSL_connect)
1724         if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1725             dnl still no SSL_connect
1726             AC_MSG_RESULT(no)
1727             LIBS=$OLIBS
1728         else
1729             AC_MSG_RESULT(yes)
1730         fi
1731
1732     else
1733
1734       dnl Have the libraries--check for OpenSSL headers
1735       AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1736                        openssl/pem.h openssl/ssl.h openssl/err.h,
1737         ssl_msg="OpenSSL"
1738         test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1739         OPENSSL_ENABLED=1
1740         AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1741
1742       if test $ac_cv_header_openssl_x509_h = no; then
1743         dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1744         dnl since 'err.h' might in fact find a krb4 header with the same
1745         dnl name
1746         AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1747
1748         if test $ac_cv_header_x509_h = yes &&
1749            test $ac_cv_header_crypto_h = yes &&
1750            test $ac_cv_header_ssl_h = yes; then
1751           dnl three matches
1752           ssl_msg="OpenSSL"
1753           OPENSSL_ENABLED=1
1754         fi
1755       fi
1756     fi
1757
1758     if test X"$OPENSSL_ENABLED" != X"1"; then
1759        LIBS="$CLEANLIBS"
1760     fi
1761
1762     if test X"$OPT_SSL" != Xoff &&
1763        test "$OPENSSL_ENABLED" != "1"; then
1764       AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1765     fi
1766   fi
1767
1768   if test X"$OPENSSL_ENABLED" = X"1"; then
1769     dnl These can only exist if OpenSSL exists
1770     dnl Older versions of Cyassl (some time before 2.9.4) don't have
1771     dnl SSL_get_shutdown (but this check won't actually detect it there
1772     dnl as it's a macro that needs the header files be included)
1773
1774     AC_CHECK_FUNCS( RAND_egd \
1775                     ENGINE_cleanup \
1776                     SSL_get_shutdown \
1777                     SSLv2_client_method )
1778
1779     AC_MSG_CHECKING([for BoringSSL])
1780     AC_COMPILE_IFELSE([
1781         AC_LANG_PROGRAM([[
1782                 #include <openssl/base.h>
1783                 ]],[[
1784                 #ifndef OPENSSL_IS_BORINGSSL
1785                 #error not boringssl
1786                 #endif
1787        ]])
1788     ],[
1789         AC_MSG_RESULT([yes])
1790         AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1791                            [Define to 1 if using BoringSSL.])
1792         ssl_msg="BoringSSL"
1793     ],[
1794         AC_MSG_RESULT([no])
1795     ])
1796
1797     AC_MSG_CHECKING([for libressl])
1798     AC_COMPILE_IFELSE([
1799       AC_LANG_PROGRAM([[
1800 #include <openssl/opensslv.h>
1801       ]],[[
1802         int dummy = LIBRESSL_VERSION_NUMBER;
1803       ]])
1804     ],[
1805       AC_MSG_RESULT([yes])
1806       AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1807         [Define to 1 if using libressl.])
1808       ssl_msg="libressl"
1809     ],[
1810       AC_MSG_RESULT([no])
1811     ])
1812   fi
1813
1814   if test "$OPENSSL_ENABLED" = "1"; then
1815     if test -n "$LIB_OPENSSL"; then
1816        dnl when the ssl shared libs were found in a path that the run-time
1817        dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
1818        dnl to prevent further configure tests to fail due to this
1819        if test "x$cross_compiling" != "xyes"; then
1820          CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_OPENSSL"
1821          export CURL_LIBRARY_PATH
1822          AC_MSG_NOTICE([Added $LIB_OPENSSL to CURL_LIBRARY_PATH])
1823        fi
1824     fi
1825     CURL_CHECK_OPENSSL_API
1826     check_for_ca_bundle=1
1827   fi
1828
1829   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1830 fi
1831
1832 dnl **********************************************************************
1833 dnl Check for the random seed preferences
1834 dnl **********************************************************************
1835
1836 if test X"$OPENSSL_ENABLED" = X"1"; then
1837   AC_ARG_WITH(egd-socket,
1838   AC_HELP_STRING([--with-egd-socket=FILE],
1839                  [Entropy Gathering Daemon socket pathname]),
1840       [ EGD_SOCKET="$withval" ]
1841   )
1842   if test -n "$EGD_SOCKET" ; then
1843           AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1844           [your Entropy Gathering Daemon socket pathname] )
1845   fi
1846
1847   dnl Check for user-specified random device
1848   AC_ARG_WITH(random,
1849   AC_HELP_STRING([--with-random=FILE],
1850                  [read randomness from FILE (default=/dev/urandom)]),
1851       [ RANDOM_FILE="$withval" ],
1852       [
1853           if test x$cross_compiling != xyes; then
1854             dnl Check for random device
1855             AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1856           else
1857             AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1858           fi
1859       ]
1860   )
1861   if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1862           AC_SUBST(RANDOM_FILE)
1863           AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1864           [a suitable file to read random data from])
1865   fi
1866 fi
1867
1868 dnl ---
1869 dnl We require OpenSSL with SRP support.
1870 dnl ---
1871 if test "$OPENSSL_ENABLED" = "1"; then
1872   AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1873    [
1874      AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1875      AC_SUBST(HAVE_OPENSSL_SRP, [1])
1876    ])
1877 fi
1878
1879 dnl ---
1880 dnl Whether the OpenSSL configuration will be loaded automatically
1881 dnl ---
1882 if test X"$OPENSSL_ENABLED" = X"1"; then
1883 AC_ARG_ENABLE(openssl-auto-load-config,
1884 AC_HELP_STRING([--enable-openssl-auto-load-config],[Enable automatic loading of OpenSSL configuration])
1885 AC_HELP_STRING([--disable-openssl-auto-load-config],[Disable automatic loading of OpenSSL configuration]),
1886 [ if test X"$enableval" = X"no"; then
1887     AC_MSG_NOTICE([automatic loading of OpenSSL configuration disabled])
1888     AC_DEFINE(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG, 1, [if the OpenSSL configuration won't be loaded automatically])
1889   fi
1890 ])
1891 fi
1892
1893 dnl ----------------------------------------------------
1894 dnl check for GnuTLS
1895 dnl ----------------------------------------------------
1896
1897 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1898 OPT_GNUTLS=no
1899
1900 AC_ARG_WITH(gnutls,dnl
1901 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
1902 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1903   OPT_GNUTLS=$withval)
1904
1905 if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1906   ssl_msg=
1907
1908   if test X"$OPT_GNUTLS" != Xno; then
1909
1910     addld=""
1911     addlib=""
1912     gtlslib=""
1913     version=""
1914     addcflags=""
1915
1916     if test "x$OPT_GNUTLS" = "xyes"; then
1917       dnl this is with no partiular path given
1918       CURL_CHECK_PKGCONFIG(gnutls)
1919
1920       if test "$PKGCONFIG" != "no" ; then
1921         addlib=`$PKGCONFIG --libs-only-l gnutls`
1922         addld=`$PKGCONFIG --libs-only-L gnutls`
1923         addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1924         version=`$PKGCONFIG --modversion gnutls`
1925         gtlslib=`echo $addld | $SED -e 's/-L//'`
1926       else
1927         dnl without pkg-config, we try libgnutls-config as that was how it
1928         dnl used to be done
1929         check=`libgnutls-config --version 2>/dev/null`
1930         if test -n "$check"; then
1931           addlib=`libgnutls-config --libs`
1932           addcflags=`libgnutls-config --cflags`
1933           version=`libgnutls-config --version`
1934           gtlslib=`libgnutls-config --prefix`/lib$libsuff
1935         fi
1936       fi
1937     else
1938       dnl this is with a given path, first check if there's a libgnutls-config
1939       dnl there and if not, make an educated guess
1940       cfg=$OPT_GNUTLS/bin/libgnutls-config
1941       check=`$cfg --version 2>/dev/null`
1942       if test -n "$check"; then
1943         addlib=`$cfg --libs`
1944         addcflags=`$cfg --cflags`
1945         version=`$cfg --version`
1946         gtlslib=`$cfg --prefix`/lib$libsuff
1947       else
1948         dnl without pkg-config and libgnutls-config, we guess a lot!
1949         addlib=-lgnutls
1950         addld=-L$OPT_GNUTLS/lib$libsuff
1951         addcflags=-I$OPT_GNUTLS/include
1952         version="" # we just don't know
1953         gtlslib=$OPT_GNUTLS/lib$libsuff
1954       fi
1955     fi
1956
1957     if test -z "$version"; then
1958       dnl lots of efforts, still no go
1959       version="unknown"
1960     fi
1961
1962     if test -n "$addlib"; then
1963
1964       CLEANLIBS="$LIBS"
1965       CLEANCPPFLAGS="$CPPFLAGS"
1966       CLEANLDFLAGS="$LDFLAGS"
1967
1968       LIBS="$addlib $LIBS"
1969       LDFLAGS="$LDFLAGS $addld"
1970       if test "$addcflags" != "-I/usr/include"; then
1971          CPPFLAGS="$CPPFLAGS $addcflags"
1972       fi
1973
1974       AC_CHECK_LIB(gnutls, gnutls_check_version,
1975        [
1976        AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1977        AC_SUBST(USE_GNUTLS, [1])
1978        GNUTLS_ENABLED=1
1979        USE_GNUTLS="yes"
1980        ssl_msg="GnuTLS"
1981        test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1982        ],
1983        [
1984          LIBS="$CLEANLIBS"
1985          CPPFLAGS="$CLEANCPPFLAGS"
1986        ])
1987
1988       if test "x$USE_GNUTLS" = "xyes"; then
1989         AC_MSG_NOTICE([detected GnuTLS version $version])
1990         check_for_ca_bundle=1
1991         if test -n "$gtlslib"; then
1992           dnl when shared libs were found in a path that the run-time
1993           dnl linker doesn't search through, we need to add it to
1994           dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
1995           dnl due to this
1996           if test "x$cross_compiling" != "xyes"; then
1997             CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$gtlslib"
1998             export CURL_LIBRARY_PATH
1999             AC_MSG_NOTICE([Added $gtlslib to CURL_LIBRARY_PATH])
2000           fi
2001         fi
2002         AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
2003       fi
2004
2005     fi
2006
2007   fi dnl GNUTLS not disabled
2008
2009   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2010 fi
2011
2012 dnl ---
2013 dnl Check which crypto backend GnuTLS uses
2014 dnl ---
2015
2016 if test "$GNUTLS_ENABLED" = "1"; then
2017   USE_GNUTLS_NETTLE=
2018   # First check if we can detect either crypto library via transitive linking
2019   AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2020   if test "$USE_GNUTLS_NETTLE" = ""; then
2021     AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2022   fi
2023   # If not, try linking directly to both of them to see if they are available
2024   if test "$USE_GNUTLS_NETTLE" = ""; then
2025     AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2026   fi
2027   if test "$USE_GNUTLS_NETTLE" = ""; then
2028     AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2029   fi
2030   if test "$USE_GNUTLS_NETTLE" = ""; then
2031     AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
2032   fi
2033   if test "$USE_GNUTLS_NETTLE" = "1"; then
2034     AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
2035     AC_SUBST(USE_GNUTLS_NETTLE, [1])
2036     LIBS="-lnettle $LIBS"
2037   else
2038     LIBS="-lgcrypt $LIBS"
2039   fi
2040 fi
2041
2042 dnl ---
2043 dnl We require GnuTLS with SRP support.
2044 dnl ---
2045 if test "$GNUTLS_ENABLED" = "1"; then
2046   AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
2047    [
2048      AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
2049      AC_SUBST(HAVE_GNUTLS_SRP, [1])
2050    ])
2051 fi
2052
2053 dnl ----------------------------------------------------
2054 dnl check for PolarSSL
2055 dnl ----------------------------------------------------
2056
2057 dnl Default to compiler & linker defaults for PolarSSL files & libraries.
2058 OPT_POLARSSL=no
2059
2060 _cppflags=$CPPFLAGS
2061 _ldflags=$LDFLAGS
2062 AC_ARG_WITH(polarssl,dnl
2063 AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
2064 AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
2065   OPT_POLARSSL=$withval)
2066
2067 if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then
2068   ssl_msg=
2069
2070   if test X"$OPT_POLARSSL" != Xno; then
2071
2072     if test "$OPT_POLARSSL" = "yes"; then
2073       OPT_POLARSSL=""
2074     fi
2075
2076     if test -z "$OPT_POLARSSL" ; then
2077       dnl check for lib first without setting any new path
2078
2079       AC_CHECK_LIB(polarssl, havege_init,
2080       dnl libpolarssl found, set the variable
2081        [
2082          AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2083          AC_SUBST(USE_POLARSSL, [1])
2084          POLARSSL_ENABLED=1
2085          USE_POLARSSL="yes"
2086          ssl_msg="PolarSSL"
2087          test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2088         ])
2089     fi
2090
2091     addld=""
2092     addlib=""
2093     addcflags=""
2094     polarssllib=""
2095
2096     if test "x$USE_POLARSSL" != "xyes"; then
2097       dnl add the path and test again
2098       addld=-L$OPT_POLARSSL/lib$libsuff
2099       addcflags=-I$OPT_POLARSSL/include
2100       polarssllib=$OPT_POLARSSL/lib$libsuff
2101
2102       LDFLAGS="$LDFLAGS $addld"
2103       if test "$addcflags" != "-I/usr/include"; then
2104          CPPFLAGS="$CPPFLAGS $addcflags"
2105       fi
2106
2107       AC_CHECK_LIB(polarssl, ssl_init,
2108        [
2109        AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2110        AC_SUBST(USE_POLARSSL, [1])
2111        POLARSSL_ENABLED=1
2112        USE_POLARSSL="yes"
2113        ssl_msg="PolarSSL"
2114        test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2115        ],
2116        [
2117          CPPFLAGS=$_cppflags
2118          LDFLAGS=$_ldflags
2119        ])
2120     fi
2121
2122     if test "x$USE_POLARSSL" = "xyes"; then
2123       AC_MSG_NOTICE([detected PolarSSL])
2124       check_for_ca_bundle=1
2125       LIBS="-lpolarssl $LIBS"
2126
2127       if test -n "$polarssllib"; then
2128         dnl when shared libs were found in a path that the run-time
2129         dnl linker doesn't search through, we need to add it to
2130         dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
2131         dnl due to this
2132         if test "x$cross_compiling" != "xyes"; then
2133           CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$polarssllib"
2134           export CURL_LIBRARY_PATH
2135           AC_MSG_NOTICE([Added $polarssllib to CURL_LIBRARY_PATH])
2136         fi
2137       fi
2138     fi
2139
2140   fi dnl PolarSSL not disabled
2141
2142   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2143 fi
2144
2145 dnl ----------------------------------------------------
2146 dnl check for mbedTLS
2147 dnl ----------------------------------------------------
2148
2149 OPT_MBEDTLS=no
2150
2151 _cppflags=$CPPFLAGS
2152 _ldflags=$LDFLAGS
2153 AC_ARG_WITH(mbedtls,dnl
2154 AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2155 AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2156   OPT_MBEDTLS=$withval)
2157
2158 if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2159   ssl_msg=
2160
2161   if test X"$OPT_MBEDTLS" != Xno; then
2162
2163     if test "$OPT_MBEDTLS" = "yes"; then
2164       OPT_MBEDTLS=""
2165     fi
2166
2167     if test -z "$OPT_MBEDTLS" ; then
2168       dnl check for lib first without setting any new path
2169
2170       AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2171       dnl libmbedtls found, set the variable
2172        [
2173          AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2174          AC_SUBST(USE_MBEDTLS, [1])
2175          MBEDTLS_ENABLED=1
2176          USE_MBEDTLS="yes"
2177          ssl_msg="mbedTLS"
2178          test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2179         ], [], -lmbedx509 -lmbedcrypto)
2180     fi
2181
2182     addld=""
2183     addlib=""
2184     addcflags=""
2185     mbedtlslib=""
2186
2187     if test "x$USE_MBEDTLS" != "xyes"; then
2188       dnl add the path and test again
2189       addld=-L$OPT_MBEDTLS/lib$libsuff
2190       addcflags=-I$OPT_MBEDTLS/include
2191       mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2192
2193       LDFLAGS="$LDFLAGS $addld"
2194       if test "$addcflags" != "-I/usr/include"; then
2195          CPPFLAGS="$CPPFLAGS $addcflags"
2196       fi
2197
2198       AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2199        [
2200        AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2201        AC_SUBST(USE_MBEDTLS, [1])
2202        MBEDTLS_ENABLED=1
2203        USE_MBEDTLS="yes"
2204        ssl_msg="mbedTLS"
2205        test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2206        ],
2207        [
2208          CPPFLAGS=$_cppflags
2209          LDFLAGS=$_ldflags
2210        ], -lmbedx509 -lmbedcrypto)
2211     fi
2212
2213     if test "x$USE_MBEDTLS" = "xyes"; then
2214       AC_MSG_NOTICE([detected mbedTLS])
2215       check_for_ca_bundle=1
2216
2217       LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2218
2219       if test -n "$mbedtlslib"; then
2220         dnl when shared libs were found in a path that the run-time
2221         dnl linker doesn't search through, we need to add it to
2222         dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
2223         dnl due to this
2224         if test "x$cross_compiling" != "xyes"; then
2225           CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$mbedtlslib"
2226           export CURL_LIBRARY_PATH
2227           AC_MSG_NOTICE([Added $mbedtlslib to CURL_LIBRARY_PATH])
2228         fi
2229       fi
2230     fi
2231
2232   fi dnl mbedTLS not disabled
2233
2234   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2235 fi
2236
2237 dnl ----------------------------------------------------
2238 dnl check for CyaSSL
2239 dnl ----------------------------------------------------
2240
2241 dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2242 OPT_CYASSL=no
2243
2244 _cppflags=$CPPFLAGS
2245 _ldflags=$LDFLAGS
2246 AC_ARG_WITH(cyassl,dnl
2247 AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2248 AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2249   OPT_CYASSL=$withval)
2250
2251 dnl provide --with-wolfssl as an alias for --with-cyassl
2252 AC_ARG_WITH(wolfssl,dnl
2253 AC_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)])
2254 AC_HELP_STRING([--without-wolfssl], [disable WolfSSL detection]),
2255   OPT_CYASSL=$withval)
2256
2257 if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then
2258   ssl_msg=
2259
2260   if test X"$OPT_CYASSL" != Xno; then
2261
2262     if test "$OPT_CYASSL" = "yes"; then
2263       OPT_CYASSL=""
2264     fi
2265
2266     dnl This should be reworked to use pkg-config instead
2267
2268     cyassllibname=cyassl
2269
2270     if test -z "$OPT_CYASSL" ; then
2271       dnl check for lib in system default first
2272
2273       AC_CHECK_LIB(cyassl, CyaSSL_Init,
2274       dnl libcyassl found, set the variable
2275        [
2276          AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2277          AC_SUBST(USE_CYASSL, [1])
2278          CYASSL_ENABLED=1
2279          USE_CYASSL="yes"
2280          ssl_msg="CyaSSL"
2281          test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2282         ])
2283     fi
2284
2285     addld=""
2286     addlib=""
2287     addcflags=""
2288     cyassllib=""
2289
2290     if test "x$USE_CYASSL" != "xyes"; then
2291       dnl add the path and test again
2292       addld=-L$OPT_CYASSL/lib$libsuff
2293       addcflags=-I$OPT_CYASSL/include
2294       cyassllib=$OPT_CYASSL/lib$libsuff
2295
2296       LDFLAGS="$LDFLAGS $addld"
2297       if test "$addcflags" != "-I/usr/include"; then
2298          CPPFLAGS="$CPPFLAGS $addcflags"
2299       fi
2300
2301       AC_CHECK_LIB(cyassl, CyaSSL_Init,
2302        [
2303        AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2304        AC_SUBST(USE_CYASSL, [1])
2305        CYASSL_ENABLED=1
2306        USE_CYASSL="yes"
2307        ssl_msg="CyaSSL"
2308        test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2309        ],
2310        [
2311          CPPFLAGS=$_cppflags
2312          LDFLAGS=$_ldflags
2313          cyassllib=""
2314        ])
2315     fi
2316
2317     addld=""
2318     addlib=""
2319     addcflags=""
2320
2321     if test "x$USE_CYASSL" != "xyes"; then
2322       dnl libcyassl renamed to libwolfssl as of 3.4.0
2323       addld=-L$OPT_CYASSL/lib$libsuff
2324       addcflags=-I$OPT_CYASSL/include
2325       cyassllib=$OPT_CYASSL/lib$libsuff
2326
2327       LDFLAGS="$LDFLAGS $addld"
2328       if test "$addcflags" != "-I/usr/include"; then
2329          CPPFLAGS="$CPPFLAGS $addcflags"
2330       fi
2331
2332       cyassllibname=wolfssl
2333       my_ac_save_LIBS="$LIBS"
2334       LIBS="-l$cyassllibname -lm $LIBS"
2335
2336       AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2337       AC_LINK_IFELSE([
2338         AC_LANG_PROGRAM([[
2339 /* These aren't needed for detection and confuse WolfSSL.
2340    They are set up properly later if it is detected.  */
2341 #undef SIZEOF_LONG
2342 #undef SIZEOF_LONG_LONG
2343 #include <cyassl/ssl.h>
2344         ]],[[
2345           return CyaSSL_Init();
2346         ]])
2347       ],[
2348          AC_MSG_RESULT(yes)
2349          AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
2350          AC_SUBST(USE_CYASSL, [1])
2351          CYASSL_ENABLED=1
2352          USE_CYASSL="yes"
2353          ssl_msg="WolfSSL"
2354          test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2355        ],
2356        [
2357          AC_MSG_RESULT(no)
2358          CPPFLAGS=$_cppflags
2359          LDFLAGS=$_ldflags
2360          cyassllib=""
2361        ])
2362       LIBS="$my_ac_save_LIBS"
2363     fi
2364
2365     if test "x$USE_CYASSL" = "xyes"; then
2366       AC_MSG_NOTICE([detected $cyassllibname])
2367       check_for_ca_bundle=1
2368
2369       dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2370       AX_COMPILE_CHECK_SIZEOF(long long)
2371
2372       dnl Versions since at least 2.6.0 may have options.h
2373       AC_CHECK_HEADERS(cyassl/options.h)
2374
2375       dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2376       AC_CHECK_HEADERS(cyassl/error-ssl.h)
2377
2378       LIBS="-l$cyassllibname -lm $LIBS"
2379
2380       if test "x$cyassllibname" = "xwolfssl"; then
2381         dnl Recent WolfSSL versions build without SSLv3 by default
2382         dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2383         AC_CHECK_FUNCS(wolfSSLv3_client_method \
2384                        wolfSSL_CTX_UseSupportedCurve \
2385                        wolfSSL_get_peer_certificate \
2386                        wolfSSL_UseALPN)
2387       else
2388         dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2389         AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2390                        CyaSSL_get_peer_certificate)
2391       fi
2392
2393       if test -n "$cyassllib"; then
2394         dnl when shared libs were found in a path that the run-time
2395         dnl linker doesn't search through, we need to add it to
2396         dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
2397         dnl due to this
2398         if test "x$cross_compiling" != "xyes"; then
2399           CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$cyassllib"
2400           export CURL_LIBRARY_PATH
2401           AC_MSG_NOTICE([Added $cyassllib to CURL_LIBRARY_PATH])
2402         fi
2403       fi
2404
2405     fi
2406
2407   fi dnl CyaSSL not disabled
2408
2409   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2410 fi
2411
2412 dnl ----------------------------------------------------
2413 dnl check for MesaLink
2414 dnl ----------------------------------------------------
2415
2416 dnl Default to compiler & linker defaults for MesaLink files & libraries.
2417 OPT_MESALINK=no
2418
2419 _cppflags=$CPPFLAGS
2420 _ldflags=$LDFLAGS
2421 AC_ARG_WITH(mesalink,dnl
2422 AC_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root])
2423 AC_HELP_STRING([--without-mesalink], [disable MesaLink detection]),
2424   OPT_MESALINK=$withval)
2425
2426 if test -z "$ssl_backends" -o "x$OPT_MESALINK" != xno; then
2427   ssl_msg=
2428
2429   if test X"$OPT_MESALINK" != Xno; then
2430
2431     if test "$OPT_MESALINK" = "yes"; then
2432       OPT_MESALINK=""
2433     fi
2434
2435     if test -z "$OPT_MESALINK" ; then
2436       dnl check for lib first without setting any new path
2437
2438       AC_CHECK_LIB(mesalink, mesalink_library_init,
2439       dnl libmesalink found, set the variable
2440        [
2441          AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2442          AC_SUBST(USE_MESALINK, [1])
2443          MESALINK_ENABLED=1
2444          USE_MESALINK="yes"
2445          ssl_msg="MesaLink"
2446          test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2447         ])
2448     fi
2449
2450     addld=""
2451     addlib=""
2452     addcflags=""
2453     mesalinklib=""
2454
2455     if test "x$USE_MESALINK" != "xyes"; then
2456       dnl add the path and test again
2457       addld=-L$OPT_MESALINK/lib$libsuff
2458       addcflags=-I$OPT_MESALINK/include
2459       mesalinklib=$OPT_MESALINK/lib$libsuff
2460
2461       LDFLAGS="$LDFLAGS $addld"
2462       if test "$addcflags" != "-I/usr/include"; then
2463          CPPFLAGS="$CPPFLAGS $addcflags"
2464       fi
2465
2466       AC_CHECK_LIB(mesalink, mesalink_library_init,
2467        [
2468        AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2469        AC_SUBST(USE_MESALINK, [1])
2470        MESALINK_ENABLED=1
2471        USE_MESALINK="yes"
2472        ssl_msg="MesaLink"
2473        test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2474        ],
2475        [
2476          CPPFLAGS=$_cppflags
2477          LDFLAGS=$_ldflags
2478        ])
2479     fi
2480
2481     if test "x$USE_MESALINK" = "xyes"; then
2482       AC_MSG_NOTICE([detected MesaLink])
2483
2484       LIBS="-lmesalink $LIBS"
2485
2486       if test -n "$mesalinklib"; then
2487         dnl when shared libs were found in a path that the run-time
2488         dnl linker doesn't search through, we need to add it to
2489         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2490         dnl due to this
2491         if test "x$cross_compiling" != "xyes"; then
2492           LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mesalinklib"
2493           export LD_LIBRARY_PATH
2494           AC_MSG_NOTICE([Added $mesalinklib to LD_LIBRARY_PATH])
2495         fi
2496       fi
2497     fi
2498
2499   fi dnl MesaLink not disabled
2500
2501   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2502 fi
2503
2504 dnl ----------------------------------------------------
2505 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2506 dnl ----------------------------------------------------
2507
2508 dnl Default to compiler & linker defaults for NSS files & libraries.
2509 OPT_NSS=no
2510
2511 AC_ARG_WITH(nss,dnl
2512 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
2513 AC_HELP_STRING([--without-nss], [disable NSS detection]),
2514   OPT_NSS=$withval)
2515
2516 if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2517   ssl_msg=
2518
2519   if test X"$OPT_NSS" != Xno; then
2520
2521     addld=""
2522     addlib=""
2523     addcflags=""
2524     nssprefix=""
2525     version=""
2526
2527     if test "x$OPT_NSS" = "xyes"; then
2528
2529       CURL_CHECK_PKGCONFIG(nss)
2530
2531       if test "$PKGCONFIG" != "no" ; then
2532         addlib=`$PKGCONFIG --libs nss`
2533         addcflags=`$PKGCONFIG --cflags nss`
2534         version=`$PKGCONFIG --modversion nss`
2535         nssprefix=`$PKGCONFIG --variable=prefix nss`
2536       else
2537         dnl Without pkg-config, we check for nss-config
2538
2539         check=`nss-config --version 2>/dev/null`
2540         if test -n "$check"; then
2541           addlib=`nss-config --libs`
2542           addcflags=`nss-config --cflags`
2543           version=`nss-config --version`
2544           nssprefix=`nss-config --prefix`
2545         else
2546           addlib="-lnss3"
2547           addcflags=""
2548           version="unknown"
2549         fi
2550       fi
2551     else
2552       NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2553       if test -f "$NSS_PCDIR/nss.pc"; then
2554         CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2555         if test "$PKGCONFIG" != "no" ; then
2556           addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2557           addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2558           addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2559           version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2560           nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2561         fi
2562       fi
2563     fi
2564
2565     if test -z "$addlib"; then
2566       # Without pkg-config, we'll kludge in some defaults
2567       AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2568       addld="-L$OPT_NSS/lib"
2569       addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2570       addcflags="-I$OPT_NSS/include"
2571       version="unknown"
2572       nssprefix=$OPT_NSS
2573     fi
2574
2575     CLEANLDFLAGS="$LDFLAGS"
2576     CLEANLIBS="$LIBS"
2577     CLEANCPPFLAGS="$CPPFLAGS"
2578
2579     LDFLAGS="$addld $LDFLAGS"
2580     LIBS="$addlib $LIBS"
2581     if test "$addcflags" != "-I/usr/include"; then
2582        CPPFLAGS="$CPPFLAGS $addcflags"
2583     fi
2584
2585     dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2586     AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
2587      [
2588      AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2589      AC_SUBST(USE_NSS, [1])
2590      USE_NSS="yes"
2591      NSS_ENABLED=1
2592      ssl_msg="NSS"
2593      test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2594      ],
2595      [
2596        LDFLAGS="$CLEANLDFLAGS"
2597        LIBS="$CLEANLIBS"
2598        CPPFLAGS="$CLEANCPPFLAGS"
2599      ])
2600
2601     if test "x$USE_NSS" = "xyes"; then
2602       AC_MSG_NOTICE([detected NSS version $version])
2603
2604       dnl PK11_CreateManagedGenericObject() was introduced in NSS 3.34 because
2605       dnl PK11_DestroyGenericObject() does not release resources allocated by
2606       dnl PK11_CreateGenericObject() early enough.
2607       AC_CHECK_FUNC(PK11_CreateManagedGenericObject,
2608         [
2609           AC_DEFINE(HAVE_PK11_CREATEMANAGEDGENERICOBJECT, 1,
2610                     [if you have the PK11_CreateManagedGenericObject function])
2611         ])
2612
2613       dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2614       NSS_LIBS=$addlib
2615       AC_SUBST([NSS_LIBS])
2616
2617       dnl when shared libs were found in a path that the run-time
2618       dnl linker doesn't search through, we need to add it to
2619       dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
2620       dnl due to this
2621       if test "x$cross_compiling" != "xyes"; then
2622         CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$nssprefix/lib$libsuff"
2623         export CURL_LIBRARY_PATH
2624         AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to CURL_LIBRARY_PATH])
2625       fi
2626
2627     fi dnl NSS found
2628
2629   fi dnl NSS not disabled
2630
2631   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2632 fi
2633
2634 OPT_AXTLS=off
2635
2636 AC_ARG_WITH(axtls,dnl
2637 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.])
2638 AC_HELP_STRING([--without-axtls], [disable axTLS]),
2639   OPT_AXTLS=$withval)
2640
2641 if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then
2642   ssl_msg=
2643   if test X"$OPT_AXTLS" != Xno; then
2644     dnl backup the pre-axtls variables
2645     CLEANLDFLAGS="$LDFLAGS"
2646     CLEANCPPFLAGS="$CPPFLAGS"
2647     CLEANLIBS="$LIBS"
2648
2649     case "$OPT_AXTLS" in
2650     yes)
2651       dnl --with-axtls (without path) used
2652       PREFIX_AXTLS=/usr/local
2653       LIB_AXTLS="$PREFIX_AXTLS/lib"
2654       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2655       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2656       ;;
2657     off)
2658       dnl no --with-axtls option given, just check default places
2659       PREFIX_AXTLS=
2660       ;;
2661     *)
2662       dnl check the given --with-axtls spot
2663       PREFIX_AXTLS=$OPT_AXTLS
2664       LIB_AXTLS="$PREFIX_AXTLS/lib"
2665       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2666       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2667       ;;
2668     esac
2669
2670     AC_CHECK_LIB(axtls, ssl_version,[
2671       LIBS="-laxtls $LIBS"
2672       AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2673       AC_SUBST(USE_AXTLS, [1])
2674       AXTLS_ENABLED=1
2675       check_for_ca_bundle=1
2676       USE_AXTLS="yes"
2677       ssl_msg="axTLS"
2678       test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2679
2680       if test "x$cross_compiling" != "xyes"; then
2681         CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_AXTLS"
2682         export CURL_LIBRARY_PATH
2683         AC_MSG_NOTICE([Added $LIB_AXTLS to CURL_LIBRARY_PATH])
2684       fi
2685       ],[
2686       LDFLAGS="$CLEANLDFLAGS"
2687       CPPFLAGS="$CLEANCPPFLAGS"
2688       LIBS="$CLEANLIBS"
2689     ])
2690   fi
2691   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2692 fi
2693
2694 case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED$MESALINK_ENABLED" in
2695 x)
2696   AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
2697   AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, --with-darwinssl, or --with-mesalink to address this.])
2698   ;;
2699 x1)
2700   # one SSL backend is enabled
2701   AC_SUBST(SSL_ENABLED)
2702   SSL_ENABLED="1"
2703   AC_MSG_NOTICE([built with one SSL backend])
2704   ;;
2705 *)
2706   # more than one SSL backend is enabled
2707   AC_SUBST(SSL_ENABLED)
2708   SSL_ENABLED="1"
2709   AC_SUBST(CURL_WITH_MULTI_SSL)
2710   CURL_WITH_MULTI_SSL="1"
2711   AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2712   AC_MSG_NOTICE([built with multiple SSL backends])
2713   ;;
2714 esac
2715
2716 if test -n "$ssl_backends"; then
2717   curl_ssl_msg="enabled ($ssl_backends)"
2718 fi
2719
2720 if test no = "$VALID_DEFAULT_SSL_BACKEND"
2721 then
2722   if test -n "$SSL_ENABLED"
2723   then
2724     AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2725   else
2726     AC_MSG_ERROR([Default SSL backend requires SSL!])
2727   fi
2728 elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2729 then
2730   AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
2731 fi
2732
2733 dnl **********************************************************************
2734 dnl Check for the CA bundle
2735 dnl **********************************************************************
2736
2737 if test "$check_for_ca_bundle" -gt 0; then
2738   CURL_CHECK_CA_BUNDLE
2739 fi
2740
2741 dnl **********************************************************************
2742 dnl Check for libpsl
2743 dnl **********************************************************************
2744
2745 AC_ARG_WITH(libpsl,
2746            AS_HELP_STRING([--without-libpsl],
2747            [disable support for libpsl cookie checking]),
2748            with_libpsl=$withval,
2749            with_libpsl=yes)
2750 if test $with_libpsl != "no"; then
2751   AC_SEARCH_LIBS(psl_builtin, psl,
2752     [curl_psl_msg="yes";
2753      AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2754      ],
2755     [curl_psl_msg="no      (libpsl not found)";
2756      AC_MSG_WARN([libpsl was not found])
2757      ]
2758   )
2759 fi
2760 AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2761
2762 dnl **********************************************************************
2763 dnl Check for libmetalink
2764 dnl **********************************************************************
2765
2766 OPT_LIBMETALINK=no
2767
2768 AC_ARG_WITH(libmetalink,dnl
2769 AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2770 AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2771   OPT_LIBMETALINK=$withval)
2772
2773 if test X"$OPT_LIBMETALINK" != Xno; then
2774
2775   addld=""
2776   addlib=""
2777   addcflags=""
2778   version=""
2779   libmetalinklib=""
2780
2781   PKGTEST="no"
2782   if test "x$OPT_LIBMETALINK" = "xyes"; then
2783     dnl this is with no partiular path given
2784     PKGTEST="yes"
2785     CURL_CHECK_PKGCONFIG(libmetalink)
2786   else
2787     dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2788     LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2789     AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2790     if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2791       PKGTEST="yes"
2792     fi
2793     if test "$PKGTEST" = "yes"; then
2794       CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2795     fi
2796   fi
2797   if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2798     addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2799       $PKGCONFIG --libs-only-l libmetalink`
2800     addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2801       $PKGCONFIG --libs-only-L libmetalink`
2802     addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2803       $PKGCONFIG --cflags-only-I libmetalink`
2804     version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2805       $PKGCONFIG --modversion libmetalink`
2806     libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2807   fi
2808   if test -n "$addlib"; then
2809
2810     clean_CPPFLAGS="$CPPFLAGS"
2811     clean_LDFLAGS="$LDFLAGS"
2812     clean_LIBS="$LIBS"
2813     CPPFLAGS="$clean_CPPFLAGS $addcflags"
2814     LDFLAGS="$clean_LDFLAGS $addld"
2815     LIBS="$addlib $clean_LIBS"
2816     AC_MSG_CHECKING([if libmetalink is recent enough])
2817     AC_LINK_IFELSE([
2818       AC_LANG_PROGRAM([[
2819 #       include <metalink/metalink.h>
2820       ]],[[
2821         if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2822           return 1;
2823       ]])
2824     ],[
2825       AC_MSG_RESULT([yes ($version)])
2826       want_metalink="yes"
2827     ],[
2828       AC_MSG_RESULT([no ($version)])
2829       AC_MSG_NOTICE([libmetalink library defective or too old])
2830       want_metalink="no"
2831     ])
2832     CPPFLAGS="$clean_CPPFLAGS"
2833     LDFLAGS="$clean_LDFLAGS"
2834     LIBS="$clean_LIBS"
2835     if test "$want_metalink" = "yes"; then
2836       dnl finally libmetalink will be used
2837       AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2838       LIBMETALINK_LIBS=$addlib
2839       LIBMETALINK_LDFLAGS=$addld
2840       LIBMETALINK_CPPFLAGS=$addcflags
2841       AC_SUBST([LIBMETALINK_LIBS])
2842       AC_SUBST([LIBMETALINK_LDFLAGS])
2843       AC_SUBST([LIBMETALINK_CPPFLAGS])
2844       curl_mtlnk_msg="enabled"
2845     fi
2846
2847   fi
2848 fi
2849
2850 dnl **********************************************************************
2851 dnl Check for the presence of LIBSSH2 libraries and headers
2852 dnl **********************************************************************
2853
2854 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2855 OPT_LIBSSH2=off
2856 AC_ARG_WITH(libssh2,dnl
2857 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])
2858 AC_HELP_STRING([--with-libssh2], [enable LIBSSH2]),
2859   OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
2860
2861
2862 OPT_LIBSSH=off
2863 AC_ARG_WITH(libssh,dnl
2864 AC_HELP_STRING([--with-libssh=PATH],[Where to look for libssh, PATH points to the LIBSSH installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
2865 AC_HELP_STRING([--with-libssh], [enable LIBSSH]),
2866   OPT_LIBSSH=$withval, OPT_LIBSSH=no)
2867
2868 if test X"$OPT_LIBSSH2" != Xno; then
2869   dnl backup the pre-libssh2 variables
2870   CLEANLDFLAGS="$LDFLAGS"
2871   CLEANCPPFLAGS="$CPPFLAGS"
2872   CLEANLIBS="$LIBS"
2873
2874   case "$OPT_LIBSSH2" in
2875   yes)
2876     dnl --with-libssh2 (without path) used
2877     CURL_CHECK_PKGCONFIG(libssh2)
2878
2879     if test "$PKGCONFIG" != "no" ; then
2880       LIB_SSH2=`$PKGCONFIG --libs libssh2`
2881       LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2882       CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2883       version=`$PKGCONFIG --modversion libssh2`
2884       DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2885     fi
2886
2887     ;;
2888   off)
2889     dnl no --with-libssh2 option given, just check default places
2890     ;;
2891   *)
2892     dnl use the given --with-libssh2 spot
2893     PREFIX_SSH2=$OPT_LIBSSH2
2894     ;;
2895   esac
2896
2897   dnl if given with a prefix, we set -L and -I based on that
2898   if test -n "$PREFIX_SSH2"; then
2899     LIB_SSH2="-lssh2"
2900     LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2901     CPP_SSH2=-I${PREFIX_SSH2}/include
2902     DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2903   fi
2904
2905   LDFLAGS="$LDFLAGS $LD_SSH2"
2906   CPPFLAGS="$CPPFLAGS $CPP_SSH2"
2907   LIBS="$LIB_SSH2 $LIBS"
2908
2909   AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2910
2911   AC_CHECK_HEADERS(libssh2.h,
2912     curl_ssh_msg="enabled (libSSH2)"
2913     LIBSSH2_ENABLED=1
2914     AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2915     AC_SUBST(USE_LIBSSH2, [1])
2916   )
2917
2918   if test X"$OPT_LIBSSH2" != Xoff &&
2919      test "$LIBSSH2_ENABLED" != "1"; then
2920     AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2921   fi
2922
2923   if test "$LIBSSH2_ENABLED" = "1"; then
2924     if test -n "$DIR_SSH2"; then
2925        dnl when the libssh2 shared libs were found in a path that the run-time
2926        dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
2927        dnl to prevent further configure tests to fail due to this
2928
2929        if test "x$cross_compiling" != "xyes"; then
2930          CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2"
2931          export CURL_LIBRARY_PATH
2932          AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH])
2933        fi
2934     fi
2935   else
2936     dnl no libssh2, revert back to clean variables
2937     LDFLAGS=$CLEANLDFLAGS
2938     CPPFLAGS=$CLEANCPPFLAGS
2939     LIBS=$CLEANLIBS
2940   fi
2941 elif test X"$OPT_LIBSSH" != Xno; then
2942   dnl backup the pre-libssh variables
2943   CLEANLDFLAGS="$LDFLAGS"
2944   CLEANCPPFLAGS="$CPPFLAGS"
2945   CLEANLIBS="$LIBS"
2946
2947   case "$OPT_LIBSSH" in
2948   yes)
2949     dnl --with-libssh (without path) used
2950     CURL_CHECK_PKGCONFIG(libssh)
2951
2952     if test "$PKGCONFIG" != "no" ; then
2953       LIB_SSH=`$PKGCONFIG --libs-only-l libssh`
2954       LD_SSH=`$PKGCONFIG --libs-only-L libssh`
2955       CPP_SSH=`$PKGCONFIG --cflags-only-I libssh`
2956       version=`$PKGCONFIG --modversion libssh`
2957       DIR_SSH=`echo $LD_SSH | $SED -e 's/-L//'`
2958     fi
2959
2960     ;;
2961   off)
2962     dnl no --with-libssh option given, just check default places
2963     ;;
2964   *)
2965     dnl use the given --with-libssh spot
2966     PREFIX_SSH=$OPT_LIBSSH
2967     ;;
2968   esac
2969
2970   dnl if given with a prefix, we set -L and -I based on that
2971   if test -n "$PREFIX_SSH"; then
2972     LIB_SSH="-lssh"
2973     LD_SSH=-L${PREFIX_SSH}/lib$libsuff
2974     CPP_SSH=-I${PREFIX_SSH}/include
2975     DIR_SSH=${PREFIX_SSH}/lib$libsuff
2976   fi
2977
2978   LDFLAGS="$LDFLAGS $LD_SSH"
2979   CPPFLAGS="$CPPFLAGS $CPP_SSH"
2980   LIBS="$LIB_SSH $LIBS"
2981
2982   AC_CHECK_LIB(ssh, ssh_new)
2983
2984   AC_CHECK_HEADERS(libssh/libssh.h,
2985     curl_ssh_msg="enabled (libSSH)"
2986     LIBSSH_ENABLED=1
2987     AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use])
2988     AC_SUBST(USE_LIBSSH, [1])
2989   )
2990
2991   if test X"$OPT_LIBSSH" != Xoff &&
2992      test "$LIBSSH_ENABLED" != "1"; then
2993     AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!])
2994   fi
2995
2996   if test "$LIBSSH_ENABLED" = "1"; then
2997     if test -n "$DIR_SSH"; then
2998        dnl when the libssh shared libs were found in a path that the run-time
2999        dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
3000        dnl to prevent further configure tests to fail due to this
3001
3002        if test "x$cross_compiling" != "xyes"; then
3003          CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH"
3004          export CURL_LIBRARY_PATH
3005          AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH])
3006        fi
3007     fi
3008   else
3009     dnl no libssh, revert back to clean variables
3010     LDFLAGS=$CLEANLDFLAGS
3011     CPPFLAGS=$CLEANCPPFLAGS
3012     LIBS=$CLEANLIBS
3013   fi
3014 fi
3015
3016 dnl **********************************************************************
3017 dnl Check for the presence of LIBRTMP libraries and headers
3018 dnl **********************************************************************
3019
3020 dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
3021 OPT_LIBRTMP=off
3022 AC_ARG_WITH(librtmp,dnl
3023 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])
3024 AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
3025   OPT_LIBRTMP=$withval)
3026
3027 if test X"$OPT_LIBRTMP" != Xno; then
3028   dnl backup the pre-librtmp variables
3029   CLEANLDFLAGS="$LDFLAGS"
3030   CLEANCPPFLAGS="$CPPFLAGS"
3031   CLEANLIBS="$LIBS"
3032
3033   case "$OPT_LIBRTMP" in
3034   yes)
3035     dnl --with-librtmp (without path) used
3036     CURL_CHECK_PKGCONFIG(librtmp)
3037
3038     if test "$PKGCONFIG" != "no" ; then
3039       LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
3040       LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
3041       CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
3042       version=`$PKGCONFIG --modversion librtmp`
3043       DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
3044     else
3045       dnl To avoid link errors, we do not allow --librtmp without
3046       dnl a pkgconfig file
3047       AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
3048     fi
3049
3050     ;;
3051   off)
3052     dnl no --with-librtmp option given, just check default places
3053     LIB_RTMP="-lrtmp"
3054     ;;
3055   *)
3056     dnl use the given --with-librtmp spot
3057     LIB_RTMP="-lrtmp"
3058     PREFIX_RTMP=$OPT_LIBRTMP
3059     ;;
3060   esac
3061
3062   dnl if given with a prefix, we set -L and -I based on that
3063   if test -n "$PREFIX_RTMP"; then
3064     LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
3065     CPP_RTMP=-I${PREFIX_RTMP}/include
3066     DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
3067   fi
3068
3069   LDFLAGS="$LDFLAGS $LD_RTMP"
3070   CPPFLAGS="$CPPFLAGS $CPP_RTMP"
3071   LIBS="$LIB_RTMP $LIBS"
3072
3073   AC_CHECK_LIB(rtmp, RTMP_Init,
3074     [
3075      AC_CHECK_HEADERS(librtmp/rtmp.h,
3076         curl_rtmp_msg="enabled (librtmp)"
3077         LIBRTMP_ENABLED=1
3078         AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
3079         AC_SUBST(USE_LIBRTMP, [1])
3080      )
3081     ],
3082       dnl not found, revert back to clean variables
3083       LDFLAGS=$CLEANLDFLAGS
3084       CPPFLAGS=$CLEANCPPFLAGS
3085       LIBS=$CLEANLIBS
3086   )
3087
3088   if test X"$OPT_LIBRTMP" != Xoff &&
3089      test "$LIBRTMP_ENABLED" != "1"; then
3090     AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
3091   fi
3092
3093 fi
3094
3095 dnl **********************************************************************
3096 dnl Check for linker switch for versioned symbols
3097 dnl **********************************************************************
3098
3099 versioned_symbols_flavour=
3100 AC_MSG_CHECKING([whether versioned symbols are wanted])
3101 AC_ARG_ENABLE(versioned-symbols,
3102 AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
3103 AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
3104 [ case "$enableval" in
3105   yes) AC_MSG_RESULT(yes)
3106     AC_MSG_CHECKING([if libraries can be versioned])
3107     GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
3108     if test -z "$GLD"; then
3109         AC_MSG_RESULT(no)
3110         AC_MSG_WARN([You need an ld version supporting the --version-script option])
3111     else
3112         AC_MSG_RESULT(yes)
3113         if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3114           versioned_symbols_flavour="MULTISSL_"
3115         elif test "x$OPENSSL_ENABLED" = "x1"; then
3116           versioned_symbols_flavour="OPENSSL_"
3117         elif test "x$GNUTLS_ENABLED" = "x1"; then
3118           versioned_symbols_flavour="GNUTLS_"
3119         elif test "x$NSS_ENABLED" = "x1"; then
3120           versioned_symbols_flavour="NSS_"
3121         elif test "x$POLARSSL_ENABLED" = "x1"; then
3122           versioned_symbols_flavour="POLARSSL_"
3123         elif test "x$CYASSL_ENABLED" = "x1"; then
3124           versioned_symbols_flavour="CYASSL_"
3125         elif test "x$AXTLS_ENABLED" = "x1"; then
3126           versioned_symbols_flavour="AXTLS_"
3127         elif test "x$WINSSL_ENABLED" = "x1"; then
3128           versioned_symbols_flavour="WINSSL_"
3129         elif test "x$DARWINSSL_ENABLED" = "x1"; then
3130           versioned_symbols_flavour="DARWINSSL_"
3131         else
3132           versioned_symbols_flavour=""
3133         fi
3134         versioned_symbols="yes"
3135     fi
3136     ;;
3137
3138   *)   AC_MSG_RESULT(no)
3139     ;;
3140   esac
3141 ], [
3142 AC_MSG_RESULT(no)
3143 ]
3144 )
3145
3146 AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
3147   ["$versioned_symbols_flavour"])
3148 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
3149   [test "x$versioned_symbols" = 'xyes'])
3150
3151 dnl -------------------------------------------------
3152 dnl check winidn option before other IDN libraries
3153 dnl -------------------------------------------------
3154
3155 AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
3156 OPT_WINIDN="default"
3157 AC_ARG_WITH(winidn,
3158 AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
3159 AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
3160   OPT_WINIDN=$withval)
3161 case "$OPT_WINIDN" in
3162   no|default)
3163     dnl --without-winidn option used or configure option not specified
3164     want_winidn="no"
3165     AC_MSG_RESULT([no])
3166     ;;
3167   yes)
3168     dnl --with-winidn option used without path
3169     want_winidn="yes"
3170     want_winidn_path="default"
3171     AC_MSG_RESULT([yes])
3172     ;;
3173   *)
3174     dnl --with-winidn option used with path
3175     want_winidn="yes"
3176     want_winidn_path="$withval"
3177     AC_MSG_RESULT([yes ($withval)])
3178     ;;
3179 esac
3180
3181 if test "$want_winidn" = "yes"; then
3182   dnl winidn library support has been requested
3183   clean_CPPFLAGS="$CPPFLAGS"
3184   clean_LDFLAGS="$LDFLAGS"
3185   clean_LIBS="$LIBS"
3186   WINIDN_LIBS="-lnormaliz"
3187   WINIDN_CPPFLAGS="-DWINVER=0x0600"
3188   #
3189   if test "$want_winidn_path" != "default"; then
3190     dnl path has been specified
3191     dnl pkg-config not available or provides no info
3192     WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
3193     WINIDN_CPPFLAGS="-I$want_winidn_path/include"
3194     WINIDN_DIR="$want_winidn_path/lib$libsuff"
3195   fi
3196   #
3197   CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
3198   LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
3199   LIBS="$WINIDN_LIBS $LIBS"
3200   #
3201   AC_MSG_CHECKING([if IdnToUnicode can be linked])
3202   AC_LINK_IFELSE([
3203     AC_LANG_PROGRAM([[
3204       #include <windows.h>
3205     ]],[[
3206       IdnToUnicode(0, NULL, 0, NULL, 0);
3207     ]])
3208   ],[
3209     AC_MSG_RESULT([yes])
3210     tst_links_winidn="yes"
3211   ],[
3212     AC_MSG_RESULT([no])
3213     tst_links_winidn="no"
3214   ])
3215   #
3216   if test "$tst_links_winidn" = "yes"; then
3217     AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
3218     AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
3219     AC_SUBST([IDN_ENABLED], [1])
3220     curl_idn_msg="enabled (Windows-native)"
3221   else
3222     AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3223     CPPFLAGS="$clean_CPPFLAGS"
3224     LDFLAGS="$clean_LDFLAGS"
3225     LIBS="$clean_LIBS"
3226   fi
3227 fi
3228
3229 dnl **********************************************************************
3230 dnl Check for the presence of IDN libraries and headers
3231 dnl **********************************************************************
3232
3233 AC_MSG_CHECKING([whether to build with libidn2])
3234 OPT_IDN="default"
3235 AC_ARG_WITH(libidn2,
3236 AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
3237 AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
3238   [OPT_IDN=$withval])
3239 case "$OPT_IDN" in
3240   no)
3241     dnl --without-libidn2 option used
3242     want_idn="no"
3243     AC_MSG_RESULT([no])
3244     ;;
3245   default)
3246     dnl configure option not specified
3247     want_idn="yes"
3248     want_idn_path="default"
3249     AC_MSG_RESULT([(assumed) yes])
3250     ;;
3251   yes)
3252     dnl --with-libidn2 option used without path
3253     want_idn="yes"
3254     want_idn_path="default"
3255     AC_MSG_RESULT([yes])
3256     ;;
3257   *)
3258     dnl --with-libidn2 option used with path
3259     want_idn="yes"
3260     want_idn_path="$withval"
3261     AC_MSG_RESULT([yes ($withval)])
3262     ;;
3263 esac
3264
3265 if test "$want_idn" = "yes"; then
3266   dnl idn library support has been requested
3267   clean_CPPFLAGS="$CPPFLAGS"
3268   clean_LDFLAGS="$LDFLAGS"
3269   clean_LIBS="$LIBS"
3270   PKGCONFIG="no"
3271   #
3272   if test "$want_idn_path" != "default"; then
3273     dnl path has been specified
3274     IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
3275     CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
3276     if test "$PKGCONFIG" != "no"; then
3277       IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3278         $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3279       IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3280         $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3281       IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3282         $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
3283       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3284     else
3285       dnl pkg-config not available or provides no info
3286       IDN_LIBS="-lidn2"
3287       IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3288       IDN_CPPFLAGS="-I$want_idn_path/include"
3289       IDN_DIR="$want_idn_path/lib$libsuff"
3290     fi
3291   else
3292     dnl path not specified
3293     CURL_CHECK_PKGCONFIG(libidn2)
3294     if test "$PKGCONFIG" != "no"; then
3295       IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3296       IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3297       IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
3298       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3299     else
3300       dnl pkg-config not available or provides no info
3301       IDN_LIBS="-lidn2"
3302     fi
3303   fi
3304   #
3305   if test "$PKGCONFIG" != "no"; then
3306     AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3307     AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3308     AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3309     AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3310   else
3311     AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3312     AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3313     AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3314     AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3315   fi
3316   #
3317   CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3318   LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
3319   LIBS="$IDN_LIBS $LIBS"
3320   #
3321   AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
3322   AC_LINK_IFELSE([
3323     AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
3324   ],[
3325     AC_MSG_RESULT([yes])
3326     tst_links_libidn="yes"
3327   ],[
3328     AC_MSG_RESULT([no])
3329     tst_links_libidn="no"
3330   ])
3331   #
3332   AC_CHECK_HEADERS( idn2.h )
3333
3334   if test "$tst_links_libidn" = "yes"; then
3335     AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
3336     dnl different versions of libidn have different setups of these:
3337
3338     AC_SUBST([IDN_ENABLED], [1])
3339     curl_idn_msg="enabled (libidn2)"
3340     if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
3341       CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR"
3342       export CURL_LIBRARY_PATH
3343       AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH])
3344     fi
3345   else
3346     AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3347     CPPFLAGS="$clean_CPPFLAGS"
3348     LDFLAGS="$clean_LDFLAGS"
3349     LIBS="$clean_LIBS"
3350   fi
3351 fi
3352
3353
3354 dnl Let's hope this split URL remains working:
3355 dnl https://www15.software.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
3356 dnl genprogc/thread_quick_ref.htm
3357
3358 dnl **********************************************************************
3359 dnl Check for ICU-UC (IDN support)
3360 dnl **********************************************************************
3361
3362 AC_MSG_CHECKING([whether to build with icu-uc])
3363 OPT_IDN="default"
3364 AC_ARG_WITH(icu-uc,
3365 AC_HELP_STRING([--with-icu-uc=PATH],[Enable icu-uc usage])
3366 AC_HELP_STRING([--without-icu-uc],[Disable icu-uc usage]),
3367   [OPT_IDN=$withval])
3368 case "$OPT_IDN" in
3369   no)
3370     dnl --without-icu-uc option used
3371     want_idn="no"
3372     AC_MSG_RESULT([no])
3373     ;;
3374   default)
3375     dnl configure option not specified
3376     want_idn="yes"
3377     want_idn_path="default"
3378     AC_MSG_RESULT([(assumed) yes])
3379     ;;
3380   yes)
3381     dnl --with-icu-uc option used without path
3382     want_idn="yes"
3383     want_idn_path="default"
3384     AC_MSG_RESULT([yes])
3385     ;;
3386   *)
3387     dnl --with-icu-uc option used with path
3388     want_idn="yes"
3389     want_idn_path="$withval"
3390     AC_MSG_RESULT([yes ($withval)])
3391     ;;
3392 esac
3393
3394 if test "$want_idn" = "yes"; then
3395   dnl idn library support has been requested
3396   clean_CPPFLAGS="$CPPFLAGS"
3397   clean_LDFLAGS="$LDFLAGS"
3398   clean_LIBS="$LIBS"
3399   PKGCONFIG="no"
3400   #
3401   if test "$want_idn_path" != "default"; then
3402     dnl path has been specified
3403     IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
3404     CURL_CHECK_PKGCONFIG(icu-uc, [$IDN_PCDIR])
3405     if test "$PKGCONFIG" != "no"; then
3406       IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3407         $PKGCONFIG --libs-only-l icu-uc 2>/dev/null`
3408       IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3409         $PKGCONFIG --libs-only-L icu-uc 2>/dev/null`
3410       IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
3411         $PKGCONFIG --cflags-only-I icu-uc 2>/dev/null`
3412       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3413     else
3414       dnl pkg-config not available or provides no info
3415       IDN_LIBS="-licu-uc"
3416       IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3417       IDN_CPPFLAGS="-I$want_idn_path/include"
3418       IDN_DIR="$want_idn_path/lib$libsuff"
3419     fi
3420   else
3421     dnl path not specified
3422     CURL_CHECK_PKGCONFIG(icu-uc)
3423     if test "$PKGCONFIG" != "no"; then
3424       IDN_LIBS=`$PKGCONFIG --libs-only-l icu-uc 2>/dev/null`
3425       IDN_LDFLAGS=`$PKGCONFIG --libs-only-L icu-uc 2>/dev/null`
3426       IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I icu-uc 2>/dev/null`
3427       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3428     else
3429       dnl pkg-config not available or provides no info
3430       IDN_LIBS="-licu-uc"
3431     fi
3432   fi
3433   #
3434   if test "$PKGCONFIG" != "no"; then
3435     AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3436     AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3437     AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3438     AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3439   else
3440     AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3441     AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3442     AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3443     AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3444   fi
3445   #
3446   CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
3447   LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
3448   LIBS="$IDN_LIBS $LIBS"
3449   #
3450   AC_MSG_CHECKING([if uidna_nameToASCII_UTF8 can be linked])
3451   AC_LINK_IFELSE([
3452     AC_LANG_FUNC_LINK_TRY([uidna_nameToASCII_UTF8])
3453   ],[
3454     AC_MSG_RESULT([yes])
3455     tst_links_icu="yes"
3456   ],[
3457     AC_MSG_RESULT([no])
3458     tst_links_icu="no"
3459   ])
3460   #
3461   if test "$tst_links_icu" = "yes"; then
3462     AC_DEFINE(USE_ICU_IDNA, 1, [Define to 1 if you have the `icu-uc' library (-licu-uc).])
3463     dnl different versions of libidn have different setups of these:
3464
3465     AC_SUBST([IDN_ENABLED], [1])
3466     curl_idn_msg="enabled (icu-uc)"
3467     if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
3468       LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
3469       export LD_LIBRARY_PATH
3470       AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
3471     fi
3472   else
3473     AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3474     CPPFLAGS="$clean_CPPFLAGS"
3475     LDFLAGS="$clean_LDFLAGS"
3476     LIBS="$clean_LIBS"
3477   fi
3478
3479 fi
3480
3481 dnl Let's hope this split URL remains working:
3482 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
3483 dnl genprogc/thread_quick_ref.htm
3484
3485 dnl **********************************************************************
3486 dnl Check for DLP
3487 dnl **********************************************************************
3488
3489 AC_ARG_ENABLE([dlp],
3490     AS_HELP_STRING([--enable-dlp], [Enable DLP usage]))
3491
3492 AS_IF([test "x$enable_dlp" = "xyes"], [
3493     CPPFLAGS+=" -DUSE_TIZEN_FEATURE_DLP"
3494         LIBS="-ldl $LIBS"
3495 ])
3496
3497 AM_CONDITIONAL(USE_TIZEN_FEATURE_DLP, test "x$enable_dlp" = "xyes")
3498
3499
3500 dnl **********************************************************************
3501 dnl Check for nghttp2
3502 dnl **********************************************************************
3503
3504 OPT_H2="yes"
3505
3506 if test "x$disable_http" = "xyes"; then
3507   # without HTTP, nghttp2 is no use
3508   OPT_H2="no"
3509 fi
3510
3511 AC_ARG_WITH(nghttp2,
3512 AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3513 AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3514   [OPT_H2=$withval])
3515 case "$OPT_H2" in
3516   no)
3517     dnl --without-nghttp2 option used
3518     want_h2="no"
3519     ;;
3520   yes)
3521     dnl --with-nghttp2 option used without path
3522     want_h2="default"
3523     want_h2_path=""
3524     ;;
3525   *)
3526     dnl --with-nghttp2 option used with path
3527     want_h2="yes"
3528     want_h2_path="$withval/lib/pkgconfig"
3529     ;;
3530 esac
3531
3532 curl_h2_msg="disabled (--with-nghttp2)"
3533 if test X"$want_h2" != Xno; then
3534   dnl backup the pre-nghttp2 variables
3535   CLEANLDFLAGS="$LDFLAGS"
3536   CLEANCPPFLAGS="$CPPFLAGS"
3537   CLEANLIBS="$LIBS"
3538
3539   CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3540
3541   if test "$PKGCONFIG" != "no" ; then
3542     LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3543       $PKGCONFIG --libs-only-l libnghttp2`
3544     AC_MSG_NOTICE([-l is $LIB_H2])
3545
3546     CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3547       $PKGCONFIG --cflags-only-I libnghttp2`
3548     AC_MSG_NOTICE([-I is $CPP_H2])
3549
3550     LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3551       $PKGCONFIG --libs-only-L libnghttp2`
3552     AC_MSG_NOTICE([-L is $LD_H2])
3553
3554     LDFLAGS="$LDFLAGS $LD_H2"
3555     CPPFLAGS="$CPPFLAGS $CPP_H2"
3556     LIBS="$LIB_H2 $LIBS"
3557
3558     # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3559     # >= 1.0.0
3560     AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3561       [
3562        AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3563           curl_h2_msg="enabled (nghttp2)"
3564           NGHTTP2_ENABLED=1
3565           AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3566           AC_SUBST(USE_NGHTTP2, [1])
3567        )
3568       ],
3569         dnl not found, revert back to clean variables
3570         LDFLAGS=$CLEANLDFLAGS
3571         CPPFLAGS=$CLEANCPPFLAGS
3572         LIBS=$CLEANLIBS
3573     )
3574
3575   else
3576     dnl no nghttp2 pkg-config found, deal with it
3577     if test X"$want_h2" != Xdefault; then
3578       dnl To avoid link errors, we do not allow --with-nghttp2 without
3579       dnl a pkgconfig file
3580       AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3581     fi
3582   fi
3583
3584 fi
3585
3586 dnl **********************************************************************
3587 dnl Check for zsh completion path
3588 dnl **********************************************************************
3589
3590 OPT_ZSH_FPATH=default
3591 AC_ARG_WITH(zsh-functions-dir,
3592 AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3593 AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3594   [OPT_ZSH_FPATH=$withval])
3595 case "$OPT_ZSH_FPATH" in
3596   no)
3597     dnl --without-zsh-functions-dir option used
3598     ;;
3599   default|yes)
3600     dnl --with-zsh-functions-dir option used without path
3601     ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3602     AC_SUBST(ZSH_FUNCTIONS_DIR)
3603     ;;
3604   *)
3605     dnl --with-zsh-functions-dir option used with path
3606     ZSH_FUNCTIONS_DIR="$withval"
3607     AC_SUBST(ZSH_FUNCTIONS_DIR)
3608     ;;
3609 esac
3610
3611 dnl **********************************************************************
3612 dnl Back to "normal" configuring
3613 dnl **********************************************************************
3614
3615 dnl Checks for header files.
3616 AC_HEADER_STDC
3617
3618 CURL_CHECK_HEADER_MALLOC
3619 CURL_CHECK_HEADER_MEMORY
3620
3621 dnl Now check for the very most basic headers. Then we can use these
3622 dnl ones as default-headers when checking for the rest!
3623 AC_CHECK_HEADERS(
3624         sys/types.h \
3625         sys/time.h \
3626         sys/select.h \
3627         sys/socket.h \
3628         sys/ioctl.h \
3629         sys/uio.h \
3630         assert.h \
3631         unistd.h \
3632         stdlib.h \
3633         arpa/inet.h \
3634         net/if.h \
3635         netinet/in.h \
3636         netinet/in6.h \
3637         sys/un.h \
3638         linux/tcp.h \
3639         netinet/tcp.h \
3640         netdb.h \
3641         sys/sockio.h \
3642         sys/stat.h \
3643         sys/param.h \
3644         termios.h \
3645         termio.h \
3646         sgtty.h \
3647         fcntl.h \
3648         alloca.h \
3649         time.h \
3650         io.h \
3651         pwd.h \
3652         utime.h \
3653         sys/utime.h \
3654         sys/poll.h \
3655         poll.h \
3656         socket.h \
3657         sys/resource.h \
3658         libgen.h \
3659         locale.h \
3660         errno.h \
3661         stdbool.h \
3662         arpa/tftp.h \
3663         sys/filio.h \
3664         sys/wait.h \
3665         setjmp.h,
3666 dnl to do if not found
3667 [],
3668 dnl to do if found
3669 [],
3670 dnl default includes
3671 [
3672 #ifdef HAVE_SYS_TYPES_H
3673 #include <sys/types.h>
3674 #endif
3675 #ifdef HAVE_SYS_TIME_H
3676 #include <sys/time.h>
3677 #endif
3678 #ifdef HAVE_SYS_SELECT_H
3679 #include <sys/select.h>
3680 #endif
3681 #ifdef HAVE_SYS_SOCKET_H
3682 #include <sys/socket.h>
3683 #endif
3684 #ifdef HAVE_NETINET_IN_H
3685 #include <netinet/in.h>
3686 #endif
3687 #ifdef HAVE_NETINET_IN6_H
3688 #include <netinet/in6.h>
3689 #endif
3690 #ifdef HAVE_SYS_UN_H
3691 #include <sys/un.h>
3692 #endif
3693 ]
3694 )
3695
3696 dnl Checks for typedefs, structures, and compiler characteristics.
3697 AC_C_CONST
3698 CURL_CHECK_VARIADIC_MACROS
3699 AC_TYPE_SIZE_T
3700 AC_HEADER_TIME
3701 CURL_CHECK_STRUCT_TIMEVAL
3702 CURL_VERIFY_RUNTIMELIBS
3703
3704 AX_COMPILE_CHECK_SIZEOF(size_t)
3705 AX_COMPILE_CHECK_SIZEOF(long)
3706 AX_COMPILE_CHECK_SIZEOF(int)
3707 AX_COMPILE_CHECK_SIZEOF(short)
3708 AX_COMPILE_CHECK_SIZEOF(time_t)
3709 AX_COMPILE_CHECK_SIZEOF(off_t)
3710
3711 o=$CPPFLAGS
3712 CPPFLAGS="-I$srcdir/include $CPPFLAGS"
3713 AX_COMPILE_CHECK_SIZEOF(curl_off_t, [
3714 #include <curl/system.h>
3715 ])
3716 CPPFLAGS=$o
3717
3718 AC_CHECK_TYPE(long long,
3719    [AC_DEFINE(HAVE_LONGLONG, 1,
3720       [Define to 1 if the compiler supports the 'long long' data type.])]
3721    longlong="yes"
3722 )
3723
3724 if test "xyes" = "x$longlong"; then
3725   AC_MSG_CHECKING([if numberLL works])
3726   AC_COMPILE_IFELSE([
3727     AC_LANG_PROGRAM([[
3728     ]],[[
3729       long long val = 1000LL;
3730     ]])
3731   ],[
3732     AC_MSG_RESULT([yes])
3733     AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3734   ],[
3735     AC_MSG_RESULT([no])
3736   ])
3737 fi
3738
3739
3740 # check for ssize_t
3741 AC_CHECK_TYPE(ssize_t, ,
3742    AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3743
3744 # check for bool type
3745 AC_CHECK_TYPE([bool],[
3746   AC_DEFINE(HAVE_BOOL_T, 1,
3747     [Define to 1 if bool is an available type.])
3748 ], ,[
3749 #ifdef HAVE_SYS_TYPES_H
3750 #include <sys/types.h>
3751 #endif
3752 #ifdef HAVE_STDBOOL_H
3753 #include <stdbool.h>
3754 #endif
3755 ])
3756
3757 # check for sa_family_t
3758 AC_CHECK_TYPE(sa_family_t,
3759    AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
3760    [
3761    # The windows name?
3762    AC_CHECK_TYPE(ADDRESS_FAMILY,
3763      AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
3764      AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
3765     [
3766 #ifdef HAVE_SYS_SOCKET_H
3767 #include <sys/socket.h>
3768 #endif
3769     ])
3770    ],
3771 [
3772 #ifdef HAVE_SYS_SOCKET_H
3773 #include <sys/socket.h>
3774 #endif
3775 ])
3776
3777 AC_MSG_CHECKING([if time_t is unsigned])
3778 CURL_RUN_IFELSE(
3779   [
3780   #include <time.h>
3781   #include <limits.h>
3782   time_t t = -1;
3783   return (t > 0);
3784   ],[
3785   AC_MSG_RESULT([yes])
3786   AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
3787 ],[
3788   AC_MSG_RESULT([no])
3789 ],[
3790   dnl cross-compiling, most systems are unsigned
3791   AC_MSG_RESULT([no])
3792 ])
3793
3794 CURL_CONFIGURE_PULL_SYS_POLL
3795
3796 TYPE_IN_ADDR_T
3797
3798 TYPE_SOCKADDR_STORAGE
3799
3800 TYPE_SIG_ATOMIC_T
3801
3802 AC_TYPE_SIGNAL
3803
3804 CURL_CHECK_FUNC_SELECT
3805
3806 CURL_CHECK_FUNC_RECV
3807 CURL_CHECK_FUNC_SEND
3808 CURL_CHECK_MSG_NOSIGNAL
3809
3810 CURL_CHECK_FUNC_ALARM
3811 CURL_CHECK_FUNC_BASENAME
3812 CURL_CHECK_FUNC_CLOSESOCKET
3813 CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3814 CURL_CHECK_FUNC_CONNECT
3815 CURL_CHECK_FUNC_FCNTL
3816 CURL_CHECK_FUNC_FDOPEN
3817 CURL_CHECK_FUNC_FREEADDRINFO
3818 CURL_CHECK_FUNC_FREEIFADDRS
3819 CURL_CHECK_FUNC_FSETXATTR
3820 CURL_CHECK_FUNC_FTRUNCATE
3821 CURL_CHECK_FUNC_GETADDRINFO
3822 CURL_CHECK_FUNC_GAI_STRERROR
3823 CURL_CHECK_FUNC_GETHOSTBYADDR
3824 CURL_CHECK_FUNC_GETHOSTBYADDR_R
3825 CURL_CHECK_FUNC_GETHOSTBYNAME
3826 CURL_CHECK_FUNC_GETHOSTBYNAME_R
3827 CURL_CHECK_FUNC_GETHOSTNAME
3828 CURL_CHECK_FUNC_GETIFADDRS
3829 CURL_CHECK_FUNC_GETSERVBYPORT_R
3830 CURL_CHECK_FUNC_GMTIME_R
3831 CURL_CHECK_FUNC_INET_NTOA_R
3832 CURL_CHECK_FUNC_INET_NTOP
3833 CURL_CHECK_FUNC_INET_PTON
3834 CURL_CHECK_FUNC_IOCTL
3835 CURL_CHECK_FUNC_IOCTLSOCKET
3836 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3837 CURL_CHECK_FUNC_LOCALTIME_R
3838 CURL_CHECK_FUNC_MEMRCHR
3839 CURL_CHECK_FUNC_POLL
3840 CURL_CHECK_FUNC_SETSOCKOPT
3841 CURL_CHECK_FUNC_SIGACTION
3842 CURL_CHECK_FUNC_SIGINTERRUPT
3843 CURL_CHECK_FUNC_SIGNAL
3844 CURL_CHECK_FUNC_SIGSETJMP
3845 CURL_CHECK_FUNC_SOCKET
3846 CURL_CHECK_FUNC_SOCKETPAIR
3847 CURL_CHECK_FUNC_STRCASECMP
3848 CURL_CHECK_FUNC_STRCMPI
3849 CURL_CHECK_FUNC_STRDUP
3850 CURL_CHECK_FUNC_STRERROR_R
3851 CURL_CHECK_FUNC_STRICMP
3852 CURL_CHECK_FUNC_STRNCASECMP
3853 CURL_CHECK_FUNC_STRNCMPI
3854 CURL_CHECK_FUNC_STRNICMP
3855 CURL_CHECK_FUNC_STRSTR
3856 CURL_CHECK_FUNC_STRTOK_R
3857 CURL_CHECK_FUNC_STRTOLL
3858 CURL_CHECK_FUNC_WRITEV
3859
3860 case $host in
3861   *msdosdjgpp)
3862      ac_cv_func_pipe=no
3863      skipcheck_pipe=yes
3864      AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3865     ;;
3866 esac
3867
3868 AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
3869         [[#include <pwd.h>
3870           #include <sys/types.h>]])
3871
3872
3873 AC_CHECK_FUNCS([fnmatch \
3874   geteuid \
3875   getpass_r \
3876   getppid \
3877   getpwuid \
3878   getpwuid_r \
3879   getrlimit \
3880   gettimeofday \
3881   if_nametoindex \
3882   mach_absolute_time \
3883   pipe \
3884   setlocale \
3885   setmode \
3886   setrlimit \
3887   utime \
3888   utimes
3889 ],[
3890 ],[
3891   func="$ac_func"
3892   eval skipcheck=\$skipcheck_$func
3893   if test "x$skipcheck" != "xyes"; then
3894     AC_MSG_CHECKING([deeper for $func])
3895     AC_LINK_IFELSE([
3896       AC_LANG_PROGRAM([[
3897       ]],[[
3898         $func ();
3899       ]])
3900     ],[
3901       AC_MSG_RESULT([yes])
3902       eval "ac_cv_func_$func=yes"
3903       AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
3904         [Define to 1 if you have the $func function.])
3905     ],[
3906       AC_MSG_RESULT([but still no])
3907     ])
3908   fi
3909 ])
3910
3911 if test "$ipv6" = "yes"; then
3912   if test "$curl_cv_func_getaddrinfo" = "yes"; then
3913     AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3914     IPV6_ENABLED=1
3915     AC_SUBST(IPV6_ENABLED)
3916   fi
3917 fi
3918
3919 CURL_CHECK_NONBLOCKING_SOCKET
3920
3921 dnl ************************************************************
3922 dnl nroff tool stuff
3923 dnl
3924
3925 AC_PATH_PROG( PERL, perl, ,
3926   $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3927 AC_SUBST(PERL)
3928
3929 AC_PATH_PROGS( NROFF, gnroff nroff, ,
3930   $PATH:/usr/bin/:/usr/local/bin )
3931 AC_SUBST(NROFF)
3932
3933 if test -n "$NROFF"; then
3934   dnl only check for nroff options if an nroff command was found
3935
3936   AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3937   MANOPT="-man"
3938   mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3939   if test -z "$mancheck"; then
3940     MANOPT="-mandoc"
3941    mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3942     if test -z "$mancheck"; then
3943       MANOPT=""
3944       AC_MSG_RESULT([failed])
3945       AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3946     else
3947       AC_MSG_RESULT([$MANOPT])
3948     fi
3949   else
3950     AC_MSG_RESULT([$MANOPT])
3951   fi
3952   AC_SUBST(MANOPT)
3953 fi
3954
3955 if test -z "$MANOPT"
3956 then
3957   dnl if no nroff tool was found, or no option that could convert man pages
3958   dnl was found, then disable the built-in manual stuff
3959   AC_MSG_WARN([disabling built-in manual])
3960   USE_MANUAL="no";
3961 fi
3962
3963 dnl *************************************************************************
3964 dnl If the manual variable still is set, then we go with providing a built-in
3965 dnl manual
3966
3967 if test "$USE_MANUAL" = "1"; then
3968   AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3969   curl_manual_msg="enabled"
3970 fi
3971
3972 dnl set variable for use in automakefile(s)
3973 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3974
3975 CURL_CHECK_LIB_ARES
3976 AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3977
3978 if test "x$curl_cv_native_windows" != "xyes" &&
3979    test "x$enable_shared" = "xyes"; then
3980   build_libhostname=yes
3981 else
3982   build_libhostname=no
3983 fi
3984 AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3985
3986 if test "x$want_ares" != xyes; then
3987   CURL_CHECK_OPTION_THREADED_RESOLVER
3988 fi
3989
3990 dnl ************************************************************
3991 dnl disable POSIX threads
3992 dnl
3993 AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3994 AC_ARG_ENABLE(pthreads,
3995 AC_HELP_STRING([--enable-pthreads],
3996                [Enable POSIX threads (default for threaded resolver)])
3997 AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
3998 [ case "$enableval" in
3999   no)  AC_MSG_RESULT(no)
4000        want_pthreads=no
4001        ;;
4002   *)   AC_MSG_RESULT(yes)
4003        want_pthreads=yes
4004        ;;
4005   esac ], [
4006        AC_MSG_RESULT(auto)
4007        want_pthreads=auto
4008        ]
4009 )
4010
4011 dnl turn off pthreads if rt is disabled
4012 if test "$want_pthreads" != "no"; then
4013   if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
4014     AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
4015   fi
4016   if test "$dontwant_rt" != "no"; then
4017     dnl if --enable-pthreads was explicit then warn it's being ignored
4018     if test "$want_pthreads" = "yes"; then
4019       AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
4020     fi
4021     want_pthreads=no
4022   fi
4023 fi
4024
4025 dnl turn off pthreads if no threaded resolver
4026 if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
4027   want_pthreads=no
4028 fi
4029
4030 dnl detect pthreads
4031 if test "$want_pthreads" != "no"; then
4032   AC_CHECK_HEADER(pthread.h,
4033     [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
4034       save_CFLAGS="$CFLAGS"
4035
4036       dnl first check for function without lib
4037       AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
4038
4039       dnl on HPUX, life is more complicated...
4040       case $host in
4041       *-hp-hpux*)
4042          dnl it doesn't actually work without -lpthread
4043          USE_THREADS_POSIX=""
4044          ;;
4045       *)
4046          ;;
4047       esac
4048
4049       dnl if it wasn't found without lib, search for it in pthread lib
4050       if test "$USE_THREADS_POSIX" != "1"
4051       then
4052         CFLAGS="$CFLAGS -pthread"
4053         AC_CHECK_LIB(pthread, pthread_create,
4054                      [USE_THREADS_POSIX=1],
4055                      [ CFLAGS="$save_CFLAGS"])
4056       fi
4057
4058       if test "x$USE_THREADS_POSIX" = "x1"
4059       then
4060         AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
4061         curl_res_msg="POSIX threaded"
4062       fi
4063   ])
4064 fi
4065
4066 dnl threaded resolver check
4067 if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
4068   if test "$want_pthreads" = "yes"; then
4069     AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
4070   fi
4071   dnl If native Windows fallback on Win32 threads since no POSIX threads
4072   if test "$curl_cv_native_windows" = "yes"; then
4073     USE_THREADS_WIN32=1
4074     AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
4075     curl_res_msg="Win32 threaded"
4076   else
4077     AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
4078   fi
4079 fi
4080
4081 dnl ************************************************************
4082 dnl disable verbose text strings
4083 dnl
4084 AC_MSG_CHECKING([whether to enable verbose strings])
4085 AC_ARG_ENABLE(verbose,
4086 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
4087 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
4088 [ case "$enableval" in
4089   no)
4090        AC_MSG_RESULT(no)
4091        AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
4092        curl_verbose_msg="no"
4093        ;;
4094   *)   AC_MSG_RESULT(yes)
4095        ;;
4096   esac ],
4097        AC_MSG_RESULT(yes)
4098 )
4099
4100 dnl ************************************************************
4101 dnl enable SSPI support
4102 dnl
4103 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
4104 AC_ARG_ENABLE(sspi,
4105 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
4106 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
4107 [ case "$enableval" in
4108   yes)
4109        if test "$curl_cv_native_windows" = "yes"; then
4110          AC_MSG_RESULT(yes)
4111          AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
4112          AC_SUBST(USE_WINDOWS_SSPI, [1])
4113          curl_sspi_msg="enabled"
4114        else
4115          AC_MSG_RESULT(no)
4116          AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
4117        fi
4118        ;;
4119   *)
4120        if test "x$WINSSL_ENABLED" = "x1"; then
4121          # --with-winssl implies --enable-sspi
4122          AC_MSG_RESULT(yes)
4123        else
4124          AC_MSG_RESULT(no)
4125        fi
4126        ;;
4127   esac ],
4128        if test "x$WINSSL_ENABLED" = "x1"; then
4129          # --with-winssl implies --enable-sspi
4130          AC_MSG_RESULT(yes)
4131        else
4132          AC_MSG_RESULT(no)
4133        fi
4134 )
4135
4136 dnl ************************************************************
4137 dnl disable cryptographic authentication
4138 dnl
4139 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
4140 AC_ARG_ENABLE(crypto-auth,
4141 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
4142 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
4143 [ case "$enableval" in
4144   no)
4145        AC_MSG_RESULT(no)
4146        AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
4147        CURL_DISABLE_CRYPTO_AUTH=1
4148        ;;
4149   *)   AC_MSG_RESULT(yes)
4150        ;;
4151   esac ],
4152        AC_MSG_RESULT(yes)
4153 )
4154
4155 CURL_CHECK_OPTION_NTLM_WB
4156
4157 CURL_CHECK_NTLM_WB
4158
4159 dnl ************************************************************
4160 dnl disable TLS-SRP authentication
4161 dnl
4162 AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
4163 AC_ARG_ENABLE(tls-srp,
4164 AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
4165 AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
4166 [ case "$enableval" in
4167   no)
4168        AC_MSG_RESULT(no)
4169        AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
4170        want_tls_srp=no
4171        ;;
4172   *)   AC_MSG_RESULT(yes)
4173        want_tls_srp=yes
4174        ;;
4175   esac ],
4176        AC_MSG_RESULT(yes)
4177        want_tls_srp=yes
4178 )
4179
4180 if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
4181    AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
4182    USE_TLS_SRP=1
4183    curl_tls_srp_msg="enabled"
4184 fi
4185
4186 dnl ************************************************************
4187 dnl disable Unix domain sockets support
4188 dnl
4189 AC_MSG_CHECKING([whether to enable Unix domain sockets])
4190 AC_ARG_ENABLE(unix-sockets,
4191 AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
4192 AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
4193 [ case "$enableval" in
4194   no)  AC_MSG_RESULT(no)
4195        want_unix_sockets=no
4196        ;;
4197   *)   AC_MSG_RESULT(yes)
4198        want_unix_sockets=yes
4199        ;;
4200   esac ], [
4201        AC_MSG_RESULT(auto)
4202        want_unix_sockets=auto
4203        ]
4204 )
4205 if test "x$want_unix_sockets" != "xno"; then
4206   AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
4207     AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
4208     AC_SUBST(USE_UNIX_SOCKETS, [1])
4209     curl_unix_sockets_msg="enabled"
4210   ], [
4211     if test "x$want_unix_sockets" = "xyes"; then
4212       AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
4213     fi
4214   ], [
4215     #include <sys/un.h>
4216   ])
4217 fi
4218
4219 dnl ************************************************************
4220 dnl disable cookies support
4221 dnl
4222 AC_MSG_CHECKING([whether to enable support for cookies])
4223 AC_ARG_ENABLE(cookies,
4224 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
4225 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
4226 [ case "$enableval" in
4227   no)
4228        AC_MSG_RESULT(no)
4229        AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
4230        ;;
4231   *)   AC_MSG_RESULT(yes)
4232        ;;
4233   esac ],
4234        AC_MSG_RESULT(yes)
4235 )
4236
4237 dnl ************************************************************
4238 dnl hiding of library internal symbols
4239 dnl
4240 CURL_CONFIGURE_SYMBOL_HIDING
4241
4242 dnl
4243 dnl All the library dependencies put into $LIB apply to libcurl only.
4244 dnl
4245 LIBCURL_LIBS=$LIBS
4246
4247 AC_SUBST(LIBCURL_LIBS)
4248 AC_SUBST(CURL_NETWORK_LIBS)
4249 AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
4250
4251 dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
4252 dnl LIBS variable used in generated makefile at makefile processing
4253 dnl time. Doing this functionally prevents LIBS from being used for
4254 dnl all link targets in given makefile.
4255 BLANK_AT_MAKETIME=
4256 AC_SUBST(BLANK_AT_MAKETIME)
4257
4258 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
4259
4260 dnl yes or no
4261 ENABLE_SHARED="$enable_shared"
4262 AC_SUBST(ENABLE_SHARED)
4263
4264 dnl to let curl-config output the static libraries correctly
4265 ENABLE_STATIC="$enable_static"
4266 AC_SUBST(ENABLE_STATIC)
4267
4268
4269 dnl
4270 dnl For keeping supported features and protocols also in pkg-config file
4271 dnl since it is more cross-compile friendly than curl-config
4272 dnl
4273
4274 if test "x$OPENSSL_ENABLED" = "x1"; then
4275   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4276 elif test -n "$SSL_ENABLED"; then
4277   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4278 fi
4279 if test "x$IPV6_ENABLED" = "x1"; then
4280   SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
4281 fi
4282 if test "x$USE_UNIX_SOCKETS" = "x1"; then
4283   SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
4284 fi
4285 if test "x$HAVE_LIBZ" = "x1"; then
4286   SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
4287 fi
4288 if test "x$HAVE_BROTLI" = "x1"; then
4289   SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
4290 fi
4291 if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
4292                             -o "x$USE_THREADS_WIN32" = "x1"; then
4293   SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
4294 fi
4295 if test "x$IDN_ENABLED" = "x1"; then
4296   SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
4297 fi
4298 if test "x$USE_WINDOWS_SSPI" = "x1"; then
4299   SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
4300 fi
4301
4302 if test "x$HAVE_GSSAPI" = "x1"; then
4303   SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
4304 fi
4305
4306 if test "x$curl_psl_msg" = "xyes"; then
4307   SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
4308 fi
4309
4310 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4311     \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4312   SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
4313 fi
4314
4315 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4316     \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4317   SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
4318 fi
4319
4320 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
4321   if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
4322       -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4323       -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then
4324     SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
4325
4326     if test "x$CURL_DISABLE_HTTP" != "x1" -a \
4327         "x$NTLM_WB_ENABLED" = "x1"; then
4328       SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
4329     fi
4330   fi
4331 fi
4332
4333 if test "x$USE_TLS_SRP" = "x1"; then
4334   SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
4335 fi
4336
4337 if test "x$USE_NGHTTP2" = "x1"; then
4338   SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
4339 fi
4340
4341 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
4342   SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
4343 fi
4344
4345 if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
4346     -o "x$NSS_ENABLED" = "x1"; then
4347   SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
4348 fi
4349
4350 AC_SUBST(SUPPORT_FEATURES)
4351
4352 dnl For supported protocols in pkg-config file
4353 if test "x$CURL_DISABLE_HTTP" != "x1"; then
4354   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
4355   if test "x$SSL_ENABLED" = "x1"; then
4356     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
4357   fi
4358 fi
4359 if test "x$CURL_DISABLE_FTP" != "x1"; then
4360   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
4361   if test "x$SSL_ENABLED" = "x1"; then
4362     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
4363   fi
4364 fi
4365 if test "x$CURL_DISABLE_FILE" != "x1"; then
4366   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
4367 fi
4368 if test "x$CURL_DISABLE_TELNET" != "x1"; then
4369   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
4370 fi
4371 if test "x$CURL_DISABLE_LDAP" != "x1"; then
4372   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
4373   if test "x$CURL_DISABLE_LDAPS" != "x1"; then
4374     if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
4375       (test "x$USE_OPENLDAP" != "x1"  && test "x$HAVE_LDAP_SSL" = "x1"); then
4376       SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
4377     fi
4378   fi
4379 fi
4380 if test "x$CURL_DISABLE_DICT" != "x1"; then
4381   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
4382 fi
4383 if test "x$CURL_DISABLE_TFTP" != "x1"; then
4384   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
4385 fi
4386 if test "x$CURL_DISABLE_GOPHER" != "x1"; then
4387   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
4388 fi
4389 if test "x$CURL_DISABLE_POP3" != "x1"; then
4390   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
4391   if test "x$SSL_ENABLED" = "x1"; then
4392     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
4393   fi
4394 fi
4395 if test "x$CURL_DISABLE_IMAP" != "x1"; then
4396   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
4397   if test "x$SSL_ENABLED" = "x1"; then
4398     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
4399   fi
4400 fi
4401 if test "x$CURL_DISABLE_SMB" != "x1" \
4402     -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
4403     -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
4404       -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4405       -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then
4406   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
4407   if test "x$SSL_ENABLED" = "x1"; then
4408     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4409   fi
4410 fi
4411 if test "x$CURL_DISABLE_SMTP" != "x1"; then
4412   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4413   if test "x$SSL_ENABLED" = "x1"; then
4414     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4415   fi
4416 fi
4417 if test "x$USE_LIBSSH2" = "x1"; then
4418   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4419   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4420 fi
4421 if test "x$USE_LIBSSH" = "x1"; then
4422   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4423   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4424 fi
4425 if test "x$CURL_DISABLE_RTSP" != "x1"; then
4426   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4427 fi
4428 if test "x$USE_LIBRTMP" = "x1"; then
4429   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4430 fi
4431
4432 dnl replace spaces with newlines
4433 dnl sort the lines
4434 dnl replace the newlines back to spaces
4435 SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4436
4437 AC_SUBST(SUPPORT_PROTOCOLS)
4438
4439 dnl squeeze whitespace out of some variables
4440
4441 squeeze CFLAGS
4442 squeeze CPPFLAGS
4443 squeeze DEFS
4444 squeeze LDFLAGS
4445 squeeze LIBS
4446
4447 squeeze LIBCURL_LIBS
4448 squeeze CURL_NETWORK_LIBS
4449 squeeze CURL_NETWORK_AND_TIME_LIBS
4450
4451 squeeze SUPPORT_FEATURES
4452 squeeze SUPPORT_PROTOCOLS
4453
4454 XC_CHECK_BUILD_FLAGS
4455
4456 SSL_BACKENDS=${ssl_backends}
4457 AC_SUBST(SSL_BACKENDS)
4458
4459 if test "x$want_curldebug_assumed" = "xyes" &&
4460   test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4461   ac_configure_args="$ac_configure_args --enable-curldebug"
4462 fi
4463
4464 AC_CONFIG_FILES([Makefile \
4465            docs/Makefile \
4466            docs/examples/Makefile \
4467            docs/libcurl/Makefile \
4468            docs/libcurl/opts/Makefile \
4469            docs/cmdline-opts/Makefile \
4470            include/Makefile \
4471            include/curl/Makefile \
4472            src/Makefile \
4473            lib/Makefile \
4474            extensions/Makefile \
4475            scripts/Makefile \
4476            lib/libcurl.vers \
4477            tests/Makefile \
4478            tests/certs/Makefile \
4479            tests/certs/scripts/Makefile \
4480            tests/data/Makefile \
4481            tests/server/Makefile \
4482            tests/libtest/Makefile \
4483            tests/unit/Makefile \
4484            packages/Makefile \
4485            packages/Win32/Makefile \
4486            packages/Win32/cygwin/Makefile \
4487            packages/Linux/Makefile \
4488            packages/Linux/RPM/Makefile \
4489            packages/Linux/RPM/curl.spec \
4490            packages/Linux/RPM/curl-ssl.spec \
4491            packages/Solaris/Makefile \
4492            packages/vms/Makefile \
4493            packages/AIX/Makefile \
4494            packages/AIX/RPM/Makefile \
4495            packages/AIX/RPM/curl.spec \
4496            curl-config \
4497            libcurl.pc
4498 ])
4499 AC_OUTPUT
4500
4501 CURL_GENERATE_CONFIGUREHELP_PM
4502
4503 XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4504
4505 AC_MSG_NOTICE([Configured to build curl/libcurl:
4506
4507   curl version:     ${CURLVERSION}
4508   Host setup:       ${host}
4509   Install prefix:   ${prefix}
4510   Compiler:         ${CC}
4511   SSL support:      ${curl_ssl_msg}
4512   SSH support:      ${curl_ssh_msg}
4513   zlib support:     ${curl_zlib_msg}
4514   brotli support:   ${curl_brotli_msg}
4515   GSS-API support:  ${curl_gss_msg}
4516   TLS-SRP support:  ${curl_tls_srp_msg}
4517   resolver:         ${curl_res_msg}
4518   IPv6 support:     ${curl_ipv6_msg}
4519   Unix sockets support: ${curl_unix_sockets_msg}
4520   IDN support:      ${curl_idn_msg}
4521   Build libcurl:    Shared=${enable_shared}, Static=${enable_static}
4522   Built-in manual:  ${curl_manual_msg}
4523   --libcurl option: ${curl_libcurl_msg}
4524   Verbose errors:   ${curl_verbose_msg}
4525   SSPI support:     ${curl_sspi_msg}
4526   ca cert bundle:   ${ca}${ca_warning}
4527   ca cert path:     ${capath}${capath_warning}
4528   ca fallback:      ${with_ca_fallback}
4529   LDAP support:     ${curl_ldap_msg}
4530   LDAPS support:    ${curl_ldaps_msg}
4531   RTSP support:     ${curl_rtsp_msg}
4532   RTMP support:     ${curl_rtmp_msg}
4533   metalink support: ${curl_mtlnk_msg}
4534   PSL support:      ${curl_psl_msg}
4535   HTTP2 support:    ${curl_h2_msg}
4536   Protocols:        ${SUPPORT_PROTOCOLS}
4537 ])