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