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