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