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