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