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