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