blob: 07e0a502e38232a2eb0e478b275f5089e17d6763 [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Haibo Huang51d9d882019-02-06 01:36:06 -08008# Copyright (C) 1998 - 2019, 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
Alex Deymod15eaac2016-06-28 14:49:26 -070012# are also available at https://curl.haxx.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
24AC_PREREQ(2.57)
25
26dnl We don't know the version number "statically" so we use a dash here
Alex Deymod15eaac2016-06-28 14:49:26 -070027AC_INIT([curl], [-], [a suitable curl mailing list: https://curl.haxx.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
Haibo Huang51d9d882019-02-06 01:36:06 -080034AC_COPYRIGHT([Copyright (c) 1998 - 2019 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
Lucas Eckels9bd90e62012-08-06 15:07:02 -070052
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070053XC_CHECK_PATH_SEPARATOR
Lucas Eckels9bd90e62012-08-06 15:07:02 -070054
55#
56# save the configure arguments
57#
58CONFIGURE_OPTIONS="\"$ac_configure_args\""
59AC_SUBST(CONFIGURE_OPTIONS)
60
61CURL_CFLAG_EXTRAS=""
62if test X"$want_werror" = Xyes; then
63 CURL_CFLAG_EXTRAS="-Werror"
Elliott Hughesb1ef70f2018-10-30 11:28:38 -070064 if test "$compiler_id" = "GNU_C"; then
65 dnl enable -pedantic-errors for GCC 5 and later,
66 dnl as before that it was the same as -Werror=pedantic
67 if test "$compiler_num" -ge "500"; then
68 CURL_CFLAG_EXTRAS="$CURL_CFLAG_EXTRAS -pedantic-errors"
69 fi
70 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -070071fi
72AC_SUBST(CURL_CFLAG_EXTRAS)
73
74dnl SED is mandatory for configure process and libtool.
75dnl Set it now, allowing it to be changed later.
76if test -z "$SED"; then
77 dnl allow it to be overridden
78 AC_PATH_PROG([SED], [sed], [not_found],
79 [$PATH:/usr/bin:/usr/local/bin])
80 if test -z "$SED" || test "$SED" = "not_found"; then
81 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
82 fi
83fi
84AC_SUBST([SED])
85
86dnl GREP is mandatory for configure process and libtool.
87dnl Set it now, allowing it to be changed later.
88if test -z "$GREP"; then
89 dnl allow it to be overridden
90 AC_PATH_PROG([GREP], [grep], [not_found],
91 [$PATH:/usr/bin:/usr/local/bin])
92 if test -z "$GREP" || test "$GREP" = "not_found"; then
93 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
94 fi
95fi
96AC_SUBST([GREP])
97
98dnl EGREP is mandatory for configure process and libtool.
99dnl Set it now, allowing it to be changed later.
100if test -z "$EGREP"; then
101 dnl allow it to be overridden
102 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
103 AC_MSG_CHECKING([for egrep])
104 EGREP="$GREP -E"
105 AC_MSG_RESULT([$EGREP])
106 else
107 AC_PATH_PROG([EGREP], [egrep], [not_found],
108 [$PATH:/usr/bin:/usr/local/bin])
109 fi
110fi
111if test -z "$EGREP" || test "$EGREP" = "not_found"; then
112 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
113fi
114AC_SUBST([EGREP])
115
116dnl AR is mandatory for configure process and libtool.
117dnl This is target dependent, so check it as a tool.
118if test -z "$AR"; then
119 dnl allow it to be overridden
120 AC_PATH_TOOL([AR], [ar], [not_found],
121 [$PATH:/usr/bin:/usr/local/bin])
122 if test -z "$AR" || test "$AR" = "not_found"; then
123 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
124 fi
125fi
126AC_SUBST([AR])
127
128AC_SUBST(libext)
129
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700130dnl figure out the libcurl version
Elliott Hughes82be86d2017-09-20 17:00:17 -0700131CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700132XC_CHECK_PROG_CC
Elliott Hughes0128fe42018-02-27 14:57:55 -0800133
Haibo Huang51d9d882019-02-06 01:36:06 -0800134dnl for --enable-code-coverage
135CURL_COVERAGE
Elliott Hughes0128fe42018-02-27 14:57:55 -0800136
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700137XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700138AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700139AC_MSG_RESULT($CURLVERSION)
140
141AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700142
143dnl
144dnl we extract the numerical version for curl-config only
Elliott Hughes82be86d2017-09-20 17:00:17 -0700145VERSIONNUM=`$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 -0700146AC_SUBST(VERSIONNUM)
147
148dnl Solaris pkgadd support definitions
149PKGADD_PKG="HAXXcurl"
Elliott Hughescee03382017-06-23 12:17:18 -0700150PKGADD_NAME="curl - a client that groks URLs"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700151PKGADD_VENDOR="curl.haxx.se"
152AC_SUBST(PKGADD_PKG)
153AC_SUBST(PKGADD_NAME)
154AC_SUBST(PKGADD_VENDOR)
155
156dnl
157dnl initialize all the info variables
Haibo Huang001784b2019-07-19 05:27:28 -0700158 curl_ssl_msg="no (--with-{ssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,mesalink,amissl} )"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700159 curl_ssh_msg="no (--with-libssh2)"
160 curl_zlib_msg="no (--with-zlib)"
Alex Deymo486467e2017-12-19 19:04:07 +0100161 curl_brotli_msg="no (--with-brotli)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700162 curl_gss_msg="no (--with-gssapi)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700163curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700164 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
165 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700166curl_unix_sockets_msg="no (--enable-unix-sockets)"
Elliott Hughescee03382017-06-23 12:17:18 -0700167 curl_idn_msg="no (--with-{libidn2,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700168 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700169curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700170curl_verbose_msg="enabled (--disable-verbose)"
171 curl_sspi_msg="no (--enable-sspi)"
172 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
173 curl_ldaps_msg="no (--enable-ldaps)"
174 curl_rtsp_msg="no (--enable-rtsp)"
175 curl_rtmp_msg="no (--with-librtmp)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700176 curl_mtlnk_msg="no (--with-libmetalink)"
Alex Deymod15eaac2016-06-28 14:49:26 -0700177 curl_psl_msg="no (--with-libpsl)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700178
Alex Deymo486467e2017-12-19 19:04:07 +0100179 ssl_backends=
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700180
181dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700182dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700183dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700184INITIAL_LDFLAGS=$LDFLAGS
185INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700186
Elliott Hughes82be86d2017-09-20 17:00:17 -0700187dnl
188dnl Detect the canonical host and target build environment
189dnl
190
191AC_CANONICAL_HOST
192dnl Get system canonical name
193AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
194
Elliott Hughes72d948d2018-08-03 14:37:21 -0700195# Silence warning: ar: 'u' modifier ignored since 'D' is the default
196AC_SUBST(AR_FLAGS, [cr])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700197
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700198dnl This defines _ALL_SOURCE for AIX
199CURL_CHECK_AIX_ALL_SOURCE
200
201dnl Our configure and build reentrant settings
202CURL_CONFIGURE_THREAD_SAFE
203CURL_CONFIGURE_REENTRANT
204
205dnl check for how to do large files
206AC_SYS_LARGEFILE
207
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700208XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700209
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700210#
211# Automake conditionals based on libtool related checks
212#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700213
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700214AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
215 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
216AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
217 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
218AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
219 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700220
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700221#
222# Due to libtool and automake machinery limitations of not allowing
223# specifying separate CPPFLAGS or CFLAGS when compiling objects for
224# inclusion of these in shared or static libraries, we are forced to
225# build using separate configure runs for shared and static libraries
226# on systems where different CPPFLAGS or CFLAGS are mandatory in order
227# to compile objects for each kind of library. Notice that relying on
228# the '-DPIC' CFLAG that libtool provides is not valid given that the
229# user might for example choose to build static libraries with PIC.
230#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700231
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700232#
233# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
234# targeting a static library and not building its shared counterpart.
235#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700236
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700237AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
238 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700239
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700240#
241# Make staticlib CPPFLAG variable and its definition visible in output
242# files unconditionally, providing an empty definition unless strictly
243# targeting a static library and not building its shared counterpart.
244#
245
246CPPFLAG_CURL_STATICLIB=
247if test "x$xc_lt_build_static_only" = 'xyes'; then
248 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
249fi
250AC_SUBST([CPPFLAG_CURL_STATICLIB])
251
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700252
253# Determine whether all dependent libraries must be specified when linking
254if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
255then
256 REQUIRE_LIB_DEPS=no
257else
258 REQUIRE_LIB_DEPS=yes
259fi
260AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700261AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700262
263dnl check if there's a way to force code inline
264AC_C_INLINE
265
266dnl **********************************************************************
267dnl platform/compiler/architecture specific checks/flags
268dnl **********************************************************************
269
270CURL_CHECK_COMPILER
271CURL_SET_COMPILER_BASIC_OPTS
272CURL_SET_COMPILER_DEBUG_OPTS
273CURL_SET_COMPILER_OPTIMIZE_OPTS
274CURL_SET_COMPILER_WARNING_OPTS
275
276if test "$compiler_id" = "INTEL_UNIX_C"; then
277 #
278 if test "$compiler_num" -ge "1000"; then
279 dnl icc 10.X or later
280 CFLAGS="$CFLAGS -shared-intel"
281 elif test "$compiler_num" -ge "900"; then
282 dnl icc 9.X specific
283 CFLAGS="$CFLAGS -i-dynamic"
284 fi
285 #
286fi
287
288CURL_CHECK_COMPILER_HALT_ON_ERROR
289CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700290CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
291CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700292
293CURL_CHECK_CURLDEBUG
294AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
295
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700296supports_unittests=yes
297# cross-compilation of unit tests static library/programs fails when
298# libcurl shared library is built. This might be due to a libtool or
299# automake issue. In this case we disable unit tests.
300if test "x$cross_compiling" != "xno" &&
301 test "x$enable_shared" != "xno"; then
302 supports_unittests=no
303fi
304
305# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
306# a problem related with OpenSSL headers and library versions not matching.
307# Disable unit tests while time to further investigate this is found.
308case $host in
309 mips-sgi-irix6.5)
310 if test "$compiler_id" = "GNU_C"; then
311 supports_unittests=no
312 fi
313 ;;
314esac
315
316# All AIX autobuilds fails unit tests linking against unittests library
317# due to unittests library being built with no symbols or members. Libtool ?
318# Disable unit tests while time to further investigate this is found.
319case $host_os in
320 aix*)
321 supports_unittests=no
322 ;;
323esac
324
325dnl Build unit tests when option --enable-debug is given.
326if test "x$want_debug" = "xyes" &&
327 test "x$supports_unittests" = "xyes"; then
328 want_unittests=yes
329else
330 want_unittests=no
331fi
332AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
333
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700334dnl **********************************************************************
335dnl Compilation based checks should not be done before this point.
336dnl **********************************************************************
337
338dnl **********************************************************************
339dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
340dnl and ws2tcpip.h take precedence over any other further checks which
341dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
342dnl this specific header files. And do them before its results are used.
343dnl **********************************************************************
344
345CURL_CHECK_HEADER_WINDOWS
346CURL_CHECK_NATIVE_WINDOWS
Alex Deymod15eaac2016-06-28 14:49:26 -0700347case X-"$curl_cv_native_windows" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700348 X-yes)
349 CURL_CHECK_HEADER_WINSOCK
350 CURL_CHECK_HEADER_WINSOCK2
351 CURL_CHECK_HEADER_WS2TCPIP
352 CURL_CHECK_HEADER_WINLDAP
353 CURL_CHECK_HEADER_WINBER
354 ;;
355 *)
Alex Deymod15eaac2016-06-28 14:49:26 -0700356 curl_cv_header_winsock_h="no"
357 curl_cv_header_winsock2_h="no"
358 curl_cv_header_ws2tcpip_h="no"
359 curl_cv_header_winldap_h="no"
360 curl_cv_header_winber_h="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700361 ;;
362esac
363CURL_CHECK_WIN32_LARGEFILE
364
Elliott Hughescee03382017-06-23 12:17:18 -0700365CURL_MAC_CFLAGS
Alex Deymo486467e2017-12-19 19:04:07 +0100366CURL_SUPPORTS_BUILTIN_AVAILABLE
Elliott Hughescee03382017-06-23 12:17:18 -0700367
Haibo Huang65021c72019-03-27 15:37:23 -0700368
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700369dnl ************************************************************
370dnl switch off particular protocols
371dnl
372AC_MSG_CHECKING([whether to support http])
373AC_ARG_ENABLE(http,
374AC_HELP_STRING([--enable-http],[Enable HTTP support])
375AC_HELP_STRING([--disable-http],[Disable HTTP support]),
376[ case "$enableval" in
377 no)
378 AC_MSG_RESULT(no)
379 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
Elliott Hughes82be86d2017-09-20 17:00:17 -0700380 disable_http="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700381 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
382 AC_SUBST(CURL_DISABLE_HTTP, [1])
383 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
384 AC_SUBST(CURL_DISABLE_RTSP, [1])
385 ;;
386 *) AC_MSG_RESULT(yes)
387 ;;
388 esac ],
389 AC_MSG_RESULT(yes)
390)
391AC_MSG_CHECKING([whether to support ftp])
392AC_ARG_ENABLE(ftp,
393AC_HELP_STRING([--enable-ftp],[Enable FTP support])
394AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
395[ case "$enableval" in
396 no)
397 AC_MSG_RESULT(no)
398 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
399 AC_SUBST(CURL_DISABLE_FTP, [1])
400 ;;
401 *) AC_MSG_RESULT(yes)
402 ;;
403 esac ],
404 AC_MSG_RESULT(yes)
405)
406AC_MSG_CHECKING([whether to support file])
407AC_ARG_ENABLE(file,
408AC_HELP_STRING([--enable-file],[Enable FILE support])
409AC_HELP_STRING([--disable-file],[Disable FILE support]),
410[ case "$enableval" in
411 no)
412 AC_MSG_RESULT(no)
413 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
414 AC_SUBST(CURL_DISABLE_FILE, [1])
415 ;;
416 *) AC_MSG_RESULT(yes)
417 ;;
418 esac ],
419 AC_MSG_RESULT(yes)
420)
421AC_MSG_CHECKING([whether to support ldap])
422AC_ARG_ENABLE(ldap,
423AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
424AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
425[ case "$enableval" in
426 no)
427 AC_MSG_RESULT(no)
428 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
429 AC_SUBST(CURL_DISABLE_LDAP, [1])
430 ;;
431 *)
432 AC_MSG_RESULT(yes)
433 ;;
434 esac ],[
435 AC_MSG_RESULT(yes) ]
436)
437AC_MSG_CHECKING([whether to support ldaps])
438AC_ARG_ENABLE(ldaps,
439AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
440AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
441[ case "$enableval" in
442 no)
443 AC_MSG_RESULT(no)
444 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
445 AC_SUBST(CURL_DISABLE_LDAPS, [1])
446 ;;
447 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
448 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
449 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
450 AC_SUBST(CURL_DISABLE_LDAPS, [1])
451 else
452 AC_MSG_RESULT(yes)
453 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
454 AC_SUBST(HAVE_LDAP_SSL, [1])
455 fi
456 ;;
457 esac ],[
458 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
459 AC_MSG_RESULT(no)
460 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
461 AC_SUBST(CURL_DISABLE_LDAPS, [1])
462 else
463 AC_MSG_RESULT(yes)
464 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
465 AC_SUBST(HAVE_LDAP_SSL, [1])
466 fi ]
467)
468
469AC_MSG_CHECKING([whether to support rtsp])
470AC_ARG_ENABLE(rtsp,
471AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
472AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
473[ case "$enableval" in
474 no)
475 AC_MSG_RESULT(no)
476 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
477 AC_SUBST(CURL_DISABLE_RTSP, [1])
478 ;;
479 *) if test x$CURL_DISABLE_HTTP = x1 ; then
480 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
481 else
482 AC_MSG_RESULT(yes)
483 curl_rtsp_msg="enabled"
484 fi
485 ;;
486 esac ],
487 if test "x$CURL_DISABLE_HTTP" != "x1"; then
488 AC_MSG_RESULT(yes)
489 curl_rtsp_msg="enabled"
490 else
491 AC_MSG_RESULT(no)
492 fi
493)
494
495AC_MSG_CHECKING([whether to support proxies])
496AC_ARG_ENABLE(proxy,
497AC_HELP_STRING([--enable-proxy],[Enable proxy support])
498AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
499[ case "$enableval" in
500 no)
501 AC_MSG_RESULT(no)
502 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
503 AC_SUBST(CURL_DISABLE_PROXY, [1])
504 ;;
505 *) AC_MSG_RESULT(yes)
506 ;;
507 esac ],
508 AC_MSG_RESULT(yes)
509)
510
511AC_MSG_CHECKING([whether to support dict])
512AC_ARG_ENABLE(dict,
513AC_HELP_STRING([--enable-dict],[Enable DICT support])
514AC_HELP_STRING([--disable-dict],[Disable DICT support]),
515[ case "$enableval" in
516 no)
517 AC_MSG_RESULT(no)
518 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
519 AC_SUBST(CURL_DISABLE_DICT, [1])
520 ;;
521 *) AC_MSG_RESULT(yes)
522 ;;
523 esac ],
524 AC_MSG_RESULT(yes)
525)
526AC_MSG_CHECKING([whether to support telnet])
527AC_ARG_ENABLE(telnet,
528AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
529AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
530[ case "$enableval" in
531 no)
532 AC_MSG_RESULT(no)
533 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
534 AC_SUBST(CURL_DISABLE_TELNET, [1])
535 ;;
536 *) AC_MSG_RESULT(yes)
537 ;;
538 esac ],
539 AC_MSG_RESULT(yes)
540)
541AC_MSG_CHECKING([whether to support tftp])
542AC_ARG_ENABLE(tftp,
543AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
544AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
545[ case "$enableval" in
546 no)
547 AC_MSG_RESULT(no)
548 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
549 AC_SUBST(CURL_DISABLE_TFTP, [1])
550 ;;
551 *) AC_MSG_RESULT(yes)
552 ;;
553 esac ],
554 AC_MSG_RESULT(yes)
555)
556
557AC_MSG_CHECKING([whether to support pop3])
558AC_ARG_ENABLE(pop3,
559AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
560AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
561[ case "$enableval" in
562 no)
563 AC_MSG_RESULT(no)
564 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
565 AC_SUBST(CURL_DISABLE_POP3, [1])
566 ;;
567 *) AC_MSG_RESULT(yes)
568 ;;
569 esac ],
570 AC_MSG_RESULT(yes)
571)
572
573
574AC_MSG_CHECKING([whether to support imap])
575AC_ARG_ENABLE(imap,
576AC_HELP_STRING([--enable-imap],[Enable IMAP support])
577AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
578[ case "$enableval" in
579 no)
580 AC_MSG_RESULT(no)
581 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
582 AC_SUBST(CURL_DISABLE_IMAP, [1])
583 ;;
584 *) AC_MSG_RESULT(yes)
585 ;;
586 esac ],
587 AC_MSG_RESULT(yes)
588)
589
590
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700591AC_MSG_CHECKING([whether to support smb])
592AC_ARG_ENABLE(smb,
593AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
594AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
595[ case "$enableval" in
596 no)
597 AC_MSG_RESULT(no)
598 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
599 AC_SUBST(CURL_DISABLE_SMB, [1])
600 ;;
601 *) AC_MSG_RESULT(yes)
602 ;;
603 esac ],
604 AC_MSG_RESULT(yes)
605)
606
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700607AC_MSG_CHECKING([whether to support smtp])
608AC_ARG_ENABLE(smtp,
609AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
610AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
611[ case "$enableval" in
612 no)
613 AC_MSG_RESULT(no)
614 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
615 AC_SUBST(CURL_DISABLE_SMTP, [1])
616 ;;
617 *) AC_MSG_RESULT(yes)
618 ;;
619 esac ],
620 AC_MSG_RESULT(yes)
621)
622
623AC_MSG_CHECKING([whether to support gopher])
624AC_ARG_ENABLE(gopher,
625AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
626AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
627[ case "$enableval" in
628 no)
629 AC_MSG_RESULT(no)
630 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
631 AC_SUBST(CURL_DISABLE_GOPHER, [1])
632 ;;
633 *) AC_MSG_RESULT(yes)
634 ;;
635 esac ],
636 AC_MSG_RESULT(yes)
637)
638
639
640dnl **********************************************************************
641dnl Check for built-in manual
642dnl **********************************************************************
643
644AC_MSG_CHECKING([whether to provide built-in manual])
645AC_ARG_ENABLE(manual,
646AC_HELP_STRING([--enable-manual],[Enable built-in manual])
647AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
648[ case "$enableval" in
649 no)
650 AC_MSG_RESULT(no)
651 ;;
652 *) AC_MSG_RESULT(yes)
653 USE_MANUAL="1"
654 ;;
655 esac ],
656 AC_MSG_RESULT(yes)
657 USE_MANUAL="1"
658)
659dnl The actual use of the USE_MANUAL variable is done much later in this
660dnl script to allow other actions to disable it as well.
661
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700662dnl ************************************************************
663dnl disable C code generation support
664dnl
665AC_MSG_CHECKING([whether to enable generation of C code])
666AC_ARG_ENABLE(libcurl_option,
667AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
668AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
669[ case "$enableval" in
670 no)
671 AC_MSG_RESULT(no)
672 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
673 curl_libcurl_msg="no"
674 ;;
675 *) AC_MSG_RESULT(yes)
676 ;;
677 esac ],
678 AC_MSG_RESULT(yes)
679)
680
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700681dnl **********************************************************************
682dnl Checks for libraries.
683dnl **********************************************************************
684
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700685AC_MSG_CHECKING([whether to use libgcc])
686AC_ARG_ENABLE(libgcc,
687AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
688[ case "$enableval" in
689 yes)
690 LIBS="-lgcc $LIBS"
691 AC_MSG_RESULT(yes)
692 ;;
693 *) AC_MSG_RESULT(no)
694 ;;
695 esac ],
696 AC_MSG_RESULT(no)
697)
698
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700699CURL_CHECK_LIB_XNET
700
701dnl gethostbyname without lib or in the nsl lib?
702AC_CHECK_FUNC(gethostbyname,
703 [HAVE_GETHOSTBYNAME="1"
704 ],
705 [ AC_CHECK_LIB(nsl, gethostbyname,
706 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700707 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700708 ])
709 ])
710
711if test "$HAVE_GETHOSTBYNAME" != "1"
712then
713 dnl gethostbyname in the socket lib?
714 AC_CHECK_LIB(socket, gethostbyname,
715 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700716 LIBS="-lsocket $LIBS"
717 ])
718fi
719
720if test "$HAVE_GETHOSTBYNAME" != "1"
721then
722 dnl gethostbyname in the watt lib?
723 AC_CHECK_LIB(watt, gethostbyname,
724 [HAVE_GETHOSTBYNAME="1"
725 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
726 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
727 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700728 ])
729fi
730
731dnl At least one system has been identified to require BOTH nsl and socket
732dnl libs at the same time to link properly.
733if test "$HAVE_GETHOSTBYNAME" != "1"
734then
735 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
736 my_ac_save_LIBS=$LIBS
737 LIBS="-lnsl -lsocket $LIBS"
738 AC_LINK_IFELSE([
739 AC_LANG_PROGRAM([[
740 ]],[[
741 gethostbyname();
742 ]])
743 ],[
744 AC_MSG_RESULT([yes])
745 HAVE_GETHOSTBYNAME="1"
746 ],[
747 AC_MSG_RESULT([no])
748 LIBS=$my_ac_save_LIBS
749 ])
750fi
751
752if test "$HAVE_GETHOSTBYNAME" != "1"
753then
754 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -0700755 if test "$curl_cv_header_windows_h" = "yes"; then
756 if test "$curl_cv_header_winsock_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700757 case $host in
758 *-*-mingw32ce*)
759 winsock_LIB="-lwinsock"
760 ;;
761 *)
762 winsock_LIB="-lwsock32"
763 ;;
764 esac
765 fi
Alex Deymod15eaac2016-06-28 14:49:26 -0700766 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700767 winsock_LIB="-lws2_32"
768 fi
769 if test ! -z "$winsock_LIB"; then
770 my_ac_save_LIBS=$LIBS
771 LIBS="$winsock_LIB $LIBS"
772 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
773 AC_LINK_IFELSE([
774 AC_LANG_PROGRAM([[
775#ifdef HAVE_WINDOWS_H
776#ifndef WIN32_LEAN_AND_MEAN
777#define WIN32_LEAN_AND_MEAN
778#endif
779#include <windows.h>
780#ifdef HAVE_WINSOCK2_H
781#include <winsock2.h>
782#else
783#ifdef HAVE_WINSOCK_H
784#include <winsock.h>
785#endif
786#endif
787#endif
788 ]],[[
789 gethostbyname("www.dummysite.com");
790 ]])
791 ],[
792 AC_MSG_RESULT([yes])
793 HAVE_GETHOSTBYNAME="1"
794 ],[
795 AC_MSG_RESULT([no])
796 winsock_LIB=""
797 LIBS=$my_ac_save_LIBS
798 ])
799 fi
800 fi
801fi
802
803if test "$HAVE_GETHOSTBYNAME" != "1"
804then
805 dnl This is for Minix 3.1
806 AC_MSG_CHECKING([for gethostbyname for Minix 3])
807 AC_LINK_IFELSE([
808 AC_LANG_PROGRAM([[
809/* Older Minix versions may need <net/gen/netdb.h> here instead */
810#include <netdb.h>
811 ]],[[
812 gethostbyname("www.dummysite.com");
813 ]])
814 ],[
815 AC_MSG_RESULT([yes])
816 HAVE_GETHOSTBYNAME="1"
817 ],[
818 AC_MSG_RESULT([no])
819 ])
820fi
821
822if test "$HAVE_GETHOSTBYNAME" != "1"
823then
824 dnl This is for eCos with a stubbed DNS implementation
825 AC_MSG_CHECKING([for gethostbyname for eCos])
826 AC_LINK_IFELSE([
827 AC_LANG_PROGRAM([[
828#include <stdio.h>
829#include <netdb.h>
830 ]],[[
831 gethostbyname("www.dummysite.com");
832 ]])
833 ],[
834 AC_MSG_RESULT([yes])
835 HAVE_GETHOSTBYNAME="1"
836 ],[
837 AC_MSG_RESULT([no])
838 ])
839fi
840
841if test "$HAVE_GETHOSTBYNAME" != "1"
842then
Haibo Huang65021c72019-03-27 15:37:23 -0700843 dnl This is for AmigaOS with bsdsocket.library - needs testing before -lnet
844 AC_MSG_CHECKING([for gethostbyname for AmigaOS bsdsocket.library])
845 AC_LINK_IFELSE([
846 AC_LANG_PROGRAM([[
847#include <proto/bsdsocket.h>
848struct Library *SocketBase = NULL;
849 ]],[[
850 gethostbyname("www.dummysite.com");
851 ]])
852 ],[
853 AC_MSG_RESULT([yes])
854 HAVE_GETHOSTBYNAME="1"
855 HAVE_PROTO_BSDSOCKET_H="1"
856 AC_DEFINE(HAVE_PROTO_BSDSOCKET_H, 1, [if Amiga bsdsocket.library is in use])
857 AC_SUBST(HAVE_PROTO_BSDSOCKET_H, [1])
858 ],[
859 AC_MSG_RESULT([no])
860 ])
861fi
862
863if test "$HAVE_GETHOSTBYNAME" != "1"
864then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700865 dnl gethostbyname in the network lib - for Haiku OS
866 AC_CHECK_LIB(network, gethostbyname,
867 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700868 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700869 ])
870fi
871
872if test "$HAVE_GETHOSTBYNAME" != "1"
873then
874 dnl gethostbyname in the net lib - for BeOS
875 AC_CHECK_LIB(net, gethostbyname,
876 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700877 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700878 ])
879fi
880
881
882if test "$HAVE_GETHOSTBYNAME" != "1"; then
883 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
884fi
885
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700886CURL_CHECK_LIBS_CONNECT
887
888CURL_NETWORK_LIBS=$LIBS
889
890dnl **********************************************************************
891dnl In case that function clock_gettime with monotonic timer is available,
892dnl check for additional required libraries.
893dnl **********************************************************************
894CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
895
896dnl **********************************************************************
897dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700898dnl servers and libtest cases which require networking and clock_gettime
899dnl support. Save the list of required libraries at this point for use
900dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700901dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700902CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700903
904dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700905dnl Check for the presence of ZLIB libraries and headers
906dnl **********************************************************************
907
908dnl Check for & handle argument to --with-zlib.
909
910clean_CPPFLAGS=$CPPFLAGS
911clean_LDFLAGS=$LDFLAGS
912clean_LIBS=$LIBS
913ZLIB_LIBS=""
914AC_ARG_WITH(zlib,
915AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
916AC_HELP_STRING([--without-zlib],[disable use of zlib]),
917 [OPT_ZLIB="$withval"])
918
919if test "$OPT_ZLIB" = "no" ; then
920 AC_MSG_WARN([zlib disabled])
921else
922 if test "$OPT_ZLIB" = "yes" ; then
923 OPT_ZLIB=""
924 fi
925
Elliott Hughescee03382017-06-23 12:17:18 -0700926 if test -z "$OPT_ZLIB" ; then
Elliott Hughes82be86d2017-09-20 17:00:17 -0700927 CURL_CHECK_PKGCONFIG(zlib)
928
929 if test "$PKGCONFIG" != "no" ; then
930 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
931 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
932 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
933 OPT_ZLIB=""
934 HAVE_LIBZ="1"
935 fi
Elliott Hughescee03382017-06-23 12:17:18 -0700936
937 if test -z "$HAVE_LIBZ"; then
938
939 dnl Check for the lib without setting any new path, since many
940 dnl people have it in the default path
941
942 AC_CHECK_LIB(z, inflateEnd,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700943 dnl libz found, set the variable
944 [HAVE_LIBZ="1"
945 LIBS="-lz $LIBS"],
946 dnl if no lib found, try /usr/local
947 [OPT_ZLIB="/usr/local"])
Elliott Hughescee03382017-06-23 12:17:18 -0700948 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700949 fi
950
951 dnl Add a nonempty path to the compiler flags
952 if test -n "$OPT_ZLIB"; then
953 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
954 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
955 fi
956
957 AC_CHECK_HEADER(zlib.h,
958 [
959 dnl zlib.h was found
960 HAVE_ZLIB_H="1"
961 dnl if the lib wasn't found already, try again with the new paths
962 if test "$HAVE_LIBZ" != "1"; then
963 AC_CHECK_LIB(z, gzread,
964 [
965 dnl the lib was found!
966 HAVE_LIBZ="1"
967 LIBS="-lz $LIBS"
968 ],
969 [ CPPFLAGS=$clean_CPPFLAGS
970 LDFLAGS=$clean_LDFLAGS])
971 fi
972 ],
973 [
974 dnl zlib.h was not found, restore the flags
975 CPPFLAGS=$clean_CPPFLAGS
976 LDFLAGS=$clean_LDFLAGS]
977 )
978
979 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
980 then
981 AC_MSG_WARN([configure found only the libz lib, not the header file!])
982 HAVE_LIBZ=""
983 CPPFLAGS=$clean_CPPFLAGS
984 LDFLAGS=$clean_LDFLAGS
985 LIBS=$clean_LIBS
986 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
987 then
988 AC_MSG_WARN([configure found only the libz header file, not the lib!])
989 CPPFLAGS=$clean_CPPFLAGS
990 LDFLAGS=$clean_LDFLAGS
991 LIBS=$clean_LIBS
992 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
993 then
994 dnl both header and lib were found!
995 AC_SUBST(HAVE_LIBZ)
996 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
997 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
998
999 ZLIB_LIBS="-lz"
1000 LIBS="-lz $clean_LIBS"
1001
1002 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1003 AMFIXLIB="1"
1004 AC_MSG_NOTICE([found both libz and libz.h header])
1005 curl_zlib_msg="enabled"
1006 fi
1007fi
1008
1009dnl set variable for use in automakefile(s)
1010AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1011AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001012
1013dnl **********************************************************************
Alex Deymo486467e2017-12-19 19:04:07 +01001014dnl Check for the presence of BROTLI decoder libraries and headers
1015dnl **********************************************************************
1016
1017dnl Brotli project home page: https://github.com/google/brotli
1018
1019dnl Default to compiler & linker defaults for BROTLI files & libraries.
1020OPT_BROTLI=off
1021AC_ARG_WITH(brotli,dnl
1022AC_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])
1023AC_HELP_STRING([--without-brotli], [disable BROTLI]),
1024 OPT_BROTLI=$withval)
1025
1026if test X"$OPT_BROTLI" != Xno; then
1027 dnl backup the pre-brotli variables
1028 CLEANLDFLAGS="$LDFLAGS"
1029 CLEANCPPFLAGS="$CPPFLAGS"
1030 CLEANLIBS="$LIBS"
1031
1032 case "$OPT_BROTLI" in
1033 yes)
1034 dnl --with-brotli (without path) used
1035 CURL_CHECK_PKGCONFIG(libbrotlidec)
1036
1037 if test "$PKGCONFIG" != "no" ; then
1038 LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1039 LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1040 CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1041 version=`$PKGCONFIG --modversion libbrotlidec`
1042 DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/-L//'`
1043 fi
1044
1045 ;;
1046 off)
1047 dnl no --with-brotli option given, just check default places
1048 ;;
1049 *)
1050 dnl use the given --with-brotli spot
1051 PREFIX_BROTLI=$OPT_BROTLI
1052 ;;
1053 esac
1054
1055 dnl if given with a prefix, we set -L and -I based on that
1056 if test -n "$PREFIX_BROTLI"; then
1057 LIB_BROTLI="-lbrotlidec"
1058 LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1059 CPP_BROTLI=-I${PREFIX_BROTLI}/include
1060 DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1061 fi
1062
1063 LDFLAGS="$LDFLAGS $LD_BROTLI"
1064 CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1065 LIBS="$LIB_BROTLI $LIBS"
1066
1067 AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1068
1069 AC_CHECK_HEADERS(brotli/decode.h,
1070 curl_brotli_msg="enabled (libbrotlidec)"
1071 HAVE_BROTLI=1
1072 AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1073 AC_SUBST(HAVE_BROTLI, [1])
1074 )
1075
1076 if test X"$OPT_BROTLI" != Xoff &&
1077 test "$HAVE_BROTLI" != "1"; then
1078 AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1079 fi
1080
1081 if test "$HAVE_BROTLI" = "1"; then
1082 if test -n "$DIR_BROTLI"; then
1083 dnl when the brotli shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001084 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Alex Deymo486467e2017-12-19 19:04:07 +01001085 dnl to prevent further configure tests to fail due to this
1086
1087 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001088 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI"
1089 export CURL_LIBRARY_PATH
1090 AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH])
Alex Deymo486467e2017-12-19 19:04:07 +01001091 fi
1092 fi
1093 else
1094 dnl no brotli, revert back to clean variables
1095 LDFLAGS=$CLEANLDFLAGS
1096 CPPFLAGS=$CLEANCPPFLAGS
1097 LIBS=$CLEANLIBS
1098 fi
1099fi
1100
1101dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001102dnl Check for LDAP
1103dnl **********************************************************************
1104
1105LDAPLIBNAME=""
1106AC_ARG_WITH(ldap-lib,
1107AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
1108 [LDAPLIBNAME="$withval"])
1109
1110LBERLIBNAME=""
1111AC_ARG_WITH(lber-lib,
1112AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
1113 [LBERLIBNAME="$withval"])
1114
1115if test x$CURL_DISABLE_LDAP != x1 ; then
1116
1117 CURL_CHECK_HEADER_LBER
1118 CURL_CHECK_HEADER_LDAP
1119 CURL_CHECK_HEADER_LDAPSSL
1120 CURL_CHECK_HEADER_LDAP_SSL
1121
1122 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001123 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001124 dnl Windows uses a single and unique LDAP library name
1125 LDAPLIBNAME="wldap32"
1126 LBERLIBNAME="no"
1127 fi
1128 fi
1129
1130 if test "$LDAPLIBNAME" ; then
1131 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1132 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1133 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001134 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001135 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001136 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001137 else
1138 dnl Try to find the right ldap libraries for this system
1139 CURL_CHECK_LIBS_LDAP
1140 case X-"$curl_cv_ldap_LIBS" in
1141 X-unknown)
1142 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1143 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1144 AC_SUBST(CURL_DISABLE_LDAP, [1])
1145 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1146 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1147 ;;
1148 esac
1149 fi
1150fi
1151
1152if test x$CURL_DISABLE_LDAP != x1 ; then
1153
1154 if test "$LBERLIBNAME" ; then
1155 dnl If name is "no" then don't define this library at all
1156 dnl (it's only needed if libldap.so's dependencies are broken).
1157 if test "$LBERLIBNAME" != "no" ; then
1158 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1159 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1160 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001161 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001162 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001163 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001164 fi
1165 fi
1166fi
1167
1168if test x$CURL_DISABLE_LDAP != x1 ; then
1169 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1170
1171 if test "$LDAPLIBNAME" = "wldap32"; then
1172 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001173 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001174 else
1175 curl_ldap_msg="enabled (OpenLDAP)"
1176 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1177 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1178 AC_SUBST(USE_OPENLDAP, [1])
1179 fi
1180 fi
1181fi
1182
1183if test x$CURL_DISABLE_LDAPS != x1 ; then
1184 curl_ldaps_msg="enabled"
1185fi
1186
1187dnl **********************************************************************
1188dnl Checks for IPv6
1189dnl **********************************************************************
1190
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001191AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001192AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001193AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1194AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001195[ case "$enableval" in
1196 no)
1197 AC_MSG_RESULT(no)
1198 ipv6=no
1199 ;;
1200 *) AC_MSG_RESULT(yes)
1201 ipv6=yes
1202 ;;
1203 esac ],
1204
1205 AC_TRY_RUN([ /* is AF_INET6 available? */
1206#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001207#ifdef HAVE_WINSOCK2_H
1208#include <winsock2.h>
1209#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001210#include <sys/socket.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001211#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001212#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001213main()
1214{
1215 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1216 exit(1);
1217 else
1218 exit(0);
1219}
1220],
1221 AC_MSG_RESULT(yes)
1222 ipv6=yes,
1223 AC_MSG_RESULT(no)
1224 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001225 AC_MSG_RESULT(yes)
1226 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001227))
1228
1229if test "$ipv6" = "yes"; then
1230 curl_ipv6_msg="enabled"
1231fi
1232
1233# Check if struct sockaddr_in6 have sin6_scope_id member
1234if test "$ipv6" = yes; then
1235 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1236 AC_TRY_COMPILE([
1237#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001238#ifdef HAVE_WINSOCK2_H
1239#include <winsock2.h>
1240#include <ws2tcpip.h>
1241#else
1242#include <netinet/in.h>
Elliott Hughes0128fe42018-02-27 14:57:55 -08001243#if defined (__TANDEM)
1244# include <netinet/in6.h>
1245#endif
Alex Deymod15eaac2016-06-28 14:49:26 -07001246#endif] ,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001247 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1248 if test "$have_sin6_scope_id" = yes; then
1249 AC_MSG_RESULT([yes])
1250 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1251 else
1252 AC_MSG_RESULT([no])
1253 fi
1254fi
1255
1256dnl **********************************************************************
1257dnl Check if the operating system allows programs to write to their own argv[]
1258dnl **********************************************************************
1259
1260AC_MSG_CHECKING([if argv can be written to])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001261CURL_RUN_IFELSE([
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001262int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001263 argv[0][0] = ' ';
1264 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001265}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001266],[
1267 curl_cv_writable_argv=yes
1268],[
1269 curl_cv_writable_argv=no
1270],[
1271 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001272])
1273case $curl_cv_writable_argv in
1274yes)
1275 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1276 AC_MSG_RESULT(yes)
1277 ;;
1278no)
1279 AC_MSG_RESULT(no)
1280 ;;
1281*)
1282 AC_MSG_RESULT(no)
1283 AC_MSG_WARN([the previous check could not be made default was used])
1284 ;;
1285esac
1286
1287dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001288dnl Check for GSS-API libraries
1289dnl **********************************************************************
1290
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001291dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001292
1293GSSAPI_ROOT="/usr"
1294AC_ARG_WITH(gssapi-includes,
1295 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001296 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001297 [ GSSAPI_INCS="-I$withval"
1298 want_gss="yes" ]
1299)
1300
1301AC_ARG_WITH(gssapi-libs,
1302 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001303 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001304 [ GSSAPI_LIB_DIR="-L$withval"
1305 want_gss="yes" ]
1306)
1307
1308AC_ARG_WITH(gssapi,
1309 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001310 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001311 GSSAPI_ROOT="$withval"
1312 if test x"$GSSAPI_ROOT" != xno; then
1313 want_gss="yes"
1314 if test x"$GSSAPI_ROOT" = xyes; then
1315 dnl if yes, then use default root
1316 GSSAPI_ROOT="/usr"
1317 fi
1318 fi
1319])
1320
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001321: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1322
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001323save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001324AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001325if test x"$want_gss" = xyes; then
1326 AC_MSG_RESULT(yes)
1327
1328 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001329 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1330 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1331 elif test -f "$KRB5CONFIG"; then
1332 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001333 elif test "$GSSAPI_ROOT" != "yes"; then
1334 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1335 fi
1336 fi
1337
1338 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1339
1340 AC_CHECK_HEADER(gss.h,
1341 [
1342 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001343 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001344 gnu_gss=yes
1345 ],
1346 [
1347 dnl not found, check Heimdal or MIT
1348 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1349 AC_CHECK_HEADERS(
1350 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1351 [],
1352 [not_mit=1],
1353 [
1354AC_INCLUDES_DEFAULT
1355#ifdef HAVE_GSSAPI_GSSAPI_H
1356#include <gssapi/gssapi.h>
1357#endif
1358 ])
1359 if test "x$not_mit" = "x1"; then
1360 dnl MIT not found, check for Heimdal
1361 AC_CHECK_HEADER(gssapi.h,
1362 [
1363 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001364 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001365 ],
1366 [
1367 dnl no header found, disabling GSS
1368 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001369 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001370 ]
1371 )
1372 else
1373 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001374 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1375 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1376 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001377 AC_COMPILE_IFELSE([
1378 AC_LANG_PROGRAM([[
1379#include <gssapi/gssapi.h>
1380#include <gssapi/gssapi_generic.h>
1381#include <gssapi/gssapi_krb5.h>
1382 ]],[[
1383 gss_import_name(
1384 (OM_uint32 *)0,
1385 (gss_buffer_t)0,
1386 GSS_C_NT_HOSTBASED_SERVICE,
1387 (gss_name_t *)0);
1388 ]])
1389 ],[
1390 AC_MSG_RESULT([yes])
1391 ],[
1392 AC_MSG_RESULT([no])
1393 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001394 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001395 ])
1396 fi
1397 ]
1398 )
1399else
1400 AC_MSG_RESULT(no)
1401fi
1402if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001403 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1404 HAVE_GSSAPI=1
1405 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001406
1407 if test -n "$gnu_gss"; then
1408 curl_gss_msg="enabled (GNU GSS)"
1409 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001410 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001411 elif test -z "$GSSAPI_LIB_DIR"; then
1412 case $host in
1413 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001414 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001415 ;;
1416 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001417 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001418 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1419 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001420 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1421 LIBS="$gss_libs $LIBS"
1422 elif test -f "$KRB5CONFIG"; then
1423 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1424 dnl into LIBS
1425 gss_libs=`$KRB5CONFIG --libs gssapi`
1426 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001427 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001428 case $host in
1429 *-hp-hpux*)
1430 gss_libname="gss"
1431 ;;
1432 *)
1433 gss_libname="gssapi"
1434 ;;
1435 esac
1436
1437 if test "$GSSAPI_ROOT" != "yes"; then
1438 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1439 LIBS="-l$gss_libname $LIBS"
1440 else
1441 LIBS="-l$gss_libname $LIBS"
1442 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001443 fi
1444 ;;
1445 esac
1446 else
1447 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001448 case $host in
1449 *-hp-hpux*)
1450 LIBS="-lgss $LIBS"
1451 ;;
1452 *)
1453 LIBS="-lgssapi $LIBS"
1454 ;;
1455 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001456 fi
1457else
1458 CPPFLAGS="$save_CPPFLAGS"
1459fi
1460
Alex Deymo486467e2017-12-19 19:04:07 +01001461build_libstubgss=no
1462if test x"$want_gss" = "xyes"; then
1463 build_libstubgss=yes
1464fi
1465
1466AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1467
1468dnl -------------------------------------------------------------
1469dnl parse --with-default-ssl-backend so it can be validated below
1470dnl -------------------------------------------------------------
1471
1472DEFAULT_SSL_BACKEND=no
1473VALID_DEFAULT_SSL_BACKEND=
1474AC_ARG_WITH(default-ssl-backend,
1475AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1476AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1477 [DEFAULT_SSL_BACKEND=$withval])
1478case "$DEFAULT_SSL_BACKEND" in
1479 no)
1480 dnl --without-default-ssl-backend option used
1481 ;;
1482 default|yes)
1483 dnl --with-default-ssl-backend option used without name
1484 AC_MSG_ERROR([The name of the default SSL backend is required.])
1485 ;;
1486 *)
1487 dnl --with-default-ssl-backend option used with name
1488 AC_SUBST(DEFAULT_SSL_BACKEND)
1489 dnl needs to be validated below
1490 VALID_DEFAULT_SSL_BACKEND=no
1491 ;;
1492esac
1493
1494dnl **********************************************************************
1495
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001496dnl -------------------------------------------------
1497dnl check winssl option before other SSL libraries
1498dnl -------------------------------------------------
1499
1500OPT_WINSSL=no
1501AC_ARG_WITH(winssl,dnl
1502AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1503AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1504 OPT_WINSSL=$withval)
1505
Haibo Huang51d9d882019-02-06 01:36:06 -08001506AC_ARG_WITH(schannel,dnl
1507AC_HELP_STRING([--with-schannel],[enable Windows native SSL/TLS])
1508AC_HELP_STRING([--without-schannel], [disable Windows native SSL/TLS]),
1509 OPT_WINSSL=$withval)
1510
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001511AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
Alex Deymo486467e2017-12-19 19:04:07 +01001512if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1513 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001514 if test "x$OPT_WINSSL" != "xno" &&
Alex Deymod15eaac2016-06-28 14:49:26 -07001515 test "x$curl_cv_native_windows" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001516 AC_MSG_RESULT(yes)
1517 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1518 AC_SUBST(USE_SCHANNEL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001519 ssl_msg="Windows-native"
1520 test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001521 WINSSL_ENABLED=1
1522 # --with-winssl implies --enable-sspi
1523 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1524 AC_SUBST(USE_WINDOWS_SSPI, [1])
1525 curl_sspi_msg="enabled"
Alex Deymoe3149cc2016-10-05 11:18:42 -07001526 LIBS="-lcrypt32 $LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001527 else
1528 AC_MSG_RESULT(no)
1529 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001530 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001531else
1532 AC_MSG_RESULT(no)
1533fi
1534
Haibo Huang65021c72019-03-27 15:37:23 -07001535OPT_SECURETRANSPORT=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001536AC_ARG_WITH(darwinssl,dnl
Elliott Hughescee03382017-06-23 12:17:18 -07001537AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1538AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
Haibo Huang65021c72019-03-27 15:37:23 -07001539 OPT_SECURETRANSPORT=$withval)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001540
Haibo Huang65021c72019-03-27 15:37:23 -07001541AC_ARG_WITH(secure-transport,dnl
1542AC_HELP_STRING([--with-secure-transport],[enable Apple OS native SSL/TLS])
1543AC_HELP_STRING([--without-secure-transport], [disable Apple OS native SSL/TLS]),
1544 OPT_SECURETRANSPORT=$withval)
1545
1546AC_MSG_CHECKING([whether to enable Secure Transport])
1547if test -z "$ssl_backends" -o "x$OPT_SECURETRANSPORT" != xno; then
1548 if test "x$OPT_SECURETRANSPORT" != "xno" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001549 test -d "/System/Library/Frameworks/Security.framework"; then
1550 AC_MSG_RESULT(yes)
Haibo Huang65021c72019-03-27 15:37:23 -07001551 AC_DEFINE(USE_SECTRANSP, 1, [enable Secure Transport])
1552 AC_SUBST(USE_SECTRANSP, [1])
1553 ssl_msg="Secure Transport"
1554 test secure-transport != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1555 SECURETRANSPORT_ENABLED=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001556 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1557 else
1558 AC_MSG_RESULT(no)
1559 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001560 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001561else
1562 AC_MSG_RESULT(no)
1563fi
1564
Haibo Huang65021c72019-03-27 15:37:23 -07001565OPT_AMISSL=no
1566AC_ARG_WITH(amissl,dnl
1567AC_HELP_STRING([--with-amissl],[enable Amiga native SSL/TLS (AmiSSL)])
1568AC_HELP_STRING([--without-amissl], [disable Amiga native SSL/TLS (AmiSSL)]),
1569 OPT_AMISSL=$withval)
1570
1571AC_MSG_CHECKING([whether to enable Amiga native SSL/TLS (AmiSSL)])
Haibo Huang34ab3462019-05-22 00:50:27 -07001572if test "$HAVE_PROTO_BSDSOCKET_H" = "1"; then
Haibo Huang65021c72019-03-27 15:37:23 -07001573 if test -z "$ssl_backends" -o "x$OPT_AMISSL" != xno; then
1574 ssl_msg=
1575 if test "x$OPT_AMISSL" != "xno"; then
1576 AC_MSG_RESULT(yes)
1577 ssl_msg="AmiSSL"
1578 test amissl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
1579 AMISSL_ENABLED=1
1580 LIBS="-lamisslauto $LIBS"
1581 AC_DEFINE(USE_AMISSL, 1, [if AmiSSL is in use])
1582 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use])
1583 else
1584 AC_MSG_RESULT(no)
1585 fi
1586 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
1587 else
1588 AC_MSG_RESULT(no)
1589 fi
1590else
1591 AC_MSG_RESULT(no)
1592fi
1593
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001594dnl **********************************************************************
1595dnl Check for the presence of SSL libraries and headers
1596dnl **********************************************************************
1597
1598dnl Default to compiler & linker defaults for SSL files & libraries.
1599OPT_SSL=off
1600dnl Default to no CA bundle
1601ca="no"
1602AC_ARG_WITH(ssl,dnl
1603AC_HELP_STRING([--with-ssl=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])
1604AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1605 OPT_SSL=$withval)
1606
Alex Deymo486467e2017-12-19 19:04:07 +01001607if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1608 test X"$OPT_SSL" != Xno; then
1609 ssl_msg=
1610
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001611 dnl backup the pre-ssl variables
1612 CLEANLDFLAGS="$LDFLAGS"
1613 CLEANCPPFLAGS="$CPPFLAGS"
1614 CLEANLIBS="$LIBS"
1615
Alex Deymod15eaac2016-06-28 14:49:26 -07001616 dnl This is for Msys/Mingw
1617 case $host in
1618 *-*-msys* | *-*-mingw*)
1619 AC_MSG_CHECKING([for gdi32])
1620 my_ac_save_LIBS=$LIBS
1621 LIBS="-lgdi32 $LIBS"
1622 AC_TRY_LINK([#include <windef.h>
1623 #include <wingdi.h>],
1624 [GdiFlush();],
1625 [ dnl worked!
1626 AC_MSG_RESULT([yes])],
1627 [ dnl failed, restore LIBS
1628 LIBS=$my_ac_save_LIBS
1629 AC_MSG_RESULT(no)]
1630 )
1631 ;;
1632 esac
1633
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001634 case "$OPT_SSL" in
1635 yes)
1636 dnl --with-ssl (without path) used
1637 if test x$cross_compiling != xyes; then
1638 dnl only do pkg-config magic when not cross-compiling
1639 PKGTEST="yes"
1640 fi
1641 PREFIX_OPENSSL=/usr/local/ssl
1642 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1643 ;;
1644 off)
1645 dnl no --with-ssl option given, just check default places
1646 if test x$cross_compiling != xyes; then
1647 dnl only do pkg-config magic when not cross-compiling
1648 PKGTEST="yes"
1649 fi
1650 PREFIX_OPENSSL=
1651 ;;
1652 *)
1653 dnl check the given --with-ssl spot
1654 PKGTEST="no"
1655 PREFIX_OPENSSL=$OPT_SSL
1656
1657 dnl Try pkg-config even when cross-compiling. Since we
1658 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1659 dnl the user told us to look
1660 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001661 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Elliott Hughes72d948d2018-08-03 14:37:21 -07001662 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001663 PKGTEST="yes"
Elliott Hughes72d948d2018-08-03 14:37:21 -07001664 elif test ! -f "$PREFIX_OPENSSL/include/openssl/ssl.h"; then
1665 AC_MSG_ERROR([$PREFIX_OPENSSL is a bad --with-ssl prefix!])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001666 fi
1667
1668 dnl in case pkg-config comes up empty, use what we got
1669 dnl via --with-ssl
1670 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1671 if test "$PREFIX_OPENSSL" != "/usr" ; then
1672 SSL_LDFLAGS="-L$LIB_OPENSSL"
1673 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1674 fi
1675 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1676 ;;
1677 esac
1678
1679 if test "$PKGTEST" = "yes"; then
1680
1681 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1682
1683 if test "$PKGCONFIG" != "no" ; then
1684 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
Haibo Huang21926d52019-01-08 14:27:10 -08001685 $PKGCONFIG --libs-only-l --libs-only-other openssl 2>/dev/null`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001686
1687 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1688 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1689
1690 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1691 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1692
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001693 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001694 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1695 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1696 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1697
1698 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1699
1700 dnl use the values pkg-config reported. This is here
1701 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1702 dnl learn about this via pkg-config. If we only have
1703 dnl the argument to --with-ssl we don't know what
1704 dnl additional libs may be necessary. Hope that we
1705 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001706 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001707 fi
1708 fi
1709
1710 dnl finally, set flags to use SSL
1711 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1712 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1713
Alex Deymod15eaac2016-06-28 14:49:26 -07001714 AC_CHECK_LIB(crypto, HMAC_Update,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001715 HAVECRYPTO="yes"
1716 LIBS="-lcrypto $LIBS"
1717 ],[
1718 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
Elliott Hughesb1ef70f2018-10-30 11:28:38 -07001719 if test "$PKGCONFIG" = "no" ; then
1720 # only set this if pkg-config wasn't used
1721 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1722 fi
Alex Deymod15eaac2016-06-28 14:49:26 -07001723 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001724 HAVECRYPTO="yes"
1725 LIBS="-lcrypto $LIBS"], [
Elliott Hughes82be86d2017-09-20 17:00:17 -07001726
1727 dnl still no, but what about with -ldl?
1728 AC_MSG_CHECKING([OpenSSL linking with -ldl])
Elliott Hughes72d948d2018-08-03 14:37:21 -07001729 LIBS="$CLEANLIBS -lcrypto -ldl"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001730 AC_TRY_LINK(
1731 [
1732 #include <openssl/err.h>
1733 ],
1734 [
1735 ERR_clear_error();
1736 ],
1737 [
1738 AC_MSG_RESULT(yes)
1739 HAVECRYPTO="yes"
1740 ],
1741 [
1742 AC_MSG_RESULT(no)
Elliott Hughes72d948d2018-08-03 14:37:21 -07001743 dnl ok, so what about both -ldl and -lpthread?
Elliott Hughes82be86d2017-09-20 17:00:17 -07001744
1745 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
Elliott Hughes72d948d2018-08-03 14:37:21 -07001746 LIBS="$CLEANLIBS -lcrypto -ldl -lpthread"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001747 AC_TRY_LINK(
1748 [
1749 #include <openssl/err.h>
1750 ],
1751 [
1752 ERR_clear_error();
1753 ],
1754 [
1755 AC_MSG_RESULT(yes)
1756 HAVECRYPTO="yes"
1757 ],
1758 [
1759 AC_MSG_RESULT(no)
1760 LDFLAGS="$CLEANLDFLAGS"
1761 CPPFLAGS="$CLEANCPPFLAGS"
1762 LIBS="$CLEANLIBS"
1763
1764 ])
1765
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001766 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001767
Elliott Hughes82be86d2017-09-20 17:00:17 -07001768 ])
1769 ])
Alex Deymod15eaac2016-06-28 14:49:26 -07001770
1771 if test X"$HAVECRYPTO" = X"yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001772 dnl This is only reasonable to do if crypto actually is there: check for
1773 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1774
1775 AC_CHECK_LIB(ssl, SSL_connect)
1776
1777 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1778 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1779 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1780 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001781 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001782 AC_CHECK_LIB(ssl, SSL_connect)
1783 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1784 dnl still no SSL_connect
1785 AC_MSG_RESULT(no)
1786 LIBS=$OLIBS
1787 else
1788 AC_MSG_RESULT(yes)
1789 fi
1790
1791 else
1792
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001793 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001794 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1795 openssl/pem.h openssl/ssl.h openssl/err.h,
Alex Deymo486467e2017-12-19 19:04:07 +01001796 ssl_msg="OpenSSL"
1797 test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001798 OPENSSL_ENABLED=1
1799 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1800
1801 if test $ac_cv_header_openssl_x509_h = no; then
1802 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1803 dnl since 'err.h' might in fact find a krb4 header with the same
1804 dnl name
1805 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1806
1807 if test $ac_cv_header_x509_h = yes &&
1808 test $ac_cv_header_crypto_h = yes &&
1809 test $ac_cv_header_ssl_h = yes; then
1810 dnl three matches
Alex Deymo486467e2017-12-19 19:04:07 +01001811 ssl_msg="OpenSSL"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001812 OPENSSL_ENABLED=1
1813 fi
1814 fi
1815 fi
1816
Alex Deymo486467e2017-12-19 19:04:07 +01001817 if test X"$OPENSSL_ENABLED" != X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001818 LIBS="$CLEANLIBS"
1819 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001820
1821 if test X"$OPT_SSL" != Xoff &&
1822 test "$OPENSSL_ENABLED" != "1"; then
1823 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1824 fi
1825 fi
1826
1827 if test X"$OPENSSL_ENABLED" = X"1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001828 dnl These can only exist if OpenSSL exists
Haibo Huang51d9d882019-02-06 01:36:06 -08001829 dnl OpenSSL_version is introduced in 3.0.0
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001830
Elliott Hughescee03382017-06-23 12:17:18 -07001831 AC_CHECK_FUNCS( RAND_egd \
Haibo Huang51d9d882019-02-06 01:36:06 -08001832 SSLv2_client_method \
1833 OpenSSL_version )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001834
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001835 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001836 AC_COMPILE_IFELSE([
Alex Deymod15eaac2016-06-28 14:49:26 -07001837 AC_LANG_PROGRAM([[
1838 #include <openssl/base.h>
1839 ]],[[
1840 #ifndef OPENSSL_IS_BORINGSSL
1841 #error not boringssl
1842 #endif
1843 ]])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001844 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001845 AC_MSG_RESULT([yes])
1846 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1847 [Define to 1 if using BoringSSL.])
Alex Deymo486467e2017-12-19 19:04:07 +01001848 ssl_msg="BoringSSL"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001849 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001850 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001851 ])
1852
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001853 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001854 AC_COMPILE_IFELSE([
1855 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001856#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001857 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001858 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001859 ]])
1860 ],[
1861 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001862 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1863 [Define to 1 if using libressl.])
Alex Deymo486467e2017-12-19 19:04:07 +01001864 ssl_msg="libressl"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001865 ],[
1866 AC_MSG_RESULT([no])
1867 ])
1868 fi
1869
1870 if test "$OPENSSL_ENABLED" = "1"; then
1871 if test -n "$LIB_OPENSSL"; then
1872 dnl when the ssl shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001873 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001874 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001875 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001876 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_OPENSSL"
1877 export CURL_LIBRARY_PATH
1878 AC_MSG_NOTICE([Added $LIB_OPENSSL to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001879 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001880 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001881 CURL_CHECK_OPENSSL_API
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001882 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001883 fi
1884
Alex Deymo486467e2017-12-19 19:04:07 +01001885 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001886fi
1887
Haibo Huang34ab3462019-05-22 00:50:27 -07001888if test X"$OPT_SSL" != Xoff &&
1889 test X"$OPT_SSL" != Xno &&
1890 test "$OPENSSL_ENABLED" != "1"; then
1891 AC_MSG_NOTICE([OPT_SSL: $OPT_SSL])
1892 AC_MSG_NOTICE([OPENSSL_ENABLED: $OPENSSL_ENABLED])
1893 AC_MSG_ERROR([--with-ssl was given but OpenSSL could not be detected])
1894fi
1895
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001896dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001897dnl Check for the random seed preferences
1898dnl **********************************************************************
1899
1900if test X"$OPENSSL_ENABLED" = X"1"; then
1901 AC_ARG_WITH(egd-socket,
1902 AC_HELP_STRING([--with-egd-socket=FILE],
1903 [Entropy Gathering Daemon socket pathname]),
1904 [ EGD_SOCKET="$withval" ]
1905 )
1906 if test -n "$EGD_SOCKET" ; then
1907 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1908 [your Entropy Gathering Daemon socket pathname] )
1909 fi
1910
1911 dnl Check for user-specified random device
1912 AC_ARG_WITH(random,
1913 AC_HELP_STRING([--with-random=FILE],
1914 [read randomness from FILE (default=/dev/urandom)]),
1915 [ RANDOM_FILE="$withval" ],
1916 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001917 if test x$cross_compiling != xyes; then
1918 dnl Check for random device
1919 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1920 else
1921 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1922 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001923 ]
1924 )
1925 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1926 AC_SUBST(RANDOM_FILE)
1927 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1928 [a suitable file to read random data from])
1929 fi
1930fi
1931
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001932dnl ---
1933dnl We require OpenSSL with SRP support.
1934dnl ---
1935if test "$OPENSSL_ENABLED" = "1"; then
1936 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1937 [
1938 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1939 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1940 ])
1941fi
1942
Elliott Hughesa93fb052018-12-12 14:22:48 -08001943dnl ---
1944dnl Whether the OpenSSL configuration will be loaded automatically
1945dnl ---
1946if test X"$OPENSSL_ENABLED" = X"1"; then
1947AC_ARG_ENABLE(openssl-auto-load-config,
1948AC_HELP_STRING([--enable-openssl-auto-load-config],[Enable automatic loading of OpenSSL configuration])
1949AC_HELP_STRING([--disable-openssl-auto-load-config],[Disable automatic loading of OpenSSL configuration]),
1950[ if test X"$enableval" = X"no"; then
1951 AC_MSG_NOTICE([automatic loading of OpenSSL configuration disabled])
1952 AC_DEFINE(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG, 1, [if the OpenSSL configuration won't be loaded automatically])
1953 fi
1954])
1955fi
1956
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001957dnl ----------------------------------------------------
1958dnl check for GnuTLS
1959dnl ----------------------------------------------------
1960
1961dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1962OPT_GNUTLS=no
1963
1964AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001965AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001966AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1967 OPT_GNUTLS=$withval)
1968
Alex Deymo486467e2017-12-19 19:04:07 +01001969if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1970 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001971
1972 if test X"$OPT_GNUTLS" != Xno; then
1973
1974 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001975 addlib=""
1976 gtlslib=""
1977 version=""
1978 addcflags=""
1979
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001980 if test "x$OPT_GNUTLS" = "xyes"; then
1981 dnl this is with no partiular path given
1982 CURL_CHECK_PKGCONFIG(gnutls)
1983
1984 if test "$PKGCONFIG" != "no" ; then
1985 addlib=`$PKGCONFIG --libs-only-l gnutls`
1986 addld=`$PKGCONFIG --libs-only-L gnutls`
1987 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1988 version=`$PKGCONFIG --modversion gnutls`
1989 gtlslib=`echo $addld | $SED -e 's/-L//'`
1990 else
1991 dnl without pkg-config, we try libgnutls-config as that was how it
1992 dnl used to be done
1993 check=`libgnutls-config --version 2>/dev/null`
1994 if test -n "$check"; then
1995 addlib=`libgnutls-config --libs`
1996 addcflags=`libgnutls-config --cflags`
1997 version=`libgnutls-config --version`
1998 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1999 fi
2000 fi
2001 else
2002 dnl this is with a given path, first check if there's a libgnutls-config
2003 dnl there and if not, make an educated guess
2004 cfg=$OPT_GNUTLS/bin/libgnutls-config
2005 check=`$cfg --version 2>/dev/null`
2006 if test -n "$check"; then
2007 addlib=`$cfg --libs`
2008 addcflags=`$cfg --cflags`
2009 version=`$cfg --version`
2010 gtlslib=`$cfg --prefix`/lib$libsuff
2011 else
2012 dnl without pkg-config and libgnutls-config, we guess a lot!
2013 addlib=-lgnutls
2014 addld=-L$OPT_GNUTLS/lib$libsuff
2015 addcflags=-I$OPT_GNUTLS/include
2016 version="" # we just don't know
2017 gtlslib=$OPT_GNUTLS/lib$libsuff
2018 fi
2019 fi
2020
2021 if test -z "$version"; then
2022 dnl lots of efforts, still no go
2023 version="unknown"
2024 fi
2025
2026 if test -n "$addlib"; then
2027
2028 CLEANLIBS="$LIBS"
2029 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002030 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002031
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002032 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002033 LDFLAGS="$LDFLAGS $addld"
2034 if test "$addcflags" != "-I/usr/include"; then
2035 CPPFLAGS="$CPPFLAGS $addcflags"
2036 fi
2037
2038 AC_CHECK_LIB(gnutls, gnutls_check_version,
2039 [
2040 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
2041 AC_SUBST(USE_GNUTLS, [1])
2042 GNUTLS_ENABLED=1
2043 USE_GNUTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002044 ssl_msg="GnuTLS"
2045 test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002046 ],
2047 [
2048 LIBS="$CLEANLIBS"
2049 CPPFLAGS="$CLEANCPPFLAGS"
2050 ])
2051
2052 if test "x$USE_GNUTLS" = "xyes"; then
2053 AC_MSG_NOTICE([detected GnuTLS version $version])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002054 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002055 if test -n "$gtlslib"; then
2056 dnl when shared libs were found in a path that the run-time
2057 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002058 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002059 dnl due to this
Alex Deymo486467e2017-12-19 19:04:07 +01002060 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002061 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$gtlslib"
2062 export CURL_LIBRARY_PATH
2063 AC_MSG_NOTICE([Added $gtlslib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002064 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002065 fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07002066 AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002067 fi
2068
2069 fi
2070
2071 fi dnl GNUTLS not disabled
2072
Alex Deymo486467e2017-12-19 19:04:07 +01002073 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002074fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002075
2076dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002077dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002078dnl ---
2079
2080if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002081 USE_GNUTLS_NETTLE=
2082 # First check if we can detect either crypto library via transitive linking
2083 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2084 if test "$USE_GNUTLS_NETTLE" = ""; then
2085 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2086 fi
2087 # If not, try linking directly to both of them to see if they are available
2088 if test "$USE_GNUTLS_NETTLE" = ""; then
2089 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2090 fi
2091 if test "$USE_GNUTLS_NETTLE" = ""; then
2092 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2093 fi
2094 if test "$USE_GNUTLS_NETTLE" = ""; then
2095 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
2096 fi
2097 if test "$USE_GNUTLS_NETTLE" = "1"; then
2098 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
2099 AC_SUBST(USE_GNUTLS_NETTLE, [1])
2100 LIBS="-lnettle $LIBS"
2101 else
2102 LIBS="-lgcrypt $LIBS"
2103 fi
2104fi
2105
2106dnl ---
2107dnl We require GnuTLS with SRP support.
2108dnl ---
2109if test "$GNUTLS_ENABLED" = "1"; then
2110 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
2111 [
2112 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
2113 AC_SUBST(HAVE_GNUTLS_SRP, [1])
2114 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002115fi
2116
2117dnl ----------------------------------------------------
Alex Deymod15eaac2016-06-28 14:49:26 -07002118dnl check for mbedTLS
2119dnl ----------------------------------------------------
2120
2121OPT_MBEDTLS=no
2122
2123_cppflags=$CPPFLAGS
2124_ldflags=$LDFLAGS
2125AC_ARG_WITH(mbedtls,dnl
2126AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2127AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2128 OPT_MBEDTLS=$withval)
2129
Alex Deymo486467e2017-12-19 19:04:07 +01002130if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2131 ssl_msg=
Alex Deymod15eaac2016-06-28 14:49:26 -07002132
2133 if test X"$OPT_MBEDTLS" != Xno; then
2134
2135 if test "$OPT_MBEDTLS" = "yes"; then
2136 OPT_MBEDTLS=""
2137 fi
2138
2139 if test -z "$OPT_MBEDTLS" ; then
2140 dnl check for lib first without setting any new path
2141
2142 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2143 dnl libmbedtls found, set the variable
2144 [
2145 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2146 AC_SUBST(USE_MBEDTLS, [1])
2147 MBEDTLS_ENABLED=1
2148 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002149 ssl_msg="mbedTLS"
2150 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002151 ], [], -lmbedx509 -lmbedcrypto)
2152 fi
2153
2154 addld=""
2155 addlib=""
2156 addcflags=""
2157 mbedtlslib=""
2158
2159 if test "x$USE_MBEDTLS" != "xyes"; then
2160 dnl add the path and test again
2161 addld=-L$OPT_MBEDTLS/lib$libsuff
2162 addcflags=-I$OPT_MBEDTLS/include
2163 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2164
2165 LDFLAGS="$LDFLAGS $addld"
2166 if test "$addcflags" != "-I/usr/include"; then
2167 CPPFLAGS="$CPPFLAGS $addcflags"
2168 fi
2169
2170 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2171 [
2172 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2173 AC_SUBST(USE_MBEDTLS, [1])
2174 MBEDTLS_ENABLED=1
2175 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002176 ssl_msg="mbedTLS"
2177 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002178 ],
2179 [
2180 CPPFLAGS=$_cppflags
2181 LDFLAGS=$_ldflags
2182 ], -lmbedx509 -lmbedcrypto)
2183 fi
2184
2185 if test "x$USE_MBEDTLS" = "xyes"; then
2186 AC_MSG_NOTICE([detected mbedTLS])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002187 check_for_ca_bundle=1
Alex Deymod15eaac2016-06-28 14:49:26 -07002188
2189 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2190
2191 if test -n "$mbedtlslib"; then
2192 dnl when shared libs were found in a path that the run-time
2193 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002194 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Alex Deymod15eaac2016-06-28 14:49:26 -07002195 dnl due to this
2196 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002197 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$mbedtlslib"
2198 export CURL_LIBRARY_PATH
2199 AC_MSG_NOTICE([Added $mbedtlslib to CURL_LIBRARY_PATH])
Alex Deymod15eaac2016-06-28 14:49:26 -07002200 fi
2201 fi
2202 fi
2203
2204 fi dnl mbedTLS not disabled
2205
Alex Deymo486467e2017-12-19 19:04:07 +01002206 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Alex Deymod15eaac2016-06-28 14:49:26 -07002207fi
2208
2209dnl ----------------------------------------------------
Haibo Huang001784b2019-07-19 05:27:28 -07002210dnl check for wolfSSL
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002211dnl ----------------------------------------------------
2212
Haibo Huang001784b2019-07-19 05:27:28 -07002213dnl Default to compiler & linker defaults for wolfSSL files & libraries.
2214OPT_WOLFSSL=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002215
2216_cppflags=$CPPFLAGS
2217_ldflags=$LDFLAGS
2218AC_ARG_WITH(cyassl,dnl
2219AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2220AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
Haibo Huang001784b2019-07-19 05:27:28 -07002221 OPT_WOLFSSL=$withval)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002222
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002223dnl provide --with-wolfssl as an alias for --with-cyassl
2224AC_ARG_WITH(wolfssl,dnl
2225AC_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)])
2226AC_HELP_STRING([--without-wolfssl], [disable WolfSSL detection]),
Haibo Huang001784b2019-07-19 05:27:28 -07002227 OPT_WOLFSSL=$withval)
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002228
Haibo Huang001784b2019-07-19 05:27:28 -07002229if test -z "$ssl_backends" -o "x$OPT_WOLFSSL" != xno; then
Alex Deymo486467e2017-12-19 19:04:07 +01002230 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002231
Haibo Huang001784b2019-07-19 05:27:28 -07002232 if test X"$OPT_WOLFSSL" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002233
Haibo Huang001784b2019-07-19 05:27:28 -07002234 if test "$OPT_WOLFSSL" = "yes"; then
2235 OPT_WOLFSSL=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002236 fi
2237
2238 dnl This should be reworked to use pkg-config instead
2239
2240 cyassllibname=cyassl
2241
Haibo Huang001784b2019-07-19 05:27:28 -07002242 if test -z "$OPT_WOLFSSL" ; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002243 dnl check for lib in system default first
2244
2245 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2246 dnl libcyassl found, set the variable
2247 [
Haibo Huang001784b2019-07-19 05:27:28 -07002248 AC_DEFINE(USE_WOLFSSL, 1, [if wolfSSL is enabled])
2249 AC_SUBST(USE_WOLFSSL, [1])
2250 WOLFSSL_ENABLED=1
2251 USE_WOLFSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002252 ssl_msg="CyaSSL"
2253 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002254 ])
2255 fi
2256
2257 addld=""
2258 addlib=""
2259 addcflags=""
2260 cyassllib=""
2261
Haibo Huang001784b2019-07-19 05:27:28 -07002262 if test "x$USE_WOLFSSL" != "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002263 dnl add the path and test again
Haibo Huang001784b2019-07-19 05:27:28 -07002264 addld=-L$OPT_WOLFSSL/lib$libsuff
2265 addcflags=-I$OPT_WOLFSSL/include
2266 cyassllib=$OPT_WOLFSSL/lib$libsuff
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002267
2268 LDFLAGS="$LDFLAGS $addld"
2269 if test "$addcflags" != "-I/usr/include"; then
2270 CPPFLAGS="$CPPFLAGS $addcflags"
2271 fi
2272
2273 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2274 [
Haibo Huang001784b2019-07-19 05:27:28 -07002275 AC_DEFINE(USE_WOLFSSL, 1, [if CyaSSL is enabled])
2276 AC_SUBST(USE_WOLFSSL, [1])
2277 WOLFSSL_ENABLED=1
2278 USE_WOLFSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002279 ssl_msg="CyaSSL"
2280 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002281 ],
2282 [
2283 CPPFLAGS=$_cppflags
2284 LDFLAGS=$_ldflags
2285 cyassllib=""
2286 ])
2287 fi
2288
2289 addld=""
2290 addlib=""
2291 addcflags=""
2292
Haibo Huang001784b2019-07-19 05:27:28 -07002293 if test "x$USE_WOLFSSL" != "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002294 dnl libcyassl renamed to libwolfssl as of 3.4.0
Haibo Huang001784b2019-07-19 05:27:28 -07002295 addld=-L$OPT_WOLFSSL/lib$libsuff
2296 addcflags=-I$OPT_WOLFSSL/include
2297 cyassllib=$OPT_WOLFSSL/lib$libsuff
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002298
2299 LDFLAGS="$LDFLAGS $addld"
2300 if test "$addcflags" != "-I/usr/include"; then
2301 CPPFLAGS="$CPPFLAGS $addcflags"
2302 fi
2303
2304 cyassllibname=wolfssl
2305 my_ac_save_LIBS="$LIBS"
2306 LIBS="-l$cyassllibname -lm $LIBS"
2307
2308 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2309 AC_LINK_IFELSE([
2310 AC_LANG_PROGRAM([[
2311/* These aren't needed for detection and confuse WolfSSL.
2312 They are set up properly later if it is detected. */
2313#undef SIZEOF_LONG
2314#undef SIZEOF_LONG_LONG
2315#include <cyassl/ssl.h>
2316 ]],[[
2317 return CyaSSL_Init();
2318 ]])
2319 ],[
2320 AC_MSG_RESULT(yes)
Haibo Huang001784b2019-07-19 05:27:28 -07002321 AC_DEFINE(USE_WOLFSSL, 1, [if wolfSSL is enabled])
2322 AC_SUBST(USE_WOLFSSL, [1])
2323 WOLFSSL_ENABLED=1
2324 USE_WOLFSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002325 ssl_msg="WolfSSL"
2326 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002327 ],
2328 [
2329 AC_MSG_RESULT(no)
2330 CPPFLAGS=$_cppflags
2331 LDFLAGS=$_ldflags
2332 cyassllib=""
2333 ])
2334 LIBS="$my_ac_save_LIBS"
2335 fi
2336
Haibo Huang001784b2019-07-19 05:27:28 -07002337 if test "x$USE_WOLFSSL" = "xyes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07002338 AC_MSG_NOTICE([detected $cyassllibname])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002339 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002340
2341 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
Elliott Hughes72d948d2018-08-03 14:37:21 -07002342 AX_COMPILE_CHECK_SIZEOF(long long)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002343
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002344 LIBS="-l$cyassllibname -lm $LIBS"
2345
Haibo Huang001784b2019-07-19 05:27:28 -07002346 dnl Recent WolfSSL versions build without SSLv3 by default
2347 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2348 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2349 wolfSSL_get_peer_certificate \
2350 wolfSSL_UseALPN)
Alex Deymod15eaac2016-06-28 14:49:26 -07002351
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002352 if test -n "$cyassllib"; then
2353 dnl when shared libs were found in a path that the run-time
2354 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002355 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002356 dnl due to this
2357 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002358 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$cyassllib"
2359 export CURL_LIBRARY_PATH
2360 AC_MSG_NOTICE([Added $cyassllib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002361 fi
2362 fi
2363
2364 fi
2365
Haibo Huang001784b2019-07-19 05:27:28 -07002366 fi dnl wolfSSL not disabled
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002367
Alex Deymo486467e2017-12-19 19:04:07 +01002368 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002369fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002370
2371dnl ----------------------------------------------------
Elliott Hughesa93fb052018-12-12 14:22:48 -08002372dnl check for MesaLink
2373dnl ----------------------------------------------------
2374
2375dnl Default to compiler & linker defaults for MesaLink files & libraries.
2376OPT_MESALINK=no
2377
2378_cppflags=$CPPFLAGS
2379_ldflags=$LDFLAGS
2380AC_ARG_WITH(mesalink,dnl
2381AC_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root])
2382AC_HELP_STRING([--without-mesalink], [disable MesaLink detection]),
2383 OPT_MESALINK=$withval)
2384
2385if test -z "$ssl_backends" -o "x$OPT_MESALINK" != xno; then
2386 ssl_msg=
2387
2388 if test X"$OPT_MESALINK" != Xno; then
2389
2390 if test "$OPT_MESALINK" = "yes"; then
2391 OPT_MESALINK=""
2392 fi
2393
2394 if test -z "$OPT_MESALINK" ; then
2395 dnl check for lib first without setting any new path
2396
2397 AC_CHECK_LIB(mesalink, mesalink_library_init,
2398 dnl libmesalink found, set the variable
2399 [
2400 AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2401 AC_SUBST(USE_MESALINK, [1])
2402 MESALINK_ENABLED=1
2403 USE_MESALINK="yes"
2404 ssl_msg="MesaLink"
2405 test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2406 ])
2407 fi
2408
2409 addld=""
2410 addlib=""
2411 addcflags=""
2412 mesalinklib=""
2413
2414 if test "x$USE_MESALINK" != "xyes"; then
2415 dnl add the path and test again
2416 addld=-L$OPT_MESALINK/lib$libsuff
2417 addcflags=-I$OPT_MESALINK/include
2418 mesalinklib=$OPT_MESALINK/lib$libsuff
2419
2420 LDFLAGS="$LDFLAGS $addld"
2421 if test "$addcflags" != "-I/usr/include"; then
2422 CPPFLAGS="$CPPFLAGS $addcflags"
2423 fi
2424
2425 AC_CHECK_LIB(mesalink, mesalink_library_init,
2426 [
2427 AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2428 AC_SUBST(USE_MESALINK, [1])
2429 MESALINK_ENABLED=1
2430 USE_MESALINK="yes"
2431 ssl_msg="MesaLink"
2432 test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2433 ],
2434 [
2435 CPPFLAGS=$_cppflags
2436 LDFLAGS=$_ldflags
2437 ])
2438 fi
2439
2440 if test "x$USE_MESALINK" = "xyes"; then
2441 AC_MSG_NOTICE([detected MesaLink])
2442
2443 LIBS="-lmesalink $LIBS"
2444
2445 if test -n "$mesalinklib"; then
2446 dnl when shared libs were found in a path that the run-time
2447 dnl linker doesn't search through, we need to add it to
2448 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2449 dnl due to this
2450 if test "x$cross_compiling" != "xyes"; then
2451 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mesalinklib"
2452 export LD_LIBRARY_PATH
2453 AC_MSG_NOTICE([Added $mesalinklib to LD_LIBRARY_PATH])
2454 fi
2455 fi
2456 fi
2457
2458 fi dnl MesaLink not disabled
2459
2460 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2461fi
2462
2463dnl ----------------------------------------------------
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002464dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2465dnl ----------------------------------------------------
2466
2467dnl Default to compiler & linker defaults for NSS files & libraries.
2468OPT_NSS=no
2469
2470AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002471AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002472AC_HELP_STRING([--without-nss], [disable NSS detection]),
2473 OPT_NSS=$withval)
2474
Alex Deymo486467e2017-12-19 19:04:07 +01002475if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2476 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002477
2478 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002479
2480 addld=""
2481 addlib=""
2482 addcflags=""
2483 nssprefix=""
2484 version=""
2485
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002486 if test "x$OPT_NSS" = "xyes"; then
2487
2488 CURL_CHECK_PKGCONFIG(nss)
2489
2490 if test "$PKGCONFIG" != "no" ; then
2491 addlib=`$PKGCONFIG --libs nss`
2492 addcflags=`$PKGCONFIG --cflags nss`
2493 version=`$PKGCONFIG --modversion nss`
2494 nssprefix=`$PKGCONFIG --variable=prefix nss`
2495 else
2496 dnl Without pkg-config, we check for nss-config
2497
2498 check=`nss-config --version 2>/dev/null`
2499 if test -n "$check"; then
2500 addlib=`nss-config --libs`
2501 addcflags=`nss-config --cflags`
2502 version=`nss-config --version`
2503 nssprefix=`nss-config --prefix`
2504 else
2505 addlib="-lnss3"
2506 addcflags=""
2507 version="unknown"
2508 fi
2509 fi
2510 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002511 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2512 if test -f "$NSS_PCDIR/nss.pc"; then
2513 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2514 if test "$PKGCONFIG" != "no" ; then
2515 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2516 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2517 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2518 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2519 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2520 fi
2521 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002522 fi
2523
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002524 if test -z "$addlib"; then
2525 # Without pkg-config, we'll kludge in some defaults
2526 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2527 addld="-L$OPT_NSS/lib"
2528 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2529 addcflags="-I$OPT_NSS/include"
2530 version="unknown"
2531 nssprefix=$OPT_NSS
2532 fi
2533
2534 CLEANLDFLAGS="$LDFLAGS"
2535 CLEANLIBS="$LIBS"
2536 CLEANCPPFLAGS="$CPPFLAGS"
2537
2538 LDFLAGS="$addld $LDFLAGS"
2539 LIBS="$addlib $LIBS"
2540 if test "$addcflags" != "-I/usr/include"; then
2541 CPPFLAGS="$CPPFLAGS $addcflags"
2542 fi
2543
2544 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2545 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002546 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002547 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2548 AC_SUBST(USE_NSS, [1])
2549 USE_NSS="yes"
2550 NSS_ENABLED=1
Alex Deymo486467e2017-12-19 19:04:07 +01002551 ssl_msg="NSS"
2552 test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002553 ],
2554 [
2555 LDFLAGS="$CLEANLDFLAGS"
2556 LIBS="$CLEANLIBS"
2557 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002558 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002559
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002560 if test "x$USE_NSS" = "xyes"; then
2561 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002562
Elliott Hughescac39802018-04-27 16:19:43 -07002563 dnl PK11_CreateManagedGenericObject() was introduced in NSS 3.34 because
2564 dnl PK11_DestroyGenericObject() does not release resources allocated by
2565 dnl PK11_CreateGenericObject() early enough.
2566 AC_CHECK_FUNC(PK11_CreateManagedGenericObject,
2567 [
2568 AC_DEFINE(HAVE_PK11_CREATEMANAGEDGENERICOBJECT, 1,
2569 [if you have the PK11_CreateManagedGenericObject function])
2570 ])
2571
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002572 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2573 NSS_LIBS=$addlib
2574 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002575
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002576 dnl when shared libs were found in a path that the run-time
2577 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002578 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002579 dnl due to this
2580 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002581 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$nssprefix/lib$libsuff"
2582 export CURL_LIBRARY_PATH
2583 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to CURL_LIBRARY_PATH])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002584 fi
2585
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002586 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002587
2588 fi dnl NSS not disabled
2589
Alex Deymo486467e2017-12-19 19:04:07 +01002590 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2591fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002592
Haibo Huang001784b2019-07-19 05:27:28 -07002593case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$MBEDTLS_ENABLED$WOLFSSL_ENABLED$WINSSL_ENABLED$SECURETRANSPORT_ENABLED$MESALINK_ENABLED$AMISSL_ENABLED" in
Alex Deymo486467e2017-12-19 19:04:07 +01002594x)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002595 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Haibo Huang001784b2019-07-19 05:27:28 -07002596 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-wolfssl, --with-mbedtls, --with-nss, --with-schannel, --with-secure-transport, --with-mesalink or --with-amissl to address this.])
Alex Deymo486467e2017-12-19 19:04:07 +01002597 ;;
2598x1)
2599 # one SSL backend is enabled
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002600 AC_SUBST(SSL_ENABLED)
2601 SSL_ENABLED="1"
Alex Deymo486467e2017-12-19 19:04:07 +01002602 AC_MSG_NOTICE([built with one SSL backend])
2603 ;;
2604*)
2605 # more than one SSL backend is enabled
2606 AC_SUBST(SSL_ENABLED)
2607 SSL_ENABLED="1"
2608 AC_SUBST(CURL_WITH_MULTI_SSL)
2609 CURL_WITH_MULTI_SSL="1"
2610 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2611 AC_MSG_NOTICE([built with multiple SSL backends])
2612 ;;
2613esac
2614
2615if test -n "$ssl_backends"; then
2616 curl_ssl_msg="enabled ($ssl_backends)"
2617fi
2618
2619if test no = "$VALID_DEFAULT_SSL_BACKEND"
2620then
2621 if test -n "$SSL_ENABLED"
2622 then
2623 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2624 else
2625 AC_MSG_ERROR([Default SSL backend requires SSL!])
2626 fi
2627elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2628then
2629 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002630fi
2631
2632dnl **********************************************************************
2633dnl Check for the CA bundle
2634dnl **********************************************************************
2635
Haibo Huang445085a2019-09-11 13:33:50 -07002636if test -n "$check_for_ca_bundle"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002637 CURL_CHECK_CA_BUNDLE
2638fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002639
2640dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002641dnl Check for libpsl
2642dnl **********************************************************************
2643
2644AC_ARG_WITH(libpsl,
2645 AS_HELP_STRING([--without-libpsl],
2646 [disable support for libpsl cookie checking]),
2647 with_libpsl=$withval,
2648 with_libpsl=yes)
2649if test $with_libpsl != "no"; then
2650 AC_SEARCH_LIBS(psl_builtin, psl,
Haibo Huang65021c72019-03-27 15:37:23 -07002651 [curl_psl_msg="enabled";
Alex Deymod15eaac2016-06-28 14:49:26 -07002652 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2653 ],
2654 [curl_psl_msg="no (libpsl not found)";
2655 AC_MSG_WARN([libpsl was not found])
2656 ]
2657 )
2658fi
Haibo Huang65021c72019-03-27 15:37:23 -07002659AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "enabled"])
Alex Deymod15eaac2016-06-28 14:49:26 -07002660
2661dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002662dnl Check for libmetalink
2663dnl **********************************************************************
2664
2665OPT_LIBMETALINK=no
2666
2667AC_ARG_WITH(libmetalink,dnl
2668AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2669AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2670 OPT_LIBMETALINK=$withval)
2671
2672if test X"$OPT_LIBMETALINK" != Xno; then
2673
2674 addld=""
2675 addlib=""
2676 addcflags=""
2677 version=""
2678 libmetalinklib=""
2679
2680 PKGTEST="no"
2681 if test "x$OPT_LIBMETALINK" = "xyes"; then
2682 dnl this is with no partiular path given
2683 PKGTEST="yes"
2684 CURL_CHECK_PKGCONFIG(libmetalink)
2685 else
2686 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2687 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2688 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2689 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2690 PKGTEST="yes"
2691 fi
2692 if test "$PKGTEST" = "yes"; then
2693 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2694 fi
2695 fi
2696 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2697 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2698 $PKGCONFIG --libs-only-l libmetalink`
2699 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2700 $PKGCONFIG --libs-only-L libmetalink`
2701 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2702 $PKGCONFIG --cflags-only-I libmetalink`
2703 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2704 $PKGCONFIG --modversion libmetalink`
2705 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2706 fi
2707 if test -n "$addlib"; then
2708
2709 clean_CPPFLAGS="$CPPFLAGS"
2710 clean_LDFLAGS="$LDFLAGS"
2711 clean_LIBS="$LIBS"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002712 CPPFLAGS="$clean_CPPFLAGS $addcflags"
2713 LDFLAGS="$clean_LDFLAGS $addld"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002714 LIBS="$addlib $clean_LIBS"
2715 AC_MSG_CHECKING([if libmetalink is recent enough])
2716 AC_LINK_IFELSE([
2717 AC_LANG_PROGRAM([[
2718# include <metalink/metalink.h>
2719 ]],[[
2720 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2721 return 1;
2722 ]])
2723 ],[
2724 AC_MSG_RESULT([yes ($version)])
2725 want_metalink="yes"
2726 ],[
2727 AC_MSG_RESULT([no ($version)])
2728 AC_MSG_NOTICE([libmetalink library defective or too old])
2729 want_metalink="no"
2730 ])
2731 CPPFLAGS="$clean_CPPFLAGS"
2732 LDFLAGS="$clean_LDFLAGS"
2733 LIBS="$clean_LIBS"
2734 if test "$want_metalink" = "yes"; then
2735 dnl finally libmetalink will be used
2736 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2737 LIBMETALINK_LIBS=$addlib
2738 LIBMETALINK_LDFLAGS=$addld
2739 LIBMETALINK_CPPFLAGS=$addcflags
2740 AC_SUBST([LIBMETALINK_LIBS])
2741 AC_SUBST([LIBMETALINK_LDFLAGS])
2742 AC_SUBST([LIBMETALINK_CPPFLAGS])
2743 curl_mtlnk_msg="enabled"
2744 fi
2745
2746 fi
2747fi
2748
2749dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002750dnl Check for the presence of LIBSSH2 libraries and headers
2751dnl **********************************************************************
2752
2753dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2754OPT_LIBSSH2=off
2755AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002756AC_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])
Elliott Hughes0128fe42018-02-27 14:57:55 -08002757AC_HELP_STRING([--with-libssh2], [enable LIBSSH2]),
2758 OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
2759
2760
2761OPT_LIBSSH=off
2762AC_ARG_WITH(libssh,dnl
2763AC_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])
2764AC_HELP_STRING([--with-libssh], [enable LIBSSH]),
2765 OPT_LIBSSH=$withval, OPT_LIBSSH=no)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002766
2767if test X"$OPT_LIBSSH2" != Xno; then
2768 dnl backup the pre-libssh2 variables
2769 CLEANLDFLAGS="$LDFLAGS"
2770 CLEANCPPFLAGS="$CPPFLAGS"
2771 CLEANLIBS="$LIBS"
2772
2773 case "$OPT_LIBSSH2" in
2774 yes)
2775 dnl --with-libssh2 (without path) used
2776 CURL_CHECK_PKGCONFIG(libssh2)
2777
2778 if test "$PKGCONFIG" != "no" ; then
Elliott Hughes72d948d2018-08-03 14:37:21 -07002779 LIB_SSH2=`$PKGCONFIG --libs libssh2`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002780 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2781 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2782 version=`$PKGCONFIG --modversion libssh2`
2783 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2784 fi
2785
2786 ;;
2787 off)
2788 dnl no --with-libssh2 option given, just check default places
2789 ;;
2790 *)
2791 dnl use the given --with-libssh2 spot
2792 PREFIX_SSH2=$OPT_LIBSSH2
2793 ;;
2794 esac
2795
2796 dnl if given with a prefix, we set -L and -I based on that
2797 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002798 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002799 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2800 CPP_SSH2=-I${PREFIX_SSH2}/include
2801 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2802 fi
2803
Elliott Hughes82be86d2017-09-20 17:00:17 -07002804 LDFLAGS="$LDFLAGS $LD_SSH2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002805 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002806 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002807
2808 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2809
2810 AC_CHECK_HEADERS(libssh2.h,
2811 curl_ssh_msg="enabled (libSSH2)"
2812 LIBSSH2_ENABLED=1
2813 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2814 AC_SUBST(USE_LIBSSH2, [1])
2815 )
2816
2817 if test X"$OPT_LIBSSH2" != Xoff &&
2818 test "$LIBSSH2_ENABLED" != "1"; then
2819 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2820 fi
2821
2822 if test "$LIBSSH2_ENABLED" = "1"; then
2823 if test -n "$DIR_SSH2"; then
2824 dnl when the libssh2 shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002825 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002826 dnl to prevent further configure tests to fail due to this
2827
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002828 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002829 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2"
2830 export CURL_LIBRARY_PATH
2831 AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002832 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002833 fi
2834 else
2835 dnl no libssh2, revert back to clean variables
2836 LDFLAGS=$CLEANLDFLAGS
2837 CPPFLAGS=$CLEANCPPFLAGS
2838 LIBS=$CLEANLIBS
2839 fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08002840elif test X"$OPT_LIBSSH" != Xno; then
2841 dnl backup the pre-libssh variables
2842 CLEANLDFLAGS="$LDFLAGS"
2843 CLEANCPPFLAGS="$CPPFLAGS"
2844 CLEANLIBS="$LIBS"
2845
2846 case "$OPT_LIBSSH" in
2847 yes)
2848 dnl --with-libssh (without path) used
2849 CURL_CHECK_PKGCONFIG(libssh)
2850
2851 if test "$PKGCONFIG" != "no" ; then
2852 LIB_SSH=`$PKGCONFIG --libs-only-l libssh`
2853 LD_SSH=`$PKGCONFIG --libs-only-L libssh`
2854 CPP_SSH=`$PKGCONFIG --cflags-only-I libssh`
2855 version=`$PKGCONFIG --modversion libssh`
2856 DIR_SSH=`echo $LD_SSH | $SED -e 's/-L//'`
2857 fi
2858
2859 ;;
2860 off)
2861 dnl no --with-libssh option given, just check default places
2862 ;;
2863 *)
2864 dnl use the given --with-libssh spot
2865 PREFIX_SSH=$OPT_LIBSSH
2866 ;;
2867 esac
2868
2869 dnl if given with a prefix, we set -L and -I based on that
2870 if test -n "$PREFIX_SSH"; then
2871 LIB_SSH="-lssh"
2872 LD_SSH=-L${PREFIX_SSH}/lib$libsuff
2873 CPP_SSH=-I${PREFIX_SSH}/include
2874 DIR_SSH=${PREFIX_SSH}/lib$libsuff
2875 fi
2876
2877 LDFLAGS="$LDFLAGS $LD_SSH"
2878 CPPFLAGS="$CPPFLAGS $CPP_SSH"
2879 LIBS="$LIB_SSH $LIBS"
2880
2881 AC_CHECK_LIB(ssh, ssh_new)
2882
2883 AC_CHECK_HEADERS(libssh/libssh.h,
2884 curl_ssh_msg="enabled (libSSH)"
2885 LIBSSH_ENABLED=1
2886 AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use])
2887 AC_SUBST(USE_LIBSSH, [1])
2888 )
2889
2890 if test X"$OPT_LIBSSH" != Xoff &&
2891 test "$LIBSSH_ENABLED" != "1"; then
2892 AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!])
2893 fi
2894
2895 if test "$LIBSSH_ENABLED" = "1"; then
2896 if test -n "$DIR_SSH"; then
2897 dnl when the libssh shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002898 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Elliott Hughes0128fe42018-02-27 14:57:55 -08002899 dnl to prevent further configure tests to fail due to this
2900
2901 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002902 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH"
2903 export CURL_LIBRARY_PATH
2904 AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH])
Elliott Hughes0128fe42018-02-27 14:57:55 -08002905 fi
2906 fi
2907 else
2908 dnl no libssh, revert back to clean variables
2909 LDFLAGS=$CLEANLDFLAGS
2910 CPPFLAGS=$CLEANCPPFLAGS
2911 LIBS=$CLEANLIBS
2912 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002913fi
2914
2915dnl **********************************************************************
2916dnl Check for the presence of LIBRTMP libraries and headers
2917dnl **********************************************************************
2918
2919dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2920OPT_LIBRTMP=off
2921AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002922AC_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])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002923AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2924 OPT_LIBRTMP=$withval)
2925
2926if test X"$OPT_LIBRTMP" != Xno; then
2927 dnl backup the pre-librtmp variables
2928 CLEANLDFLAGS="$LDFLAGS"
2929 CLEANCPPFLAGS="$CPPFLAGS"
2930 CLEANLIBS="$LIBS"
2931
2932 case "$OPT_LIBRTMP" in
2933 yes)
2934 dnl --with-librtmp (without path) used
2935 CURL_CHECK_PKGCONFIG(librtmp)
2936
2937 if test "$PKGCONFIG" != "no" ; then
2938 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2939 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2940 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2941 version=`$PKGCONFIG --modversion librtmp`
2942 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002943 else
2944 dnl To avoid link errors, we do not allow --librtmp without
2945 dnl a pkgconfig file
2946 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002947 fi
2948
2949 ;;
2950 off)
2951 dnl no --with-librtmp option given, just check default places
2952 LIB_RTMP="-lrtmp"
2953 ;;
2954 *)
2955 dnl use the given --with-librtmp spot
Elliott Hughes82be86d2017-09-20 17:00:17 -07002956 LIB_RTMP="-lrtmp"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002957 PREFIX_RTMP=$OPT_LIBRTMP
2958 ;;
2959 esac
2960
2961 dnl if given with a prefix, we set -L and -I based on that
2962 if test -n "$PREFIX_RTMP"; then
2963 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2964 CPP_RTMP=-I${PREFIX_RTMP}/include
2965 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2966 fi
2967
2968 LDFLAGS="$LDFLAGS $LD_RTMP"
2969 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002970 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002971
2972 AC_CHECK_LIB(rtmp, RTMP_Init,
2973 [
2974 AC_CHECK_HEADERS(librtmp/rtmp.h,
2975 curl_rtmp_msg="enabled (librtmp)"
2976 LIBRTMP_ENABLED=1
2977 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2978 AC_SUBST(USE_LIBRTMP, [1])
2979 )
2980 ],
2981 dnl not found, revert back to clean variables
2982 LDFLAGS=$CLEANLDFLAGS
2983 CPPFLAGS=$CLEANCPPFLAGS
2984 LIBS=$CLEANLIBS
2985 )
2986
2987 if test X"$OPT_LIBRTMP" != Xoff &&
2988 test "$LIBRTMP_ENABLED" != "1"; then
2989 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2990 fi
2991
2992fi
2993
2994dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002995dnl Check for linker switch for versioned symbols
2996dnl **********************************************************************
2997
2998versioned_symbols_flavour=
2999AC_MSG_CHECKING([whether versioned symbols are wanted])
3000AC_ARG_ENABLE(versioned-symbols,
3001AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
3002AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
3003[ case "$enableval" in
3004 yes) AC_MSG_RESULT(yes)
3005 AC_MSG_CHECKING([if libraries can be versioned])
3006 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
3007 if test -z "$GLD"; then
3008 AC_MSG_RESULT(no)
3009 AC_MSG_WARN([You need an ld version supporting the --version-script option])
3010 else
3011 AC_MSG_RESULT(yes)
Alex Deymo486467e2017-12-19 19:04:07 +01003012 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3013 versioned_symbols_flavour="MULTISSL_"
3014 elif test "x$OPENSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003015 versioned_symbols_flavour="OPENSSL_"
3016 elif test "x$GNUTLS_ENABLED" = "x1"; then
3017 versioned_symbols_flavour="GNUTLS_"
3018 elif test "x$NSS_ENABLED" = "x1"; then
3019 versioned_symbols_flavour="NSS_"
Haibo Huang001784b2019-07-19 05:27:28 -07003020 elif test "x$WOLFSSL_ENABLED" = "x1"; then
3021 versioned_symbols_flavour="WOLFSSL_"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003022 elif test "x$WINSSL_ENABLED" = "x1"; then
Haibo Huang65021c72019-03-27 15:37:23 -07003023 versioned_symbols_flavour="SCHANNEL_"
3024 elif test "x$SECURETRANSPORT_ENABLED" = "x1"; then
3025 versioned_symbols_flavour="SECURE_TRANSPORT_"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003026 else
3027 versioned_symbols_flavour=""
3028 fi
3029 versioned_symbols="yes"
3030 fi
3031 ;;
3032
3033 *) AC_MSG_RESULT(no)
3034 ;;
3035 esac
3036], [
3037AC_MSG_RESULT(no)
3038]
3039)
3040
3041AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
3042 ["$versioned_symbols_flavour"])
3043AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
3044 [test "x$versioned_symbols" = 'xyes'])
3045
3046dnl -------------------------------------------------
3047dnl check winidn option before other IDN libraries
3048dnl -------------------------------------------------
3049
3050AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
3051OPT_WINIDN="default"
3052AC_ARG_WITH(winidn,
3053AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
3054AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
3055 OPT_WINIDN=$withval)
3056case "$OPT_WINIDN" in
3057 no|default)
3058 dnl --without-winidn option used or configure option not specified
3059 want_winidn="no"
3060 AC_MSG_RESULT([no])
3061 ;;
3062 yes)
3063 dnl --with-winidn option used without path
3064 want_winidn="yes"
3065 want_winidn_path="default"
3066 AC_MSG_RESULT([yes])
3067 ;;
3068 *)
3069 dnl --with-winidn option used with path
3070 want_winidn="yes"
3071 want_winidn_path="$withval"
3072 AC_MSG_RESULT([yes ($withval)])
3073 ;;
3074esac
3075
3076if test "$want_winidn" = "yes"; then
3077 dnl winidn library support has been requested
3078 clean_CPPFLAGS="$CPPFLAGS"
3079 clean_LDFLAGS="$LDFLAGS"
3080 clean_LIBS="$LIBS"
3081 WINIDN_LIBS="-lnormaliz"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003082 WINIDN_CPPFLAGS="-DWINVER=0x0600"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003083 #
3084 if test "$want_winidn_path" != "default"; then
3085 dnl path has been specified
3086 dnl pkg-config not available or provides no info
3087 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
3088 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
3089 WINIDN_DIR="$want_winidn_path/lib$libsuff"
3090 fi
3091 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003092 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
3093 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003094 LIBS="$WINIDN_LIBS $LIBS"
3095 #
3096 AC_MSG_CHECKING([if IdnToUnicode can be linked])
3097 AC_LINK_IFELSE([
Elliott Hughes82be86d2017-09-20 17:00:17 -07003098 AC_LANG_PROGRAM([[
3099 #include <windows.h>
3100 ]],[[
3101 IdnToUnicode(0, NULL, 0, NULL, 0);
3102 ]])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003103 ],[
3104 AC_MSG_RESULT([yes])
3105 tst_links_winidn="yes"
3106 ],[
3107 AC_MSG_RESULT([no])
3108 tst_links_winidn="no"
3109 ])
3110 #
3111 if test "$tst_links_winidn" = "yes"; then
3112 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
3113 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
3114 AC_SUBST([IDN_ENABLED], [1])
3115 curl_idn_msg="enabled (Windows-native)"
3116 else
3117 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3118 CPPFLAGS="$clean_CPPFLAGS"
3119 LDFLAGS="$clean_LDFLAGS"
3120 LIBS="$clean_LIBS"
3121 fi
3122fi
3123
3124dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003125dnl Check for the presence of IDN libraries and headers
3126dnl **********************************************************************
3127
Elliott Hughescee03382017-06-23 12:17:18 -07003128AC_MSG_CHECKING([whether to build with libidn2])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003129OPT_IDN="default"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003130AC_ARG_WITH(libidn2,
Elliott Hughescee03382017-06-23 12:17:18 -07003131AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
3132AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003133 [OPT_IDN=$withval])
3134case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003135 no)
Elliott Hughescee03382017-06-23 12:17:18 -07003136 dnl --without-libidn2 option used
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003137 want_idn="no"
3138 AC_MSG_RESULT([no])
3139 ;;
3140 default)
3141 dnl configure option not specified
3142 want_idn="yes"
3143 want_idn_path="default"
3144 AC_MSG_RESULT([(assumed) yes])
3145 ;;
3146 yes)
Elliott Hughescee03382017-06-23 12:17:18 -07003147 dnl --with-libidn2 option used without path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003148 want_idn="yes"
3149 want_idn_path="default"
3150 AC_MSG_RESULT([yes])
3151 ;;
3152 *)
Elliott Hughescee03382017-06-23 12:17:18 -07003153 dnl --with-libidn2 option used with path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003154 want_idn="yes"
3155 want_idn_path="$withval"
3156 AC_MSG_RESULT([yes ($withval)])
3157 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003158esac
3159
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003160if test "$want_idn" = "yes"; then
3161 dnl idn library support has been requested
3162 clean_CPPFLAGS="$CPPFLAGS"
3163 clean_LDFLAGS="$LDFLAGS"
3164 clean_LIBS="$LIBS"
3165 PKGCONFIG="no"
3166 #
3167 if test "$want_idn_path" != "default"; then
3168 dnl path has been specified
3169 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
Elliott Hughescee03382017-06-23 12:17:18 -07003170 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003171 if test "$PKGCONFIG" != "no"; then
3172 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003173 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003174 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003175 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003176 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003177 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003178 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3179 else
3180 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003181 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003182 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3183 IDN_CPPFLAGS="-I$want_idn_path/include"
3184 IDN_DIR="$want_idn_path/lib$libsuff"
3185 fi
3186 else
3187 dnl path not specified
Elliott Hughescee03382017-06-23 12:17:18 -07003188 CURL_CHECK_PKGCONFIG(libidn2)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003189 if test "$PKGCONFIG" != "no"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003190 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3191 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3192 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003193 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3194 else
3195 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003196 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003197 fi
3198 fi
3199 #
3200 if test "$PKGCONFIG" != "no"; then
3201 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3202 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3203 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3204 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3205 else
3206 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3207 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3208 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3209 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3210 fi
3211 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003212 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3213 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003214 LIBS="$IDN_LIBS $LIBS"
3215 #
Elliott Hughescee03382017-06-23 12:17:18 -07003216 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003217 AC_LINK_IFELSE([
Elliott Hughescee03382017-06-23 12:17:18 -07003218 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003219 ],[
3220 AC_MSG_RESULT([yes])
3221 tst_links_libidn="yes"
3222 ],[
3223 AC_MSG_RESULT([no])
3224 tst_links_libidn="no"
3225 ])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003226 #
Elliott Hughescee03382017-06-23 12:17:18 -07003227 AC_CHECK_HEADERS( idn2.h )
3228
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003229 if test "$tst_links_libidn" = "yes"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003230 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003231 dnl different versions of libidn have different setups of these:
Elliott Hughescee03382017-06-23 12:17:18 -07003232
3233 AC_SUBST([IDN_ENABLED], [1])
3234 curl_idn_msg="enabled (libidn2)"
3235 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003236 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR"
3237 export CURL_LIBRARY_PATH
3238 AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003239 fi
3240 else
3241 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3242 CPPFLAGS="$clean_CPPFLAGS"
3243 LDFLAGS="$clean_LDFLAGS"
3244 LIBS="$clean_LIBS"
3245 fi
3246fi
3247
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003248
3249dnl Let's hope this split URL remains working:
Elliott Hughesa93fb052018-12-12 14:22:48 -08003250dnl https://www15.software.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003251dnl genprogc/thread_quick_ref.htm
3252
3253
3254dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003255dnl Check for nghttp2
3256dnl **********************************************************************
3257
3258OPT_H2="yes"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003259
3260if test "x$disable_http" = "xyes"; then
3261 # without HTTP, nghttp2 is no use
3262 OPT_H2="no"
3263fi
3264
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003265AC_ARG_WITH(nghttp2,
3266AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3267AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3268 [OPT_H2=$withval])
3269case "$OPT_H2" in
3270 no)
3271 dnl --without-nghttp2 option used
3272 want_h2="no"
3273 ;;
3274 yes)
3275 dnl --with-nghttp2 option used without path
3276 want_h2="default"
3277 want_h2_path=""
3278 ;;
3279 *)
3280 dnl --with-nghttp2 option used with path
3281 want_h2="yes"
3282 want_h2_path="$withval/lib/pkgconfig"
3283 ;;
3284esac
3285
3286curl_h2_msg="disabled (--with-nghttp2)"
3287if test X"$want_h2" != Xno; then
3288 dnl backup the pre-nghttp2 variables
3289 CLEANLDFLAGS="$LDFLAGS"
3290 CLEANCPPFLAGS="$CPPFLAGS"
3291 CLEANLIBS="$LIBS"
3292
3293 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3294
3295 if test "$PKGCONFIG" != "no" ; then
3296 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3297 $PKGCONFIG --libs-only-l libnghttp2`
3298 AC_MSG_NOTICE([-l is $LIB_H2])
3299
3300 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3301 $PKGCONFIG --cflags-only-I libnghttp2`
3302 AC_MSG_NOTICE([-I is $CPP_H2])
3303
3304 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3305 $PKGCONFIG --libs-only-L libnghttp2`
3306 AC_MSG_NOTICE([-L is $LD_H2])
3307
3308 LDFLAGS="$LDFLAGS $LD_H2"
3309 CPPFLAGS="$CPPFLAGS $CPP_H2"
3310 LIBS="$LIB_H2 $LIBS"
3311
3312 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3313 # >= 1.0.0
3314 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3315 [
3316 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3317 curl_h2_msg="enabled (nghttp2)"
3318 NGHTTP2_ENABLED=1
3319 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3320 AC_SUBST(USE_NGHTTP2, [1])
3321 )
3322 ],
3323 dnl not found, revert back to clean variables
3324 LDFLAGS=$CLEANLDFLAGS
3325 CPPFLAGS=$CLEANCPPFLAGS
3326 LIBS=$CLEANLIBS
3327 )
3328
3329 else
3330 dnl no nghttp2 pkg-config found, deal with it
3331 if test X"$want_h2" != Xdefault; then
3332 dnl To avoid link errors, we do not allow --with-nghttp2 without
3333 dnl a pkgconfig file
3334 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3335 fi
3336 fi
3337
3338fi
3339
3340dnl **********************************************************************
Haibo Huang445085a2019-09-11 13:33:50 -07003341dnl Check for ngtcp2 (QUIC)
3342dnl **********************************************************************
3343
3344OPT_TCP2="yes"
3345curl_h3_msg="disabled (--with-ngtcp2, --with-quiche)"
3346
3347if test "x$disable_http" = "xyes"; then
3348 # without HTTP, ngtcp2 is no use
3349 OPT_TCP2="no"
3350fi
3351
3352AC_ARG_WITH(ngtcp2,
3353AC_HELP_STRING([--with-ngtcp2=PATH],[Enable ngtcp2 usage])
3354AC_HELP_STRING([--without-ngtcp2],[Disable ngtcp2 usage]),
3355 [OPT_TCP2=$withval])
3356case "$OPT_TCP2" in
3357 no)
3358 dnl --without-ngtcp2 option used
3359 want_tcp2="no"
3360 ;;
3361 yes)
3362 dnl --with-ngtcp2 option used without path
3363 want_tcp2="default"
3364 want_tcp2_path=""
3365 ;;
3366 *)
3367 dnl --with-ngtcp2 option used with path
3368 want_tcp2="yes"
3369 want_tcp2_path="$withval/lib/pkgconfig"
3370 ;;
3371esac
3372
3373curl_tcp2_msg="disabled (--with-ngtcp2)"
3374if test X"$want_tcp2" != Xno; then
3375 dnl backup the pre-ngtcp2 variables
3376 CLEANLDFLAGS="$LDFLAGS"
3377 CLEANCPPFLAGS="$CPPFLAGS"
3378 CLEANLIBS="$LIBS"
3379
3380 CURL_CHECK_PKGCONFIG(libngtcp2, $want_tcp2_path)
3381
3382 if test "$PKGCONFIG" != "no" ; then
3383 LIB_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path])
3384 $PKGCONFIG --libs-only-l libngtcp2`
3385 AC_MSG_NOTICE([-l is $LIB_TCP2])
3386
3387 CPP_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
3388 $PKGCONFIG --cflags-only-I libngtcp2`
3389 AC_MSG_NOTICE([-I is $CPP_TCP2])
3390
3391 LD_TCP2=`CURL_EXPORT_PCDIR([$want_tcp2_path])
3392 $PKGCONFIG --libs-only-L libngtcp2`
3393 AC_MSG_NOTICE([-L is $LD_TCP2])
3394
3395 LDFLAGS="$LDFLAGS $LD_TCP2"
3396 CPPFLAGS="$CPPFLAGS $CPP_TCP2"
3397 LIBS="$LIB_TCP2 $LIBS"
3398
3399 if test "x$cross_compiling" != "xyes"; then
3400 DIR_TCP2=`echo $LD_TCP2 | $SED -e 's/-L//'`
3401 fi
3402 AC_CHECK_LIB(ngtcp2, ngtcp2_conn_client_new,
3403 [
3404 AC_CHECK_HEADERS(ngtcp2/ngtcp2.h,
3405 NGTCP2_ENABLED=1
3406 AC_DEFINE(USE_NGTCP2, 1, [if ngtcp2 is in use])
3407 AC_SUBST(USE_NGTCP2, [1])
3408 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_TCP2"
3409 export CURL_LIBRARY_PATH
3410 AC_MSG_NOTICE([Added $DIR_TCP2 to CURL_LIBRARY_PATH])
3411 )
3412 ],
3413 dnl not found, revert back to clean variables
3414 LDFLAGS=$CLEANLDFLAGS
3415 CPPFLAGS=$CLEANCPPFLAGS
3416 LIBS=$CLEANLIBS
3417 )
3418
3419 else
3420 dnl no ngtcp2 pkg-config found, deal with it
3421 if test X"$want_tcp2" != Xdefault; then
3422 dnl To avoid link errors, we do not allow --with-ngtcp2 without
3423 dnl a pkgconfig file
3424 AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2 pkg-config file.])
3425 fi
3426 fi
3427
3428fi
3429
3430if test "x$NGTCP2_ENABLED" = "x1"; then
3431 dnl backup the pre-ngtcp2_crypto_openssl variables
3432 CLEANLDFLAGS="$LDFLAGS"
3433 CLEANCPPFLAGS="$CPPFLAGS"
3434 CLEANLIBS="$LIBS"
3435
3436 CURL_CHECK_PKGCONFIG(libngtcp2_crypto_openssl, $want_tcp2_path)
3437
3438 if test "$PKGCONFIG" != "no" ; then
3439 LIB_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
3440 $PKGCONFIG --libs-only-l libngtcp2_crypto_openssl`
3441 AC_MSG_NOTICE([-l is $LIB_NGTCP2_CRYPTO_OPENSSL])
3442
3443 CPP_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path]) dnl
3444 $PKGCONFIG --cflags-only-I libngtcp2_crypto_openssl`
3445 AC_MSG_NOTICE([-I is $CPP_NGTCP2_CRYPTO_OPENSSL])
3446
3447 LD_NGTCP2_CRYPTO_OPENSSL=`CURL_EXPORT_PCDIR([$want_tcp2_path])
3448 $PKGCONFIG --libs-only-L libngtcp2_crypto_openssl`
3449 AC_MSG_NOTICE([-L is $LD_NGTCP2_CRYPTO_OPENSSL])
3450
3451 LDFLAGS="$LDFLAGS $LD_NGTCP2_CRYPTO_OPENSSL"
3452 CPPFLAGS="$CPPFLAGS $CPP_NGTCP2_CRYPTO_OPENSSL"
3453 LIBS="$LIB_NGTCP2_CRYPTO_OPENSSL $LIBS"
3454
3455 if test "x$cross_compiling" != "xyes"; then
3456 DIR_NGTCP2_CRYPTO_OPENSSL=`echo $LD_NGTCP2_CRYPTO_OPENSSL | $SED -e 's/-L//'`
3457 fi
3458 AC_CHECK_LIB(ngtcp2_crypto_openssl, ngtcp2_crypto_ctx_initial,
3459 [
3460 AC_CHECK_HEADERS(ngtcp2/ngtcp2_crypto.h,
3461 NGTCP2_ENABLED=1
3462 AC_DEFINE(USE_NGTCP2_CRYPTO_OPENSSL, 1, [if ngtcp2_crypto_openssl is in use])
3463 AC_SUBST(USE_NGTCP2_CRYPTO_OPENSSL, [1])
3464 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGTCP2_CRYPTO_OPENSSL"
3465 export CURL_LIBRARY_PATH
3466 AC_MSG_NOTICE([Added $DIR_NGTCP2_CRYPTO_OPENSSL to CURL_LIBRARY_PATH])
3467 )
3468 ],
3469 dnl not found, revert back to clean variables
3470 LDFLAGS=$CLEANLDFLAGS
3471 CPPFLAGS=$CLEANCPPFLAGS
3472 LIBS=$CLEANLIBS
3473 )
3474
3475 else
3476 dnl no ngtcp2_crypto_openssl pkg-config found, deal with it
3477 if test X"$want_tcp2" != Xdefault; then
3478 dnl To avoid link errors, we do not allow --with-ngtcp2 without
3479 dnl a pkgconfig file
3480 AC_MSG_ERROR([--with-ngtcp2 was specified but could not find ngtcp2_crypto_openssl pkg-config file.])
3481 fi
3482 fi
3483fi
3484
3485dnl **********************************************************************
3486dnl Check for nghttp3 (HTTP/3 with ngtcp2)
3487dnl **********************************************************************
3488
3489OPT_NGHTTP3="yes"
3490
3491if test "x$NGTCP2_ENABLED" = "x"; then
3492 # without ngtcp2, nghttp3 is of no use for us
3493 OPT_NGHTTP3="no"
3494fi
3495
3496AC_ARG_WITH(nghttp3,
3497AC_HELP_STRING([--with-nghttp3=PATH],[Enable nghttp3 usage])
3498AC_HELP_STRING([--without-nghttp3],[Disable nghttp3 usage]),
3499 [OPT_NGHTTP3=$withval])
3500case "$OPT_NGHTTP3" in
3501 no)
3502 dnl --without-nghttp3 option used
3503 want_nghttp3="no"
3504 ;;
3505 yes)
3506 dnl --with-nghttp3 option used without path
3507 want_nghttp3="default"
3508 want_nghttp3_path=""
3509 ;;
3510 *)
3511 dnl --with-nghttp3 option used with path
3512 want_nghttp3="yes"
3513 want_nghttp3_path="$withval/lib/pkgconfig"
3514 ;;
3515esac
3516
3517curl_http3_msg="disabled (--with-nghttp3)"
3518if test X"$want_nghttp3" != Xno; then
3519 dnl backup the pre-nghttp3 variables
3520 CLEANLDFLAGS="$LDFLAGS"
3521 CLEANCPPFLAGS="$CPPFLAGS"
3522 CLEANLIBS="$LIBS"
3523
3524 CURL_CHECK_PKGCONFIG(libnghttp3, $want_nghttp3_path)
3525
3526 if test "$PKGCONFIG" != "no" ; then
3527 LIB_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
3528 $PKGCONFIG --libs-only-l libnghttp3`
3529 AC_MSG_NOTICE([-l is $LIB_NGHTTP3])
3530
3531 CPP_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) dnl
3532 $PKGCONFIG --cflags-only-I libnghttp3`
3533 AC_MSG_NOTICE([-I is $CPP_NGHTTP3])
3534
3535 LD_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path])
3536 $PKGCONFIG --libs-only-L libnghttp3`
3537 AC_MSG_NOTICE([-L is $LD_NGHTTP3])
3538
3539 LDFLAGS="$LDFLAGS $LD_NGHTTP3"
3540 CPPFLAGS="$CPPFLAGS $CPP_NGHTTP3"
3541 LIBS="$LIB_NGHTTP3 $LIBS"
3542
3543 if test "x$cross_compiling" != "xyes"; then
3544 DIR_NGHTTP3=`echo $LD_NGHTTP3 | $SED -e 's/-L//'`
3545 fi
3546 AC_CHECK_LIB(nghttp3, nghttp3_conn_client_new,
3547 [
3548 AC_CHECK_HEADERS(nghttp3/nghttp3.h,
3549 curl_h3_msg="enabled (ngtcp2 + nghttp3)"
3550 NGHTTP3_ENABLED=1
3551 AC_DEFINE(USE_NGHTTP3, 1, [if nghttp3 is in use])
3552 AC_SUBST(USE_NGHTTP3, [1])
3553 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGHTTP3"
3554 export CURL_LIBRARY_PATH
3555 AC_MSG_NOTICE([Added $DIR_NGHTTP3 to CURL_LIBRARY_PATH])
3556 experimental="$experimental HTTP3"
3557 )
3558 ],
3559 dnl not found, revert back to clean variables
3560 LDFLAGS=$CLEANLDFLAGS
3561 CPPFLAGS=$CLEANCPPFLAGS
3562 LIBS=$CLEANLIBS
3563 )
3564
3565 else
3566 dnl no nghttp3 pkg-config found, deal with it
3567 if test X"$want_nghttp3" != Xdefault; then
3568 dnl To avoid link errors, we do not allow --with-nghttp3 without
3569 dnl a pkgconfig file
3570 AC_MSG_ERROR([--with-nghttp3 was specified but could not find nghttp3 pkg-config file.])
3571 fi
3572 fi
3573
3574fi
3575
3576dnl **********************************************************************
3577dnl Check for quiche (QUIC)
3578dnl **********************************************************************
3579
3580OPT_QUICHE="yes"
3581
3582if test "x$disable_http" = "xyes" -o "x$USE_NGTCP" = "x1"; then
3583 # without HTTP or with ngtcp2, quiche is no use
3584 OPT_QUICHE="no"
3585fi
3586
3587AC_ARG_WITH(quiche,
3588AC_HELP_STRING([--with-quiche=PATH],[Enable quiche usage])
3589AC_HELP_STRING([--without-quiche],[Disable quiche usage]),
3590 [OPT_QUICHE=$withval])
3591case "$OPT_QUICHE" in
3592 no)
3593 dnl --without-quiche option used
3594 want_quiche="no"
3595 ;;
3596 yes)
3597 dnl --with-quiche option used without path
3598 want_quiche="default"
3599 want_quiche_path=""
3600 ;;
3601 *)
3602 dnl --with-quiche option used with path
3603 want_quiche="yes"
3604 want_quiche_path="$withval"
3605 ;;
3606esac
3607
3608if test X"$want_quiche" != Xno; then
3609 dnl backup the pre-quiche variables
3610 CLEANLDFLAGS="$LDFLAGS"
3611 CLEANCPPFLAGS="$CPPFLAGS"
3612 CLEANLIBS="$LIBS"
3613
3614 CURL_CHECK_PKGCONFIG(quiche, $want_quiche_path)
3615
3616 if test "$PKGCONFIG" != "no" ; then
3617 LIB_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
3618 $PKGCONFIG --libs-only-l quiche`
3619 AC_MSG_NOTICE([-l is $LIB_QUICHE])
3620
3621 CPP_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path]) dnl
3622 $PKGCONFIG --cflags-only-I quiche`
3623 AC_MSG_NOTICE([-I is $CPP_QUICHE])
3624
3625 LD_QUICHE=`CURL_EXPORT_PCDIR([$want_quiche_path])
3626 $PKGCONFIG --libs-only-L quiche`
3627 AC_MSG_NOTICE([-L is $LD_QUICHE])
3628
3629 LDFLAGS="$LDFLAGS $LD_QUICHE"
3630 CPPFLAGS="$CPPFLAGS $CPP_QUICHE"
3631 LIBS="$LIB_QUICHE $LIBS"
3632
3633 if test "x$cross_compiling" != "xyes"; then
3634 DIR_QUICHE=`echo $LD_QUICHE | $SED -e 's/-L//'`
3635 fi
3636 AC_CHECK_LIB(quiche, quiche_connect,
3637 [
3638 AC_CHECK_HEADERS(quiche.h,
3639 experimental="$experimental HTTP3"
3640 AC_MSG_NOTICE([HTTP3 support is experimental])
3641 curl_h3_msg="enabled (quiche)"
3642 QUICHE_ENABLED=1
3643 AC_DEFINE(USE_QUICHE, 1, [if quiche is in use])
3644 AC_SUBST(USE_QUICHE, [1])
3645 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_QUICHE"
3646 export CURL_LIBRARY_PATH
3647 AC_MSG_NOTICE([Added $DIR_QUICHE to CURL_LIBRARY_PATH]),
3648 )
3649 ],
3650 dnl not found, revert back to clean variables
3651 LDFLAGS=$CLEANLDFLAGS
3652 CPPFLAGS=$CLEANCPPFLAGS
3653 LIBS=$CLEANLIBS
3654 )
3655 else
3656 dnl no nghttp3 pkg-config found, deal with it
3657 if test X"$want_quiche" != Xdefault; then
3658 dnl To avoid link errors, we do not allow --with-nghttp3 without
3659 dnl a pkgconfig file
3660 AC_MSG_ERROR([--with-quiche was specified but could not find quiche pkg-config file.])
3661 fi
3662 fi
3663fi
3664
3665dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07003666dnl Check for zsh completion path
3667dnl **********************************************************************
3668
3669OPT_ZSH_FPATH=default
3670AC_ARG_WITH(zsh-functions-dir,
3671AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3672AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3673 [OPT_ZSH_FPATH=$withval])
3674case "$OPT_ZSH_FPATH" in
3675 no)
3676 dnl --without-zsh-functions-dir option used
3677 ;;
3678 default|yes)
3679 dnl --with-zsh-functions-dir option used without path
3680 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3681 AC_SUBST(ZSH_FUNCTIONS_DIR)
3682 ;;
3683 *)
3684 dnl --with-zsh-functions-dir option used with path
3685 ZSH_FUNCTIONS_DIR="$withval"
3686 AC_SUBST(ZSH_FUNCTIONS_DIR)
3687 ;;
3688esac
3689
3690dnl **********************************************************************
Haibo Huang65021c72019-03-27 15:37:23 -07003691dnl Check for fish completion path
3692dnl **********************************************************************
3693
3694OPT_FISH_FPATH=default
3695AC_ARG_WITH(fish-functions-dir,
3696AC_HELP_STRING([--with-fish-functions-dir=PATH],[Install fish completions to PATH])
3697AC_HELP_STRING([--without-fish-functions-dir],[Do not install fish completions]),
3698 [OPT_FISH_FPATH=$withval])
3699case "$OPT_FISH_FPATH" in
3700 no)
3701 dnl --without-fish-functions-dir option used
3702 ;;
3703 default|yes)
3704 dnl --with-fish-functions-dir option used without path
Haibo Huang34ab3462019-05-22 00:50:27 -07003705 CURL_CHECK_PKGCONFIG(fish)
3706 if test "$PKGCONFIG" != "no" ; then
3707 FISH_FUNCTIONS_DIR="$($PKGCONFIG --variable completionsdir fish)"
3708 else
3709 FISH_FUNCTIONS_DIR="$datarootdir/fish/vendor_completions.d"
3710 fi
Haibo Huang65021c72019-03-27 15:37:23 -07003711 AC_SUBST(FISH_FUNCTIONS_DIR)
3712 ;;
3713 *)
3714 dnl --with-fish-functions-dir option used with path
3715 FISH_FUNCTIONS_DIR="$withval"
3716 AC_SUBST(FISH_FUNCTIONS_DIR)
3717 ;;
3718esac
3719
3720dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003721dnl Back to "normal" configuring
3722dnl **********************************************************************
3723
3724dnl Checks for header files.
3725AC_HEADER_STDC
3726
3727CURL_CHECK_HEADER_MALLOC
3728CURL_CHECK_HEADER_MEMORY
3729
3730dnl Now check for the very most basic headers. Then we can use these
3731dnl ones as default-headers when checking for the rest!
3732AC_CHECK_HEADERS(
3733 sys/types.h \
3734 sys/time.h \
3735 sys/select.h \
3736 sys/socket.h \
3737 sys/ioctl.h \
3738 sys/uio.h \
3739 assert.h \
3740 unistd.h \
3741 stdlib.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003742 arpa/inet.h \
3743 net/if.h \
3744 netinet/in.h \
Elliott Hughes0128fe42018-02-27 14:57:55 -08003745 netinet/in6.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003746 sys/un.h \
Alex Deymo486467e2017-12-19 19:04:07 +01003747 linux/tcp.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003748 netinet/tcp.h \
3749 netdb.h \
3750 sys/sockio.h \
3751 sys/stat.h \
3752 sys/param.h \
3753 termios.h \
3754 termio.h \
3755 sgtty.h \
3756 fcntl.h \
3757 alloca.h \
3758 time.h \
3759 io.h \
3760 pwd.h \
3761 utime.h \
3762 sys/utime.h \
3763 sys/poll.h \
3764 poll.h \
3765 socket.h \
3766 sys/resource.h \
3767 libgen.h \
3768 locale.h \
3769 errno.h \
3770 stdbool.h \
3771 arpa/tftp.h \
3772 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003773 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003774 setjmp.h,
3775dnl to do if not found
3776[],
3777dnl to do if found
3778[],
3779dnl default includes
3780[
3781#ifdef HAVE_SYS_TYPES_H
3782#include <sys/types.h>
3783#endif
3784#ifdef HAVE_SYS_TIME_H
3785#include <sys/time.h>
3786#endif
3787#ifdef HAVE_SYS_SELECT_H
3788#include <sys/select.h>
3789#endif
3790#ifdef HAVE_SYS_SOCKET_H
3791#include <sys/socket.h>
3792#endif
3793#ifdef HAVE_NETINET_IN_H
3794#include <netinet/in.h>
3795#endif
Elliott Hughes0128fe42018-02-27 14:57:55 -08003796#ifdef HAVE_NETINET_IN6_H
3797#include <netinet/in6.h>
3798#endif
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003799#ifdef HAVE_SYS_UN_H
3800#include <sys/un.h>
3801#endif
3802]
3803)
3804
Haibo Huang65021c72019-03-27 15:37:23 -07003805
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003806dnl Checks for typedefs, structures, and compiler characteristics.
3807AC_C_CONST
3808CURL_CHECK_VARIADIC_MACROS
3809AC_TYPE_SIZE_T
3810AC_HEADER_TIME
3811CURL_CHECK_STRUCT_TIMEVAL
3812CURL_VERIFY_RUNTIMELIBS
3813
Elliott Hughes72d948d2018-08-03 14:37:21 -07003814AX_COMPILE_CHECK_SIZEOF(size_t)
3815AX_COMPILE_CHECK_SIZEOF(long)
3816AX_COMPILE_CHECK_SIZEOF(int)
3817AX_COMPILE_CHECK_SIZEOF(short)
3818AX_COMPILE_CHECK_SIZEOF(time_t)
3819AX_COMPILE_CHECK_SIZEOF(off_t)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003820
Alex Deymo486467e2017-12-19 19:04:07 +01003821o=$CPPFLAGS
3822CPPFLAGS="-I$srcdir/include $CPPFLAGS"
Elliott Hughes72d948d2018-08-03 14:37:21 -07003823AX_COMPILE_CHECK_SIZEOF(curl_off_t, [
Alex Deymo486467e2017-12-19 19:04:07 +01003824#include <curl/system.h>
3825])
3826CPPFLAGS=$o
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003827
3828AC_CHECK_TYPE(long long,
3829 [AC_DEFINE(HAVE_LONGLONG, 1,
3830 [Define to 1 if the compiler supports the 'long long' data type.])]
3831 longlong="yes"
3832)
3833
3834if test "xyes" = "x$longlong"; then
3835 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003836 AC_COMPILE_IFELSE([
3837 AC_LANG_PROGRAM([[
3838 ]],[[
3839 long long val = 1000LL;
3840 ]])
3841 ],[
3842 AC_MSG_RESULT([yes])
3843 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3844 ],[
3845 AC_MSG_RESULT([no])
3846 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003847fi
3848
3849
3850# check for ssize_t
3851AC_CHECK_TYPE(ssize_t, ,
3852 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3853
3854# check for bool type
3855AC_CHECK_TYPE([bool],[
3856 AC_DEFINE(HAVE_BOOL_T, 1,
3857 [Define to 1 if bool is an available type.])
3858], ,[
3859#ifdef HAVE_SYS_TYPES_H
3860#include <sys/types.h>
3861#endif
3862#ifdef HAVE_STDBOOL_H
3863#include <stdbool.h>
3864#endif
3865])
3866
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003867# check for sa_family_t
3868AC_CHECK_TYPE(sa_family_t,
3869 AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
3870 [
3871 # The windows name?
3872 AC_CHECK_TYPE(ADDRESS_FAMILY,
3873 AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
3874 AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
3875 [
3876#ifdef HAVE_SYS_SOCKET_H
3877#include <sys/socket.h>
3878#endif
3879 ])
3880 ],
3881[
3882#ifdef HAVE_SYS_SOCKET_H
3883#include <sys/socket.h>
3884#endif
3885])
3886
Elliott Hughescac39802018-04-27 16:19:43 -07003887AC_MSG_CHECKING([if time_t is unsigned])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003888CURL_RUN_IFELSE(
3889 [
Elliott Hughescac39802018-04-27 16:19:43 -07003890 #include <time.h>
3891 #include <limits.h>
3892 time_t t = -1;
3893 return (t > 0);
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003894 ],[
Elliott Hughescac39802018-04-27 16:19:43 -07003895 AC_MSG_RESULT([yes])
3896 AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
3897],[
3898 AC_MSG_RESULT([no])
3899],[
3900 dnl cross-compiling, most systems are unsigned
3901 AC_MSG_RESULT([no])
3902])
3903
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003904CURL_CONFIGURE_PULL_SYS_POLL
3905
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003906TYPE_IN_ADDR_T
3907
3908TYPE_SOCKADDR_STORAGE
3909
3910TYPE_SIG_ATOMIC_T
3911
3912AC_TYPE_SIGNAL
3913
3914CURL_CHECK_FUNC_SELECT
3915
3916CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003917CURL_CHECK_FUNC_SEND
3918CURL_CHECK_MSG_NOSIGNAL
3919
3920CURL_CHECK_FUNC_ALARM
3921CURL_CHECK_FUNC_BASENAME
3922CURL_CHECK_FUNC_CLOSESOCKET
3923CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3924CURL_CHECK_FUNC_CONNECT
3925CURL_CHECK_FUNC_FCNTL
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003926CURL_CHECK_FUNC_FREEADDRINFO
3927CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003928CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003929CURL_CHECK_FUNC_FTRUNCATE
3930CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003931CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003932CURL_CHECK_FUNC_GETHOSTBYADDR
3933CURL_CHECK_FUNC_GETHOSTBYADDR_R
3934CURL_CHECK_FUNC_GETHOSTBYNAME
3935CURL_CHECK_FUNC_GETHOSTBYNAME_R
3936CURL_CHECK_FUNC_GETHOSTNAME
Haibo Huang34ab3462019-05-22 00:50:27 -07003937CURL_CHECK_FUNC_GETPEERNAME
3938CURL_CHECK_FUNC_GETSOCKNAME
Haibo Huangb6336c12019-06-05 01:34:44 -07003939CURL_CHECK_FUNC_IF_NAMETOINDEX
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003940CURL_CHECK_FUNC_GETIFADDRS
3941CURL_CHECK_FUNC_GETSERVBYPORT_R
3942CURL_CHECK_FUNC_GMTIME_R
3943CURL_CHECK_FUNC_INET_NTOA_R
3944CURL_CHECK_FUNC_INET_NTOP
3945CURL_CHECK_FUNC_INET_PTON
3946CURL_CHECK_FUNC_IOCTL
3947CURL_CHECK_FUNC_IOCTLSOCKET
3948CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3949CURL_CHECK_FUNC_LOCALTIME_R
3950CURL_CHECK_FUNC_MEMRCHR
3951CURL_CHECK_FUNC_POLL
3952CURL_CHECK_FUNC_SETSOCKOPT
3953CURL_CHECK_FUNC_SIGACTION
3954CURL_CHECK_FUNC_SIGINTERRUPT
3955CURL_CHECK_FUNC_SIGNAL
3956CURL_CHECK_FUNC_SIGSETJMP
3957CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003958CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003959CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003960CURL_CHECK_FUNC_STRCMPI
3961CURL_CHECK_FUNC_STRDUP
3962CURL_CHECK_FUNC_STRERROR_R
3963CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003964CURL_CHECK_FUNC_STRNCASECMP
3965CURL_CHECK_FUNC_STRNCMPI
3966CURL_CHECK_FUNC_STRNICMP
3967CURL_CHECK_FUNC_STRSTR
3968CURL_CHECK_FUNC_STRTOK_R
3969CURL_CHECK_FUNC_STRTOLL
3970CURL_CHECK_FUNC_WRITEV
3971
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003972case $host in
3973 *msdosdjgpp)
3974 ac_cv_func_pipe=no
3975 skipcheck_pipe=yes
3976 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3977 ;;
3978esac
3979
Elliott Hughes72d948d2018-08-03 14:37:21 -07003980AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
3981 [[#include <pwd.h>
3982 #include <sys/types.h>]])
3983
3984
3985AC_CHECK_FUNCS([fnmatch \
3986 geteuid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003987 getpass_r \
3988 getppid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003989 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003990 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003991 getrlimit \
3992 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003993 if_nametoindex \
Alex Deymo486467e2017-12-19 19:04:07 +01003994 mach_absolute_time \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003995 pipe \
3996 setlocale \
3997 setmode \
3998 setrlimit \
Haibo Huang445085a2019-09-11 13:33:50 -07003999 usleep \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004000 utime \
4001 utimes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004002],[
4003],[
4004 func="$ac_func"
4005 eval skipcheck=\$skipcheck_$func
4006 if test "x$skipcheck" != "xyes"; then
4007 AC_MSG_CHECKING([deeper for $func])
4008 AC_LINK_IFELSE([
4009 AC_LANG_PROGRAM([[
4010 ]],[[
4011 $func ();
4012 ]])
4013 ],[
4014 AC_MSG_RESULT([yes])
4015 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004016 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004017 [Define to 1 if you have the $func function.])
4018 ],[
4019 AC_MSG_RESULT([but still no])
4020 ])
4021 fi
4022])
4023
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004024if test "$ipv6" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07004025 if test "$curl_cv_func_getaddrinfo" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004026 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
4027 IPV6_ENABLED=1
4028 AC_SUBST(IPV6_ENABLED)
4029 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004030fi
4031
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004032CURL_CHECK_NONBLOCKING_SOCKET
4033
4034dnl ************************************************************
4035dnl nroff tool stuff
4036dnl
4037
4038AC_PATH_PROG( PERL, perl, ,
4039 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
4040AC_SUBST(PERL)
4041
4042AC_PATH_PROGS( NROFF, gnroff nroff, ,
4043 $PATH:/usr/bin/:/usr/local/bin )
4044AC_SUBST(NROFF)
4045
4046if test -n "$NROFF"; then
4047 dnl only check for nroff options if an nroff command was found
4048
4049 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
4050 MANOPT="-man"
4051 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
4052 if test -z "$mancheck"; then
4053 MANOPT="-mandoc"
4054 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
4055 if test -z "$mancheck"; then
4056 MANOPT=""
4057 AC_MSG_RESULT([failed])
4058 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
4059 else
4060 AC_MSG_RESULT([$MANOPT])
4061 fi
4062 else
4063 AC_MSG_RESULT([$MANOPT])
4064 fi
4065 AC_SUBST(MANOPT)
4066fi
4067
4068if test -z "$MANOPT"
4069then
4070 dnl if no nroff tool was found, or no option that could convert man pages
4071 dnl was found, then disable the built-in manual stuff
4072 AC_MSG_WARN([disabling built-in manual])
4073 USE_MANUAL="no";
4074fi
4075
4076dnl *************************************************************************
4077dnl If the manual variable still is set, then we go with providing a built-in
4078dnl manual
4079
4080if test "$USE_MANUAL" = "1"; then
4081 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
4082 curl_manual_msg="enabled"
4083fi
4084
4085dnl set variable for use in automakefile(s)
4086AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
4087
4088CURL_CHECK_LIB_ARES
4089AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
4090
Alex Deymod15eaac2016-06-28 14:49:26 -07004091if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004092 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004093 build_libhostname=yes
4094else
4095 build_libhostname=no
4096fi
4097AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
4098
Elliott Hughes82be86d2017-09-20 17:00:17 -07004099if test "x$want_ares" != xyes; then
4100 CURL_CHECK_OPTION_THREADED_RESOLVER
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004101fi
4102
Elliott Hughes82be86d2017-09-20 17:00:17 -07004103dnl ************************************************************
4104dnl disable POSIX threads
4105dnl
4106AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
4107AC_ARG_ENABLE(pthreads,
4108AC_HELP_STRING([--enable-pthreads],
4109 [Enable POSIX threads (default for threaded resolver)])
4110AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
4111[ case "$enableval" in
4112 no) AC_MSG_RESULT(no)
4113 want_pthreads=no
4114 ;;
4115 *) AC_MSG_RESULT(yes)
4116 want_pthreads=yes
4117 ;;
4118 esac ], [
4119 AC_MSG_RESULT(auto)
4120 want_pthreads=auto
4121 ]
4122)
4123
4124dnl turn off pthreads if rt is disabled
4125if test "$want_pthreads" != "no"; then
4126 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
4127 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
4128 fi
4129 if test "$dontwant_rt" != "no"; then
4130 dnl if --enable-pthreads was explicit then warn it's being ignored
4131 if test "$want_pthreads" = "yes"; then
4132 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
4133 fi
4134 want_pthreads=no
4135 fi
4136fi
4137
4138dnl turn off pthreads if no threaded resolver
4139if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
4140 want_pthreads=no
4141fi
4142
4143dnl detect pthreads
4144if test "$want_pthreads" != "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004145 AC_CHECK_HEADER(pthread.h,
4146 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
4147 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004148
4149 dnl first check for function without lib
4150 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
4151
Elliott Hughesa93fb052018-12-12 14:22:48 -08004152 dnl on HPUX, life is more complicated...
4153 case $host in
4154 *-hp-hpux*)
4155 dnl it doesn't actually work without -lpthread
4156 USE_THREADS_POSIX=""
4157 ;;
4158 *)
4159 ;;
4160 esac
4161
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004162 dnl if it wasn't found without lib, search for it in pthread lib
4163 if test "$USE_THREADS_POSIX" != "1"
4164 then
4165 CFLAGS="$CFLAGS -pthread"
4166 AC_CHECK_LIB(pthread, pthread_create,
4167 [USE_THREADS_POSIX=1],
4168 [ CFLAGS="$save_CFLAGS"])
4169 fi
4170
4171 if test "x$USE_THREADS_POSIX" = "x1"
4172 then
4173 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
4174 curl_res_msg="POSIX threaded"
4175 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004176 ])
4177fi
4178
Elliott Hughes82be86d2017-09-20 17:00:17 -07004179dnl threaded resolver check
4180if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
4181 if test "$want_pthreads" = "yes"; then
4182 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
4183 fi
4184 dnl If native Windows fallback on Win32 threads since no POSIX threads
4185 if test "$curl_cv_native_windows" = "yes"; then
4186 USE_THREADS_WIN32=1
4187 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
4188 curl_res_msg="Win32 threaded"
4189 else
4190 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
4191 fi
4192fi
4193
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004194dnl ************************************************************
4195dnl disable verbose text strings
4196dnl
4197AC_MSG_CHECKING([whether to enable verbose strings])
4198AC_ARG_ENABLE(verbose,
4199AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
4200AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
4201[ case "$enableval" in
4202 no)
4203 AC_MSG_RESULT(no)
4204 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
4205 curl_verbose_msg="no"
4206 ;;
4207 *) AC_MSG_RESULT(yes)
4208 ;;
4209 esac ],
4210 AC_MSG_RESULT(yes)
4211)
4212
4213dnl ************************************************************
4214dnl enable SSPI support
4215dnl
4216AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
4217AC_ARG_ENABLE(sspi,
4218AC_HELP_STRING([--enable-sspi],[Enable SSPI])
4219AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
4220[ case "$enableval" in
4221 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07004222 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004223 AC_MSG_RESULT(yes)
4224 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
4225 AC_SUBST(USE_WINDOWS_SSPI, [1])
4226 curl_sspi_msg="enabled"
4227 else
4228 AC_MSG_RESULT(no)
4229 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
4230 fi
4231 ;;
4232 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004233 if test "x$WINSSL_ENABLED" = "x1"; then
4234 # --with-winssl implies --enable-sspi
4235 AC_MSG_RESULT(yes)
4236 else
4237 AC_MSG_RESULT(no)
4238 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004239 ;;
4240 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004241 if test "x$WINSSL_ENABLED" = "x1"; then
4242 # --with-winssl implies --enable-sspi
4243 AC_MSG_RESULT(yes)
4244 else
4245 AC_MSG_RESULT(no)
4246 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004247)
4248
4249dnl ************************************************************
4250dnl disable cryptographic authentication
4251dnl
4252AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
4253AC_ARG_ENABLE(crypto-auth,
4254AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
4255AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
4256[ case "$enableval" in
4257 no)
4258 AC_MSG_RESULT(no)
4259 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004260 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004261 ;;
4262 *) AC_MSG_RESULT(yes)
4263 ;;
4264 esac ],
4265 AC_MSG_RESULT(yes)
4266)
4267
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004268CURL_CHECK_OPTION_NTLM_WB
4269
4270CURL_CHECK_NTLM_WB
4271
4272dnl ************************************************************
4273dnl disable TLS-SRP authentication
4274dnl
4275AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
4276AC_ARG_ENABLE(tls-srp,
4277AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
4278AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
4279[ case "$enableval" in
4280 no)
4281 AC_MSG_RESULT(no)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004282 want_tls_srp=no
4283 ;;
4284 *) AC_MSG_RESULT(yes)
4285 want_tls_srp=yes
4286 ;;
4287 esac ],
4288 AC_MSG_RESULT(yes)
4289 want_tls_srp=yes
4290)
4291
4292if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
4293 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
4294 USE_TLS_SRP=1
4295 curl_tls_srp_msg="enabled"
4296fi
4297
4298dnl ************************************************************
4299dnl disable Unix domain sockets support
4300dnl
4301AC_MSG_CHECKING([whether to enable Unix domain sockets])
4302AC_ARG_ENABLE(unix-sockets,
4303AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
4304AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
4305[ case "$enableval" in
4306 no) AC_MSG_RESULT(no)
4307 want_unix_sockets=no
4308 ;;
4309 *) AC_MSG_RESULT(yes)
4310 want_unix_sockets=yes
4311 ;;
4312 esac ], [
4313 AC_MSG_RESULT(auto)
4314 want_unix_sockets=auto
4315 ]
4316)
4317if test "x$want_unix_sockets" != "xno"; then
4318 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
4319 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
4320 AC_SUBST(USE_UNIX_SOCKETS, [1])
4321 curl_unix_sockets_msg="enabled"
4322 ], [
4323 if test "x$want_unix_sockets" = "xyes"; then
4324 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
4325 fi
4326 ], [
4327 #include <sys/un.h>
4328 ])
4329fi
4330
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004331dnl ************************************************************
4332dnl disable cookies support
4333dnl
Haibo Huang001784b2019-07-19 05:27:28 -07004334AC_MSG_CHECKING([whether to support cookies])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004335AC_ARG_ENABLE(cookies,
4336AC_HELP_STRING([--enable-cookies],[Enable cookies support])
4337AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
4338[ case "$enableval" in
4339 no)
4340 AC_MSG_RESULT(no)
4341 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
4342 ;;
4343 *) AC_MSG_RESULT(yes)
4344 ;;
4345 esac ],
4346 AC_MSG_RESULT(yes)
4347)
4348
4349dnl ************************************************************
Haibo Huang001784b2019-07-19 05:27:28 -07004350dnl disable HTTP authentication support
4351dnl
4352AC_MSG_CHECKING([whether to support HTTP authentication])
4353AC_ARG_ENABLE(http-auth,
4354AC_HELP_STRING([--enable-http-auth],[Enable HTTP authentication support])
4355AC_HELP_STRING([--disable-http-auth],[Disable HTTP authentication support]),
4356[ case "$enableval" in
4357 no)
4358 AC_MSG_RESULT(no)
4359 AC_DEFINE(CURL_DISABLE_HTTP_AUTH, 1, [disable HTTP authentication])
4360 ;;
4361 *) AC_MSG_RESULT(yes)
4362 ;;
4363 esac ],
4364 AC_MSG_RESULT(yes)
4365)
4366
4367dnl ************************************************************
4368dnl disable DoH support
4369dnl
4370AC_MSG_CHECKING([whether to support DoH])
4371AC_ARG_ENABLE(doh,
4372AC_HELP_STRING([--enable-doh],[Enable DoH support])
4373AC_HELP_STRING([--disable-doh],[Disable DoH support]),
4374[ case "$enableval" in
4375 no)
4376 AC_MSG_RESULT(no)
4377 AC_DEFINE(CURL_DISABLE_DOH, 1, [disable DoH])
4378 ;;
4379 *) AC_MSG_RESULT(yes)
4380 ;;
4381 esac ],
4382 AC_MSG_RESULT(yes)
4383)
4384
4385dnl ************************************************************
4386dnl disable mime API support
4387dnl
4388AC_MSG_CHECKING([whether to support the MIME API])
4389AC_ARG_ENABLE(mime,
4390AC_HELP_STRING([--enable-mime],[Enable mime API support])
4391AC_HELP_STRING([--disable-mime],[Disable mime API support]),
4392[ case "$enableval" in
4393 no)
4394 AC_MSG_RESULT(no)
4395 AC_DEFINE(CURL_DISABLE_MIME, 1, [disable mime API])
4396 ;;
4397 *) AC_MSG_RESULT(yes)
4398 ;;
4399 esac ],
4400 AC_MSG_RESULT(yes)
4401)
4402
4403dnl ************************************************************
4404dnl disable date parsing
4405dnl
4406AC_MSG_CHECKING([whether to support date parsing])
4407AC_ARG_ENABLE(dateparse,
4408AC_HELP_STRING([--enable-dateparse],[Enable date parsing])
4409AC_HELP_STRING([--disable-dateparse],[Disable date parsing]),
4410[ case "$enableval" in
4411 no)
4412 AC_MSG_RESULT(no)
4413 AC_DEFINE(CURL_DISABLE_PARSEDATE, 1, [disable date parsing])
4414 ;;
4415 *) AC_MSG_RESULT(yes)
4416 ;;
4417 esac ],
4418 AC_MSG_RESULT(yes)
4419)
4420
4421dnl ************************************************************
4422dnl disable netrc
4423dnl
4424AC_MSG_CHECKING([whether to support netrc parsing])
4425AC_ARG_ENABLE(netrc,
4426AC_HELP_STRING([--enable-netrc],[Enable netrc parsing])
4427AC_HELP_STRING([--disable-netrc],[Disable netrc parsing]),
4428[ case "$enableval" in
4429 no)
4430 AC_MSG_RESULT(no)
4431 AC_DEFINE(CURL_DISABLE_NETRC, 1, [disable netrc parsing])
4432 ;;
4433 *) AC_MSG_RESULT(yes)
4434 ;;
4435 esac ],
4436 AC_MSG_RESULT(yes)
4437)
4438
4439dnl ************************************************************
4440dnl disable progress-meter
4441dnl
4442AC_MSG_CHECKING([whether to support progress-meter])
4443AC_ARG_ENABLE(progress-meter,
4444AC_HELP_STRING([--enable-progress-meter],[Enable progress-meter])
4445AC_HELP_STRING([--disable-progress-meter],[Disable progress-meter]),
4446[ case "$enableval" in
4447 no)
4448 AC_MSG_RESULT(no)
4449 AC_DEFINE(CURL_DISABLE_PROGRESS_METER, 1, [disable progress-meter])
4450 ;;
4451 *) AC_MSG_RESULT(yes)
4452 ;;
4453 esac ],
4454 AC_MSG_RESULT(yes)
4455)
4456
4457dnl ************************************************************
4458dnl disable shuffle DNS support
4459dnl
4460AC_MSG_CHECKING([whether to support DNS shuffling])
4461AC_ARG_ENABLE(dnsshuffle,
4462AC_HELP_STRING([--enable-dnsshuffle],[Enable DNS shuffling])
4463AC_HELP_STRING([--disable-dnsshuffle],[Disable DNS shufflinf]),
4464[ case "$enableval" in
4465 no)
4466 AC_MSG_RESULT(no)
4467 AC_DEFINE(CURL_DISABLE_SHUFFLE_DNS, 1, [disable DNS shuffling])
4468 ;;
4469 *) AC_MSG_RESULT(yes)
4470 ;;
4471 esac ],
4472 AC_MSG_RESULT(yes)
4473)
4474
4475dnl ************************************************************
Haibo Huang65021c72019-03-27 15:37:23 -07004476dnl switch on/off alt-svc
4477dnl
4478curl_altsvc_msg="no (--enable-alt-svc)";
4479AC_MSG_CHECKING([whether to support alt-svc])
4480AC_ARG_ENABLE(alt-svc,
4481AC_HELP_STRING([--enable-alt-svc],[Enable alt-svc support])
4482AC_HELP_STRING([--disable-alt-svc],[Disable alt-svc support]),
4483[ case "$enableval" in
4484 no)
4485 AC_MSG_RESULT(no)
4486 ;;
4487 *) AC_MSG_RESULT(yes)
4488 curl_altsvc_msg="enabled";
4489 enable_altsvc="yes"
Haibo Huang65021c72019-03-27 15:37:23 -07004490 ;;
4491 esac ],
4492 AC_MSG_RESULT(no)
4493)
4494
4495if test "$enable_altsvc" = "yes"; then
4496 AC_DEFINE(USE_ALTSVC, 1, [to enable alt-svc])
Haibo Huang445085a2019-09-11 13:33:50 -07004497 experimental="$experimental alt-svc"
Haibo Huang65021c72019-03-27 15:37:23 -07004498fi
4499
4500dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004501dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004502dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004503CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004504
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004505dnl
4506dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004507dnl
4508LIBCURL_LIBS=$LIBS
4509
4510AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004511AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004512AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
4513
4514dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
4515dnl LIBS variable used in generated makefile at makefile processing
4516dnl time. Doing this functionally prevents LIBS from being used for
4517dnl all link targets in given makefile.
4518BLANK_AT_MAKETIME=
4519AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004520
4521AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
4522
4523dnl yes or no
4524ENABLE_SHARED="$enable_shared"
4525AC_SUBST(ENABLE_SHARED)
4526
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004527dnl to let curl-config output the static libraries correctly
4528ENABLE_STATIC="$enable_static"
4529AC_SUBST(ENABLE_STATIC)
4530
4531
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004532dnl
4533dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004534dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004535dnl
4536
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004537if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004538 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4539elif test -n "$SSL_ENABLED"; then
4540 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4541fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004542if test "x$IPV6_ENABLED" = "x1"; then
4543 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
4544fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004545if test "x$USE_UNIX_SOCKETS" = "x1"; then
4546 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
4547fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004548if test "x$HAVE_LIBZ" = "x1"; then
4549 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
4550fi
Alex Deymo486467e2017-12-19 19:04:07 +01004551if test "x$HAVE_BROTLI" = "x1"; then
4552 SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
4553fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07004554if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
4555 -o "x$USE_THREADS_WIN32" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004556 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
4557fi
4558if test "x$IDN_ENABLED" = "x1"; then
4559 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
4560fi
4561if test "x$USE_WINDOWS_SSPI" = "x1"; then
4562 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
4563fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004564
4565if test "x$HAVE_GSSAPI" = "x1"; then
4566 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
4567fi
4568
Haibo Huang65021c72019-03-27 15:37:23 -07004569if test "x$curl_psl_msg" = "xenabled"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07004570 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
4571fi
4572
Haibo Huang65021c72019-03-27 15:37:23 -07004573if test "x$enable_altsvc" = "xyes"; then
4574 SUPPORT_FEATURES="$SUPPORT_FEATURES alt-svc"
4575fi
4576
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004577if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4578 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4579 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
4580fi
4581
4582if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4583 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4584 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
4585fi
4586
4587if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
4588 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004589 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
Haibo Huang65021c72019-03-27 15:37:23 -07004590 -o "x$NSS_ENABLED" = "x1" -o "x$SECURETRANSPORT_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004591 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
4592
4593 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
4594 "x$NTLM_WB_ENABLED" = "x1"; then
4595 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
4596 fi
4597 fi
4598fi
4599
4600if test "x$USE_TLS_SRP" = "x1"; then
4601 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
4602fi
4603
4604if test "x$USE_NGHTTP2" = "x1"; then
4605 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004606fi
4607
Haibo Huang445085a2019-09-11 13:33:50 -07004608if test "x$USE_NGTCP2" = "x1" -o "x$USE_QUICHE" = "x1"; then
4609 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP3"
4610fi
4611
Alex Deymo486467e2017-12-19 19:04:07 +01004612if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
4613 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
4614fi
4615
Elliott Hughes82be86d2017-09-20 17:00:17 -07004616if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
4617 -o "x$NSS_ENABLED" = "x1"; then
4618 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
4619fi
4620
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004621AC_SUBST(SUPPORT_FEATURES)
4622
4623dnl For supported protocols in pkg-config file
4624if test "x$CURL_DISABLE_HTTP" != "x1"; then
4625 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
4626 if test "x$SSL_ENABLED" = "x1"; then
4627 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
4628 fi
4629fi
4630if test "x$CURL_DISABLE_FTP" != "x1"; then
4631 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
4632 if test "x$SSL_ENABLED" = "x1"; then
4633 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
4634 fi
4635fi
4636if test "x$CURL_DISABLE_FILE" != "x1"; then
4637 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
4638fi
4639if test "x$CURL_DISABLE_TELNET" != "x1"; then
4640 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
4641fi
4642if test "x$CURL_DISABLE_LDAP" != "x1"; then
4643 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
4644 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
4645 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
4646 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
4647 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
4648 fi
4649 fi
4650fi
4651if test "x$CURL_DISABLE_DICT" != "x1"; then
4652 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
4653fi
4654if test "x$CURL_DISABLE_TFTP" != "x1"; then
4655 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
4656fi
4657if test "x$CURL_DISABLE_GOPHER" != "x1"; then
4658 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
4659fi
4660if test "x$CURL_DISABLE_POP3" != "x1"; then
4661 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
4662 if test "x$SSL_ENABLED" = "x1"; then
4663 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
4664 fi
4665fi
4666if test "x$CURL_DISABLE_IMAP" != "x1"; then
4667 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
4668 if test "x$SSL_ENABLED" = "x1"; then
4669 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
4670 fi
4671fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004672if test "x$CURL_DISABLE_SMB" != "x1" \
4673 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
4674 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004675 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
Haibo Huang65021c72019-03-27 15:37:23 -07004676 -o "x$NSS_ENABLED" = "x1" -o "x$SECURETRANSPORT_ENABLED" = "x1" \); then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004677 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
4678 if test "x$SSL_ENABLED" = "x1"; then
4679 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4680 fi
4681fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004682if test "x$CURL_DISABLE_SMTP" != "x1"; then
4683 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4684 if test "x$SSL_ENABLED" = "x1"; then
4685 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4686 fi
4687fi
4688if test "x$USE_LIBSSH2" = "x1"; then
4689 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4690 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4691fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08004692if test "x$USE_LIBSSH" = "x1"; then
4693 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4694 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4695fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004696if test "x$CURL_DISABLE_RTSP" != "x1"; then
4697 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4698fi
4699if test "x$USE_LIBRTMP" = "x1"; then
4700 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4701fi
4702
4703dnl replace spaces with newlines
4704dnl sort the lines
4705dnl replace the newlines back to spaces
4706SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4707
4708AC_SUBST(SUPPORT_PROTOCOLS)
4709
4710dnl squeeze whitespace out of some variables
4711
4712squeeze CFLAGS
4713squeeze CPPFLAGS
4714squeeze DEFS
4715squeeze LDFLAGS
4716squeeze LIBS
4717
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004718squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004719squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004720squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004721
4722squeeze SUPPORT_FEATURES
4723squeeze SUPPORT_PROTOCOLS
4724
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004725XC_CHECK_BUILD_FLAGS
4726
Elliott Hughes0128fe42018-02-27 14:57:55 -08004727SSL_BACKENDS=${ssl_backends}
4728AC_SUBST(SSL_BACKENDS)
4729
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004730if test "x$want_curldebug_assumed" = "xyes" &&
4731 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4732 ac_configure_args="$ac_configure_args --enable-curldebug"
4733fi
4734
4735AC_CONFIG_FILES([Makefile \
4736 docs/Makefile \
4737 docs/examples/Makefile \
4738 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004739 docs/libcurl/opts/Makefile \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004740 docs/cmdline-opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004741 include/Makefile \
4742 include/curl/Makefile \
4743 src/Makefile \
4744 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07004745 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004746 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004747 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004748 tests/certs/Makefile \
4749 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004750 tests/data/Makefile \
4751 tests/server/Makefile \
4752 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004753 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004754 packages/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004755 packages/vms/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004756 curl-config \
4757 libcurl.pc
4758])
4759AC_OUTPUT
4760
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004761CURL_GENERATE_CONFIGUREHELP_PM
4762
4763XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4764
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004765AC_MSG_NOTICE([Configured to build curl/libcurl:
4766
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004767 Host setup: ${host}
4768 Install prefix: ${prefix}
4769 Compiler: ${CC}
Haibo Huang21926d52019-01-08 14:27:10 -08004770 CFLAGS: ${CFLAGS}
4771 CPPFLAGS: ${CPPFLAGS}
4772 LDFLAGS: ${LDFLAGS}
4773 LIBS: ${LIBS}
4774
4775 curl version: ${CURLVERSION}
Haibo Huang65021c72019-03-27 15:37:23 -07004776 SSL: ${curl_ssl_msg}
4777 SSH: ${curl_ssh_msg}
4778 zlib: ${curl_zlib_msg}
4779 brotli: ${curl_brotli_msg}
4780 GSS-API: ${curl_gss_msg}
4781 TLS-SRP: ${curl_tls_srp_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004782 resolver: ${curl_res_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004783 IPv6: ${curl_ipv6_msg}
4784 Unix sockets: ${curl_unix_sockets_msg}
4785 IDN: ${curl_idn_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004786 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4787 Built-in manual: ${curl_manual_msg}
4788 --libcurl option: ${curl_libcurl_msg}
4789 Verbose errors: ${curl_verbose_msg}
Haibo Huang51d9d882019-02-06 01:36:06 -08004790 Code coverage: ${curl_coverage_msg}
Haibo Huang65021c72019-03-27 15:37:23 -07004791 SSPI: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004792 ca cert bundle: ${ca}${ca_warning}
4793 ca cert path: ${capath}${capath_warning}
4794 ca fallback: ${with_ca_fallback}
Haibo Huang65021c72019-03-27 15:37:23 -07004795 LDAP: ${curl_ldap_msg}
4796 LDAPS: ${curl_ldaps_msg}
4797 RTSP: ${curl_rtsp_msg}
4798 RTMP: ${curl_rtmp_msg}
4799 Metalink: ${curl_mtlnk_msg}
4800 PSL: ${curl_psl_msg}
4801 Alt-svc: ${curl_altsvc_msg}
4802 HTTP2: ${curl_h2_msg}
Haibo Huang445085a2019-09-11 13:33:50 -07004803 HTTP3: ${curl_h3_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004804 Protocols: ${SUPPORT_PROTOCOLS}
Haibo Huang65021c72019-03-27 15:37:23 -07004805 Features: ${SUPPORT_FEATURES}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004806])
Haibo Huang65021c72019-03-27 15:37:23 -07004807if test -n "$experimental"; then
4808 cat >&2 << _EOF
Haibo Huang445085a2019-09-11 13:33:50 -07004809 WARNING: $experimental enabled but marked EXPERIMENTAL. Use with caution!
Haibo Huang65021c72019-03-27 15:37:23 -07004810_EOF
4811fi