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