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