blob: 0c23847033ecb31c323d28750ec08630bc85506e [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Elliott Hughes34dd5f42021-08-10 13:01:18 -07008# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07009#
10# This software is licensed as described in the file COPYING, which
11# you should have received as part of this distribution. The terms
Elliott Hughes34dd5f42021-08-10 13:01:18 -070012# are also available at https://curl.se/docs/copyright.html.
Lucas Eckels9bd90e62012-08-06 15:07:02 -070013#
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21#***************************************************************************
22dnl Process this file with autoconf to produce a configure script.
23
Elliott Hughes34dd5f42021-08-10 13:01:18 -070024AC_PREREQ(2.59)
Lucas Eckels9bd90e62012-08-06 15:07:02 -070025
26dnl We don't know the version number "statically" so we use a dash here
Elliott Hughes34dd5f42021-08-10 13:01:18 -070027AC_INIT([curl], [-], [a suitable curl mailing list: https://curl.se/mail/])
Lucas Eckels9bd90e62012-08-06 15:07:02 -070028
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070029XC_OVR_ZZ50
30XC_OVR_ZZ60
Lucas Eckels9bd90e62012-08-06 15:07:02 -070031CURL_OVERRIDE_AUTOCONF
32
33dnl configure script copyright
Elliott Hughes34dd5f42021-08-10 13:01:18 -070034AC_COPYRIGHT([Copyright (c) 1998 - 2021 Daniel Stenberg, <daniel@haxx.se>
Lucas Eckels9bd90e62012-08-06 15:07:02 -070035This configure script may be copied, distributed and modified under the
36terms of the curl license; see COPYING for more details])
37
38AC_CONFIG_SRCDIR([lib/urldata.h])
Elliott Hughes82be86d2017-09-20 17:00:17 -070039AC_CONFIG_HEADERS(lib/curl_config.h)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070040AC_CONFIG_MACRO_DIR([m4])
Lucas Eckels9bd90e62012-08-06 15:07:02 -070041AM_MAINTAINER_MODE
Alex Deymod15eaac2016-06-28 14:49:26 -070042m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -070043
44CURL_CHECK_OPTION_DEBUG
45CURL_CHECK_OPTION_OPTIMIZE
46CURL_CHECK_OPTION_WARNINGS
47CURL_CHECK_OPTION_WERROR
48CURL_CHECK_OPTION_CURLDEBUG
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070049CURL_CHECK_OPTION_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -070050CURL_CHECK_OPTION_ARES
Alex Deymod15eaac2016-06-28 14:49:26 -070051CURL_CHECK_OPTION_RT
Haibo Huangb5a52b92020-10-28 22:18:23 -070052CURL_CHECK_OPTION_ECH
Lucas Eckels9bd90e62012-08-06 15:07:02 -070053
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070054XC_CHECK_PATH_SEPARATOR
Lucas Eckels9bd90e62012-08-06 15:07:02 -070055
56#
57# save the configure arguments
58#
59CONFIGURE_OPTIONS="\"$ac_configure_args\""
60AC_SUBST(CONFIGURE_OPTIONS)
61
Lucas Eckels9bd90e62012-08-06 15:07:02 -070062dnl SED is mandatory for configure process and libtool.
63dnl Set it now, allowing it to be changed later.
64if test -z "$SED"; then
65 dnl allow it to be overridden
66 AC_PATH_PROG([SED], [sed], [not_found],
67 [$PATH:/usr/bin:/usr/local/bin])
68 if test -z "$SED" || test "$SED" = "not_found"; then
69 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
70 fi
71fi
72AC_SUBST([SED])
73
74dnl GREP is mandatory for configure process and libtool.
75dnl Set it now, allowing it to be changed later.
76if test -z "$GREP"; then
77 dnl allow it to be overridden
78 AC_PATH_PROG([GREP], [grep], [not_found],
79 [$PATH:/usr/bin:/usr/local/bin])
80 if test -z "$GREP" || test "$GREP" = "not_found"; then
81 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
82 fi
83fi
84AC_SUBST([GREP])
85
86dnl EGREP is mandatory for configure process and libtool.
87dnl Set it now, allowing it to be changed later.
88if test -z "$EGREP"; then
89 dnl allow it to be overridden
90 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
91 AC_MSG_CHECKING([for egrep])
92 EGREP="$GREP -E"
93 AC_MSG_RESULT([$EGREP])
94 else
95 AC_PATH_PROG([EGREP], [egrep], [not_found],
96 [$PATH:/usr/bin:/usr/local/bin])
97 fi
98fi
99if test -z "$EGREP" || test "$EGREP" = "not_found"; then
100 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
101fi
102AC_SUBST([EGREP])
103
104dnl AR is mandatory for configure process and libtool.
105dnl This is target dependent, so check it as a tool.
106if test -z "$AR"; then
107 dnl allow it to be overridden
108 AC_PATH_TOOL([AR], [ar], [not_found],
109 [$PATH:/usr/bin:/usr/local/bin])
110 if test -z "$AR" || test "$AR" = "not_found"; then
111 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
112 fi
113fi
114AC_SUBST([AR])
115
116AC_SUBST(libext)
117
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700118dnl figure out the libcurl version
Elliott Hughes82be86d2017-09-20 17:00:17 -0700119CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700120XC_CHECK_PROG_CC
Elliott Hughes0128fe42018-02-27 14:57:55 -0800121
Haibo Huang51d9d882019-02-06 01:36:06 -0800122dnl for --enable-code-coverage
123CURL_COVERAGE
Elliott Hughes0128fe42018-02-27 14:57:55 -0800124
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700125XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700126AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700127AC_MSG_RESULT($CURLVERSION)
128
129AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700130
131dnl
132dnl we extract the numerical version for curl-config only
Elliott Hughes82be86d2017-09-20 17:00:17 -0700133VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\([0-9A-Fa-f]*\).*/\1/p' ${srcdir}/include/curl/curlver.h`
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700134AC_SUBST(VERSIONNUM)
135
136dnl Solaris pkgadd support definitions
137PKGADD_PKG="HAXXcurl"
Elliott Hughescee03382017-06-23 12:17:18 -0700138PKGADD_NAME="curl - a client that groks URLs"
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700139PKGADD_VENDOR="curl.se"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700140AC_SUBST(PKGADD_PKG)
141AC_SUBST(PKGADD_NAME)
142AC_SUBST(PKGADD_VENDOR)
143
144dnl
145dnl initialize all the info variables
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700146 curl_ssl_msg="no (--with-{openssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,mesalink,amissl,bearssl,rustls} )"
Haibo Huangb51266f2020-03-04 02:22:48 -0800147 curl_ssh_msg="no (--with-{libssh,libssh2})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700148 curl_zlib_msg="no (--with-zlib)"
Alex Deymo486467e2017-12-19 19:04:07 +0100149 curl_brotli_msg="no (--with-brotli)"
Haibo Huangc3c04f42020-08-19 13:00:07 -0700150 curl_zstd_msg="no (--with-zstd)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700151 curl_gss_msg="no (--with-gssapi)"
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700152 curl_gsasl_msg="no (--with-gsasl)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700153curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700154 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
155 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700156curl_unix_sockets_msg="no (--enable-unix-sockets)"
Elliott Hughescee03382017-06-23 12:17:18 -0700157 curl_idn_msg="no (--with-{libidn2,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700158 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700159curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700160curl_verbose_msg="enabled (--disable-verbose)"
161 curl_sspi_msg="no (--enable-sspi)"
162 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
163 curl_ldaps_msg="no (--enable-ldaps)"
164 curl_rtsp_msg="no (--enable-rtsp)"
165 curl_rtmp_msg="no (--with-librtmp)"
Alex Deymod15eaac2016-06-28 14:49:26 -0700166 curl_psl_msg="no (--with-libpsl)"
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700167 curl_altsvc_msg="enabled (--disable-alt-svc)"
168 curl_hsts_msg="enabled (--disable-hsts)"
Alex Deymo486467e2017-12-19 19:04:07 +0100169 ssl_backends=
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700170 curl_h1_msg="enabled (internal)"
171 curl_h2_msg="no (--with-nghttp2, --with-hyper)"
172 curl_h3_msg="no (--with-ngtcp2, --with-quiche)"
173
174enable_altsvc="yes"
Elliott Hughesf344baa2021-12-07 09:12:34 -0800175hsts="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700176
177dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700178dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700179dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700180INITIAL_LDFLAGS=$LDFLAGS
181INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700182
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700183dnl **********************************************************************
184dnl See which TLS backend(s) that are requested. Just do all the
185dnl TLS AC_ARG_WITH() invokes here and do the checks later
186dnl **********************************************************************
187OPT_SCHANNEL=no
188AC_ARG_WITH(schannel,dnl
189AS_HELP_STRING([--with-schannel],[enable Windows native SSL/TLS]),
190 OPT_SCHANNEL=$withval
191 TLSCHOICE="schannel")
192
193OPT_SECURETRANSPORT=no
194AC_ARG_WITH(secure-transport,dnl
195AS_HELP_STRING([--with-secure-transport],[enable Apple OS native SSL/TLS]),
196 OPT_SECURETRANSPORT=$withval
197 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }Secure-Transport"
198)
199
200OPT_AMISSL=no
201AC_ARG_WITH(amissl,dnl
202AS_HELP_STRING([--with-amissl],[enable Amiga native SSL/TLS (AmiSSL)]),
203 OPT_AMISSL=$withval
204 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }AmiSSL")
205
206OPT_OPENSSL=no
207dnl Default to no CA bundle
208ca="no"
209AC_ARG_WITH(ssl,dnl
210AS_HELP_STRING([--with-ssl=PATH],[old version of --with-openssl])
211AS_HELP_STRING([--without-ssl], [build without any TLS library]),
212 OPT_SSL=$withval
213 OPT_OPENSSL=$withval
214 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }OpenSSL")
215
216AC_ARG_WITH(openssl,dnl
217AS_HELP_STRING([--with-openssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option]),
218 OPT_OPENSSL=$withval
219 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }OpenSSL")
220
221OPT_GNUTLS=no
222AC_ARG_WITH(gnutls,dnl
223AS_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root]),
224 OPT_GNUTLS=$withval
225 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }GnuTLS")
226
227OPT_MBEDTLS=no
228AC_ARG_WITH(mbedtls,dnl
229AS_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root]),
230 OPT_MBEDTLS=$withval
231 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }mbedTLS")
232
233OPT_WOLFSSL=no
234AC_ARG_WITH(wolfssl,dnl
235AS_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)]),
236 OPT_WOLFSSL=$withval
237 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }wolfSSL")
238
239OPT_MESALINK=no
240AC_ARG_WITH(mesalink,dnl
241AS_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root]),
242 OPT_MESALINK=$withval
243 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }MesaLink")
244
245OPT_BEARSSL=no
246AC_ARG_WITH(bearssl,dnl
247AS_HELP_STRING([--with-bearssl=PATH],[where to look for BearSSL, PATH points to the installation root]),
248 OPT_BEARSSL=$withval
249 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }BearSSL")
250
251OPT_RUSTLS=no
252AC_ARG_WITH(rustls,dnl
253AS_HELP_STRING([--with-rustls=PATH],[where to look for rustls, PATH points to the installation root]),
254 OPT_RUSTLS=$withval
255 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }rustls")
256
257OPT_NSS=no
258AC_ARG_WITH(nss,dnl
259AS_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root]),
260 OPT_NSS=$withval
261 test -z "TLSCHOICE" || TLSCHOICE="${TLSCHOICE:+$TLSCHOICE, }NSS")
262
263dnl If no TLS choice has been made, check if it was explicitly disabled or
264dnl error out to force the user to decide.
265if test -z "$TLSCHOICE"; then
266 if test "x$OPT_SSL" != "xno"; then
267 AC_MSG_ERROR([select TLS backend(s) or disable TLS with --without-ssl.
268
269Select from these:
270
271 --with-amissl
272 --with-bearssl
273 --with-gnutls
274 --with-mbedtls
275 --with-mesalink
276 --with-nss
277 --with-openssl (also works for BoringSSL and libressl)
278 --with-rustls
279 --with-schannel
280 --with-secure-transport
281 --with-wolfssl
282])
283 fi
284fi
285
286AC_ARG_WITH(darwinssl,,
287 AC_MSG_ERROR([--with-darwin-ssl no longer works!]))
288
Elliott Hughes82be86d2017-09-20 17:00:17 -0700289dnl
290dnl Detect the canonical host and target build environment
291dnl
292
293AC_CANONICAL_HOST
294dnl Get system canonical name
295AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
296
Elliott Hughes72d948d2018-08-03 14:37:21 -0700297# Silence warning: ar: 'u' modifier ignored since 'D' is the default
298AC_SUBST(AR_FLAGS, [cr])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700299
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700300dnl This defines _ALL_SOURCE for AIX
301CURL_CHECK_AIX_ALL_SOURCE
302
303dnl Our configure and build reentrant settings
304CURL_CONFIGURE_THREAD_SAFE
305CURL_CONFIGURE_REENTRANT
306
307dnl check for how to do large files
308AC_SYS_LARGEFILE
309
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700310XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700311
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700312#
313# Automake conditionals based on libtool related checks
314#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700315
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700316AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
317 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
318AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
319 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
320AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
321 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700322
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700323#
324# Due to libtool and automake machinery limitations of not allowing
325# specifying separate CPPFLAGS or CFLAGS when compiling objects for
326# inclusion of these in shared or static libraries, we are forced to
327# build using separate configure runs for shared and static libraries
328# on systems where different CPPFLAGS or CFLAGS are mandatory in order
329# to compile objects for each kind of library. Notice that relying on
330# the '-DPIC' CFLAG that libtool provides is not valid given that the
331# user might for example choose to build static libraries with PIC.
332#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700333
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700334#
335# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
336# targeting a static library and not building its shared counterpart.
337#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700338
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700339AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
340 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700341
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700342#
343# Make staticlib CPPFLAG variable and its definition visible in output
344# files unconditionally, providing an empty definition unless strictly
345# targeting a static library and not building its shared counterpart.
346#
347
348CPPFLAG_CURL_STATICLIB=
349if test "x$xc_lt_build_static_only" = 'xyes'; then
350 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
351fi
352AC_SUBST([CPPFLAG_CURL_STATICLIB])
353
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700354
355# Determine whether all dependent libraries must be specified when linking
356if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
357then
358 REQUIRE_LIB_DEPS=no
359else
360 REQUIRE_LIB_DEPS=yes
361fi
362AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700363AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700364
365dnl check if there's a way to force code inline
366AC_C_INLINE
367
368dnl **********************************************************************
369dnl platform/compiler/architecture specific checks/flags
370dnl **********************************************************************
371
372CURL_CHECK_COMPILER
373CURL_SET_COMPILER_BASIC_OPTS
374CURL_SET_COMPILER_DEBUG_OPTS
375CURL_SET_COMPILER_OPTIMIZE_OPTS
376CURL_SET_COMPILER_WARNING_OPTS
377
378if test "$compiler_id" = "INTEL_UNIX_C"; then
379 #
380 if test "$compiler_num" -ge "1000"; then
381 dnl icc 10.X or later
382 CFLAGS="$CFLAGS -shared-intel"
383 elif test "$compiler_num" -ge "900"; then
384 dnl icc 9.X specific
385 CFLAGS="$CFLAGS -i-dynamic"
386 fi
387 #
388fi
389
Haibo Huang24c77a12020-04-29 13:49:57 -0700390CURL_CFLAG_EXTRAS=""
391if test X"$want_werror" = Xyes; then
392 CURL_CFLAG_EXTRAS="-Werror"
393 if test "$compiler_id" = "GNU_C"; then
394 dnl enable -pedantic-errors for GCC 5 and later,
395 dnl as before that it was the same as -Werror=pedantic
396 if test "$compiler_num" -ge "500"; then
397 CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
398 fi
399 fi
400fi
401AC_SUBST(CURL_CFLAG_EXTRAS)
402
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700403CURL_CHECK_COMPILER_HALT_ON_ERROR
404CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700405CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
406CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700407
408CURL_CHECK_CURLDEBUG
409AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
410
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700411supports_unittests=yes
412# cross-compilation of unit tests static library/programs fails when
413# libcurl shared library is built. This might be due to a libtool or
414# automake issue. In this case we disable unit tests.
415if test "x$cross_compiling" != "xno" &&
416 test "x$enable_shared" != "xno"; then
417 supports_unittests=no
418fi
419
420# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
421# a problem related with OpenSSL headers and library versions not matching.
422# Disable unit tests while time to further investigate this is found.
423case $host in
424 mips-sgi-irix6.5)
425 if test "$compiler_id" = "GNU_C"; then
426 supports_unittests=no
427 fi
428 ;;
429esac
430
431# All AIX autobuilds fails unit tests linking against unittests library
432# due to unittests library being built with no symbols or members. Libtool ?
433# Disable unit tests while time to further investigate this is found.
434case $host_os in
435 aix*)
436 supports_unittests=no
437 ;;
438esac
439
440dnl Build unit tests when option --enable-debug is given.
441if test "x$want_debug" = "xyes" &&
442 test "x$supports_unittests" = "xyes"; then
443 want_unittests=yes
444else
445 want_unittests=no
446fi
447AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
448
Elliott Hughesf344baa2021-12-07 09:12:34 -0800449# For original MinGW (ie not MinGW-w64) define the Windows minimum supported OS
450# version to Windows XP (0x501) if it hasn't already been defined by the user.
451# Without this override original MinGW defaults the version to Windows NT 4.0.
452# Note original MinGW sets _WIN32_WINNT if not defined to whatever WINVER is.
453case $host in
454 *-*-mingw32*)
455 AC_MSG_CHECKING([if MinGW minimum supported OS should be set to XP])
456 AC_COMPILE_IFELSE([
457 AC_LANG_PROGRAM([[
458#include <_mingw.h>
459 ]],[[
460#if defined(__MINGW64_VERSION_MAJOR) || \
461 defined(WINVER) || \
462 defined(_WIN32_WINNT)
463#error
464#endif
465 ]])
466 ],[
467 CPPFLAGS="$CPPFLAGS -DWINVER=0x501"
468 AC_MSG_RESULT([yes])
469 ],[
470 AC_MSG_RESULT([no])
471 ])
472 ;;
473esac
474
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700475dnl **********************************************************************
476dnl Compilation based checks should not be done before this point.
477dnl **********************************************************************
478
479dnl **********************************************************************
Elliott Hughesf344baa2021-12-07 09:12:34 -0800480dnl Make sure that our checks for headers windows.h winsock2.h
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700481dnl and ws2tcpip.h take precedence over any other further checks which
482dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
483dnl this specific header files. And do them before its results are used.
484dnl **********************************************************************
485
486CURL_CHECK_HEADER_WINDOWS
487CURL_CHECK_NATIVE_WINDOWS
Alex Deymod15eaac2016-06-28 14:49:26 -0700488case X-"$curl_cv_native_windows" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700489 X-yes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700490 CURL_CHECK_HEADER_WINSOCK2
491 CURL_CHECK_HEADER_WS2TCPIP
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700492 CURL_CHECK_HEADER_WINCRYPT
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700493 CURL_CHECK_HEADER_WINLDAP
494 CURL_CHECK_HEADER_WINBER
495 ;;
496 *)
Alex Deymod15eaac2016-06-28 14:49:26 -0700497 curl_cv_header_winsock2_h="no"
498 curl_cv_header_ws2tcpip_h="no"
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700499 curl_cv_header_wincrypt_h="no"
Alex Deymod15eaac2016-06-28 14:49:26 -0700500 curl_cv_header_winldap_h="no"
501 curl_cv_header_winber_h="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700502 ;;
503esac
504CURL_CHECK_WIN32_LARGEFILE
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700505CURL_CHECK_WIN32_CRYPTO
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700506
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700507CURL_DARWIN_CFLAGS
508CURL_DARWIN_SYSTEMCONFIGURATION
Alex Deymo486467e2017-12-19 19:04:07 +0100509CURL_SUPPORTS_BUILTIN_AVAILABLE
Elliott Hughescee03382017-06-23 12:17:18 -0700510
Haibo Huang65021c72019-03-27 15:37:23 -0700511
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700512dnl ************************************************************
513dnl switch off particular protocols
514dnl
515AC_MSG_CHECKING([whether to support http])
516AC_ARG_ENABLE(http,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700517AS_HELP_STRING([--enable-http],[Enable HTTP support])
518AS_HELP_STRING([--disable-http],[Disable HTTP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700519[ case "$enableval" in
520 no)
521 AC_MSG_RESULT(no)
522 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
Elliott Hughes82be86d2017-09-20 17:00:17 -0700523 disable_http="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700524 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
525 AC_SUBST(CURL_DISABLE_HTTP, [1])
526 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
527 AC_SUBST(CURL_DISABLE_RTSP, [1])
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700528 dnl toggle off alt-svc too when HTTP is disabled
529 AC_DEFINE(CURL_DISABLE_ALTSVC, 1, [disable alt-svc])
530 AC_DEFINE(CURL_DISABLE_HSTS, 1, [disable HSTS])
531 curl_h1_msg="no (--enable-http, --with-hyper)"
532 curl_altsvc_msg="no";
533 curl_hsts_msg="no (--enable-hsts)";
534 enable_altsvc="no"
Elliott Hughesf344baa2021-12-07 09:12:34 -0800535 hsts="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700536 ;;
537 *) AC_MSG_RESULT(yes)
538 ;;
539 esac ],
540 AC_MSG_RESULT(yes)
541)
542AC_MSG_CHECKING([whether to support ftp])
543AC_ARG_ENABLE(ftp,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700544AS_HELP_STRING([--enable-ftp],[Enable FTP support])
545AS_HELP_STRING([--disable-ftp],[Disable FTP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700546[ case "$enableval" in
547 no)
548 AC_MSG_RESULT(no)
549 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
550 AC_SUBST(CURL_DISABLE_FTP, [1])
551 ;;
552 *) AC_MSG_RESULT(yes)
553 ;;
554 esac ],
555 AC_MSG_RESULT(yes)
556)
557AC_MSG_CHECKING([whether to support file])
558AC_ARG_ENABLE(file,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700559AS_HELP_STRING([--enable-file],[Enable FILE support])
560AS_HELP_STRING([--disable-file],[Disable FILE support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700561[ case "$enableval" in
562 no)
563 AC_MSG_RESULT(no)
564 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
565 AC_SUBST(CURL_DISABLE_FILE, [1])
566 ;;
567 *) AC_MSG_RESULT(yes)
568 ;;
569 esac ],
570 AC_MSG_RESULT(yes)
571)
572AC_MSG_CHECKING([whether to support ldap])
573AC_ARG_ENABLE(ldap,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700574AS_HELP_STRING([--enable-ldap],[Enable LDAP support])
575AS_HELP_STRING([--disable-ldap],[Disable LDAP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700576[ case "$enableval" in
577 no)
578 AC_MSG_RESULT(no)
579 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
580 AC_SUBST(CURL_DISABLE_LDAP, [1])
581 ;;
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700582 yes)
583 ldap_askedfor="yes"
584 AC_MSG_RESULT(yes)
585 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700586 *)
587 AC_MSG_RESULT(yes)
588 ;;
589 esac ],[
590 AC_MSG_RESULT(yes) ]
591)
592AC_MSG_CHECKING([whether to support ldaps])
593AC_ARG_ENABLE(ldaps,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700594AS_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
595AS_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700596[ case "$enableval" in
597 no)
598 AC_MSG_RESULT(no)
599 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
600 AC_SUBST(CURL_DISABLE_LDAPS, [1])
601 ;;
602 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
603 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
604 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
605 AC_SUBST(CURL_DISABLE_LDAPS, [1])
606 else
607 AC_MSG_RESULT(yes)
608 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
609 AC_SUBST(HAVE_LDAP_SSL, [1])
610 fi
611 ;;
612 esac ],[
613 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
614 AC_MSG_RESULT(no)
615 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
616 AC_SUBST(CURL_DISABLE_LDAPS, [1])
617 else
618 AC_MSG_RESULT(yes)
619 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
620 AC_SUBST(HAVE_LDAP_SSL, [1])
621 fi ]
622)
623
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700624dnl **********************************************************************
625dnl Check for Hyper
626dnl **********************************************************************
627
628OPT_HYPER="no"
629
630AC_ARG_WITH(hyper,
631AS_HELP_STRING([--with-hyper=PATH],[Enable hyper usage])
632AS_HELP_STRING([--without-hyper],[Disable hyper usage]),
633 [OPT_HYPER=$withval])
634case "$OPT_HYPER" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700635 no)
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700636 dnl --without-hyper option used
637 want_hyper="no"
638 ;;
639 yes)
640 dnl --with-hyper option used without path
641 want_hyper="default"
642 want_hyper_path=""
643 ;;
644 *)
645 dnl --with-hyper option used with path
646 want_hyper="yes"
647 want_hyper_path="$withval"
648 ;;
649esac
650
651if test X"$want_hyper" != Xno; then
652 if test "x$disable_http" = "xyes"; then
653 AC_MSG_ERROR([--with-hyper is not compatible with --disable-http])
654 fi
655
656 dnl backup the pre-hyper variables
657 CLEANLDFLAGS="$LDFLAGS"
658 CLEANCPPFLAGS="$CPPFLAGS"
659 CLEANLIBS="$LIBS"
660
661 CURL_CHECK_PKGCONFIG(hyper, $want_hyper_path)
662
663 if test "$PKGCONFIG" != "no" ; then
664 LIB_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path])
665 $PKGCONFIG --libs-only-l hyper`
666 CPP_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path]) dnl
667 $PKGCONFIG --cflags-only-I hyper`
668 LD_HYPER=`CURL_EXPORT_PCDIR([$want_hyper_path])
669 $PKGCONFIG --libs-only-L hyper`
670 else
671 dnl no hyper pkg-config found
672 LIB_HYPER="-lhyper -ldl -lpthread -lm"
673 if test X"$want_hyper" != Xdefault; then
674 CPP_HYPER=-I"$want_hyper_path/capi/include"
675 LD_HYPER="-L$want_hyper_path/target/debug"
676 fi
677 fi
678 if test -n "$LIB_HYPER"; then
679 AC_MSG_NOTICE([-l is $LIB_HYPER])
680 AC_MSG_NOTICE([-I is $CPP_HYPER])
681 AC_MSG_NOTICE([-L is $LD_HYPER])
682
683 LDFLAGS="$LDFLAGS $LD_HYPER"
684 CPPFLAGS="$CPPFLAGS $CPP_HYPER"
685 LIBS="$LIB_HYPER $LIBS"
686
687 if test "x$cross_compiling" != "xyes"; then
688 DIR_HYPER=`echo $LD_HYPER | $SED -e 's/^-L//'`
689 fi
690
691 AC_CHECK_LIB(hyper, hyper_io_new,
692 [
693 AC_CHECK_HEADERS(hyper.h,
694 experimental="$experimental Hyper"
695 AC_MSG_NOTICE([Hyper support is experimental])
696 curl_h1_msg="enabled (Hyper)"
697 curl_h2_msg=$curl_h1_msg
698 HYPER_ENABLED=1
699 AC_DEFINE(USE_HYPER, 1, [if hyper is in use])
700 AC_SUBST(USE_HYPER, [1])
701 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_HYPER"
702 export CURL_LIBRARY_PATH
703 AC_MSG_NOTICE([Added $DIR_HYPER to CURL_LIBRARY_PATH]),
704 )
705 ],
706 AC_MSG_ERROR([--with-hyper but hyper was not found. See docs/HYPER.md.])
707 )
708 fi
709fi
710
711if test X"$want_hyper" != Xno; then
712 AC_MSG_NOTICE([Disable RTSP support with hyper])
713 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
714 AC_SUBST(CURL_DISABLE_RTSP, [1])
715
716else
717
718 AC_MSG_CHECKING([whether to support rtsp])
719 AC_ARG_ENABLE(rtsp,
720 AS_HELP_STRING([--enable-rtsp],[Enable RTSP support])
721 AS_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
722 [ case "$enableval" in
723 no)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700724 AC_MSG_RESULT(no)
725 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
726 AC_SUBST(CURL_DISABLE_RTSP, [1])
727 ;;
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700728 *)
729 if test x$CURL_DISABLE_HTTP = x1 ; then
730 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700731 else
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700732 AC_MSG_RESULT(yes)
733 curl_rtsp_msg="enabled"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700734 fi
735 ;;
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700736 esac ],
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700737 if test "x$CURL_DISABLE_HTTP" != "x1"; then
738 AC_MSG_RESULT(yes)
739 curl_rtsp_msg="enabled"
740 else
741 AC_MSG_RESULT(no)
742 fi
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700743 )
744fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700745
746AC_MSG_CHECKING([whether to support proxies])
747AC_ARG_ENABLE(proxy,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700748AS_HELP_STRING([--enable-proxy],[Enable proxy support])
749AS_HELP_STRING([--disable-proxy],[Disable proxy support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700750[ case "$enableval" in
751 no)
752 AC_MSG_RESULT(no)
753 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
754 AC_SUBST(CURL_DISABLE_PROXY, [1])
Haibo Huangb5a52b92020-10-28 22:18:23 -0700755 https_proxy="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700756 ;;
757 *) AC_MSG_RESULT(yes)
758 ;;
759 esac ],
760 AC_MSG_RESULT(yes)
761)
762
763AC_MSG_CHECKING([whether to support dict])
764AC_ARG_ENABLE(dict,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700765AS_HELP_STRING([--enable-dict],[Enable DICT support])
766AS_HELP_STRING([--disable-dict],[Disable DICT support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700767[ case "$enableval" in
768 no)
769 AC_MSG_RESULT(no)
770 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
771 AC_SUBST(CURL_DISABLE_DICT, [1])
772 ;;
773 *) AC_MSG_RESULT(yes)
774 ;;
775 esac ],
776 AC_MSG_RESULT(yes)
777)
778AC_MSG_CHECKING([whether to support telnet])
779AC_ARG_ENABLE(telnet,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700780AS_HELP_STRING([--enable-telnet],[Enable TELNET support])
781AS_HELP_STRING([--disable-telnet],[Disable TELNET support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700782[ case "$enableval" in
783 no)
784 AC_MSG_RESULT(no)
785 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
786 AC_SUBST(CURL_DISABLE_TELNET, [1])
787 ;;
788 *) AC_MSG_RESULT(yes)
789 ;;
790 esac ],
791 AC_MSG_RESULT(yes)
792)
793AC_MSG_CHECKING([whether to support tftp])
794AC_ARG_ENABLE(tftp,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700795AS_HELP_STRING([--enable-tftp],[Enable TFTP support])
796AS_HELP_STRING([--disable-tftp],[Disable TFTP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700797[ case "$enableval" in
798 no)
799 AC_MSG_RESULT(no)
800 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
801 AC_SUBST(CURL_DISABLE_TFTP, [1])
802 ;;
803 *) AC_MSG_RESULT(yes)
804 ;;
805 esac ],
806 AC_MSG_RESULT(yes)
807)
808
809AC_MSG_CHECKING([whether to support pop3])
810AC_ARG_ENABLE(pop3,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700811AS_HELP_STRING([--enable-pop3],[Enable POP3 support])
812AS_HELP_STRING([--disable-pop3],[Disable POP3 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700813[ case "$enableval" in
814 no)
815 AC_MSG_RESULT(no)
816 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
817 AC_SUBST(CURL_DISABLE_POP3, [1])
818 ;;
819 *) AC_MSG_RESULT(yes)
820 ;;
821 esac ],
822 AC_MSG_RESULT(yes)
823)
824
825
826AC_MSG_CHECKING([whether to support imap])
827AC_ARG_ENABLE(imap,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700828AS_HELP_STRING([--enable-imap],[Enable IMAP support])
829AS_HELP_STRING([--disable-imap],[Disable IMAP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700830[ case "$enableval" in
831 no)
832 AC_MSG_RESULT(no)
833 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
834 AC_SUBST(CURL_DISABLE_IMAP, [1])
835 ;;
836 *) AC_MSG_RESULT(yes)
837 ;;
838 esac ],
839 AC_MSG_RESULT(yes)
840)
841
842
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700843AC_MSG_CHECKING([whether to support smb])
844AC_ARG_ENABLE(smb,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700845AS_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
846AS_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700847[ case "$enableval" in
848 no)
849 AC_MSG_RESULT(no)
850 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
851 AC_SUBST(CURL_DISABLE_SMB, [1])
852 ;;
853 *) AC_MSG_RESULT(yes)
854 ;;
855 esac ],
856 AC_MSG_RESULT(yes)
857)
858
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700859AC_MSG_CHECKING([whether to support smtp])
860AC_ARG_ENABLE(smtp,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700861AS_HELP_STRING([--enable-smtp],[Enable SMTP support])
862AS_HELP_STRING([--disable-smtp],[Disable SMTP support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700863[ case "$enableval" in
864 no)
865 AC_MSG_RESULT(no)
866 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
867 AC_SUBST(CURL_DISABLE_SMTP, [1])
868 ;;
869 *) AC_MSG_RESULT(yes)
870 ;;
871 esac ],
872 AC_MSG_RESULT(yes)
873)
874
875AC_MSG_CHECKING([whether to support gopher])
876AC_ARG_ENABLE(gopher,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700877AS_HELP_STRING([--enable-gopher],[Enable Gopher support])
878AS_HELP_STRING([--disable-gopher],[Disable Gopher support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700879[ case "$enableval" in
880 no)
881 AC_MSG_RESULT(no)
882 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
883 AC_SUBST(CURL_DISABLE_GOPHER, [1])
884 ;;
885 *) AC_MSG_RESULT(yes)
886 ;;
887 esac ],
888 AC_MSG_RESULT(yes)
889)
890
Haibo Huang24c77a12020-04-29 13:49:57 -0700891AC_MSG_CHECKING([whether to support mqtt])
892AC_ARG_ENABLE(mqtt,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700893AS_HELP_STRING([--enable-mqtt],[Enable MQTT support])
894AS_HELP_STRING([--disable-mqtt],[Disable MQTT support]),
Haibo Huang24c77a12020-04-29 13:49:57 -0700895[ case "$enableval" in
896 no)
897 AC_MSG_RESULT(no)
Haibo Huangb5a52b92020-10-28 22:18:23 -0700898 AC_DEFINE(CURL_DISABLE_MQTT, 1, [to disable MQTT])
899 AC_SUBST(CURL_DISABLE_MQTT, [1])
Haibo Huang24c77a12020-04-29 13:49:57 -0700900 ;;
901 *) AC_MSG_RESULT(yes)
Haibo Huang24c77a12020-04-29 13:49:57 -0700902 ;;
903 esac ],
904 AC_MSG_RESULT(no)
905)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700906
907dnl **********************************************************************
908dnl Check for built-in manual
909dnl **********************************************************************
910
911AC_MSG_CHECKING([whether to provide built-in manual])
912AC_ARG_ENABLE(manual,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700913AS_HELP_STRING([--enable-manual],[Enable built-in manual])
914AS_HELP_STRING([--disable-manual],[Disable built-in manual]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700915[ case "$enableval" in
916 no)
917 AC_MSG_RESULT(no)
918 ;;
919 *) AC_MSG_RESULT(yes)
920 USE_MANUAL="1"
921 ;;
922 esac ],
923 AC_MSG_RESULT(yes)
924 USE_MANUAL="1"
925)
926dnl The actual use of the USE_MANUAL variable is done much later in this
927dnl script to allow other actions to disable it as well.
928
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700929dnl ************************************************************
930dnl disable C code generation support
931dnl
932AC_MSG_CHECKING([whether to enable generation of C code])
933AC_ARG_ENABLE(libcurl_option,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700934AS_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
935AS_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700936[ case "$enableval" in
937 no)
938 AC_MSG_RESULT(no)
939 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
940 curl_libcurl_msg="no"
941 ;;
942 *) AC_MSG_RESULT(yes)
943 ;;
944 esac ],
945 AC_MSG_RESULT(yes)
946)
947
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700948dnl **********************************************************************
949dnl Checks for libraries.
950dnl **********************************************************************
951
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700952AC_MSG_CHECKING([whether to use libgcc])
953AC_ARG_ENABLE(libgcc,
Elliott Hughes34dd5f42021-08-10 13:01:18 -0700954AS_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700955[ case "$enableval" in
956 yes)
957 LIBS="-lgcc $LIBS"
958 AC_MSG_RESULT(yes)
959 ;;
960 *) AC_MSG_RESULT(no)
961 ;;
962 esac ],
963 AC_MSG_RESULT(no)
964)
965
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700966CURL_CHECK_LIB_XNET
967
968dnl gethostbyname without lib or in the nsl lib?
969AC_CHECK_FUNC(gethostbyname,
970 [HAVE_GETHOSTBYNAME="1"
971 ],
972 [ AC_CHECK_LIB(nsl, gethostbyname,
973 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700974 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700975 ])
976 ])
977
978if test "$HAVE_GETHOSTBYNAME" != "1"
979then
980 dnl gethostbyname in the socket lib?
981 AC_CHECK_LIB(socket, gethostbyname,
982 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700983 LIBS="-lsocket $LIBS"
984 ])
985fi
986
987if test "$HAVE_GETHOSTBYNAME" != "1"
988then
989 dnl gethostbyname in the watt lib?
990 AC_CHECK_LIB(watt, gethostbyname,
991 [HAVE_GETHOSTBYNAME="1"
992 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
993 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
994 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700995 ])
996fi
997
998dnl At least one system has been identified to require BOTH nsl and socket
999dnl libs at the same time to link properly.
1000if test "$HAVE_GETHOSTBYNAME" != "1"
1001then
1002 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
1003 my_ac_save_LIBS=$LIBS
1004 LIBS="-lnsl -lsocket $LIBS"
1005 AC_LINK_IFELSE([
1006 AC_LANG_PROGRAM([[
1007 ]],[[
1008 gethostbyname();
1009 ]])
1010 ],[
1011 AC_MSG_RESULT([yes])
1012 HAVE_GETHOSTBYNAME="1"
1013 ],[
1014 AC_MSG_RESULT([no])
1015 LIBS=$my_ac_save_LIBS
1016 ])
1017fi
1018
1019if test "$HAVE_GETHOSTBYNAME" != "1"
1020then
1021 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -07001022 if test "$curl_cv_header_windows_h" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001023 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001024 winsock_LIB="-lws2_32"
1025 fi
1026 if test ! -z "$winsock_LIB"; then
1027 my_ac_save_LIBS=$LIBS
1028 LIBS="$winsock_LIB $LIBS"
1029 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
1030 AC_LINK_IFELSE([
1031 AC_LANG_PROGRAM([[
1032#ifdef HAVE_WINDOWS_H
1033#ifndef WIN32_LEAN_AND_MEAN
1034#define WIN32_LEAN_AND_MEAN
1035#endif
1036#include <windows.h>
1037#ifdef HAVE_WINSOCK2_H
1038#include <winsock2.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001039#endif
1040#endif
1041 ]],[[
1042 gethostbyname("www.dummysite.com");
1043 ]])
1044 ],[
1045 AC_MSG_RESULT([yes])
1046 HAVE_GETHOSTBYNAME="1"
1047 ],[
1048 AC_MSG_RESULT([no])
1049 winsock_LIB=""
1050 LIBS=$my_ac_save_LIBS
1051 ])
1052 fi
1053 fi
1054fi
1055
1056if test "$HAVE_GETHOSTBYNAME" != "1"
1057then
1058 dnl This is for Minix 3.1
1059 AC_MSG_CHECKING([for gethostbyname for Minix 3])
1060 AC_LINK_IFELSE([
1061 AC_LANG_PROGRAM([[
1062/* Older Minix versions may need <net/gen/netdb.h> here instead */
1063#include <netdb.h>
1064 ]],[[
1065 gethostbyname("www.dummysite.com");
1066 ]])
1067 ],[
1068 AC_MSG_RESULT([yes])
1069 HAVE_GETHOSTBYNAME="1"
1070 ],[
1071 AC_MSG_RESULT([no])
1072 ])
1073fi
1074
1075if test "$HAVE_GETHOSTBYNAME" != "1"
1076then
1077 dnl This is for eCos with a stubbed DNS implementation
1078 AC_MSG_CHECKING([for gethostbyname for eCos])
1079 AC_LINK_IFELSE([
1080 AC_LANG_PROGRAM([[
1081#include <stdio.h>
1082#include <netdb.h>
1083 ]],[[
1084 gethostbyname("www.dummysite.com");
1085 ]])
1086 ],[
1087 AC_MSG_RESULT([yes])
1088 HAVE_GETHOSTBYNAME="1"
1089 ],[
1090 AC_MSG_RESULT([no])
1091 ])
1092fi
1093
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001094if test "$HAVE_GETHOSTBYNAME" != "1" -o "${with_amissl+set}" = set
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001095then
Haibo Huang65021c72019-03-27 15:37:23 -07001096 dnl This is for AmigaOS with bsdsocket.library - needs testing before -lnet
1097 AC_MSG_CHECKING([for gethostbyname for AmigaOS bsdsocket.library])
1098 AC_LINK_IFELSE([
1099 AC_LANG_PROGRAM([[
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001100 #include <proto/bsdsocket.h>
1101 struct Library *SocketBase = NULL;
Haibo Huang65021c72019-03-27 15:37:23 -07001102 ]],[[
1103 gethostbyname("www.dummysite.com");
1104 ]])
1105 ],[
1106 AC_MSG_RESULT([yes])
1107 HAVE_GETHOSTBYNAME="1"
1108 HAVE_PROTO_BSDSOCKET_H="1"
1109 AC_DEFINE(HAVE_PROTO_BSDSOCKET_H, 1, [if Amiga bsdsocket.library is in use])
1110 AC_SUBST(HAVE_PROTO_BSDSOCKET_H, [1])
1111 ],[
1112 AC_MSG_RESULT([no])
1113 ])
1114fi
1115
1116if test "$HAVE_GETHOSTBYNAME" != "1"
1117then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001118 dnl gethostbyname in the network lib - for Haiku OS
1119 AC_CHECK_LIB(network, gethostbyname,
1120 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001121 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001122 ])
1123fi
1124
1125if test "$HAVE_GETHOSTBYNAME" != "1"
1126then
1127 dnl gethostbyname in the net lib - for BeOS
1128 AC_CHECK_LIB(net, gethostbyname,
1129 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001130 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001131 ])
1132fi
1133
1134
1135if test "$HAVE_GETHOSTBYNAME" != "1"; then
1136 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
1137fi
1138
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001139CURL_CHECK_LIBS_CONNECT
1140
1141CURL_NETWORK_LIBS=$LIBS
1142
1143dnl **********************************************************************
1144dnl In case that function clock_gettime with monotonic timer is available,
1145dnl check for additional required libraries.
1146dnl **********************************************************************
1147CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
1148
1149dnl **********************************************************************
1150dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001151dnl servers and libtest cases which require networking and clock_gettime
1152dnl support. Save the list of required libraries at this point for use
1153dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001154dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001155CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001156
1157dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001158dnl Check for the presence of ZLIB libraries and headers
1159dnl **********************************************************************
1160
1161dnl Check for & handle argument to --with-zlib.
1162
1163clean_CPPFLAGS=$CPPFLAGS
1164clean_LDFLAGS=$LDFLAGS
1165clean_LIBS=$LIBS
1166ZLIB_LIBS=""
1167AC_ARG_WITH(zlib,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001168AS_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
1169AS_HELP_STRING([--without-zlib],[disable use of zlib]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001170 [OPT_ZLIB="$withval"])
1171
1172if test "$OPT_ZLIB" = "no" ; then
1173 AC_MSG_WARN([zlib disabled])
1174else
1175 if test "$OPT_ZLIB" = "yes" ; then
1176 OPT_ZLIB=""
1177 fi
1178
Elliott Hughescee03382017-06-23 12:17:18 -07001179 if test -z "$OPT_ZLIB" ; then
Elliott Hughes82be86d2017-09-20 17:00:17 -07001180 CURL_CHECK_PKGCONFIG(zlib)
1181
1182 if test "$PKGCONFIG" != "no" ; then
1183 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
1184 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
1185 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
1186 OPT_ZLIB=""
1187 HAVE_LIBZ="1"
1188 fi
Elliott Hughescee03382017-06-23 12:17:18 -07001189
1190 if test -z "$HAVE_LIBZ"; then
1191
1192 dnl Check for the lib without setting any new path, since many
1193 dnl people have it in the default path
1194
1195 AC_CHECK_LIB(z, inflateEnd,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001196 dnl libz found, set the variable
1197 [HAVE_LIBZ="1"
1198 LIBS="-lz $LIBS"],
1199 dnl if no lib found, try /usr/local
1200 [OPT_ZLIB="/usr/local"])
Elliott Hughescee03382017-06-23 12:17:18 -07001201 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001202 fi
1203
1204 dnl Add a nonempty path to the compiler flags
1205 if test -n "$OPT_ZLIB"; then
1206 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
1207 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
1208 fi
1209
1210 AC_CHECK_HEADER(zlib.h,
1211 [
1212 dnl zlib.h was found
1213 HAVE_ZLIB_H="1"
1214 dnl if the lib wasn't found already, try again with the new paths
1215 if test "$HAVE_LIBZ" != "1"; then
1216 AC_CHECK_LIB(z, gzread,
1217 [
1218 dnl the lib was found!
1219 HAVE_LIBZ="1"
1220 LIBS="-lz $LIBS"
1221 ],
1222 [ CPPFLAGS=$clean_CPPFLAGS
1223 LDFLAGS=$clean_LDFLAGS])
1224 fi
1225 ],
1226 [
1227 dnl zlib.h was not found, restore the flags
1228 CPPFLAGS=$clean_CPPFLAGS
1229 LDFLAGS=$clean_LDFLAGS]
1230 )
1231
1232 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
1233 then
1234 AC_MSG_WARN([configure found only the libz lib, not the header file!])
1235 HAVE_LIBZ=""
1236 CPPFLAGS=$clean_CPPFLAGS
1237 LDFLAGS=$clean_LDFLAGS
1238 LIBS=$clean_LIBS
1239 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
1240 then
1241 AC_MSG_WARN([configure found only the libz header file, not the lib!])
1242 CPPFLAGS=$clean_CPPFLAGS
1243 LDFLAGS=$clean_LDFLAGS
1244 LIBS=$clean_LIBS
1245 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
1246 then
1247 dnl both header and lib were found!
1248 AC_SUBST(HAVE_LIBZ)
1249 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
1250 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
1251
1252 ZLIB_LIBS="-lz"
1253 LIBS="-lz $clean_LIBS"
1254
1255 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1256 AMFIXLIB="1"
1257 AC_MSG_NOTICE([found both libz and libz.h header])
1258 curl_zlib_msg="enabled"
1259 fi
1260fi
1261
1262dnl set variable for use in automakefile(s)
1263AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1264AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001265
1266dnl **********************************************************************
Alex Deymo486467e2017-12-19 19:04:07 +01001267dnl Check for the presence of BROTLI decoder libraries and headers
1268dnl **********************************************************************
1269
1270dnl Brotli project home page: https://github.com/google/brotli
1271
1272dnl Default to compiler & linker defaults for BROTLI files & libraries.
1273OPT_BROTLI=off
1274AC_ARG_WITH(brotli,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001275AS_HELP_STRING([--with-brotli=PATH],[Where to look for brotli, PATH points to the BROTLI installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1276AS_HELP_STRING([--without-brotli], [disable BROTLI]),
Alex Deymo486467e2017-12-19 19:04:07 +01001277 OPT_BROTLI=$withval)
1278
1279if test X"$OPT_BROTLI" != Xno; then
1280 dnl backup the pre-brotli variables
1281 CLEANLDFLAGS="$LDFLAGS"
1282 CLEANCPPFLAGS="$CPPFLAGS"
1283 CLEANLIBS="$LIBS"
1284
1285 case "$OPT_BROTLI" in
1286 yes)
1287 dnl --with-brotli (without path) used
1288 CURL_CHECK_PKGCONFIG(libbrotlidec)
1289
1290 if test "$PKGCONFIG" != "no" ; then
1291 LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1292 LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1293 CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1294 version=`$PKGCONFIG --modversion libbrotlidec`
Haibo Huangca2a8022020-07-10 20:17:42 -07001295 DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/^-L//'`
Alex Deymo486467e2017-12-19 19:04:07 +01001296 fi
1297
1298 ;;
1299 off)
1300 dnl no --with-brotli option given, just check default places
1301 ;;
1302 *)
1303 dnl use the given --with-brotli spot
1304 PREFIX_BROTLI=$OPT_BROTLI
1305 ;;
1306 esac
1307
1308 dnl if given with a prefix, we set -L and -I based on that
1309 if test -n "$PREFIX_BROTLI"; then
1310 LIB_BROTLI="-lbrotlidec"
1311 LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1312 CPP_BROTLI=-I${PREFIX_BROTLI}/include
1313 DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1314 fi
1315
1316 LDFLAGS="$LDFLAGS $LD_BROTLI"
1317 CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1318 LIBS="$LIB_BROTLI $LIBS"
1319
1320 AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1321
1322 AC_CHECK_HEADERS(brotli/decode.h,
1323 curl_brotli_msg="enabled (libbrotlidec)"
1324 HAVE_BROTLI=1
1325 AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1326 AC_SUBST(HAVE_BROTLI, [1])
1327 )
1328
1329 if test X"$OPT_BROTLI" != Xoff &&
1330 test "$HAVE_BROTLI" != "1"; then
1331 AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1332 fi
1333
1334 if test "$HAVE_BROTLI" = "1"; then
1335 if test -n "$DIR_BROTLI"; then
1336 dnl when the brotli shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001337 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Alex Deymo486467e2017-12-19 19:04:07 +01001338 dnl to prevent further configure tests to fail due to this
1339
1340 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001341 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI"
1342 export CURL_LIBRARY_PATH
1343 AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH])
Alex Deymo486467e2017-12-19 19:04:07 +01001344 fi
1345 fi
1346 else
1347 dnl no brotli, revert back to clean variables
1348 LDFLAGS=$CLEANLDFLAGS
1349 CPPFLAGS=$CLEANCPPFLAGS
1350 LIBS=$CLEANLIBS
1351 fi
1352fi
1353
1354dnl **********************************************************************
Haibo Huangc3c04f42020-08-19 13:00:07 -07001355dnl Check for libzstd
1356dnl **********************************************************************
1357
1358dnl Default to compiler & linker defaults for libzstd
1359OPT_ZSTD=off
1360AC_ARG_WITH(zstd,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001361AS_HELP_STRING([--with-zstd=PATH],[Where to look for libzstd, PATH points to the libzstd installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1362AS_HELP_STRING([--without-zstd], [disable libzstd]),
Haibo Huangc3c04f42020-08-19 13:00:07 -07001363 OPT_ZSTD=$withval)
1364
1365if test X"$OPT_ZSTD" != Xno; then
1366 dnl backup the pre-zstd variables
1367 CLEANLDFLAGS="$LDFLAGS"
1368 CLEANCPPFLAGS="$CPPFLAGS"
1369 CLEANLIBS="$LIBS"
1370
1371 case "$OPT_ZSTD" in
1372 yes)
1373 dnl --with-zstd (without path) used
1374 CURL_CHECK_PKGCONFIG(libzstd)
1375
1376 if test "$PKGCONFIG" != "no" ; then
1377 LIB_ZSTD=`$PKGCONFIG --libs-only-l libzstd`
1378 LD_ZSTD=`$PKGCONFIG --libs-only-L libzstd`
1379 CPP_ZSTD=`$PKGCONFIG --cflags-only-I libzstd`
1380 version=`$PKGCONFIG --modversion libzstd`
1381 DIR_ZSTD=`echo $LD_ZSTD | $SED -e 's/-L//'`
1382 fi
1383
1384 ;;
1385 off)
1386 dnl no --with-zstd option given, just check default places
1387 ;;
1388 *)
1389 dnl use the given --with-zstd spot
1390 PREFIX_ZSTD=$OPT_ZSTD
1391 ;;
1392 esac
1393
1394 dnl if given with a prefix, we set -L and -I based on that
1395 if test -n "$PREFIX_ZSTD"; then
1396 LIB_ZSTD="-lzstd"
1397 LD_ZSTD=-L${PREFIX_ZSTD}/lib$libsuff
1398 CPP_ZSTD=-I${PREFIX_ZSTD}/include
1399 DIR_ZSTD=${PREFIX_ZSTD}/lib$libsuff
1400 fi
1401
1402 LDFLAGS="$LDFLAGS $LD_ZSTD"
1403 CPPFLAGS="$CPPFLAGS $CPP_ZSTD"
1404 LIBS="$LIB_ZSTD $LIBS"
1405
1406 AC_CHECK_LIB(zstd, ZSTD_createDStream)
1407
1408 AC_CHECK_HEADERS(zstd.h,
1409 curl_zstd_msg="enabled (libzstd)"
1410 HAVE_ZSTD=1
1411 AC_DEFINE(HAVE_ZSTD, 1, [if libzstd is in use])
1412 AC_SUBST(HAVE_ZSTD, [1])
1413 )
1414
1415 if test X"$OPT_ZSTD" != Xoff &&
1416 test "$HAVE_ZSTD" != "1"; then
1417 AC_MSG_ERROR([libzstd was not found where specified!])
1418 fi
1419
1420 if test "$HAVE_ZSTD" = "1"; then
1421 if test -n "$DIR_ZSTD"; then
1422 dnl when the zstd shared lib were found in a path that the run-time
1423 dnl linker doesn't search through, we need to add it to
1424 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail due to
1425 dnl this
1426
1427 if test "x$cross_compiling" != "xyes"; then
1428 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_ZSTD"
1429 export CURL_LIBRARY_PATH
1430 AC_MSG_NOTICE([Added $DIR_ZSTD to CURL_LIBRARY_PATH])
1431 fi
1432 fi
1433 else
1434 dnl no zstd, revert back to clean variables
1435 LDFLAGS=$CLEANLDFLAGS
1436 CPPFLAGS=$CLEANCPPFLAGS
1437 LIBS=$CLEANLIBS
1438 fi
1439fi
1440
1441dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001442dnl Check for LDAP
1443dnl **********************************************************************
1444
1445LDAPLIBNAME=""
1446AC_ARG_WITH(ldap-lib,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001447AS_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001448 [LDAPLIBNAME="$withval"])
1449
1450LBERLIBNAME=""
1451AC_ARG_WITH(lber-lib,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001452AS_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001453 [LBERLIBNAME="$withval"])
1454
1455if test x$CURL_DISABLE_LDAP != x1 ; then
1456
1457 CURL_CHECK_HEADER_LBER
1458 CURL_CHECK_HEADER_LDAP
1459 CURL_CHECK_HEADER_LDAPSSL
1460 CURL_CHECK_HEADER_LDAP_SSL
1461
1462 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001463 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001464 dnl Windows uses a single and unique LDAP library name
1465 LDAPLIBNAME="wldap32"
1466 LBERLIBNAME="no"
1467 fi
1468 fi
1469
1470 if test "$LDAPLIBNAME" ; then
1471 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001472 if test -n "$ldap_askedfor"; then
1473 AC_MSG_ERROR([couldn't detect the LDAP libraries])
1474 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001475 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1476 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001477 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001478 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001479 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001480 else
1481 dnl Try to find the right ldap libraries for this system
1482 CURL_CHECK_LIBS_LDAP
1483 case X-"$curl_cv_ldap_LIBS" in
1484 X-unknown)
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001485 if test -n "$ldap_askedfor"; then
1486 AC_MSG_ERROR([couldn't detect the LDAP libraries])
1487 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001488 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1489 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1490 AC_SUBST(CURL_DISABLE_LDAP, [1])
1491 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1492 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1493 ;;
1494 esac
1495 fi
1496fi
1497
1498if test x$CURL_DISABLE_LDAP != x1 ; then
1499
1500 if test "$LBERLIBNAME" ; then
1501 dnl If name is "no" then don't define this library at all
1502 dnl (it's only needed if libldap.so's dependencies are broken).
1503 if test "$LBERLIBNAME" != "no" ; then
1504 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1505 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1506 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001507 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001508 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001509 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001510 fi
1511 fi
1512fi
1513
1514if test x$CURL_DISABLE_LDAP != x1 ; then
1515 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1516
1517 if test "$LDAPLIBNAME" = "wldap32"; then
1518 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001519 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001520 else
1521 curl_ldap_msg="enabled (OpenLDAP)"
1522 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1523 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1524 AC_SUBST(USE_OPENLDAP, [1])
1525 fi
1526 fi
1527fi
1528
1529if test x$CURL_DISABLE_LDAPS != x1 ; then
1530 curl_ldaps_msg="enabled"
1531fi
1532
1533dnl **********************************************************************
1534dnl Checks for IPv6
1535dnl **********************************************************************
1536
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001537AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001538AC_ARG_ENABLE(ipv6,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001539AS_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1540AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001541[ case "$enableval" in
1542 no)
1543 AC_MSG_RESULT(no)
1544 ipv6=no
1545 ;;
1546 *) AC_MSG_RESULT(yes)
1547 ipv6=yes
1548 ;;
1549 esac ],
1550
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001551 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1552/* are AF_INET6 and sockaddr_in6 available? */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001553#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001554#ifdef HAVE_WINSOCK2_H
1555#include <winsock2.h>
Haibo Huangb51266f2020-03-04 02:22:48 -08001556#include <ws2tcpip.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001557#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001558#include <sys/socket.h>
Haibo Huangb51266f2020-03-04 02:22:48 -08001559#include <netinet/in.h>
1560#if defined (__TANDEM)
1561# include <netinet/in6.h>
1562#endif
Alex Deymod15eaac2016-06-28 14:49:26 -07001563#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001564#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001565main()
1566{
Haibo Huangb51266f2020-03-04 02:22:48 -08001567 struct sockaddr_in6 s;
1568 (void)s;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001569 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1570 exit(1);
1571 else
1572 exit(0);
1573}
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001574]])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001575],
1576 AC_MSG_RESULT(yes)
1577 ipv6=yes,
1578 AC_MSG_RESULT(no)
1579 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001580 AC_MSG_RESULT(yes)
1581 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001582))
1583
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001584if test "$ipv6" = yes; then
Haibo Huangb51266f2020-03-04 02:22:48 -08001585 curl_ipv6_msg="enabled"
1586 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
1587 IPV6_ENABLED=1
1588 AC_SUBST(IPV6_ENABLED)
1589
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001590 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001591 AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001592#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001593#ifdef HAVE_WINSOCK2_H
1594#include <winsock2.h>
1595#include <ws2tcpip.h>
1596#else
1597#include <netinet/in.h>
Elliott Hughes0128fe42018-02-27 14:57:55 -08001598#if defined (__TANDEM)
1599# include <netinet/in6.h>
1600#endif
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001601#endif
1602]], [[
1603 struct sockaddr_in6 s;
1604 s.sin6_scope_id = 0;
1605]])], [
1606 AC_MSG_RESULT([yes])
1607 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1608 ], [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001609 AC_MSG_RESULT([no])
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001610 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001611fi
1612
1613dnl **********************************************************************
1614dnl Check if the operating system allows programs to write to their own argv[]
1615dnl **********************************************************************
1616
1617AC_MSG_CHECKING([if argv can be written to])
Haibo Huangca2a8022020-07-10 20:17:42 -07001618CURL_RUN_IFELSE([[
1619int main(int argc, char **argv)
1620{
1621 (void)argc;
1622 argv[0][0] = ' ';
1623 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001624}
Haibo Huangca2a8022020-07-10 20:17:42 -07001625]],[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001626 curl_cv_writable_argv=yes
1627],[
1628 curl_cv_writable_argv=no
1629],[
1630 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001631])
1632case $curl_cv_writable_argv in
1633yes)
1634 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1635 AC_MSG_RESULT(yes)
1636 ;;
1637no)
1638 AC_MSG_RESULT(no)
1639 ;;
1640*)
1641 AC_MSG_RESULT(no)
1642 AC_MSG_WARN([the previous check could not be made default was used])
1643 ;;
1644esac
1645
1646dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001647dnl Check for GSS-API libraries
1648dnl **********************************************************************
1649
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001650dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001651
1652GSSAPI_ROOT="/usr"
1653AC_ARG_WITH(gssapi-includes,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001654 AS_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001655 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001656 [ GSSAPI_INCS="-I$withval"
1657 want_gss="yes" ]
1658)
1659
1660AC_ARG_WITH(gssapi-libs,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001661 AS_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001662 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001663 [ GSSAPI_LIB_DIR="-L$withval"
1664 want_gss="yes" ]
1665)
1666
1667AC_ARG_WITH(gssapi,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001668 AS_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001669 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001670 GSSAPI_ROOT="$withval"
1671 if test x"$GSSAPI_ROOT" != xno; then
1672 want_gss="yes"
1673 if test x"$GSSAPI_ROOT" = xyes; then
1674 dnl if yes, then use default root
1675 GSSAPI_ROOT="/usr"
1676 fi
1677 fi
1678])
1679
1680save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001681AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001682if test x"$want_gss" = xyes; then
1683 AC_MSG_RESULT(yes)
1684
Elliott Hughesf344baa2021-12-07 09:12:34 -08001685 CURL_CHECK_PKGCONFIG(mit-krb5-gssapi)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001686 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001687 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1688 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
Elliott Hughesf344baa2021-12-07 09:12:34 -08001689 elif test "$PKGCONFIG" != "no" ; then
1690 GSSAPI_INCS=`$PKGCONFIG --cflags mit-krb5-gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001691 elif test "$GSSAPI_ROOT" != "yes"; then
1692 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1693 fi
1694 fi
1695
1696 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1697
1698 AC_CHECK_HEADER(gss.h,
1699 [
1700 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001701 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001702 gnu_gss=yes
1703 ],
1704 [
1705 dnl not found, check Heimdal or MIT
1706 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1707 AC_CHECK_HEADERS(
1708 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1709 [],
1710 [not_mit=1],
1711 [
1712AC_INCLUDES_DEFAULT
1713#ifdef HAVE_GSSAPI_GSSAPI_H
1714#include <gssapi/gssapi.h>
1715#endif
1716 ])
1717 if test "x$not_mit" = "x1"; then
1718 dnl MIT not found, check for Heimdal
1719 AC_CHECK_HEADER(gssapi.h,
1720 [
1721 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001722 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001723 ],
1724 [
1725 dnl no header found, disabling GSS
1726 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001727 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001728 ]
1729 )
1730 else
1731 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001732 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1733 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1734 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001735 AC_COMPILE_IFELSE([
1736 AC_LANG_PROGRAM([[
1737#include <gssapi/gssapi.h>
1738#include <gssapi/gssapi_generic.h>
1739#include <gssapi/gssapi_krb5.h>
1740 ]],[[
1741 gss_import_name(
1742 (OM_uint32 *)0,
1743 (gss_buffer_t)0,
1744 GSS_C_NT_HOSTBASED_SERVICE,
1745 (gss_name_t *)0);
1746 ]])
1747 ],[
1748 AC_MSG_RESULT([yes])
1749 ],[
1750 AC_MSG_RESULT([no])
1751 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001752 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001753 ])
1754 fi
1755 ]
1756 )
1757else
1758 AC_MSG_RESULT(no)
1759fi
1760if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001761 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1762 HAVE_GSSAPI=1
1763 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001764
1765 if test -n "$gnu_gss"; then
1766 curl_gss_msg="enabled (GNU GSS)"
1767 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001768 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001769 elif test -z "$GSSAPI_LIB_DIR"; then
1770 case $host in
1771 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001772 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001773 ;;
1774 *)
Elliott Hughesf344baa2021-12-07 09:12:34 -08001775 CURL_CHECK_PKGCONFIG(mit-krb5-gssapi)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001776 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001777 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1778 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001779 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1780 LIBS="$gss_libs $LIBS"
Elliott Hughesf344baa2021-12-07 09:12:34 -08001781 elif test "$PKGCONFIG" != "no" ; then
1782 gss_libs=`$PKGCONFIG --libs mit-krb5-gssapi`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001783 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001784 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001785 case $host in
1786 *-hp-hpux*)
1787 gss_libname="gss"
1788 ;;
1789 *)
1790 gss_libname="gssapi"
1791 ;;
1792 esac
1793
1794 if test "$GSSAPI_ROOT" != "yes"; then
1795 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1796 LIBS="-l$gss_libname $LIBS"
1797 else
1798 LIBS="-l$gss_libname $LIBS"
1799 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001800 fi
1801 ;;
1802 esac
1803 else
1804 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001805 case $host in
1806 *-hp-hpux*)
1807 LIBS="-lgss $LIBS"
1808 ;;
1809 *)
1810 LIBS="-lgssapi $LIBS"
1811 ;;
1812 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001813 fi
1814else
1815 CPPFLAGS="$save_CPPFLAGS"
1816fi
1817
Alex Deymo486467e2017-12-19 19:04:07 +01001818build_libstubgss=no
1819if test x"$want_gss" = "xyes"; then
1820 build_libstubgss=yes
1821fi
1822
1823AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1824
1825dnl -------------------------------------------------------------
1826dnl parse --with-default-ssl-backend so it can be validated below
1827dnl -------------------------------------------------------------
1828
1829DEFAULT_SSL_BACKEND=no
1830VALID_DEFAULT_SSL_BACKEND=
1831AC_ARG_WITH(default-ssl-backend,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001832AS_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1833AS_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
Alex Deymo486467e2017-12-19 19:04:07 +01001834 [DEFAULT_SSL_BACKEND=$withval])
1835case "$DEFAULT_SSL_BACKEND" in
1836 no)
1837 dnl --without-default-ssl-backend option used
1838 ;;
1839 default|yes)
1840 dnl --with-default-ssl-backend option used without name
1841 AC_MSG_ERROR([The name of the default SSL backend is required.])
1842 ;;
1843 *)
1844 dnl --with-default-ssl-backend option used with name
1845 AC_SUBST(DEFAULT_SSL_BACKEND)
1846 dnl needs to be validated below
1847 VALID_DEFAULT_SSL_BACKEND=no
1848 ;;
1849esac
1850
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001851CURL_WITH_SCHANNEL
1852CURL_WITH_SECURETRANSPORT
1853CURL_WITH_AMISSL
1854CURL_WITH_OPENSSL
1855CURL_WITH_GNUTLS
1856CURL_WITH_MBEDTLS
1857CURL_WITH_WOLFSSL
1858CURL_WITH_MESALINK
1859CURL_WITH_BEARSSL
1860CURL_WITH_RUSTLS
1861CURL_WITH_NSS
Alex Deymo486467e2017-12-19 19:04:07 +01001862
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001863dnl link required libraries for USE_WIN32_CRYPTO or USE_SCHANNEL
1864if test "x$USE_WIN32_CRYPTO" = "x1" -o "x$USE_SCHANNEL" = "x1"; then
1865 LIBS="-ladvapi32 -lcrypt32 $LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001866fi
1867
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001868case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$MBEDTLS_ENABLED$WOLFSSL_ENABLED$SCHANNEL_ENABLED$SECURETRANSPORT_ENABLED$MESALINK_ENABLED$BEARSSL_ENABLED$AMISSL_ENABLED$RUSTLS_ENABLED"
1869in
Alex Deymo486467e2017-12-19 19:04:07 +01001870x)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001871 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001872 AC_MSG_WARN([Use --with-openssl, --with-gnutls, --with-wolfssl, --with-mbedtls, --with-nss, --with-schannel, --with-secure-transport, --with-mesalink, --with-amissl, --with-bearssl or --with-rustls to address this.])
Alex Deymo486467e2017-12-19 19:04:07 +01001873 ;;
1874x1)
1875 # one SSL backend is enabled
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001876 AC_SUBST(SSL_ENABLED)
1877 SSL_ENABLED="1"
Alex Deymo486467e2017-12-19 19:04:07 +01001878 AC_MSG_NOTICE([built with one SSL backend])
1879 ;;
1880*)
1881 # more than one SSL backend is enabled
1882 AC_SUBST(SSL_ENABLED)
1883 SSL_ENABLED="1"
1884 AC_SUBST(CURL_WITH_MULTI_SSL)
1885 CURL_WITH_MULTI_SSL="1"
1886 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
1887 AC_MSG_NOTICE([built with multiple SSL backends])
1888 ;;
1889esac
1890
1891if test -n "$ssl_backends"; then
1892 curl_ssl_msg="enabled ($ssl_backends)"
1893fi
1894
1895if test no = "$VALID_DEFAULT_SSL_BACKEND"
1896then
1897 if test -n "$SSL_ENABLED"
1898 then
1899 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
1900 else
1901 AC_MSG_ERROR([Default SSL backend requires SSL!])
1902 fi
1903elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
1904then
1905 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001906fi
1907
1908dnl **********************************************************************
1909dnl Check for the CA bundle
1910dnl **********************************************************************
1911
Haibo Huang445085a2019-09-11 13:33:50 -07001912if test -n "$check_for_ca_bundle"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001913 CURL_CHECK_CA_BUNDLE
1914fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001915
1916dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07001917dnl Check for libpsl
1918dnl **********************************************************************
1919
1920AC_ARG_WITH(libpsl,
1921 AS_HELP_STRING([--without-libpsl],
1922 [disable support for libpsl cookie checking]),
1923 with_libpsl=$withval,
1924 with_libpsl=yes)
1925if test $with_libpsl != "no"; then
1926 AC_SEARCH_LIBS(psl_builtin, psl,
Haibo Huang65021c72019-03-27 15:37:23 -07001927 [curl_psl_msg="enabled";
Alex Deymod15eaac2016-06-28 14:49:26 -07001928 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
1929 ],
1930 [curl_psl_msg="no (libpsl not found)";
1931 AC_MSG_WARN([libpsl was not found])
1932 ]
1933 )
1934fi
Haibo Huang65021c72019-03-27 15:37:23 -07001935AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"])
Alex Deymod15eaac2016-06-28 14:49:26 -07001936
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001937
Alex Deymod15eaac2016-06-28 14:49:26 -07001938dnl **********************************************************************
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001939dnl Check for libgsasl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001940dnl **********************************************************************
1941
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001942AC_ARG_WITH(libgsasl,
1943 AS_HELP_STRING([--without-libgsasl],
1944 [disable libgsasl support for SCRAM]),
1945 with_libgsasl=$withval,
1946 with_libgsasl=yes)
1947if test $with_libgsasl != "no"; then
1948 AC_SEARCH_LIBS(gsasl_init, gsasl,
1949 [curl_gsasl_msg="enabled";
1950 AC_DEFINE([USE_GSASL], [1], [GSASL support enabled])
1951 ],
1952 [curl_gsasl_msg="no (libgsasl not found)";
1953 AC_MSG_WARN([libgsasl was not found])
1954 ]
1955 )
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001956fi
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001957AM_CONDITIONAL([USE_GSASL], [test "$curl_gsasl_msg" = "enabled"])
1958
1959AC_ARG_WITH(libmetalink,,
1960 AC_MSG_ERROR([--with-libmetalink no longer works!]))
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001961
1962dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001963dnl Check for the presence of LIBSSH2 libraries and headers
1964dnl **********************************************************************
1965
1966dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
1967OPT_LIBSSH2=off
1968AC_ARG_WITH(libssh2,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001969AS_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the libssh2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1970AS_HELP_STRING([--with-libssh2], [enable libssh2]),
Elliott Hughes0128fe42018-02-27 14:57:55 -08001971 OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
1972
1973
1974OPT_LIBSSH=off
1975AC_ARG_WITH(libssh,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001976AS_HELP_STRING([--with-libssh=PATH],[Where to look for libssh, PATH points to the libssh installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1977AS_HELP_STRING([--with-libssh], [enable libssh]),
Elliott Hughes0128fe42018-02-27 14:57:55 -08001978 OPT_LIBSSH=$withval, OPT_LIBSSH=no)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001979
Haibo Huangb51266f2020-03-04 02:22:48 -08001980OPT_WOLFSSH=off
1981AC_ARG_WITH(wolfssh,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07001982AS_HELP_STRING([--with-wolfssh=PATH],[Where to look for wolfssh, PATH points to the wolfSSH installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1983AS_HELP_STRING([--with-wolfssh], [enable wolfssh]),
Haibo Huangb51266f2020-03-04 02:22:48 -08001984 OPT_WOLFSSH=$withval, OPT_WOLFSSH=no)
1985
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001986if test X"$OPT_LIBSSH2" != Xno; then
1987 dnl backup the pre-libssh2 variables
1988 CLEANLDFLAGS="$LDFLAGS"
1989 CLEANCPPFLAGS="$CPPFLAGS"
1990 CLEANLIBS="$LIBS"
1991
1992 case "$OPT_LIBSSH2" in
1993 yes)
1994 dnl --with-libssh2 (without path) used
1995 CURL_CHECK_PKGCONFIG(libssh2)
1996
1997 if test "$PKGCONFIG" != "no" ; then
Elliott Hughes72d948d2018-08-03 14:37:21 -07001998 LIB_SSH2=`$PKGCONFIG --libs libssh2`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001999 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2000 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2001 version=`$PKGCONFIG --modversion libssh2`
Haibo Huangca2a8022020-07-10 20:17:42 -07002002 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/^-L//'`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002003 fi
2004
2005 ;;
2006 off)
2007 dnl no --with-libssh2 option given, just check default places
2008 ;;
2009 *)
2010 dnl use the given --with-libssh2 spot
2011 PREFIX_SSH2=$OPT_LIBSSH2
2012 ;;
2013 esac
2014
2015 dnl if given with a prefix, we set -L and -I based on that
2016 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002017 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002018 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2019 CPP_SSH2=-I${PREFIX_SSH2}/include
2020 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2021 fi
2022
Elliott Hughes82be86d2017-09-20 17:00:17 -07002023 LDFLAGS="$LDFLAGS $LD_SSH2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002024 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002025 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002026
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002027 dnl check for function added in libssh2 version 1.0
2028 AC_CHECK_LIB(ssh2, libssh2_session_block_directions)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002029
2030 AC_CHECK_HEADERS(libssh2.h,
2031 curl_ssh_msg="enabled (libSSH2)"
2032 LIBSSH2_ENABLED=1
2033 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2034 AC_SUBST(USE_LIBSSH2, [1])
2035 )
2036
2037 if test X"$OPT_LIBSSH2" != Xoff &&
2038 test "$LIBSSH2_ENABLED" != "1"; then
2039 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2040 fi
2041
2042 if test "$LIBSSH2_ENABLED" = "1"; then
2043 if test -n "$DIR_SSH2"; then
2044 dnl when the libssh2 shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002045 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002046 dnl to prevent further configure tests to fail due to this
2047
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002048 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002049 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2"
2050 export CURL_LIBRARY_PATH
2051 AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002052 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002053 fi
2054 else
2055 dnl no libssh2, revert back to clean variables
2056 LDFLAGS=$CLEANLDFLAGS
2057 CPPFLAGS=$CLEANCPPFLAGS
2058 LIBS=$CLEANLIBS
2059 fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08002060elif test X"$OPT_LIBSSH" != Xno; then
2061 dnl backup the pre-libssh variables
2062 CLEANLDFLAGS="$LDFLAGS"
2063 CLEANCPPFLAGS="$CPPFLAGS"
2064 CLEANLIBS="$LIBS"
2065
2066 case "$OPT_LIBSSH" in
2067 yes)
2068 dnl --with-libssh (without path) used
2069 CURL_CHECK_PKGCONFIG(libssh)
2070
2071 if test "$PKGCONFIG" != "no" ; then
2072 LIB_SSH=`$PKGCONFIG --libs-only-l libssh`
2073 LD_SSH=`$PKGCONFIG --libs-only-L libssh`
2074 CPP_SSH=`$PKGCONFIG --cflags-only-I libssh`
2075 version=`$PKGCONFIG --modversion libssh`
Haibo Huangca2a8022020-07-10 20:17:42 -07002076 DIR_SSH=`echo $LD_SSH | $SED -e 's/^-L//'`
Elliott Hughes0128fe42018-02-27 14:57:55 -08002077 fi
2078
2079 ;;
2080 off)
2081 dnl no --with-libssh option given, just check default places
2082 ;;
2083 *)
2084 dnl use the given --with-libssh spot
2085 PREFIX_SSH=$OPT_LIBSSH
2086 ;;
2087 esac
2088
2089 dnl if given with a prefix, we set -L and -I based on that
2090 if test -n "$PREFIX_SSH"; then
2091 LIB_SSH="-lssh"
2092 LD_SSH=-L${PREFIX_SSH}/lib$libsuff
2093 CPP_SSH=-I${PREFIX_SSH}/include
2094 DIR_SSH=${PREFIX_SSH}/lib$libsuff
2095 fi
2096
2097 LDFLAGS="$LDFLAGS $LD_SSH"
2098 CPPFLAGS="$CPPFLAGS $CPP_SSH"
2099 LIBS="$LIB_SSH $LIBS"
2100
2101 AC_CHECK_LIB(ssh, ssh_new)
2102
2103 AC_CHECK_HEADERS(libssh/libssh.h,
2104 curl_ssh_msg="enabled (libSSH)"
2105 LIBSSH_ENABLED=1
2106 AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use])
2107 AC_SUBST(USE_LIBSSH, [1])
2108 )
2109
2110 if test X"$OPT_LIBSSH" != Xoff &&
2111 test "$LIBSSH_ENABLED" != "1"; then
2112 AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!])
2113 fi
2114
2115 if test "$LIBSSH_ENABLED" = "1"; then
2116 if test -n "$DIR_SSH"; then
2117 dnl when the libssh shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002118 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Elliott Hughes0128fe42018-02-27 14:57:55 -08002119 dnl to prevent further configure tests to fail due to this
2120
2121 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002122 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH"
2123 export CURL_LIBRARY_PATH
2124 AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH])
Elliott Hughes0128fe42018-02-27 14:57:55 -08002125 fi
2126 fi
2127 else
2128 dnl no libssh, revert back to clean variables
2129 LDFLAGS=$CLEANLDFLAGS
2130 CPPFLAGS=$CLEANCPPFLAGS
2131 LIBS=$CLEANLIBS
2132 fi
Haibo Huangb51266f2020-03-04 02:22:48 -08002133elif test X"$OPT_WOLFSSH" != Xno; then
2134 dnl backup the pre-wolfssh variables
2135 CLEANLDFLAGS="$LDFLAGS"
2136 CLEANCPPFLAGS="$CPPFLAGS"
2137 CLEANLIBS="$LIBS"
2138
2139
2140 if test "$OPT_WOLFSSH" != yes; then
2141 WOLFCONFIG="$OPT_WOLFSSH/bin/wolfssh-config"
2142 LDFLAGS="$LDFLAGS `$WOLFCONFIG --libs`"
2143 CPPFLAGS="$CPPFLAGS `$WOLFCONFIG --cflags`"
2144 fi
2145
2146 AC_CHECK_LIB(wolfssh, wolfSSH_Init)
2147
2148 AC_CHECK_HEADERS(wolfssh/ssh.h,
2149 curl_ssh_msg="enabled (wolfSSH)"
2150 WOLFSSH_ENABLED=1
2151 AC_DEFINE(USE_WOLFSSH, 1, [if wolfSSH is in use])
2152 AC_SUBST(USE_WOLFSSH, [1])
2153 )
2154
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002155fi
2156
2157dnl **********************************************************************
2158dnl Check for the presence of LIBRTMP libraries and headers
2159dnl **********************************************************************
2160
2161dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2162OPT_LIBRTMP=off
2163AC_ARG_WITH(librtmp,dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002164AS_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
2165AS_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002166 OPT_LIBRTMP=$withval)
2167
2168if test X"$OPT_LIBRTMP" != Xno; then
2169 dnl backup the pre-librtmp variables
2170 CLEANLDFLAGS="$LDFLAGS"
2171 CLEANCPPFLAGS="$CPPFLAGS"
2172 CLEANLIBS="$LIBS"
2173
2174 case "$OPT_LIBRTMP" in
2175 yes)
2176 dnl --with-librtmp (without path) used
2177 CURL_CHECK_PKGCONFIG(librtmp)
2178
2179 if test "$PKGCONFIG" != "no" ; then
2180 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2181 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2182 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2183 version=`$PKGCONFIG --modversion librtmp`
Haibo Huangca2a8022020-07-10 20:17:42 -07002184 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/^-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002185 else
2186 dnl To avoid link errors, we do not allow --librtmp without
2187 dnl a pkgconfig file
2188 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002189 fi
2190
2191 ;;
2192 off)
2193 dnl no --with-librtmp option given, just check default places
2194 LIB_RTMP="-lrtmp"
2195 ;;
2196 *)
2197 dnl use the given --with-librtmp spot
Elliott Hughes82be86d2017-09-20 17:00:17 -07002198 LIB_RTMP="-lrtmp"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002199 PREFIX_RTMP=$OPT_LIBRTMP
2200 ;;
2201 esac
2202
2203 dnl if given with a prefix, we set -L and -I based on that
2204 if test -n "$PREFIX_RTMP"; then
2205 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2206 CPP_RTMP=-I${PREFIX_RTMP}/include
2207 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2208 fi
2209
2210 LDFLAGS="$LDFLAGS $LD_RTMP"
2211 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002212 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002213
2214 AC_CHECK_LIB(rtmp, RTMP_Init,
2215 [
2216 AC_CHECK_HEADERS(librtmp/rtmp.h,
2217 curl_rtmp_msg="enabled (librtmp)"
2218 LIBRTMP_ENABLED=1
2219 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2220 AC_SUBST(USE_LIBRTMP, [1])
2221 )
2222 ],
2223 dnl not found, revert back to clean variables
2224 LDFLAGS=$CLEANLDFLAGS
2225 CPPFLAGS=$CLEANCPPFLAGS
2226 LIBS=$CLEANLIBS
2227 )
2228
2229 if test X"$OPT_LIBRTMP" != Xoff &&
2230 test "$LIBRTMP_ENABLED" != "1"; then
2231 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2232 fi
2233
2234fi
2235
2236dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002237dnl Check for linker switch for versioned symbols
2238dnl **********************************************************************
2239
2240versioned_symbols_flavour=
2241AC_MSG_CHECKING([whether versioned symbols are wanted])
2242AC_ARG_ENABLE(versioned-symbols,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002243AS_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2244AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002245[ case "$enableval" in
2246 yes) AC_MSG_RESULT(yes)
2247 AC_MSG_CHECKING([if libraries can be versioned])
2248 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2249 if test -z "$GLD"; then
2250 AC_MSG_RESULT(no)
2251 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2252 else
2253 AC_MSG_RESULT(yes)
Alex Deymo486467e2017-12-19 19:04:07 +01002254 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
2255 versioned_symbols_flavour="MULTISSL_"
2256 elif test "x$OPENSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002257 versioned_symbols_flavour="OPENSSL_"
2258 elif test "x$GNUTLS_ENABLED" = "x1"; then
2259 versioned_symbols_flavour="GNUTLS_"
2260 elif test "x$NSS_ENABLED" = "x1"; then
2261 versioned_symbols_flavour="NSS_"
Haibo Huang001784b2019-07-19 05:27:28 -07002262 elif test "x$WOLFSSL_ENABLED" = "x1"; then
2263 versioned_symbols_flavour="WOLFSSL_"
Haibo Huangc3c04f42020-08-19 13:00:07 -07002264 elif test "x$SCHANNEL_ENABLED" = "x1"; then
Haibo Huang65021c72019-03-27 15:37:23 -07002265 versioned_symbols_flavour="SCHANNEL_"
2266 elif test "x$SECURETRANSPORT_ENABLED" = "x1"; then
2267 versioned_symbols_flavour="SECURE_TRANSPORT_"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002268 else
2269 versioned_symbols_flavour=""
2270 fi
2271 versioned_symbols="yes"
2272 fi
2273 ;;
2274
2275 *) AC_MSG_RESULT(no)
2276 ;;
2277 esac
2278], [
2279AC_MSG_RESULT(no)
2280]
2281)
2282
2283AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2284 ["$versioned_symbols_flavour"])
2285AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2286 [test "x$versioned_symbols" = 'xyes'])
2287
2288dnl -------------------------------------------------
2289dnl check winidn option before other IDN libraries
2290dnl -------------------------------------------------
2291
2292AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2293OPT_WINIDN="default"
2294AC_ARG_WITH(winidn,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002295AS_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2296AS_HELP_STRING([--without-winidn], [disable Windows native IDN]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002297 OPT_WINIDN=$withval)
2298case "$OPT_WINIDN" in
2299 no|default)
2300 dnl --without-winidn option used or configure option not specified
2301 want_winidn="no"
2302 AC_MSG_RESULT([no])
2303 ;;
2304 yes)
2305 dnl --with-winidn option used without path
2306 want_winidn="yes"
2307 want_winidn_path="default"
2308 AC_MSG_RESULT([yes])
2309 ;;
2310 *)
2311 dnl --with-winidn option used with path
2312 want_winidn="yes"
2313 want_winidn_path="$withval"
2314 AC_MSG_RESULT([yes ($withval)])
2315 ;;
2316esac
2317
2318if test "$want_winidn" = "yes"; then
2319 dnl winidn library support has been requested
Elliott Hughesf344baa2021-12-07 09:12:34 -08002320 clean_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002321 clean_CPPFLAGS="$CPPFLAGS"
2322 clean_LDFLAGS="$LDFLAGS"
2323 clean_LIBS="$LIBS"
2324 WINIDN_LIBS="-lnormaliz"
Elliott Hughesf344baa2021-12-07 09:12:34 -08002325 WINIDN_CPPFLAGS=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002326 #
2327 if test "$want_winidn_path" != "default"; then
2328 dnl path has been specified
2329 dnl pkg-config not available or provides no info
2330 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2331 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2332 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2333 fi
2334 #
Elliott Hughesf344baa2021-12-07 09:12:34 -08002335 dnl WinIDN requires a minimum supported OS version of at least Vista (0x0600)
2336 AC_COMPILE_IFELSE([
2337 AC_LANG_PROGRAM([[
2338 #include <windows.h>
2339 ]],[[
2340 #if (WINVER < 0x600) && (_WIN32_WINNT < 0x600)
2341 #error
2342 #endif
2343 ]])
2344 ],[
2345 ],[
2346 CFLAGS=`echo $CFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'`
2347 CFLAGS=`echo $CFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'`
2348 CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-DWINVER=[[^ ]]*//g'`
2349 CPPFLAGS=`echo $CPPFLAGS | $SED -e 's/-D_WIN32_WINNT=[[^ ]]*//g'`
2350 WINIDN_CPPFLAGS="$WINIDN_CPPFLAGS -DWINVER=0x0600"
2351 ])
2352 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07002353 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
2354 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002355 LIBS="$WINIDN_LIBS $LIBS"
2356 #
2357 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2358 AC_LINK_IFELSE([
Elliott Hughes82be86d2017-09-20 17:00:17 -07002359 AC_LANG_PROGRAM([[
2360 #include <windows.h>
2361 ]],[[
2362 IdnToUnicode(0, NULL, 0, NULL, 0);
2363 ]])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002364 ],[
2365 AC_MSG_RESULT([yes])
2366 tst_links_winidn="yes"
2367 ],[
2368 AC_MSG_RESULT([no])
2369 tst_links_winidn="no"
2370 ])
2371 #
2372 if test "$tst_links_winidn" = "yes"; then
2373 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2374 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
2375 AC_SUBST([IDN_ENABLED], [1])
2376 curl_idn_msg="enabled (Windows-native)"
2377 else
2378 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
Elliott Hughesf344baa2021-12-07 09:12:34 -08002379 CFLAGS="$clean_CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002380 CPPFLAGS="$clean_CPPFLAGS"
2381 LDFLAGS="$clean_LDFLAGS"
2382 LIBS="$clean_LIBS"
2383 fi
2384fi
2385
2386dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002387dnl Check for the presence of IDN libraries and headers
2388dnl **********************************************************************
2389
Elliott Hughescee03382017-06-23 12:17:18 -07002390AC_MSG_CHECKING([whether to build with libidn2])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002391OPT_IDN="default"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002392AC_ARG_WITH(libidn2,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002393AS_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
2394AS_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002395 [OPT_IDN=$withval])
2396case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002397 no)
Elliott Hughescee03382017-06-23 12:17:18 -07002398 dnl --without-libidn2 option used
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002399 want_idn="no"
2400 AC_MSG_RESULT([no])
2401 ;;
2402 default)
2403 dnl configure option not specified
2404 want_idn="yes"
2405 want_idn_path="default"
2406 AC_MSG_RESULT([(assumed) yes])
2407 ;;
2408 yes)
Elliott Hughescee03382017-06-23 12:17:18 -07002409 dnl --with-libidn2 option used without path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002410 want_idn="yes"
2411 want_idn_path="default"
2412 AC_MSG_RESULT([yes])
2413 ;;
2414 *)
Elliott Hughescee03382017-06-23 12:17:18 -07002415 dnl --with-libidn2 option used with path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002416 want_idn="yes"
2417 want_idn_path="$withval"
2418 AC_MSG_RESULT([yes ($withval)])
2419 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002420esac
2421
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002422if test "$want_idn" = "yes"; then
2423 dnl idn library support has been requested
2424 clean_CPPFLAGS="$CPPFLAGS"
2425 clean_LDFLAGS="$LDFLAGS"
2426 clean_LIBS="$LIBS"
2427 PKGCONFIG="no"
2428 #
2429 if test "$want_idn_path" != "default"; then
2430 dnl path has been specified
2431 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
Elliott Hughescee03382017-06-23 12:17:18 -07002432 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002433 if test "$PKGCONFIG" != "no"; then
2434 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07002435 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002436 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07002437 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002438 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07002439 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Haibo Huangca2a8022020-07-10 20:17:42 -07002440 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/^-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002441 else
2442 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07002443 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002444 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
2445 IDN_CPPFLAGS="-I$want_idn_path/include"
2446 IDN_DIR="$want_idn_path/lib$libsuff"
2447 fi
2448 else
2449 dnl path not specified
Elliott Hughescee03382017-06-23 12:17:18 -07002450 CURL_CHECK_PKGCONFIG(libidn2)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002451 if test "$PKGCONFIG" != "no"; then
Elliott Hughescee03382017-06-23 12:17:18 -07002452 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
2453 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
2454 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Haibo Huangca2a8022020-07-10 20:17:42 -07002455 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/^-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002456 else
2457 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07002458 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002459 fi
2460 fi
2461 #
2462 if test "$PKGCONFIG" != "no"; then
2463 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
2464 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
2465 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2466 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
2467 else
2468 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
2469 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
2470 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2471 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
2472 fi
2473 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07002474 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
2475 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002476 LIBS="$IDN_LIBS $LIBS"
2477 #
Elliott Hughescee03382017-06-23 12:17:18 -07002478 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002479 AC_LINK_IFELSE([
Elliott Hughescee03382017-06-23 12:17:18 -07002480 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002481 ],[
2482 AC_MSG_RESULT([yes])
2483 tst_links_libidn="yes"
2484 ],[
2485 AC_MSG_RESULT([no])
2486 tst_links_libidn="no"
2487 ])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002488 #
Elliott Hughescee03382017-06-23 12:17:18 -07002489 AC_CHECK_HEADERS( idn2.h )
2490
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002491 if test "$tst_links_libidn" = "yes"; then
Elliott Hughescee03382017-06-23 12:17:18 -07002492 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002493 dnl different versions of libidn have different setups of these:
Elliott Hughescee03382017-06-23 12:17:18 -07002494
2495 AC_SUBST([IDN_ENABLED], [1])
2496 curl_idn_msg="enabled (libidn2)"
2497 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002498 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR"
2499 export CURL_LIBRARY_PATH
2500 AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002501 fi
2502 else
2503 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2504 CPPFLAGS="$clean_CPPFLAGS"
2505 LDFLAGS="$clean_LDFLAGS"
2506 LIBS="$clean_LIBS"
2507 fi
2508fi
2509
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002510dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002511dnl Check for nghttp2
2512dnl **********************************************************************
2513
2514OPT_H2="yes"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002515
Elliott Hughesf344baa2021-12-07 09:12:34 -08002516if test "x$disable_http" = "xyes" -o X"$want_hyper" != Xno; then
2517 # without HTTP or with Hyper, nghttp2 is no use
Elliott Hughes82be86d2017-09-20 17:00:17 -07002518 OPT_H2="no"
2519fi
2520
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002521AC_ARG_WITH(nghttp2,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002522AS_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
2523AS_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002524 [OPT_H2=$withval])
2525case "$OPT_H2" in
2526 no)
2527 dnl --without-nghttp2 option used
Elliott Hughesf344baa2021-12-07 09:12:34 -08002528 want_nghttp2="no"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002529 ;;
2530 yes)
2531 dnl --with-nghttp2 option used without path
Elliott Hughesf344baa2021-12-07 09:12:34 -08002532 want_nghttp2="default"
2533 want_nghttp2_path=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002534 ;;
2535 *)
2536 dnl --with-nghttp2 option used with path
Elliott Hughesf344baa2021-12-07 09:12:34 -08002537 want_nghttp2="yes"
2538 want_nghttp2_path="$withval/lib/pkgconfig"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002539 ;;
2540esac
2541
Elliott Hughesf344baa2021-12-07 09:12:34 -08002542if test X"$want_nghttp2" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002543 dnl backup the pre-nghttp2 variables
2544 CLEANLDFLAGS="$LDFLAGS"
2545 CLEANCPPFLAGS="$CPPFLAGS"
2546 CLEANLIBS="$LIBS"
2547
Elliott Hughesf344baa2021-12-07 09:12:34 -08002548 CURL_CHECK_PKGCONFIG(libnghttp2, $want_nghttp2_path)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002549
2550 if test "$PKGCONFIG" != "no" ; then
Elliott Hughesf344baa2021-12-07 09:12:34 -08002551 LIB_H2=`CURL_EXPORT_PCDIR([$want_nghttp2_path])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002552 $PKGCONFIG --libs-only-l libnghttp2`
2553 AC_MSG_NOTICE([-l is $LIB_H2])
2554
Elliott Hughesf344baa2021-12-07 09:12:34 -08002555 CPP_H2=`CURL_EXPORT_PCDIR([$want_nghttp2_path]) dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002556 $PKGCONFIG --cflags-only-I libnghttp2`
2557 AC_MSG_NOTICE([-I is $CPP_H2])
2558
Elliott Hughesf344baa2021-12-07 09:12:34 -08002559 LD_H2=`CURL_EXPORT_PCDIR([$want_nghttp2_path])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002560 $PKGCONFIG --libs-only-L libnghttp2`
2561 AC_MSG_NOTICE([-L is $LD_H2])
2562
2563 LDFLAGS="$LDFLAGS $LD_H2"
2564 CPPFLAGS="$CPPFLAGS $CPP_H2"
2565 LIBS="$LIB_H2 $LIBS"
2566
Haibo Huangb51266f2020-03-04 02:22:48 -08002567 # use nghttp2_session_set_local_window_size to require nghttp2
2568 # >= 1.12.0
Elliott Hughesf344baa2021-12-07 09:12:34 -08002569 AC_CHECK_LIB(nghttp2, nghttp2_session_set_local_window_size,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002570 [
2571 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
2572 curl_h2_msg="enabled (nghttp2)"
2573 NGHTTP2_ENABLED=1
2574 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
2575 AC_SUBST(USE_NGHTTP2, [1])
2576 )
2577 ],
2578 dnl not found, revert back to clean variables
2579 LDFLAGS=$CLEANLDFLAGS
2580 CPPFLAGS=$CLEANCPPFLAGS
2581 LIBS=$CLEANLIBS
2582 )
2583
2584 else
2585 dnl no nghttp2 pkg-config found, deal with it
Elliott Hughesf344baa2021-12-07 09:12:34 -08002586 if test X"$want_nghttp2" != Xdefault; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002587 dnl To avoid link errors, we do not allow --with-nghttp2 without
2588 dnl a pkgconfig file
2589 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
2590 fi
2591 fi
2592
2593fi
2594
2595dnl **********************************************************************
Haibo Huang445085a2019-09-11 13:33:50 -07002596dnl Check for ngtcp2 (QUIC)
2597dnl **********************************************************************
2598
2599OPT_TCP2="yes"
Haibo Huang445085a2019-09-11 13:33:50 -07002600
2601if test "x$disable_http" = "xyes"; then
2602 # without HTTP, ngtcp2 is no use
2603 OPT_TCP2="no"
2604fi
2605
2606AC_ARG_WITH(ngtcp2,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002607AS_HELP_STRING([--with-ngtcp2=PATH],[Enable ngtcp2 usage])
2608AS_HELP_STRING([--without-ngtcp2],[Disable ngtcp2 usage]),
Haibo Huang445085a2019-09-11 13:33:50 -07002609 [OPT_TCP2=$withval])
2610case "$OPT_TCP2" in
2611 no)
2612 dnl --without-ngtcp2 option used
2613 want_tcp2="no"
2614 ;;
2615 yes)
2616 dnl --with-ngtcp2 option used without path
2617 want_tcp2="default"
2618 want_tcp2_path=""
2619 ;;
2620 *)
2621 dnl --with-ngtcp2 option used with path
2622 want_tcp2="yes"
2623 want_tcp2_path="$withval/lib/pkgconfig"
2624 ;;
2625esac
2626
Haibo Huangb5a52b92020-10-28 22:18:23 -07002627curl_tcp2_msg="no (--with-ngtcp2)"
Haibo Huang445085a2019-09-11 13:33:50 -07002628if test X"$want_tcp2" != Xno; then
2629 dnl backup the pre-ngtcp2 variables
2630 CLEANLDFLAGS="$LDFLAGS"
2631 CLEANCPPFLAGS="$CPPFLAGS"
2632 CLEANLIBS="$LIBS"
2633
2634 CURL_CHECK_PKGCONFIG(libngtcp2, $want_tcp2_path)
2635
2636 if test "$PKGCONFIG" != "no" ; then
2637 LIB_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2638 $PKGCONFIG --libs-only-l libngtcp2`
2639 AC_MSG_NOTICE([-l is $LIB_TCP2])
2640
2641 CPP_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
2642 $PKGCONFIG --cflags-only-I libngtcp2`
2643 AC_MSG_NOTICE([-I is $CPP_TCP2])
2644
2645 LD_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2646 $PKGCONFIG --libs-only-L libngtcp2`
2647 AC_MSG_NOTICE([-L is $LD_TCP2])
2648
2649 LDFLAGS="$LDFLAGS $LD_TCP2"
2650 CPPFLAGS="$CPPFLAGS $CPP_TCP2"
2651 LIBS="$LIB_TCP2 $LIBS"
2652
2653 if test "x$cross_compiling" != "xyes"; then
Haibo Huangca2a8022020-07-10 20:17:42 -07002654 DIR_TCP2=`echo $LD_TCP2 | $SED -e 's/^-L//'`
Haibo Huang445085a2019-09-11 13:33:50 -07002655 fi
Elliott Hughesf344baa2021-12-07 09:12:34 -08002656 AC_CHECK_LIB(ngtcp2, ngtcp2_conn_client_new_versioned,
Haibo Huang445085a2019-09-11 13:33:50 -07002657 [
2658 AC_CHECK_HEADERS(ngtcp2/ngtcp2.h,
2659 NGTCP2_ENABLED=1
2660 AC_DEFINE(USE_NGTCP2, 1, [if ngtcp2 is in use])
2661 AC_SUBST(USE_NGTCP2, [1])
2662 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_TCP2"
2663 export CURL_LIBRARY_PATH
2664 AC_MSG_NOTICE([Added $DIR_TCP2 to CURL_LIBRARY_PATH])
2665 )
2666 ],
2667 dnl not found, revert back to clean variables
2668 LDFLAGS=$CLEANLDFLAGS
2669 CPPFLAGS=$CLEANCPPFLAGS
2670 LIBS=$CLEANLIBS
2671 )
2672
2673 else
2674 dnl no ngtcp2 pkg-config found, deal with it
2675 if test X"$want_tcp2" != Xdefault; then
2676 dnl To avoid link errors, we do not allow --with-ngtcp2 without
2677 dnl a pkgconfig file
2678 AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2 pkg-config file.])
2679 fi
2680 fi
2681
2682fi
2683
Haibo Huang24c77a12020-04-29 13:49:57 -07002684if test "x$NGTCP2_ENABLED" = "x1" -a "x$OPENSSL_ENABLED" = "x1"; then
Haibo Huang445085a2019-09-11 13:33:50 -07002685 dnl backup the pre-ngtcp2_crypto_openssl variables
2686 CLEANLDFLAGS="$LDFLAGS"
2687 CLEANCPPFLAGS="$CPPFLAGS"
2688 CLEANLIBS="$LIBS"
2689
2690 CURL_CHECK_PKGCONFIG(libngtcp2_crypto_openssl, $want_tcp2_path)
2691
2692 if test "$PKGCONFIG" != "no" ; then
2693 LIB_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2694 $PKGCONFIG --libs-only-l libngtcp2_crypto_openssl`
2695 AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_OPENSSL])
2696
2697 CPP_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
2698 $PKGCONFIG --cflags-only-I libngtcp2_crypto_openssl`
2699 AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_OPENSSL])
2700
2701 LD_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2702 $PKGCONFIG --libs-only-L libngtcp2_crypto_openssl`
2703 AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_OPENSSL])
2704
2705 LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_OPENSSL"
2706 CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_OPENSSL"
2707 LIBS="$LIB_NGTCP2_CRYPTO_OPENSSL $LIBS"
2708
2709 if test "x$cross_compiling" != "xyes"; then
Haibo Huangca2a8022020-07-10 20:17:42 -07002710 DIR_NGTCP2_CRYPTO_OPENSSL=`echo $LD_NGTCP2_CRYPTO_OPENSSL | $SED -e 's/^-L//'`
Haibo Huang445085a2019-09-11 13:33:50 -07002711 fi
2712 AC_CHECK_LIB(ngtcp2_crypto_openssl, ngtcp2_crypto_ctx_initial,
2713 [
2714 AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h,
2715 NGTCP2_ENABLED=1
2716 AC_DEFINE(USE_NGTCP2_CRYPTO_OPENSSL, 1, [if ngtcp2_crypto_openssl is in use])
2717 AC_SUBST(USE_NGTCP2_CRYPTO_OPENSSL, [1])
2718 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_OPENSSL"
2719 export CURL_LIBRARY_PATH
2720 AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_OPENSSL to CURL_LIBRARY_PATH])
2721 )
2722 ],
2723 dnl not found, revert back to clean variables
2724 LDFLAGS=$CLEANLDFLAGS
2725 CPPFLAGS=$CLEANCPPFLAGS
2726 LIBS=$CLEANLIBS
2727 )
2728
2729 else
2730 dnl no ngtcp2_crypto_openssl pkg-config found, deal with it
2731 if test X"$want_tcp2" != Xdefault; then
2732 dnl To avoid link errors, we do not allow --with-ngtcp2 without
2733 dnl a pkgconfig file
2734 AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_openssl pkg-config file.])
2735 fi
2736 fi
2737fi
2738
Haibo Huang24c77a12020-04-29 13:49:57 -07002739if test "x$NGTCP2_ENABLED" = "x1" -a "x$GNUTLS_ENABLED" = "x1"; then
2740 dnl backup the pre-ngtcp2_crypto_gnutls variables
2741 CLEANLDFLAGS="$LDFLAGS"
2742 CLEANCPPFLAGS="$CPPFLAGS"
2743 CLEANLIBS="$LIBS"
2744
2745 CURL_CHECK_PKGCONFIG(libngtcp2_crypto_gnutls, $want_tcp2_path)
2746
2747 if test "$PKGCONFIG" != "no" ; then
2748 LIB_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2749 $PKGCONFIG --libs-only-l libngtcp2_crypto_gnutls`
2750 AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_GNUTLS])
2751
2752 CPP_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
2753 $PKGCONFIG --cflags-only-I libngtcp2_crypto_gnutls`
2754 AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_GNUTLS])
2755
2756 LD_NGTCP2_CRYPTO_GNUTLS=`CURL_EXPORT_PCDIR([$want_tcp2_path])
2757 $PKGCONFIG --libs-only-L libngtcp2_crypto_gnutls`
2758 AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_GNUTLS])
2759
2760 LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_GNUTLS"
2761 CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_GNUTLS"
2762 LIBS="$LIB_NGTCP2_CRYPTO_GNUTLS $LIBS"
2763
2764 if test "x$cross_compiling" != "xyes"; then
Haibo Huangca2a8022020-07-10 20:17:42 -07002765 DIR_NGTCP2_CRYPTO_GNUTLS=`echo $LD_NGTCP2_CRYPTO_GNUTLS | $SED -e 's/^-L//'`
Haibo Huang24c77a12020-04-29 13:49:57 -07002766 fi
2767 AC_CHECK_LIB(ngtcp2_crypto_gnutls, ngtcp2_crypto_ctx_initial,
2768 [
2769 AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h,
2770 NGTCP2_ENABLED=1
2771 AC_DEFINE(USE_NGTCP2_CRYPTO_GNUTLS, 1, [if ngtcp2_crypto_gnutls is in use])
2772 AC_SUBST(USE_NGTCP2_CRYPTO_GNUTLS, [1])
2773 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_GNUTLS"
2774 export CURL_LIBRARY_PATH
2775 AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_GNUTLS to CURL_LIBRARY_PATH])
2776 )
2777 ],
2778 dnl not found, revert back to clean variables
2779 LDFLAGS=$CLEANLDFLAGS
2780 CPPFLAGS=$CLEANCPPFLAGS
2781 LIBS=$CLEANLIBS
2782 )
2783
2784 else
2785 dnl no ngtcp2_crypto_gnutls pkg-config found, deal with it
2786 if test X"$want_tcp2" != Xdefault; then
2787 dnl To avoid link errors, we do not allow --with-ngtcp2 without
2788 dnl a pkgconfig file
2789 AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_gnutls pkg-config file.])
2790 fi
2791 fi
2792fi
2793
Haibo Huang445085a2019-09-11 13:33:50 -07002794dnl **********************************************************************
2795dnl Check for nghttp3 (HTTP/3 with ngtcp2)
2796dnl **********************************************************************
2797
2798OPT_NGHTTP3="yes"
2799
2800if test "x$NGTCP2_ENABLED" = "x"; then
2801 # without ngtcp2, nghttp3 is of no use for us
2802 OPT_NGHTTP3="no"
2803fi
2804
2805AC_ARG_WITH(nghttp3,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002806AS_HELP_STRING([--with-nghttp3=PATH],[Enable nghttp3 usage])
2807AS_HELP_STRING([--without-nghttp3],[Disable nghttp3 usage]),
Haibo Huang445085a2019-09-11 13:33:50 -07002808 [OPT_NGHTTP3=$withval])
2809case "$OPT_NGHTTP3" in
2810 no)
2811 dnl --without-nghttp3 option used
2812 want_nghttp3="no"
2813 ;;
2814 yes)
2815 dnl --with-nghttp3 option used without path
2816 want_nghttp3="default"
2817 want_nghttp3_path=""
2818 ;;
2819 *)
2820 dnl --with-nghttp3 option used with path
2821 want_nghttp3="yes"
2822 want_nghttp3_path="$withval/lib/pkgconfig"
2823 ;;
2824esac
2825
Haibo Huangb5a52b92020-10-28 22:18:23 -07002826curl_http3_msg="no (--with-nghttp3)"
Haibo Huang445085a2019-09-11 13:33:50 -07002827if test X"$want_nghttp3" != Xno; then
2828 dnl backup the pre-nghttp3 variables
2829 CLEANLDFLAGS="$LDFLAGS"
2830 CLEANCPPFLAGS="$CPPFLAGS"
2831 CLEANLIBS="$LIBS"
2832
2833 CURL_CHECK_PKGCONFIG(libnghttp3, $want_nghttp3_path)
2834
2835 if test "$PKGCONFIG" != "no" ; then
2836 LIB_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
2837 $PKGCONFIG --libs-only-l libnghttp3`
2838 AC_MSG_NOTICE([-l is $LIB_NGHTTP3])
2839
2840 CPP_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) dnl
2841 $PKGCONFIG --cflags-only-I libnghttp3`
2842 AC_MSG_NOTICE([-I is $CPP_NGHTTP3])
2843
2844 LD_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
2845 $PKGCONFIG --libs-only-L libnghttp3`
2846 AC_MSG_NOTICE([-L is $LD_NGHTTP3])
2847
2848 LDFLAGS="$LDFLAGS $LD_NGHTTP3"
2849 CPPFLAGS="$CPPFLAGS $CPP_NGHTTP3"
2850 LIBS="$LIB_NGHTTP3 $LIBS"
2851
2852 if test "x$cross_compiling" != "xyes"; then
Haibo Huangca2a8022020-07-10 20:17:42 -07002853 DIR_NGHTTP3=`echo $LD_NGHTTP3 | $SED -e 's/^-L//'`
Haibo Huang445085a2019-09-11 13:33:50 -07002854 fi
Elliott Hughesf344baa2021-12-07 09:12:34 -08002855 AC_CHECK_LIB(nghttp3, nghttp3_conn_client_new_versioned,
Haibo Huang445085a2019-09-11 13:33:50 -07002856 [
2857 AC_CHECK_HEADERS(nghttp3/nghttp3.h,
2858 curl_h3_msg="enabled (ngtcp2 + nghttp3)"
2859 NGHTTP3_ENABLED=1
2860 AC_DEFINE(USE_NGHTTP3, 1, [if nghttp3 is in use])
2861 AC_SUBST(USE_NGHTTP3, [1])
2862 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGHTTP3"
2863 export CURL_LIBRARY_PATH
2864 AC_MSG_NOTICE([Added $DIR_NGHTTP3 to CURL_LIBRARY_PATH])
2865 experimental="$experimental HTTP3"
2866 )
2867 ],
2868 dnl not found, revert back to clean variables
2869 LDFLAGS=$CLEANLDFLAGS
2870 CPPFLAGS=$CLEANCPPFLAGS
2871 LIBS=$CLEANLIBS
2872 )
2873
2874 else
2875 dnl no nghttp3 pkg-config found, deal with it
2876 if test X"$want_nghttp3" != Xdefault; then
2877 dnl To avoid link errors, we do not allow --with-nghttp3 without
2878 dnl a pkgconfig file
2879 AC_MSG_ERROR([--with-nghttp3 was specified but could not find nghttp3 pkg-config file.])
2880 fi
2881 fi
2882
2883fi
2884
2885dnl **********************************************************************
2886dnl Check for quiche (QUIC)
2887dnl **********************************************************************
2888
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002889OPT_QUICHE="no"
Haibo Huang445085a2019-09-11 13:33:50 -07002890
2891if test "x$disable_http" = "xyes" -o "x$USE_NGTCP" = "x1"; then
2892 # without HTTP or with ngtcp2, quiche is no use
2893 OPT_QUICHE="no"
2894fi
2895
2896AC_ARG_WITH(quiche,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002897AS_HELP_STRING([--with-quiche=PATH],[Enable quiche usage])
2898AS_HELP_STRING([--without-quiche],[Disable quiche usage]),
Haibo Huang445085a2019-09-11 13:33:50 -07002899 [OPT_QUICHE=$withval])
2900case "$OPT_QUICHE" in
2901 no)
2902 dnl --without-quiche option used
2903 want_quiche="no"
2904 ;;
2905 yes)
2906 dnl --with-quiche option used without path
2907 want_quiche="default"
2908 want_quiche_path=""
2909 ;;
2910 *)
2911 dnl --with-quiche option used with path
2912 want_quiche="yes"
2913 want_quiche_path="$withval"
2914 ;;
2915esac
2916
2917if test X"$want_quiche" != Xno; then
Elliott Hughesf344baa2021-12-07 09:12:34 -08002918
2919 if test "$NGHTTP3_ENABLED" = 1; then
2920 AC_MSG_ERROR([--with-quiche and --with-ngtcp2 are mutually exclusive])
2921 fi
2922
Haibo Huang445085a2019-09-11 13:33:50 -07002923 dnl backup the pre-quiche variables
2924 CLEANLDFLAGS="$LDFLAGS"
2925 CLEANCPPFLAGS="$CPPFLAGS"
2926 CLEANLIBS="$LIBS"
2927
2928 CURL_CHECK_PKGCONFIG(quiche, $want_quiche_path)
2929
2930 if test "$PKGCONFIG" != "no" ; then
2931 LIB_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
2932 $PKGCONFIG --libs-only-l quiche`
2933 AC_MSG_NOTICE([-l is $LIB_QUICHE])
2934
2935 CPP_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) dnl
2936 $PKGCONFIG --cflags-only-I quiche`
2937 AC_MSG_NOTICE([-I is $CPP_QUICHE])
2938
2939 LD_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
2940 $PKGCONFIG --libs-only-L quiche`
2941 AC_MSG_NOTICE([-L is $LD_QUICHE])
2942
2943 LDFLAGS="$LDFLAGS $LD_QUICHE"
2944 CPPFLAGS="$CPPFLAGS $CPP_QUICHE"
2945 LIBS="$LIB_QUICHE $LIBS"
2946
2947 if test "x$cross_compiling" != "xyes"; then
Haibo Huangca2a8022020-07-10 20:17:42 -07002948 DIR_QUICHE=`echo $LD_QUICHE | $SED -e 's/^-L//'`
Haibo Huang445085a2019-09-11 13:33:50 -07002949 fi
2950 AC_CHECK_LIB(quiche, quiche_connect,
2951 [
2952 AC_CHECK_HEADERS(quiche.h,
2953 experimental="$experimental HTTP3"
2954 AC_MSG_NOTICE([HTTP3 support is experimental])
2955 curl_h3_msg="enabled (quiche)"
2956 QUICHE_ENABLED=1
2957 AC_DEFINE(USE_QUICHE, 1, [if quiche is in use])
2958 AC_SUBST(USE_QUICHE, [1])
Haibo Huangca2a8022020-07-10 20:17:42 -07002959 AC_CHECK_FUNCS([quiche_conn_set_qlog_fd])
Haibo Huang445085a2019-09-11 13:33:50 -07002960 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_QUICHE"
2961 export CURL_LIBRARY_PATH
2962 AC_MSG_NOTICE([Added $DIR_QUICHE to CURL_LIBRARY_PATH]),
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002963 [],
2964 [
2965AC_INCLUDES_DEFAULT
2966#include <sys/socket.h>
2967 ]
Haibo Huang445085a2019-09-11 13:33:50 -07002968 )
2969 ],
2970 dnl not found, revert back to clean variables
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002971 AC_MSG_ERROR([couldn't use quiche])
Haibo Huang445085a2019-09-11 13:33:50 -07002972 )
2973 else
Haibo Huangb51266f2020-03-04 02:22:48 -08002974 dnl no quiche pkg-config found, deal with it
Haibo Huang445085a2019-09-11 13:33:50 -07002975 if test X"$want_quiche" != Xdefault; then
Haibo Huangb51266f2020-03-04 02:22:48 -08002976 dnl To avoid link errors, we do not allow --with-quiche without
Haibo Huang445085a2019-09-11 13:33:50 -07002977 dnl a pkgconfig file
2978 AC_MSG_ERROR([--with-quiche was specified but could not find quiche pkg-config file.])
2979 fi
2980 fi
2981fi
2982
2983dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002984dnl Check for zsh completion path
2985dnl **********************************************************************
2986
2987OPT_ZSH_FPATH=default
2988AC_ARG_WITH(zsh-functions-dir,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07002989AS_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
2990AS_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
Alex Deymod15eaac2016-06-28 14:49:26 -07002991 [OPT_ZSH_FPATH=$withval])
2992case "$OPT_ZSH_FPATH" in
2993 no)
2994 dnl --without-zsh-functions-dir option used
2995 ;;
2996 default|yes)
2997 dnl --with-zsh-functions-dir option used without path
2998 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
2999 AC_SUBST(ZSH_FUNCTIONS_DIR)
3000 ;;
3001 *)
3002 dnl --with-zsh-functions-dir option used with path
3003 ZSH_FUNCTIONS_DIR="$withval"
3004 AC_SUBST(ZSH_FUNCTIONS_DIR)
3005 ;;
3006esac
3007
3008dnl **********************************************************************
Haibo Huang65021c72019-03-27 15:37:23 -07003009dnl Check for fish completion path
3010dnl **********************************************************************
3011
3012OPT_FISH_FPATH=default
3013AC_ARG_WITH(fish-functions-dir,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003014AS_HELP_STRING([--with-fish-functions-dir=PATH],[Install fish completions to PATH])
3015AS_HELP_STRING([--without-fish-functions-dir],[Do not install fish completions]),
Haibo Huang65021c72019-03-27 15:37:23 -07003016 [OPT_FISH_FPATH=$withval])
3017case "$OPT_FISH_FPATH" in
3018 no)
3019 dnl --without-fish-functions-dir option used
3020 ;;
3021 default|yes)
3022 dnl --with-fish-functions-dir option used without path
Haibo Huang34ab3462019-05-22 00:50:27 -07003023 CURL_CHECK_PKGCONFIG(fish)
3024 if test "$PKGCONFIG" != "no" ; then
3025 FISH_FUNCTIONS_DIR="$($PKGCONFIG --variable completionsdir fish)"
3026 else
3027 FISH_FUNCTIONS_DIR="$datarootdir/fish/vendor_completions.d"
3028 fi
Haibo Huang65021c72019-03-27 15:37:23 -07003029 AC_SUBST(FISH_FUNCTIONS_DIR)
3030 ;;
3031 *)
3032 dnl --with-fish-functions-dir option used with path
3033 FISH_FUNCTIONS_DIR="$withval"
3034 AC_SUBST(FISH_FUNCTIONS_DIR)
3035 ;;
3036esac
3037
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003038CURL_CHECK_HEADER_MALLOC
3039CURL_CHECK_HEADER_MEMORY
3040
3041dnl Now check for the very most basic headers. Then we can use these
3042dnl ones as default-headers when checking for the rest!
3043AC_CHECK_HEADERS(
3044 sys/types.h \
3045 sys/time.h \
3046 sys/select.h \
3047 sys/socket.h \
3048 sys/ioctl.h \
3049 sys/uio.h \
3050 assert.h \
3051 unistd.h \
3052 stdlib.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003053 arpa/inet.h \
3054 net/if.h \
3055 netinet/in.h \
Elliott Hughes0128fe42018-02-27 14:57:55 -08003056 netinet/in6.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003057 sys/un.h \
Alex Deymo486467e2017-12-19 19:04:07 +01003058 linux/tcp.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003059 netinet/tcp.h \
3060 netdb.h \
3061 sys/sockio.h \
3062 sys/stat.h \
3063 sys/param.h \
3064 termios.h \
3065 termio.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003066 fcntl.h \
3067 alloca.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003068 io.h \
3069 pwd.h \
3070 utime.h \
3071 sys/utime.h \
3072 sys/poll.h \
3073 poll.h \
3074 socket.h \
3075 sys/resource.h \
3076 libgen.h \
3077 locale.h \
3078 errno.h \
3079 stdbool.h \
3080 arpa/tftp.h \
3081 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003082 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003083 setjmp.h,
3084dnl to do if not found
3085[],
3086dnl to do if found
3087[],
3088dnl default includes
3089[
3090#ifdef HAVE_SYS_TYPES_H
3091#include <sys/types.h>
3092#endif
3093#ifdef HAVE_SYS_TIME_H
3094#include <sys/time.h>
3095#endif
3096#ifdef HAVE_SYS_SELECT_H
3097#include <sys/select.h>
Haibo Huang24c77a12020-04-29 13:49:57 -07003098#elif defined(HAVE_UNISTD_H)
3099#include <unistd.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003100#endif
3101#ifdef HAVE_SYS_SOCKET_H
3102#include <sys/socket.h>
3103#endif
3104#ifdef HAVE_NETINET_IN_H
3105#include <netinet/in.h>
3106#endif
Elliott Hughes0128fe42018-02-27 14:57:55 -08003107#ifdef HAVE_NETINET_IN6_H
3108#include <netinet/in6.h>
3109#endif
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003110#ifdef HAVE_SYS_UN_H
3111#include <sys/un.h>
3112#endif
3113]
3114)
3115
Haibo Huang65021c72019-03-27 15:37:23 -07003116
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003117dnl Checks for typedefs, structures, and compiler characteristics.
3118AC_C_CONST
3119CURL_CHECK_VARIADIC_MACROS
3120AC_TYPE_SIZE_T
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003121
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003122CURL_CHECK_STRUCT_TIMEVAL
3123CURL_VERIFY_RUNTIMELIBS
3124
Elliott Hughes72d948d2018-08-03 14:37:21 -07003125AX_COMPILE_CHECK_SIZEOF(size_t)
3126AX_COMPILE_CHECK_SIZEOF(long)
3127AX_COMPILE_CHECK_SIZEOF(int)
3128AX_COMPILE_CHECK_SIZEOF(short)
3129AX_COMPILE_CHECK_SIZEOF(time_t)
3130AX_COMPILE_CHECK_SIZEOF(off_t)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003131
Alex Deymo486467e2017-12-19 19:04:07 +01003132o=$CPPFLAGS
3133CPPFLAGS="-I$srcdir/include $CPPFLAGS"
Elliott Hughes72d948d2018-08-03 14:37:21 -07003134AX_COMPILE_CHECK_SIZEOF(curl_off_t, [
Alex Deymo486467e2017-12-19 19:04:07 +01003135#include <curl/system.h>
3136])
3137CPPFLAGS=$o
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003138
3139AC_CHECK_TYPE(long long,
3140 [AC_DEFINE(HAVE_LONGLONG, 1,
3141 [Define to 1 if the compiler supports the 'long long' data type.])]
3142 longlong="yes"
3143)
3144
3145if test "xyes" = "x$longlong"; then
3146 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003147 AC_COMPILE_IFELSE([
3148 AC_LANG_PROGRAM([[
3149 ]],[[
3150 long long val = 1000LL;
3151 ]])
3152 ],[
3153 AC_MSG_RESULT([yes])
3154 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3155 ],[
3156 AC_MSG_RESULT([no])
3157 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003158fi
3159
3160
3161# check for ssize_t
3162AC_CHECK_TYPE(ssize_t, ,
3163 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3164
3165# check for bool type
3166AC_CHECK_TYPE([bool],[
3167 AC_DEFINE(HAVE_BOOL_T, 1,
3168 [Define to 1 if bool is an available type.])
3169], ,[
3170#ifdef HAVE_SYS_TYPES_H
3171#include <sys/types.h>
3172#endif
3173#ifdef HAVE_STDBOOL_H
3174#include <stdbool.h>
3175#endif
3176])
3177
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003178# check for sa_family_t
3179AC_CHECK_TYPE(sa_family_t,
3180 AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
3181 [
3182 # The windows name?
3183 AC_CHECK_TYPE(ADDRESS_FAMILY,
3184 AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
3185 AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
3186 [
3187#ifdef HAVE_SYS_SOCKET_H
3188#include <sys/socket.h>
3189#endif
3190 ])
3191 ],
3192[
3193#ifdef HAVE_SYS_SOCKET_H
3194#include <sys/socket.h>
3195#endif
3196])
3197
Haibo Huangca2a8022020-07-10 20:17:42 -07003198# check for suseconds_t
3199AC_CHECK_TYPE([suseconds_t],[
3200 AC_DEFINE(HAVE_SUSECONDS_T, 1,
3201 [Define to 1 if suseconds_t is an available type.])
3202], ,[
3203#ifdef HAVE_SYS_TYPES_H
3204#include <sys/types.h>
3205#endif
3206#ifdef HAVE_SYS_TIME_H
3207#include <sys/time.h>
3208#endif
3209])
3210
Elliott Hughescac39802018-04-27 16:19:43 -07003211AC_MSG_CHECKING([if time_t is unsigned])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003212CURL_RUN_IFELSE(
3213 [
Elliott Hughescac39802018-04-27 16:19:43 -07003214 #include <time.h>
3215 #include <limits.h>
3216 time_t t = -1;
3217 return (t > 0);
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003218 ],[
Elliott Hughescac39802018-04-27 16:19:43 -07003219 AC_MSG_RESULT([yes])
3220 AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
3221],[
3222 AC_MSG_RESULT([no])
3223],[
3224 dnl cross-compiling, most systems are unsigned
3225 AC_MSG_RESULT([no])
3226])
3227
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003228CURL_CONFIGURE_PULL_SYS_POLL
3229
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003230TYPE_IN_ADDR_T
3231
3232TYPE_SOCKADDR_STORAGE
3233
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003234CURL_CHECK_FUNC_SELECT
3235
3236CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003237CURL_CHECK_FUNC_SEND
3238CURL_CHECK_MSG_NOSIGNAL
3239
3240CURL_CHECK_FUNC_ALARM
3241CURL_CHECK_FUNC_BASENAME
3242CURL_CHECK_FUNC_CLOSESOCKET
3243CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3244CURL_CHECK_FUNC_CONNECT
3245CURL_CHECK_FUNC_FCNTL
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003246CURL_CHECK_FUNC_FREEADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003247CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003248CURL_CHECK_FUNC_FTRUNCATE
3249CURL_CHECK_FUNC_GETADDRINFO
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003250CURL_CHECK_FUNC_GETHOSTBYNAME
3251CURL_CHECK_FUNC_GETHOSTBYNAME_R
3252CURL_CHECK_FUNC_GETHOSTNAME
Haibo Huang34ab3462019-05-22 00:50:27 -07003253CURL_CHECK_FUNC_GETPEERNAME
3254CURL_CHECK_FUNC_GETSOCKNAME
Haibo Huangb6336c12019-06-05 01:34:44 -07003255CURL_CHECK_FUNC_IF_NAMETOINDEX
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003256CURL_CHECK_FUNC_GETIFADDRS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003257CURL_CHECK_FUNC_GMTIME_R
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003258CURL_CHECK_FUNC_INET_NTOP
3259CURL_CHECK_FUNC_INET_PTON
3260CURL_CHECK_FUNC_IOCTL
3261CURL_CHECK_FUNC_IOCTLSOCKET
3262CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3263CURL_CHECK_FUNC_LOCALTIME_R
3264CURL_CHECK_FUNC_MEMRCHR
3265CURL_CHECK_FUNC_POLL
3266CURL_CHECK_FUNC_SETSOCKOPT
3267CURL_CHECK_FUNC_SIGACTION
3268CURL_CHECK_FUNC_SIGINTERRUPT
3269CURL_CHECK_FUNC_SIGNAL
3270CURL_CHECK_FUNC_SIGSETJMP
3271CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003272CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003273CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003274CURL_CHECK_FUNC_STRCMPI
3275CURL_CHECK_FUNC_STRDUP
3276CURL_CHECK_FUNC_STRERROR_R
3277CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003278CURL_CHECK_FUNC_STRNCMPI
3279CURL_CHECK_FUNC_STRNICMP
3280CURL_CHECK_FUNC_STRSTR
3281CURL_CHECK_FUNC_STRTOK_R
3282CURL_CHECK_FUNC_STRTOLL
3283CURL_CHECK_FUNC_WRITEV
3284
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003285case $host in
3286 *msdosdjgpp)
3287 ac_cv_func_pipe=no
3288 skipcheck_pipe=yes
3289 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3290 ;;
3291esac
3292
Elliott Hughes72d948d2018-08-03 14:37:21 -07003293AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
3294 [[#include <pwd.h>
3295 #include <sys/types.h>]])
3296
3297
3298AC_CHECK_FUNCS([fnmatch \
3299 geteuid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003300 getpass_r \
3301 getppid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003302 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003303 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003304 getrlimit \
3305 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003306 if_nametoindex \
Alex Deymo486467e2017-12-19 19:04:07 +01003307 mach_absolute_time \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003308 pipe \
3309 setlocale \
3310 setmode \
3311 setrlimit \
Haibo Huang445085a2019-09-11 13:33:50 -07003312 usleep \
Elliott Hughes82be86d2017-09-20 17:00:17 -07003313 utime \
3314 utimes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003315],[
3316],[
3317 func="$ac_func"
3318 eval skipcheck=\$skipcheck_$func
3319 if test "x$skipcheck" != "xyes"; then
3320 AC_MSG_CHECKING([deeper for $func])
3321 AC_LINK_IFELSE([
3322 AC_LANG_PROGRAM([[
3323 ]],[[
3324 $func ();
3325 ]])
3326 ],[
3327 AC_MSG_RESULT([yes])
3328 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003329 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003330 [Define to 1 if you have the $func function.])
3331 ],[
3332 AC_MSG_RESULT([but still no])
3333 ])
3334 fi
3335])
3336
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003337CURL_CHECK_NONBLOCKING_SOCKET
3338
3339dnl ************************************************************
3340dnl nroff tool stuff
3341dnl
3342
3343AC_PATH_PROG( PERL, perl, ,
3344 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3345AC_SUBST(PERL)
3346
3347AC_PATH_PROGS( NROFF, gnroff nroff, ,
3348 $PATH:/usr/bin/:/usr/local/bin )
3349AC_SUBST(NROFF)
3350
3351if test -n "$NROFF"; then
3352 dnl only check for nroff options if an nroff command was found
3353
3354 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3355 MANOPT="-man"
3356 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3357 if test -z "$mancheck"; then
3358 MANOPT="-mandoc"
3359 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3360 if test -z "$mancheck"; then
3361 MANOPT=""
3362 AC_MSG_RESULT([failed])
3363 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3364 else
3365 AC_MSG_RESULT([$MANOPT])
3366 fi
3367 else
3368 AC_MSG_RESULT([$MANOPT])
3369 fi
3370 AC_SUBST(MANOPT)
3371fi
3372
3373if test -z "$MANOPT"
3374then
3375 dnl if no nroff tool was found, or no option that could convert man pages
3376 dnl was found, then disable the built-in manual stuff
3377 AC_MSG_WARN([disabling built-in manual])
3378 USE_MANUAL="no";
3379fi
3380
3381dnl *************************************************************************
3382dnl If the manual variable still is set, then we go with providing a built-in
3383dnl manual
3384
3385if test "$USE_MANUAL" = "1"; then
3386 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3387 curl_manual_msg="enabled"
3388fi
3389
3390dnl set variable for use in automakefile(s)
3391AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3392
3393CURL_CHECK_LIB_ARES
3394AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3395
Alex Deymod15eaac2016-06-28 14:49:26 -07003396if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003397 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003398 build_libhostname=yes
3399else
3400 build_libhostname=no
3401fi
3402AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3403
Elliott Hughes82be86d2017-09-20 17:00:17 -07003404if test "x$want_ares" != xyes; then
3405 CURL_CHECK_OPTION_THREADED_RESOLVER
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003406fi
3407
Elliott Hughes82be86d2017-09-20 17:00:17 -07003408dnl ************************************************************
3409dnl disable POSIX threads
3410dnl
3411AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3412AC_ARG_ENABLE(pthreads,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003413AS_HELP_STRING([--enable-pthreads],
Elliott Hughes82be86d2017-09-20 17:00:17 -07003414 [Enable POSIX threads (default for threaded resolver)])
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003415AS_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
Elliott Hughes82be86d2017-09-20 17:00:17 -07003416[ case "$enableval" in
3417 no) AC_MSG_RESULT(no)
3418 want_pthreads=no
3419 ;;
3420 *) AC_MSG_RESULT(yes)
3421 want_pthreads=yes
3422 ;;
3423 esac ], [
3424 AC_MSG_RESULT(auto)
3425 want_pthreads=auto
3426 ]
3427)
3428
3429dnl turn off pthreads if rt is disabled
3430if test "$want_pthreads" != "no"; then
3431 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
3432 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
3433 fi
3434 if test "$dontwant_rt" != "no"; then
3435 dnl if --enable-pthreads was explicit then warn it's being ignored
3436 if test "$want_pthreads" = "yes"; then
3437 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
3438 fi
3439 want_pthreads=no
3440 fi
3441fi
3442
3443dnl turn off pthreads if no threaded resolver
3444if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
3445 want_pthreads=no
3446fi
3447
3448dnl detect pthreads
3449if test "$want_pthreads" != "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003450 AC_CHECK_HEADER(pthread.h,
3451 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3452 save_CFLAGS="$CFLAGS"
Haibo Huangca2a8022020-07-10 20:17:42 -07003453 dnl When statically linking against boringssl, -lpthread is added to LIBS.
3454 dnl Make sure to that this does not pass the check below, we really want
3455 dnl -pthread in CFLAGS as recommended for GCC. This also ensures that
3456 dnl lib1541 and lib1565 tests are built with these options. Otherwise
3457 dnl they fail the build since tests/libtest/Makefile.am clears LIBS.
3458 save_LIBS="$LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003459
Haibo Huangca2a8022020-07-10 20:17:42 -07003460 LIBS=
3461 dnl Check for libc variants without a separate pthread lib like bionic
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003462 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
Haibo Huangca2a8022020-07-10 20:17:42 -07003463 LIBS="$save_LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003464
Elliott Hughesa93fb052018-12-12 14:22:48 -08003465 dnl on HPUX, life is more complicated...
3466 case $host in
3467 *-hp-hpux*)
3468 dnl it doesn't actually work without -lpthread
3469 USE_THREADS_POSIX=""
3470 ;;
3471 *)
3472 ;;
3473 esac
3474
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003475 dnl if it wasn't found without lib, search for it in pthread lib
3476 if test "$USE_THREADS_POSIX" != "1"
3477 then
3478 CFLAGS="$CFLAGS -pthread"
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003479 # assign PTHREAD for pkg-config use
3480 PTHREAD=" -pthread"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003481 AC_CHECK_LIB(pthread, pthread_create,
3482 [USE_THREADS_POSIX=1],
3483 [ CFLAGS="$save_CFLAGS"])
3484 fi
3485
3486 if test "x$USE_THREADS_POSIX" = "x1"
3487 then
3488 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3489 curl_res_msg="POSIX threaded"
3490 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003491 ])
3492fi
3493
Elliott Hughes82be86d2017-09-20 17:00:17 -07003494dnl threaded resolver check
3495if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
3496 if test "$want_pthreads" = "yes"; then
3497 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
3498 fi
3499 dnl If native Windows fallback on Win32 threads since no POSIX threads
3500 if test "$curl_cv_native_windows" = "yes"; then
3501 USE_THREADS_WIN32=1
3502 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
3503 curl_res_msg="Win32 threaded"
3504 else
3505 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
3506 fi
3507fi
3508
Haibo Huang24c77a12020-04-29 13:49:57 -07003509CURL_CONVERT_INCLUDE_TO_ISYSTEM
3510
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003511dnl ************************************************************
3512dnl disable verbose text strings
3513dnl
3514AC_MSG_CHECKING([whether to enable verbose strings])
3515AC_ARG_ENABLE(verbose,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003516AS_HELP_STRING([--enable-verbose],[Enable verbose strings])
3517AS_HELP_STRING([--disable-verbose],[Disable verbose strings]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003518[ case "$enableval" in
3519 no)
3520 AC_MSG_RESULT(no)
3521 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3522 curl_verbose_msg="no"
3523 ;;
3524 *) AC_MSG_RESULT(yes)
3525 ;;
3526 esac ],
3527 AC_MSG_RESULT(yes)
3528)
3529
3530dnl ************************************************************
3531dnl enable SSPI support
3532dnl
3533AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3534AC_ARG_ENABLE(sspi,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003535AS_HELP_STRING([--enable-sspi],[Enable SSPI])
3536AS_HELP_STRING([--disable-sspi],[Disable SSPI]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003537[ case "$enableval" in
3538 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07003539 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003540 AC_MSG_RESULT(yes)
3541 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3542 AC_SUBST(USE_WINDOWS_SSPI, [1])
3543 curl_sspi_msg="enabled"
3544 else
3545 AC_MSG_RESULT(no)
3546 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3547 fi
3548 ;;
3549 *)
Haibo Huangc3c04f42020-08-19 13:00:07 -07003550 if test "x$SCHANNEL_ENABLED" = "x1"; then
3551 # --with-schannel implies --enable-sspi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003552 AC_MSG_RESULT(yes)
3553 else
3554 AC_MSG_RESULT(no)
3555 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003556 ;;
3557 esac ],
Haibo Huangc3c04f42020-08-19 13:00:07 -07003558 if test "x$SCHANNEL_ENABLED" = "x1"; then
3559 # --with-schannel implies --enable-sspi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003560 AC_MSG_RESULT(yes)
3561 else
3562 AC_MSG_RESULT(no)
3563 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003564)
3565
3566dnl ************************************************************
3567dnl disable cryptographic authentication
3568dnl
3569AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3570AC_ARG_ENABLE(crypto-auth,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003571AS_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3572AS_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003573[ case "$enableval" in
3574 no)
3575 AC_MSG_RESULT(no)
3576 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003577 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003578 ;;
3579 *) AC_MSG_RESULT(yes)
3580 ;;
3581 esac ],
3582 AC_MSG_RESULT(yes)
3583)
3584
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003585dnl ************************************************************
3586dnl disable NTLM support
3587dnl
3588AC_MSG_CHECKING([whether to support NTLM])
3589AC_ARG_ENABLE(ntlm,
3590AS_HELP_STRING([--enable-ntlm],[Enable NTLM support])
3591AS_HELP_STRING([--disable-ntlm],[Disable NTLM support]),
3592[ case "$enableval" in
3593 no)
3594 AC_MSG_RESULT(no)
3595 AC_DEFINE(CURL_DISABLE_NTLM, 1, [to disable NTLM support])
3596 CURL_DISABLE_NTLM=1
3597 ;;
3598 *) AC_MSG_RESULT(yes)
3599 ;;
3600 esac ],
3601 AC_MSG_RESULT(yes)
3602)
3603
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003604CURL_CHECK_OPTION_NTLM_WB
3605
3606CURL_CHECK_NTLM_WB
3607
3608dnl ************************************************************
3609dnl disable TLS-SRP authentication
3610dnl
3611AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3612AC_ARG_ENABLE(tls-srp,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003613AS_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3614AS_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003615[ case "$enableval" in
3616 no)
3617 AC_MSG_RESULT(no)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003618 want_tls_srp=no
3619 ;;
3620 *) AC_MSG_RESULT(yes)
3621 want_tls_srp=yes
3622 ;;
3623 esac ],
3624 AC_MSG_RESULT(yes)
3625 want_tls_srp=yes
3626)
3627
3628if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3629 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3630 USE_TLS_SRP=1
3631 curl_tls_srp_msg="enabled"
3632fi
3633
3634dnl ************************************************************
3635dnl disable Unix domain sockets support
3636dnl
3637AC_MSG_CHECKING([whether to enable Unix domain sockets])
3638AC_ARG_ENABLE(unix-sockets,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003639AS_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3640AS_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003641[ case "$enableval" in
3642 no) AC_MSG_RESULT(no)
3643 want_unix_sockets=no
3644 ;;
3645 *) AC_MSG_RESULT(yes)
3646 want_unix_sockets=yes
3647 ;;
3648 esac ], [
3649 AC_MSG_RESULT(auto)
3650 want_unix_sockets=auto
3651 ]
3652)
3653if test "x$want_unix_sockets" != "xno"; then
3654 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3655 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3656 AC_SUBST(USE_UNIX_SOCKETS, [1])
3657 curl_unix_sockets_msg="enabled"
3658 ], [
3659 if test "x$want_unix_sockets" = "xyes"; then
3660 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3661 fi
3662 ], [
3663 #include <sys/un.h>
3664 ])
3665fi
3666
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003667dnl ************************************************************
3668dnl disable cookies support
3669dnl
Haibo Huang001784b2019-07-19 05:27:28 -07003670AC_MSG_CHECKING([whether to support cookies])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003671AC_ARG_ENABLE(cookies,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003672AS_HELP_STRING([--enable-cookies],[Enable cookies support])
3673AS_HELP_STRING([--disable-cookies],[Disable cookies support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003674[ case "$enableval" in
3675 no)
3676 AC_MSG_RESULT(no)
3677 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3678 ;;
3679 *) AC_MSG_RESULT(yes)
3680 ;;
3681 esac ],
3682 AC_MSG_RESULT(yes)
3683)
3684
3685dnl ************************************************************
Haibo Huangb5a52b92020-10-28 22:18:23 -07003686dnl disable socketpair
3687dnl
3688AC_MSG_CHECKING([whether to support socketpair])
3689AC_ARG_ENABLE(socketpair,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003690AS_HELP_STRING([--enable-socketpair],[Enable socketpair support])
3691AS_HELP_STRING([--disable-socketpair],[Disable socketpair support]),
Haibo Huangb5a52b92020-10-28 22:18:23 -07003692[ case "$enableval" in
3693 no)
3694 AC_MSG_RESULT(no)
3695 AC_DEFINE(CURL_DISABLE_SOCKETPAIR, 1, [to disable socketpair support])
3696 ;;
3697 *) AC_MSG_RESULT(yes)
3698 ;;
3699 esac ],
3700 AC_MSG_RESULT(yes)
3701)
3702
3703dnl ************************************************************
Haibo Huang001784b2019-07-19 05:27:28 -07003704dnl disable HTTP authentication support
3705dnl
3706AC_MSG_CHECKING([whether to support HTTP authentication])
3707AC_ARG_ENABLE(http-auth,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003708AS_HELP_STRING([--enable-http-auth],[Enable HTTP authentication support])
3709AS_HELP_STRING([--disable-http-auth],[Disable HTTP authentication support]),
Haibo Huang001784b2019-07-19 05:27:28 -07003710[ case "$enableval" in
3711 no)
3712 AC_MSG_RESULT(no)
3713 AC_DEFINE(CURL_DISABLE_HTTP_AUTH, 1, [disable HTTP authentication])
3714 ;;
3715 *) AC_MSG_RESULT(yes)
3716 ;;
3717 esac ],
3718 AC_MSG_RESULT(yes)
3719)
3720
3721dnl ************************************************************
3722dnl disable DoH support
3723dnl
3724AC_MSG_CHECKING([whether to support DoH])
3725AC_ARG_ENABLE(doh,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003726AS_HELP_STRING([--enable-doh],[Enable DoH support])
3727AS_HELP_STRING([--disable-doh],[Disable DoH support]),
Haibo Huang001784b2019-07-19 05:27:28 -07003728[ case "$enableval" in
3729 no)
3730 AC_MSG_RESULT(no)
3731 AC_DEFINE(CURL_DISABLE_DOH, 1, [disable DoH])
3732 ;;
3733 *) AC_MSG_RESULT(yes)
3734 ;;
3735 esac ],
3736 AC_MSG_RESULT(yes)
3737)
3738
3739dnl ************************************************************
3740dnl disable mime API support
3741dnl
3742AC_MSG_CHECKING([whether to support the MIME API])
3743AC_ARG_ENABLE(mime,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003744AS_HELP_STRING([--enable-mime],[Enable mime API support])
3745AS_HELP_STRING([--disable-mime],[Disable mime API support]),
Haibo Huang001784b2019-07-19 05:27:28 -07003746[ case "$enableval" in
3747 no)
3748 AC_MSG_RESULT(no)
3749 AC_DEFINE(CURL_DISABLE_MIME, 1, [disable mime API])
3750 ;;
3751 *) AC_MSG_RESULT(yes)
3752 ;;
3753 esac ],
3754 AC_MSG_RESULT(yes)
3755)
3756
3757dnl ************************************************************
3758dnl disable date parsing
3759dnl
3760AC_MSG_CHECKING([whether to support date parsing])
3761AC_ARG_ENABLE(dateparse,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003762AS_HELP_STRING([--enable-dateparse],[Enable date parsing])
3763AS_HELP_STRING([--disable-dateparse],[Disable date parsing]),
Haibo Huang001784b2019-07-19 05:27:28 -07003764[ case "$enableval" in
3765 no)
3766 AC_MSG_RESULT(no)
3767 AC_DEFINE(CURL_DISABLE_PARSEDATE, 1, [disable date parsing])
3768 ;;
3769 *) AC_MSG_RESULT(yes)
3770 ;;
3771 esac ],
3772 AC_MSG_RESULT(yes)
3773)
3774
3775dnl ************************************************************
3776dnl disable netrc
3777dnl
3778AC_MSG_CHECKING([whether to support netrc parsing])
3779AC_ARG_ENABLE(netrc,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003780AS_HELP_STRING([--enable-netrc],[Enable netrc parsing])
3781AS_HELP_STRING([--disable-netrc],[Disable netrc parsing]),
Haibo Huang001784b2019-07-19 05:27:28 -07003782[ case "$enableval" in
3783 no)
3784 AC_MSG_RESULT(no)
3785 AC_DEFINE(CURL_DISABLE_NETRC, 1, [disable netrc parsing])
3786 ;;
3787 *) AC_MSG_RESULT(yes)
3788 ;;
3789 esac ],
3790 AC_MSG_RESULT(yes)
3791)
3792
3793dnl ************************************************************
3794dnl disable progress-meter
3795dnl
3796AC_MSG_CHECKING([whether to support progress-meter])
3797AC_ARG_ENABLE(progress-meter,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003798AS_HELP_STRING([--enable-progress-meter],[Enable progress-meter])
3799AS_HELP_STRING([--disable-progress-meter],[Disable progress-meter]),
Haibo Huang001784b2019-07-19 05:27:28 -07003800[ case "$enableval" in
3801 no)
3802 AC_MSG_RESULT(no)
3803 AC_DEFINE(CURL_DISABLE_PROGRESS_METER, 1, [disable progress-meter])
3804 ;;
3805 *) AC_MSG_RESULT(yes)
3806 ;;
3807 esac ],
3808 AC_MSG_RESULT(yes)
3809)
3810
3811dnl ************************************************************
3812dnl disable shuffle DNS support
3813dnl
3814AC_MSG_CHECKING([whether to support DNS shuffling])
3815AC_ARG_ENABLE(dnsshuffle,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003816AS_HELP_STRING([--enable-dnsshuffle],[Enable DNS shuffling])
3817AS_HELP_STRING([--disable-dnsshuffle],[Disable DNS shuffling]),
Haibo Huang001784b2019-07-19 05:27:28 -07003818[ case "$enableval" in
3819 no)
3820 AC_MSG_RESULT(no)
3821 AC_DEFINE(CURL_DISABLE_SHUFFLE_DNS, 1, [disable DNS shuffling])
3822 ;;
3823 *) AC_MSG_RESULT(yes)
3824 ;;
3825 esac ],
3826 AC_MSG_RESULT(yes)
3827)
3828
3829dnl ************************************************************
Haibo Huangb5a52b92020-10-28 22:18:23 -07003830dnl disable the curl_easy_options API
3831dnl
3832AC_MSG_CHECKING([whether to support curl_easy_option*])
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003833AC_ARG_ENABLE(get-easy-options,
3834AS_HELP_STRING([--enable-get-easy-options],[Enable curl_easy_options])
3835AS_HELP_STRING([--disable-get-easy-options],[Disable curl_easy_options]),
Haibo Huangb5a52b92020-10-28 22:18:23 -07003836[ case "$enableval" in
3837 no)
3838 AC_MSG_RESULT(no)
3839 AC_DEFINE(CURL_DISABLE_GETOPTIONS, 1, [to disable curl_easy_options])
3840 ;;
3841 *) AC_MSG_RESULT(yes)
3842 ;;
3843 esac ],
3844 AC_MSG_RESULT(yes)
3845)
3846
3847dnl ************************************************************
Haibo Huang65021c72019-03-27 15:37:23 -07003848dnl switch on/off alt-svc
3849dnl
Haibo Huang65021c72019-03-27 15:37:23 -07003850AC_MSG_CHECKING([whether to support alt-svc])
3851AC_ARG_ENABLE(alt-svc,
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003852AS_HELP_STRING([--enable-alt-svc],[Enable alt-svc support])
3853AS_HELP_STRING([--disable-alt-svc],[Disable alt-svc support]),
Haibo Huang65021c72019-03-27 15:37:23 -07003854[ case "$enableval" in
3855 no)
3856 AC_MSG_RESULT(no)
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003857 AC_DEFINE(CURL_DISABLE_ALTSVC, 1, [disable alt-svc])
3858 curl_altsvc_msg="no";
3859 enable_altsvc="no"
Haibo Huang65021c72019-03-27 15:37:23 -07003860 ;;
3861 *) AC_MSG_RESULT(yes)
Haibo Huang65021c72019-03-27 15:37:23 -07003862 ;;
3863 esac ],
3864 AC_MSG_RESULT(no)
3865)
3866
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003867dnl only check for HSTS if there's SSL present
3868if test -n "$SSL_ENABLED"; then
3869
3870 dnl ************************************************************
3871 dnl switch on/off hsts
3872 dnl
3873 AC_MSG_CHECKING([whether to support HSTS])
3874 AC_ARG_ENABLE(hsts,
3875 AS_HELP_STRING([--enable-hsts],[Enable HSTS support])
3876 AS_HELP_STRING([--disable-hsts],[Disable HSTS support]),
3877 [ case "$enableval" in
3878 no)
3879 AC_MSG_RESULT(no)
Elliott Hughesf344baa2021-12-07 09:12:34 -08003880 hsts="no"
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003881 ;;
3882 *) AC_MSG_RESULT(yes)
3883 ;;
3884 esac ],
Elliott Hughesf344baa2021-12-07 09:12:34 -08003885 AC_MSG_RESULT($hsts)
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003886 )
3887else
3888 AC_MSG_NOTICE([disables HSTS due to lack of SSL])
Elliott Hughesf344baa2021-12-07 09:12:34 -08003889 hsts="no"
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003890fi
3891
Elliott Hughesf344baa2021-12-07 09:12:34 -08003892if test "x$hsts" != "xyes"; then
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003893 curl_hsts_msg="no (--enable-hsts)";
3894 AC_DEFINE(CURL_DISABLE_HSTS, 1, [disable alt-svc])
Haibo Huang65021c72019-03-27 15:37:23 -07003895fi
3896
Haibo Huang31944072019-11-06 02:28:57 -08003897dnl *************************************************************
Haibo Huangb5a52b92020-10-28 22:18:23 -07003898dnl check whether ECH support, if desired, is actually available
Haibo Huang31944072019-11-06 02:28:57 -08003899dnl
Haibo Huangb5a52b92020-10-28 22:18:23 -07003900if test "x$want_ech" != "xno"; then
3901 AC_MSG_CHECKING([whether ECH support is available])
Haibo Huang31944072019-11-06 02:28:57 -08003902
3903 dnl assume NOT and look for sufficient condition
Haibo Huangb5a52b92020-10-28 22:18:23 -07003904 ECH_ENABLED=0
3905 ECH_SUPPORT=''
Haibo Huang31944072019-11-06 02:28:57 -08003906
Haibo Huangb5a52b92020-10-28 22:18:23 -07003907 dnl OpenSSL with a chosen ECH function should be enough
Haibo Huang31944072019-11-06 02:28:57 -08003908 dnl so more exhaustive checking seems unnecessary for now
Haibo Huangb51266f2020-03-04 02:22:48 -08003909 if test "x$OPENSSL_ENABLED" = "x1"; then
Haibo Huangb5a52b92020-10-28 22:18:23 -07003910 AC_CHECK_FUNCS(SSL_get_ech_status,
3911 ECH_SUPPORT="ECH support available (OpenSSL with SSL_get_ech_status)"
3912 ECH_ENABLED=1)
Haibo Huang31944072019-11-06 02:28:57 -08003913
3914 dnl add 'elif' chain here for additional implementations
3915 fi
3916
3917 dnl now deal with whatever we found
Haibo Huangb5a52b92020-10-28 22:18:23 -07003918 if test "x$ECH_ENABLED" = "x1"; then
3919 AC_DEFINE(USE_ECH, 1, [if ECH support is available])
3920 AC_MSG_RESULT($ECH_SUPPORT)
3921 experimental="$experimental ECH"
Haibo Huang31944072019-11-06 02:28:57 -08003922 else
Haibo Huangb5a52b92020-10-28 22:18:23 -07003923 AC_MSG_ERROR([--enable-ech ignored: No ECH support found])
Haibo Huang31944072019-11-06 02:28:57 -08003924 fi
3925fi
3926
Haibo Huang65021c72019-03-27 15:37:23 -07003927dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003928dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003929dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003930CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003931
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003932dnl
3933dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003934dnl
Elliott Hughes34dd5f42021-08-10 13:01:18 -07003935LIBCURL_LIBS="$LIBS$PTHREAD"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003936
3937AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003938AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003939AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3940
3941dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3942dnl LIBS variable used in generated makefile at makefile processing
3943dnl time. Doing this functionally prevents LIBS from being used for
3944dnl all link targets in given makefile.
3945BLANK_AT_MAKETIME=
3946AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003947
3948AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3949
3950dnl yes or no
3951ENABLE_SHARED="$enable_shared"
3952AC_SUBST(ENABLE_SHARED)
3953
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003954dnl to let curl-config output the static libraries correctly
3955ENABLE_STATIC="$enable_static"
3956AC_SUBST(ENABLE_STATIC)
3957
Haibo Huangca2a8022020-07-10 20:17:42 -07003958dnl merge the pkg-config Libs.private field into Libs when static-only
3959if test "x$enable_shared" = "xno"; then
3960 LIBCURL_NO_SHARED=$LIBCURL_LIBS
3961else
3962 LIBCURL_NO_SHARED=
3963fi
3964AC_SUBST(LIBCURL_NO_SHARED)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003965
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003966dnl
3967dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003968dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003969dnl
3970
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003971if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003972 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3973elif test -n "$SSL_ENABLED"; then
3974 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3975fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003976if test "x$IPV6_ENABLED" = "x1"; then
3977 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3978fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003979if test "x$USE_UNIX_SOCKETS" = "x1"; then
3980 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3981fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003982if test "x$HAVE_LIBZ" = "x1"; then
3983 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3984fi
Alex Deymo486467e2017-12-19 19:04:07 +01003985if test "x$HAVE_BROTLI" = "x1"; then
3986 SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
3987fi
Haibo Huangc3c04f42020-08-19 13:00:07 -07003988if test "x$HAVE_ZSTD" = "x1"; then
3989 SUPPORT_FEATURES="$SUPPORT_FEATURES zstd"
3990fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07003991if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
3992 -o "x$USE_THREADS_WIN32" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003993 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3994fi
3995if test "x$IDN_ENABLED" = "x1"; then
3996 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3997fi
3998if test "x$USE_WINDOWS_SSPI" = "x1"; then
3999 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
4000fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004001
4002if test "x$HAVE_GSSAPI" = "x1"; then
4003 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
4004fi
4005
Haibo Huang65021c72019-03-27 15:37:23 -07004006if test "x$curl_psl_msg" = "xenabled"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07004007 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
4008fi
4009
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004010if test "x$curl_gsasl_msg" = "xenabled"; then
4011 SUPPORT_FEATURES="$SUPPORT_FEATURES GSASL"
4012fi
4013
Haibo Huang65021c72019-03-27 15:37:23 -07004014if test "x$enable_altsvc" = "xyes"; then
4015 SUPPORT_FEATURES="$SUPPORT_FEATURES alt-svc"
4016fi
Elliott Hughesf344baa2021-12-07 09:12:34 -08004017if test "x$hsts" = "xyes"; then
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004018 SUPPORT_FEATURES="$SUPPORT_FEATURES HSTS"
4019fi
Haibo Huang65021c72019-03-27 15:37:23 -07004020
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004021if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4022 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4023 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
4024fi
4025
4026if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4027 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4028 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
4029fi
4030
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004031use_curl_ntlm_core=no
4032
4033if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4034 "x$CURL_DISABLE_NTLM" != "x1"; then
4035 if test "x$OPENSSL_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4036 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
4037 -o "x$SECURETRANSPORT_ENABLED" = "x1" \
4038 -o "x$USE_WIN32_CRYPTO" = "x1" \
Haibo Huangca2a8022020-07-10 20:17:42 -07004039 -o "x$WOLFSSL_NTLM" = "x1"; then
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004040 use_curl_ntlm_core=yes
4041 fi
4042
4043 if test "x$use_curl_ntlm_core" = "xyes" \
4044 -o "x$USE_WINDOWS_SSPI" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004045 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
4046
4047 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
4048 "x$NTLM_WB_ENABLED" = "x1"; then
4049 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
4050 fi
4051 fi
4052fi
4053
4054if test "x$USE_TLS_SRP" = "x1"; then
4055 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
4056fi
4057
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004058if test "x$USE_NGHTTP2" = "x1" -o "x$USE_HYPER" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004059 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004060fi
4061
Haibo Huang445085a2019-09-11 13:33:50 -07004062if test "x$USE_NGTCP2" = "x1" -o "x$USE_QUICHE" = "x1"; then
4063 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP3"
4064fi
4065
Alex Deymo486467e2017-12-19 19:04:07 +01004066if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
4067 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
4068fi
4069
Elliott Hughesf344baa2021-12-07 09:12:34 -08004070dnl if not explicitly turned off, HTTPS-proxy comes with some TLS backends
Haibo Huangb5a52b92020-10-28 22:18:23 -07004071if test "x$https_proxy" != "xno"; then
4072 if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
4073 -o "x$NSS_ENABLED" = "x1"; then
4074 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
4075 fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07004076fi
4077
Haibo Huangb5a52b92020-10-28 22:18:23 -07004078if test "x$ECH_ENABLED" = "x1"; then
4079 SUPPORT_FEATURES="$SUPPORT_FEATURES ECH"
Haibo Huang31944072019-11-06 02:28:57 -08004080fi
4081
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004082if test ${ac_cv_sizeof_curl_off_t} -gt 4; then
4083 if test ${ac_cv_sizeof_off_t} -gt 4 -o \
4084 "$curl_win32_file_api" = "win32_large_files"; then
4085 SUPPORT_FEATURES="$SUPPORT_FEATURES Largefile"
4086 fi
4087fi
4088
Haibo Huangc3c04f42020-08-19 13:00:07 -07004089dnl replace spaces with newlines
4090dnl sort the lines
4091dnl replace the newlines back to spaces
4092SUPPORT_FEATURES=`echo $SUPPORT_FEATURES | tr ' ' '\012' | sort | tr '\012' ' '`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004093AC_SUBST(SUPPORT_FEATURES)
4094
4095dnl For supported protocols in pkg-config file
4096if test "x$CURL_DISABLE_HTTP" != "x1"; then
4097 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
4098 if test "x$SSL_ENABLED" = "x1"; then
4099 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
4100 fi
4101fi
4102if test "x$CURL_DISABLE_FTP" != "x1"; then
4103 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
4104 if test "x$SSL_ENABLED" = "x1"; then
4105 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
4106 fi
4107fi
4108if test "x$CURL_DISABLE_FILE" != "x1"; then
4109 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
4110fi
4111if test "x$CURL_DISABLE_TELNET" != "x1"; then
4112 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
4113fi
4114if test "x$CURL_DISABLE_LDAP" != "x1"; then
4115 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
4116 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
4117 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
4118 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
4119 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
4120 fi
4121 fi
4122fi
4123if test "x$CURL_DISABLE_DICT" != "x1"; then
4124 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
4125fi
4126if test "x$CURL_DISABLE_TFTP" != "x1"; then
4127 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
4128fi
4129if test "x$CURL_DISABLE_GOPHER" != "x1"; then
4130 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004131 if test "x$SSL_ENABLED" = "x1"; then
4132 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHERS"
4133 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004134fi
Haibo Huangb5a52b92020-10-28 22:18:23 -07004135if test "x$CURL_DISABLE_MQTT" != "x1"; then
Haibo Huang24c77a12020-04-29 13:49:57 -07004136 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS MQTT"
4137fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004138if test "x$CURL_DISABLE_POP3" != "x1"; then
4139 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
4140 if test "x$SSL_ENABLED" = "x1"; then
4141 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
4142 fi
4143fi
4144if test "x$CURL_DISABLE_IMAP" != "x1"; then
4145 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
4146 if test "x$SSL_ENABLED" = "x1"; then
4147 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
4148 fi
4149fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004150if test "x$CURL_DISABLE_SMB" != "x1" \
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004151 -a "x$use_curl_ntlm_core" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004152 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
4153 if test "x$SSL_ENABLED" = "x1"; then
4154 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4155 fi
4156fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004157if test "x$CURL_DISABLE_SMTP" != "x1"; then
4158 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4159 if test "x$SSL_ENABLED" = "x1"; then
4160 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4161 fi
4162fi
4163if test "x$USE_LIBSSH2" = "x1"; then
4164 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4165 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4166fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08004167if test "x$USE_LIBSSH" = "x1"; then
4168 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4169 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4170fi
Haibo Huangb51266f2020-03-04 02:22:48 -08004171if test "x$USE_WOLFSSH" = "x1"; then
Haibo Huangb51266f2020-03-04 02:22:48 -08004172 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4173fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004174if test "x$CURL_DISABLE_RTSP" != "x1"; then
4175 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4176fi
4177if test "x$USE_LIBRTMP" = "x1"; then
4178 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4179fi
4180
4181dnl replace spaces with newlines
4182dnl sort the lines
4183dnl replace the newlines back to spaces
4184SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4185
4186AC_SUBST(SUPPORT_PROTOCOLS)
4187
4188dnl squeeze whitespace out of some variables
4189
4190squeeze CFLAGS
4191squeeze CPPFLAGS
4192squeeze DEFS
4193squeeze LDFLAGS
4194squeeze LIBS
4195
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004196squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004197squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004198squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004199
4200squeeze SUPPORT_FEATURES
4201squeeze SUPPORT_PROTOCOLS
4202
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004203XC_CHECK_BUILD_FLAGS
4204
Elliott Hughes0128fe42018-02-27 14:57:55 -08004205SSL_BACKENDS=${ssl_backends}
4206AC_SUBST(SSL_BACKENDS)
4207
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004208if test "x$want_curldebug_assumed" = "xyes" &&
4209 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4210 ac_configure_args="$ac_configure_args --enable-curldebug"
4211fi
4212
4213AC_CONFIG_FILES([Makefile \
4214 docs/Makefile \
4215 docs/examples/Makefile \
4216 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004217 docs/libcurl/opts/Makefile \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004218 docs/cmdline-opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004219 include/Makefile \
4220 include/curl/Makefile \
4221 src/Makefile \
4222 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07004223 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004224 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004225 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004226 tests/certs/Makefile \
4227 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004228 tests/data/Makefile \
4229 tests/server/Makefile \
4230 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004231 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004232 packages/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004233 packages/vms/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004234 curl-config \
4235 libcurl.pc
4236])
4237AC_OUTPUT
4238
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004239CURL_GENERATE_CONFIGUREHELP_PM
4240
4241XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4242
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004243AC_MSG_NOTICE([Configured to build curl/libcurl:
4244
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004245 Host setup: ${host}
4246 Install prefix: ${prefix}
4247 Compiler: ${CC}
Haibo Huang21926d52019-01-08 14:27:10 -08004248 CFLAGS: ${CFLAGS}
4249 CPPFLAGS: ${CPPFLAGS}
4250 LDFLAGS: ${LDFLAGS}
4251 LIBS: ${LIBS}
4252
4253 curl version: ${CURLVERSION}
Haibo Huang65021c72019-03-27 15:37:23 -07004254 SSL: ${curl_ssl_msg}
4255 SSH: ${curl_ssh_msg}
4256 zlib: ${curl_zlib_msg}
4257 brotli: ${curl_brotli_msg}
Haibo Huangc3c04f42020-08-19 13:00:07 -07004258 zstd: ${curl_zstd_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004259 GSS-API: ${curl_gss_msg}
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004260 GSASL: ${curl_gsasl_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004261 TLS-SRP: ${curl_tls_srp_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004262 resolver: ${curl_res_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004263 IPv6: ${curl_ipv6_msg}
4264 Unix sockets: ${curl_unix_sockets_msg}
4265 IDN: ${curl_idn_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004266 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4267 Built-in manual: ${curl_manual_msg}
4268 --libcurl option: ${curl_libcurl_msg}
4269 Verbose errors: ${curl_verbose_msg}
Haibo Huang51d9d882019-02-06 01:36:06 -08004270 Code coverage: ${curl_coverage_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004271 SSPI: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004272 ca cert bundle: ${ca}${ca_warning}
4273 ca cert path: ${capath}${capath_warning}
4274 ca fallback: ${with_ca_fallback}
Haibo Huang65021c72019-03-27 15:37:23 -07004275 LDAP: ${curl_ldap_msg}
4276 LDAPS: ${curl_ldaps_msg}
4277 RTSP: ${curl_rtsp_msg}
4278 RTMP: ${curl_rtmp_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004279 PSL: ${curl_psl_msg}
4280 Alt-svc: ${curl_altsvc_msg}
Elliott Hughes34dd5f42021-08-10 13:01:18 -07004281 HSTS: ${curl_hsts_msg}
4282 HTTP1: ${curl_h1_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004283 HTTP2: ${curl_h2_msg}
Haibo Huang445085a2019-09-11 13:33:50 -07004284 HTTP3: ${curl_h3_msg}
Haibo Huangb5a52b92020-10-28 22:18:23 -07004285 ECH: ${curl_ech_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004286 Protocols: ${SUPPORT_PROTOCOLS}
Haibo Huang65021c72019-03-27 15:37:23 -07004287 Features: ${SUPPORT_FEATURES}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004288])
Haibo Huang65021c72019-03-27 15:37:23 -07004289if test -n "$experimental"; then
4290 cat >&2 << _EOF
Haibo Huang445085a2019-09-11 13:33:50 -07004291 WARNING: $experimental enabled but marked EXPERIMENTAL. Use with caution!
Haibo Huang65021c72019-03-27 15:37:23 -07004292_EOF
4293fi