blob: 5569a26b46b8189498a7a812ad3c2d6ce2684699 [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Elliott Hughescac39802018-04-27 16:19:43 -07008# Copyright (C) 1998 - 2018, 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
Elliott Hughes82be86d2017-09-20 17:00:17 -070034AC_COPYRIGHT([Copyright (c) 1998 - 2017 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"
64fi
65AC_SUBST(CURL_CFLAG_EXTRAS)
66
67dnl SED is mandatory for configure process and libtool.
68dnl Set it now, allowing it to be changed later.
69if test -z "$SED"; then
70 dnl allow it to be overridden
71 AC_PATH_PROG([SED], [sed], [not_found],
72 [$PATH:/usr/bin:/usr/local/bin])
73 if test -z "$SED" || test "$SED" = "not_found"; then
74 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
75 fi
76fi
77AC_SUBST([SED])
78
79dnl GREP is mandatory for configure process and libtool.
80dnl Set it now, allowing it to be changed later.
81if test -z "$GREP"; then
82 dnl allow it to be overridden
83 AC_PATH_PROG([GREP], [grep], [not_found],
84 [$PATH:/usr/bin:/usr/local/bin])
85 if test -z "$GREP" || test "$GREP" = "not_found"; then
86 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
87 fi
88fi
89AC_SUBST([GREP])
90
91dnl EGREP is mandatory for configure process and libtool.
92dnl Set it now, allowing it to be changed later.
93if test -z "$EGREP"; then
94 dnl allow it to be overridden
95 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
96 AC_MSG_CHECKING([for egrep])
97 EGREP="$GREP -E"
98 AC_MSG_RESULT([$EGREP])
99 else
100 AC_PATH_PROG([EGREP], [egrep], [not_found],
101 [$PATH:/usr/bin:/usr/local/bin])
102 fi
103fi
104if test -z "$EGREP" || test "$EGREP" = "not_found"; then
105 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
106fi
107AC_SUBST([EGREP])
108
109dnl AR is mandatory for configure process and libtool.
110dnl This is target dependent, so check it as a tool.
111if test -z "$AR"; then
112 dnl allow it to be overridden
113 AC_PATH_TOOL([AR], [ar], [not_found],
114 [$PATH:/usr/bin:/usr/local/bin])
115 if test -z "$AR" || test "$AR" = "not_found"; then
116 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
117 fi
118fi
119AC_SUBST([AR])
120
121AC_SUBST(libext)
122
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700123dnl figure out the libcurl version
Elliott Hughes82be86d2017-09-20 17:00:17 -0700124CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700125XC_CHECK_PROG_CC
Elliott Hughes0128fe42018-02-27 14:57:55 -0800126
127dnl Check if gcc is being used before adding AX_CODE_COVERAGE
128AS_IF([ test "$GCC" = "yes" ], [AX_CODE_COVERAGE],
129 # not using GCC so pass a test below - CODE_COVERAGE_ENABLED_TRUE is not zero length
130 CODE_COVERAGE_ENABLED_TRUE='#'
131)
132
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700133XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700134AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700135AC_MSG_RESULT($CURLVERSION)
136
137AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700138
139dnl
140dnl we extract the numerical version for curl-config only
Elliott Hughes82be86d2017-09-20 17:00:17 -0700141VERSIONNUM=`$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 -0700142AC_SUBST(VERSIONNUM)
143
144dnl Solaris pkgadd support definitions
145PKGADD_PKG="HAXXcurl"
Elliott Hughescee03382017-06-23 12:17:18 -0700146PKGADD_NAME="curl - a client that groks URLs"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700147PKGADD_VENDOR="curl.haxx.se"
148AC_SUBST(PKGADD_PKG)
149AC_SUBST(PKGADD_NAME)
150AC_SUBST(PKGADD_VENDOR)
151
152dnl
153dnl initialize all the info variables
Alex Deymod15eaac2016-06-28 14:49:26 -0700154 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700155 curl_ssh_msg="no (--with-libssh2)"
156 curl_zlib_msg="no (--with-zlib)"
Alex Deymo486467e2017-12-19 19:04:07 +0100157 curl_brotli_msg="no (--with-brotli)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700158 curl_gss_msg="no (--with-gssapi)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700159curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700160 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
161 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700162curl_unix_sockets_msg="no (--enable-unix-sockets)"
Elliott Hughescee03382017-06-23 12:17:18 -0700163 curl_idn_msg="no (--with-{libidn2,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700164 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700165curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700166curl_verbose_msg="enabled (--disable-verbose)"
167 curl_sspi_msg="no (--enable-sspi)"
168 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
169 curl_ldaps_msg="no (--enable-ldaps)"
170 curl_rtsp_msg="no (--enable-rtsp)"
171 curl_rtmp_msg="no (--with-librtmp)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700172 curl_mtlnk_msg="no (--with-libmetalink)"
Alex Deymod15eaac2016-06-28 14:49:26 -0700173 curl_psl_msg="no (--with-libpsl)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700174
Alex Deymo486467e2017-12-19 19:04:07 +0100175 ssl_backends=
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700176
177dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700178dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700179dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700180INITIAL_LDFLAGS=$LDFLAGS
181INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700182
Elliott Hughes82be86d2017-09-20 17:00:17 -0700183dnl
184dnl Detect the canonical host and target build environment
185dnl
186
187AC_CANONICAL_HOST
188dnl Get system canonical name
189AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
190
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700191dnl Checks for programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700192
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700193dnl This defines _ALL_SOURCE for AIX
194CURL_CHECK_AIX_ALL_SOURCE
195
196dnl Our configure and build reentrant settings
197CURL_CONFIGURE_THREAD_SAFE
198CURL_CONFIGURE_REENTRANT
199
200dnl check for how to do large files
201AC_SYS_LARGEFILE
202
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700203XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700204
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700205#
206# Automake conditionals based on libtool related checks
207#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700208
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700209AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
210 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
211AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
212 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
213AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
214 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700215
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700216#
217# Due to libtool and automake machinery limitations of not allowing
218# specifying separate CPPFLAGS or CFLAGS when compiling objects for
219# inclusion of these in shared or static libraries, we are forced to
220# build using separate configure runs for shared and static libraries
221# on systems where different CPPFLAGS or CFLAGS are mandatory in order
222# to compile objects for each kind of library. Notice that relying on
223# the '-DPIC' CFLAG that libtool provides is not valid given that the
224# user might for example choose to build static libraries with PIC.
225#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700226
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700227#
228# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
229# targeting a static library and not building its shared counterpart.
230#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700231
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700232AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
233 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700234
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700235#
236# Make staticlib CPPFLAG variable and its definition visible in output
237# files unconditionally, providing an empty definition unless strictly
238# targeting a static library and not building its shared counterpart.
239#
240
241CPPFLAG_CURL_STATICLIB=
242if test "x$xc_lt_build_static_only" = 'xyes'; then
243 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
244fi
245AC_SUBST([CPPFLAG_CURL_STATICLIB])
246
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700247
248# Determine whether all dependent libraries must be specified when linking
249if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
250then
251 REQUIRE_LIB_DEPS=no
252else
253 REQUIRE_LIB_DEPS=yes
254fi
255AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700256AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700257
258dnl check if there's a way to force code inline
259AC_C_INLINE
260
261dnl **********************************************************************
262dnl platform/compiler/architecture specific checks/flags
263dnl **********************************************************************
264
265CURL_CHECK_COMPILER
266CURL_SET_COMPILER_BASIC_OPTS
267CURL_SET_COMPILER_DEBUG_OPTS
268CURL_SET_COMPILER_OPTIMIZE_OPTS
269CURL_SET_COMPILER_WARNING_OPTS
270
271if test "$compiler_id" = "INTEL_UNIX_C"; then
272 #
273 if test "$compiler_num" -ge "1000"; then
274 dnl icc 10.X or later
275 CFLAGS="$CFLAGS -shared-intel"
276 elif test "$compiler_num" -ge "900"; then
277 dnl icc 9.X specific
278 CFLAGS="$CFLAGS -i-dynamic"
279 fi
280 #
281fi
282
283CURL_CHECK_COMPILER_HALT_ON_ERROR
284CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700285CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
286CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700287
288CURL_CHECK_CURLDEBUG
289AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
290
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700291supports_unittests=yes
292# cross-compilation of unit tests static library/programs fails when
293# libcurl shared library is built. This might be due to a libtool or
294# automake issue. In this case we disable unit tests.
295if test "x$cross_compiling" != "xno" &&
296 test "x$enable_shared" != "xno"; then
297 supports_unittests=no
298fi
299
300# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
301# a problem related with OpenSSL headers and library versions not matching.
302# Disable unit tests while time to further investigate this is found.
303case $host in
304 mips-sgi-irix6.5)
305 if test "$compiler_id" = "GNU_C"; then
306 supports_unittests=no
307 fi
308 ;;
309esac
310
311# All AIX autobuilds fails unit tests linking against unittests library
312# due to unittests library being built with no symbols or members. Libtool ?
313# Disable unit tests while time to further investigate this is found.
314case $host_os in
315 aix*)
316 supports_unittests=no
317 ;;
318esac
319
320dnl Build unit tests when option --enable-debug is given.
321if test "x$want_debug" = "xyes" &&
322 test "x$supports_unittests" = "xyes"; then
323 want_unittests=yes
324else
325 want_unittests=no
326fi
327AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
328
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700329dnl **********************************************************************
330dnl Compilation based checks should not be done before this point.
331dnl **********************************************************************
332
333dnl **********************************************************************
334dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
335dnl and ws2tcpip.h take precedence over any other further checks which
336dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
337dnl this specific header files. And do them before its results are used.
338dnl **********************************************************************
339
340CURL_CHECK_HEADER_WINDOWS
341CURL_CHECK_NATIVE_WINDOWS
Alex Deymod15eaac2016-06-28 14:49:26 -0700342case X-"$curl_cv_native_windows" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700343 X-yes)
344 CURL_CHECK_HEADER_WINSOCK
345 CURL_CHECK_HEADER_WINSOCK2
346 CURL_CHECK_HEADER_WS2TCPIP
347 CURL_CHECK_HEADER_WINLDAP
348 CURL_CHECK_HEADER_WINBER
349 ;;
350 *)
Alex Deymod15eaac2016-06-28 14:49:26 -0700351 curl_cv_header_winsock_h="no"
352 curl_cv_header_winsock2_h="no"
353 curl_cv_header_ws2tcpip_h="no"
354 curl_cv_header_winldap_h="no"
355 curl_cv_header_winber_h="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700356 ;;
357esac
358CURL_CHECK_WIN32_LARGEFILE
359
Elliott Hughescee03382017-06-23 12:17:18 -0700360CURL_MAC_CFLAGS
Alex Deymo486467e2017-12-19 19:04:07 +0100361CURL_SUPPORTS_BUILTIN_AVAILABLE
Elliott Hughescee03382017-06-23 12:17:18 -0700362
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700363dnl ************************************************************
364dnl switch off particular protocols
365dnl
366AC_MSG_CHECKING([whether to support http])
367AC_ARG_ENABLE(http,
368AC_HELP_STRING([--enable-http],[Enable HTTP support])
369AC_HELP_STRING([--disable-http],[Disable HTTP support]),
370[ case "$enableval" in
371 no)
372 AC_MSG_RESULT(no)
373 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
Elliott Hughes82be86d2017-09-20 17:00:17 -0700374 disable_http="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700375 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
376 AC_SUBST(CURL_DISABLE_HTTP, [1])
377 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
378 AC_SUBST(CURL_DISABLE_RTSP, [1])
379 ;;
380 *) AC_MSG_RESULT(yes)
381 ;;
382 esac ],
383 AC_MSG_RESULT(yes)
384)
385AC_MSG_CHECKING([whether to support ftp])
386AC_ARG_ENABLE(ftp,
387AC_HELP_STRING([--enable-ftp],[Enable FTP support])
388AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
389[ case "$enableval" in
390 no)
391 AC_MSG_RESULT(no)
392 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
393 AC_SUBST(CURL_DISABLE_FTP, [1])
394 ;;
395 *) AC_MSG_RESULT(yes)
396 ;;
397 esac ],
398 AC_MSG_RESULT(yes)
399)
400AC_MSG_CHECKING([whether to support file])
401AC_ARG_ENABLE(file,
402AC_HELP_STRING([--enable-file],[Enable FILE support])
403AC_HELP_STRING([--disable-file],[Disable FILE support]),
404[ case "$enableval" in
405 no)
406 AC_MSG_RESULT(no)
407 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
408 AC_SUBST(CURL_DISABLE_FILE, [1])
409 ;;
410 *) AC_MSG_RESULT(yes)
411 ;;
412 esac ],
413 AC_MSG_RESULT(yes)
414)
415AC_MSG_CHECKING([whether to support ldap])
416AC_ARG_ENABLE(ldap,
417AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
418AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
419[ case "$enableval" in
420 no)
421 AC_MSG_RESULT(no)
422 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
423 AC_SUBST(CURL_DISABLE_LDAP, [1])
424 ;;
425 *)
426 AC_MSG_RESULT(yes)
427 ;;
428 esac ],[
429 AC_MSG_RESULT(yes) ]
430)
431AC_MSG_CHECKING([whether to support ldaps])
432AC_ARG_ENABLE(ldaps,
433AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
434AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
435[ case "$enableval" in
436 no)
437 AC_MSG_RESULT(no)
438 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
439 AC_SUBST(CURL_DISABLE_LDAPS, [1])
440 ;;
441 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
442 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
443 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
444 AC_SUBST(CURL_DISABLE_LDAPS, [1])
445 else
446 AC_MSG_RESULT(yes)
447 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
448 AC_SUBST(HAVE_LDAP_SSL, [1])
449 fi
450 ;;
451 esac ],[
452 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
453 AC_MSG_RESULT(no)
454 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
455 AC_SUBST(CURL_DISABLE_LDAPS, [1])
456 else
457 AC_MSG_RESULT(yes)
458 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
459 AC_SUBST(HAVE_LDAP_SSL, [1])
460 fi ]
461)
462
463AC_MSG_CHECKING([whether to support rtsp])
464AC_ARG_ENABLE(rtsp,
465AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
466AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
467[ case "$enableval" in
468 no)
469 AC_MSG_RESULT(no)
470 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
471 AC_SUBST(CURL_DISABLE_RTSP, [1])
472 ;;
473 *) if test x$CURL_DISABLE_HTTP = x1 ; then
474 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
475 else
476 AC_MSG_RESULT(yes)
477 curl_rtsp_msg="enabled"
478 fi
479 ;;
480 esac ],
481 if test "x$CURL_DISABLE_HTTP" != "x1"; then
482 AC_MSG_RESULT(yes)
483 curl_rtsp_msg="enabled"
484 else
485 AC_MSG_RESULT(no)
486 fi
487)
488
489AC_MSG_CHECKING([whether to support proxies])
490AC_ARG_ENABLE(proxy,
491AC_HELP_STRING([--enable-proxy],[Enable proxy support])
492AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
493[ case "$enableval" in
494 no)
495 AC_MSG_RESULT(no)
496 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
497 AC_SUBST(CURL_DISABLE_PROXY, [1])
498 ;;
499 *) AC_MSG_RESULT(yes)
500 ;;
501 esac ],
502 AC_MSG_RESULT(yes)
503)
504
505AC_MSG_CHECKING([whether to support dict])
506AC_ARG_ENABLE(dict,
507AC_HELP_STRING([--enable-dict],[Enable DICT support])
508AC_HELP_STRING([--disable-dict],[Disable DICT support]),
509[ case "$enableval" in
510 no)
511 AC_MSG_RESULT(no)
512 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
513 AC_SUBST(CURL_DISABLE_DICT, [1])
514 ;;
515 *) AC_MSG_RESULT(yes)
516 ;;
517 esac ],
518 AC_MSG_RESULT(yes)
519)
520AC_MSG_CHECKING([whether to support telnet])
521AC_ARG_ENABLE(telnet,
522AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
523AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
524[ case "$enableval" in
525 no)
526 AC_MSG_RESULT(no)
527 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
528 AC_SUBST(CURL_DISABLE_TELNET, [1])
529 ;;
530 *) AC_MSG_RESULT(yes)
531 ;;
532 esac ],
533 AC_MSG_RESULT(yes)
534)
535AC_MSG_CHECKING([whether to support tftp])
536AC_ARG_ENABLE(tftp,
537AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
538AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
539[ case "$enableval" in
540 no)
541 AC_MSG_RESULT(no)
542 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
543 AC_SUBST(CURL_DISABLE_TFTP, [1])
544 ;;
545 *) AC_MSG_RESULT(yes)
546 ;;
547 esac ],
548 AC_MSG_RESULT(yes)
549)
550
551AC_MSG_CHECKING([whether to support pop3])
552AC_ARG_ENABLE(pop3,
553AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
554AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
555[ case "$enableval" in
556 no)
557 AC_MSG_RESULT(no)
558 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
559 AC_SUBST(CURL_DISABLE_POP3, [1])
560 ;;
561 *) AC_MSG_RESULT(yes)
562 ;;
563 esac ],
564 AC_MSG_RESULT(yes)
565)
566
567
568AC_MSG_CHECKING([whether to support imap])
569AC_ARG_ENABLE(imap,
570AC_HELP_STRING([--enable-imap],[Enable IMAP support])
571AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
572[ case "$enableval" in
573 no)
574 AC_MSG_RESULT(no)
575 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
576 AC_SUBST(CURL_DISABLE_IMAP, [1])
577 ;;
578 *) AC_MSG_RESULT(yes)
579 ;;
580 esac ],
581 AC_MSG_RESULT(yes)
582)
583
584
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700585AC_MSG_CHECKING([whether to support smb])
586AC_ARG_ENABLE(smb,
587AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
588AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
589[ case "$enableval" in
590 no)
591 AC_MSG_RESULT(no)
592 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
593 AC_SUBST(CURL_DISABLE_SMB, [1])
594 ;;
595 *) AC_MSG_RESULT(yes)
596 ;;
597 esac ],
598 AC_MSG_RESULT(yes)
599)
600
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700601AC_MSG_CHECKING([whether to support smtp])
602AC_ARG_ENABLE(smtp,
603AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
604AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
605[ case "$enableval" in
606 no)
607 AC_MSG_RESULT(no)
608 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
609 AC_SUBST(CURL_DISABLE_SMTP, [1])
610 ;;
611 *) AC_MSG_RESULT(yes)
612 ;;
613 esac ],
614 AC_MSG_RESULT(yes)
615)
616
617AC_MSG_CHECKING([whether to support gopher])
618AC_ARG_ENABLE(gopher,
619AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
620AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
621[ case "$enableval" in
622 no)
623 AC_MSG_RESULT(no)
624 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
625 AC_SUBST(CURL_DISABLE_GOPHER, [1])
626 ;;
627 *) AC_MSG_RESULT(yes)
628 ;;
629 esac ],
630 AC_MSG_RESULT(yes)
631)
632
633
634dnl **********************************************************************
635dnl Check for built-in manual
636dnl **********************************************************************
637
638AC_MSG_CHECKING([whether to provide built-in manual])
639AC_ARG_ENABLE(manual,
640AC_HELP_STRING([--enable-manual],[Enable built-in manual])
641AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
642[ case "$enableval" in
643 no)
644 AC_MSG_RESULT(no)
645 ;;
646 *) AC_MSG_RESULT(yes)
647 USE_MANUAL="1"
648 ;;
649 esac ],
650 AC_MSG_RESULT(yes)
651 USE_MANUAL="1"
652)
653dnl The actual use of the USE_MANUAL variable is done much later in this
654dnl script to allow other actions to disable it as well.
655
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700656dnl ************************************************************
657dnl disable C code generation support
658dnl
659AC_MSG_CHECKING([whether to enable generation of C code])
660AC_ARG_ENABLE(libcurl_option,
661AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
662AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
663[ case "$enableval" in
664 no)
665 AC_MSG_RESULT(no)
666 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
667 curl_libcurl_msg="no"
668 ;;
669 *) AC_MSG_RESULT(yes)
670 ;;
671 esac ],
672 AC_MSG_RESULT(yes)
673)
674
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700675dnl **********************************************************************
676dnl Checks for libraries.
677dnl **********************************************************************
678
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700679AC_MSG_CHECKING([whether to use libgcc])
680AC_ARG_ENABLE(libgcc,
681AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
682[ case "$enableval" in
683 yes)
684 LIBS="-lgcc $LIBS"
685 AC_MSG_RESULT(yes)
686 ;;
687 *) AC_MSG_RESULT(no)
688 ;;
689 esac ],
690 AC_MSG_RESULT(no)
691)
692
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700693CURL_CHECK_LIB_XNET
694
695dnl gethostbyname without lib or in the nsl lib?
696AC_CHECK_FUNC(gethostbyname,
697 [HAVE_GETHOSTBYNAME="1"
698 ],
699 [ AC_CHECK_LIB(nsl, gethostbyname,
700 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700701 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700702 ])
703 ])
704
705if test "$HAVE_GETHOSTBYNAME" != "1"
706then
707 dnl gethostbyname in the socket lib?
708 AC_CHECK_LIB(socket, gethostbyname,
709 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700710 LIBS="-lsocket $LIBS"
711 ])
712fi
713
714if test "$HAVE_GETHOSTBYNAME" != "1"
715then
716 dnl gethostbyname in the watt lib?
717 AC_CHECK_LIB(watt, gethostbyname,
718 [HAVE_GETHOSTBYNAME="1"
719 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
720 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
721 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700722 ])
723fi
724
725dnl At least one system has been identified to require BOTH nsl and socket
726dnl libs at the same time to link properly.
727if test "$HAVE_GETHOSTBYNAME" != "1"
728then
729 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
730 my_ac_save_LIBS=$LIBS
731 LIBS="-lnsl -lsocket $LIBS"
732 AC_LINK_IFELSE([
733 AC_LANG_PROGRAM([[
734 ]],[[
735 gethostbyname();
736 ]])
737 ],[
738 AC_MSG_RESULT([yes])
739 HAVE_GETHOSTBYNAME="1"
740 ],[
741 AC_MSG_RESULT([no])
742 LIBS=$my_ac_save_LIBS
743 ])
744fi
745
746if test "$HAVE_GETHOSTBYNAME" != "1"
747then
748 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -0700749 if test "$curl_cv_header_windows_h" = "yes"; then
750 if test "$curl_cv_header_winsock_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700751 case $host in
752 *-*-mingw32ce*)
753 winsock_LIB="-lwinsock"
754 ;;
755 *)
756 winsock_LIB="-lwsock32"
757 ;;
758 esac
759 fi
Alex Deymod15eaac2016-06-28 14:49:26 -0700760 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700761 winsock_LIB="-lws2_32"
762 fi
763 if test ! -z "$winsock_LIB"; then
764 my_ac_save_LIBS=$LIBS
765 LIBS="$winsock_LIB $LIBS"
766 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
767 AC_LINK_IFELSE([
768 AC_LANG_PROGRAM([[
769#ifdef HAVE_WINDOWS_H
770#ifndef WIN32_LEAN_AND_MEAN
771#define WIN32_LEAN_AND_MEAN
772#endif
773#include <windows.h>
774#ifdef HAVE_WINSOCK2_H
775#include <winsock2.h>
776#else
777#ifdef HAVE_WINSOCK_H
778#include <winsock.h>
779#endif
780#endif
781#endif
782 ]],[[
783 gethostbyname("www.dummysite.com");
784 ]])
785 ],[
786 AC_MSG_RESULT([yes])
787 HAVE_GETHOSTBYNAME="1"
788 ],[
789 AC_MSG_RESULT([no])
790 winsock_LIB=""
791 LIBS=$my_ac_save_LIBS
792 ])
793 fi
794 fi
795fi
796
797if test "$HAVE_GETHOSTBYNAME" != "1"
798then
799 dnl This is for Minix 3.1
800 AC_MSG_CHECKING([for gethostbyname for Minix 3])
801 AC_LINK_IFELSE([
802 AC_LANG_PROGRAM([[
803/* Older Minix versions may need <net/gen/netdb.h> here instead */
804#include <netdb.h>
805 ]],[[
806 gethostbyname("www.dummysite.com");
807 ]])
808 ],[
809 AC_MSG_RESULT([yes])
810 HAVE_GETHOSTBYNAME="1"
811 ],[
812 AC_MSG_RESULT([no])
813 ])
814fi
815
816if test "$HAVE_GETHOSTBYNAME" != "1"
817then
818 dnl This is for eCos with a stubbed DNS implementation
819 AC_MSG_CHECKING([for gethostbyname for eCos])
820 AC_LINK_IFELSE([
821 AC_LANG_PROGRAM([[
822#include <stdio.h>
823#include <netdb.h>
824 ]],[[
825 gethostbyname("www.dummysite.com");
826 ]])
827 ],[
828 AC_MSG_RESULT([yes])
829 HAVE_GETHOSTBYNAME="1"
830 ],[
831 AC_MSG_RESULT([no])
832 ])
833fi
834
835if test "$HAVE_GETHOSTBYNAME" != "1"
836then
837 dnl gethostbyname in the network lib - for Haiku OS
838 AC_CHECK_LIB(network, gethostbyname,
839 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700840 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700841 ])
842fi
843
844if test "$HAVE_GETHOSTBYNAME" != "1"
845then
846 dnl gethostbyname in the net lib - for BeOS
847 AC_CHECK_LIB(net, gethostbyname,
848 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700849 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700850 ])
851fi
852
853
854if test "$HAVE_GETHOSTBYNAME" != "1"; then
855 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
856fi
857
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700858CURL_CHECK_LIBS_CONNECT
859
860CURL_NETWORK_LIBS=$LIBS
861
862dnl **********************************************************************
863dnl In case that function clock_gettime with monotonic timer is available,
864dnl check for additional required libraries.
865dnl **********************************************************************
866CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
867
868dnl **********************************************************************
869dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700870dnl servers and libtest cases which require networking and clock_gettime
871dnl support. Save the list of required libraries at this point for use
872dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700873dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700874CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700875
876dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700877dnl Check for the presence of ZLIB libraries and headers
878dnl **********************************************************************
879
880dnl Check for & handle argument to --with-zlib.
881
882clean_CPPFLAGS=$CPPFLAGS
883clean_LDFLAGS=$LDFLAGS
884clean_LIBS=$LIBS
885ZLIB_LIBS=""
886AC_ARG_WITH(zlib,
887AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
888AC_HELP_STRING([--without-zlib],[disable use of zlib]),
889 [OPT_ZLIB="$withval"])
890
891if test "$OPT_ZLIB" = "no" ; then
892 AC_MSG_WARN([zlib disabled])
893else
894 if test "$OPT_ZLIB" = "yes" ; then
895 OPT_ZLIB=""
896 fi
897
Elliott Hughescee03382017-06-23 12:17:18 -0700898 if test -z "$OPT_ZLIB" ; then
Elliott Hughes82be86d2017-09-20 17:00:17 -0700899 CURL_CHECK_PKGCONFIG(zlib)
900
901 if test "$PKGCONFIG" != "no" ; then
902 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
903 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
904 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
905 OPT_ZLIB=""
906 HAVE_LIBZ="1"
907 fi
Elliott Hughescee03382017-06-23 12:17:18 -0700908
909 if test -z "$HAVE_LIBZ"; then
910
911 dnl Check for the lib without setting any new path, since many
912 dnl people have it in the default path
913
914 AC_CHECK_LIB(z, inflateEnd,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700915 dnl libz found, set the variable
916 [HAVE_LIBZ="1"
917 LIBS="-lz $LIBS"],
918 dnl if no lib found, try /usr/local
919 [OPT_ZLIB="/usr/local"])
Elliott Hughescee03382017-06-23 12:17:18 -0700920 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700921 fi
922
923 dnl Add a nonempty path to the compiler flags
924 if test -n "$OPT_ZLIB"; then
925 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
926 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
927 fi
928
929 AC_CHECK_HEADER(zlib.h,
930 [
931 dnl zlib.h was found
932 HAVE_ZLIB_H="1"
933 dnl if the lib wasn't found already, try again with the new paths
934 if test "$HAVE_LIBZ" != "1"; then
935 AC_CHECK_LIB(z, gzread,
936 [
937 dnl the lib was found!
938 HAVE_LIBZ="1"
939 LIBS="-lz $LIBS"
940 ],
941 [ CPPFLAGS=$clean_CPPFLAGS
942 LDFLAGS=$clean_LDFLAGS])
943 fi
944 ],
945 [
946 dnl zlib.h was not found, restore the flags
947 CPPFLAGS=$clean_CPPFLAGS
948 LDFLAGS=$clean_LDFLAGS]
949 )
950
951 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
952 then
953 AC_MSG_WARN([configure found only the libz lib, not the header file!])
954 HAVE_LIBZ=""
955 CPPFLAGS=$clean_CPPFLAGS
956 LDFLAGS=$clean_LDFLAGS
957 LIBS=$clean_LIBS
958 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
959 then
960 AC_MSG_WARN([configure found only the libz header file, not the lib!])
961 CPPFLAGS=$clean_CPPFLAGS
962 LDFLAGS=$clean_LDFLAGS
963 LIBS=$clean_LIBS
964 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
965 then
966 dnl both header and lib were found!
967 AC_SUBST(HAVE_LIBZ)
968 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
969 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
970
971 ZLIB_LIBS="-lz"
972 LIBS="-lz $clean_LIBS"
973
974 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
975 AMFIXLIB="1"
976 AC_MSG_NOTICE([found both libz and libz.h header])
977 curl_zlib_msg="enabled"
978 fi
979fi
980
981dnl set variable for use in automakefile(s)
982AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
983AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700984
985dnl **********************************************************************
Alex Deymo486467e2017-12-19 19:04:07 +0100986dnl Check for the presence of BROTLI decoder libraries and headers
987dnl **********************************************************************
988
989dnl Brotli project home page: https://github.com/google/brotli
990
991dnl Default to compiler & linker defaults for BROTLI files & libraries.
992OPT_BROTLI=off
993AC_ARG_WITH(brotli,dnl
994AC_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])
995AC_HELP_STRING([--without-brotli], [disable BROTLI]),
996 OPT_BROTLI=$withval)
997
998if test X"$OPT_BROTLI" != Xno; then
999 dnl backup the pre-brotli variables
1000 CLEANLDFLAGS="$LDFLAGS"
1001 CLEANCPPFLAGS="$CPPFLAGS"
1002 CLEANLIBS="$LIBS"
1003
1004 case "$OPT_BROTLI" in
1005 yes)
1006 dnl --with-brotli (without path) used
1007 CURL_CHECK_PKGCONFIG(libbrotlidec)
1008
1009 if test "$PKGCONFIG" != "no" ; then
1010 LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1011 LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1012 CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1013 version=`$PKGCONFIG --modversion libbrotlidec`
1014 DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/-L//'`
1015 fi
1016
1017 ;;
1018 off)
1019 dnl no --with-brotli option given, just check default places
1020 ;;
1021 *)
1022 dnl use the given --with-brotli spot
1023 PREFIX_BROTLI=$OPT_BROTLI
1024 ;;
1025 esac
1026
1027 dnl if given with a prefix, we set -L and -I based on that
1028 if test -n "$PREFIX_BROTLI"; then
1029 LIB_BROTLI="-lbrotlidec"
1030 LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1031 CPP_BROTLI=-I${PREFIX_BROTLI}/include
1032 DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1033 fi
1034
1035 LDFLAGS="$LDFLAGS $LD_BROTLI"
1036 CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1037 LIBS="$LIB_BROTLI $LIBS"
1038
1039 AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1040
1041 AC_CHECK_HEADERS(brotli/decode.h,
1042 curl_brotli_msg="enabled (libbrotlidec)"
1043 HAVE_BROTLI=1
1044 AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1045 AC_SUBST(HAVE_BROTLI, [1])
1046 )
1047
1048 if test X"$OPT_BROTLI" != Xoff &&
1049 test "$HAVE_BROTLI" != "1"; then
1050 AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1051 fi
1052
1053 if test "$HAVE_BROTLI" = "1"; then
1054 if test -n "$DIR_BROTLI"; then
1055 dnl when the brotli shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001056 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Alex Deymo486467e2017-12-19 19:04:07 +01001057 dnl to prevent further configure tests to fail due to this
1058
1059 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001060 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_BROTLI"
1061 export CURL_LIBRARY_PATH
1062 AC_MSG_NOTICE([Added $DIR_BROTLI to CURL_LIBRARY_PATH])
Alex Deymo486467e2017-12-19 19:04:07 +01001063 fi
1064 fi
1065 else
1066 dnl no brotli, revert back to clean variables
1067 LDFLAGS=$CLEANLDFLAGS
1068 CPPFLAGS=$CLEANCPPFLAGS
1069 LIBS=$CLEANLIBS
1070 fi
1071fi
1072
1073dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001074dnl Check for LDAP
1075dnl **********************************************************************
1076
1077LDAPLIBNAME=""
1078AC_ARG_WITH(ldap-lib,
1079AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
1080 [LDAPLIBNAME="$withval"])
1081
1082LBERLIBNAME=""
1083AC_ARG_WITH(lber-lib,
1084AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
1085 [LBERLIBNAME="$withval"])
1086
1087if test x$CURL_DISABLE_LDAP != x1 ; then
1088
1089 CURL_CHECK_HEADER_LBER
1090 CURL_CHECK_HEADER_LDAP
1091 CURL_CHECK_HEADER_LDAPSSL
1092 CURL_CHECK_HEADER_LDAP_SSL
1093
1094 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001095 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001096 dnl Windows uses a single and unique LDAP library name
1097 LDAPLIBNAME="wldap32"
1098 LBERLIBNAME="no"
1099 fi
1100 fi
1101
1102 if test "$LDAPLIBNAME" ; then
1103 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1104 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1105 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001106 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001107 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001108 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001109 else
1110 dnl Try to find the right ldap libraries for this system
1111 CURL_CHECK_LIBS_LDAP
1112 case X-"$curl_cv_ldap_LIBS" in
1113 X-unknown)
1114 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1115 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1116 AC_SUBST(CURL_DISABLE_LDAP, [1])
1117 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1118 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1119 ;;
1120 esac
1121 fi
1122fi
1123
1124if test x$CURL_DISABLE_LDAP != x1 ; then
1125
1126 if test "$LBERLIBNAME" ; then
1127 dnl If name is "no" then don't define this library at all
1128 dnl (it's only needed if libldap.so's dependencies are broken).
1129 if test "$LBERLIBNAME" != "no" ; then
1130 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1131 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1132 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001133 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001134 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001135 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001136 fi
1137 fi
1138fi
1139
1140if test x$CURL_DISABLE_LDAP != x1 ; then
1141 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1142
1143 if test "$LDAPLIBNAME" = "wldap32"; then
1144 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001145 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001146 else
1147 curl_ldap_msg="enabled (OpenLDAP)"
1148 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1149 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1150 AC_SUBST(USE_OPENLDAP, [1])
1151 fi
1152 fi
1153fi
1154
1155if test x$CURL_DISABLE_LDAPS != x1 ; then
1156 curl_ldaps_msg="enabled"
1157fi
1158
1159dnl **********************************************************************
1160dnl Checks for IPv6
1161dnl **********************************************************************
1162
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001163AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001164AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001165AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1166AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001167[ case "$enableval" in
1168 no)
1169 AC_MSG_RESULT(no)
1170 ipv6=no
1171 ;;
1172 *) AC_MSG_RESULT(yes)
1173 ipv6=yes
1174 ;;
1175 esac ],
1176
1177 AC_TRY_RUN([ /* is AF_INET6 available? */
1178#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001179#ifdef HAVE_WINSOCK2_H
1180#include <winsock2.h>
1181#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001182#include <sys/socket.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001183#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001184#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001185main()
1186{
1187 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1188 exit(1);
1189 else
1190 exit(0);
1191}
1192],
1193 AC_MSG_RESULT(yes)
1194 ipv6=yes,
1195 AC_MSG_RESULT(no)
1196 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001197 AC_MSG_RESULT(yes)
1198 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001199))
1200
1201if test "$ipv6" = "yes"; then
1202 curl_ipv6_msg="enabled"
1203fi
1204
1205# Check if struct sockaddr_in6 have sin6_scope_id member
1206if test "$ipv6" = yes; then
1207 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1208 AC_TRY_COMPILE([
1209#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001210#ifdef HAVE_WINSOCK2_H
1211#include <winsock2.h>
1212#include <ws2tcpip.h>
1213#else
1214#include <netinet/in.h>
Elliott Hughes0128fe42018-02-27 14:57:55 -08001215#if defined (__TANDEM)
1216# include <netinet/in6.h>
1217#endif
Alex Deymod15eaac2016-06-28 14:49:26 -07001218#endif] ,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001219 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1220 if test "$have_sin6_scope_id" = yes; then
1221 AC_MSG_RESULT([yes])
1222 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1223 else
1224 AC_MSG_RESULT([no])
1225 fi
1226fi
1227
1228dnl **********************************************************************
1229dnl Check if the operating system allows programs to write to their own argv[]
1230dnl **********************************************************************
1231
1232AC_MSG_CHECKING([if argv can be written to])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001233CURL_RUN_IFELSE([
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001234int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001235 argv[0][0] = ' ';
1236 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001237}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001238],[
1239 curl_cv_writable_argv=yes
1240],[
1241 curl_cv_writable_argv=no
1242],[
1243 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001244])
1245case $curl_cv_writable_argv in
1246yes)
1247 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1248 AC_MSG_RESULT(yes)
1249 ;;
1250no)
1251 AC_MSG_RESULT(no)
1252 ;;
1253*)
1254 AC_MSG_RESULT(no)
1255 AC_MSG_WARN([the previous check could not be made default was used])
1256 ;;
1257esac
1258
1259dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001260dnl Check for GSS-API libraries
1261dnl **********************************************************************
1262
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001263dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001264
1265GSSAPI_ROOT="/usr"
1266AC_ARG_WITH(gssapi-includes,
1267 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001268 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001269 [ GSSAPI_INCS="-I$withval"
1270 want_gss="yes" ]
1271)
1272
1273AC_ARG_WITH(gssapi-libs,
1274 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001275 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001276 [ GSSAPI_LIB_DIR="-L$withval"
1277 want_gss="yes" ]
1278)
1279
1280AC_ARG_WITH(gssapi,
1281 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001282 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001283 GSSAPI_ROOT="$withval"
1284 if test x"$GSSAPI_ROOT" != xno; then
1285 want_gss="yes"
1286 if test x"$GSSAPI_ROOT" = xyes; then
1287 dnl if yes, then use default root
1288 GSSAPI_ROOT="/usr"
1289 fi
1290 fi
1291])
1292
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001293: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1294
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001295save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001296AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001297if test x"$want_gss" = xyes; then
1298 AC_MSG_RESULT(yes)
1299
1300 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001301 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1302 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1303 elif test -f "$KRB5CONFIG"; then
1304 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001305 elif test "$GSSAPI_ROOT" != "yes"; then
1306 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1307 fi
1308 fi
1309
1310 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1311
1312 AC_CHECK_HEADER(gss.h,
1313 [
1314 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001315 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001316 gnu_gss=yes
1317 ],
1318 [
1319 dnl not found, check Heimdal or MIT
1320 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1321 AC_CHECK_HEADERS(
1322 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1323 [],
1324 [not_mit=1],
1325 [
1326AC_INCLUDES_DEFAULT
1327#ifdef HAVE_GSSAPI_GSSAPI_H
1328#include <gssapi/gssapi.h>
1329#endif
1330 ])
1331 if test "x$not_mit" = "x1"; then
1332 dnl MIT not found, check for Heimdal
1333 AC_CHECK_HEADER(gssapi.h,
1334 [
1335 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001336 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001337 ],
1338 [
1339 dnl no header found, disabling GSS
1340 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001341 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001342 ]
1343 )
1344 else
1345 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001346 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1347 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1348 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001349 AC_COMPILE_IFELSE([
1350 AC_LANG_PROGRAM([[
1351#include <gssapi/gssapi.h>
1352#include <gssapi/gssapi_generic.h>
1353#include <gssapi/gssapi_krb5.h>
1354 ]],[[
1355 gss_import_name(
1356 (OM_uint32 *)0,
1357 (gss_buffer_t)0,
1358 GSS_C_NT_HOSTBASED_SERVICE,
1359 (gss_name_t *)0);
1360 ]])
1361 ],[
1362 AC_MSG_RESULT([yes])
1363 ],[
1364 AC_MSG_RESULT([no])
1365 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001366 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001367 ])
1368 fi
1369 ]
1370 )
1371else
1372 AC_MSG_RESULT(no)
1373fi
1374if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001375 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1376 HAVE_GSSAPI=1
1377 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001378
1379 if test -n "$gnu_gss"; then
1380 curl_gss_msg="enabled (GNU GSS)"
1381 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001382 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001383 elif test -z "$GSSAPI_LIB_DIR"; then
1384 case $host in
1385 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001386 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001387 ;;
1388 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001389 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001390 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1391 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001392 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1393 LIBS="$gss_libs $LIBS"
1394 elif test -f "$KRB5CONFIG"; then
1395 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1396 dnl into LIBS
1397 gss_libs=`$KRB5CONFIG --libs gssapi`
1398 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001399 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001400 case $host in
1401 *-hp-hpux*)
1402 gss_libname="gss"
1403 ;;
1404 *)
1405 gss_libname="gssapi"
1406 ;;
1407 esac
1408
1409 if test "$GSSAPI_ROOT" != "yes"; then
1410 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1411 LIBS="-l$gss_libname $LIBS"
1412 else
1413 LIBS="-l$gss_libname $LIBS"
1414 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001415 fi
1416 ;;
1417 esac
1418 else
1419 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001420 case $host in
1421 *-hp-hpux*)
1422 LIBS="-lgss $LIBS"
1423 ;;
1424 *)
1425 LIBS="-lgssapi $LIBS"
1426 ;;
1427 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001428 fi
1429else
1430 CPPFLAGS="$save_CPPFLAGS"
1431fi
1432
Alex Deymo486467e2017-12-19 19:04:07 +01001433build_libstubgss=no
1434if test x"$want_gss" = "xyes"; then
1435 build_libstubgss=yes
1436fi
1437
1438AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1439
1440dnl -------------------------------------------------------------
1441dnl parse --with-default-ssl-backend so it can be validated below
1442dnl -------------------------------------------------------------
1443
1444DEFAULT_SSL_BACKEND=no
1445VALID_DEFAULT_SSL_BACKEND=
1446AC_ARG_WITH(default-ssl-backend,
1447AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1448AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1449 [DEFAULT_SSL_BACKEND=$withval])
1450case "$DEFAULT_SSL_BACKEND" in
1451 no)
1452 dnl --without-default-ssl-backend option used
1453 ;;
1454 default|yes)
1455 dnl --with-default-ssl-backend option used without name
1456 AC_MSG_ERROR([The name of the default SSL backend is required.])
1457 ;;
1458 *)
1459 dnl --with-default-ssl-backend option used with name
1460 AC_SUBST(DEFAULT_SSL_BACKEND)
1461 dnl needs to be validated below
1462 VALID_DEFAULT_SSL_BACKEND=no
1463 ;;
1464esac
1465
1466dnl **********************************************************************
1467
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001468dnl -------------------------------------------------
1469dnl check winssl option before other SSL libraries
1470dnl -------------------------------------------------
1471
1472OPT_WINSSL=no
1473AC_ARG_WITH(winssl,dnl
1474AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1475AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1476 OPT_WINSSL=$withval)
1477
1478AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
Alex Deymo486467e2017-12-19 19:04:07 +01001479if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1480 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001481 if test "x$OPT_WINSSL" != "xno" &&
Alex Deymod15eaac2016-06-28 14:49:26 -07001482 test "x$curl_cv_native_windows" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001483 AC_MSG_RESULT(yes)
1484 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1485 AC_SUBST(USE_SCHANNEL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001486 ssl_msg="Windows-native"
1487 test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001488 WINSSL_ENABLED=1
1489 # --with-winssl implies --enable-sspi
1490 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1491 AC_SUBST(USE_WINDOWS_SSPI, [1])
1492 curl_sspi_msg="enabled"
Alex Deymoe3149cc2016-10-05 11:18:42 -07001493 LIBS="-lcrypt32 $LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001494 else
1495 AC_MSG_RESULT(no)
1496 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001497 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001498else
1499 AC_MSG_RESULT(no)
1500fi
1501
1502OPT_DARWINSSL=no
1503AC_ARG_WITH(darwinssl,dnl
Elliott Hughescee03382017-06-23 12:17:18 -07001504AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1505AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001506 OPT_DARWINSSL=$withval)
1507
Elliott Hughescee03382017-06-23 12:17:18 -07001508AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS])
Alex Deymo486467e2017-12-19 19:04:07 +01001509if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001510 if test "x$OPT_DARWINSSL" != "xno" &&
1511 test -d "/System/Library/Frameworks/Security.framework"; then
1512 AC_MSG_RESULT(yes)
Elliott Hughescee03382017-06-23 12:17:18 -07001513 AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001514 AC_SUBST(USE_DARWINSSL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001515 ssl_msg="Apple OS-native"
1516 test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001517 DARWINSSL_ENABLED=1
1518 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1519 else
1520 AC_MSG_RESULT(no)
1521 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001522 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001523else
1524 AC_MSG_RESULT(no)
1525fi
1526
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001527dnl **********************************************************************
1528dnl Check for the presence of SSL libraries and headers
1529dnl **********************************************************************
1530
1531dnl Default to compiler & linker defaults for SSL files & libraries.
1532OPT_SSL=off
1533dnl Default to no CA bundle
1534ca="no"
1535AC_ARG_WITH(ssl,dnl
1536AC_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])
1537AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1538 OPT_SSL=$withval)
1539
Alex Deymo486467e2017-12-19 19:04:07 +01001540if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1541 test X"$OPT_SSL" != Xno; then
1542 ssl_msg=
1543
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001544 dnl backup the pre-ssl variables
1545 CLEANLDFLAGS="$LDFLAGS"
1546 CLEANCPPFLAGS="$CPPFLAGS"
1547 CLEANLIBS="$LIBS"
1548
Alex Deymod15eaac2016-06-28 14:49:26 -07001549 dnl This is for Msys/Mingw
1550 case $host in
1551 *-*-msys* | *-*-mingw*)
1552 AC_MSG_CHECKING([for gdi32])
1553 my_ac_save_LIBS=$LIBS
1554 LIBS="-lgdi32 $LIBS"
1555 AC_TRY_LINK([#include <windef.h>
1556 #include <wingdi.h>],
1557 [GdiFlush();],
1558 [ dnl worked!
1559 AC_MSG_RESULT([yes])],
1560 [ dnl failed, restore LIBS
1561 LIBS=$my_ac_save_LIBS
1562 AC_MSG_RESULT(no)]
1563 )
1564 ;;
1565 esac
1566
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001567 case "$OPT_SSL" in
1568 yes)
1569 dnl --with-ssl (without path) used
1570 if test x$cross_compiling != xyes; then
1571 dnl only do pkg-config magic when not cross-compiling
1572 PKGTEST="yes"
1573 fi
1574 PREFIX_OPENSSL=/usr/local/ssl
1575 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1576 ;;
1577 off)
1578 dnl no --with-ssl option given, just check default places
1579 if test x$cross_compiling != xyes; then
1580 dnl only do pkg-config magic when not cross-compiling
1581 PKGTEST="yes"
1582 fi
1583 PREFIX_OPENSSL=
1584 ;;
1585 *)
1586 dnl check the given --with-ssl spot
1587 PKGTEST="no"
1588 PREFIX_OPENSSL=$OPT_SSL
1589
1590 dnl Try pkg-config even when cross-compiling. Since we
1591 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1592 dnl the user told us to look
1593 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1594 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001595 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001596 PKGTEST="yes"
1597 fi
1598
1599 dnl in case pkg-config comes up empty, use what we got
1600 dnl via --with-ssl
1601 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1602 if test "$PREFIX_OPENSSL" != "/usr" ; then
1603 SSL_LDFLAGS="-L$LIB_OPENSSL"
1604 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1605 fi
1606 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1607 ;;
1608 esac
1609
1610 if test "$PKGTEST" = "yes"; then
1611
1612 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1613
1614 if test "$PKGCONFIG" != "no" ; then
1615 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1616 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1617
1618 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1619 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1620
1621 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1622 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1623
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001624 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001625 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1626 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1627 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1628
1629 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1630
1631 dnl use the values pkg-config reported. This is here
1632 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1633 dnl learn about this via pkg-config. If we only have
1634 dnl the argument to --with-ssl we don't know what
1635 dnl additional libs may be necessary. Hope that we
1636 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001637 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001638 fi
1639 fi
1640
1641 dnl finally, set flags to use SSL
1642 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1643 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1644
Alex Deymod15eaac2016-06-28 14:49:26 -07001645 AC_CHECK_LIB(crypto, HMAC_Update,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001646 HAVECRYPTO="yes"
1647 LIBS="-lcrypto $LIBS"
1648 ],[
1649 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1650 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
Alex Deymod15eaac2016-06-28 14:49:26 -07001651 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001652 HAVECRYPTO="yes"
1653 LIBS="-lcrypto $LIBS"], [
Elliott Hughes82be86d2017-09-20 17:00:17 -07001654
1655 dnl still no, but what about with -ldl?
1656 AC_MSG_CHECKING([OpenSSL linking with -ldl])
Elliott Hughes0128fe42018-02-27 14:57:55 -08001657 LIBS="$LIBS -ldl"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001658 AC_TRY_LINK(
1659 [
1660 #include <openssl/err.h>
1661 ],
1662 [
1663 ERR_clear_error();
1664 ],
1665 [
1666 AC_MSG_RESULT(yes)
1667 HAVECRYPTO="yes"
1668 ],
1669 [
1670 AC_MSG_RESULT(no)
1671 dnl ok, so what about bouth -ldl and -lpthread?
1672
1673 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
Elliott Hughes0128fe42018-02-27 14:57:55 -08001674 LIBS="$LIBS -lpthread"
Elliott Hughes82be86d2017-09-20 17:00:17 -07001675 AC_TRY_LINK(
1676 [
1677 #include <openssl/err.h>
1678 ],
1679 [
1680 ERR_clear_error();
1681 ],
1682 [
1683 AC_MSG_RESULT(yes)
1684 HAVECRYPTO="yes"
1685 ],
1686 [
1687 AC_MSG_RESULT(no)
1688 LDFLAGS="$CLEANLDFLAGS"
1689 CPPFLAGS="$CLEANCPPFLAGS"
1690 LIBS="$CLEANLIBS"
1691
1692 ])
1693
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001694 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001695
Elliott Hughes82be86d2017-09-20 17:00:17 -07001696 ])
1697 ])
Alex Deymod15eaac2016-06-28 14:49:26 -07001698
1699 if test X"$HAVECRYPTO" = X"yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001700 dnl This is only reasonable to do if crypto actually is there: check for
1701 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1702
1703 AC_CHECK_LIB(ssl, SSL_connect)
1704
1705 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1706 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1707 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1708 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001709 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001710 AC_CHECK_LIB(ssl, SSL_connect)
1711 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1712 dnl still no SSL_connect
1713 AC_MSG_RESULT(no)
1714 LIBS=$OLIBS
1715 else
1716 AC_MSG_RESULT(yes)
1717 fi
1718
1719 else
1720
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001721 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001722 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1723 openssl/pem.h openssl/ssl.h openssl/err.h,
Alex Deymo486467e2017-12-19 19:04:07 +01001724 ssl_msg="OpenSSL"
1725 test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001726 OPENSSL_ENABLED=1
1727 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1728
1729 if test $ac_cv_header_openssl_x509_h = no; then
1730 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1731 dnl since 'err.h' might in fact find a krb4 header with the same
1732 dnl name
1733 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1734
1735 if test $ac_cv_header_x509_h = yes &&
1736 test $ac_cv_header_crypto_h = yes &&
1737 test $ac_cv_header_ssl_h = yes; then
1738 dnl three matches
Alex Deymo486467e2017-12-19 19:04:07 +01001739 ssl_msg="OpenSSL"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001740 OPENSSL_ENABLED=1
1741 fi
1742 fi
1743 fi
1744
Alex Deymo486467e2017-12-19 19:04:07 +01001745 if test X"$OPENSSL_ENABLED" != X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001746 LIBS="$CLEANLIBS"
1747 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001748
1749 if test X"$OPT_SSL" != Xoff &&
1750 test "$OPENSSL_ENABLED" != "1"; then
1751 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1752 fi
1753 fi
1754
1755 if test X"$OPENSSL_ENABLED" = X"1"; then
1756 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1757 dnl stuff, it is kind of "separated" from the main SSL check
1758 AC_CHECK_FUNC(ENGINE_init,
1759 [
1760 AC_CHECK_HEADERS(openssl/engine.h)
1761 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1762 ])
1763
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001764 dnl These can only exist if OpenSSL exists
1765 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1766 dnl SSL_get_shutdown (but this check won't actually detect it there
1767 dnl as it's a macro that needs the header files be included)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001768
Elliott Hughescee03382017-06-23 12:17:18 -07001769 AC_CHECK_FUNCS( RAND_egd \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001770 ENGINE_cleanup \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001771 SSL_get_shutdown \
Alex Deymod15eaac2016-06-28 14:49:26 -07001772 SSLv2_client_method )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001773
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001774 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001775 AC_COMPILE_IFELSE([
Alex Deymod15eaac2016-06-28 14:49:26 -07001776 AC_LANG_PROGRAM([[
1777 #include <openssl/base.h>
1778 ]],[[
1779 #ifndef OPENSSL_IS_BORINGSSL
1780 #error not boringssl
1781 #endif
1782 ]])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001783 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001784 AC_MSG_RESULT([yes])
1785 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1786 [Define to 1 if using BoringSSL.])
Alex Deymo486467e2017-12-19 19:04:07 +01001787 ssl_msg="BoringSSL"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001788 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001789 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001790 ])
1791
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001792 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001793 AC_COMPILE_IFELSE([
1794 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001795#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001796 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001797 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001798 ]])
1799 ],[
1800 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001801 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1802 [Define to 1 if using libressl.])
Alex Deymo486467e2017-12-19 19:04:07 +01001803 ssl_msg="libressl"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001804 ],[
1805 AC_MSG_RESULT([no])
1806 ])
1807 fi
1808
1809 if test "$OPENSSL_ENABLED" = "1"; then
1810 if test -n "$LIB_OPENSSL"; then
1811 dnl when the ssl shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001812 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001813 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001814 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001815 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_OPENSSL"
1816 export CURL_LIBRARY_PATH
1817 AC_MSG_NOTICE([Added $LIB_OPENSSL to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001818 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001819 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001820 CURL_CHECK_OPENSSL_API
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001821 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001822 fi
1823
Alex Deymo486467e2017-12-19 19:04:07 +01001824 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001825fi
1826
1827dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001828dnl Check for the random seed preferences
1829dnl **********************************************************************
1830
1831if test X"$OPENSSL_ENABLED" = X"1"; then
1832 AC_ARG_WITH(egd-socket,
1833 AC_HELP_STRING([--with-egd-socket=FILE],
1834 [Entropy Gathering Daemon socket pathname]),
1835 [ EGD_SOCKET="$withval" ]
1836 )
1837 if test -n "$EGD_SOCKET" ; then
1838 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1839 [your Entropy Gathering Daemon socket pathname] )
1840 fi
1841
1842 dnl Check for user-specified random device
1843 AC_ARG_WITH(random,
1844 AC_HELP_STRING([--with-random=FILE],
1845 [read randomness from FILE (default=/dev/urandom)]),
1846 [ RANDOM_FILE="$withval" ],
1847 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001848 if test x$cross_compiling != xyes; then
1849 dnl Check for random device
1850 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1851 else
1852 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1853 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001854 ]
1855 )
1856 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1857 AC_SUBST(RANDOM_FILE)
1858 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1859 [a suitable file to read random data from])
1860 fi
1861fi
1862
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001863dnl ---
1864dnl We require OpenSSL with SRP support.
1865dnl ---
1866if test "$OPENSSL_ENABLED" = "1"; then
1867 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1868 [
1869 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1870 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1871 ])
1872fi
1873
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001874dnl ----------------------------------------------------
1875dnl check for GnuTLS
1876dnl ----------------------------------------------------
1877
1878dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1879OPT_GNUTLS=no
1880
1881AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001882AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001883AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1884 OPT_GNUTLS=$withval)
1885
Alex Deymo486467e2017-12-19 19:04:07 +01001886if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1887 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001888
1889 if test X"$OPT_GNUTLS" != Xno; then
1890
1891 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001892 addlib=""
1893 gtlslib=""
1894 version=""
1895 addcflags=""
1896
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001897 if test "x$OPT_GNUTLS" = "xyes"; then
1898 dnl this is with no partiular path given
1899 CURL_CHECK_PKGCONFIG(gnutls)
1900
1901 if test "$PKGCONFIG" != "no" ; then
1902 addlib=`$PKGCONFIG --libs-only-l gnutls`
1903 addld=`$PKGCONFIG --libs-only-L gnutls`
1904 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1905 version=`$PKGCONFIG --modversion gnutls`
1906 gtlslib=`echo $addld | $SED -e 's/-L//'`
1907 else
1908 dnl without pkg-config, we try libgnutls-config as that was how it
1909 dnl used to be done
1910 check=`libgnutls-config --version 2>/dev/null`
1911 if test -n "$check"; then
1912 addlib=`libgnutls-config --libs`
1913 addcflags=`libgnutls-config --cflags`
1914 version=`libgnutls-config --version`
1915 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1916 fi
1917 fi
1918 else
1919 dnl this is with a given path, first check if there's a libgnutls-config
1920 dnl there and if not, make an educated guess
1921 cfg=$OPT_GNUTLS/bin/libgnutls-config
1922 check=`$cfg --version 2>/dev/null`
1923 if test -n "$check"; then
1924 addlib=`$cfg --libs`
1925 addcflags=`$cfg --cflags`
1926 version=`$cfg --version`
1927 gtlslib=`$cfg --prefix`/lib$libsuff
1928 else
1929 dnl without pkg-config and libgnutls-config, we guess a lot!
1930 addlib=-lgnutls
1931 addld=-L$OPT_GNUTLS/lib$libsuff
1932 addcflags=-I$OPT_GNUTLS/include
1933 version="" # we just don't know
1934 gtlslib=$OPT_GNUTLS/lib$libsuff
1935 fi
1936 fi
1937
1938 if test -z "$version"; then
1939 dnl lots of efforts, still no go
1940 version="unknown"
1941 fi
1942
1943 if test -n "$addlib"; then
1944
1945 CLEANLIBS="$LIBS"
1946 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001947 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001948
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001949 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001950 LDFLAGS="$LDFLAGS $addld"
1951 if test "$addcflags" != "-I/usr/include"; then
1952 CPPFLAGS="$CPPFLAGS $addcflags"
1953 fi
1954
1955 AC_CHECK_LIB(gnutls, gnutls_check_version,
1956 [
1957 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1958 AC_SUBST(USE_GNUTLS, [1])
1959 GNUTLS_ENABLED=1
1960 USE_GNUTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01001961 ssl_msg="GnuTLS"
1962 test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001963 ],
1964 [
1965 LIBS="$CLEANLIBS"
1966 CPPFLAGS="$CLEANCPPFLAGS"
1967 ])
1968
1969 if test "x$USE_GNUTLS" = "xyes"; then
1970 AC_MSG_NOTICE([detected GnuTLS version $version])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001971 check_for_ca_bundle=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001972 if test -n "$gtlslib"; then
1973 dnl when shared libs were found in a path that the run-time
1974 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001975 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001976 dnl due to this
Alex Deymo486467e2017-12-19 19:04:07 +01001977 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07001978 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$gtlslib"
1979 export CURL_LIBRARY_PATH
1980 AC_MSG_NOTICE([Added $gtlslib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001981 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001982 fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07001983 AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001984 fi
1985
1986 fi
1987
1988 fi dnl GNUTLS not disabled
1989
Alex Deymo486467e2017-12-19 19:04:07 +01001990 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001991fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001992
1993dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001994dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001995dnl ---
1996
1997if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001998 USE_GNUTLS_NETTLE=
1999 # First check if we can detect either crypto library via transitive linking
2000 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2001 if test "$USE_GNUTLS_NETTLE" = ""; then
2002 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2003 fi
2004 # If not, try linking directly to both of them to see if they are available
2005 if test "$USE_GNUTLS_NETTLE" = ""; then
2006 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
2007 fi
2008 if test "$USE_GNUTLS_NETTLE" = ""; then
2009 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2010 fi
2011 if test "$USE_GNUTLS_NETTLE" = ""; then
2012 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
2013 fi
2014 if test "$USE_GNUTLS_NETTLE" = "1"; then
2015 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
2016 AC_SUBST(USE_GNUTLS_NETTLE, [1])
2017 LIBS="-lnettle $LIBS"
2018 else
2019 LIBS="-lgcrypt $LIBS"
2020 fi
2021fi
2022
2023dnl ---
2024dnl We require GnuTLS with SRP support.
2025dnl ---
2026if test "$GNUTLS_ENABLED" = "1"; then
2027 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
2028 [
2029 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
2030 AC_SUBST(HAVE_GNUTLS_SRP, [1])
2031 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002032fi
2033
2034dnl ----------------------------------------------------
2035dnl check for PolarSSL
2036dnl ----------------------------------------------------
2037
2038dnl Default to compiler & linker defaults for PolarSSL files & libraries.
2039OPT_POLARSSL=no
2040
2041_cppflags=$CPPFLAGS
2042_ldflags=$LDFLAGS
2043AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002044AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002045AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
2046 OPT_POLARSSL=$withval)
2047
Alex Deymo486467e2017-12-19 19:04:07 +01002048if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then
2049 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002050
2051 if test X"$OPT_POLARSSL" != Xno; then
2052
2053 if test "$OPT_POLARSSL" = "yes"; then
2054 OPT_POLARSSL=""
2055 fi
2056
2057 if test -z "$OPT_POLARSSL" ; then
2058 dnl check for lib first without setting any new path
2059
2060 AC_CHECK_LIB(polarssl, havege_init,
2061 dnl libpolarssl found, set the variable
2062 [
2063 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2064 AC_SUBST(USE_POLARSSL, [1])
2065 POLARSSL_ENABLED=1
2066 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002067 ssl_msg="PolarSSL"
2068 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002069 ])
2070 fi
2071
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002072 addld=""
2073 addlib=""
2074 addcflags=""
2075 polarssllib=""
2076
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002077 if test "x$USE_POLARSSL" != "xyes"; then
2078 dnl add the path and test again
2079 addld=-L$OPT_POLARSSL/lib$libsuff
2080 addcflags=-I$OPT_POLARSSL/include
2081 polarssllib=$OPT_POLARSSL/lib$libsuff
2082
2083 LDFLAGS="$LDFLAGS $addld"
2084 if test "$addcflags" != "-I/usr/include"; then
2085 CPPFLAGS="$CPPFLAGS $addcflags"
2086 fi
2087
2088 AC_CHECK_LIB(polarssl, ssl_init,
2089 [
2090 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2091 AC_SUBST(USE_POLARSSL, [1])
2092 POLARSSL_ENABLED=1
2093 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002094 ssl_msg="PolarSSL"
2095 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002096 ],
2097 [
2098 CPPFLAGS=$_cppflags
2099 LDFLAGS=$_ldflags
2100 ])
2101 fi
2102
2103 if test "x$USE_POLARSSL" = "xyes"; then
2104 AC_MSG_NOTICE([detected PolarSSL])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002105 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002106 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002107
2108 if test -n "$polarssllib"; then
2109 dnl when shared libs were found in a path that the run-time
2110 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002111 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002112 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002113 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002114 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$polarssllib"
2115 export CURL_LIBRARY_PATH
2116 AC_MSG_NOTICE([Added $polarssllib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002117 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002118 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002119 fi
2120
2121 fi dnl PolarSSL not disabled
2122
Alex Deymo486467e2017-12-19 19:04:07 +01002123 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002124fi
2125
2126dnl ----------------------------------------------------
Alex Deymod15eaac2016-06-28 14:49:26 -07002127dnl check for mbedTLS
2128dnl ----------------------------------------------------
2129
2130OPT_MBEDTLS=no
2131
2132_cppflags=$CPPFLAGS
2133_ldflags=$LDFLAGS
2134AC_ARG_WITH(mbedtls,dnl
2135AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2136AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2137 OPT_MBEDTLS=$withval)
2138
Alex Deymo486467e2017-12-19 19:04:07 +01002139if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2140 ssl_msg=
Alex Deymod15eaac2016-06-28 14:49:26 -07002141
2142 if test X"$OPT_MBEDTLS" != Xno; then
2143
2144 if test "$OPT_MBEDTLS" = "yes"; then
2145 OPT_MBEDTLS=""
2146 fi
2147
2148 if test -z "$OPT_MBEDTLS" ; then
2149 dnl check for lib first without setting any new path
2150
2151 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2152 dnl libmbedtls found, set the variable
2153 [
2154 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2155 AC_SUBST(USE_MBEDTLS, [1])
2156 MBEDTLS_ENABLED=1
2157 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002158 ssl_msg="mbedTLS"
2159 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002160 ], [], -lmbedx509 -lmbedcrypto)
2161 fi
2162
2163 addld=""
2164 addlib=""
2165 addcflags=""
2166 mbedtlslib=""
2167
2168 if test "x$USE_MBEDTLS" != "xyes"; then
2169 dnl add the path and test again
2170 addld=-L$OPT_MBEDTLS/lib$libsuff
2171 addcflags=-I$OPT_MBEDTLS/include
2172 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2173
2174 LDFLAGS="$LDFLAGS $addld"
2175 if test "$addcflags" != "-I/usr/include"; then
2176 CPPFLAGS="$CPPFLAGS $addcflags"
2177 fi
2178
2179 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2180 [
2181 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2182 AC_SUBST(USE_MBEDTLS, [1])
2183 MBEDTLS_ENABLED=1
2184 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002185 ssl_msg="mbedTLS"
2186 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002187 ],
2188 [
2189 CPPFLAGS=$_cppflags
2190 LDFLAGS=$_ldflags
2191 ], -lmbedx509 -lmbedcrypto)
2192 fi
2193
2194 if test "x$USE_MBEDTLS" = "xyes"; then
2195 AC_MSG_NOTICE([detected mbedTLS])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002196 check_for_ca_bundle=1
Alex Deymod15eaac2016-06-28 14:49:26 -07002197
2198 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2199
2200 if test -n "$mbedtlslib"; then
2201 dnl when shared libs were found in a path that the run-time
2202 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002203 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Alex Deymod15eaac2016-06-28 14:49:26 -07002204 dnl due to this
2205 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002206 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$mbedtlslib"
2207 export CURL_LIBRARY_PATH
2208 AC_MSG_NOTICE([Added $mbedtlslib to CURL_LIBRARY_PATH])
Alex Deymod15eaac2016-06-28 14:49:26 -07002209 fi
2210 fi
2211 fi
2212
2213 fi dnl mbedTLS not disabled
2214
Alex Deymo486467e2017-12-19 19:04:07 +01002215 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Alex Deymod15eaac2016-06-28 14:49:26 -07002216fi
2217
2218dnl ----------------------------------------------------
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002219dnl check for CyaSSL
2220dnl ----------------------------------------------------
2221
2222dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2223OPT_CYASSL=no
2224
2225_cppflags=$CPPFLAGS
2226_ldflags=$LDFLAGS
2227AC_ARG_WITH(cyassl,dnl
2228AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2229AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2230 OPT_CYASSL=$withval)
2231
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002232dnl provide --with-wolfssl as an alias for --with-cyassl
2233AC_ARG_WITH(wolfssl,dnl
2234AC_HELP_STRING([--with-wolfssl=PATH],[where to look for WolfSSL, PATH points to the installation root (default: system lib default)])
2235AC_HELP_STRING([--without-wolfssl], [disable WolfSSL detection]),
2236 OPT_CYASSL=$withval)
2237
Alex Deymo486467e2017-12-19 19:04:07 +01002238if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then
2239 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002240
2241 if test X"$OPT_CYASSL" != Xno; then
2242
2243 if test "$OPT_CYASSL" = "yes"; then
2244 OPT_CYASSL=""
2245 fi
2246
2247 dnl This should be reworked to use pkg-config instead
2248
2249 cyassllibname=cyassl
2250
2251 if test -z "$OPT_CYASSL" ; then
2252 dnl check for lib in system default first
2253
2254 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2255 dnl libcyassl found, set the variable
2256 [
2257 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2258 AC_SUBST(USE_CYASSL, [1])
2259 CYASSL_ENABLED=1
2260 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002261 ssl_msg="CyaSSL"
2262 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002263 ])
2264 fi
2265
2266 addld=""
2267 addlib=""
2268 addcflags=""
2269 cyassllib=""
2270
2271 if test "x$USE_CYASSL" != "xyes"; then
2272 dnl add the path and test again
2273 addld=-L$OPT_CYASSL/lib$libsuff
2274 addcflags=-I$OPT_CYASSL/include
2275 cyassllib=$OPT_CYASSL/lib$libsuff
2276
2277 LDFLAGS="$LDFLAGS $addld"
2278 if test "$addcflags" != "-I/usr/include"; then
2279 CPPFLAGS="$CPPFLAGS $addcflags"
2280 fi
2281
2282 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2283 [
2284 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2285 AC_SUBST(USE_CYASSL, [1])
2286 CYASSL_ENABLED=1
2287 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002288 ssl_msg="CyaSSL"
2289 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002290 ],
2291 [
2292 CPPFLAGS=$_cppflags
2293 LDFLAGS=$_ldflags
2294 cyassllib=""
2295 ])
2296 fi
2297
2298 addld=""
2299 addlib=""
2300 addcflags=""
2301
2302 if test "x$USE_CYASSL" != "xyes"; then
2303 dnl libcyassl renamed to libwolfssl as of 3.4.0
2304 addld=-L$OPT_CYASSL/lib$libsuff
2305 addcflags=-I$OPT_CYASSL/include
2306 cyassllib=$OPT_CYASSL/lib$libsuff
2307
2308 LDFLAGS="$LDFLAGS $addld"
2309 if test "$addcflags" != "-I/usr/include"; then
2310 CPPFLAGS="$CPPFLAGS $addcflags"
2311 fi
2312
2313 cyassllibname=wolfssl
2314 my_ac_save_LIBS="$LIBS"
2315 LIBS="-l$cyassllibname -lm $LIBS"
2316
2317 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2318 AC_LINK_IFELSE([
2319 AC_LANG_PROGRAM([[
2320/* These aren't needed for detection and confuse WolfSSL.
2321 They are set up properly later if it is detected. */
2322#undef SIZEOF_LONG
2323#undef SIZEOF_LONG_LONG
2324#include <cyassl/ssl.h>
2325 ]],[[
2326 return CyaSSL_Init();
2327 ]])
2328 ],[
2329 AC_MSG_RESULT(yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07002330 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002331 AC_SUBST(USE_CYASSL, [1])
2332 CYASSL_ENABLED=1
2333 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002334 ssl_msg="WolfSSL"
2335 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002336 ],
2337 [
2338 AC_MSG_RESULT(no)
2339 CPPFLAGS=$_cppflags
2340 LDFLAGS=$_ldflags
2341 cyassllib=""
2342 ])
2343 LIBS="$my_ac_save_LIBS"
2344 fi
2345
2346 if test "x$USE_CYASSL" = "xyes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07002347 AC_MSG_NOTICE([detected $cyassllibname])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002348 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002349
2350 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2351 AC_CHECK_SIZEOF(long long)
2352
2353 dnl Versions since at least 2.6.0 may have options.h
2354 AC_CHECK_HEADERS(cyassl/options.h)
2355
2356 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2357 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2358
2359 LIBS="-l$cyassllibname -lm $LIBS"
2360
Alex Deymod15eaac2016-06-28 14:49:26 -07002361 if test "x$cyassllibname" = "xwolfssl"; then
2362 dnl Recent WolfSSL versions build without SSLv3 by default
2363 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2364 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2365 wolfSSL_CTX_UseSupportedCurve \
2366 wolfSSL_get_peer_certificate \
2367 wolfSSL_UseALPN)
2368 else
2369 dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2370 AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2371 CyaSSL_get_peer_certificate)
2372 fi
2373
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002374 if test -n "$cyassllib"; then
2375 dnl when shared libs were found in a path that the run-time
2376 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002377 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002378 dnl due to this
2379 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002380 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$cyassllib"
2381 export CURL_LIBRARY_PATH
2382 AC_MSG_NOTICE([Added $cyassllib to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002383 fi
2384 fi
2385
2386 fi
2387
2388 fi dnl CyaSSL not disabled
2389
Alex Deymo486467e2017-12-19 19:04:07 +01002390 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002391fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002392
2393dnl ----------------------------------------------------
2394dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2395dnl ----------------------------------------------------
2396
2397dnl Default to compiler & linker defaults for NSS files & libraries.
2398OPT_NSS=no
2399
2400AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002401AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002402AC_HELP_STRING([--without-nss], [disable NSS detection]),
2403 OPT_NSS=$withval)
2404
Alex Deymo486467e2017-12-19 19:04:07 +01002405if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2406 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002407
2408 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002409
2410 addld=""
2411 addlib=""
2412 addcflags=""
2413 nssprefix=""
2414 version=""
2415
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002416 if test "x$OPT_NSS" = "xyes"; then
2417
2418 CURL_CHECK_PKGCONFIG(nss)
2419
2420 if test "$PKGCONFIG" != "no" ; then
2421 addlib=`$PKGCONFIG --libs nss`
2422 addcflags=`$PKGCONFIG --cflags nss`
2423 version=`$PKGCONFIG --modversion nss`
2424 nssprefix=`$PKGCONFIG --variable=prefix nss`
2425 else
2426 dnl Without pkg-config, we check for nss-config
2427
2428 check=`nss-config --version 2>/dev/null`
2429 if test -n "$check"; then
2430 addlib=`nss-config --libs`
2431 addcflags=`nss-config --cflags`
2432 version=`nss-config --version`
2433 nssprefix=`nss-config --prefix`
2434 else
2435 addlib="-lnss3"
2436 addcflags=""
2437 version="unknown"
2438 fi
2439 fi
2440 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002441 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2442 if test -f "$NSS_PCDIR/nss.pc"; then
2443 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2444 if test "$PKGCONFIG" != "no" ; then
2445 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2446 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2447 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2448 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2449 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2450 fi
2451 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002452 fi
2453
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002454 if test -z "$addlib"; then
2455 # Without pkg-config, we'll kludge in some defaults
2456 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2457 addld="-L$OPT_NSS/lib"
2458 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2459 addcflags="-I$OPT_NSS/include"
2460 version="unknown"
2461 nssprefix=$OPT_NSS
2462 fi
2463
2464 CLEANLDFLAGS="$LDFLAGS"
2465 CLEANLIBS="$LIBS"
2466 CLEANCPPFLAGS="$CPPFLAGS"
2467
2468 LDFLAGS="$addld $LDFLAGS"
2469 LIBS="$addlib $LIBS"
2470 if test "$addcflags" != "-I/usr/include"; then
2471 CPPFLAGS="$CPPFLAGS $addcflags"
2472 fi
2473
2474 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2475 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002476 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002477 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2478 AC_SUBST(USE_NSS, [1])
2479 USE_NSS="yes"
2480 NSS_ENABLED=1
Alex Deymo486467e2017-12-19 19:04:07 +01002481 ssl_msg="NSS"
2482 test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002483 ],
2484 [
2485 LDFLAGS="$CLEANLDFLAGS"
2486 LIBS="$CLEANLIBS"
2487 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002488 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002489
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002490 if test "x$USE_NSS" = "xyes"; then
2491 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002492
Elliott Hughescac39802018-04-27 16:19:43 -07002493 dnl PK11_CreateManagedGenericObject() was introduced in NSS 3.34 because
2494 dnl PK11_DestroyGenericObject() does not release resources allocated by
2495 dnl PK11_CreateGenericObject() early enough.
2496 AC_CHECK_FUNC(PK11_CreateManagedGenericObject,
2497 [
2498 AC_DEFINE(HAVE_PK11_CREATEMANAGEDGENERICOBJECT, 1,
2499 [if you have the PK11_CreateManagedGenericObject function])
2500 ])
2501
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002502 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2503 NSS_LIBS=$addlib
2504 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002505
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002506 dnl when shared libs were found in a path that the run-time
2507 dnl linker doesn't search through, we need to add it to
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002508 dnl CURL_LIBRARY_PATH to prevent further configure tests to fail
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002509 dnl due to this
2510 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002511 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$nssprefix/lib$libsuff"
2512 export CURL_LIBRARY_PATH
2513 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to CURL_LIBRARY_PATH])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002514 fi
2515
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002516 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002517
2518 fi dnl NSS not disabled
2519
Alex Deymo486467e2017-12-19 19:04:07 +01002520 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2521fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002522
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002523OPT_AXTLS=off
2524
2525AC_ARG_WITH(axtls,dnl
2526AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local). Ignored if another SSL engine is selected.])
2527AC_HELP_STRING([--without-axtls], [disable axTLS]),
2528 OPT_AXTLS=$withval)
2529
Alex Deymo486467e2017-12-19 19:04:07 +01002530if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then
2531 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002532 if test X"$OPT_AXTLS" != Xno; then
2533 dnl backup the pre-axtls variables
2534 CLEANLDFLAGS="$LDFLAGS"
2535 CLEANCPPFLAGS="$CPPFLAGS"
2536 CLEANLIBS="$LIBS"
2537
2538 case "$OPT_AXTLS" in
2539 yes)
2540 dnl --with-axtls (without path) used
2541 PREFIX_AXTLS=/usr/local
2542 LIB_AXTLS="$PREFIX_AXTLS/lib"
2543 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2544 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2545 ;;
2546 off)
2547 dnl no --with-axtls option given, just check default places
2548 PREFIX_AXTLS=
2549 ;;
2550 *)
2551 dnl check the given --with-axtls spot
2552 PREFIX_AXTLS=$OPT_AXTLS
2553 LIB_AXTLS="$PREFIX_AXTLS/lib"
2554 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2555 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2556 ;;
2557 esac
2558
2559 AC_CHECK_LIB(axtls, ssl_version,[
2560 LIBS="-laxtls $LIBS"
2561 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2562 AC_SUBST(USE_AXTLS, [1])
2563 AXTLS_ENABLED=1
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002564 check_for_ca_bundle=1
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002565 USE_AXTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002566 ssl_msg="axTLS"
2567 test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002568
2569 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002570 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$LIB_AXTLS"
2571 export CURL_LIBRARY_PATH
2572 AC_MSG_NOTICE([Added $LIB_AXTLS to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002573 fi
2574 ],[
2575 LDFLAGS="$CLEANLDFLAGS"
2576 CPPFLAGS="$CLEANCPPFLAGS"
2577 LIBS="$CLEANLIBS"
2578 ])
2579 fi
Alex Deymo486467e2017-12-19 19:04:07 +01002580 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002581fi
2582
Alex Deymo486467e2017-12-19 19:04:07 +01002583case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in
2584x)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002585 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002586 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
Alex Deymo486467e2017-12-19 19:04:07 +01002587 ;;
2588x1)
2589 # one SSL backend is enabled
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002590 AC_SUBST(SSL_ENABLED)
2591 SSL_ENABLED="1"
Alex Deymo486467e2017-12-19 19:04:07 +01002592 AC_MSG_NOTICE([built with one SSL backend])
2593 ;;
2594*)
2595 # more than one SSL backend is enabled
2596 AC_SUBST(SSL_ENABLED)
2597 SSL_ENABLED="1"
2598 AC_SUBST(CURL_WITH_MULTI_SSL)
2599 CURL_WITH_MULTI_SSL="1"
2600 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2601 AC_MSG_NOTICE([built with multiple SSL backends])
2602 ;;
2603esac
2604
2605if test -n "$ssl_backends"; then
2606 curl_ssl_msg="enabled ($ssl_backends)"
2607fi
2608
2609if test no = "$VALID_DEFAULT_SSL_BACKEND"
2610then
2611 if test -n "$SSL_ENABLED"
2612 then
2613 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2614 else
2615 AC_MSG_ERROR([Default SSL backend requires SSL!])
2616 fi
2617elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2618then
2619 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002620fi
2621
2622dnl **********************************************************************
2623dnl Check for the CA bundle
2624dnl **********************************************************************
2625
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002626if test "$check_for_ca_bundle" -gt 0; then
2627 CURL_CHECK_CA_BUNDLE
2628fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002629
2630dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002631dnl Check for libpsl
2632dnl **********************************************************************
2633
2634AC_ARG_WITH(libpsl,
2635 AS_HELP_STRING([--without-libpsl],
2636 [disable support for libpsl cookie checking]),
2637 with_libpsl=$withval,
2638 with_libpsl=yes)
2639if test $with_libpsl != "no"; then
2640 AC_SEARCH_LIBS(psl_builtin, psl,
2641 [curl_psl_msg="yes";
2642 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2643 ],
2644 [curl_psl_msg="no (libpsl not found)";
2645 AC_MSG_WARN([libpsl was not found])
2646 ]
2647 )
2648fi
2649AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2650
2651dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002652dnl Check for libmetalink
2653dnl **********************************************************************
2654
2655OPT_LIBMETALINK=no
2656
2657AC_ARG_WITH(libmetalink,dnl
2658AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2659AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2660 OPT_LIBMETALINK=$withval)
2661
2662if test X"$OPT_LIBMETALINK" != Xno; then
2663
2664 addld=""
2665 addlib=""
2666 addcflags=""
2667 version=""
2668 libmetalinklib=""
2669
2670 PKGTEST="no"
2671 if test "x$OPT_LIBMETALINK" = "xyes"; then
2672 dnl this is with no partiular path given
2673 PKGTEST="yes"
2674 CURL_CHECK_PKGCONFIG(libmetalink)
2675 else
2676 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2677 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2678 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2679 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2680 PKGTEST="yes"
2681 fi
2682 if test "$PKGTEST" = "yes"; then
2683 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2684 fi
2685 fi
2686 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2687 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2688 $PKGCONFIG --libs-only-l libmetalink`
2689 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2690 $PKGCONFIG --libs-only-L libmetalink`
2691 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2692 $PKGCONFIG --cflags-only-I libmetalink`
2693 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2694 $PKGCONFIG --modversion libmetalink`
2695 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2696 fi
2697 if test -n "$addlib"; then
2698
2699 clean_CPPFLAGS="$CPPFLAGS"
2700 clean_LDFLAGS="$LDFLAGS"
2701 clean_LIBS="$LIBS"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002702 CPPFLAGS="$clean_CPPFLAGS $addcflags"
2703 LDFLAGS="$clean_LDFLAGS $addld"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002704 LIBS="$addlib $clean_LIBS"
2705 AC_MSG_CHECKING([if libmetalink is recent enough])
2706 AC_LINK_IFELSE([
2707 AC_LANG_PROGRAM([[
2708# include <metalink/metalink.h>
2709 ]],[[
2710 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2711 return 1;
2712 ]])
2713 ],[
2714 AC_MSG_RESULT([yes ($version)])
2715 want_metalink="yes"
2716 ],[
2717 AC_MSG_RESULT([no ($version)])
2718 AC_MSG_NOTICE([libmetalink library defective or too old])
2719 want_metalink="no"
2720 ])
2721 CPPFLAGS="$clean_CPPFLAGS"
2722 LDFLAGS="$clean_LDFLAGS"
2723 LIBS="$clean_LIBS"
2724 if test "$want_metalink" = "yes"; then
2725 dnl finally libmetalink will be used
2726 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2727 LIBMETALINK_LIBS=$addlib
2728 LIBMETALINK_LDFLAGS=$addld
2729 LIBMETALINK_CPPFLAGS=$addcflags
2730 AC_SUBST([LIBMETALINK_LIBS])
2731 AC_SUBST([LIBMETALINK_LDFLAGS])
2732 AC_SUBST([LIBMETALINK_CPPFLAGS])
2733 curl_mtlnk_msg="enabled"
2734 fi
2735
2736 fi
2737fi
2738
2739dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002740dnl Check for the presence of LIBSSH2 libraries and headers
2741dnl **********************************************************************
2742
2743dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2744OPT_LIBSSH2=off
2745AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002746AC_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 -08002747AC_HELP_STRING([--with-libssh2], [enable LIBSSH2]),
2748 OPT_LIBSSH2=$withval, OPT_LIBSSH2=no)
2749
2750
2751OPT_LIBSSH=off
2752AC_ARG_WITH(libssh,dnl
2753AC_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])
2754AC_HELP_STRING([--with-libssh], [enable LIBSSH]),
2755 OPT_LIBSSH=$withval, OPT_LIBSSH=no)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002756
2757if test X"$OPT_LIBSSH2" != Xno; then
2758 dnl backup the pre-libssh2 variables
2759 CLEANLDFLAGS="$LDFLAGS"
2760 CLEANCPPFLAGS="$CPPFLAGS"
2761 CLEANLIBS="$LIBS"
2762
2763 case "$OPT_LIBSSH2" in
2764 yes)
2765 dnl --with-libssh2 (without path) used
2766 CURL_CHECK_PKGCONFIG(libssh2)
2767
2768 if test "$PKGCONFIG" != "no" ; then
2769 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2770 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2771 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2772 version=`$PKGCONFIG --modversion libssh2`
2773 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2774 fi
2775
2776 ;;
2777 off)
2778 dnl no --with-libssh2 option given, just check default places
2779 ;;
2780 *)
2781 dnl use the given --with-libssh2 spot
2782 PREFIX_SSH2=$OPT_LIBSSH2
2783 ;;
2784 esac
2785
2786 dnl if given with a prefix, we set -L and -I based on that
2787 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002788 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002789 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2790 CPP_SSH2=-I${PREFIX_SSH2}/include
2791 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2792 fi
2793
Elliott Hughes82be86d2017-09-20 17:00:17 -07002794 LDFLAGS="$LDFLAGS $LD_SSH2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002795 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002796 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002797
2798 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2799
2800 AC_CHECK_HEADERS(libssh2.h,
2801 curl_ssh_msg="enabled (libSSH2)"
2802 LIBSSH2_ENABLED=1
2803 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2804 AC_SUBST(USE_LIBSSH2, [1])
2805 )
2806
2807 if test X"$OPT_LIBSSH2" != Xoff &&
2808 test "$LIBSSH2_ENABLED" != "1"; then
2809 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2810 fi
2811
2812 if test "$LIBSSH2_ENABLED" = "1"; then
2813 if test -n "$DIR_SSH2"; then
2814 dnl when the libssh2 shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002815 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002816 dnl to prevent further configure tests to fail due to this
2817
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002818 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002819 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH2"
2820 export CURL_LIBRARY_PATH
2821 AC_MSG_NOTICE([Added $DIR_SSH2 to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002822 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002823 fi
2824 else
2825 dnl no libssh2, revert back to clean variables
2826 LDFLAGS=$CLEANLDFLAGS
2827 CPPFLAGS=$CLEANCPPFLAGS
2828 LIBS=$CLEANLIBS
2829 fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08002830elif test X"$OPT_LIBSSH" != Xno; then
2831 dnl backup the pre-libssh variables
2832 CLEANLDFLAGS="$LDFLAGS"
2833 CLEANCPPFLAGS="$CPPFLAGS"
2834 CLEANLIBS="$LIBS"
2835
2836 case "$OPT_LIBSSH" in
2837 yes)
2838 dnl --with-libssh (without path) used
2839 CURL_CHECK_PKGCONFIG(libssh)
2840
2841 if test "$PKGCONFIG" != "no" ; then
2842 LIB_SSH=`$PKGCONFIG --libs-only-l libssh`
2843 LD_SSH=`$PKGCONFIG --libs-only-L libssh`
2844 CPP_SSH=`$PKGCONFIG --cflags-only-I libssh`
2845 version=`$PKGCONFIG --modversion libssh`
2846 DIR_SSH=`echo $LD_SSH | $SED -e 's/-L//'`
2847 fi
2848
2849 ;;
2850 off)
2851 dnl no --with-libssh option given, just check default places
2852 ;;
2853 *)
2854 dnl use the given --with-libssh spot
2855 PREFIX_SSH=$OPT_LIBSSH
2856 ;;
2857 esac
2858
2859 dnl if given with a prefix, we set -L and -I based on that
2860 if test -n "$PREFIX_SSH"; then
2861 LIB_SSH="-lssh"
2862 LD_SSH=-L${PREFIX_SSH}/lib$libsuff
2863 CPP_SSH=-I${PREFIX_SSH}/include
2864 DIR_SSH=${PREFIX_SSH}/lib$libsuff
2865 fi
2866
2867 LDFLAGS="$LDFLAGS $LD_SSH"
2868 CPPFLAGS="$CPPFLAGS $CPP_SSH"
2869 LIBS="$LIB_SSH $LIBS"
2870
2871 AC_CHECK_LIB(ssh, ssh_new)
2872
2873 AC_CHECK_HEADERS(libssh/libssh.h,
2874 curl_ssh_msg="enabled (libSSH)"
2875 LIBSSH_ENABLED=1
2876 AC_DEFINE(USE_LIBSSH, 1, [if libSSH is in use])
2877 AC_SUBST(USE_LIBSSH, [1])
2878 )
2879
2880 if test X"$OPT_LIBSSH" != Xoff &&
2881 test "$LIBSSH_ENABLED" != "1"; then
2882 AC_MSG_ERROR([libSSH libs and/or directories were not found where specified!])
2883 fi
2884
2885 if test "$LIBSSH_ENABLED" = "1"; then
2886 if test -n "$DIR_SSH"; then
2887 dnl when the libssh shared libs were found in a path that the run-time
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002888 dnl linker doesn't search through, we need to add it to CURL_LIBRARY_PATH
Elliott Hughes0128fe42018-02-27 14:57:55 -08002889 dnl to prevent further configure tests to fail due to this
2890
2891 if test "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07002892 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_SSH"
2893 export CURL_LIBRARY_PATH
2894 AC_MSG_NOTICE([Added $DIR_SSH to CURL_LIBRARY_PATH])
Elliott Hughes0128fe42018-02-27 14:57:55 -08002895 fi
2896 fi
2897 else
2898 dnl no libssh, revert back to clean variables
2899 LDFLAGS=$CLEANLDFLAGS
2900 CPPFLAGS=$CLEANCPPFLAGS
2901 LIBS=$CLEANLIBS
2902 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002903fi
2904
2905dnl **********************************************************************
2906dnl Check for the presence of LIBRTMP libraries and headers
2907dnl **********************************************************************
2908
2909dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2910OPT_LIBRTMP=off
2911AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002912AC_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 -07002913AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2914 OPT_LIBRTMP=$withval)
2915
2916if test X"$OPT_LIBRTMP" != Xno; then
2917 dnl backup the pre-librtmp variables
2918 CLEANLDFLAGS="$LDFLAGS"
2919 CLEANCPPFLAGS="$CPPFLAGS"
2920 CLEANLIBS="$LIBS"
2921
2922 case "$OPT_LIBRTMP" in
2923 yes)
2924 dnl --with-librtmp (without path) used
2925 CURL_CHECK_PKGCONFIG(librtmp)
2926
2927 if test "$PKGCONFIG" != "no" ; then
2928 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2929 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2930 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2931 version=`$PKGCONFIG --modversion librtmp`
2932 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002933 else
2934 dnl To avoid link errors, we do not allow --librtmp without
2935 dnl a pkgconfig file
2936 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002937 fi
2938
2939 ;;
2940 off)
2941 dnl no --with-librtmp option given, just check default places
2942 LIB_RTMP="-lrtmp"
2943 ;;
2944 *)
2945 dnl use the given --with-librtmp spot
Elliott Hughes82be86d2017-09-20 17:00:17 -07002946 LIB_RTMP="-lrtmp"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002947 PREFIX_RTMP=$OPT_LIBRTMP
2948 ;;
2949 esac
2950
2951 dnl if given with a prefix, we set -L and -I based on that
2952 if test -n "$PREFIX_RTMP"; then
2953 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2954 CPP_RTMP=-I${PREFIX_RTMP}/include
2955 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2956 fi
2957
2958 LDFLAGS="$LDFLAGS $LD_RTMP"
2959 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002960 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002961
2962 AC_CHECK_LIB(rtmp, RTMP_Init,
2963 [
2964 AC_CHECK_HEADERS(librtmp/rtmp.h,
2965 curl_rtmp_msg="enabled (librtmp)"
2966 LIBRTMP_ENABLED=1
2967 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2968 AC_SUBST(USE_LIBRTMP, [1])
2969 )
2970 ],
2971 dnl not found, revert back to clean variables
2972 LDFLAGS=$CLEANLDFLAGS
2973 CPPFLAGS=$CLEANCPPFLAGS
2974 LIBS=$CLEANLIBS
2975 )
2976
2977 if test X"$OPT_LIBRTMP" != Xoff &&
2978 test "$LIBRTMP_ENABLED" != "1"; then
2979 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2980 fi
2981
2982fi
2983
2984dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002985dnl Check for linker switch for versioned symbols
2986dnl **********************************************************************
2987
2988versioned_symbols_flavour=
2989AC_MSG_CHECKING([whether versioned symbols are wanted])
2990AC_ARG_ENABLE(versioned-symbols,
2991AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2992AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2993[ case "$enableval" in
2994 yes) AC_MSG_RESULT(yes)
2995 AC_MSG_CHECKING([if libraries can be versioned])
2996 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2997 if test -z "$GLD"; then
2998 AC_MSG_RESULT(no)
2999 AC_MSG_WARN([You need an ld version supporting the --version-script option])
3000 else
3001 AC_MSG_RESULT(yes)
Alex Deymo486467e2017-12-19 19:04:07 +01003002 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3003 versioned_symbols_flavour="MULTISSL_"
3004 elif test "x$OPENSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003005 versioned_symbols_flavour="OPENSSL_"
3006 elif test "x$GNUTLS_ENABLED" = "x1"; then
3007 versioned_symbols_flavour="GNUTLS_"
3008 elif test "x$NSS_ENABLED" = "x1"; then
3009 versioned_symbols_flavour="NSS_"
3010 elif test "x$POLARSSL_ENABLED" = "x1"; then
3011 versioned_symbols_flavour="POLARSSL_"
3012 elif test "x$CYASSL_ENABLED" = "x1"; then
3013 versioned_symbols_flavour="CYASSL_"
3014 elif test "x$AXTLS_ENABLED" = "x1"; then
3015 versioned_symbols_flavour="AXTLS_"
3016 elif test "x$WINSSL_ENABLED" = "x1"; then
3017 versioned_symbols_flavour="WINSSL_"
3018 elif test "x$DARWINSSL_ENABLED" = "x1"; then
3019 versioned_symbols_flavour="DARWINSSL_"
3020 else
3021 versioned_symbols_flavour=""
3022 fi
3023 versioned_symbols="yes"
3024 fi
3025 ;;
3026
3027 *) AC_MSG_RESULT(no)
3028 ;;
3029 esac
3030], [
3031AC_MSG_RESULT(no)
3032]
3033)
3034
3035AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
3036 ["$versioned_symbols_flavour"])
3037AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
3038 [test "x$versioned_symbols" = 'xyes'])
3039
3040dnl -------------------------------------------------
3041dnl check winidn option before other IDN libraries
3042dnl -------------------------------------------------
3043
3044AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
3045OPT_WINIDN="default"
3046AC_ARG_WITH(winidn,
3047AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
3048AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
3049 OPT_WINIDN=$withval)
3050case "$OPT_WINIDN" in
3051 no|default)
3052 dnl --without-winidn option used or configure option not specified
3053 want_winidn="no"
3054 AC_MSG_RESULT([no])
3055 ;;
3056 yes)
3057 dnl --with-winidn option used without path
3058 want_winidn="yes"
3059 want_winidn_path="default"
3060 AC_MSG_RESULT([yes])
3061 ;;
3062 *)
3063 dnl --with-winidn option used with path
3064 want_winidn="yes"
3065 want_winidn_path="$withval"
3066 AC_MSG_RESULT([yes ($withval)])
3067 ;;
3068esac
3069
3070if test "$want_winidn" = "yes"; then
3071 dnl winidn library support has been requested
3072 clean_CPPFLAGS="$CPPFLAGS"
3073 clean_LDFLAGS="$LDFLAGS"
3074 clean_LIBS="$LIBS"
3075 WINIDN_LIBS="-lnormaliz"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003076 WINIDN_CPPFLAGS="-DWINVER=0x0600"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003077 #
3078 if test "$want_winidn_path" != "default"; then
3079 dnl path has been specified
3080 dnl pkg-config not available or provides no info
3081 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
3082 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
3083 WINIDN_DIR="$want_winidn_path/lib$libsuff"
3084 fi
3085 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003086 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
3087 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003088 LIBS="$WINIDN_LIBS $LIBS"
3089 #
3090 AC_MSG_CHECKING([if IdnToUnicode can be linked])
3091 AC_LINK_IFELSE([
Elliott Hughes82be86d2017-09-20 17:00:17 -07003092 AC_LANG_PROGRAM([[
3093 #include <windows.h>
3094 ]],[[
3095 IdnToUnicode(0, NULL, 0, NULL, 0);
3096 ]])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003097 ],[
3098 AC_MSG_RESULT([yes])
3099 tst_links_winidn="yes"
3100 ],[
3101 AC_MSG_RESULT([no])
3102 tst_links_winidn="no"
3103 ])
3104 #
3105 if test "$tst_links_winidn" = "yes"; then
3106 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
3107 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
3108 AC_SUBST([IDN_ENABLED], [1])
3109 curl_idn_msg="enabled (Windows-native)"
3110 else
3111 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3112 CPPFLAGS="$clean_CPPFLAGS"
3113 LDFLAGS="$clean_LDFLAGS"
3114 LIBS="$clean_LIBS"
3115 fi
3116fi
3117
3118dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003119dnl Check for the presence of IDN libraries and headers
3120dnl **********************************************************************
3121
Elliott Hughescee03382017-06-23 12:17:18 -07003122AC_MSG_CHECKING([whether to build with libidn2])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003123OPT_IDN="default"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003124AC_ARG_WITH(libidn2,
Elliott Hughescee03382017-06-23 12:17:18 -07003125AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
3126AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003127 [OPT_IDN=$withval])
3128case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003129 no)
Elliott Hughescee03382017-06-23 12:17:18 -07003130 dnl --without-libidn2 option used
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003131 want_idn="no"
3132 AC_MSG_RESULT([no])
3133 ;;
3134 default)
3135 dnl configure option not specified
3136 want_idn="yes"
3137 want_idn_path="default"
3138 AC_MSG_RESULT([(assumed) yes])
3139 ;;
3140 yes)
Elliott Hughescee03382017-06-23 12:17:18 -07003141 dnl --with-libidn2 option used without path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003142 want_idn="yes"
3143 want_idn_path="default"
3144 AC_MSG_RESULT([yes])
3145 ;;
3146 *)
Elliott Hughescee03382017-06-23 12:17:18 -07003147 dnl --with-libidn2 option used with path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003148 want_idn="yes"
3149 want_idn_path="$withval"
3150 AC_MSG_RESULT([yes ($withval)])
3151 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003152esac
3153
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003154if test "$want_idn" = "yes"; then
3155 dnl idn library support has been requested
3156 clean_CPPFLAGS="$CPPFLAGS"
3157 clean_LDFLAGS="$LDFLAGS"
3158 clean_LIBS="$LIBS"
3159 PKGCONFIG="no"
3160 #
3161 if test "$want_idn_path" != "default"; then
3162 dnl path has been specified
3163 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
Elliott Hughescee03382017-06-23 12:17:18 -07003164 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003165 if test "$PKGCONFIG" != "no"; then
3166 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003167 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003168 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003169 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003170 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003171 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003172 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3173 else
3174 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003175 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003176 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3177 IDN_CPPFLAGS="-I$want_idn_path/include"
3178 IDN_DIR="$want_idn_path/lib$libsuff"
3179 fi
3180 else
3181 dnl path not specified
Elliott Hughescee03382017-06-23 12:17:18 -07003182 CURL_CHECK_PKGCONFIG(libidn2)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003183 if test "$PKGCONFIG" != "no"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003184 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3185 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3186 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003187 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3188 else
3189 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003190 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003191 fi
3192 fi
3193 #
3194 if test "$PKGCONFIG" != "no"; then
3195 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3196 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3197 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3198 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3199 else
3200 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3201 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3202 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3203 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3204 fi
3205 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003206 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3207 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003208 LIBS="$IDN_LIBS $LIBS"
3209 #
Elliott Hughescee03382017-06-23 12:17:18 -07003210 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003211 AC_LINK_IFELSE([
Elliott Hughescee03382017-06-23 12:17:18 -07003212 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003213 ],[
3214 AC_MSG_RESULT([yes])
3215 tst_links_libidn="yes"
3216 ],[
3217 AC_MSG_RESULT([no])
3218 tst_links_libidn="no"
3219 ])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003220 #
Elliott Hughescee03382017-06-23 12:17:18 -07003221 AC_CHECK_HEADERS( idn2.h )
3222
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003223 if test "$tst_links_libidn" = "yes"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003224 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003225 dnl different versions of libidn have different setups of these:
Elliott Hughescee03382017-06-23 12:17:18 -07003226
3227 AC_SUBST([IDN_ENABLED], [1])
3228 curl_idn_msg="enabled (libidn2)"
3229 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003230 CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$IDN_DIR"
3231 export CURL_LIBRARY_PATH
3232 AC_MSG_NOTICE([Added $IDN_DIR to CURL_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003233 fi
3234 else
3235 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3236 CPPFLAGS="$clean_CPPFLAGS"
3237 LDFLAGS="$clean_LDFLAGS"
3238 LIBS="$clean_LIBS"
3239 fi
3240fi
3241
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003242
3243dnl Let's hope this split URL remains working:
3244dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
3245dnl genprogc/thread_quick_ref.htm
3246
3247
3248dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003249dnl Check for nghttp2
3250dnl **********************************************************************
3251
3252OPT_H2="yes"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003253
3254if test "x$disable_http" = "xyes"; then
3255 # without HTTP, nghttp2 is no use
3256 OPT_H2="no"
3257fi
3258
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003259AC_ARG_WITH(nghttp2,
3260AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3261AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3262 [OPT_H2=$withval])
3263case "$OPT_H2" in
3264 no)
3265 dnl --without-nghttp2 option used
3266 want_h2="no"
3267 ;;
3268 yes)
3269 dnl --with-nghttp2 option used without path
3270 want_h2="default"
3271 want_h2_path=""
3272 ;;
3273 *)
3274 dnl --with-nghttp2 option used with path
3275 want_h2="yes"
3276 want_h2_path="$withval/lib/pkgconfig"
3277 ;;
3278esac
3279
3280curl_h2_msg="disabled (--with-nghttp2)"
3281if test X"$want_h2" != Xno; then
3282 dnl backup the pre-nghttp2 variables
3283 CLEANLDFLAGS="$LDFLAGS"
3284 CLEANCPPFLAGS="$CPPFLAGS"
3285 CLEANLIBS="$LIBS"
3286
3287 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3288
3289 if test "$PKGCONFIG" != "no" ; then
3290 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3291 $PKGCONFIG --libs-only-l libnghttp2`
3292 AC_MSG_NOTICE([-l is $LIB_H2])
3293
3294 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3295 $PKGCONFIG --cflags-only-I libnghttp2`
3296 AC_MSG_NOTICE([-I is $CPP_H2])
3297
3298 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3299 $PKGCONFIG --libs-only-L libnghttp2`
3300 AC_MSG_NOTICE([-L is $LD_H2])
3301
3302 LDFLAGS="$LDFLAGS $LD_H2"
3303 CPPFLAGS="$CPPFLAGS $CPP_H2"
3304 LIBS="$LIB_H2 $LIBS"
3305
3306 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3307 # >= 1.0.0
3308 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3309 [
3310 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3311 curl_h2_msg="enabled (nghttp2)"
3312 NGHTTP2_ENABLED=1
3313 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3314 AC_SUBST(USE_NGHTTP2, [1])
3315 )
3316 ],
3317 dnl not found, revert back to clean variables
3318 LDFLAGS=$CLEANLDFLAGS
3319 CPPFLAGS=$CLEANCPPFLAGS
3320 LIBS=$CLEANLIBS
3321 )
3322
3323 else
3324 dnl no nghttp2 pkg-config found, deal with it
3325 if test X"$want_h2" != Xdefault; then
3326 dnl To avoid link errors, we do not allow --with-nghttp2 without
3327 dnl a pkgconfig file
3328 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3329 fi
3330 fi
3331
3332fi
3333
3334dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07003335dnl Check for zsh completion path
3336dnl **********************************************************************
3337
3338OPT_ZSH_FPATH=default
3339AC_ARG_WITH(zsh-functions-dir,
3340AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3341AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3342 [OPT_ZSH_FPATH=$withval])
3343case "$OPT_ZSH_FPATH" in
3344 no)
3345 dnl --without-zsh-functions-dir option used
3346 ;;
3347 default|yes)
3348 dnl --with-zsh-functions-dir option used without path
3349 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3350 AC_SUBST(ZSH_FUNCTIONS_DIR)
3351 ;;
3352 *)
3353 dnl --with-zsh-functions-dir option used with path
3354 ZSH_FUNCTIONS_DIR="$withval"
3355 AC_SUBST(ZSH_FUNCTIONS_DIR)
3356 ;;
3357esac
3358
3359dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003360dnl Back to "normal" configuring
3361dnl **********************************************************************
3362
3363dnl Checks for header files.
3364AC_HEADER_STDC
3365
3366CURL_CHECK_HEADER_MALLOC
3367CURL_CHECK_HEADER_MEMORY
3368
3369dnl Now check for the very most basic headers. Then we can use these
3370dnl ones as default-headers when checking for the rest!
3371AC_CHECK_HEADERS(
3372 sys/types.h \
3373 sys/time.h \
3374 sys/select.h \
3375 sys/socket.h \
3376 sys/ioctl.h \
3377 sys/uio.h \
3378 assert.h \
3379 unistd.h \
3380 stdlib.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003381 arpa/inet.h \
3382 net/if.h \
3383 netinet/in.h \
Elliott Hughes0128fe42018-02-27 14:57:55 -08003384 netinet/in6.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003385 sys/un.h \
Alex Deymo486467e2017-12-19 19:04:07 +01003386 linux/tcp.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003387 netinet/tcp.h \
3388 netdb.h \
3389 sys/sockio.h \
3390 sys/stat.h \
3391 sys/param.h \
3392 termios.h \
3393 termio.h \
3394 sgtty.h \
3395 fcntl.h \
3396 alloca.h \
3397 time.h \
3398 io.h \
3399 pwd.h \
3400 utime.h \
3401 sys/utime.h \
3402 sys/poll.h \
3403 poll.h \
3404 socket.h \
3405 sys/resource.h \
3406 libgen.h \
3407 locale.h \
3408 errno.h \
3409 stdbool.h \
3410 arpa/tftp.h \
3411 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003412 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003413 setjmp.h,
3414dnl to do if not found
3415[],
3416dnl to do if found
3417[],
3418dnl default includes
3419[
3420#ifdef HAVE_SYS_TYPES_H
3421#include <sys/types.h>
3422#endif
3423#ifdef HAVE_SYS_TIME_H
3424#include <sys/time.h>
3425#endif
3426#ifdef HAVE_SYS_SELECT_H
3427#include <sys/select.h>
3428#endif
3429#ifdef HAVE_SYS_SOCKET_H
3430#include <sys/socket.h>
3431#endif
3432#ifdef HAVE_NETINET_IN_H
3433#include <netinet/in.h>
3434#endif
Elliott Hughes0128fe42018-02-27 14:57:55 -08003435#ifdef HAVE_NETINET_IN6_H
3436#include <netinet/in6.h>
3437#endif
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003438#ifdef HAVE_SYS_UN_H
3439#include <sys/un.h>
3440#endif
3441]
3442)
3443
3444dnl Checks for typedefs, structures, and compiler characteristics.
3445AC_C_CONST
3446CURL_CHECK_VARIADIC_MACROS
3447AC_TYPE_SIZE_T
3448AC_HEADER_TIME
3449CURL_CHECK_STRUCT_TIMEVAL
3450CURL_VERIFY_RUNTIMELIBS
3451
Elliott Hughes82be86d2017-09-20 17:00:17 -07003452AC_CHECK_SIZEOF(size_t)
3453AC_CHECK_SIZEOF(long)
3454AC_CHECK_SIZEOF(int)
3455AC_CHECK_SIZEOF(short)
Elliott Hughes82be86d2017-09-20 17:00:17 -07003456AC_CHECK_SIZEOF(time_t)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003457AC_CHECK_SIZEOF(off_t)
3458
Alex Deymo486467e2017-12-19 19:04:07 +01003459o=$CPPFLAGS
3460CPPFLAGS="-I$srcdir/include $CPPFLAGS"
3461AC_CHECK_SIZEOF(curl_off_t, unused , [
3462#include <curl/system.h>
3463])
3464CPPFLAGS=$o
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003465
3466AC_CHECK_TYPE(long long,
3467 [AC_DEFINE(HAVE_LONGLONG, 1,
3468 [Define to 1 if the compiler supports the 'long long' data type.])]
3469 longlong="yes"
3470)
3471
3472if test "xyes" = "x$longlong"; then
3473 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003474 AC_COMPILE_IFELSE([
3475 AC_LANG_PROGRAM([[
3476 ]],[[
3477 long long val = 1000LL;
3478 ]])
3479 ],[
3480 AC_MSG_RESULT([yes])
3481 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3482 ],[
3483 AC_MSG_RESULT([no])
3484 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003485fi
3486
3487
3488# check for ssize_t
3489AC_CHECK_TYPE(ssize_t, ,
3490 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3491
3492# check for bool type
3493AC_CHECK_TYPE([bool],[
3494 AC_DEFINE(HAVE_BOOL_T, 1,
3495 [Define to 1 if bool is an available type.])
3496], ,[
3497#ifdef HAVE_SYS_TYPES_H
3498#include <sys/types.h>
3499#endif
3500#ifdef HAVE_STDBOOL_H
3501#include <stdbool.h>
3502#endif
3503])
3504
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003505# check for sa_family_t
3506AC_CHECK_TYPE(sa_family_t,
3507 AC_DEFINE(CURL_SA_FAMILY_T, sa_family_t, [IP address type in sockaddr]),
3508 [
3509 # The windows name?
3510 AC_CHECK_TYPE(ADDRESS_FAMILY,
3511 AC_DEFINE(CURL_SA_FAMILY_T, ADDRESS_FAMILY, [IP address type in sockaddr]),
3512 AC_DEFINE(CURL_SA_FAMILY_T, unsigned short, [IP address type in sockaddr]),
3513 [
3514#ifdef HAVE_SYS_SOCKET_H
3515#include <sys/socket.h>
3516#endif
3517 ])
3518 ],
3519[
3520#ifdef HAVE_SYS_SOCKET_H
3521#include <sys/socket.h>
3522#endif
3523])
3524
Elliott Hughescac39802018-04-27 16:19:43 -07003525AC_MSG_CHECKING([if time_t is unsigned])
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003526CURL_RUN_IFELSE(
3527 [
Elliott Hughescac39802018-04-27 16:19:43 -07003528 #include <time.h>
3529 #include <limits.h>
3530 time_t t = -1;
3531 return (t > 0);
Elliott Hughes1ef06ba2018-05-30 15:43:58 -07003532 ],[
Elliott Hughescac39802018-04-27 16:19:43 -07003533 AC_MSG_RESULT([yes])
3534 AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
3535],[
3536 AC_MSG_RESULT([no])
3537],[
3538 dnl cross-compiling, most systems are unsigned
3539 AC_MSG_RESULT([no])
3540])
3541
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003542CURL_CONFIGURE_CURL_SOCKLEN_T
3543
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003544CURL_CONFIGURE_PULL_SYS_POLL
3545
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003546TYPE_IN_ADDR_T
3547
3548TYPE_SOCKADDR_STORAGE
3549
3550TYPE_SIG_ATOMIC_T
3551
3552AC_TYPE_SIGNAL
3553
3554CURL_CHECK_FUNC_SELECT
3555
3556CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003557CURL_CHECK_FUNC_SEND
3558CURL_CHECK_MSG_NOSIGNAL
3559
3560CURL_CHECK_FUNC_ALARM
3561CURL_CHECK_FUNC_BASENAME
3562CURL_CHECK_FUNC_CLOSESOCKET
3563CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3564CURL_CHECK_FUNC_CONNECT
3565CURL_CHECK_FUNC_FCNTL
3566CURL_CHECK_FUNC_FDOPEN
3567CURL_CHECK_FUNC_FREEADDRINFO
3568CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003569CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003570CURL_CHECK_FUNC_FTRUNCATE
3571CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003572CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003573CURL_CHECK_FUNC_GETHOSTBYADDR
3574CURL_CHECK_FUNC_GETHOSTBYADDR_R
3575CURL_CHECK_FUNC_GETHOSTBYNAME
3576CURL_CHECK_FUNC_GETHOSTBYNAME_R
3577CURL_CHECK_FUNC_GETHOSTNAME
3578CURL_CHECK_FUNC_GETIFADDRS
3579CURL_CHECK_FUNC_GETSERVBYPORT_R
3580CURL_CHECK_FUNC_GMTIME_R
3581CURL_CHECK_FUNC_INET_NTOA_R
3582CURL_CHECK_FUNC_INET_NTOP
3583CURL_CHECK_FUNC_INET_PTON
3584CURL_CHECK_FUNC_IOCTL
3585CURL_CHECK_FUNC_IOCTLSOCKET
3586CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3587CURL_CHECK_FUNC_LOCALTIME_R
3588CURL_CHECK_FUNC_MEMRCHR
3589CURL_CHECK_FUNC_POLL
3590CURL_CHECK_FUNC_SETSOCKOPT
3591CURL_CHECK_FUNC_SIGACTION
3592CURL_CHECK_FUNC_SIGINTERRUPT
3593CURL_CHECK_FUNC_SIGNAL
3594CURL_CHECK_FUNC_SIGSETJMP
3595CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003596CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003597CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003598CURL_CHECK_FUNC_STRCMPI
3599CURL_CHECK_FUNC_STRDUP
3600CURL_CHECK_FUNC_STRERROR_R
3601CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003602CURL_CHECK_FUNC_STRNCASECMP
3603CURL_CHECK_FUNC_STRNCMPI
3604CURL_CHECK_FUNC_STRNICMP
3605CURL_CHECK_FUNC_STRSTR
3606CURL_CHECK_FUNC_STRTOK_R
3607CURL_CHECK_FUNC_STRTOLL
3608CURL_CHECK_FUNC_WRITEV
3609
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003610case $host in
3611 *msdosdjgpp)
3612 ac_cv_func_pipe=no
3613 skipcheck_pipe=yes
3614 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3615 ;;
3616esac
3617
Elliott Hughes82be86d2017-09-20 17:00:17 -07003618AC_CHECK_FUNCS([geteuid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003619 getpass_r \
3620 getppid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003621 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003622 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003623 getrlimit \
3624 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003625 if_nametoindex \
Alex Deymo486467e2017-12-19 19:04:07 +01003626 mach_absolute_time \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003627 pipe \
3628 setlocale \
3629 setmode \
3630 setrlimit \
Elliott Hughes82be86d2017-09-20 17:00:17 -07003631 utime \
3632 utimes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003633],[
3634],[
3635 func="$ac_func"
3636 eval skipcheck=\$skipcheck_$func
3637 if test "x$skipcheck" != "xyes"; then
3638 AC_MSG_CHECKING([deeper for $func])
3639 AC_LINK_IFELSE([
3640 AC_LANG_PROGRAM([[
3641 ]],[[
3642 $func ();
3643 ]])
3644 ],[
3645 AC_MSG_RESULT([yes])
3646 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003647 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003648 [Define to 1 if you have the $func function.])
3649 ],[
3650 AC_MSG_RESULT([but still no])
3651 ])
3652 fi
3653])
3654
3655dnl Check if the getnameinfo function is available
3656dnl and get the types of five of its arguments.
3657CURL_CHECK_FUNC_GETNAMEINFO
3658
3659if test "$ipv6" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07003660 if test "$curl_cv_func_getaddrinfo" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003661 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3662 IPV6_ENABLED=1
3663 AC_SUBST(IPV6_ENABLED)
3664 fi
3665 CURL_CHECK_NI_WITHSCOPEID
3666fi
3667
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003668CURL_CHECK_NONBLOCKING_SOCKET
3669
3670dnl ************************************************************
3671dnl nroff tool stuff
3672dnl
3673
3674AC_PATH_PROG( PERL, perl, ,
3675 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3676AC_SUBST(PERL)
3677
3678AC_PATH_PROGS( NROFF, gnroff nroff, ,
3679 $PATH:/usr/bin/:/usr/local/bin )
3680AC_SUBST(NROFF)
3681
3682if test -n "$NROFF"; then
3683 dnl only check for nroff options if an nroff command was found
3684
3685 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3686 MANOPT="-man"
3687 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3688 if test -z "$mancheck"; then
3689 MANOPT="-mandoc"
3690 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3691 if test -z "$mancheck"; then
3692 MANOPT=""
3693 AC_MSG_RESULT([failed])
3694 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3695 else
3696 AC_MSG_RESULT([$MANOPT])
3697 fi
3698 else
3699 AC_MSG_RESULT([$MANOPT])
3700 fi
3701 AC_SUBST(MANOPT)
3702fi
3703
3704if test -z "$MANOPT"
3705then
3706 dnl if no nroff tool was found, or no option that could convert man pages
3707 dnl was found, then disable the built-in manual stuff
3708 AC_MSG_WARN([disabling built-in manual])
3709 USE_MANUAL="no";
3710fi
3711
3712dnl *************************************************************************
3713dnl If the manual variable still is set, then we go with providing a built-in
3714dnl manual
3715
3716if test "$USE_MANUAL" = "1"; then
3717 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3718 curl_manual_msg="enabled"
3719fi
3720
3721dnl set variable for use in automakefile(s)
3722AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3723
3724CURL_CHECK_LIB_ARES
3725AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3726
Alex Deymod15eaac2016-06-28 14:49:26 -07003727if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003728 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003729 build_libhostname=yes
3730else
3731 build_libhostname=no
3732fi
3733AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3734
Elliott Hughes82be86d2017-09-20 17:00:17 -07003735if test "x$want_ares" != xyes; then
3736 CURL_CHECK_OPTION_THREADED_RESOLVER
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003737fi
3738
Elliott Hughes82be86d2017-09-20 17:00:17 -07003739dnl ************************************************************
3740dnl disable POSIX threads
3741dnl
3742AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3743AC_ARG_ENABLE(pthreads,
3744AC_HELP_STRING([--enable-pthreads],
3745 [Enable POSIX threads (default for threaded resolver)])
3746AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
3747[ case "$enableval" in
3748 no) AC_MSG_RESULT(no)
3749 want_pthreads=no
3750 ;;
3751 *) AC_MSG_RESULT(yes)
3752 want_pthreads=yes
3753 ;;
3754 esac ], [
3755 AC_MSG_RESULT(auto)
3756 want_pthreads=auto
3757 ]
3758)
3759
3760dnl turn off pthreads if rt is disabled
3761if test "$want_pthreads" != "no"; then
3762 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
3763 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
3764 fi
3765 if test "$dontwant_rt" != "no"; then
3766 dnl if --enable-pthreads was explicit then warn it's being ignored
3767 if test "$want_pthreads" = "yes"; then
3768 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
3769 fi
3770 want_pthreads=no
3771 fi
3772fi
3773
3774dnl turn off pthreads if no threaded resolver
3775if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
3776 want_pthreads=no
3777fi
3778
3779dnl detect pthreads
3780if test "$want_pthreads" != "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003781 AC_CHECK_HEADER(pthread.h,
3782 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3783 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003784
3785 dnl first check for function without lib
3786 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3787
3788 dnl if it wasn't found without lib, search for it in pthread lib
3789 if test "$USE_THREADS_POSIX" != "1"
3790 then
3791 CFLAGS="$CFLAGS -pthread"
3792 AC_CHECK_LIB(pthread, pthread_create,
3793 [USE_THREADS_POSIX=1],
3794 [ CFLAGS="$save_CFLAGS"])
3795 fi
3796
3797 if test "x$USE_THREADS_POSIX" = "x1"
3798 then
3799 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3800 curl_res_msg="POSIX threaded"
3801 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003802 ])
3803fi
3804
Elliott Hughes82be86d2017-09-20 17:00:17 -07003805dnl threaded resolver check
3806if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
3807 if test "$want_pthreads" = "yes"; then
3808 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
3809 fi
3810 dnl If native Windows fallback on Win32 threads since no POSIX threads
3811 if test "$curl_cv_native_windows" = "yes"; then
3812 USE_THREADS_WIN32=1
3813 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
3814 curl_res_msg="Win32 threaded"
3815 else
3816 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
3817 fi
3818fi
3819
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003820dnl ************************************************************
3821dnl disable verbose text strings
3822dnl
3823AC_MSG_CHECKING([whether to enable verbose strings])
3824AC_ARG_ENABLE(verbose,
3825AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3826AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3827[ case "$enableval" in
3828 no)
3829 AC_MSG_RESULT(no)
3830 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3831 curl_verbose_msg="no"
3832 ;;
3833 *) AC_MSG_RESULT(yes)
3834 ;;
3835 esac ],
3836 AC_MSG_RESULT(yes)
3837)
3838
3839dnl ************************************************************
3840dnl enable SSPI support
3841dnl
3842AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3843AC_ARG_ENABLE(sspi,
3844AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3845AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3846[ case "$enableval" in
3847 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07003848 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003849 AC_MSG_RESULT(yes)
3850 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3851 AC_SUBST(USE_WINDOWS_SSPI, [1])
3852 curl_sspi_msg="enabled"
3853 else
3854 AC_MSG_RESULT(no)
3855 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3856 fi
3857 ;;
3858 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003859 if test "x$WINSSL_ENABLED" = "x1"; then
3860 # --with-winssl implies --enable-sspi
3861 AC_MSG_RESULT(yes)
3862 else
3863 AC_MSG_RESULT(no)
3864 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003865 ;;
3866 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003867 if test "x$WINSSL_ENABLED" = "x1"; then
3868 # --with-winssl implies --enable-sspi
3869 AC_MSG_RESULT(yes)
3870 else
3871 AC_MSG_RESULT(no)
3872 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003873)
3874
3875dnl ************************************************************
3876dnl disable cryptographic authentication
3877dnl
3878AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3879AC_ARG_ENABLE(crypto-auth,
3880AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3881AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3882[ case "$enableval" in
3883 no)
3884 AC_MSG_RESULT(no)
3885 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003886 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003887 ;;
3888 *) AC_MSG_RESULT(yes)
3889 ;;
3890 esac ],
3891 AC_MSG_RESULT(yes)
3892)
3893
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003894CURL_CHECK_OPTION_NTLM_WB
3895
3896CURL_CHECK_NTLM_WB
3897
3898dnl ************************************************************
3899dnl disable TLS-SRP authentication
3900dnl
3901AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3902AC_ARG_ENABLE(tls-srp,
3903AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3904AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3905[ case "$enableval" in
3906 no)
3907 AC_MSG_RESULT(no)
3908 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3909 want_tls_srp=no
3910 ;;
3911 *) AC_MSG_RESULT(yes)
3912 want_tls_srp=yes
3913 ;;
3914 esac ],
3915 AC_MSG_RESULT(yes)
3916 want_tls_srp=yes
3917)
3918
3919if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3920 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3921 USE_TLS_SRP=1
3922 curl_tls_srp_msg="enabled"
3923fi
3924
3925dnl ************************************************************
3926dnl disable Unix domain sockets support
3927dnl
3928AC_MSG_CHECKING([whether to enable Unix domain sockets])
3929AC_ARG_ENABLE(unix-sockets,
3930AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3931AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3932[ case "$enableval" in
3933 no) AC_MSG_RESULT(no)
3934 want_unix_sockets=no
3935 ;;
3936 *) AC_MSG_RESULT(yes)
3937 want_unix_sockets=yes
3938 ;;
3939 esac ], [
3940 AC_MSG_RESULT(auto)
3941 want_unix_sockets=auto
3942 ]
3943)
3944if test "x$want_unix_sockets" != "xno"; then
3945 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3946 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3947 AC_SUBST(USE_UNIX_SOCKETS, [1])
3948 curl_unix_sockets_msg="enabled"
3949 ], [
3950 if test "x$want_unix_sockets" = "xyes"; then
3951 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3952 fi
3953 ], [
3954 #include <sys/un.h>
3955 ])
3956fi
3957
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003958dnl ************************************************************
3959dnl disable cookies support
3960dnl
3961AC_MSG_CHECKING([whether to enable support for cookies])
3962AC_ARG_ENABLE(cookies,
3963AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3964AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3965[ case "$enableval" in
3966 no)
3967 AC_MSG_RESULT(no)
3968 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3969 ;;
3970 *) AC_MSG_RESULT(yes)
3971 ;;
3972 esac ],
3973 AC_MSG_RESULT(yes)
3974)
3975
3976dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003977dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003978dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003979CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003980
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003981dnl
3982dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003983dnl
3984LIBCURL_LIBS=$LIBS
3985
3986AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003987AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003988AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3989
3990dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3991dnl LIBS variable used in generated makefile at makefile processing
3992dnl time. Doing this functionally prevents LIBS from being used for
3993dnl all link targets in given makefile.
3994BLANK_AT_MAKETIME=
3995AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003996
3997AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3998
3999dnl yes or no
4000ENABLE_SHARED="$enable_shared"
4001AC_SUBST(ENABLE_SHARED)
4002
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004003dnl to let curl-config output the static libraries correctly
4004ENABLE_STATIC="$enable_static"
4005AC_SUBST(ENABLE_STATIC)
4006
4007
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004008dnl
4009dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004010dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004011dnl
4012
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004013if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004014 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4015elif test -n "$SSL_ENABLED"; then
4016 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
4017fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004018if test "x$IPV6_ENABLED" = "x1"; then
4019 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
4020fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004021if test "x$USE_UNIX_SOCKETS" = "x1"; then
4022 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
4023fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004024if test "x$HAVE_LIBZ" = "x1"; then
4025 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
4026fi
Alex Deymo486467e2017-12-19 19:04:07 +01004027if test "x$HAVE_BROTLI" = "x1"; then
4028 SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
4029fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07004030if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
4031 -o "x$USE_THREADS_WIN32" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004032 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
4033fi
4034if test "x$IDN_ENABLED" = "x1"; then
4035 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
4036fi
4037if test "x$USE_WINDOWS_SSPI" = "x1"; then
4038 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
4039fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004040
4041if test "x$HAVE_GSSAPI" = "x1"; then
4042 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
4043fi
4044
Alex Deymod15eaac2016-06-28 14:49:26 -07004045if test "x$curl_psl_msg" = "xyes"; then
4046 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
4047fi
4048
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004049if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4050 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4051 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
4052fi
4053
4054if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
4055 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
4056 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
4057fi
4058
4059if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
4060 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004061 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4062 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004063 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
4064
4065 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
4066 "x$NTLM_WB_ENABLED" = "x1"; then
4067 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
4068 fi
4069 fi
4070fi
4071
4072if test "x$USE_TLS_SRP" = "x1"; then
4073 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
4074fi
4075
4076if test "x$USE_NGHTTP2" = "x1"; then
4077 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004078fi
4079
Alex Deymo486467e2017-12-19 19:04:07 +01004080if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
4081 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
4082fi
4083
Elliott Hughes82be86d2017-09-20 17:00:17 -07004084if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
4085 -o "x$NSS_ENABLED" = "x1"; then
4086 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
4087fi
4088
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004089AC_SUBST(SUPPORT_FEATURES)
4090
4091dnl For supported protocols in pkg-config file
4092if test "x$CURL_DISABLE_HTTP" != "x1"; then
4093 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
4094 if test "x$SSL_ENABLED" = "x1"; then
4095 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
4096 fi
4097fi
4098if test "x$CURL_DISABLE_FTP" != "x1"; then
4099 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
4100 if test "x$SSL_ENABLED" = "x1"; then
4101 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
4102 fi
4103fi
4104if test "x$CURL_DISABLE_FILE" != "x1"; then
4105 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
4106fi
4107if test "x$CURL_DISABLE_TELNET" != "x1"; then
4108 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
4109fi
4110if test "x$CURL_DISABLE_LDAP" != "x1"; then
4111 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
4112 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
4113 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
4114 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
4115 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
4116 fi
4117 fi
4118fi
4119if test "x$CURL_DISABLE_DICT" != "x1"; then
4120 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
4121fi
4122if test "x$CURL_DISABLE_TFTP" != "x1"; then
4123 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
4124fi
4125if test "x$CURL_DISABLE_GOPHER" != "x1"; then
4126 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
4127fi
4128if test "x$CURL_DISABLE_POP3" != "x1"; then
4129 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
4130 if test "x$SSL_ENABLED" = "x1"; then
4131 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
4132 fi
4133fi
4134if test "x$CURL_DISABLE_IMAP" != "x1"; then
4135 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
4136 if test "x$SSL_ENABLED" = "x1"; then
4137 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
4138 fi
4139fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004140if test "x$CURL_DISABLE_SMB" != "x1" \
4141 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
4142 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07004143 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
4144 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004145 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
4146 if test "x$SSL_ENABLED" = "x1"; then
4147 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4148 fi
4149fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004150if test "x$CURL_DISABLE_SMTP" != "x1"; then
4151 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4152 if test "x$SSL_ENABLED" = "x1"; then
4153 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4154 fi
4155fi
4156if test "x$USE_LIBSSH2" = "x1"; then
4157 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4158 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4159fi
Elliott Hughes0128fe42018-02-27 14:57:55 -08004160if test "x$USE_LIBSSH" = "x1"; then
4161 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4162 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4163fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004164if test "x$CURL_DISABLE_RTSP" != "x1"; then
4165 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4166fi
4167if test "x$USE_LIBRTMP" = "x1"; then
4168 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4169fi
4170
4171dnl replace spaces with newlines
4172dnl sort the lines
4173dnl replace the newlines back to spaces
4174SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4175
4176AC_SUBST(SUPPORT_PROTOCOLS)
4177
4178dnl squeeze whitespace out of some variables
4179
4180squeeze CFLAGS
4181squeeze CPPFLAGS
4182squeeze DEFS
4183squeeze LDFLAGS
4184squeeze LIBS
4185
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004186squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004187squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004188squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004189
4190squeeze SUPPORT_FEATURES
4191squeeze SUPPORT_PROTOCOLS
4192
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004193XC_CHECK_BUILD_FLAGS
4194
Elliott Hughes0128fe42018-02-27 14:57:55 -08004195SSL_BACKENDS=${ssl_backends}
4196AC_SUBST(SSL_BACKENDS)
4197
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004198if test "x$want_curldebug_assumed" = "xyes" &&
4199 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4200 ac_configure_args="$ac_configure_args --enable-curldebug"
4201fi
4202
4203AC_CONFIG_FILES([Makefile \
4204 docs/Makefile \
4205 docs/examples/Makefile \
4206 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004207 docs/libcurl/opts/Makefile \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004208 docs/cmdline-opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004209 include/Makefile \
4210 include/curl/Makefile \
4211 src/Makefile \
4212 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07004213 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004214 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004215 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004216 tests/certs/Makefile \
4217 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004218 tests/data/Makefile \
4219 tests/server/Makefile \
4220 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004221 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004222 packages/Makefile \
4223 packages/Win32/Makefile \
4224 packages/Win32/cygwin/Makefile \
4225 packages/Linux/Makefile \
4226 packages/Linux/RPM/Makefile \
4227 packages/Linux/RPM/curl.spec \
4228 packages/Linux/RPM/curl-ssl.spec \
4229 packages/Solaris/Makefile \
4230 packages/EPM/curl.list \
4231 packages/EPM/Makefile \
4232 packages/vms/Makefile \
4233 packages/AIX/Makefile \
4234 packages/AIX/RPM/Makefile \
4235 packages/AIX/RPM/curl.spec \
4236 curl-config \
4237 libcurl.pc
4238])
4239AC_OUTPUT
4240
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004241CURL_GENERATE_CONFIGUREHELP_PM
4242
4243XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4244
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004245AC_MSG_NOTICE([Configured to build curl/libcurl:
4246
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004247 curl version: ${CURLVERSION}
4248 Host setup: ${host}
4249 Install prefix: ${prefix}
4250 Compiler: ${CC}
4251 SSL support: ${curl_ssl_msg}
4252 SSH support: ${curl_ssh_msg}
4253 zlib support: ${curl_zlib_msg}
Alex Deymo486467e2017-12-19 19:04:07 +01004254 brotli support: ${curl_brotli_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004255 GSS-API support: ${curl_gss_msg}
4256 TLS-SRP support: ${curl_tls_srp_msg}
4257 resolver: ${curl_res_msg}
4258 IPv6 support: ${curl_ipv6_msg}
4259 Unix sockets support: ${curl_unix_sockets_msg}
4260 IDN support: ${curl_idn_msg}
4261 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4262 Built-in manual: ${curl_manual_msg}
4263 --libcurl option: ${curl_libcurl_msg}
4264 Verbose errors: ${curl_verbose_msg}
4265 SSPI support: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004266 ca cert bundle: ${ca}${ca_warning}
4267 ca cert path: ${capath}${capath_warning}
4268 ca fallback: ${with_ca_fallback}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004269 LDAP support: ${curl_ldap_msg}
4270 LDAPS support: ${curl_ldaps_msg}
4271 RTSP support: ${curl_rtsp_msg}
4272 RTMP support: ${curl_rtmp_msg}
4273 metalink support: ${curl_mtlnk_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004274 PSL support: ${curl_psl_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004275 HTTP2 support: ${curl_h2_msg}
4276 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004277])