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