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