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