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