blob: e9f0ef75b7f3afe8981b77e2e29266c4062c5fa8 [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 Huang21926d52019-01-08 14:27:10 -0800158 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,winssl,darwinssl,mesalink} )"
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
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700368dnl ************************************************************
369dnl switch off particular protocols
370dnl
371AC_MSG_CHECKING([whether to support http])
372AC_ARG_ENABLE(http,
373AC_HELP_STRING([--enable-http],[Enable HTTP support])
374AC_HELP_STRING([--disable-http],[Disable HTTP support]),
375[ case "$enableval" in
376 no)
377 AC_MSG_RESULT(no)
378 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
Elliott Hughes82be86d2017-09-20 17:00:17 -0700379 disable_http="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700380 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
381 AC_SUBST(CURL_DISABLE_HTTP, [1])
382 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
383 AC_SUBST(CURL_DISABLE_RTSP, [1])
384 ;;
385 *) AC_MSG_RESULT(yes)
386 ;;
387 esac ],
388 AC_MSG_RESULT(yes)
389)
390AC_MSG_CHECKING([whether to support ftp])
391AC_ARG_ENABLE(ftp,
392AC_HELP_STRING([--enable-ftp],[Enable FTP support])
393AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
394[ case "$enableval" in
395 no)
396 AC_MSG_RESULT(no)
397 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
398 AC_SUBST(CURL_DISABLE_FTP, [1])
399 ;;
400 *) AC_MSG_RESULT(yes)
401 ;;
402 esac ],
403 AC_MSG_RESULT(yes)
404)
405AC_MSG_CHECKING([whether to support file])
406AC_ARG_ENABLE(file,
407AC_HELP_STRING([--enable-file],[Enable FILE support])
408AC_HELP_STRING([--disable-file],[Disable FILE support]),
409[ case "$enableval" in
410 no)
411 AC_MSG_RESULT(no)
412 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
413 AC_SUBST(CURL_DISABLE_FILE, [1])
414 ;;
415 *) AC_MSG_RESULT(yes)
416 ;;
417 esac ],
418 AC_MSG_RESULT(yes)
419)
420AC_MSG_CHECKING([whether to support ldap])
421AC_ARG_ENABLE(ldap,
422AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
423AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
424[ case "$enableval" in
425 no)
426 AC_MSG_RESULT(no)
427 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
428 AC_SUBST(CURL_DISABLE_LDAP, [1])
429 ;;
430 *)
431 AC_MSG_RESULT(yes)
432 ;;
433 esac ],[
434 AC_MSG_RESULT(yes) ]
435)
436AC_MSG_CHECKING([whether to support ldaps])
437AC_ARG_ENABLE(ldaps,
438AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
439AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
440[ case "$enableval" in
441 no)
442 AC_MSG_RESULT(no)
443 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
444 AC_SUBST(CURL_DISABLE_LDAPS, [1])
445 ;;
446 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
447 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
448 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
449 AC_SUBST(CURL_DISABLE_LDAPS, [1])
450 else
451 AC_MSG_RESULT(yes)
452 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
453 AC_SUBST(HAVE_LDAP_SSL, [1])
454 fi
455 ;;
456 esac ],[
457 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
458 AC_MSG_RESULT(no)
459 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
460 AC_SUBST(CURL_DISABLE_LDAPS, [1])
461 else
462 AC_MSG_RESULT(yes)
463 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
464 AC_SUBST(HAVE_LDAP_SSL, [1])
465 fi ]
466)
467
468AC_MSG_CHECKING([whether to support rtsp])
469AC_ARG_ENABLE(rtsp,
470AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
471AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
472[ case "$enableval" in
473 no)
474 AC_MSG_RESULT(no)
475 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
476 AC_SUBST(CURL_DISABLE_RTSP, [1])
477 ;;
478 *) if test x$CURL_DISABLE_HTTP = x1 ; then
479 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
480 else
481 AC_MSG_RESULT(yes)
482 curl_rtsp_msg="enabled"
483 fi
484 ;;
485 esac ],
486 if test "x$CURL_DISABLE_HTTP" != "x1"; then
487 AC_MSG_RESULT(yes)
488 curl_rtsp_msg="enabled"
489 else
490 AC_MSG_RESULT(no)
491 fi
492)
493
494AC_MSG_CHECKING([whether to support proxies])
495AC_ARG_ENABLE(proxy,
496AC_HELP_STRING([--enable-proxy],[Enable proxy support])
497AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
498[ case "$enableval" in
499 no)
500 AC_MSG_RESULT(no)
501 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
502 AC_SUBST(CURL_DISABLE_PROXY, [1])
503 ;;
504 *) AC_MSG_RESULT(yes)
505 ;;
506 esac ],
507 AC_MSG_RESULT(yes)
508)
509
510AC_MSG_CHECKING([whether to support dict])
511AC_ARG_ENABLE(dict,
512AC_HELP_STRING([--enable-dict],[Enable DICT support])
513AC_HELP_STRING([--disable-dict],[Disable DICT support]),
514[ case "$enableval" in
515 no)
516 AC_MSG_RESULT(no)
517 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
518 AC_SUBST(CURL_DISABLE_DICT, [1])
519 ;;
520 *) AC_MSG_RESULT(yes)
521 ;;
522 esac ],
523 AC_MSG_RESULT(yes)
524)
525AC_MSG_CHECKING([whether to support telnet])
526AC_ARG_ENABLE(telnet,
527AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
528AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
529[ case "$enableval" in
530 no)
531 AC_MSG_RESULT(no)
532 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
533 AC_SUBST(CURL_DISABLE_TELNET, [1])
534 ;;
535 *) AC_MSG_RESULT(yes)
536 ;;
537 esac ],
538 AC_MSG_RESULT(yes)
539)
540AC_MSG_CHECKING([whether to support tftp])
541AC_ARG_ENABLE(tftp,
542AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
543AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
544[ case "$enableval" in
545 no)
546 AC_MSG_RESULT(no)
547 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
548 AC_SUBST(CURL_DISABLE_TFTP, [1])
549 ;;
550 *) AC_MSG_RESULT(yes)
551 ;;
552 esac ],
553 AC_MSG_RESULT(yes)
554)
555
556AC_MSG_CHECKING([whether to support pop3])
557AC_ARG_ENABLE(pop3,
558AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
559AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
560[ case "$enableval" in
561 no)
562 AC_MSG_RESULT(no)
563 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
564 AC_SUBST(CURL_DISABLE_POP3, [1])
565 ;;
566 *) AC_MSG_RESULT(yes)
567 ;;
568 esac ],
569 AC_MSG_RESULT(yes)
570)
571
572
573AC_MSG_CHECKING([whether to support imap])
574AC_ARG_ENABLE(imap,
575AC_HELP_STRING([--enable-imap],[Enable IMAP support])
576AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
577[ case "$enableval" in
578 no)
579 AC_MSG_RESULT(no)
580 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
581 AC_SUBST(CURL_DISABLE_IMAP, [1])
582 ;;
583 *) AC_MSG_RESULT(yes)
584 ;;
585 esac ],
586 AC_MSG_RESULT(yes)
587)
588
589
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700590AC_MSG_CHECKING([whether to support smb])
591AC_ARG_ENABLE(smb,
592AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
593AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
594[ case "$enableval" in
595 no)
596 AC_MSG_RESULT(no)
597 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
598 AC_SUBST(CURL_DISABLE_SMB, [1])
599 ;;
600 *) AC_MSG_RESULT(yes)
601 ;;
602 esac ],
603 AC_MSG_RESULT(yes)
604)
605
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700606AC_MSG_CHECKING([whether to support smtp])
607AC_ARG_ENABLE(smtp,
608AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
609AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
610[ case "$enableval" in
611 no)
612 AC_MSG_RESULT(no)
613 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
614 AC_SUBST(CURL_DISABLE_SMTP, [1])
615 ;;
616 *) AC_MSG_RESULT(yes)
617 ;;
618 esac ],
619 AC_MSG_RESULT(yes)
620)
621
622AC_MSG_CHECKING([whether to support gopher])
623AC_ARG_ENABLE(gopher,
624AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
625AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
626[ case "$enableval" in
627 no)
628 AC_MSG_RESULT(no)
629 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
630 AC_SUBST(CURL_DISABLE_GOPHER, [1])
631 ;;
632 *) AC_MSG_RESULT(yes)
633 ;;
634 esac ],
635 AC_MSG_RESULT(yes)
636)
637
638
639dnl **********************************************************************
640dnl Check for built-in manual
641dnl **********************************************************************
642
643AC_MSG_CHECKING([whether to provide built-in manual])
644AC_ARG_ENABLE(manual,
645AC_HELP_STRING([--enable-manual],[Enable built-in manual])
646AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
647[ case "$enableval" in
648 no)
649 AC_MSG_RESULT(no)
650 ;;
651 *) AC_MSG_RESULT(yes)
652 USE_MANUAL="1"
653 ;;
654 esac ],
655 AC_MSG_RESULT(yes)
656 USE_MANUAL="1"
657)
658dnl The actual use of the USE_MANUAL variable is done much later in this
659dnl script to allow other actions to disable it as well.
660
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700661dnl ************************************************************
662dnl disable C code generation support
663dnl
664AC_MSG_CHECKING([whether to enable generation of C code])
665AC_ARG_ENABLE(libcurl_option,
666AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
667AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
668[ case "$enableval" in
669 no)
670 AC_MSG_RESULT(no)
671 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
672 curl_libcurl_msg="no"
673 ;;
674 *) AC_MSG_RESULT(yes)
675 ;;
676 esac ],
677 AC_MSG_RESULT(yes)
678)
679
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700680dnl **********************************************************************
681dnl Checks for libraries.
682dnl **********************************************************************
683
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700684AC_MSG_CHECKING([whether to use libgcc])
685AC_ARG_ENABLE(libgcc,
686AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
687[ case "$enableval" in
688 yes)
689 LIBS="-lgcc $LIBS"
690 AC_MSG_RESULT(yes)
691 ;;
692 *) AC_MSG_RESULT(no)
693 ;;
694 esac ],
695 AC_MSG_RESULT(no)
696)
697
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700698CURL_CHECK_LIB_XNET
699
700dnl gethostbyname without lib or in the nsl lib?
701AC_CHECK_FUNC(gethostbyname,
702 [HAVE_GETHOSTBYNAME="1"
703 ],
704 [ AC_CHECK_LIB(nsl, gethostbyname,
705 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700706 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700707 ])
708 ])
709
710if test "$HAVE_GETHOSTBYNAME" != "1"
711then
712 dnl gethostbyname in the socket lib?
713 AC_CHECK_LIB(socket, gethostbyname,
714 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700715 LIBS="-lsocket $LIBS"
716 ])
717fi
718
719if test "$HAVE_GETHOSTBYNAME" != "1"
720then
721 dnl gethostbyname in the watt lib?
722 AC_CHECK_LIB(watt, gethostbyname,
723 [HAVE_GETHOSTBYNAME="1"
724 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
725 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
726 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700727 ])
728fi
729
730dnl At least one system has been identified to require BOTH nsl and socket
731dnl libs at the same time to link properly.
732if test "$HAVE_GETHOSTBYNAME" != "1"
733then
734 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
735 my_ac_save_LIBS=$LIBS
736 LIBS="-lnsl -lsocket $LIBS"
737 AC_LINK_IFELSE([
738 AC_LANG_PROGRAM([[
739 ]],[[
740 gethostbyname();
741 ]])
742 ],[
743 AC_MSG_RESULT([yes])
744 HAVE_GETHOSTBYNAME="1"
745 ],[
746 AC_MSG_RESULT([no])
747 LIBS=$my_ac_save_LIBS
748 ])
749fi
750
751if test "$HAVE_GETHOSTBYNAME" != "1"
752then
753 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -0700754 if test "$curl_cv_header_windows_h" = "yes"; then
755 if test "$curl_cv_header_winsock_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700756 case $host in
757 *-*-mingw32ce*)
758 winsock_LIB="-lwinsock"
759 ;;
760 *)
761 winsock_LIB="-lwsock32"
762 ;;
763 esac
764 fi
Alex Deymod15eaac2016-06-28 14:49:26 -0700765 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700766 winsock_LIB="-lws2_32"
767 fi
768 if test ! -z "$winsock_LIB"; then
769 my_ac_save_LIBS=$LIBS
770 LIBS="$winsock_LIB $LIBS"
771 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
772 AC_LINK_IFELSE([
773 AC_LANG_PROGRAM([[
774#ifdef HAVE_WINDOWS_H
775#ifndef WIN32_LEAN_AND_MEAN
776#define WIN32_LEAN_AND_MEAN
777#endif
778#include <windows.h>
779#ifdef HAVE_WINSOCK2_H
780#include <winsock2.h>
781#else
782#ifdef HAVE_WINSOCK_H
783#include <winsock.h>
784#endif
785#endif
786#endif
787 ]],[[
788 gethostbyname("www.dummysite.com");
789 ]])
790 ],[
791 AC_MSG_RESULT([yes])
792 HAVE_GETHOSTBYNAME="1"
793 ],[
794 AC_MSG_RESULT([no])
795 winsock_LIB=""
796 LIBS=$my_ac_save_LIBS
797 ])
798 fi
799 fi
800fi
801
802if test "$HAVE_GETHOSTBYNAME" != "1"
803then
804 dnl This is for Minix 3.1
805 AC_MSG_CHECKING([for gethostbyname for Minix 3])
806 AC_LINK_IFELSE([
807 AC_LANG_PROGRAM([[
808/* Older Minix versions may need <net/gen/netdb.h> here instead */
809#include <netdb.h>
810 ]],[[
811 gethostbyname("www.dummysite.com");
812 ]])
813 ],[
814 AC_MSG_RESULT([yes])
815 HAVE_GETHOSTBYNAME="1"
816 ],[
817 AC_MSG_RESULT([no])
818 ])
819fi
820
821if test "$HAVE_GETHOSTBYNAME" != "1"
822then
823 dnl This is for eCos with a stubbed DNS implementation
824 AC_MSG_CHECKING([for gethostbyname for eCos])
825 AC_LINK_IFELSE([
826 AC_LANG_PROGRAM([[
827#include <stdio.h>
828#include <netdb.h>
829 ]],[[
830 gethostbyname("www.dummysite.com");
831 ]])
832 ],[
833 AC_MSG_RESULT([yes])
834 HAVE_GETHOSTBYNAME="1"
835 ],[
836 AC_MSG_RESULT([no])
837 ])
838fi
839
840if test "$HAVE_GETHOSTBYNAME" != "1"
841then
842 dnl gethostbyname in the network lib - for Haiku OS
843 AC_CHECK_LIB(network, gethostbyname,
844 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700845 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700846 ])
847fi
848
849if test "$HAVE_GETHOSTBYNAME" != "1"
850then
851 dnl gethostbyname in the net lib - for BeOS
852 AC_CHECK_LIB(net, gethostbyname,
853 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700854 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700855 ])
856fi
857
858
859if test "$HAVE_GETHOSTBYNAME" != "1"; then
860 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
861fi
862
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700863CURL_CHECK_LIBS_CONNECT
864
865CURL_NETWORK_LIBS=$LIBS
866
867dnl **********************************************************************
868dnl In case that function clock_gettime with monotonic timer is available,
869dnl check for additional required libraries.
870dnl **********************************************************************
871CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
872
873dnl **********************************************************************
874dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700875dnl servers and libtest cases which require networking and clock_gettime
876dnl support. Save the list of required libraries at this point for use
877dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700878dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700879CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700880
881dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700882dnl Check for the presence of ZLIB libraries and headers
883dnl **********************************************************************
884
885dnl Check for & handle argument to --with-zlib.
886
887clean_CPPFLAGS=$CPPFLAGS
888clean_LDFLAGS=$LDFLAGS
889clean_LIBS=$LIBS
890ZLIB_LIBS=""
891AC_ARG_WITH(zlib,
892AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
893AC_HELP_STRING([--without-zlib],[disable use of zlib]),
894 [OPT_ZLIB="$withval"])
895
896if test "$OPT_ZLIB" = "no" ; then
897 AC_MSG_WARN([zlib disabled])
898else
899 if test "$OPT_ZLIB" = "yes" ; then
900 OPT_ZLIB=""
901 fi
902
Elliott Hughescee03382017-06-23 12:17:18 -0700903 if test -z "$OPT_ZLIB" ; then
Elliott Hughes82be86d2017-09-20 17:00:17 -0700904 CURL_CHECK_PKGCONFIG(zlib)
905
906 if test "$PKGCONFIG" != "no" ; then
907 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
908 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
909 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
910 OPT_ZLIB=""
911 HAVE_LIBZ="1"
912 fi
Elliott Hughescee03382017-06-23 12:17:18 -0700913
914 if test -z "$HAVE_LIBZ"; then
915
916 dnl Check for the lib without setting any new path, since many
917 dnl people have it in the default path
918
919 AC_CHECK_LIB(z, inflateEnd,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700920 dnl libz found, set the variable
921 [HAVE_LIBZ="1"
922 LIBS="-lz $LIBS"],
923 dnl if no lib found, try /usr/local
924 [OPT_ZLIB="/usr/local"])
Elliott Hughescee03382017-06-23 12:17:18 -0700925 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700926 fi
927
928 dnl Add a nonempty path to the compiler flags
929 if test -n "$OPT_ZLIB"; then
930 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
931 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
932 fi
933
934 AC_CHECK_HEADER(zlib.h,
935 [
936 dnl zlib.h was found
937 HAVE_ZLIB_H="1"
938 dnl if the lib wasn't found already, try again with the new paths
939 if test "$HAVE_LIBZ" != "1"; then
940 AC_CHECK_LIB(z, gzread,
941 [
942 dnl the lib was found!
943 HAVE_LIBZ="1"
944 LIBS="-lz $LIBS"
945 ],
946 [ CPPFLAGS=$clean_CPPFLAGS
947 LDFLAGS=$clean_LDFLAGS])
948 fi
949 ],
950 [
951 dnl zlib.h was not found, restore the flags
952 CPPFLAGS=$clean_CPPFLAGS
953 LDFLAGS=$clean_LDFLAGS]
954 )
955
956 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
957 then
958 AC_MSG_WARN([configure found only the libz lib, not the header file!])
959 HAVE_LIBZ=""
960 CPPFLAGS=$clean_CPPFLAGS
961 LDFLAGS=$clean_LDFLAGS
962 LIBS=$clean_LIBS
963 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
964 then
965 AC_MSG_WARN([configure found only the libz header file, not the lib!])
966 CPPFLAGS=$clean_CPPFLAGS
967 LDFLAGS=$clean_LDFLAGS
968 LIBS=$clean_LIBS
969 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
970 then
971 dnl both header and lib were found!
972 AC_SUBST(HAVE_LIBZ)
973 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
974 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
975
976 ZLIB_LIBS="-lz"
977 LIBS="-lz $clean_LIBS"
978
979 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
980 AMFIXLIB="1"
981 AC_MSG_NOTICE([found both libz and libz.h header])
982 curl_zlib_msg="enabled"
983 fi
984fi
985
986dnl set variable for use in automakefile(s)
987AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
988AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700989
990dnl **********************************************************************
Alex Deymo486467e2017-12-19 19:04:07 +0100991dnl Check for the presence of BROTLI decoder libraries and headers
992dnl **********************************************************************
993
994dnl Brotli project home page: https://github.com/google/brotli
995
996dnl Default to compiler & linker defaults for BROTLI files & libraries.
997OPT_BROTLI=off
998AC_ARG_WITH(brotli,dnl
999AC_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])
1000AC_HELP_STRING([--without-brotli], [disable BROTLI]),
1001 OPT_BROTLI=$withval)
1002
1003if test X"$OPT_BROTLI" != Xno; then
1004 dnl backup the pre-brotli variables
1005 CLEANLDFLAGS="$LDFLAGS"
1006 CLEANCPPFLAGS="$CPPFLAGS"
1007 CLEANLIBS="$LIBS"
1008
1009 case "$OPT_BROTLI" in
1010 yes)
1011 dnl --with-brotli (without path) used
1012 CURL_CHECK_PKGCONFIG(libbrotlidec)
1013
1014 if test "$PKGCONFIG" != "no" ; then
1015 LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1016 LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1017 CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1018 version=`$PKGCONFIG --modversion libbrotlidec`
1019 DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/-L//'`
1020 fi
1021
1022 ;;
1023 off)
1024 dnl no --with-brotli option given, just check default places
1025 ;;
1026 *)
1027 dnl use the given --with-brotli spot
1028 PREFIX_BROTLI=$OPT_BROTLI
1029 ;;
1030 esac
1031
1032 dnl if given with a prefix, we set -L and -I based on that
1033 if test -n "$PREFIX_BROTLI"; then
1034 LIB_BROTLI="-lbrotlidec"
1035 LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1036 CPP_BROTLI=-I${PREFIX_BROTLI}/include
1037 DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1038 fi
1039
1040 LDFLAGS="$LDFLAGS $LD_BROTLI"
1041 CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1042 LIBS="$LIB_BROTLI $LIBS"
1043
1044 AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1045
1046 AC_CHECK_HEADERS(brotli/decode.h,
1047 curl_brotli_msg="enabled (libbrotlidec)"
1048 HAVE_BROTLI=1
1049 AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1050 AC_SUBST(HAVE_BROTLI, [1])
1051 )
1052
1053 if test X"$OPT_BROTLI" != Xoff &&
1054 test "$HAVE_BROTLI" != "1"; then
1055 AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1056 fi
1057
1058 if test "$HAVE_BROTLI" = "1"; then
1059 if test -n "$DIR_BROTLI"; then
1060 dnl when the brotli shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001061 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Alex Deymo486467e2017-12-19 19:04:07 +01001062 dnl to prevent further configure tests to fail due to this
1063
1064 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001065 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI"
1066 export CURL_LIBRARY_PATH
1067 AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH])
Alex Deymo486467e2017-12-19 19:04:07 +01001068 fi
1069 fi
1070 else
1071 dnl no brotli, revert back to clean variables
1072 LDFLAGS=$CLEANLDFLAGS
1073 CPPFLAGS=$CLEANCPPFLAGS
1074 LIBS=$CLEANLIBS
1075 fi
1076fi
1077
1078dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001079dnl Check for LDAP
1080dnl **********************************************************************
1081
1082LDAPLIBNAME=""
1083AC_ARG_WITH(ldap-lib,
1084AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
1085 [LDAPLIBNAME="$withval"])
1086
1087LBERLIBNAME=""
1088AC_ARG_WITH(lber-lib,
1089AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
1090 [LBERLIBNAME="$withval"])
1091
1092if test x$CURL_DISABLE_LDAP != x1 ; then
1093
1094 CURL_CHECK_HEADER_LBER
1095 CURL_CHECK_HEADER_LDAP
1096 CURL_CHECK_HEADER_LDAPSSL
1097 CURL_CHECK_HEADER_LDAP_SSL
1098
1099 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001100 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001101 dnl Windows uses a single and unique LDAP library name
1102 LDAPLIBNAME="wldap32"
1103 LBERLIBNAME="no"
1104 fi
1105 fi
1106
1107 if test "$LDAPLIBNAME" ; then
1108 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1109 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1110 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001111 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001112 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001113 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001114 else
1115 dnl Try to find the right ldap libraries for this system
1116 CURL_CHECK_LIBS_LDAP
1117 case X-"$curl_cv_ldap_LIBS" in
1118 X-unknown)
1119 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1120 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1121 AC_SUBST(CURL_DISABLE_LDAP, [1])
1122 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1123 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1124 ;;
1125 esac
1126 fi
1127fi
1128
1129if test x$CURL_DISABLE_LDAP != x1 ; then
1130
1131 if test "$LBERLIBNAME" ; then
1132 dnl If name is "no" then don't define this library at all
1133 dnl (it's only needed if libldap.so's dependencies are broken).
1134 if test "$LBERLIBNAME" != "no" ; then
1135 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1136 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1137 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001138 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001139 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001140 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001141 fi
1142 fi
1143fi
1144
1145if test x$CURL_DISABLE_LDAP != x1 ; then
1146 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1147
1148 if test "$LDAPLIBNAME" = "wldap32"; then
1149 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001150 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001151 else
1152 curl_ldap_msg="enabled (OpenLDAP)"
1153 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1154 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1155 AC_SUBST(USE_OPENLDAP, [1])
1156 fi
1157 fi
1158fi
1159
1160if test x$CURL_DISABLE_LDAPS != x1 ; then
1161 curl_ldaps_msg="enabled"
1162fi
1163
1164dnl **********************************************************************
1165dnl Checks for IPv6
1166dnl **********************************************************************
1167
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001168AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001169AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001170AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1171AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001172[ case "$enableval" in
1173 no)
1174 AC_MSG_RESULT(no)
1175 ipv6=no
1176 ;;
1177 *) AC_MSG_RESULT(yes)
1178 ipv6=yes
1179 ;;
1180 esac ],
1181
1182 AC_TRY_RUN([ /* is AF_INET6 available? */
1183#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001184#ifdef HAVE_WINSOCK2_H
1185#include <winsock2.h>
1186#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001187#include <sys/socket.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001188#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001189#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001190main()
1191{
1192 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1193 exit(1);
1194 else
1195 exit(0);
1196}
1197],
1198 AC_MSG_RESULT(yes)
1199 ipv6=yes,
1200 AC_MSG_RESULT(no)
1201 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001202 AC_MSG_RESULT(yes)
1203 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001204))
1205
1206if test "$ipv6" = "yes"; then
1207 curl_ipv6_msg="enabled"
1208fi
1209
1210# Check if struct sockaddr_in6 have sin6_scope_id member
1211if test "$ipv6" = yes; then
1212 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1213 AC_TRY_COMPILE([
1214#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001215#ifdef HAVE_WINSOCK2_H
1216#include <winsock2.h>
1217#include <ws2tcpip.h>
1218#else
1219#include <netinet/in.h>
Elliott Hughes0128fe42018-02-27 14:57:55 -08001220#if defined (__TANDEM)
1221# include <netinet/in6.h>
1222#endif
Alex Deymod15eaac2016-06-28 14:49:26 -07001223#endif] ,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001224 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1225 if test "$have_sin6_scope_id" = yes; then
1226 AC_MSG_RESULT([yes])
1227 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1228 else
1229 AC_MSG_RESULT([no])
1230 fi
1231fi
1232
1233dnl **********************************************************************
1234dnl Check if the operating system allows programs to write to their own argv[]
1235dnl **********************************************************************
1236
1237AC_MSG_CHECKING([if argv can be written to])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001238CURL_RUN_IFELSE([
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001239int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001240 argv[0][0] = ' ';
1241 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001242}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001243],[
1244 curl_cv_writable_argv=yes
1245],[
1246 curl_cv_writable_argv=no
1247],[
1248 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001249])
1250case $curl_cv_writable_argv in
1251yes)
1252 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1253 AC_MSG_RESULT(yes)
1254 ;;
1255no)
1256 AC_MSG_RESULT(no)
1257 ;;
1258*)
1259 AC_MSG_RESULT(no)
1260 AC_MSG_WARN([the previous check could not be made default was used])
1261 ;;
1262esac
1263
1264dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001265dnl Check for GSS-API libraries
1266dnl **********************************************************************
1267
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001268dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001269
1270GSSAPI_ROOT="/usr"
1271AC_ARG_WITH(gssapi-includes,
1272 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001273 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001274 [ GSSAPI_INCS="-I$withval"
1275 want_gss="yes" ]
1276)
1277
1278AC_ARG_WITH(gssapi-libs,
1279 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001280 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001281 [ GSSAPI_LIB_DIR="-L$withval"
1282 want_gss="yes" ]
1283)
1284
1285AC_ARG_WITH(gssapi,
1286 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001287 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001288 GSSAPI_ROOT="$withval"
1289 if test x"$GSSAPI_ROOT" != xno; then
1290 want_gss="yes"
1291 if test x"$GSSAPI_ROOT" = xyes; then
1292 dnl if yes, then use default root
1293 GSSAPI_ROOT="/usr"
1294 fi
1295 fi
1296])
1297
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001298: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1299
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001300save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001301AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001302if test x"$want_gss" = xyes; then
1303 AC_MSG_RESULT(yes)
1304
1305 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001306 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1307 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1308 elif test -f "$KRB5CONFIG"; then
1309 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001310 elif test "$GSSAPI_ROOT" != "yes"; then
1311 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1312 fi
1313 fi
1314
1315 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1316
1317 AC_CHECK_HEADER(gss.h,
1318 [
1319 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001320 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001321 gnu_gss=yes
1322 ],
1323 [
1324 dnl not found, check Heimdal or MIT
1325 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1326 AC_CHECK_HEADERS(
1327 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1328 [],
1329 [not_mit=1],
1330 [
1331AC_INCLUDES_DEFAULT
1332#ifdef HAVE_GSSAPI_GSSAPI_H
1333#include <gssapi/gssapi.h>
1334#endif
1335 ])
1336 if test "x$not_mit" = "x1"; then
1337 dnl MIT not found, check for Heimdal
1338 AC_CHECK_HEADER(gssapi.h,
1339 [
1340 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001341 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001342 ],
1343 [
1344 dnl no header found, disabling GSS
1345 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001346 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001347 ]
1348 )
1349 else
1350 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001351 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1352 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1353 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001354 AC_COMPILE_IFELSE([
1355 AC_LANG_PROGRAM([[
1356#include <gssapi/gssapi.h>
1357#include <gssapi/gssapi_generic.h>
1358#include <gssapi/gssapi_krb5.h>
1359 ]],[[
1360 gss_import_name(
1361 (OM_uint32 *)0,
1362 (gss_buffer_t)0,
1363 GSS_C_NT_HOSTBASED_SERVICE,
1364 (gss_name_t *)0);
1365 ]])
1366 ],[
1367 AC_MSG_RESULT([yes])
1368 ],[
1369 AC_MSG_RESULT([no])
1370 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001371 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001372 ])
1373 fi
1374 ]
1375 )
1376else
1377 AC_MSG_RESULT(no)
1378fi
1379if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001380 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1381 HAVE_GSSAPI=1
1382 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001383
1384 if test -n "$gnu_gss"; then
1385 curl_gss_msg="enabled (GNU GSS)"
1386 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001387 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001388 elif test -z "$GSSAPI_LIB_DIR"; then
1389 case $host in
1390 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001391 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001392 ;;
1393 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001394 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001395 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1396 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001397 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1398 LIBS="$gss_libs $LIBS"
1399 elif test -f "$KRB5CONFIG"; then
1400 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1401 dnl into LIBS
1402 gss_libs=`$KRB5CONFIG --libs gssapi`
1403 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001404 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001405 case $host in
1406 *-hp-hpux*)
1407 gss_libname="gss"
1408 ;;
1409 *)
1410 gss_libname="gssapi"
1411 ;;
1412 esac
1413
1414 if test "$GSSAPI_ROOT" != "yes"; then
1415 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1416 LIBS="-l$gss_libname $LIBS"
1417 else
1418 LIBS="-l$gss_libname $LIBS"
1419 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001420 fi
1421 ;;
1422 esac
1423 else
1424 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001425 case $host in
1426 *-hp-hpux*)
1427 LIBS="-lgss $LIBS"
1428 ;;
1429 *)
1430 LIBS="-lgssapi $LIBS"
1431 ;;
1432 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001433 fi
1434else
1435 CPPFLAGS="$save_CPPFLAGS"
1436fi
1437
Alex Deymo486467e2017-12-19 19:04:07 +01001438build_libstubgss=no
1439if test x"$want_gss" = "xyes"; then
1440 build_libstubgss=yes
1441fi
1442
1443AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1444
1445dnl -------------------------------------------------------------
1446dnl parse --with-default-ssl-backend so it can be validated below
1447dnl -------------------------------------------------------------
1448
1449DEFAULT_SSL_BACKEND=no
1450VALID_DEFAULT_SSL_BACKEND=
1451AC_ARG_WITH(default-ssl-backend,
1452AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1453AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1454 [DEFAULT_SSL_BACKEND=$withval])
1455case "$DEFAULT_SSL_BACKEND" in
1456 no)
1457 dnl --without-default-ssl-backend option used
1458 ;;
1459 default|yes)
1460 dnl --with-default-ssl-backend option used without name
1461 AC_MSG_ERROR([The name of the default SSL backend is required.])
1462 ;;
1463 *)
1464 dnl --with-default-ssl-backend option used with name
1465 AC_SUBST(DEFAULT_SSL_BACKEND)
1466 dnl needs to be validated below
1467 VALID_DEFAULT_SSL_BACKEND=no
1468 ;;
1469esac
1470
1471dnl **********************************************************************
1472
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001473dnl -------------------------------------------------
1474dnl check winssl option before other SSL libraries
1475dnl -------------------------------------------------
1476
1477OPT_WINSSL=no
1478AC_ARG_WITH(winssl,dnl
1479AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1480AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1481 OPT_WINSSL=$withval)
1482
Haibo Huang51d9d882019-02-06 01:36:06 -08001483AC_ARG_WITH(schannel,dnl
1484AC_HELP_STRING([--with-schannel],[enable Windows native SSL/TLS])
1485AC_HELP_STRING([--without-schannel], [disable Windows native SSL/TLS]),
1486 OPT_WINSSL=$withval)
1487
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001488AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
Alex Deymo486467e2017-12-19 19:04:07 +01001489if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1490 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001491 if test "x$OPT_WINSSL" != "xno" &&
Alex Deymod15eaac2016-06-28 14:49:26 -07001492 test "x$curl_cv_native_windows" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001493 AC_MSG_RESULT(yes)
1494 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1495 AC_SUBST(USE_SCHANNEL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001496 ssl_msg="Windows-native"
1497 test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001498 WINSSL_ENABLED=1
1499 # --with-winssl implies --enable-sspi
1500 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1501 AC_SUBST(USE_WINDOWS_SSPI, [1])
1502 curl_sspi_msg="enabled"
Alex Deymoe3149cc2016-10-05 11:18:42 -07001503 LIBS="-lcrypt32 $LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001504 else
1505 AC_MSG_RESULT(no)
1506 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001507 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001508else
1509 AC_MSG_RESULT(no)
1510fi
1511
1512OPT_DARWINSSL=no
1513AC_ARG_WITH(darwinssl,dnl
Elliott Hughescee03382017-06-23 12:17:18 -07001514AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1515AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001516 OPT_DARWINSSL=$withval)
1517
Elliott Hughescee03382017-06-23 12:17:18 -07001518AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS])
Alex Deymo486467e2017-12-19 19:04:07 +01001519if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001520 if test "x$OPT_DARWINSSL" != "xno" &&
1521 test -d "/System/Library/Frameworks/Security.framework"; then
1522 AC_MSG_RESULT(yes)
Elliott Hughescee03382017-06-23 12:17:18 -07001523 AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001524 AC_SUBST(USE_DARWINSSL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001525 ssl_msg="Apple OS-native"
1526 test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001527 DARWINSSL_ENABLED=1
1528 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1529 else
1530 AC_MSG_RESULT(no)
1531 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001532 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001533else
1534 AC_MSG_RESULT(no)
1535fi
1536
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001537dnl **********************************************************************
1538dnl Check for the presence of SSL libraries and headers
1539dnl **********************************************************************
1540
1541dnl Default to compiler & linker defaults for SSL files & libraries.
1542OPT_SSL=off
1543dnl Default to no CA bundle
1544ca="no"
1545AC_ARG_WITH(ssl,dnl
1546AC_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])
1547AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1548 OPT_SSL=$withval)
1549
Alex Deymo486467e2017-12-19 19:04:07 +01001550if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1551 test X"$OPT_SSL" != Xno; then
1552 ssl_msg=
1553
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001554 dnl backup the pre-ssl variables
1555 CLEANLDFLAGS="$LDFLAGS"
1556 CLEANCPPFLAGS="$CPPFLAGS"
1557 CLEANLIBS="$LIBS"
1558
Alex Deymod15eaac2016-06-28 14:49:26 -07001559 dnl This is for Msys/Mingw
1560 case $host in
1561 *-*-msys* | *-*-mingw*)
1562 AC_MSG_CHECKING([for gdi32])
1563 my_ac_save_LIBS=$LIBS
1564 LIBS="-lgdi32 $LIBS"
1565 AC_TRY_LINK([#include <windef.h>
1566 #include <wingdi.h>],
1567 [GdiFlush();],
1568 [ dnl worked!
1569 AC_MSG_RESULT([yes])],
1570 [ dnl failed, restore LIBS
1571 LIBS=$my_ac_save_LIBS
1572 AC_MSG_RESULT(no)]
1573 )
1574 ;;
1575 esac
1576
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001577 case "$OPT_SSL" in
1578 yes)
1579 dnl --with-ssl (without path) used
1580 if test x$cross_compiling != xyes; then
1581 dnl only do pkg-config magic when not cross-compiling
1582 PKGTEST="yes"
1583 fi
1584 PREFIX_OPENSSL=/usr/local/ssl
1585 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1586 ;;
1587 off)
1588 dnl no --with-ssl option given, just check default places
1589 if test x$cross_compiling != xyes; then
1590 dnl only do pkg-config magic when not cross-compiling
1591 PKGTEST="yes"
1592 fi
1593 PREFIX_OPENSSL=
1594 ;;
1595 *)
1596 dnl check the given --with-ssl spot
1597 PKGTEST="no"
1598 PREFIX_OPENSSL=$OPT_SSL
1599
1600 dnl Try pkg-config even when cross-compiling. Since we
1601 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1602 dnl the user told us to look
1603 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001604 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Elliott Hughes72d948d2018-08-03 14:37:21 -07001605 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001606 PKGTEST="yes"
Elliott Hughes72d948d2018-08-03 14:37:21 -07001607 elif test ! -f "$PREFIX_OPENSSL/include/openssl/ssl.h"; then
1608 AC_MSG_ERROR([$PREFIX_OPENSSL is a bad --with-ssl prefix!])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001609 fi
1610
1611 dnl in case pkg-config comes up empty, use what we got
1612 dnl via --with-ssl
1613 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1614 if test "$PREFIX_OPENSSL" != "/usr" ; then
1615 SSL_LDFLAGS="-L$LIB_OPENSSL"
1616 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1617 fi
1618 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1619 ;;
1620 esac
1621
1622 if test "$PKGTEST" = "yes"; then
1623
1624 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1625
1626 if test "$PKGCONFIG" != "no" ; then
1627 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
Haibo Huang21926d52019-01-08 14:27:10 -08001628 $PKGCONFIG --libs-only-l --libs-only-other openssl 2>/dev/null`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001629
1630 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1631 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1632
1633 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1634 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1635
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001636 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001637 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1638 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1639 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1640
1641 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1642
1643 dnl use the values pkg-config reported. This is here
1644 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1645 dnl learn about this via pkg-config. If we only have
1646 dnl the argument to --with-ssl we don't know what
1647 dnl additional libs may be necessary. Hope that we
1648 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001649 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001650 fi
1651 fi
1652
1653 dnl finally, set flags to use SSL
1654 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1655 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1656
Alex Deymod15eaac2016-06-28 14:49:26 -07001657 AC_CHECK_LIB(crypto, HMAC_Update,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001658 HAVECRYPTO="yes"
1659 LIBS="-lcrypto $LIBS"
1660 ],[
1661 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
Elliott Hughesb1ef70f2018-10-30 11:28:38 -07001662 if test "$PKGCONFIG" = "no" ; then
1663 # only set this if pkg-config wasn't used
1664 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1665 fi
Alex Deymod15eaac2016-06-28 14:49:26 -07001666 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001667 HAVECRYPTO="yes"
1668 LIBS="-lcrypto $LIBS"], [
Elliott Hughes82be86d2017-09-20 17:00:17 -07001669
1670 dnl still no, but what about with -ldl?
1671 AC_MSG_CHECKING([OpenSSL linking with -ldl])
Elliott Hughes72d948d2018-08-03 14:37:21 -07001672 LIBS="$CLEANLIBS -lcrypto -ldl"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001673 AC_TRY_LINK(
1674 [
1675 #include <openssl/err.h>
1676 ],
1677 [
1678 ERR_clear_error();
1679 ],
1680 [
1681 AC_MSG_RESULT(yes)
1682 HAVECRYPTO="yes"
1683 ],
1684 [
1685 AC_MSG_RESULT(no)
Elliott Hughes72d948d2018-08-03 14:37:21 -07001686 dnl ok, so what about both -ldl and -lpthread?
Elliott Hughes82be86d2017-09-20 17:00:17 -07001687
1688 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
Elliott Hughes72d948d2018-08-03 14:37:21 -07001689 LIBS="$CLEANLIBS -lcrypto -ldl -lpthread"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001690 AC_TRY_LINK(
1691 [
1692 #include <openssl/err.h>
1693 ],
1694 [
1695 ERR_clear_error();
1696 ],
1697 [
1698 AC_MSG_RESULT(yes)
1699 HAVECRYPTO="yes"
1700 ],
1701 [
1702 AC_MSG_RESULT(no)
1703 LDFLAGS="$CLEANLDFLAGS"
1704 CPPFLAGS="$CLEANCPPFLAGS"
1705 LIBS="$CLEANLIBS"
1706
1707 ])
1708
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001709 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001710
Elliott Hughes82be86d2017-09-20 17:00:17 -07001711 ])
1712 ])
Alex Deymod15eaac2016-06-28 14:49:26 -07001713
1714 if test X"$HAVECRYPTO" = X"yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001715 dnl This is only reasonable to do if crypto actually is there: check for
1716 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1717
1718 AC_CHECK_LIB(ssl, SSL_connect)
1719
1720 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1721 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1722 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1723 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001724 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001725 AC_CHECK_LIB(ssl, SSL_connect)
1726 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1727 dnl still no SSL_connect
1728 AC_MSG_RESULT(no)
1729 LIBS=$OLIBS
1730 else
1731 AC_MSG_RESULT(yes)
1732 fi
1733
1734 else
1735
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001736 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001737 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1738 openssl/pem.h openssl/ssl.h openssl/err.h,
Alex Deymo486467e2017-12-19 19:04:07 +01001739 ssl_msg="OpenSSL"
1740 test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001741 OPENSSL_ENABLED=1
1742 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1743
1744 if test $ac_cv_header_openssl_x509_h = no; then
1745 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1746 dnl since 'err.h' might in fact find a krb4 header with the same
1747 dnl name
1748 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1749
1750 if test $ac_cv_header_x509_h = yes &&
1751 test $ac_cv_header_crypto_h = yes &&
1752 test $ac_cv_header_ssl_h = yes; then
1753 dnl three matches
Alex Deymo486467e2017-12-19 19:04:07 +01001754 ssl_msg="OpenSSL"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001755 OPENSSL_ENABLED=1
1756 fi
1757 fi
1758 fi
1759
Alex Deymo486467e2017-12-19 19:04:07 +01001760 if test X"$OPENSSL_ENABLED" != X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001761 LIBS="$CLEANLIBS"
1762 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001763
1764 if test X"$OPT_SSL" != Xoff &&
1765 test "$OPENSSL_ENABLED" != "1"; then
1766 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1767 fi
1768 fi
1769
1770 if test X"$OPENSSL_ENABLED" = X"1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001771 dnl These can only exist if OpenSSL exists
1772 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1773 dnl SSL_get_shutdown (but this check won't actually detect it there
1774 dnl as it's a macro that needs the header files be included)
Haibo Huang51d9d882019-02-06 01:36:06 -08001775 dnl OpenSSL_version is introduced in 3.0.0
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001776
Elliott Hughescee03382017-06-23 12:17:18 -07001777 AC_CHECK_FUNCS( RAND_egd \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001778 SSL_get_shutdown \
Haibo Huang51d9d882019-02-06 01:36:06 -08001779 SSLv2_client_method \
1780 OpenSSL_version )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001781
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001782 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001783 AC_COMPILE_IFELSE([
Alex Deymod15eaac2016-06-28 14:49:26 -07001784 AC_LANG_PROGRAM([[
1785 #include <openssl/base.h>
1786 ]],[[
1787 #ifndef OPENSSL_IS_BORINGSSL
1788 #error not boringssl
1789 #endif
1790 ]])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001791 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001792 AC_MSG_RESULT([yes])
1793 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1794 [Define to 1 if using BoringSSL.])
Alex Deymo486467e2017-12-19 19:04:07 +01001795 ssl_msg="BoringSSL"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001796 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001797 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001798 ])
1799
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001800 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001801 AC_COMPILE_IFELSE([
1802 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001803#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001804 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001805 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001806 ]])
1807 ],[
1808 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001809 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1810 [Define to 1 if using libressl.])
Alex Deymo486467e2017-12-19 19:04:07 +01001811 ssl_msg="libressl"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001812 ],[
1813 AC_MSG_RESULT([no])
1814 ])
1815 fi
1816
1817 if test "$OPENSSL_ENABLED" = "1"; then
1818 if test -n "$LIB_OPENSSL"; then
1819 dnl when the ssl shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001820 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001821 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001822 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001823 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_OPENSSL"
1824 export CURL_LIBRARY_PATH
1825 AC_MSG_NOTICE([Added $LIB_OPENSSL to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001826 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001827 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001828 CURL_CHECK_OPENSSL_API
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001829 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001830 fi
1831
Alex Deymo486467e2017-12-19 19:04:07 +01001832 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001833fi
1834
1835dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001836dnl Check for the random seed preferences
1837dnl **********************************************************************
1838
1839if test X"$OPENSSL_ENABLED" = X"1"; then
1840 AC_ARG_WITH(egd-socket,
1841 AC_HELP_STRING([--with-egd-socket=FILE],
1842 [Entropy Gathering Daemon socket pathname]),
1843 [ EGD_SOCKET="$withval" ]
1844 )
1845 if test -n "$EGD_SOCKET" ; then
1846 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1847 [your Entropy Gathering Daemon socket pathname] )
1848 fi
1849
1850 dnl Check for user-specified random device
1851 AC_ARG_WITH(random,
1852 AC_HELP_STRING([--with-random=FILE],
1853 [read randomness from FILE (default=/dev/urandom)]),
1854 [ RANDOM_FILE="$withval" ],
1855 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001856 if test x$cross_compiling != xyes; then
1857 dnl Check for random device
1858 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1859 else
1860 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1861 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001862 ]
1863 )
1864 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1865 AC_SUBST(RANDOM_FILE)
1866 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1867 [a suitable file to read random data from])
1868 fi
1869fi
1870
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001871dnl ---
1872dnl We require OpenSSL with SRP support.
1873dnl ---
1874if test "$OPENSSL_ENABLED" = "1"; then
1875 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1876 [
1877 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1878 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1879 ])
1880fi
1881
Elliott Hughesa93fb052018-12-12 14:22:48 -08001882dnl ---
1883dnl Whether the OpenSSL configuration will be loaded automatically
1884dnl ---
1885if test X"$OPENSSL_ENABLED" = X"1"; then
1886AC_ARG_ENABLE(openssl-auto-load-config,
1887AC_HELP_STRING([--enable-openssl-auto-load-config],[Enable automatic loading of OpenSSL configuration])
1888AC_HELP_STRING([--disable-openssl-auto-load-config],[Disable automatic loading of OpenSSL configuration]),
1889[ if test X"$enableval" = X"no"; then
1890 AC_MSG_NOTICE([automatic loading of OpenSSL configuration disabled])
1891 AC_DEFINE(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG, 1, [if the OpenSSL configuration won't be loaded automatically])
1892 fi
1893])
1894fi
1895
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001896dnl ----------------------------------------------------
1897dnl check for GnuTLS
1898dnl ----------------------------------------------------
1899
1900dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1901OPT_GNUTLS=no
1902
1903AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001904AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001905AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1906 OPT_GNUTLS=$withval)
1907
Alex Deymo486467e2017-12-19 19:04:07 +01001908if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1909 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001910
1911 if test X"$OPT_GNUTLS" != Xno; then
1912
1913 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001914 addlib=""
1915 gtlslib=""
1916 version=""
1917 addcflags=""
1918
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001919 if test "x$OPT_GNUTLS" = "xyes"; then
1920 dnl this is with no partiular path given
1921 CURL_CHECK_PKGCONFIG(gnutls)
1922
1923 if test "$PKGCONFIG" != "no" ; then
1924 addlib=`$PKGCONFIG --libs-only-l gnutls`
1925 addld=`$PKGCONFIG --libs-only-L gnutls`
1926 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1927 version=`$PKGCONFIG --modversion gnutls`
1928 gtlslib=`echo $addld | $SED -e 's/-L//'`
1929 else
1930 dnl without pkg-config, we try libgnutls-config as that was how it
1931 dnl used to be done
1932 check=`libgnutls-config --version 2>/dev/null`
1933 if test -n "$check"; then
1934 addlib=`libgnutls-config --libs`
1935 addcflags=`libgnutls-config --cflags`
1936 version=`libgnutls-config --version`
1937 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1938 fi
1939 fi
1940 else
1941 dnl this is with a given path, first check if there's a libgnutls-config
1942 dnl there and if not, make an educated guess
1943 cfg=$OPT_GNUTLS/bin/libgnutls-config
1944 check=`$cfg --version 2>/dev/null`
1945 if test -n "$check"; then
1946 addlib=`$cfg --libs`
1947 addcflags=`$cfg --cflags`
1948 version=`$cfg --version`
1949 gtlslib=`$cfg --prefix`/lib$libsuff
1950 else
1951 dnl without pkg-config and libgnutls-config, we guess a lot!
1952 addlib=-lgnutls
1953 addld=-L$OPT_GNUTLS/lib$libsuff
1954 addcflags=-I$OPT_GNUTLS/include
1955 version="" # we just don't know
1956 gtlslib=$OPT_GNUTLS/lib$libsuff
1957 fi
1958 fi
1959
1960 if test -z "$version"; then
1961 dnl lots of efforts, still no go
1962 version="unknown"
1963 fi
1964
1965 if test -n "$addlib"; then
1966
1967 CLEANLIBS="$LIBS"
1968 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001969 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001970
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001971 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001972 LDFLAGS="$LDFLAGS $addld"
1973 if test "$addcflags" != "-I/usr/include"; then
1974 CPPFLAGS="$CPPFLAGS $addcflags"
1975 fi
1976
1977 AC_CHECK_LIB(gnutls, gnutls_check_version,
1978 [
1979 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1980 AC_SUBST(USE_GNUTLS, [1])
1981 GNUTLS_ENABLED=1
1982 USE_GNUTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01001983 ssl_msg="GnuTLS"
1984 test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001985 ],
1986 [
1987 LIBS="$CLEANLIBS"
1988 CPPFLAGS="$CLEANCPPFLAGS"
1989 ])
1990
1991 if test "x$USE_GNUTLS" = "xyes"; then
1992 AC_MSG_NOTICE([detected GnuTLS version $version])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001993 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001994 if test -n "$gtlslib"; then
1995 dnl when shared libs were found in a path that the run-time
1996 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001997 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001998 dnl due to this
Alex Deymo486467e2017-12-19 19:04:07 +01001999 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002000 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$gtlslib"
2001 export CURL_LIBRARY_PATH
2002 AC_MSG_NOTICE([Added $gtlslib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002003 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002004 fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07002005 AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002006 fi
2007
2008 fi
2009
2010 fi dnl GNUTLS not disabled
2011
Alex Deymo486467e2017-12-19 19:04:07 +01002012 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002013fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002014
2015dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002016dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002017dnl ---
2018
2019if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002020 USE_GNUTLS_NETTLE=
2021 # First check if we can detect either crypto library via transitive linking
2022 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2023 if test "$USE_GNUTLS_NETTLE" = ""; then
2024 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2025 fi
2026 # If not, try linking directly to both of them to see if they are available
2027 if test "$USE_GNUTLS_NETTLE" = ""; then
2028 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2029 fi
2030 if test "$USE_GNUTLS_NETTLE" = ""; then
2031 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2032 fi
2033 if test "$USE_GNUTLS_NETTLE" = ""; then
2034 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
2035 fi
2036 if test "$USE_GNUTLS_NETTLE" = "1"; then
2037 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
2038 AC_SUBST(USE_GNUTLS_NETTLE, [1])
2039 LIBS="-lnettle $LIBS"
2040 else
2041 LIBS="-lgcrypt $LIBS"
2042 fi
2043fi
2044
2045dnl ---
2046dnl We require GnuTLS with SRP support.
2047dnl ---
2048if test "$GNUTLS_ENABLED" = "1"; then
2049 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
2050 [
2051 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
2052 AC_SUBST(HAVE_GNUTLS_SRP, [1])
2053 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002054fi
2055
2056dnl ----------------------------------------------------
2057dnl check for PolarSSL
2058dnl ----------------------------------------------------
2059
2060dnl Default to compiler & linker defaults for PolarSSL files & libraries.
2061OPT_POLARSSL=no
2062
2063_cppflags=$CPPFLAGS
2064_ldflags=$LDFLAGS
2065AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002066AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002067AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
2068 OPT_POLARSSL=$withval)
2069
Alex Deymo486467e2017-12-19 19:04:07 +01002070if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then
2071 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002072
2073 if test X"$OPT_POLARSSL" != Xno; then
2074
2075 if test "$OPT_POLARSSL" = "yes"; then
2076 OPT_POLARSSL=""
2077 fi
2078
2079 if test -z "$OPT_POLARSSL" ; then
2080 dnl check for lib first without setting any new path
2081
2082 AC_CHECK_LIB(polarssl, havege_init,
2083 dnl libpolarssl found, set the variable
2084 [
2085 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2086 AC_SUBST(USE_POLARSSL, [1])
2087 POLARSSL_ENABLED=1
2088 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002089 ssl_msg="PolarSSL"
2090 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002091 ])
2092 fi
2093
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002094 addld=""
2095 addlib=""
2096 addcflags=""
2097 polarssllib=""
2098
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002099 if test "x$USE_POLARSSL" != "xyes"; then
2100 dnl add the path and test again
2101 addld=-L$OPT_POLARSSL/lib$libsuff
2102 addcflags=-I$OPT_POLARSSL/include
2103 polarssllib=$OPT_POLARSSL/lib$libsuff
2104
2105 LDFLAGS="$LDFLAGS $addld"
2106 if test "$addcflags" != "-I/usr/include"; then
2107 CPPFLAGS="$CPPFLAGS $addcflags"
2108 fi
2109
2110 AC_CHECK_LIB(polarssl, ssl_init,
2111 [
2112 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2113 AC_SUBST(USE_POLARSSL, [1])
2114 POLARSSL_ENABLED=1
2115 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002116 ssl_msg="PolarSSL"
2117 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002118 ],
2119 [
2120 CPPFLAGS=$_cppflags
2121 LDFLAGS=$_ldflags
2122 ])
2123 fi
2124
2125 if test "x$USE_POLARSSL" = "xyes"; then
2126 AC_MSG_NOTICE([detected PolarSSL])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002127 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002128 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002129
2130 if test -n "$polarssllib"; then
2131 dnl when shared libs were found in a path that the run-time
2132 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002133 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002134 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002135 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002136 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$polarssllib"
2137 export CURL_LIBRARY_PATH
2138 AC_MSG_NOTICE([Added $polarssllib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002139 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002140 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002141 fi
2142
2143 fi dnl PolarSSL not disabled
2144
Alex Deymo486467e2017-12-19 19:04:07 +01002145 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002146fi
2147
2148dnl ----------------------------------------------------
Alex Deymod15eaac2016-06-28 14:49:26 -07002149dnl check for mbedTLS
2150dnl ----------------------------------------------------
2151
2152OPT_MBEDTLS=no
2153
2154_cppflags=$CPPFLAGS
2155_ldflags=$LDFLAGS
2156AC_ARG_WITH(mbedtls,dnl
2157AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2158AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2159 OPT_MBEDTLS=$withval)
2160
Alex Deymo486467e2017-12-19 19:04:07 +01002161if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2162 ssl_msg=
Alex Deymod15eaac2016-06-28 14:49:26 -07002163
2164 if test X"$OPT_MBEDTLS" != Xno; then
2165
2166 if test "$OPT_MBEDTLS" = "yes"; then
2167 OPT_MBEDTLS=""
2168 fi
2169
2170 if test -z "$OPT_MBEDTLS" ; then
2171 dnl check for lib first without setting any new path
2172
2173 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2174 dnl libmbedtls found, set the variable
2175 [
2176 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2177 AC_SUBST(USE_MBEDTLS, [1])
2178 MBEDTLS_ENABLED=1
2179 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002180 ssl_msg="mbedTLS"
2181 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002182 ], [], -lmbedx509 -lmbedcrypto)
2183 fi
2184
2185 addld=""
2186 addlib=""
2187 addcflags=""
2188 mbedtlslib=""
2189
2190 if test "x$USE_MBEDTLS" != "xyes"; then
2191 dnl add the path and test again
2192 addld=-L$OPT_MBEDTLS/lib$libsuff
2193 addcflags=-I$OPT_MBEDTLS/include
2194 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2195
2196 LDFLAGS="$LDFLAGS $addld"
2197 if test "$addcflags" != "-I/usr/include"; then
2198 CPPFLAGS="$CPPFLAGS $addcflags"
2199 fi
2200
2201 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2202 [
2203 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2204 AC_SUBST(USE_MBEDTLS, [1])
2205 MBEDTLS_ENABLED=1
2206 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002207 ssl_msg="mbedTLS"
2208 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002209 ],
2210 [
2211 CPPFLAGS=$_cppflags
2212 LDFLAGS=$_ldflags
2213 ], -lmbedx509 -lmbedcrypto)
2214 fi
2215
2216 if test "x$USE_MBEDTLS" = "xyes"; then
2217 AC_MSG_NOTICE([detected mbedTLS])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002218 check_for_ca_bundle=1
Alex Deymod15eaac2016-06-28 14:49:26 -07002219
2220 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2221
2222 if test -n "$mbedtlslib"; then
2223 dnl when shared libs were found in a path that the run-time
2224 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002225 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Alex Deymod15eaac2016-06-28 14:49:26 -07002226 dnl due to this
2227 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002228 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$mbedtlslib"
2229 export CURL_LIBRARY_PATH
2230 AC_MSG_NOTICE([Added $mbedtlslib to CURL_LIBRARY_PATH])
Alex Deymod15eaac2016-06-28 14:49:26 -07002231 fi
2232 fi
2233 fi
2234
2235 fi dnl mbedTLS not disabled
2236
Alex Deymo486467e2017-12-19 19:04:07 +01002237 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Alex Deymod15eaac2016-06-28 14:49:26 -07002238fi
2239
2240dnl ----------------------------------------------------
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002241dnl check for CyaSSL
2242dnl ----------------------------------------------------
2243
2244dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2245OPT_CYASSL=no
2246
2247_cppflags=$CPPFLAGS
2248_ldflags=$LDFLAGS
2249AC_ARG_WITH(cyassl,dnl
2250AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2251AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2252 OPT_CYASSL=$withval)
2253
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002254dnl provide --with-wolfssl as an alias for --with-cyassl
2255AC_ARG_WITH(wolfssl,dnl
2256AC_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)])
2257AC_HELP_STRING([--without-wolfssl], [disable WolfSSL detection]),
2258 OPT_CYASSL=$withval)
2259
Alex Deymo486467e2017-12-19 19:04:07 +01002260if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then
2261 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002262
2263 if test X"$OPT_CYASSL" != Xno; then
2264
2265 if test "$OPT_CYASSL" = "yes"; then
2266 OPT_CYASSL=""
2267 fi
2268
2269 dnl This should be reworked to use pkg-config instead
2270
2271 cyassllibname=cyassl
2272
2273 if test -z "$OPT_CYASSL" ; then
2274 dnl check for lib in system default first
2275
2276 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2277 dnl libcyassl found, set the variable
2278 [
2279 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2280 AC_SUBST(USE_CYASSL, [1])
2281 CYASSL_ENABLED=1
2282 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002283 ssl_msg="CyaSSL"
2284 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002285 ])
2286 fi
2287
2288 addld=""
2289 addlib=""
2290 addcflags=""
2291 cyassllib=""
2292
2293 if test "x$USE_CYASSL" != "xyes"; then
2294 dnl add the path and test again
2295 addld=-L$OPT_CYASSL/lib$libsuff
2296 addcflags=-I$OPT_CYASSL/include
2297 cyassllib=$OPT_CYASSL/lib$libsuff
2298
2299 LDFLAGS="$LDFLAGS $addld"
2300 if test "$addcflags" != "-I/usr/include"; then
2301 CPPFLAGS="$CPPFLAGS $addcflags"
2302 fi
2303
2304 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2305 [
2306 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2307 AC_SUBST(USE_CYASSL, [1])
2308 CYASSL_ENABLED=1
2309 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002310 ssl_msg="CyaSSL"
2311 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002312 ],
2313 [
2314 CPPFLAGS=$_cppflags
2315 LDFLAGS=$_ldflags
2316 cyassllib=""
2317 ])
2318 fi
2319
2320 addld=""
2321 addlib=""
2322 addcflags=""
2323
2324 if test "x$USE_CYASSL" != "xyes"; then
2325 dnl libcyassl renamed to libwolfssl as of 3.4.0
2326 addld=-L$OPT_CYASSL/lib$libsuff
2327 addcflags=-I$OPT_CYASSL/include
2328 cyassllib=$OPT_CYASSL/lib$libsuff
2329
2330 LDFLAGS="$LDFLAGS $addld"
2331 if test "$addcflags" != "-I/usr/include"; then
2332 CPPFLAGS="$CPPFLAGS $addcflags"
2333 fi
2334
2335 cyassllibname=wolfssl
2336 my_ac_save_LIBS="$LIBS"
2337 LIBS="-l$cyassllibname -lm $LIBS"
2338
2339 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2340 AC_LINK_IFELSE([
2341 AC_LANG_PROGRAM([[
2342/* These aren't needed for detection and confuse WolfSSL.
2343 They are set up properly later if it is detected. */
2344#undef SIZEOF_LONG
2345#undef SIZEOF_LONG_LONG
2346#include <cyassl/ssl.h>
2347 ]],[[
2348 return CyaSSL_Init();
2349 ]])
2350 ],[
2351 AC_MSG_RESULT(yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07002352 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002353 AC_SUBST(USE_CYASSL, [1])
2354 CYASSL_ENABLED=1
2355 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002356 ssl_msg="WolfSSL"
2357 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002358 ],
2359 [
2360 AC_MSG_RESULT(no)
2361 CPPFLAGS=$_cppflags
2362 LDFLAGS=$_ldflags
2363 cyassllib=""
2364 ])
2365 LIBS="$my_ac_save_LIBS"
2366 fi
2367
2368 if test "x$USE_CYASSL" = "xyes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07002369 AC_MSG_NOTICE([detected $cyassllibname])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002370 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002371
2372 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
Elliott Hughes72d948d2018-08-03 14:37:21 -07002373 AX_COMPILE_CHECK_SIZEOF(long long)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002374
2375 dnl Versions since at least 2.6.0 may have options.h
2376 AC_CHECK_HEADERS(cyassl/options.h)
2377
2378 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2379 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2380
2381 LIBS="-l$cyassllibname -lm $LIBS"
2382
Alex Deymod15eaac2016-06-28 14:49:26 -07002383 if test "x$cyassllibname" = "xwolfssl"; then
2384 dnl Recent WolfSSL versions build without SSLv3 by default
2385 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2386 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2387 wolfSSL_CTX_UseSupportedCurve \
2388 wolfSSL_get_peer_certificate \
2389 wolfSSL_UseALPN)
2390 else
2391 dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2392 AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2393 CyaSSL_get_peer_certificate)
2394 fi
2395
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002396 if test -n "$cyassllib"; then
2397 dnl when shared libs were found in a path that the run-time
2398 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002399 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002400 dnl due to this
2401 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002402 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$cyassllib"
2403 export CURL_LIBRARY_PATH
2404 AC_MSG_NOTICE([Added $cyassllib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002405 fi
2406 fi
2407
2408 fi
2409
2410 fi dnl CyaSSL not disabled
2411
Alex Deymo486467e2017-12-19 19:04:07 +01002412 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002413fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002414
2415dnl ----------------------------------------------------
Elliott Hughesa93fb052018-12-12 14:22:48 -08002416dnl check for MesaLink
2417dnl ----------------------------------------------------
2418
2419dnl Default to compiler & linker defaults for MesaLink files & libraries.
2420OPT_MESALINK=no
2421
2422_cppflags=$CPPFLAGS
2423_ldflags=$LDFLAGS
2424AC_ARG_WITH(mesalink,dnl
2425AC_HELP_STRING([--with-mesalink=PATH],[where to look for MesaLink, PATH points to the installation root])
2426AC_HELP_STRING([--without-mesalink], [disable MesaLink detection]),
2427 OPT_MESALINK=$withval)
2428
2429if test -z "$ssl_backends" -o "x$OPT_MESALINK" != xno; then
2430 ssl_msg=
2431
2432 if test X"$OPT_MESALINK" != Xno; then
2433
2434 if test "$OPT_MESALINK" = "yes"; then
2435 OPT_MESALINK=""
2436 fi
2437
2438 if test -z "$OPT_MESALINK" ; then
2439 dnl check for lib first without setting any new path
2440
2441 AC_CHECK_LIB(mesalink, mesalink_library_init,
2442 dnl libmesalink found, set the variable
2443 [
2444 AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2445 AC_SUBST(USE_MESALINK, [1])
2446 MESALINK_ENABLED=1
2447 USE_MESALINK="yes"
2448 ssl_msg="MesaLink"
2449 test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2450 ])
2451 fi
2452
2453 addld=""
2454 addlib=""
2455 addcflags=""
2456 mesalinklib=""
2457
2458 if test "x$USE_MESALINK" != "xyes"; then
2459 dnl add the path and test again
2460 addld=-L$OPT_MESALINK/lib$libsuff
2461 addcflags=-I$OPT_MESALINK/include
2462 mesalinklib=$OPT_MESALINK/lib$libsuff
2463
2464 LDFLAGS="$LDFLAGS $addld"
2465 if test "$addcflags" != "-I/usr/include"; then
2466 CPPFLAGS="$CPPFLAGS $addcflags"
2467 fi
2468
2469 AC_CHECK_LIB(mesalink, mesalink_library_init,
2470 [
2471 AC_DEFINE(USE_MESALINK, 1, [if MesaLink is enabled])
2472 AC_SUBST(USE_MESALINK, [1])
2473 MESALINK_ENABLED=1
2474 USE_MESALINK="yes"
2475 ssl_msg="MesaLink"
2476 test mesalink != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
2477 ],
2478 [
2479 CPPFLAGS=$_cppflags
2480 LDFLAGS=$_ldflags
2481 ])
2482 fi
2483
2484 if test "x$USE_MESALINK" = "xyes"; then
2485 AC_MSG_NOTICE([detected MesaLink])
2486
2487 LIBS="-lmesalink $LIBS"
2488
2489 if test -n "$mesalinklib"; then
2490 dnl when shared libs were found in a path that the run-time
2491 dnl linker doesn't search through, we need to add it to
2492 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2493 dnl due to this
2494 if test "x$cross_compiling" != "xyes"; then
2495 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mesalinklib"
2496 export LD_LIBRARY_PATH
2497 AC_MSG_NOTICE([Added $mesalinklib to LD_LIBRARY_PATH])
2498 fi
2499 fi
2500 fi
2501
2502 fi dnl MesaLink not disabled
2503
2504 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2505fi
2506
2507dnl ----------------------------------------------------
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002508dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2509dnl ----------------------------------------------------
2510
2511dnl Default to compiler & linker defaults for NSS files & libraries.
2512OPT_NSS=no
2513
2514AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002515AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002516AC_HELP_STRING([--without-nss], [disable NSS detection]),
2517 OPT_NSS=$withval)
2518
Alex Deymo486467e2017-12-19 19:04:07 +01002519if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2520 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002521
2522 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002523
2524 addld=""
2525 addlib=""
2526 addcflags=""
2527 nssprefix=""
2528 version=""
2529
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002530 if test "x$OPT_NSS" = "xyes"; then
2531
2532 CURL_CHECK_PKGCONFIG(nss)
2533
2534 if test "$PKGCONFIG" != "no" ; then
2535 addlib=`$PKGCONFIG --libs nss`
2536 addcflags=`$PKGCONFIG --cflags nss`
2537 version=`$PKGCONFIG --modversion nss`
2538 nssprefix=`$PKGCONFIG --variable=prefix nss`
2539 else
2540 dnl Without pkg-config, we check for nss-config
2541
2542 check=`nss-config --version 2>/dev/null`
2543 if test -n "$check"; then
2544 addlib=`nss-config --libs`
2545 addcflags=`nss-config --cflags`
2546 version=`nss-config --version`
2547 nssprefix=`nss-config --prefix`
2548 else
2549 addlib="-lnss3"
2550 addcflags=""
2551 version="unknown"
2552 fi
2553 fi
2554 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002555 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2556 if test -f "$NSS_PCDIR/nss.pc"; then
2557 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2558 if test "$PKGCONFIG" != "no" ; then
2559 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2560 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2561 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2562 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2563 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2564 fi
2565 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002566 fi
2567
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002568 if test -z "$addlib"; then
2569 # Without pkg-config, we'll kludge in some defaults
2570 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2571 addld="-L$OPT_NSS/lib"
2572 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2573 addcflags="-I$OPT_NSS/include"
2574 version="unknown"
2575 nssprefix=$OPT_NSS
2576 fi
2577
2578 CLEANLDFLAGS="$LDFLAGS"
2579 CLEANLIBS="$LIBS"
2580 CLEANCPPFLAGS="$CPPFLAGS"
2581
2582 LDFLAGS="$addld $LDFLAGS"
2583 LIBS="$addlib $LIBS"
2584 if test "$addcflags" != "-I/usr/include"; then
2585 CPPFLAGS="$CPPFLAGS $addcflags"
2586 fi
2587
2588 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2589 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002590 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002591 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2592 AC_SUBST(USE_NSS, [1])
2593 USE_NSS="yes"
2594 NSS_ENABLED=1
Alex Deymo486467e2017-12-19 19:04:07 +01002595 ssl_msg="NSS"
2596 test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002597 ],
2598 [
2599 LDFLAGS="$CLEANLDFLAGS"
2600 LIBS="$CLEANLIBS"
2601 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002602 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002603
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002604 if test "x$USE_NSS" = "xyes"; then
2605 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002606
Elliott Hughescac39802018-04-27 16:19:43 -07002607 dnl PK11_CreateManagedGenericObject() was introduced in NSS 3.34 because
2608 dnl PK11_DestroyGenericObject() does not release resources allocated by
2609 dnl PK11_CreateGenericObject() early enough.
2610 AC_CHECK_FUNC(PK11_CreateManagedGenericObject,
2611 [
2612 AC_DEFINE(HAVE_PK11_CREATEMANAGEDGENERICOBJECT, 1,
2613 [if you have the PK11_CreateManagedGenericObject function])
2614 ])
2615
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002616 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2617 NSS_LIBS=$addlib
2618 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002619
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002620 dnl when shared libs were found in a path that the run-time
2621 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002622 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002623 dnl due to this
2624 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002625 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$nssprefix/lib$libsuff"
2626 export CURL_LIBRARY_PATH
2627 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to CURL_LIBRARY_PATH])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002628 fi
2629
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002630 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002631
2632 fi dnl NSS not disabled
2633
Alex Deymo486467e2017-12-19 19:04:07 +01002634 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2635fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002636
Haibo Huang21926d52019-01-08 14:27:10 -08002637case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED$MESALINK_ENABLED" in
Alex Deymo486467e2017-12-19 19:04:07 +01002638x)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002639 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Haibo Huang21926d52019-01-08 14:27:10 -08002640 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-winssl, --with-darwinssl, or --with-mesalink to address this.])
Alex Deymo486467e2017-12-19 19:04:07 +01002641 ;;
2642x1)
2643 # one SSL backend is enabled
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002644 AC_SUBST(SSL_ENABLED)
2645 SSL_ENABLED="1"
Alex Deymo486467e2017-12-19 19:04:07 +01002646 AC_MSG_NOTICE([built with one SSL backend])
2647 ;;
2648*)
2649 # more than one SSL backend is enabled
2650 AC_SUBST(SSL_ENABLED)
2651 SSL_ENABLED="1"
2652 AC_SUBST(CURL_WITH_MULTI_SSL)
2653 CURL_WITH_MULTI_SSL="1"
2654 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2655 AC_MSG_NOTICE([built with multiple SSL backends])
2656 ;;
2657esac
2658
2659if test -n "$ssl_backends"; then
2660 curl_ssl_msg="enabled ($ssl_backends)"
2661fi
2662
2663if test no = "$VALID_DEFAULT_SSL_BACKEND"
2664then
2665 if test -n "$SSL_ENABLED"
2666 then
2667 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2668 else
2669 AC_MSG_ERROR([Default SSL backend requires SSL!])
2670 fi
2671elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2672then
2673 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002674fi
2675
2676dnl **********************************************************************
2677dnl Check for the CA bundle
2678dnl **********************************************************************
2679
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002680if test "$check_for_ca_bundle" -gt 0; then
2681 CURL_CHECK_CA_BUNDLE
2682fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002683
2684dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002685dnl Check for libpsl
2686dnl **********************************************************************
2687
2688AC_ARG_WITH(libpsl,
2689 AS_HELP_STRING([--without-libpsl],
2690 [disable support for libpsl cookie checking]),
2691 with_libpsl=$withval,
2692 with_libpsl=yes)
2693if test $with_libpsl != "no"; then
2694 AC_SEARCH_LIBS(psl_builtin, psl,
2695 [curl_psl_msg="yes";
2696 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2697 ],
2698 [curl_psl_msg="no (libpsl not found)";
2699 AC_MSG_WARN([libpsl was not found])
2700 ]
2701 )
2702fi
2703AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2704
2705dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002706dnl Check for libmetalink
2707dnl **********************************************************************
2708
2709OPT_LIBMETALINK=no
2710
2711AC_ARG_WITH(libmetalink,dnl
2712AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2713AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2714 OPT_LIBMETALINK=$withval)
2715
2716if test X"$OPT_LIBMETALINK" != Xno; then
2717
2718 addld=""
2719 addlib=""
2720 addcflags=""
2721 version=""
2722 libmetalinklib=""
2723
2724 PKGTEST="no"
2725 if test "x$OPT_LIBMETALINK" = "xyes"; then
2726 dnl this is with no partiular path given
2727 PKGTEST="yes"
2728 CURL_CHECK_PKGCONFIG(libmetalink)
2729 else
2730 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2731 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2732 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2733 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2734 PKGTEST="yes"
2735 fi
2736 if test "$PKGTEST" = "yes"; then
2737 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2738 fi
2739 fi
2740 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2741 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2742 $PKGCONFIG --libs-only-l libmetalink`
2743 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2744 $PKGCONFIG --libs-only-L libmetalink`
2745 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2746 $PKGCONFIG --cflags-only-I libmetalink`
2747 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2748 $PKGCONFIG --modversion libmetalink`
2749 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2750 fi
2751 if test -n "$addlib"; then
2752
2753 clean_CPPFLAGS="$CPPFLAGS"
2754 clean_LDFLAGS="$LDFLAGS"
2755 clean_LIBS="$LIBS"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002756 CPPFLAGS="$clean_CPPFLAGS $addcflags"
2757 LDFLAGS="$clean_LDFLAGS $addld"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002758 LIBS="$addlib $clean_LIBS"
2759 AC_MSG_CHECKING([if libmetalink is recent enough])
2760 AC_LINK_IFELSE([
2761 AC_LANG_PROGRAM([[
2762# include <metalink/metalink.h>
2763 ]],[[
2764 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2765 return 1;
2766 ]])
2767 ],[
2768 AC_MSG_RESULT([yes ($version)])
2769 want_metalink="yes"
2770 ],[
2771 AC_MSG_RESULT([no ($version)])
2772 AC_MSG_NOTICE([libmetalink library defective or too old])
2773 want_metalink="no"
2774 ])
2775 CPPFLAGS="$clean_CPPFLAGS"
2776 LDFLAGS="$clean_LDFLAGS"
2777 LIBS="$clean_LIBS"
2778 if test "$want_metalink" = "yes"; then
2779 dnl finally libmetalink will be used
2780 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2781 LIBMETALINK_LIBS=$addlib
2782 LIBMETALINK_LDFLAGS=$addld
2783 LIBMETALINK_CPPFLAGS=$addcflags
2784 AC_SUBST([LIBMETALINK_LIBS])
2785 AC_SUBST([LIBMETALINK_LDFLAGS])
2786 AC_SUBST([LIBMETALINK_CPPFLAGS])
2787 curl_mtlnk_msg="enabled"
2788 fi
2789
2790 fi
2791fi
2792
2793dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002794dnl Check for the presence of LIBSSH2 libraries and headers
2795dnl **********************************************************************
2796
2797dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2798OPT_LIBSSH2=off
2799AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002800AC_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 -08002801AC_HELP_STRING([--with-libssh2], [enable LIBSSH2]),
2802 OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
2803
2804
2805OPT_LIBSSH=off
2806AC_ARG_WITH(libssh,dnl
2807AC_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])
2808AC_HELP_STRING([--with-libssh], [enable LIBSSH]),
2809 OPT_LIBSSH=$withval, OPT_LIBSSH=no)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002810
2811if test X"$OPT_LIBSSH2" != Xno; then
2812 dnl backup the pre-libssh2 variables
2813 CLEANLDFLAGS="$LDFLAGS"
2814 CLEANCPPFLAGS="$CPPFLAGS"
2815 CLEANLIBS="$LIBS"
2816
2817 case "$OPT_LIBSSH2" in
2818 yes)
2819 dnl --with-libssh2 (without path) used
2820 CURL_CHECK_PKGCONFIG(libssh2)
2821
2822 if test "$PKGCONFIG" != "no" ; then
Elliott Hughes72d948d2018-08-03 14:37:21 -07002823 LIB_SSH2=`$PKGCONFIG --libs libssh2`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002824 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2825 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2826 version=`$PKGCONFIG --modversion libssh2`
2827 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2828 fi
2829
2830 ;;
2831 off)
2832 dnl no --with-libssh2 option given, just check default places
2833 ;;
2834 *)
2835 dnl use the given --with-libssh2 spot
2836 PREFIX_SSH2=$OPT_LIBSSH2
2837 ;;
2838 esac
2839
2840 dnl if given with a prefix, we set -L and -I based on that
2841 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002842 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002843 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2844 CPP_SSH2=-I${PREFIX_SSH2}/include
2845 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2846 fi
2847
Elliott Hughes82be86d2017-09-20 17:00:17 -07002848 LDFLAGS="$LDFLAGS $LD_SSH2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002849 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002850 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002851
2852 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2853
2854 AC_CHECK_HEADERS(libssh2.h,
2855 curl_ssh_msg="enabled (libSSH2)"
2856 LIBSSH2_ENABLED=1
2857 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2858 AC_SUBST(USE_LIBSSH2, [1])
2859 )
2860
2861 if test X"$OPT_LIBSSH2" != Xoff &&
2862 test "$LIBSSH2_ENABLED" != "1"; then
2863 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2864 fi
2865
2866 if test "$LIBSSH2_ENABLED" = "1"; then
2867 if test -n "$DIR_SSH2"; then
2868 dnl when the libssh2 shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002869 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002870 dnl to prevent further configure tests to fail due to this
2871
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002872 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002873 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2"
2874 export CURL_LIBRARY_PATH
2875 AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002876 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002877 fi
2878 else
2879 dnl no libssh2, revert back to clean variables
2880 LDFLAGS=$CLEANLDFLAGS
2881 CPPFLAGS=$CLEANCPPFLAGS
2882 LIBS=$CLEANLIBS
2883 fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08002884elif test X"$OPT_LIBSSH" != Xno; then
2885 dnl backup the pre-libssh variables
2886 CLEANLDFLAGS="$LDFLAGS"
2887 CLEANCPPFLAGS="$CPPFLAGS"
2888 CLEANLIBS="$LIBS"
2889
2890 case "$OPT_LIBSSH" in
2891 yes)
2892 dnl --with-libssh (without path) used
2893 CURL_CHECK_PKGCONFIG(libssh)
2894
2895 if test "$PKGCONFIG" != "no" ; then
2896 LIB_SSH=`$PKGCONFIG --libs-only-l libssh`
2897 LD_SSH=`$PKGCONFIG --libs-only-L libssh`
2898 CPP_SSH=`$PKGCONFIG --cflags-only-I libssh`
2899 version=`$PKGCONFIG --modversion libssh`
2900 DIR_SSH=`echo $LD_SSH | $SED -e 's/-L//'`
2901 fi
2902
2903 ;;
2904 off)
2905 dnl no --with-libssh option given, just check default places
2906 ;;
2907 *)
2908 dnl use the given --with-libssh spot
2909 PREFIX_SSH=$OPT_LIBSSH
2910 ;;
2911 esac
2912
2913 dnl if given with a prefix, we set -L and -I based on that
2914 if test -n "$PREFIX_SSH"; then
2915 LIB_SSH="-lssh"
2916 LD_SSH=-L${PREFIX_SSH}/lib$libsuff
2917 CPP_SSH=-I${PREFIX_SSH}/include
2918 DIR_SSH=${PREFIX_SSH}/lib$libsuff
2919 fi
2920
2921 LDFLAGS="$LDFLAGS $LD_SSH"
2922 CPPFLAGS="$CPPFLAGS $CPP_SSH"
2923 LIBS="$LIB_SSH $LIBS"
2924
2925 AC_CHECK_LIB(ssh, ssh_new)
2926
2927 AC_CHECK_HEADERS(libssh/libssh.h,
2928 curl_ssh_msg="enabled (libSSH)"
2929 LIBSSH_ENABLED=1
2930 AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use])
2931 AC_SUBST(USE_LIBSSH, [1])
2932 )
2933
2934 if test X"$OPT_LIBSSH" != Xoff &&
2935 test "$LIBSSH_ENABLED" != "1"; then
2936 AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!])
2937 fi
2938
2939 if test "$LIBSSH_ENABLED" = "1"; then
2940 if test -n "$DIR_SSH"; then
2941 dnl when the libssh shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002942 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Elliott Hughes0128fe42018-02-27 14:57:55 -08002943 dnl to prevent further configure tests to fail due to this
2944
2945 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002946 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH"
2947 export CURL_LIBRARY_PATH
2948 AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH])
Elliott Hughes0128fe42018-02-27 14:57:55 -08002949 fi
2950 fi
2951 else
2952 dnl no libssh, revert back to clean variables
2953 LDFLAGS=$CLEANLDFLAGS
2954 CPPFLAGS=$CLEANCPPFLAGS
2955 LIBS=$CLEANLIBS
2956 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002957fi
2958
2959dnl **********************************************************************
2960dnl Check for the presence of LIBRTMP libraries and headers
2961dnl **********************************************************************
2962
2963dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2964OPT_LIBRTMP=off
2965AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002966AC_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 -07002967AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2968 OPT_LIBRTMP=$withval)
2969
2970if test X"$OPT_LIBRTMP" != Xno; then
2971 dnl backup the pre-librtmp variables
2972 CLEANLDFLAGS="$LDFLAGS"
2973 CLEANCPPFLAGS="$CPPFLAGS"
2974 CLEANLIBS="$LIBS"
2975
2976 case "$OPT_LIBRTMP" in
2977 yes)
2978 dnl --with-librtmp (without path) used
2979 CURL_CHECK_PKGCONFIG(librtmp)
2980
2981 if test "$PKGCONFIG" != "no" ; then
2982 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2983 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2984 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2985 version=`$PKGCONFIG --modversion librtmp`
2986 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002987 else
2988 dnl To avoid link errors, we do not allow --librtmp without
2989 dnl a pkgconfig file
2990 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002991 fi
2992
2993 ;;
2994 off)
2995 dnl no --with-librtmp option given, just check default places
2996 LIB_RTMP="-lrtmp"
2997 ;;
2998 *)
2999 dnl use the given --with-librtmp spot
Elliott Hughes82be86d2017-09-20 17:00:17 -07003000 LIB_RTMP="-lrtmp"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003001 PREFIX_RTMP=$OPT_LIBRTMP
3002 ;;
3003 esac
3004
3005 dnl if given with a prefix, we set -L and -I based on that
3006 if test -n "$PREFIX_RTMP"; then
3007 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
3008 CPP_RTMP=-I${PREFIX_RTMP}/include
3009 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
3010 fi
3011
3012 LDFLAGS="$LDFLAGS $LD_RTMP"
3013 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003014 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003015
3016 AC_CHECK_LIB(rtmp, RTMP_Init,
3017 [
3018 AC_CHECK_HEADERS(librtmp/rtmp.h,
3019 curl_rtmp_msg="enabled (librtmp)"
3020 LIBRTMP_ENABLED=1
3021 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
3022 AC_SUBST(USE_LIBRTMP, [1])
3023 )
3024 ],
3025 dnl not found, revert back to clean variables
3026 LDFLAGS=$CLEANLDFLAGS
3027 CPPFLAGS=$CLEANCPPFLAGS
3028 LIBS=$CLEANLIBS
3029 )
3030
3031 if test X"$OPT_LIBRTMP" != Xoff &&
3032 test "$LIBRTMP_ENABLED" != "1"; then
3033 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
3034 fi
3035
3036fi
3037
3038dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003039dnl Check for linker switch for versioned symbols
3040dnl **********************************************************************
3041
3042versioned_symbols_flavour=
3043AC_MSG_CHECKING([whether versioned symbols are wanted])
3044AC_ARG_ENABLE(versioned-symbols,
3045AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
3046AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
3047[ case "$enableval" in
3048 yes) AC_MSG_RESULT(yes)
3049 AC_MSG_CHECKING([if libraries can be versioned])
3050 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
3051 if test -z "$GLD"; then
3052 AC_MSG_RESULT(no)
3053 AC_MSG_WARN([You need an ld version supporting the --version-script option])
3054 else
3055 AC_MSG_RESULT(yes)
Alex Deymo486467e2017-12-19 19:04:07 +01003056 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3057 versioned_symbols_flavour="MULTISSL_"
3058 elif test "x$OPENSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003059 versioned_symbols_flavour="OPENSSL_"
3060 elif test "x$GNUTLS_ENABLED" = "x1"; then
3061 versioned_symbols_flavour="GNUTLS_"
3062 elif test "x$NSS_ENABLED" = "x1"; then
3063 versioned_symbols_flavour="NSS_"
3064 elif test "x$POLARSSL_ENABLED" = "x1"; then
3065 versioned_symbols_flavour="POLARSSL_"
3066 elif test "x$CYASSL_ENABLED" = "x1"; then
3067 versioned_symbols_flavour="CYASSL_"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003068 elif test "x$WINSSL_ENABLED" = "x1"; then
3069 versioned_symbols_flavour="WINSSL_"
3070 elif test "x$DARWINSSL_ENABLED" = "x1"; then
3071 versioned_symbols_flavour="DARWINSSL_"
3072 else
3073 versioned_symbols_flavour=""
3074 fi
3075 versioned_symbols="yes"
3076 fi
3077 ;;
3078
3079 *) AC_MSG_RESULT(no)
3080 ;;
3081 esac
3082], [
3083AC_MSG_RESULT(no)
3084]
3085)
3086
3087AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
3088 ["$versioned_symbols_flavour"])
3089AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
3090 [test "x$versioned_symbols" = 'xyes'])
3091
3092dnl -------------------------------------------------
3093dnl check winidn option before other IDN libraries
3094dnl -------------------------------------------------
3095
3096AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
3097OPT_WINIDN="default"
3098AC_ARG_WITH(winidn,
3099AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
3100AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
3101 OPT_WINIDN=$withval)
3102case "$OPT_WINIDN" in
3103 no|default)
3104 dnl --without-winidn option used or configure option not specified
3105 want_winidn="no"
3106 AC_MSG_RESULT([no])
3107 ;;
3108 yes)
3109 dnl --with-winidn option used without path
3110 want_winidn="yes"
3111 want_winidn_path="default"
3112 AC_MSG_RESULT([yes])
3113 ;;
3114 *)
3115 dnl --with-winidn option used with path
3116 want_winidn="yes"
3117 want_winidn_path="$withval"
3118 AC_MSG_RESULT([yes ($withval)])
3119 ;;
3120esac
3121
3122if test "$want_winidn" = "yes"; then
3123 dnl winidn library support has been requested
3124 clean_CPPFLAGS="$CPPFLAGS"
3125 clean_LDFLAGS="$LDFLAGS"
3126 clean_LIBS="$LIBS"
3127 WINIDN_LIBS="-lnormaliz"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003128 WINIDN_CPPFLAGS="-DWINVER=0x0600"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003129 #
3130 if test "$want_winidn_path" != "default"; then
3131 dnl path has been specified
3132 dnl pkg-config not available or provides no info
3133 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
3134 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
3135 WINIDN_DIR="$want_winidn_path/lib$libsuff"
3136 fi
3137 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003138 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
3139 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003140 LIBS="$WINIDN_LIBS $LIBS"
3141 #
3142 AC_MSG_CHECKING([if IdnToUnicode can be linked])
3143 AC_LINK_IFELSE([
Elliott Hughes82be86d2017-09-20 17:00:17 -07003144 AC_LANG_PROGRAM([[
3145 #include <windows.h>
3146 ]],[[
3147 IdnToUnicode(0, NULL, 0, NULL, 0);
3148 ]])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003149 ],[
3150 AC_MSG_RESULT([yes])
3151 tst_links_winidn="yes"
3152 ],[
3153 AC_MSG_RESULT([no])
3154 tst_links_winidn="no"
3155 ])
3156 #
3157 if test "$tst_links_winidn" = "yes"; then
3158 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
3159 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
3160 AC_SUBST([IDN_ENABLED], [1])
3161 curl_idn_msg="enabled (Windows-native)"
3162 else
3163 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3164 CPPFLAGS="$clean_CPPFLAGS"
3165 LDFLAGS="$clean_LDFLAGS"
3166 LIBS="$clean_LIBS"
3167 fi
3168fi
3169
3170dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003171dnl Check for the presence of IDN libraries and headers
3172dnl **********************************************************************
3173
Elliott Hughescee03382017-06-23 12:17:18 -07003174AC_MSG_CHECKING([whether to build with libidn2])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003175OPT_IDN="default"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003176AC_ARG_WITH(libidn2,
Elliott Hughescee03382017-06-23 12:17:18 -07003177AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
3178AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003179 [OPT_IDN=$withval])
3180case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003181 no)
Elliott Hughescee03382017-06-23 12:17:18 -07003182 dnl --without-libidn2 option used
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003183 want_idn="no"
3184 AC_MSG_RESULT([no])
3185 ;;
3186 default)
3187 dnl configure option not specified
3188 want_idn="yes"
3189 want_idn_path="default"
3190 AC_MSG_RESULT([(assumed) yes])
3191 ;;
3192 yes)
Elliott Hughescee03382017-06-23 12:17:18 -07003193 dnl --with-libidn2 option used without path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003194 want_idn="yes"
3195 want_idn_path="default"
3196 AC_MSG_RESULT([yes])
3197 ;;
3198 *)
Elliott Hughescee03382017-06-23 12:17:18 -07003199 dnl --with-libidn2 option used with path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003200 want_idn="yes"
3201 want_idn_path="$withval"
3202 AC_MSG_RESULT([yes ($withval)])
3203 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003204esac
3205
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003206if test "$want_idn" = "yes"; then
3207 dnl idn library support has been requested
3208 clean_CPPFLAGS="$CPPFLAGS"
3209 clean_LDFLAGS="$LDFLAGS"
3210 clean_LIBS="$LIBS"
3211 PKGCONFIG="no"
3212 #
3213 if test "$want_idn_path" != "default"; then
3214 dnl path has been specified
3215 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
Elliott Hughescee03382017-06-23 12:17:18 -07003216 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003217 if test "$PKGCONFIG" != "no"; then
3218 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003219 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003220 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003221 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003222 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003223 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003224 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3225 else
3226 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003227 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003228 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3229 IDN_CPPFLAGS="-I$want_idn_path/include"
3230 IDN_DIR="$want_idn_path/lib$libsuff"
3231 fi
3232 else
3233 dnl path not specified
Elliott Hughescee03382017-06-23 12:17:18 -07003234 CURL_CHECK_PKGCONFIG(libidn2)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003235 if test "$PKGCONFIG" != "no"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003236 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3237 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3238 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003239 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3240 else
3241 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003242 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003243 fi
3244 fi
3245 #
3246 if test "$PKGCONFIG" != "no"; then
3247 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3248 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3249 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3250 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3251 else
3252 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3253 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3254 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3255 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3256 fi
3257 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003258 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3259 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003260 LIBS="$IDN_LIBS $LIBS"
3261 #
Elliott Hughescee03382017-06-23 12:17:18 -07003262 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003263 AC_LINK_IFELSE([
Elliott Hughescee03382017-06-23 12:17:18 -07003264 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003265 ],[
3266 AC_MSG_RESULT([yes])
3267 tst_links_libidn="yes"
3268 ],[
3269 AC_MSG_RESULT([no])
3270 tst_links_libidn="no"
3271 ])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003272 #
Elliott Hughescee03382017-06-23 12:17:18 -07003273 AC_CHECK_HEADERS( idn2.h )
3274
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003275 if test "$tst_links_libidn" = "yes"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003276 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003277 dnl different versions of libidn have different setups of these:
Elliott Hughescee03382017-06-23 12:17:18 -07003278
3279 AC_SUBST([IDN_ENABLED], [1])
3280 curl_idn_msg="enabled (libidn2)"
3281 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003282 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR"
3283 export CURL_LIBRARY_PATH
3284 AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003285 fi
3286 else
3287 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3288 CPPFLAGS="$clean_CPPFLAGS"
3289 LDFLAGS="$clean_LDFLAGS"
3290 LIBS="$clean_LIBS"
3291 fi
3292fi
3293
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003294
3295dnl Let's hope this split URL remains working:
Elliott Hughesa93fb052018-12-12 14:22:48 -08003296dnl https://www15.software.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003297dnl genprogc/thread_quick_ref.htm
3298
3299
3300dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003301dnl Check for nghttp2
3302dnl **********************************************************************
3303
3304OPT_H2="yes"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003305
3306if test "x$disable_http" = "xyes"; then
3307 # without HTTP, nghttp2 is no use
3308 OPT_H2="no"
3309fi
3310
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003311AC_ARG_WITH(nghttp2,
3312AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3313AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3314 [OPT_H2=$withval])
3315case "$OPT_H2" in
3316 no)
3317 dnl --without-nghttp2 option used
3318 want_h2="no"
3319 ;;
3320 yes)
3321 dnl --with-nghttp2 option used without path
3322 want_h2="default"
3323 want_h2_path=""
3324 ;;
3325 *)
3326 dnl --with-nghttp2 option used with path
3327 want_h2="yes"
3328 want_h2_path="$withval/lib/pkgconfig"
3329 ;;
3330esac
3331
3332curl_h2_msg="disabled (--with-nghttp2)"
3333if test X"$want_h2" != Xno; then
3334 dnl backup the pre-nghttp2 variables
3335 CLEANLDFLAGS="$LDFLAGS"
3336 CLEANCPPFLAGS="$CPPFLAGS"
3337 CLEANLIBS="$LIBS"
3338
3339 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3340
3341 if test "$PKGCONFIG" != "no" ; then
3342 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3343 $PKGCONFIG --libs-only-l libnghttp2`
3344 AC_MSG_NOTICE([-l is $LIB_H2])
3345
3346 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3347 $PKGCONFIG --cflags-only-I libnghttp2`
3348 AC_MSG_NOTICE([-I is $CPP_H2])
3349
3350 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3351 $PKGCONFIG --libs-only-L libnghttp2`
3352 AC_MSG_NOTICE([-L is $LD_H2])
3353
3354 LDFLAGS="$LDFLAGS $LD_H2"
3355 CPPFLAGS="$CPPFLAGS $CPP_H2"
3356 LIBS="$LIB_H2 $LIBS"
3357
3358 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3359 # >= 1.0.0
3360 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3361 [
3362 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3363 curl_h2_msg="enabled (nghttp2)"
3364 NGHTTP2_ENABLED=1
3365 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3366 AC_SUBST(USE_NGHTTP2, [1])
3367 )
3368 ],
3369 dnl not found, revert back to clean variables
3370 LDFLAGS=$CLEANLDFLAGS
3371 CPPFLAGS=$CLEANCPPFLAGS
3372 LIBS=$CLEANLIBS
3373 )
3374
3375 else
3376 dnl no nghttp2 pkg-config found, deal with it
3377 if test X"$want_h2" != Xdefault; then
3378 dnl To avoid link errors, we do not allow --with-nghttp2 without
3379 dnl a pkgconfig file
3380 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3381 fi
3382 fi
3383
3384fi
3385
3386dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07003387dnl Check for zsh completion path
3388dnl **********************************************************************
3389
3390OPT_ZSH_FPATH=default
3391AC_ARG_WITH(zsh-functions-dir,
3392AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3393AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3394 [OPT_ZSH_FPATH=$withval])
3395case "$OPT_ZSH_FPATH" in
3396 no)
3397 dnl --without-zsh-functions-dir option used
3398 ;;
3399 default|yes)
3400 dnl --with-zsh-functions-dir option used without path
3401 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3402 AC_SUBST(ZSH_FUNCTIONS_DIR)
3403 ;;
3404 *)
3405 dnl --with-zsh-functions-dir option used with path
3406 ZSH_FUNCTIONS_DIR="$withval"
3407 AC_SUBST(ZSH_FUNCTIONS_DIR)
3408 ;;
3409esac
3410
3411dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003412dnl Back to "normal" configuring
3413dnl **********************************************************************
3414
3415dnl Checks for header files.
3416AC_HEADER_STDC
3417
3418CURL_CHECK_HEADER_MALLOC
3419CURL_CHECK_HEADER_MEMORY
3420
3421dnl Now check for the very most basic headers. Then we can use these
3422dnl ones as default-headers when checking for the rest!
3423AC_CHECK_HEADERS(
3424 sys/types.h \
3425 sys/time.h \
3426 sys/select.h \
3427 sys/socket.h \
3428 sys/ioctl.h \
3429 sys/uio.h \
3430 assert.h \
3431 unistd.h \
3432 stdlib.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003433 arpa/inet.h \
3434 net/if.h \
3435 netinet/in.h \
Elliott Hughes0128fe42018-02-27 14:57:55 -08003436 netinet/in6.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003437 sys/un.h \
Alex Deymo486467e2017-12-19 19:04:07 +01003438 linux/tcp.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003439 netinet/tcp.h \
3440 netdb.h \
3441 sys/sockio.h \
3442 sys/stat.h \
3443 sys/param.h \
3444 termios.h \
3445 termio.h \
3446 sgtty.h \
3447 fcntl.h \
3448 alloca.h \
3449 time.h \
3450 io.h \
3451 pwd.h \
3452 utime.h \
3453 sys/utime.h \
3454 sys/poll.h \
3455 poll.h \
3456 socket.h \
3457 sys/resource.h \
3458 libgen.h \
3459 locale.h \
3460 errno.h \
3461 stdbool.h \
3462 arpa/tftp.h \
3463 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003464 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003465 setjmp.h,
3466dnl to do if not found
3467[],
3468dnl to do if found
3469[],
3470dnl default includes
3471[
3472#ifdef HAVE_SYS_TYPES_H
3473#include <sys/types.h>
3474#endif
3475#ifdef HAVE_SYS_TIME_H
3476#include <sys/time.h>
3477#endif
3478#ifdef HAVE_SYS_SELECT_H
3479#include <sys/select.h>
3480#endif
3481#ifdef HAVE_SYS_SOCKET_H
3482#include <sys/socket.h>
3483#endif
3484#ifdef HAVE_NETINET_IN_H
3485#include <netinet/in.h>
3486#endif
Elliott Hughes0128fe42018-02-27 14:57:55 -08003487#ifdef HAVE_NETINET_IN6_H
3488#include <netinet/in6.h>
3489#endif
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003490#ifdef HAVE_SYS_UN_H
3491#include <sys/un.h>
3492#endif
3493]
3494)
3495
3496dnl Checks for typedefs, structures, and compiler characteristics.
3497AC_C_CONST
3498CURL_CHECK_VARIADIC_MACROS
3499AC_TYPE_SIZE_T
3500AC_HEADER_TIME
3501CURL_CHECK_STRUCT_TIMEVAL
3502CURL_VERIFY_RUNTIMELIBS
3503
Elliott Hughes72d948d2018-08-03 14:37:21 -07003504AX_COMPILE_CHECK_SIZEOF(size_t)
3505AX_COMPILE_CHECK_SIZEOF(long)
3506AX_COMPILE_CHECK_SIZEOF(int)
3507AX_COMPILE_CHECK_SIZEOF(short)
3508AX_COMPILE_CHECK_SIZEOF(time_t)
3509AX_COMPILE_CHECK_SIZEOF(off_t)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003510
Alex Deymo486467e2017-12-19 19:04:07 +01003511o=$CPPFLAGS
3512CPPFLAGS="-I$srcdir/include $CPPFLAGS"
Elliott Hughes72d948d2018-08-03 14:37:21 -07003513AX_COMPILE_CHECK_SIZEOF(curl_off_t, [
Alex Deymo486467e2017-12-19 19:04:07 +01003514#include <curl/system.h>
3515])
3516CPPFLAGS=$o
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003517
3518AC_CHECK_TYPE(long long,
3519 [AC_DEFINE(HAVE_LONGLONG, 1,
3520 [Define to 1 if the compiler supports the 'long long' data type.])]
3521 longlong="yes"
3522)
3523
3524if test "xyes" = "x$longlong"; then
3525 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003526 AC_COMPILE_IFELSE([
3527 AC_LANG_PROGRAM([[
3528 ]],[[
3529 long long val = 1000LL;
3530 ]])
3531 ],[
3532 AC_MSG_RESULT([yes])
3533 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3534 ],[
3535 AC_MSG_RESULT([no])
3536 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003537fi
3538
3539
3540# check for ssize_t
3541AC_CHECK_TYPE(ssize_t, ,
3542 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3543
3544# check for bool type
3545AC_CHECK_TYPE([bool],[
3546 AC_DEFINE(HAVE_BOOL_T, 1,
3547 [Define to 1 if bool is an available type.])
3548], ,[
3549#ifdef HAVE_SYS_TYPES_H
3550#include <sys/types.h>
3551#endif
3552#ifdef HAVE_STDBOOL_H
3553#include <stdbool.h>
3554#endif
3555])
3556
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003557# check for sa_family_t
3558AC_CHECK_TYPE(sa_family_t,
3559 AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
3560 [
3561 # The windows name?
3562 AC_CHECK_TYPE(ADDRESS_FAMILY,
3563 AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
3564 AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
3565 [
3566#ifdef HAVE_SYS_SOCKET_H
3567#include <sys/socket.h>
3568#endif
3569 ])
3570 ],
3571[
3572#ifdef HAVE_SYS_SOCKET_H
3573#include <sys/socket.h>
3574#endif
3575])
3576
Elliott Hughescac39802018-04-27 16:19:43 -07003577AC_MSG_CHECKING([if time_t is unsigned])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003578CURL_RUN_IFELSE(
3579 [
Elliott Hughescac39802018-04-27 16:19:43 -07003580 #include <time.h>
3581 #include <limits.h>
3582 time_t t = -1;
3583 return (t > 0);
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003584 ],[
Elliott Hughescac39802018-04-27 16:19:43 -07003585 AC_MSG_RESULT([yes])
3586 AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
3587],[
3588 AC_MSG_RESULT([no])
3589],[
3590 dnl cross-compiling, most systems are unsigned
3591 AC_MSG_RESULT([no])
3592])
3593
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003594CURL_CONFIGURE_PULL_SYS_POLL
3595
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003596TYPE_IN_ADDR_T
3597
3598TYPE_SOCKADDR_STORAGE
3599
3600TYPE_SIG_ATOMIC_T
3601
3602AC_TYPE_SIGNAL
3603
3604CURL_CHECK_FUNC_SELECT
3605
3606CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003607CURL_CHECK_FUNC_SEND
3608CURL_CHECK_MSG_NOSIGNAL
3609
3610CURL_CHECK_FUNC_ALARM
3611CURL_CHECK_FUNC_BASENAME
3612CURL_CHECK_FUNC_CLOSESOCKET
3613CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3614CURL_CHECK_FUNC_CONNECT
3615CURL_CHECK_FUNC_FCNTL
3616CURL_CHECK_FUNC_FDOPEN
3617CURL_CHECK_FUNC_FREEADDRINFO
3618CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003619CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003620CURL_CHECK_FUNC_FTRUNCATE
3621CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003622CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003623CURL_CHECK_FUNC_GETHOSTBYADDR
3624CURL_CHECK_FUNC_GETHOSTBYADDR_R
3625CURL_CHECK_FUNC_GETHOSTBYNAME
3626CURL_CHECK_FUNC_GETHOSTBYNAME_R
3627CURL_CHECK_FUNC_GETHOSTNAME
3628CURL_CHECK_FUNC_GETIFADDRS
3629CURL_CHECK_FUNC_GETSERVBYPORT_R
3630CURL_CHECK_FUNC_GMTIME_R
3631CURL_CHECK_FUNC_INET_NTOA_R
3632CURL_CHECK_FUNC_INET_NTOP
3633CURL_CHECK_FUNC_INET_PTON
3634CURL_CHECK_FUNC_IOCTL
3635CURL_CHECK_FUNC_IOCTLSOCKET
3636CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3637CURL_CHECK_FUNC_LOCALTIME_R
3638CURL_CHECK_FUNC_MEMRCHR
3639CURL_CHECK_FUNC_POLL
3640CURL_CHECK_FUNC_SETSOCKOPT
3641CURL_CHECK_FUNC_SIGACTION
3642CURL_CHECK_FUNC_SIGINTERRUPT
3643CURL_CHECK_FUNC_SIGNAL
3644CURL_CHECK_FUNC_SIGSETJMP
3645CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003646CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003647CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003648CURL_CHECK_FUNC_STRCMPI
3649CURL_CHECK_FUNC_STRDUP
3650CURL_CHECK_FUNC_STRERROR_R
3651CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003652CURL_CHECK_FUNC_STRNCASECMP
3653CURL_CHECK_FUNC_STRNCMPI
3654CURL_CHECK_FUNC_STRNICMP
3655CURL_CHECK_FUNC_STRSTR
3656CURL_CHECK_FUNC_STRTOK_R
3657CURL_CHECK_FUNC_STRTOLL
3658CURL_CHECK_FUNC_WRITEV
3659
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003660case $host in
3661 *msdosdjgpp)
3662 ac_cv_func_pipe=no
3663 skipcheck_pipe=yes
3664 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3665 ;;
3666esac
3667
Elliott Hughes72d948d2018-08-03 14:37:21 -07003668AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Set if getpwuid_r() declaration is missing")],
3669 [[#include <pwd.h>
3670 #include <sys/types.h>]])
3671
3672
3673AC_CHECK_FUNCS([fnmatch \
3674 geteuid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003675 getpass_r \
3676 getppid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003677 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003678 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003679 getrlimit \
3680 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003681 if_nametoindex \
Alex Deymo486467e2017-12-19 19:04:07 +01003682 mach_absolute_time \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003683 pipe \
3684 setlocale \
3685 setmode \
3686 setrlimit \
Elliott Hughes82be86d2017-09-20 17:00:17 -07003687 utime \
3688 utimes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003689],[
3690],[
3691 func="$ac_func"
3692 eval skipcheck=\$skipcheck_$func
3693 if test "x$skipcheck" != "xyes"; then
3694 AC_MSG_CHECKING([deeper for $func])
3695 AC_LINK_IFELSE([
3696 AC_LANG_PROGRAM([[
3697 ]],[[
3698 $func ();
3699 ]])
3700 ],[
3701 AC_MSG_RESULT([yes])
3702 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003703 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003704 [Define to 1 if you have the $func function.])
3705 ],[
3706 AC_MSG_RESULT([but still no])
3707 ])
3708 fi
3709])
3710
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003711if test "$ipv6" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07003712 if test "$curl_cv_func_getaddrinfo" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003713 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3714 IPV6_ENABLED=1
3715 AC_SUBST(IPV6_ENABLED)
3716 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003717fi
3718
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003719CURL_CHECK_NONBLOCKING_SOCKET
3720
3721dnl ************************************************************
3722dnl nroff tool stuff
3723dnl
3724
3725AC_PATH_PROG( PERL, perl, ,
3726 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3727AC_SUBST(PERL)
3728
3729AC_PATH_PROGS( NROFF, gnroff nroff, ,
3730 $PATH:/usr/bin/:/usr/local/bin )
3731AC_SUBST(NROFF)
3732
3733if test -n "$NROFF"; then
3734 dnl only check for nroff options if an nroff command was found
3735
3736 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3737 MANOPT="-man"
3738 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3739 if test -z "$mancheck"; then
3740 MANOPT="-mandoc"
3741 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3742 if test -z "$mancheck"; then
3743 MANOPT=""
3744 AC_MSG_RESULT([failed])
3745 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3746 else
3747 AC_MSG_RESULT([$MANOPT])
3748 fi
3749 else
3750 AC_MSG_RESULT([$MANOPT])
3751 fi
3752 AC_SUBST(MANOPT)
3753fi
3754
3755if test -z "$MANOPT"
3756then
3757 dnl if no nroff tool was found, or no option that could convert man pages
3758 dnl was found, then disable the built-in manual stuff
3759 AC_MSG_WARN([disabling built-in manual])
3760 USE_MANUAL="no";
3761fi
3762
3763dnl *************************************************************************
3764dnl If the manual variable still is set, then we go with providing a built-in
3765dnl manual
3766
3767if test "$USE_MANUAL" = "1"; then
3768 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3769 curl_manual_msg="enabled"
3770fi
3771
3772dnl set variable for use in automakefile(s)
3773AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3774
3775CURL_CHECK_LIB_ARES
3776AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3777
Alex Deymod15eaac2016-06-28 14:49:26 -07003778if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003779 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003780 build_libhostname=yes
3781else
3782 build_libhostname=no
3783fi
3784AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3785
Elliott Hughes82be86d2017-09-20 17:00:17 -07003786if test "x$want_ares" != xyes; then
3787 CURL_CHECK_OPTION_THREADED_RESOLVER
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003788fi
3789
Elliott Hughes82be86d2017-09-20 17:00:17 -07003790dnl ************************************************************
3791dnl disable POSIX threads
3792dnl
3793AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3794AC_ARG_ENABLE(pthreads,
3795AC_HELP_STRING([--enable-pthreads],
3796 [Enable POSIX threads (default for threaded resolver)])
3797AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
3798[ case "$enableval" in
3799 no) AC_MSG_RESULT(no)
3800 want_pthreads=no
3801 ;;
3802 *) AC_MSG_RESULT(yes)
3803 want_pthreads=yes
3804 ;;
3805 esac ], [
3806 AC_MSG_RESULT(auto)
3807 want_pthreads=auto
3808 ]
3809)
3810
3811dnl turn off pthreads if rt is disabled
3812if test "$want_pthreads" != "no"; then
3813 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
3814 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
3815 fi
3816 if test "$dontwant_rt" != "no"; then
3817 dnl if --enable-pthreads was explicit then warn it's being ignored
3818 if test "$want_pthreads" = "yes"; then
3819 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
3820 fi
3821 want_pthreads=no
3822 fi
3823fi
3824
3825dnl turn off pthreads if no threaded resolver
3826if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
3827 want_pthreads=no
3828fi
3829
3830dnl detect pthreads
3831if test "$want_pthreads" != "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003832 AC_CHECK_HEADER(pthread.h,
3833 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3834 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003835
3836 dnl first check for function without lib
3837 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3838
Elliott Hughesa93fb052018-12-12 14:22:48 -08003839 dnl on HPUX, life is more complicated...
3840 case $host in
3841 *-hp-hpux*)
3842 dnl it doesn't actually work without -lpthread
3843 USE_THREADS_POSIX=""
3844 ;;
3845 *)
3846 ;;
3847 esac
3848
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003849 dnl if it wasn't found without lib, search for it in pthread lib
3850 if test "$USE_THREADS_POSIX" != "1"
3851 then
3852 CFLAGS="$CFLAGS -pthread"
3853 AC_CHECK_LIB(pthread, pthread_create,
3854 [USE_THREADS_POSIX=1],
3855 [ CFLAGS="$save_CFLAGS"])
3856 fi
3857
3858 if test "x$USE_THREADS_POSIX" = "x1"
3859 then
3860 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3861 curl_res_msg="POSIX threaded"
3862 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003863 ])
3864fi
3865
Elliott Hughes82be86d2017-09-20 17:00:17 -07003866dnl threaded resolver check
3867if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
3868 if test "$want_pthreads" = "yes"; then
3869 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
3870 fi
3871 dnl If native Windows fallback on Win32 threads since no POSIX threads
3872 if test "$curl_cv_native_windows" = "yes"; then
3873 USE_THREADS_WIN32=1
3874 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
3875 curl_res_msg="Win32 threaded"
3876 else
3877 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
3878 fi
3879fi
3880
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003881dnl ************************************************************
3882dnl disable verbose text strings
3883dnl
3884AC_MSG_CHECKING([whether to enable verbose strings])
3885AC_ARG_ENABLE(verbose,
3886AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3887AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3888[ case "$enableval" in
3889 no)
3890 AC_MSG_RESULT(no)
3891 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3892 curl_verbose_msg="no"
3893 ;;
3894 *) AC_MSG_RESULT(yes)
3895 ;;
3896 esac ],
3897 AC_MSG_RESULT(yes)
3898)
3899
3900dnl ************************************************************
3901dnl enable SSPI support
3902dnl
3903AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3904AC_ARG_ENABLE(sspi,
3905AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3906AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3907[ case "$enableval" in
3908 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07003909 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003910 AC_MSG_RESULT(yes)
3911 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3912 AC_SUBST(USE_WINDOWS_SSPI, [1])
3913 curl_sspi_msg="enabled"
3914 else
3915 AC_MSG_RESULT(no)
3916 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3917 fi
3918 ;;
3919 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003920 if test "x$WINSSL_ENABLED" = "x1"; then
3921 # --with-winssl implies --enable-sspi
3922 AC_MSG_RESULT(yes)
3923 else
3924 AC_MSG_RESULT(no)
3925 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003926 ;;
3927 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003928 if test "x$WINSSL_ENABLED" = "x1"; then
3929 # --with-winssl implies --enable-sspi
3930 AC_MSG_RESULT(yes)
3931 else
3932 AC_MSG_RESULT(no)
3933 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003934)
3935
3936dnl ************************************************************
3937dnl disable cryptographic authentication
3938dnl
3939AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3940AC_ARG_ENABLE(crypto-auth,
3941AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3942AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3943[ case "$enableval" in
3944 no)
3945 AC_MSG_RESULT(no)
3946 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003947 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003948 ;;
3949 *) AC_MSG_RESULT(yes)
3950 ;;
3951 esac ],
3952 AC_MSG_RESULT(yes)
3953)
3954
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003955CURL_CHECK_OPTION_NTLM_WB
3956
3957CURL_CHECK_NTLM_WB
3958
3959dnl ************************************************************
3960dnl disable TLS-SRP authentication
3961dnl
3962AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3963AC_ARG_ENABLE(tls-srp,
3964AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3965AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3966[ case "$enableval" in
3967 no)
3968 AC_MSG_RESULT(no)
3969 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3970 want_tls_srp=no
3971 ;;
3972 *) AC_MSG_RESULT(yes)
3973 want_tls_srp=yes
3974 ;;
3975 esac ],
3976 AC_MSG_RESULT(yes)
3977 want_tls_srp=yes
3978)
3979
3980if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3981 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3982 USE_TLS_SRP=1
3983 curl_tls_srp_msg="enabled"
3984fi
3985
3986dnl ************************************************************
3987dnl disable Unix domain sockets support
3988dnl
3989AC_MSG_CHECKING([whether to enable Unix domain sockets])
3990AC_ARG_ENABLE(unix-sockets,
3991AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3992AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3993[ case "$enableval" in
3994 no) AC_MSG_RESULT(no)
3995 want_unix_sockets=no
3996 ;;
3997 *) AC_MSG_RESULT(yes)
3998 want_unix_sockets=yes
3999 ;;
4000 esac ], [
4001 AC_MSG_RESULT(auto)
4002 want_unix_sockets=auto
4003 ]
4004)
4005if test "x$want_unix_sockets" != "xno"; then
4006 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
4007 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
4008 AC_SUBST(USE_UNIX_SOCKETS, [1])
4009 curl_unix_sockets_msg="enabled"
4010 ], [
4011 if test "x$want_unix_sockets" = "xyes"; then
4012 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
4013 fi
4014 ], [
4015 #include <sys/un.h>
4016 ])
4017fi
4018
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004019dnl ************************************************************
4020dnl disable cookies support
4021dnl
4022AC_MSG_CHECKING([whether to enable support for cookies])
4023AC_ARG_ENABLE(cookies,
4024AC_HELP_STRING([--enable-cookies],[Enable cookies support])
4025AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
4026[ case "$enableval" in
4027 no)
4028 AC_MSG_RESULT(no)
4029 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
4030 ;;
4031 *) AC_MSG_RESULT(yes)
4032 ;;
4033 esac ],
4034 AC_MSG_RESULT(yes)
4035)
4036
4037dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004038dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004039dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004040CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004041
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004042dnl
4043dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004044dnl
4045LIBCURL_LIBS=$LIBS
4046
4047AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004048AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004049AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
4050
4051dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
4052dnl LIBS variable used in generated makefile at makefile processing
4053dnl time. Doing this functionally prevents LIBS from being used for
4054dnl all link targets in given makefile.
4055BLANK_AT_MAKETIME=
4056AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004057
4058AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
4059
4060dnl yes or no
4061ENABLE_SHARED="$enable_shared"
4062AC_SUBST(ENABLE_SHARED)
4063
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004064dnl to let curl-config output the static libraries correctly
4065ENABLE_STATIC="$enable_static"
4066AC_SUBST(ENABLE_STATIC)
4067
4068
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004069dnl
4070dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004071dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004072dnl
4073
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004074if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004075 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4076elif test -n "$SSL_ENABLED"; then
4077 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4078fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004079if test "x$IPV6_ENABLED" = "x1"; then
4080 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
4081fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004082if test "x$USE_UNIX_SOCKETS" = "x1"; then
4083 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
4084fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004085if test "x$HAVE_LIBZ" = "x1"; then
4086 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
4087fi
Alex Deymo486467e2017-12-19 19:04:07 +01004088if test "x$HAVE_BROTLI" = "x1"; then
4089 SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
4090fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07004091if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
4092 -o "x$USE_THREADS_WIN32" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004093 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
4094fi
4095if test "x$IDN_ENABLED" = "x1"; then
4096 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
4097fi
4098if test "x$USE_WINDOWS_SSPI" = "x1"; then
4099 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
4100fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004101
4102if test "x$HAVE_GSSAPI" = "x1"; then
4103 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
4104fi
4105
Alex Deymod15eaac2016-06-28 14:49:26 -07004106if test "x$curl_psl_msg" = "xyes"; then
4107 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
4108fi
4109
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004110if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4111 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4112 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
4113fi
4114
4115if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4116 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4117 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
4118fi
4119
4120if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
4121 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004122 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4123 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004124 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
4125
4126 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
4127 "x$NTLM_WB_ENABLED" = "x1"; then
4128 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
4129 fi
4130 fi
4131fi
4132
4133if test "x$USE_TLS_SRP" = "x1"; then
4134 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
4135fi
4136
4137if test "x$USE_NGHTTP2" = "x1"; then
4138 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004139fi
4140
Alex Deymo486467e2017-12-19 19:04:07 +01004141if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
4142 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
4143fi
4144
Elliott Hughes82be86d2017-09-20 17:00:17 -07004145if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
4146 -o "x$NSS_ENABLED" = "x1"; then
4147 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
4148fi
4149
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004150AC_SUBST(SUPPORT_FEATURES)
4151
4152dnl For supported protocols in pkg-config file
4153if test "x$CURL_DISABLE_HTTP" != "x1"; then
4154 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
4155 if test "x$SSL_ENABLED" = "x1"; then
4156 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
4157 fi
4158fi
4159if test "x$CURL_DISABLE_FTP" != "x1"; then
4160 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
4161 if test "x$SSL_ENABLED" = "x1"; then
4162 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
4163 fi
4164fi
4165if test "x$CURL_DISABLE_FILE" != "x1"; then
4166 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
4167fi
4168if test "x$CURL_DISABLE_TELNET" != "x1"; then
4169 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
4170fi
4171if test "x$CURL_DISABLE_LDAP" != "x1"; then
4172 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
4173 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
4174 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
4175 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
4176 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
4177 fi
4178 fi
4179fi
4180if test "x$CURL_DISABLE_DICT" != "x1"; then
4181 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
4182fi
4183if test "x$CURL_DISABLE_TFTP" != "x1"; then
4184 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
4185fi
4186if test "x$CURL_DISABLE_GOPHER" != "x1"; then
4187 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
4188fi
4189if test "x$CURL_DISABLE_POP3" != "x1"; then
4190 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
4191 if test "x$SSL_ENABLED" = "x1"; then
4192 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
4193 fi
4194fi
4195if test "x$CURL_DISABLE_IMAP" != "x1"; then
4196 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
4197 if test "x$SSL_ENABLED" = "x1"; then
4198 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
4199 fi
4200fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004201if test "x$CURL_DISABLE_SMB" != "x1" \
4202 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
4203 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004204 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4205 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004206 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
4207 if test "x$SSL_ENABLED" = "x1"; then
4208 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4209 fi
4210fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004211if test "x$CURL_DISABLE_SMTP" != "x1"; then
4212 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4213 if test "x$SSL_ENABLED" = "x1"; then
4214 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4215 fi
4216fi
4217if test "x$USE_LIBSSH2" = "x1"; then
4218 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4219 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4220fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08004221if test "x$USE_LIBSSH" = "x1"; then
4222 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4223 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4224fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004225if test "x$CURL_DISABLE_RTSP" != "x1"; then
4226 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4227fi
4228if test "x$USE_LIBRTMP" = "x1"; then
4229 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4230fi
4231
4232dnl replace spaces with newlines
4233dnl sort the lines
4234dnl replace the newlines back to spaces
4235SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4236
4237AC_SUBST(SUPPORT_PROTOCOLS)
4238
4239dnl squeeze whitespace out of some variables
4240
4241squeeze CFLAGS
4242squeeze CPPFLAGS
4243squeeze DEFS
4244squeeze LDFLAGS
4245squeeze LIBS
4246
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004247squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004248squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004249squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004250
4251squeeze SUPPORT_FEATURES
4252squeeze SUPPORT_PROTOCOLS
4253
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004254XC_CHECK_BUILD_FLAGS
4255
Elliott Hughes0128fe42018-02-27 14:57:55 -08004256SSL_BACKENDS=${ssl_backends}
4257AC_SUBST(SSL_BACKENDS)
4258
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004259if test "x$want_curldebug_assumed" = "xyes" &&
4260 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4261 ac_configure_args="$ac_configure_args --enable-curldebug"
4262fi
4263
4264AC_CONFIG_FILES([Makefile \
4265 docs/Makefile \
4266 docs/examples/Makefile \
4267 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004268 docs/libcurl/opts/Makefile \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004269 docs/cmdline-opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004270 include/Makefile \
4271 include/curl/Makefile \
4272 src/Makefile \
4273 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07004274 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004275 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004276 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004277 tests/certs/Makefile \
4278 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004279 tests/data/Makefile \
4280 tests/server/Makefile \
4281 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004282 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004283 packages/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004284 packages/vms/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004285 curl-config \
4286 libcurl.pc
4287])
4288AC_OUTPUT
4289
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004290CURL_GENERATE_CONFIGUREHELP_PM
4291
4292XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4293
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004294AC_MSG_NOTICE([Configured to build curl/libcurl:
4295
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004296 Host setup: ${host}
4297 Install prefix: ${prefix}
4298 Compiler: ${CC}
Haibo Huang21926d52019-01-08 14:27:10 -08004299 CFLAGS: ${CFLAGS}
4300 CPPFLAGS: ${CPPFLAGS}
4301 LDFLAGS: ${LDFLAGS}
4302 LIBS: ${LIBS}
4303
4304 curl version: ${CURLVERSION}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004305 SSL support: ${curl_ssl_msg}
4306 SSH support: ${curl_ssh_msg}
4307 zlib support: ${curl_zlib_msg}
Alex Deymo486467e2017-12-19 19:04:07 +01004308 brotli support: ${curl_brotli_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004309 GSS-API support: ${curl_gss_msg}
4310 TLS-SRP support: ${curl_tls_srp_msg}
4311 resolver: ${curl_res_msg}
4312 IPv6 support: ${curl_ipv6_msg}
4313 Unix sockets support: ${curl_unix_sockets_msg}
4314 IDN support: ${curl_idn_msg}
4315 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4316 Built-in manual: ${curl_manual_msg}
4317 --libcurl option: ${curl_libcurl_msg}
4318 Verbose errors: ${curl_verbose_msg}
Haibo Huang51d9d882019-02-06 01:36:06 -08004319 Code coverage: ${curl_coverage_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004320 SSPI support: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004321 ca cert bundle: ${ca}${ca_warning}
4322 ca cert path: ${capath}${capath_warning}
4323 ca fallback: ${with_ca_fallback}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004324 LDAP support: ${curl_ldap_msg}
4325 LDAPS support: ${curl_ldaps_msg}
4326 RTSP support: ${curl_rtsp_msg}
4327 RTMP support: ${curl_rtmp_msg}
4328 metalink support: ${curl_mtlnk_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004329 PSL support: ${curl_psl_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004330 HTTP2 support: ${curl_h2_msg}
4331 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004332])