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