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