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