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