blob: a72a612fb378ce2727f7dce2b9e530123da180c0 [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Elliott Hughes82be86d2017-09-20 17:00:17 -07008# Copyright (C) 1998 - 2017, 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
Elliott Hughes82be86d2017-09-20 17:00:17 -070054AX_CODE_COVERAGE
Lucas Eckels9bd90e62012-08-06 15:07:02 -070055
56#
57# save the configure arguments
58#
59CONFIGURE_OPTIONS="\"$ac_configure_args\""
60AC_SUBST(CONFIGURE_OPTIONS)
61
62CURL_CFLAG_EXTRAS=""
63if test X"$want_werror" = Xyes; then
64 CURL_CFLAG_EXTRAS="-Werror"
65fi
66AC_SUBST(CURL_CFLAG_EXTRAS)
67
68dnl SED is mandatory for configure process and libtool.
69dnl Set it now, allowing it to be changed later.
70if test -z "$SED"; then
71 dnl allow it to be overridden
72 AC_PATH_PROG([SED], [sed], [not_found],
73 [$PATH:/usr/bin:/usr/local/bin])
74 if test -z "$SED" || test "$SED" = "not_found"; then
75 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
76 fi
77fi
78AC_SUBST([SED])
79
80dnl GREP is mandatory for configure process and libtool.
81dnl Set it now, allowing it to be changed later.
82if test -z "$GREP"; then
83 dnl allow it to be overridden
84 AC_PATH_PROG([GREP], [grep], [not_found],
85 [$PATH:/usr/bin:/usr/local/bin])
86 if test -z "$GREP" || test "$GREP" = "not_found"; then
87 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
88 fi
89fi
90AC_SUBST([GREP])
91
92dnl EGREP is mandatory for configure process and libtool.
93dnl Set it now, allowing it to be changed later.
94if test -z "$EGREP"; then
95 dnl allow it to be overridden
96 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
97 AC_MSG_CHECKING([for egrep])
98 EGREP="$GREP -E"
99 AC_MSG_RESULT([$EGREP])
100 else
101 AC_PATH_PROG([EGREP], [egrep], [not_found],
102 [$PATH:/usr/bin:/usr/local/bin])
103 fi
104fi
105if test -z "$EGREP" || test "$EGREP" = "not_found"; then
106 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
107fi
108AC_SUBST([EGREP])
109
110dnl AR is mandatory for configure process and libtool.
111dnl This is target dependent, so check it as a tool.
112if test -z "$AR"; then
113 dnl allow it to be overridden
114 AC_PATH_TOOL([AR], [ar], [not_found],
115 [$PATH:/usr/bin:/usr/local/bin])
116 if test -z "$AR" || test "$AR" = "not_found"; then
117 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
118 fi
119fi
120AC_SUBST([AR])
121
122AC_SUBST(libext)
123
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700124dnl figure out the libcurl version
Elliott Hughes82be86d2017-09-20 17:00:17 -0700125CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)".*/\1/p' ${srcdir}/include/curl/curlver.h`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700126XC_CHECK_PROG_CC
127XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700128AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700129AC_MSG_RESULT($CURLVERSION)
130
131AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700132
133dnl
134dnl we extract the numerical version for curl-config only
Elliott Hughes82be86d2017-09-20 17:00:17 -0700135VERSIONNUM=`$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 -0700136AC_SUBST(VERSIONNUM)
137
138dnl Solaris pkgadd support definitions
139PKGADD_PKG="HAXXcurl"
Elliott Hughescee03382017-06-23 12:17:18 -0700140PKGADD_NAME="curl - a client that groks URLs"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700141PKGADD_VENDOR="curl.haxx.se"
142AC_SUBST(PKGADD_PKG)
143AC_SUBST(PKGADD_NAME)
144AC_SUBST(PKGADD_VENDOR)
145
146dnl
147dnl initialize all the info variables
Alex Deymod15eaac2016-06-28 14:49:26 -0700148 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700149 curl_ssh_msg="no (--with-libssh2)"
150 curl_zlib_msg="no (--with-zlib)"
Alex Deymo486467e2017-12-19 19:04:07 +0100151 curl_brotli_msg="no (--with-brotli)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700152 curl_gss_msg="no (--with-gssapi)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700153curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700154 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
155 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700156curl_unix_sockets_msg="no (--enable-unix-sockets)"
Elliott Hughescee03382017-06-23 12:17:18 -0700157 curl_idn_msg="no (--with-{libidn2,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700158 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700159curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700160curl_verbose_msg="enabled (--disable-verbose)"
161 curl_sspi_msg="no (--enable-sspi)"
162 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
163 curl_ldaps_msg="no (--enable-ldaps)"
164 curl_rtsp_msg="no (--enable-rtsp)"
165 curl_rtmp_msg="no (--with-librtmp)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700166 curl_mtlnk_msg="no (--with-libmetalink)"
Alex Deymod15eaac2016-06-28 14:49:26 -0700167 curl_psl_msg="no (--with-libpsl)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700168
Alex Deymo486467e2017-12-19 19:04:07 +0100169 ssl_backends=
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700170
171dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700172dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700173dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700174INITIAL_LDFLAGS=$LDFLAGS
175INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700176
Elliott Hughes82be86d2017-09-20 17:00:17 -0700177dnl
178dnl Detect the canonical host and target build environment
179dnl
180
181AC_CANONICAL_HOST
182dnl Get system canonical name
183AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
184
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700185dnl Checks for programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700186
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700187dnl This defines _ALL_SOURCE for AIX
188CURL_CHECK_AIX_ALL_SOURCE
189
190dnl Our configure and build reentrant settings
191CURL_CONFIGURE_THREAD_SAFE
192CURL_CONFIGURE_REENTRANT
193
194dnl check for how to do large files
195AC_SYS_LARGEFILE
196
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700197XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700198
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700199#
200# Automake conditionals based on libtool related checks
201#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700202
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700203AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
204 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
205AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
206 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
207AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
208 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700209
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700210#
211# Due to libtool and automake machinery limitations of not allowing
212# specifying separate CPPFLAGS or CFLAGS when compiling objects for
213# inclusion of these in shared or static libraries, we are forced to
214# build using separate configure runs for shared and static libraries
215# on systems where different CPPFLAGS or CFLAGS are mandatory in order
216# to compile objects for each kind of library. Notice that relying on
217# the '-DPIC' CFLAG that libtool provides is not valid given that the
218# user might for example choose to build static libraries with PIC.
219#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700220
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700221#
222# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
223# targeting a static library and not building its shared counterpart.
224#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700225
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700226AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
227 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700228
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700229#
230# Make staticlib CPPFLAG variable and its definition visible in output
231# files unconditionally, providing an empty definition unless strictly
232# targeting a static library and not building its shared counterpart.
233#
234
235CPPFLAG_CURL_STATICLIB=
236if test "x$xc_lt_build_static_only" = 'xyes'; then
237 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
238fi
239AC_SUBST([CPPFLAG_CURL_STATICLIB])
240
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700241
242# Determine whether all dependent libraries must be specified when linking
243if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
244then
245 REQUIRE_LIB_DEPS=no
246else
247 REQUIRE_LIB_DEPS=yes
248fi
249AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700250AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700251
252dnl check if there's a way to force code inline
253AC_C_INLINE
254
255dnl **********************************************************************
256dnl platform/compiler/architecture specific checks/flags
257dnl **********************************************************************
258
259CURL_CHECK_COMPILER
260CURL_SET_COMPILER_BASIC_OPTS
261CURL_SET_COMPILER_DEBUG_OPTS
262CURL_SET_COMPILER_OPTIMIZE_OPTS
263CURL_SET_COMPILER_WARNING_OPTS
264
265if test "$compiler_id" = "INTEL_UNIX_C"; then
266 #
267 if test "$compiler_num" -ge "1000"; then
268 dnl icc 10.X or later
269 CFLAGS="$CFLAGS -shared-intel"
270 elif test "$compiler_num" -ge "900"; then
271 dnl icc 9.X specific
272 CFLAGS="$CFLAGS -i-dynamic"
273 fi
274 #
275fi
276
277CURL_CHECK_COMPILER_HALT_ON_ERROR
278CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700279CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
280CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700281
282CURL_CHECK_CURLDEBUG
283AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
284
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700285supports_unittests=yes
286# cross-compilation of unit tests static library/programs fails when
287# libcurl shared library is built. This might be due to a libtool or
288# automake issue. In this case we disable unit tests.
289if test "x$cross_compiling" != "xno" &&
290 test "x$enable_shared" != "xno"; then
291 supports_unittests=no
292fi
293
294# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
295# a problem related with OpenSSL headers and library versions not matching.
296# Disable unit tests while time to further investigate this is found.
297case $host in
298 mips-sgi-irix6.5)
299 if test "$compiler_id" = "GNU_C"; then
300 supports_unittests=no
301 fi
302 ;;
303esac
304
305# All AIX autobuilds fails unit tests linking against unittests library
306# due to unittests library being built with no symbols or members. Libtool ?
307# Disable unit tests while time to further investigate this is found.
308case $host_os in
309 aix*)
310 supports_unittests=no
311 ;;
312esac
313
314dnl Build unit tests when option --enable-debug is given.
315if test "x$want_debug" = "xyes" &&
316 test "x$supports_unittests" = "xyes"; then
317 want_unittests=yes
318else
319 want_unittests=no
320fi
321AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
322
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700323dnl **********************************************************************
324dnl Compilation based checks should not be done before this point.
325dnl **********************************************************************
326
327dnl **********************************************************************
328dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
329dnl and ws2tcpip.h take precedence over any other further checks which
330dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
331dnl this specific header files. And do them before its results are used.
332dnl **********************************************************************
333
334CURL_CHECK_HEADER_WINDOWS
335CURL_CHECK_NATIVE_WINDOWS
Alex Deymod15eaac2016-06-28 14:49:26 -0700336case X-"$curl_cv_native_windows" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700337 X-yes)
338 CURL_CHECK_HEADER_WINSOCK
339 CURL_CHECK_HEADER_WINSOCK2
340 CURL_CHECK_HEADER_WS2TCPIP
341 CURL_CHECK_HEADER_WINLDAP
342 CURL_CHECK_HEADER_WINBER
343 ;;
344 *)
Alex Deymod15eaac2016-06-28 14:49:26 -0700345 curl_cv_header_winsock_h="no"
346 curl_cv_header_winsock2_h="no"
347 curl_cv_header_ws2tcpip_h="no"
348 curl_cv_header_winldap_h="no"
349 curl_cv_header_winber_h="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700350 ;;
351esac
352CURL_CHECK_WIN32_LARGEFILE
353
Elliott Hughescee03382017-06-23 12:17:18 -0700354CURL_MAC_CFLAGS
Alex Deymo486467e2017-12-19 19:04:07 +0100355CURL_SUPPORTS_BUILTIN_AVAILABLE
Elliott Hughescee03382017-06-23 12:17:18 -0700356
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700357dnl ************************************************************
358dnl switch off particular protocols
359dnl
360AC_MSG_CHECKING([whether to support http])
361AC_ARG_ENABLE(http,
362AC_HELP_STRING([--enable-http],[Enable HTTP support])
363AC_HELP_STRING([--disable-http],[Disable HTTP support]),
364[ case "$enableval" in
365 no)
366 AC_MSG_RESULT(no)
367 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
Elliott Hughes82be86d2017-09-20 17:00:17 -0700368 disable_http="yes"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700369 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
370 AC_SUBST(CURL_DISABLE_HTTP, [1])
371 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
372 AC_SUBST(CURL_DISABLE_RTSP, [1])
373 ;;
374 *) AC_MSG_RESULT(yes)
375 ;;
376 esac ],
377 AC_MSG_RESULT(yes)
378)
379AC_MSG_CHECKING([whether to support ftp])
380AC_ARG_ENABLE(ftp,
381AC_HELP_STRING([--enable-ftp],[Enable FTP support])
382AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
383[ case "$enableval" in
384 no)
385 AC_MSG_RESULT(no)
386 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
387 AC_SUBST(CURL_DISABLE_FTP, [1])
388 ;;
389 *) AC_MSG_RESULT(yes)
390 ;;
391 esac ],
392 AC_MSG_RESULT(yes)
393)
394AC_MSG_CHECKING([whether to support file])
395AC_ARG_ENABLE(file,
396AC_HELP_STRING([--enable-file],[Enable FILE support])
397AC_HELP_STRING([--disable-file],[Disable FILE support]),
398[ case "$enableval" in
399 no)
400 AC_MSG_RESULT(no)
401 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
402 AC_SUBST(CURL_DISABLE_FILE, [1])
403 ;;
404 *) AC_MSG_RESULT(yes)
405 ;;
406 esac ],
407 AC_MSG_RESULT(yes)
408)
409AC_MSG_CHECKING([whether to support ldap])
410AC_ARG_ENABLE(ldap,
411AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
412AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
413[ case "$enableval" in
414 no)
415 AC_MSG_RESULT(no)
416 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
417 AC_SUBST(CURL_DISABLE_LDAP, [1])
418 ;;
419 *)
420 AC_MSG_RESULT(yes)
421 ;;
422 esac ],[
423 AC_MSG_RESULT(yes) ]
424)
425AC_MSG_CHECKING([whether to support ldaps])
426AC_ARG_ENABLE(ldaps,
427AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
428AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
429[ case "$enableval" in
430 no)
431 AC_MSG_RESULT(no)
432 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
433 AC_SUBST(CURL_DISABLE_LDAPS, [1])
434 ;;
435 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
436 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
437 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
438 AC_SUBST(CURL_DISABLE_LDAPS, [1])
439 else
440 AC_MSG_RESULT(yes)
441 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
442 AC_SUBST(HAVE_LDAP_SSL, [1])
443 fi
444 ;;
445 esac ],[
446 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
447 AC_MSG_RESULT(no)
448 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
449 AC_SUBST(CURL_DISABLE_LDAPS, [1])
450 else
451 AC_MSG_RESULT(yes)
452 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
453 AC_SUBST(HAVE_LDAP_SSL, [1])
454 fi ]
455)
456
457AC_MSG_CHECKING([whether to support rtsp])
458AC_ARG_ENABLE(rtsp,
459AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
460AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
461[ case "$enableval" in
462 no)
463 AC_MSG_RESULT(no)
464 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
465 AC_SUBST(CURL_DISABLE_RTSP, [1])
466 ;;
467 *) if test x$CURL_DISABLE_HTTP = x1 ; then
468 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
469 else
470 AC_MSG_RESULT(yes)
471 curl_rtsp_msg="enabled"
472 fi
473 ;;
474 esac ],
475 if test "x$CURL_DISABLE_HTTP" != "x1"; then
476 AC_MSG_RESULT(yes)
477 curl_rtsp_msg="enabled"
478 else
479 AC_MSG_RESULT(no)
480 fi
481)
482
483AC_MSG_CHECKING([whether to support proxies])
484AC_ARG_ENABLE(proxy,
485AC_HELP_STRING([--enable-proxy],[Enable proxy support])
486AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
487[ case "$enableval" in
488 no)
489 AC_MSG_RESULT(no)
490 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
491 AC_SUBST(CURL_DISABLE_PROXY, [1])
492 ;;
493 *) AC_MSG_RESULT(yes)
494 ;;
495 esac ],
496 AC_MSG_RESULT(yes)
497)
498
499AC_MSG_CHECKING([whether to support dict])
500AC_ARG_ENABLE(dict,
501AC_HELP_STRING([--enable-dict],[Enable DICT support])
502AC_HELP_STRING([--disable-dict],[Disable DICT support]),
503[ case "$enableval" in
504 no)
505 AC_MSG_RESULT(no)
506 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
507 AC_SUBST(CURL_DISABLE_DICT, [1])
508 ;;
509 *) AC_MSG_RESULT(yes)
510 ;;
511 esac ],
512 AC_MSG_RESULT(yes)
513)
514AC_MSG_CHECKING([whether to support telnet])
515AC_ARG_ENABLE(telnet,
516AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
517AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
518[ case "$enableval" in
519 no)
520 AC_MSG_RESULT(no)
521 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
522 AC_SUBST(CURL_DISABLE_TELNET, [1])
523 ;;
524 *) AC_MSG_RESULT(yes)
525 ;;
526 esac ],
527 AC_MSG_RESULT(yes)
528)
529AC_MSG_CHECKING([whether to support tftp])
530AC_ARG_ENABLE(tftp,
531AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
532AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
533[ case "$enableval" in
534 no)
535 AC_MSG_RESULT(no)
536 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
537 AC_SUBST(CURL_DISABLE_TFTP, [1])
538 ;;
539 *) AC_MSG_RESULT(yes)
540 ;;
541 esac ],
542 AC_MSG_RESULT(yes)
543)
544
545AC_MSG_CHECKING([whether to support pop3])
546AC_ARG_ENABLE(pop3,
547AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
548AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
549[ case "$enableval" in
550 no)
551 AC_MSG_RESULT(no)
552 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
553 AC_SUBST(CURL_DISABLE_POP3, [1])
554 ;;
555 *) AC_MSG_RESULT(yes)
556 ;;
557 esac ],
558 AC_MSG_RESULT(yes)
559)
560
561
562AC_MSG_CHECKING([whether to support imap])
563AC_ARG_ENABLE(imap,
564AC_HELP_STRING([--enable-imap],[Enable IMAP support])
565AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
566[ case "$enableval" in
567 no)
568 AC_MSG_RESULT(no)
569 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
570 AC_SUBST(CURL_DISABLE_IMAP, [1])
571 ;;
572 *) AC_MSG_RESULT(yes)
573 ;;
574 esac ],
575 AC_MSG_RESULT(yes)
576)
577
578
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700579AC_MSG_CHECKING([whether to support smb])
580AC_ARG_ENABLE(smb,
581AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
582AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
583[ case "$enableval" in
584 no)
585 AC_MSG_RESULT(no)
586 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
587 AC_SUBST(CURL_DISABLE_SMB, [1])
588 ;;
589 *) AC_MSG_RESULT(yes)
590 ;;
591 esac ],
592 AC_MSG_RESULT(yes)
593)
594
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700595AC_MSG_CHECKING([whether to support smtp])
596AC_ARG_ENABLE(smtp,
597AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
598AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
599[ case "$enableval" in
600 no)
601 AC_MSG_RESULT(no)
602 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
603 AC_SUBST(CURL_DISABLE_SMTP, [1])
604 ;;
605 *) AC_MSG_RESULT(yes)
606 ;;
607 esac ],
608 AC_MSG_RESULT(yes)
609)
610
611AC_MSG_CHECKING([whether to support gopher])
612AC_ARG_ENABLE(gopher,
613AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
614AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
615[ case "$enableval" in
616 no)
617 AC_MSG_RESULT(no)
618 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
619 AC_SUBST(CURL_DISABLE_GOPHER, [1])
620 ;;
621 *) AC_MSG_RESULT(yes)
622 ;;
623 esac ],
624 AC_MSG_RESULT(yes)
625)
626
627
628dnl **********************************************************************
629dnl Check for built-in manual
630dnl **********************************************************************
631
632AC_MSG_CHECKING([whether to provide built-in manual])
633AC_ARG_ENABLE(manual,
634AC_HELP_STRING([--enable-manual],[Enable built-in manual])
635AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
636[ case "$enableval" in
637 no)
638 AC_MSG_RESULT(no)
639 ;;
640 *) AC_MSG_RESULT(yes)
641 USE_MANUAL="1"
642 ;;
643 esac ],
644 AC_MSG_RESULT(yes)
645 USE_MANUAL="1"
646)
647dnl The actual use of the USE_MANUAL variable is done much later in this
648dnl script to allow other actions to disable it as well.
649
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700650dnl ************************************************************
651dnl disable C code generation support
652dnl
653AC_MSG_CHECKING([whether to enable generation of C code])
654AC_ARG_ENABLE(libcurl_option,
655AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
656AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
657[ case "$enableval" in
658 no)
659 AC_MSG_RESULT(no)
660 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
661 curl_libcurl_msg="no"
662 ;;
663 *) AC_MSG_RESULT(yes)
664 ;;
665 esac ],
666 AC_MSG_RESULT(yes)
667)
668
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700669dnl **********************************************************************
670dnl Checks for libraries.
671dnl **********************************************************************
672
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700673AC_MSG_CHECKING([whether to use libgcc])
674AC_ARG_ENABLE(libgcc,
675AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
676[ case "$enableval" in
677 yes)
678 LIBS="-lgcc $LIBS"
679 AC_MSG_RESULT(yes)
680 ;;
681 *) AC_MSG_RESULT(no)
682 ;;
683 esac ],
684 AC_MSG_RESULT(no)
685)
686
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700687CURL_CHECK_LIB_XNET
688
689dnl gethostbyname without lib or in the nsl lib?
690AC_CHECK_FUNC(gethostbyname,
691 [HAVE_GETHOSTBYNAME="1"
692 ],
693 [ AC_CHECK_LIB(nsl, gethostbyname,
694 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700695 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700696 ])
697 ])
698
699if test "$HAVE_GETHOSTBYNAME" != "1"
700then
701 dnl gethostbyname in the socket lib?
702 AC_CHECK_LIB(socket, gethostbyname,
703 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700704 LIBS="-lsocket $LIBS"
705 ])
706fi
707
708if test "$HAVE_GETHOSTBYNAME" != "1"
709then
710 dnl gethostbyname in the watt lib?
711 AC_CHECK_LIB(watt, gethostbyname,
712 [HAVE_GETHOSTBYNAME="1"
713 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
714 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
715 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700716 ])
717fi
718
719dnl At least one system has been identified to require BOTH nsl and socket
720dnl libs at the same time to link properly.
721if test "$HAVE_GETHOSTBYNAME" != "1"
722then
723 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
724 my_ac_save_LIBS=$LIBS
725 LIBS="-lnsl -lsocket $LIBS"
726 AC_LINK_IFELSE([
727 AC_LANG_PROGRAM([[
728 ]],[[
729 gethostbyname();
730 ]])
731 ],[
732 AC_MSG_RESULT([yes])
733 HAVE_GETHOSTBYNAME="1"
734 ],[
735 AC_MSG_RESULT([no])
736 LIBS=$my_ac_save_LIBS
737 ])
738fi
739
740if test "$HAVE_GETHOSTBYNAME" != "1"
741then
742 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -0700743 if test "$curl_cv_header_windows_h" = "yes"; then
744 if test "$curl_cv_header_winsock_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700745 case $host in
746 *-*-mingw32ce*)
747 winsock_LIB="-lwinsock"
748 ;;
749 *)
750 winsock_LIB="-lwsock32"
751 ;;
752 esac
753 fi
Alex Deymod15eaac2016-06-28 14:49:26 -0700754 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700755 winsock_LIB="-lws2_32"
756 fi
757 if test ! -z "$winsock_LIB"; then
758 my_ac_save_LIBS=$LIBS
759 LIBS="$winsock_LIB $LIBS"
760 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
761 AC_LINK_IFELSE([
762 AC_LANG_PROGRAM([[
763#ifdef HAVE_WINDOWS_H
764#ifndef WIN32_LEAN_AND_MEAN
765#define WIN32_LEAN_AND_MEAN
766#endif
767#include <windows.h>
768#ifdef HAVE_WINSOCK2_H
769#include <winsock2.h>
770#else
771#ifdef HAVE_WINSOCK_H
772#include <winsock.h>
773#endif
774#endif
775#endif
776 ]],[[
777 gethostbyname("www.dummysite.com");
778 ]])
779 ],[
780 AC_MSG_RESULT([yes])
781 HAVE_GETHOSTBYNAME="1"
782 ],[
783 AC_MSG_RESULT([no])
784 winsock_LIB=""
785 LIBS=$my_ac_save_LIBS
786 ])
787 fi
788 fi
789fi
790
791if test "$HAVE_GETHOSTBYNAME" != "1"
792then
793 dnl This is for Minix 3.1
794 AC_MSG_CHECKING([for gethostbyname for Minix 3])
795 AC_LINK_IFELSE([
796 AC_LANG_PROGRAM([[
797/* Older Minix versions may need <net/gen/netdb.h> here instead */
798#include <netdb.h>
799 ]],[[
800 gethostbyname("www.dummysite.com");
801 ]])
802 ],[
803 AC_MSG_RESULT([yes])
804 HAVE_GETHOSTBYNAME="1"
805 ],[
806 AC_MSG_RESULT([no])
807 ])
808fi
809
810if test "$HAVE_GETHOSTBYNAME" != "1"
811then
812 dnl This is for eCos with a stubbed DNS implementation
813 AC_MSG_CHECKING([for gethostbyname for eCos])
814 AC_LINK_IFELSE([
815 AC_LANG_PROGRAM([[
816#include <stdio.h>
817#include <netdb.h>
818 ]],[[
819 gethostbyname("www.dummysite.com");
820 ]])
821 ],[
822 AC_MSG_RESULT([yes])
823 HAVE_GETHOSTBYNAME="1"
824 ],[
825 AC_MSG_RESULT([no])
826 ])
827fi
828
829if test "$HAVE_GETHOSTBYNAME" != "1"
830then
831 dnl gethostbyname in the network lib - for Haiku OS
832 AC_CHECK_LIB(network, gethostbyname,
833 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700834 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700835 ])
836fi
837
838if test "$HAVE_GETHOSTBYNAME" != "1"
839then
840 dnl gethostbyname in the net lib - for BeOS
841 AC_CHECK_LIB(net, gethostbyname,
842 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700843 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700844 ])
845fi
846
847
848if test "$HAVE_GETHOSTBYNAME" != "1"; then
849 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
850fi
851
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700852CURL_CHECK_LIBS_CONNECT
853
854CURL_NETWORK_LIBS=$LIBS
855
856dnl **********************************************************************
857dnl In case that function clock_gettime with monotonic timer is available,
858dnl check for additional required libraries.
859dnl **********************************************************************
860CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
861
862dnl **********************************************************************
863dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700864dnl servers and libtest cases which require networking and clock_gettime
865dnl support. Save the list of required libraries at this point for use
866dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700867dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700868CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700869
870dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700871dnl Check for the presence of ZLIB libraries and headers
872dnl **********************************************************************
873
874dnl Check for & handle argument to --with-zlib.
875
876clean_CPPFLAGS=$CPPFLAGS
877clean_LDFLAGS=$LDFLAGS
878clean_LIBS=$LIBS
879ZLIB_LIBS=""
880AC_ARG_WITH(zlib,
881AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
882AC_HELP_STRING([--without-zlib],[disable use of zlib]),
883 [OPT_ZLIB="$withval"])
884
885if test "$OPT_ZLIB" = "no" ; then
886 AC_MSG_WARN([zlib disabled])
887else
888 if test "$OPT_ZLIB" = "yes" ; then
889 OPT_ZLIB=""
890 fi
891
Elliott Hughescee03382017-06-23 12:17:18 -0700892 if test -z "$OPT_ZLIB" ; then
Elliott Hughes82be86d2017-09-20 17:00:17 -0700893 CURL_CHECK_PKGCONFIG(zlib)
894
895 if test "$PKGCONFIG" != "no" ; then
896 LIBS="`$PKGCONFIG --libs-only-l zlib` $LIBS"
897 LDFLAGS="$LDFLAGS `$PKGCONFIG --libs-only-L zlib`"
898 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags-only-I zlib`"
899 OPT_ZLIB=""
900 HAVE_LIBZ="1"
901 fi
Elliott Hughescee03382017-06-23 12:17:18 -0700902
903 if test -z "$HAVE_LIBZ"; then
904
905 dnl Check for the lib without setting any new path, since many
906 dnl people have it in the default path
907
908 AC_CHECK_LIB(z, inflateEnd,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700909 dnl libz found, set the variable
910 [HAVE_LIBZ="1"
911 LIBS="-lz $LIBS"],
912 dnl if no lib found, try /usr/local
913 [OPT_ZLIB="/usr/local"])
Elliott Hughescee03382017-06-23 12:17:18 -0700914 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700915 fi
916
917 dnl Add a nonempty path to the compiler flags
918 if test -n "$OPT_ZLIB"; then
919 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
920 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
921 fi
922
923 AC_CHECK_HEADER(zlib.h,
924 [
925 dnl zlib.h was found
926 HAVE_ZLIB_H="1"
927 dnl if the lib wasn't found already, try again with the new paths
928 if test "$HAVE_LIBZ" != "1"; then
929 AC_CHECK_LIB(z, gzread,
930 [
931 dnl the lib was found!
932 HAVE_LIBZ="1"
933 LIBS="-lz $LIBS"
934 ],
935 [ CPPFLAGS=$clean_CPPFLAGS
936 LDFLAGS=$clean_LDFLAGS])
937 fi
938 ],
939 [
940 dnl zlib.h was not found, restore the flags
941 CPPFLAGS=$clean_CPPFLAGS
942 LDFLAGS=$clean_LDFLAGS]
943 )
944
945 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
946 then
947 AC_MSG_WARN([configure found only the libz lib, not the header file!])
948 HAVE_LIBZ=""
949 CPPFLAGS=$clean_CPPFLAGS
950 LDFLAGS=$clean_LDFLAGS
951 LIBS=$clean_LIBS
952 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
953 then
954 AC_MSG_WARN([configure found only the libz header file, not the lib!])
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 dnl both header and lib were found!
961 AC_SUBST(HAVE_LIBZ)
962 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
963 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
964
965 ZLIB_LIBS="-lz"
966 LIBS="-lz $clean_LIBS"
967
968 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
969 AMFIXLIB="1"
970 AC_MSG_NOTICE([found both libz and libz.h header])
971 curl_zlib_msg="enabled"
972 fi
973fi
974
975dnl set variable for use in automakefile(s)
976AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
977AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700978
979dnl **********************************************************************
Alex Deymo486467e2017-12-19 19:04:07 +0100980dnl Check for the presence of BROTLI decoder libraries and headers
981dnl **********************************************************************
982
983dnl Brotli project home page: https://github.com/google/brotli
984
985dnl Default to compiler & linker defaults for BROTLI files & libraries.
986OPT_BROTLI=off
987AC_ARG_WITH(brotli,dnl
988AC_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])
989AC_HELP_STRING([--without-brotli], [disable BROTLI]),
990 OPT_BROTLI=$withval)
991
992if test X"$OPT_BROTLI" != Xno; then
993 dnl backup the pre-brotli variables
994 CLEANLDFLAGS="$LDFLAGS"
995 CLEANCPPFLAGS="$CPPFLAGS"
996 CLEANLIBS="$LIBS"
997
998 case "$OPT_BROTLI" in
999 yes)
1000 dnl --with-brotli (without path) used
1001 CURL_CHECK_PKGCONFIG(libbrotlidec)
1002
1003 if test "$PKGCONFIG" != "no" ; then
1004 LIB_BROTLI=`$PKGCONFIG --libs-only-l libbrotlidec`
1005 LD_BROTLI=`$PKGCONFIG --libs-only-L libbrotlidec`
1006 CPP_BROTLI=`$PKGCONFIG --cflags-only-I libbrotlidec`
1007 version=`$PKGCONFIG --modversion libbrotlidec`
1008 DIR_BROTLI=`echo $LD_BROTLI | $SED -e 's/-L//'`
1009 fi
1010
1011 ;;
1012 off)
1013 dnl no --with-brotli option given, just check default places
1014 ;;
1015 *)
1016 dnl use the given --with-brotli spot
1017 PREFIX_BROTLI=$OPT_BROTLI
1018 ;;
1019 esac
1020
1021 dnl if given with a prefix, we set -L and -I based on that
1022 if test -n "$PREFIX_BROTLI"; then
1023 LIB_BROTLI="-lbrotlidec"
1024 LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
1025 CPP_BROTLI=-I${PREFIX_BROTLI}/include
1026 DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
1027 fi
1028
1029 LDFLAGS="$LDFLAGS $LD_BROTLI"
1030 CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
1031 LIBS="$LIB_BROTLI $LIBS"
1032
1033 AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
1034
1035 AC_CHECK_HEADERS(brotli/decode.h,
1036 curl_brotli_msg="enabled (libbrotlidec)"
1037 HAVE_BROTLI=1
1038 AC_DEFINE(HAVE_BROTLI, 1, [if BROTLI is in use])
1039 AC_SUBST(HAVE_BROTLI, [1])
1040 )
1041
1042 if test X"$OPT_BROTLI" != Xoff &&
1043 test "$HAVE_BROTLI" != "1"; then
1044 AC_MSG_ERROR([BROTLI libs and/or directories were not found where specified!])
1045 fi
1046
1047 if test "$HAVE_BROTLI" = "1"; then
1048 if test -n "$DIR_BROTLI"; then
1049 dnl when the brotli shared libs were found in a path that the run-time
1050 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1051 dnl to prevent further configure tests to fail due to this
1052
1053 if test "x$cross_compiling" != "xyes"; then
1054 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_BROTLI"
1055 export LD_LIBRARY_PATH
1056 AC_MSG_NOTICE([Added $DIR_BROTLI to LD_LIBRARY_PATH])
1057 fi
1058 fi
1059 else
1060 dnl no brotli, revert back to clean variables
1061 LDFLAGS=$CLEANLDFLAGS
1062 CPPFLAGS=$CLEANCPPFLAGS
1063 LIBS=$CLEANLIBS
1064 fi
1065fi
1066
1067dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001068dnl Check for LDAP
1069dnl **********************************************************************
1070
1071LDAPLIBNAME=""
1072AC_ARG_WITH(ldap-lib,
1073AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
1074 [LDAPLIBNAME="$withval"])
1075
1076LBERLIBNAME=""
1077AC_ARG_WITH(lber-lib,
1078AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
1079 [LBERLIBNAME="$withval"])
1080
1081if test x$CURL_DISABLE_LDAP != x1 ; then
1082
1083 CURL_CHECK_HEADER_LBER
1084 CURL_CHECK_HEADER_LDAP
1085 CURL_CHECK_HEADER_LDAPSSL
1086 CURL_CHECK_HEADER_LDAP_SSL
1087
1088 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001089 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001090 dnl Windows uses a single and unique LDAP library name
1091 LDAPLIBNAME="wldap32"
1092 LBERLIBNAME="no"
1093 fi
1094 fi
1095
1096 if test "$LDAPLIBNAME" ; then
1097 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1098 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1099 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001100 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001101 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001102 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001103 else
1104 dnl Try to find the right ldap libraries for this system
1105 CURL_CHECK_LIBS_LDAP
1106 case X-"$curl_cv_ldap_LIBS" in
1107 X-unknown)
1108 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1109 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1110 AC_SUBST(CURL_DISABLE_LDAP, [1])
1111 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1112 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1113 ;;
1114 esac
1115 fi
1116fi
1117
1118if test x$CURL_DISABLE_LDAP != x1 ; then
1119
1120 if test "$LBERLIBNAME" ; then
1121 dnl If name is "no" then don't define this library at all
1122 dnl (it's only needed if libldap.so's dependencies are broken).
1123 if test "$LBERLIBNAME" != "no" ; then
1124 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1125 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1126 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001127 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001128 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001129 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001130 fi
1131 fi
1132fi
1133
1134if test x$CURL_DISABLE_LDAP != x1 ; then
1135 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1136
1137 if test "$LDAPLIBNAME" = "wldap32"; then
1138 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001139 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001140 else
1141 curl_ldap_msg="enabled (OpenLDAP)"
1142 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1143 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1144 AC_SUBST(USE_OPENLDAP, [1])
1145 fi
1146 fi
1147fi
1148
1149if test x$CURL_DISABLE_LDAPS != x1 ; then
1150 curl_ldaps_msg="enabled"
1151fi
1152
1153dnl **********************************************************************
1154dnl Checks for IPv6
1155dnl **********************************************************************
1156
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001157AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001158AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001159AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1160AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001161[ case "$enableval" in
1162 no)
1163 AC_MSG_RESULT(no)
1164 ipv6=no
1165 ;;
1166 *) AC_MSG_RESULT(yes)
1167 ipv6=yes
1168 ;;
1169 esac ],
1170
1171 AC_TRY_RUN([ /* is AF_INET6 available? */
1172#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001173#ifdef HAVE_WINSOCK2_H
1174#include <winsock2.h>
1175#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001176#include <sys/socket.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001177#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001178#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001179main()
1180{
1181 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1182 exit(1);
1183 else
1184 exit(0);
1185}
1186],
1187 AC_MSG_RESULT(yes)
1188 ipv6=yes,
1189 AC_MSG_RESULT(no)
1190 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001191 AC_MSG_RESULT(yes)
1192 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001193))
1194
1195if test "$ipv6" = "yes"; then
1196 curl_ipv6_msg="enabled"
1197fi
1198
1199# Check if struct sockaddr_in6 have sin6_scope_id member
1200if test "$ipv6" = yes; then
1201 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1202 AC_TRY_COMPILE([
1203#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001204#ifdef HAVE_WINSOCK2_H
1205#include <winsock2.h>
1206#include <ws2tcpip.h>
1207#else
1208#include <netinet/in.h>
1209#endif] ,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001210 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1211 if test "$have_sin6_scope_id" = yes; then
1212 AC_MSG_RESULT([yes])
1213 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1214 else
1215 AC_MSG_RESULT([no])
1216 fi
1217fi
1218
1219dnl **********************************************************************
1220dnl Check if the operating system allows programs to write to their own argv[]
1221dnl **********************************************************************
1222
1223AC_MSG_CHECKING([if argv can be written to])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001224AC_RUN_IFELSE([
1225 AC_LANG_SOURCE([[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001226int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001227 argv[0][0] = ' ';
1228 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001229}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001230 ]])
1231],[
1232 curl_cv_writable_argv=yes
1233],[
1234 curl_cv_writable_argv=no
1235],[
1236 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001237])
1238case $curl_cv_writable_argv in
1239yes)
1240 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1241 AC_MSG_RESULT(yes)
1242 ;;
1243no)
1244 AC_MSG_RESULT(no)
1245 ;;
1246*)
1247 AC_MSG_RESULT(no)
1248 AC_MSG_WARN([the previous check could not be made default was used])
1249 ;;
1250esac
1251
1252dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001253dnl Check for GSS-API libraries
1254dnl **********************************************************************
1255
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001256dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001257
1258GSSAPI_ROOT="/usr"
1259AC_ARG_WITH(gssapi-includes,
1260 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001261 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001262 [ GSSAPI_INCS="-I$withval"
1263 want_gss="yes" ]
1264)
1265
1266AC_ARG_WITH(gssapi-libs,
1267 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001268 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001269 [ GSSAPI_LIB_DIR="-L$withval"
1270 want_gss="yes" ]
1271)
1272
1273AC_ARG_WITH(gssapi,
1274 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001275 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001276 GSSAPI_ROOT="$withval"
1277 if test x"$GSSAPI_ROOT" != xno; then
1278 want_gss="yes"
1279 if test x"$GSSAPI_ROOT" = xyes; then
1280 dnl if yes, then use default root
1281 GSSAPI_ROOT="/usr"
1282 fi
1283 fi
1284])
1285
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001286: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1287
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001288save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001289AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001290if test x"$want_gss" = xyes; then
1291 AC_MSG_RESULT(yes)
1292
1293 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001294 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1295 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1296 elif test -f "$KRB5CONFIG"; then
1297 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001298 elif test "$GSSAPI_ROOT" != "yes"; then
1299 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1300 fi
1301 fi
1302
1303 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1304
1305 AC_CHECK_HEADER(gss.h,
1306 [
1307 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001308 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001309 gnu_gss=yes
1310 ],
1311 [
1312 dnl not found, check Heimdal or MIT
1313 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1314 AC_CHECK_HEADERS(
1315 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1316 [],
1317 [not_mit=1],
1318 [
1319AC_INCLUDES_DEFAULT
1320#ifdef HAVE_GSSAPI_GSSAPI_H
1321#include <gssapi/gssapi.h>
1322#endif
1323 ])
1324 if test "x$not_mit" = "x1"; then
1325 dnl MIT not found, check for Heimdal
1326 AC_CHECK_HEADER(gssapi.h,
1327 [
1328 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001329 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001330 ],
1331 [
1332 dnl no header found, disabling GSS
1333 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001334 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001335 ]
1336 )
1337 else
1338 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001339 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1340 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1341 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001342 AC_COMPILE_IFELSE([
1343 AC_LANG_PROGRAM([[
1344#include <gssapi/gssapi.h>
1345#include <gssapi/gssapi_generic.h>
1346#include <gssapi/gssapi_krb5.h>
1347 ]],[[
1348 gss_import_name(
1349 (OM_uint32 *)0,
1350 (gss_buffer_t)0,
1351 GSS_C_NT_HOSTBASED_SERVICE,
1352 (gss_name_t *)0);
1353 ]])
1354 ],[
1355 AC_MSG_RESULT([yes])
1356 ],[
1357 AC_MSG_RESULT([no])
1358 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001359 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001360 ])
1361 fi
1362 ]
1363 )
1364else
1365 AC_MSG_RESULT(no)
1366fi
1367if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001368 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1369 HAVE_GSSAPI=1
1370 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001371
1372 if test -n "$gnu_gss"; then
1373 curl_gss_msg="enabled (GNU GSS)"
1374 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001375 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001376 elif test -z "$GSSAPI_LIB_DIR"; then
1377 case $host in
1378 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001379 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001380 ;;
1381 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001382 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001383 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1384 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001385 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1386 LIBS="$gss_libs $LIBS"
1387 elif test -f "$KRB5CONFIG"; then
1388 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1389 dnl into LIBS
1390 gss_libs=`$KRB5CONFIG --libs gssapi`
1391 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001392 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001393 case $host in
1394 *-hp-hpux*)
1395 gss_libname="gss"
1396 ;;
1397 *)
1398 gss_libname="gssapi"
1399 ;;
1400 esac
1401
1402 if test "$GSSAPI_ROOT" != "yes"; then
1403 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1404 LIBS="-l$gss_libname $LIBS"
1405 else
1406 LIBS="-l$gss_libname $LIBS"
1407 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001408 fi
1409 ;;
1410 esac
1411 else
1412 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001413 case $host in
1414 *-hp-hpux*)
1415 LIBS="-lgss $LIBS"
1416 ;;
1417 *)
1418 LIBS="-lgssapi $LIBS"
1419 ;;
1420 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001421 fi
1422else
1423 CPPFLAGS="$save_CPPFLAGS"
1424fi
1425
Alex Deymo486467e2017-12-19 19:04:07 +01001426build_libstubgss=no
1427if test x"$want_gss" = "xyes"; then
1428 build_libstubgss=yes
1429fi
1430
1431AM_CONDITIONAL(BUILD_STUB_GSS, test "x$build_libstubgss" = "xyes")
1432
1433dnl -------------------------------------------------------------
1434dnl parse --with-default-ssl-backend so it can be validated below
1435dnl -------------------------------------------------------------
1436
1437DEFAULT_SSL_BACKEND=no
1438VALID_DEFAULT_SSL_BACKEND=
1439AC_ARG_WITH(default-ssl-backend,
1440AC_HELP_STRING([--with-default-ssl-backend=NAME],[Use NAME as default SSL backend])
1441AC_HELP_STRING([--without-default-ssl-backend],[Use implicit default SSL backend]),
1442 [DEFAULT_SSL_BACKEND=$withval])
1443case "$DEFAULT_SSL_BACKEND" in
1444 no)
1445 dnl --without-default-ssl-backend option used
1446 ;;
1447 default|yes)
1448 dnl --with-default-ssl-backend option used without name
1449 AC_MSG_ERROR([The name of the default SSL backend is required.])
1450 ;;
1451 *)
1452 dnl --with-default-ssl-backend option used with name
1453 AC_SUBST(DEFAULT_SSL_BACKEND)
1454 dnl needs to be validated below
1455 VALID_DEFAULT_SSL_BACKEND=no
1456 ;;
1457esac
1458
1459dnl **********************************************************************
1460
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001461dnl -------------------------------------------------
1462dnl check winssl option before other SSL libraries
1463dnl -------------------------------------------------
1464
1465OPT_WINSSL=no
1466AC_ARG_WITH(winssl,dnl
1467AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1468AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1469 OPT_WINSSL=$withval)
1470
1471AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
Alex Deymo486467e2017-12-19 19:04:07 +01001472if test -z "$ssl_backends" -o "x$OPT_WINSSL" != xno; then
1473 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001474 if test "x$OPT_WINSSL" != "xno" &&
Alex Deymod15eaac2016-06-28 14:49:26 -07001475 test "x$curl_cv_native_windows" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001476 AC_MSG_RESULT(yes)
1477 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1478 AC_SUBST(USE_SCHANNEL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001479 ssl_msg="Windows-native"
1480 test schannel != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001481 WINSSL_ENABLED=1
1482 # --with-winssl implies --enable-sspi
1483 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1484 AC_SUBST(USE_WINDOWS_SSPI, [1])
1485 curl_sspi_msg="enabled"
Alex Deymoe3149cc2016-10-05 11:18:42 -07001486 LIBS="-lcrypt32 $LIBS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001487 else
1488 AC_MSG_RESULT(no)
1489 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001490 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001491else
1492 AC_MSG_RESULT(no)
1493fi
1494
1495OPT_DARWINSSL=no
1496AC_ARG_WITH(darwinssl,dnl
Elliott Hughescee03382017-06-23 12:17:18 -07001497AC_HELP_STRING([--with-darwinssl],[enable Apple OS native SSL/TLS])
1498AC_HELP_STRING([--without-darwinssl], [disable Apple OS native SSL/TLS]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001499 OPT_DARWINSSL=$withval)
1500
Elliott Hughescee03382017-06-23 12:17:18 -07001501AC_MSG_CHECKING([whether to enable Apple OS native SSL/TLS])
Alex Deymo486467e2017-12-19 19:04:07 +01001502if test -z "$ssl_backends" -o "x$OPT_DARWINSSL" != xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001503 if test "x$OPT_DARWINSSL" != "xno" &&
1504 test -d "/System/Library/Frameworks/Security.framework"; then
1505 AC_MSG_RESULT(yes)
Elliott Hughescee03382017-06-23 12:17:18 -07001506 AC_DEFINE(USE_DARWINSSL, 1, [to enable Apple OS native SSL/TLS support])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001507 AC_SUBST(USE_DARWINSSL, [1])
Alex Deymo486467e2017-12-19 19:04:07 +01001508 ssl_msg="Apple OS-native"
1509 test darwinssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001510 DARWINSSL_ENABLED=1
1511 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1512 else
1513 AC_MSG_RESULT(no)
1514 fi
Alex Deymo486467e2017-12-19 19:04:07 +01001515 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001516else
1517 AC_MSG_RESULT(no)
1518fi
1519
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001520dnl **********************************************************************
1521dnl Check for the presence of SSL libraries and headers
1522dnl **********************************************************************
1523
1524dnl Default to compiler & linker defaults for SSL files & libraries.
1525OPT_SSL=off
1526dnl Default to no CA bundle
1527ca="no"
1528AC_ARG_WITH(ssl,dnl
1529AC_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])
1530AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1531 OPT_SSL=$withval)
1532
Alex Deymo486467e2017-12-19 19:04:07 +01001533if test -z "$ssl_backends" -o "x$OPT_SSL" != xno &&
1534 test X"$OPT_SSL" != Xno; then
1535 ssl_msg=
1536
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001537 dnl backup the pre-ssl variables
1538 CLEANLDFLAGS="$LDFLAGS"
1539 CLEANCPPFLAGS="$CPPFLAGS"
1540 CLEANLIBS="$LIBS"
1541
Alex Deymod15eaac2016-06-28 14:49:26 -07001542 dnl This is for Msys/Mingw
1543 case $host in
1544 *-*-msys* | *-*-mingw*)
1545 AC_MSG_CHECKING([for gdi32])
1546 my_ac_save_LIBS=$LIBS
1547 LIBS="-lgdi32 $LIBS"
1548 AC_TRY_LINK([#include <windef.h>
1549 #include <wingdi.h>],
1550 [GdiFlush();],
1551 [ dnl worked!
1552 AC_MSG_RESULT([yes])],
1553 [ dnl failed, restore LIBS
1554 LIBS=$my_ac_save_LIBS
1555 AC_MSG_RESULT(no)]
1556 )
1557 ;;
1558 esac
1559
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001560 case "$OPT_SSL" in
1561 yes)
1562 dnl --with-ssl (without path) used
1563 if test x$cross_compiling != xyes; then
1564 dnl only do pkg-config magic when not cross-compiling
1565 PKGTEST="yes"
1566 fi
1567 PREFIX_OPENSSL=/usr/local/ssl
1568 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1569 ;;
1570 off)
1571 dnl no --with-ssl option given, just check default places
1572 if test x$cross_compiling != xyes; then
1573 dnl only do pkg-config magic when not cross-compiling
1574 PKGTEST="yes"
1575 fi
1576 PREFIX_OPENSSL=
1577 ;;
1578 *)
1579 dnl check the given --with-ssl spot
1580 PKGTEST="no"
1581 PREFIX_OPENSSL=$OPT_SSL
1582
1583 dnl Try pkg-config even when cross-compiling. Since we
1584 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1585 dnl the user told us to look
1586 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1587 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001588 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001589 PKGTEST="yes"
1590 fi
1591
1592 dnl in case pkg-config comes up empty, use what we got
1593 dnl via --with-ssl
1594 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1595 if test "$PREFIX_OPENSSL" != "/usr" ; then
1596 SSL_LDFLAGS="-L$LIB_OPENSSL"
1597 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1598 fi
1599 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1600 ;;
1601 esac
1602
1603 if test "$PKGTEST" = "yes"; then
1604
1605 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1606
1607 if test "$PKGCONFIG" != "no" ; then
1608 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1609 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1610
1611 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1612 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1613
1614 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1615 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1616
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001617 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001618 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1619 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1620 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1621
1622 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1623
1624 dnl use the values pkg-config reported. This is here
1625 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1626 dnl learn about this via pkg-config. If we only have
1627 dnl the argument to --with-ssl we don't know what
1628 dnl additional libs may be necessary. Hope that we
1629 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001630 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001631 fi
1632 fi
1633
1634 dnl finally, set flags to use SSL
1635 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1636 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1637
Alex Deymod15eaac2016-06-28 14:49:26 -07001638 AC_CHECK_LIB(crypto, HMAC_Update,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001639 HAVECRYPTO="yes"
1640 LIBS="-lcrypto $LIBS"
1641 ],[
1642 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1643 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
Alex Deymod15eaac2016-06-28 14:49:26 -07001644 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001645 HAVECRYPTO="yes"
1646 LIBS="-lcrypto $LIBS"], [
Elliott Hughes82be86d2017-09-20 17:00:17 -07001647
1648 dnl still no, but what about with -ldl?
1649 AC_MSG_CHECKING([OpenSSL linking with -ldl])
1650 LIBS="-ldl $LIBS"
1651 AC_TRY_LINK(
1652 [
1653 #include <openssl/err.h>
1654 ],
1655 [
1656 ERR_clear_error();
1657 ],
1658 [
1659 AC_MSG_RESULT(yes)
1660 HAVECRYPTO="yes"
1661 ],
1662 [
1663 AC_MSG_RESULT(no)
1664 dnl ok, so what about bouth -ldl and -lpthread?
1665
1666 AC_MSG_CHECKING([OpenSSL linking with -ldl and -lpthread])
1667 LIBS="-lpthread $LIBS"
1668 AC_TRY_LINK(
1669 [
1670 #include <openssl/err.h>
1671 ],
1672 [
1673 ERR_clear_error();
1674 ],
1675 [
1676 AC_MSG_RESULT(yes)
1677 HAVECRYPTO="yes"
1678 ],
1679 [
1680 AC_MSG_RESULT(no)
1681 LDFLAGS="$CLEANLDFLAGS"
1682 CPPFLAGS="$CLEANCPPFLAGS"
1683 LIBS="$CLEANLIBS"
1684
1685 ])
1686
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001687 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001688
Elliott Hughes82be86d2017-09-20 17:00:17 -07001689 ])
1690 ])
Alex Deymod15eaac2016-06-28 14:49:26 -07001691
1692 if test X"$HAVECRYPTO" = X"yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001693 dnl This is only reasonable to do if crypto actually is there: check for
1694 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1695
1696 AC_CHECK_LIB(ssl, SSL_connect)
1697
1698 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1699 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1700 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1701 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001702 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001703 AC_CHECK_LIB(ssl, SSL_connect)
1704 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1705 dnl still no SSL_connect
1706 AC_MSG_RESULT(no)
1707 LIBS=$OLIBS
1708 else
1709 AC_MSG_RESULT(yes)
1710 fi
1711
1712 else
1713
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001714 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001715 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1716 openssl/pem.h openssl/ssl.h openssl/err.h,
Alex Deymo486467e2017-12-19 19:04:07 +01001717 ssl_msg="OpenSSL"
1718 test openssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001719 OPENSSL_ENABLED=1
1720 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1721
1722 if test $ac_cv_header_openssl_x509_h = no; then
1723 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1724 dnl since 'err.h' might in fact find a krb4 header with the same
1725 dnl name
1726 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1727
1728 if test $ac_cv_header_x509_h = yes &&
1729 test $ac_cv_header_crypto_h = yes &&
1730 test $ac_cv_header_ssl_h = yes; then
1731 dnl three matches
Alex Deymo486467e2017-12-19 19:04:07 +01001732 ssl_msg="OpenSSL"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001733 OPENSSL_ENABLED=1
1734 fi
1735 fi
1736 fi
1737
Alex Deymo486467e2017-12-19 19:04:07 +01001738 if test X"$OPENSSL_ENABLED" != X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001739 LIBS="$CLEANLIBS"
1740 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001741
1742 if test X"$OPT_SSL" != Xoff &&
1743 test "$OPENSSL_ENABLED" != "1"; then
1744 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1745 fi
1746 fi
1747
1748 if test X"$OPENSSL_ENABLED" = X"1"; then
1749 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1750 dnl stuff, it is kind of "separated" from the main SSL check
1751 AC_CHECK_FUNC(ENGINE_init,
1752 [
1753 AC_CHECK_HEADERS(openssl/engine.h)
1754 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1755 ])
1756
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001757 dnl These can only exist if OpenSSL exists
1758 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1759 dnl SSL_get_shutdown (but this check won't actually detect it there
1760 dnl as it's a macro that needs the header files be included)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001761
Elliott Hughescee03382017-06-23 12:17:18 -07001762 AC_CHECK_FUNCS( RAND_egd \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001763 ENGINE_cleanup \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001764 SSL_get_shutdown \
Alex Deymod15eaac2016-06-28 14:49:26 -07001765 SSLv2_client_method )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001766
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001767 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001768 AC_COMPILE_IFELSE([
Alex Deymod15eaac2016-06-28 14:49:26 -07001769 AC_LANG_PROGRAM([[
1770 #include <openssl/base.h>
1771 ]],[[
1772 #ifndef OPENSSL_IS_BORINGSSL
1773 #error not boringssl
1774 #endif
1775 ]])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001776 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001777 AC_MSG_RESULT([yes])
1778 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1779 [Define to 1 if using BoringSSL.])
Alex Deymo486467e2017-12-19 19:04:07 +01001780 ssl_msg="BoringSSL"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001781 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001782 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001783 ])
1784
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001785 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001786 AC_COMPILE_IFELSE([
1787 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001788#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001789 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001790 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001791 ]])
1792 ],[
1793 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001794 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1795 [Define to 1 if using libressl.])
Alex Deymo486467e2017-12-19 19:04:07 +01001796 ssl_msg="libressl"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001797 ],[
1798 AC_MSG_RESULT([no])
1799 ])
1800 fi
1801
1802 if test "$OPENSSL_ENABLED" = "1"; then
1803 if test -n "$LIB_OPENSSL"; then
1804 dnl when the ssl shared libs were found in a path that the run-time
1805 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1806 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001807 if test "x$cross_compiling" != "xyes"; then
1808 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1809 export LD_LIBRARY_PATH
1810 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1811 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001812 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001813 CURL_CHECK_OPENSSL_API
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001814 fi
1815
Alex Deymo486467e2017-12-19 19:04:07 +01001816 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001817fi
1818
1819dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001820dnl Check for the random seed preferences
1821dnl **********************************************************************
1822
1823if test X"$OPENSSL_ENABLED" = X"1"; then
1824 AC_ARG_WITH(egd-socket,
1825 AC_HELP_STRING([--with-egd-socket=FILE],
1826 [Entropy Gathering Daemon socket pathname]),
1827 [ EGD_SOCKET="$withval" ]
1828 )
1829 if test -n "$EGD_SOCKET" ; then
1830 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1831 [your Entropy Gathering Daemon socket pathname] )
1832 fi
1833
1834 dnl Check for user-specified random device
1835 AC_ARG_WITH(random,
1836 AC_HELP_STRING([--with-random=FILE],
1837 [read randomness from FILE (default=/dev/urandom)]),
1838 [ RANDOM_FILE="$withval" ],
1839 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001840 if test x$cross_compiling != xyes; then
1841 dnl Check for random device
1842 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1843 else
1844 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1845 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001846 ]
1847 )
1848 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1849 AC_SUBST(RANDOM_FILE)
1850 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1851 [a suitable file to read random data from])
1852 fi
1853fi
1854
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001855dnl ---
1856dnl We require OpenSSL with SRP support.
1857dnl ---
1858if test "$OPENSSL_ENABLED" = "1"; then
1859 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1860 [
1861 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1862 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1863 ])
1864fi
1865
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001866dnl ----------------------------------------------------
1867dnl check for GnuTLS
1868dnl ----------------------------------------------------
1869
1870dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1871OPT_GNUTLS=no
1872
1873AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001874AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001875AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1876 OPT_GNUTLS=$withval)
1877
Alex Deymo486467e2017-12-19 19:04:07 +01001878if test -z "$ssl_backends" -o "x$OPT_GNUTLS" != xno; then
1879 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001880
1881 if test X"$OPT_GNUTLS" != Xno; then
1882
1883 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001884 addlib=""
1885 gtlslib=""
1886 version=""
1887 addcflags=""
1888
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001889 if test "x$OPT_GNUTLS" = "xyes"; then
1890 dnl this is with no partiular path given
1891 CURL_CHECK_PKGCONFIG(gnutls)
1892
1893 if test "$PKGCONFIG" != "no" ; then
1894 addlib=`$PKGCONFIG --libs-only-l gnutls`
1895 addld=`$PKGCONFIG --libs-only-L gnutls`
1896 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1897 version=`$PKGCONFIG --modversion gnutls`
1898 gtlslib=`echo $addld | $SED -e 's/-L//'`
1899 else
1900 dnl without pkg-config, we try libgnutls-config as that was how it
1901 dnl used to be done
1902 check=`libgnutls-config --version 2>/dev/null`
1903 if test -n "$check"; then
1904 addlib=`libgnutls-config --libs`
1905 addcflags=`libgnutls-config --cflags`
1906 version=`libgnutls-config --version`
1907 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1908 fi
1909 fi
1910 else
1911 dnl this is with a given path, first check if there's a libgnutls-config
1912 dnl there and if not, make an educated guess
1913 cfg=$OPT_GNUTLS/bin/libgnutls-config
1914 check=`$cfg --version 2>/dev/null`
1915 if test -n "$check"; then
1916 addlib=`$cfg --libs`
1917 addcflags=`$cfg --cflags`
1918 version=`$cfg --version`
1919 gtlslib=`$cfg --prefix`/lib$libsuff
1920 else
1921 dnl without pkg-config and libgnutls-config, we guess a lot!
1922 addlib=-lgnutls
1923 addld=-L$OPT_GNUTLS/lib$libsuff
1924 addcflags=-I$OPT_GNUTLS/include
1925 version="" # we just don't know
1926 gtlslib=$OPT_GNUTLS/lib$libsuff
1927 fi
1928 fi
1929
1930 if test -z "$version"; then
1931 dnl lots of efforts, still no go
1932 version="unknown"
1933 fi
1934
1935 if test -n "$addlib"; then
1936
1937 CLEANLIBS="$LIBS"
1938 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001939 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001940
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001941 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001942 LDFLAGS="$LDFLAGS $addld"
1943 if test "$addcflags" != "-I/usr/include"; then
1944 CPPFLAGS="$CPPFLAGS $addcflags"
1945 fi
1946
1947 AC_CHECK_LIB(gnutls, gnutls_check_version,
1948 [
1949 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1950 AC_SUBST(USE_GNUTLS, [1])
1951 GNUTLS_ENABLED=1
1952 USE_GNUTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01001953 ssl_msg="GnuTLS"
1954 test gnutls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001955 ],
1956 [
1957 LIBS="$CLEANLIBS"
1958 CPPFLAGS="$CLEANCPPFLAGS"
1959 ])
1960
1961 if test "x$USE_GNUTLS" = "xyes"; then
1962 AC_MSG_NOTICE([detected GnuTLS version $version])
1963
1964 if test -n "$gtlslib"; then
1965 dnl when shared libs were found in a path that the run-time
1966 dnl linker doesn't search through, we need to add it to
1967 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1968 dnl due to this
Alex Deymo486467e2017-12-19 19:04:07 +01001969 if test "x$cross_compiling" != "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001970 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1971 export LD_LIBRARY_PATH
1972 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1973 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001974 fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07001975 AC_CHECK_FUNCS([gnutls_certificate_set_x509_key_file2 gnutls_alpn_set_protocols gnutls_ocsp_req_init])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001976 fi
1977
1978 fi
1979
1980 fi dnl GNUTLS not disabled
1981
Alex Deymo486467e2017-12-19 19:04:07 +01001982 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001983fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001984
1985dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001986dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001987dnl ---
1988
1989if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001990 USE_GNUTLS_NETTLE=
1991 # First check if we can detect either crypto library via transitive linking
1992 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1993 if test "$USE_GNUTLS_NETTLE" = ""; then
1994 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1995 fi
1996 # If not, try linking directly to both of them to see if they are available
1997 if test "$USE_GNUTLS_NETTLE" = ""; then
1998 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1999 fi
2000 if test "$USE_GNUTLS_NETTLE" = ""; then
2001 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
2002 fi
2003 if test "$USE_GNUTLS_NETTLE" = ""; then
2004 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
2005 fi
2006 if test "$USE_GNUTLS_NETTLE" = "1"; then
2007 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
2008 AC_SUBST(USE_GNUTLS_NETTLE, [1])
2009 LIBS="-lnettle $LIBS"
2010 else
2011 LIBS="-lgcrypt $LIBS"
2012 fi
2013fi
2014
2015dnl ---
2016dnl We require GnuTLS with SRP support.
2017dnl ---
2018if test "$GNUTLS_ENABLED" = "1"; then
2019 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
2020 [
2021 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
2022 AC_SUBST(HAVE_GNUTLS_SRP, [1])
2023 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002024fi
2025
2026dnl ----------------------------------------------------
2027dnl check for PolarSSL
2028dnl ----------------------------------------------------
2029
2030dnl Default to compiler & linker defaults for PolarSSL files & libraries.
2031OPT_POLARSSL=no
2032
2033_cppflags=$CPPFLAGS
2034_ldflags=$LDFLAGS
2035AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002036AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002037AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
2038 OPT_POLARSSL=$withval)
2039
Alex Deymo486467e2017-12-19 19:04:07 +01002040if test -z "$ssl_backends" -o "x$OPT_POLARSSL" != xno; then
2041 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002042
2043 if test X"$OPT_POLARSSL" != Xno; then
2044
2045 if test "$OPT_POLARSSL" = "yes"; then
2046 OPT_POLARSSL=""
2047 fi
2048
2049 if test -z "$OPT_POLARSSL" ; then
2050 dnl check for lib first without setting any new path
2051
2052 AC_CHECK_LIB(polarssl, havege_init,
2053 dnl libpolarssl found, set the variable
2054 [
2055 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2056 AC_SUBST(USE_POLARSSL, [1])
2057 POLARSSL_ENABLED=1
2058 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002059 ssl_msg="PolarSSL"
2060 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002061 ])
2062 fi
2063
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002064 addld=""
2065 addlib=""
2066 addcflags=""
2067 polarssllib=""
2068
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002069 if test "x$USE_POLARSSL" != "xyes"; then
2070 dnl add the path and test again
2071 addld=-L$OPT_POLARSSL/lib$libsuff
2072 addcflags=-I$OPT_POLARSSL/include
2073 polarssllib=$OPT_POLARSSL/lib$libsuff
2074
2075 LDFLAGS="$LDFLAGS $addld"
2076 if test "$addcflags" != "-I/usr/include"; then
2077 CPPFLAGS="$CPPFLAGS $addcflags"
2078 fi
2079
2080 AC_CHECK_LIB(polarssl, ssl_init,
2081 [
2082 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
2083 AC_SUBST(USE_POLARSSL, [1])
2084 POLARSSL_ENABLED=1
2085 USE_POLARSSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002086 ssl_msg="PolarSSL"
2087 test polarssl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002088 ],
2089 [
2090 CPPFLAGS=$_cppflags
2091 LDFLAGS=$_ldflags
2092 ])
2093 fi
2094
2095 if test "x$USE_POLARSSL" = "xyes"; then
2096 AC_MSG_NOTICE([detected PolarSSL])
2097
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002098 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002099
2100 if test -n "$polarssllib"; then
2101 dnl when shared libs were found in a path that the run-time
2102 dnl linker doesn't search through, we need to add it to
2103 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2104 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002105 if test "x$cross_compiling" != "xyes"; then
2106 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
2107 export LD_LIBRARY_PATH
2108 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
2109 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002110 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002111 fi
2112
2113 fi dnl PolarSSL not disabled
2114
Alex Deymo486467e2017-12-19 19:04:07 +01002115 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002116fi
2117
2118dnl ----------------------------------------------------
Alex Deymod15eaac2016-06-28 14:49:26 -07002119dnl check for mbedTLS
2120dnl ----------------------------------------------------
2121
2122OPT_MBEDTLS=no
2123
2124_cppflags=$CPPFLAGS
2125_ldflags=$LDFLAGS
2126AC_ARG_WITH(mbedtls,dnl
2127AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
2128AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
2129 OPT_MBEDTLS=$withval)
2130
Alex Deymo486467e2017-12-19 19:04:07 +01002131if test -z "$ssl_backends" -o "x$OPT_MBEDTLS" != xno; then
2132 ssl_msg=
Alex Deymod15eaac2016-06-28 14:49:26 -07002133
2134 if test X"$OPT_MBEDTLS" != Xno; then
2135
2136 if test "$OPT_MBEDTLS" = "yes"; then
2137 OPT_MBEDTLS=""
2138 fi
2139
2140 if test -z "$OPT_MBEDTLS" ; then
2141 dnl check for lib first without setting any new path
2142
2143 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
2144 dnl libmbedtls found, set the variable
2145 [
2146 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2147 AC_SUBST(USE_MBEDTLS, [1])
2148 MBEDTLS_ENABLED=1
2149 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002150 ssl_msg="mbedTLS"
2151 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002152 ], [], -lmbedx509 -lmbedcrypto)
2153 fi
2154
2155 addld=""
2156 addlib=""
2157 addcflags=""
2158 mbedtlslib=""
2159
2160 if test "x$USE_MBEDTLS" != "xyes"; then
2161 dnl add the path and test again
2162 addld=-L$OPT_MBEDTLS/lib$libsuff
2163 addcflags=-I$OPT_MBEDTLS/include
2164 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2165
2166 LDFLAGS="$LDFLAGS $addld"
2167 if test "$addcflags" != "-I/usr/include"; then
2168 CPPFLAGS="$CPPFLAGS $addcflags"
2169 fi
2170
2171 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2172 [
2173 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2174 AC_SUBST(USE_MBEDTLS, [1])
2175 MBEDTLS_ENABLED=1
2176 USE_MBEDTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002177 ssl_msg="mbedTLS"
2178 test mbedtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Alex Deymod15eaac2016-06-28 14:49:26 -07002179 ],
2180 [
2181 CPPFLAGS=$_cppflags
2182 LDFLAGS=$_ldflags
2183 ], -lmbedx509 -lmbedcrypto)
2184 fi
2185
2186 if test "x$USE_MBEDTLS" = "xyes"; then
2187 AC_MSG_NOTICE([detected mbedTLS])
2188
2189 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2190
2191 if test -n "$mbedtlslib"; then
2192 dnl when shared libs were found in a path that the run-time
2193 dnl linker doesn't search through, we need to add it to
2194 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2195 dnl due to this
2196 if test "x$cross_compiling" != "xyes"; then
2197 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib"
2198 export LD_LIBRARY_PATH
2199 AC_MSG_NOTICE([Added $mbedtlslib to LD_LIBRARY_PATH])
2200 fi
2201 fi
2202 fi
2203
2204 fi dnl mbedTLS not disabled
2205
Alex Deymo486467e2017-12-19 19:04:07 +01002206 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Alex Deymod15eaac2016-06-28 14:49:26 -07002207fi
2208
2209dnl ----------------------------------------------------
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002210dnl check for CyaSSL
2211dnl ----------------------------------------------------
2212
2213dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2214OPT_CYASSL=no
2215
2216_cppflags=$CPPFLAGS
2217_ldflags=$LDFLAGS
2218AC_ARG_WITH(cyassl,dnl
2219AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2220AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2221 OPT_CYASSL=$withval)
2222
Alex Deymo486467e2017-12-19 19:04:07 +01002223if test -z "$ssl_backends" -o "x$OPT_CYASSL" != xno; then
2224 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002225
2226 if test X"$OPT_CYASSL" != Xno; then
2227
2228 if test "$OPT_CYASSL" = "yes"; then
2229 OPT_CYASSL=""
2230 fi
2231
2232 dnl This should be reworked to use pkg-config instead
2233
2234 cyassllibname=cyassl
2235
2236 if test -z "$OPT_CYASSL" ; then
2237 dnl check for lib in system default first
2238
2239 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2240 dnl libcyassl found, set the variable
2241 [
2242 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2243 AC_SUBST(USE_CYASSL, [1])
2244 CYASSL_ENABLED=1
2245 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002246 ssl_msg="CyaSSL"
2247 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002248 ])
2249 fi
2250
2251 addld=""
2252 addlib=""
2253 addcflags=""
2254 cyassllib=""
2255
2256 if test "x$USE_CYASSL" != "xyes"; then
2257 dnl add the path and test again
2258 addld=-L$OPT_CYASSL/lib$libsuff
2259 addcflags=-I$OPT_CYASSL/include
2260 cyassllib=$OPT_CYASSL/lib$libsuff
2261
2262 LDFLAGS="$LDFLAGS $addld"
2263 if test "$addcflags" != "-I/usr/include"; then
2264 CPPFLAGS="$CPPFLAGS $addcflags"
2265 fi
2266
2267 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2268 [
2269 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2270 AC_SUBST(USE_CYASSL, [1])
2271 CYASSL_ENABLED=1
2272 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002273 ssl_msg="CyaSSL"
2274 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002275 ],
2276 [
2277 CPPFLAGS=$_cppflags
2278 LDFLAGS=$_ldflags
2279 cyassllib=""
2280 ])
2281 fi
2282
2283 addld=""
2284 addlib=""
2285 addcflags=""
2286
2287 if test "x$USE_CYASSL" != "xyes"; then
2288 dnl libcyassl renamed to libwolfssl as of 3.4.0
2289 addld=-L$OPT_CYASSL/lib$libsuff
2290 addcflags=-I$OPT_CYASSL/include
2291 cyassllib=$OPT_CYASSL/lib$libsuff
2292
2293 LDFLAGS="$LDFLAGS $addld"
2294 if test "$addcflags" != "-I/usr/include"; then
2295 CPPFLAGS="$CPPFLAGS $addcflags"
2296 fi
2297
2298 cyassllibname=wolfssl
2299 my_ac_save_LIBS="$LIBS"
2300 LIBS="-l$cyassllibname -lm $LIBS"
2301
2302 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2303 AC_LINK_IFELSE([
2304 AC_LANG_PROGRAM([[
2305/* These aren't needed for detection and confuse WolfSSL.
2306 They are set up properly later if it is detected. */
2307#undef SIZEOF_LONG
2308#undef SIZEOF_LONG_LONG
2309#include <cyassl/ssl.h>
2310 ]],[[
2311 return CyaSSL_Init();
2312 ]])
2313 ],[
2314 AC_MSG_RESULT(yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07002315 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002316 AC_SUBST(USE_CYASSL, [1])
2317 CYASSL_ENABLED=1
2318 USE_CYASSL="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002319 ssl_msg="WolfSSL"
2320 test cyassl != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002321 ],
2322 [
2323 AC_MSG_RESULT(no)
2324 CPPFLAGS=$_cppflags
2325 LDFLAGS=$_ldflags
2326 cyassllib=""
2327 ])
2328 LIBS="$my_ac_save_LIBS"
2329 fi
2330
2331 if test "x$USE_CYASSL" = "xyes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07002332 AC_MSG_NOTICE([detected $cyassllibname])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002333
2334 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2335 AC_CHECK_SIZEOF(long long)
2336
2337 dnl Versions since at least 2.6.0 may have options.h
2338 AC_CHECK_HEADERS(cyassl/options.h)
2339
2340 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2341 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2342
2343 LIBS="-l$cyassllibname -lm $LIBS"
2344
Alex Deymod15eaac2016-06-28 14:49:26 -07002345 if test "x$cyassllibname" = "xwolfssl"; then
2346 dnl Recent WolfSSL versions build without SSLv3 by default
2347 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2348 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2349 wolfSSL_CTX_UseSupportedCurve \
2350 wolfSSL_get_peer_certificate \
2351 wolfSSL_UseALPN)
2352 else
2353 dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2354 AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2355 CyaSSL_get_peer_certificate)
2356 fi
2357
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002358 if test -n "$cyassllib"; then
2359 dnl when shared libs were found in a path that the run-time
2360 dnl linker doesn't search through, we need to add it to
2361 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2362 dnl due to this
2363 if test "x$cross_compiling" != "xyes"; then
2364 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
2365 export LD_LIBRARY_PATH
2366 AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
2367 fi
2368 fi
2369
2370 fi
2371
2372 fi dnl CyaSSL not disabled
2373
Alex Deymo486467e2017-12-19 19:04:07 +01002374 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002375fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002376
2377dnl ----------------------------------------------------
2378dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2379dnl ----------------------------------------------------
2380
2381dnl Default to compiler & linker defaults for NSS files & libraries.
2382OPT_NSS=no
2383
2384AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002385AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002386AC_HELP_STRING([--without-nss], [disable NSS detection]),
2387 OPT_NSS=$withval)
2388
Alex Deymo486467e2017-12-19 19:04:07 +01002389if test -z "$ssl_backends" -o "x$OPT_NSS" != xno; then
2390 ssl_msg=
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002391
2392 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002393
2394 addld=""
2395 addlib=""
2396 addcflags=""
2397 nssprefix=""
2398 version=""
2399
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002400 if test "x$OPT_NSS" = "xyes"; then
2401
2402 CURL_CHECK_PKGCONFIG(nss)
2403
2404 if test "$PKGCONFIG" != "no" ; then
2405 addlib=`$PKGCONFIG --libs nss`
2406 addcflags=`$PKGCONFIG --cflags nss`
2407 version=`$PKGCONFIG --modversion nss`
2408 nssprefix=`$PKGCONFIG --variable=prefix nss`
2409 else
2410 dnl Without pkg-config, we check for nss-config
2411
2412 check=`nss-config --version 2>/dev/null`
2413 if test -n "$check"; then
2414 addlib=`nss-config --libs`
2415 addcflags=`nss-config --cflags`
2416 version=`nss-config --version`
2417 nssprefix=`nss-config --prefix`
2418 else
2419 addlib="-lnss3"
2420 addcflags=""
2421 version="unknown"
2422 fi
2423 fi
2424 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002425 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2426 if test -f "$NSS_PCDIR/nss.pc"; then
2427 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2428 if test "$PKGCONFIG" != "no" ; then
2429 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2430 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2431 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2432 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2433 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2434 fi
2435 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002436 fi
2437
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002438 if test -z "$addlib"; then
2439 # Without pkg-config, we'll kludge in some defaults
2440 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2441 addld="-L$OPT_NSS/lib"
2442 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2443 addcflags="-I$OPT_NSS/include"
2444 version="unknown"
2445 nssprefix=$OPT_NSS
2446 fi
2447
2448 CLEANLDFLAGS="$LDFLAGS"
2449 CLEANLIBS="$LIBS"
2450 CLEANCPPFLAGS="$CPPFLAGS"
2451
2452 LDFLAGS="$addld $LDFLAGS"
2453 LIBS="$addlib $LIBS"
2454 if test "$addcflags" != "-I/usr/include"; then
2455 CPPFLAGS="$CPPFLAGS $addcflags"
2456 fi
2457
2458 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2459 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002460 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002461 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2462 AC_SUBST(USE_NSS, [1])
2463 USE_NSS="yes"
2464 NSS_ENABLED=1
Alex Deymo486467e2017-12-19 19:04:07 +01002465 ssl_msg="NSS"
2466 test nss != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002467 ],
2468 [
2469 LDFLAGS="$CLEANLDFLAGS"
2470 LIBS="$CLEANLIBS"
2471 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002472 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002473
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002474 if test "x$USE_NSS" = "xyes"; then
2475 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002476
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002477 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2478 NSS_LIBS=$addlib
2479 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002480
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002481 dnl when shared libs were found in a path that the run-time
2482 dnl linker doesn't search through, we need to add it to
2483 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2484 dnl due to this
2485 if test "x$cross_compiling" != "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002486 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2487 export LD_LIBRARY_PATH
2488 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2489 fi
2490
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002491 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002492
2493 fi dnl NSS not disabled
2494
Alex Deymo486467e2017-12-19 19:04:07 +01002495 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
2496fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002497
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002498OPT_AXTLS=off
2499
2500AC_ARG_WITH(axtls,dnl
2501AC_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.])
2502AC_HELP_STRING([--without-axtls], [disable axTLS]),
2503 OPT_AXTLS=$withval)
2504
Alex Deymo486467e2017-12-19 19:04:07 +01002505if test -z "$ssl_backends" -o "x$OPT_AXTLS" != xno; then
2506 ssl_msg=
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002507 if test X"$OPT_AXTLS" != Xno; then
2508 dnl backup the pre-axtls variables
2509 CLEANLDFLAGS="$LDFLAGS"
2510 CLEANCPPFLAGS="$CPPFLAGS"
2511 CLEANLIBS="$LIBS"
2512
2513 case "$OPT_AXTLS" in
2514 yes)
2515 dnl --with-axtls (without path) used
2516 PREFIX_AXTLS=/usr/local
2517 LIB_AXTLS="$PREFIX_AXTLS/lib"
2518 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2519 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2520 ;;
2521 off)
2522 dnl no --with-axtls option given, just check default places
2523 PREFIX_AXTLS=
2524 ;;
2525 *)
2526 dnl check the given --with-axtls spot
2527 PREFIX_AXTLS=$OPT_AXTLS
2528 LIB_AXTLS="$PREFIX_AXTLS/lib"
2529 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2530 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2531 ;;
2532 esac
2533
2534 AC_CHECK_LIB(axtls, ssl_version,[
2535 LIBS="-laxtls $LIBS"
2536 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2537 AC_SUBST(USE_AXTLS, [1])
2538 AXTLS_ENABLED=1
2539 USE_AXTLS="yes"
Alex Deymo486467e2017-12-19 19:04:07 +01002540 ssl_msg="axTLS"
2541 test axtls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002542
2543 if test "x$cross_compiling" != "xyes"; then
2544 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2545 export LD_LIBRARY_PATH
2546 AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2547 fi
2548 ],[
2549 LDFLAGS="$CLEANLDFLAGS"
2550 CPPFLAGS="$CLEANCPPFLAGS"
2551 LIBS="$CLEANLIBS"
2552 ])
2553 fi
Alex Deymo486467e2017-12-19 19:04:07 +01002554 test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002555fi
2556
Alex Deymo486467e2017-12-19 19:04:07 +01002557case "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" in
2558x)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002559 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002560 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 +01002561 ;;
2562x1)
2563 # one SSL backend is enabled
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002564 AC_SUBST(SSL_ENABLED)
2565 SSL_ENABLED="1"
Alex Deymo486467e2017-12-19 19:04:07 +01002566 AC_MSG_NOTICE([built with one SSL backend])
2567 ;;
2568*)
2569 # more than one SSL backend is enabled
2570 AC_SUBST(SSL_ENABLED)
2571 SSL_ENABLED="1"
2572 AC_SUBST(CURL_WITH_MULTI_SSL)
2573 CURL_WITH_MULTI_SSL="1"
2574 AC_DEFINE(CURL_WITH_MULTI_SSL, 1, [built with multiple SSL backends])
2575 AC_MSG_NOTICE([built with multiple SSL backends])
2576 ;;
2577esac
2578
2579if test -n "$ssl_backends"; then
2580 curl_ssl_msg="enabled ($ssl_backends)"
2581fi
2582
2583if test no = "$VALID_DEFAULT_SSL_BACKEND"
2584then
2585 if test -n "$SSL_ENABLED"
2586 then
2587 AC_MSG_ERROR([Default SSL backend $DEFAULT_SSL_BACKEND not enabled!])
2588 else
2589 AC_MSG_ERROR([Default SSL backend requires SSL!])
2590 fi
2591elif test yes = "$VALID_DEFAULT_SSL_BACKEND"
2592then
2593 AC_DEFINE_UNQUOTED([CURL_DEFAULT_SSL_BACKEND], ["$DEFAULT_SSL_BACKEND"], [Default SSL backend])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002594fi
2595
2596dnl **********************************************************************
2597dnl Check for the CA bundle
2598dnl **********************************************************************
2599
2600CURL_CHECK_CA_BUNDLE
2601
2602dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002603dnl Check for libpsl
2604dnl **********************************************************************
2605
2606AC_ARG_WITH(libpsl,
2607 AS_HELP_STRING([--without-libpsl],
2608 [disable support for libpsl cookie checking]),
2609 with_libpsl=$withval,
2610 with_libpsl=yes)
2611if test $with_libpsl != "no"; then
2612 AC_SEARCH_LIBS(psl_builtin, psl,
2613 [curl_psl_msg="yes";
2614 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2615 ],
2616 [curl_psl_msg="no (libpsl not found)";
2617 AC_MSG_WARN([libpsl was not found])
2618 ]
2619 )
2620fi
2621AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2622
2623dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002624dnl Check for libmetalink
2625dnl **********************************************************************
2626
2627OPT_LIBMETALINK=no
2628
2629AC_ARG_WITH(libmetalink,dnl
2630AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2631AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2632 OPT_LIBMETALINK=$withval)
2633
2634if test X"$OPT_LIBMETALINK" != Xno; then
2635
2636 addld=""
2637 addlib=""
2638 addcflags=""
2639 version=""
2640 libmetalinklib=""
2641
2642 PKGTEST="no"
2643 if test "x$OPT_LIBMETALINK" = "xyes"; then
2644 dnl this is with no partiular path given
2645 PKGTEST="yes"
2646 CURL_CHECK_PKGCONFIG(libmetalink)
2647 else
2648 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2649 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2650 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2651 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2652 PKGTEST="yes"
2653 fi
2654 if test "$PKGTEST" = "yes"; then
2655 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2656 fi
2657 fi
2658 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2659 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2660 $PKGCONFIG --libs-only-l libmetalink`
2661 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2662 $PKGCONFIG --libs-only-L libmetalink`
2663 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2664 $PKGCONFIG --cflags-only-I libmetalink`
2665 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2666 $PKGCONFIG --modversion libmetalink`
2667 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2668 fi
2669 if test -n "$addlib"; then
2670
2671 clean_CPPFLAGS="$CPPFLAGS"
2672 clean_LDFLAGS="$LDFLAGS"
2673 clean_LIBS="$LIBS"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002674 CPPFLAGS="$clean_CPPFLAGS $addcflags"
2675 LDFLAGS="$clean_LDFLAGS $addld"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002676 LIBS="$addlib $clean_LIBS"
2677 AC_MSG_CHECKING([if libmetalink is recent enough])
2678 AC_LINK_IFELSE([
2679 AC_LANG_PROGRAM([[
2680# include <metalink/metalink.h>
2681 ]],[[
2682 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2683 return 1;
2684 ]])
2685 ],[
2686 AC_MSG_RESULT([yes ($version)])
2687 want_metalink="yes"
2688 ],[
2689 AC_MSG_RESULT([no ($version)])
2690 AC_MSG_NOTICE([libmetalink library defective or too old])
2691 want_metalink="no"
2692 ])
2693 CPPFLAGS="$clean_CPPFLAGS"
2694 LDFLAGS="$clean_LDFLAGS"
2695 LIBS="$clean_LIBS"
2696 if test "$want_metalink" = "yes"; then
2697 dnl finally libmetalink will be used
2698 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2699 LIBMETALINK_LIBS=$addlib
2700 LIBMETALINK_LDFLAGS=$addld
2701 LIBMETALINK_CPPFLAGS=$addcflags
2702 AC_SUBST([LIBMETALINK_LIBS])
2703 AC_SUBST([LIBMETALINK_LDFLAGS])
2704 AC_SUBST([LIBMETALINK_CPPFLAGS])
2705 curl_mtlnk_msg="enabled"
2706 fi
2707
2708 fi
2709fi
2710
2711dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002712dnl Check for the presence of LIBSSH2 libraries and headers
2713dnl **********************************************************************
2714
2715dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2716OPT_LIBSSH2=off
2717AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002718AC_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])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002719AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2720 OPT_LIBSSH2=$withval)
2721
2722if test X"$OPT_LIBSSH2" != Xno; then
2723 dnl backup the pre-libssh2 variables
2724 CLEANLDFLAGS="$LDFLAGS"
2725 CLEANCPPFLAGS="$CPPFLAGS"
2726 CLEANLIBS="$LIBS"
2727
2728 case "$OPT_LIBSSH2" in
2729 yes)
2730 dnl --with-libssh2 (without path) used
2731 CURL_CHECK_PKGCONFIG(libssh2)
2732
2733 if test "$PKGCONFIG" != "no" ; then
2734 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2735 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2736 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2737 version=`$PKGCONFIG --modversion libssh2`
2738 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2739 fi
2740
2741 ;;
2742 off)
2743 dnl no --with-libssh2 option given, just check default places
2744 ;;
2745 *)
2746 dnl use the given --with-libssh2 spot
2747 PREFIX_SSH2=$OPT_LIBSSH2
2748 ;;
2749 esac
2750
2751 dnl if given with a prefix, we set -L and -I based on that
2752 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002753 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002754 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2755 CPP_SSH2=-I${PREFIX_SSH2}/include
2756 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2757 fi
2758
Elliott Hughes82be86d2017-09-20 17:00:17 -07002759 LDFLAGS="$LDFLAGS $LD_SSH2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002760 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002761 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002762
2763 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2764
2765 AC_CHECK_HEADERS(libssh2.h,
2766 curl_ssh_msg="enabled (libSSH2)"
2767 LIBSSH2_ENABLED=1
2768 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2769 AC_SUBST(USE_LIBSSH2, [1])
2770 )
2771
2772 if test X"$OPT_LIBSSH2" != Xoff &&
2773 test "$LIBSSH2_ENABLED" != "1"; then
2774 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2775 fi
2776
2777 if test "$LIBSSH2_ENABLED" = "1"; then
2778 if test -n "$DIR_SSH2"; then
2779 dnl when the libssh2 shared libs were found in a path that the run-time
2780 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2781 dnl to prevent further configure tests to fail due to this
2782
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002783 if test "x$cross_compiling" != "xyes"; then
2784 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2785 export LD_LIBRARY_PATH
2786 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2787 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002788 fi
2789 else
2790 dnl no libssh2, revert back to clean variables
2791 LDFLAGS=$CLEANLDFLAGS
2792 CPPFLAGS=$CLEANCPPFLAGS
2793 LIBS=$CLEANLIBS
2794 fi
2795fi
2796
2797dnl **********************************************************************
2798dnl Check for the presence of LIBRTMP libraries and headers
2799dnl **********************************************************************
2800
2801dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2802OPT_LIBRTMP=off
2803AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002804AC_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 -07002805AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2806 OPT_LIBRTMP=$withval)
2807
2808if test X"$OPT_LIBRTMP" != Xno; then
2809 dnl backup the pre-librtmp variables
2810 CLEANLDFLAGS="$LDFLAGS"
2811 CLEANCPPFLAGS="$CPPFLAGS"
2812 CLEANLIBS="$LIBS"
2813
2814 case "$OPT_LIBRTMP" in
2815 yes)
2816 dnl --with-librtmp (without path) used
2817 CURL_CHECK_PKGCONFIG(librtmp)
2818
2819 if test "$PKGCONFIG" != "no" ; then
2820 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2821 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2822 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2823 version=`$PKGCONFIG --modversion librtmp`
2824 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002825 else
2826 dnl To avoid link errors, we do not allow --librtmp without
2827 dnl a pkgconfig file
2828 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002829 fi
2830
2831 ;;
2832 off)
2833 dnl no --with-librtmp option given, just check default places
2834 LIB_RTMP="-lrtmp"
2835 ;;
2836 *)
2837 dnl use the given --with-librtmp spot
Elliott Hughes82be86d2017-09-20 17:00:17 -07002838 LIB_RTMP="-lrtmp"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002839 PREFIX_RTMP=$OPT_LIBRTMP
2840 ;;
2841 esac
2842
2843 dnl if given with a prefix, we set -L and -I based on that
2844 if test -n "$PREFIX_RTMP"; then
2845 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2846 CPP_RTMP=-I${PREFIX_RTMP}/include
2847 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2848 fi
2849
2850 LDFLAGS="$LDFLAGS $LD_RTMP"
2851 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002852 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002853
2854 AC_CHECK_LIB(rtmp, RTMP_Init,
2855 [
2856 AC_CHECK_HEADERS(librtmp/rtmp.h,
2857 curl_rtmp_msg="enabled (librtmp)"
2858 LIBRTMP_ENABLED=1
2859 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2860 AC_SUBST(USE_LIBRTMP, [1])
2861 )
2862 ],
2863 dnl not found, revert back to clean variables
2864 LDFLAGS=$CLEANLDFLAGS
2865 CPPFLAGS=$CLEANCPPFLAGS
2866 LIBS=$CLEANLIBS
2867 )
2868
2869 if test X"$OPT_LIBRTMP" != Xoff &&
2870 test "$LIBRTMP_ENABLED" != "1"; then
2871 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2872 fi
2873
2874fi
2875
2876dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002877dnl Check for linker switch for versioned symbols
2878dnl **********************************************************************
2879
2880versioned_symbols_flavour=
2881AC_MSG_CHECKING([whether versioned symbols are wanted])
2882AC_ARG_ENABLE(versioned-symbols,
2883AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2884AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2885[ case "$enableval" in
2886 yes) AC_MSG_RESULT(yes)
2887 AC_MSG_CHECKING([if libraries can be versioned])
2888 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2889 if test -z "$GLD"; then
2890 AC_MSG_RESULT(no)
2891 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2892 else
2893 AC_MSG_RESULT(yes)
Alex Deymo486467e2017-12-19 19:04:07 +01002894 if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
2895 versioned_symbols_flavour="MULTISSL_"
2896 elif test "x$OPENSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002897 versioned_symbols_flavour="OPENSSL_"
2898 elif test "x$GNUTLS_ENABLED" = "x1"; then
2899 versioned_symbols_flavour="GNUTLS_"
2900 elif test "x$NSS_ENABLED" = "x1"; then
2901 versioned_symbols_flavour="NSS_"
2902 elif test "x$POLARSSL_ENABLED" = "x1"; then
2903 versioned_symbols_flavour="POLARSSL_"
2904 elif test "x$CYASSL_ENABLED" = "x1"; then
2905 versioned_symbols_flavour="CYASSL_"
2906 elif test "x$AXTLS_ENABLED" = "x1"; then
2907 versioned_symbols_flavour="AXTLS_"
2908 elif test "x$WINSSL_ENABLED" = "x1"; then
2909 versioned_symbols_flavour="WINSSL_"
2910 elif test "x$DARWINSSL_ENABLED" = "x1"; then
2911 versioned_symbols_flavour="DARWINSSL_"
2912 else
2913 versioned_symbols_flavour=""
2914 fi
2915 versioned_symbols="yes"
2916 fi
2917 ;;
2918
2919 *) AC_MSG_RESULT(no)
2920 ;;
2921 esac
2922], [
2923AC_MSG_RESULT(no)
2924]
2925)
2926
2927AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2928 ["$versioned_symbols_flavour"])
2929AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2930 [test "x$versioned_symbols" = 'xyes'])
2931
2932dnl -------------------------------------------------
2933dnl check winidn option before other IDN libraries
2934dnl -------------------------------------------------
2935
2936AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2937OPT_WINIDN="default"
2938AC_ARG_WITH(winidn,
2939AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2940AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
2941 OPT_WINIDN=$withval)
2942case "$OPT_WINIDN" in
2943 no|default)
2944 dnl --without-winidn option used or configure option not specified
2945 want_winidn="no"
2946 AC_MSG_RESULT([no])
2947 ;;
2948 yes)
2949 dnl --with-winidn option used without path
2950 want_winidn="yes"
2951 want_winidn_path="default"
2952 AC_MSG_RESULT([yes])
2953 ;;
2954 *)
2955 dnl --with-winidn option used with path
2956 want_winidn="yes"
2957 want_winidn_path="$withval"
2958 AC_MSG_RESULT([yes ($withval)])
2959 ;;
2960esac
2961
2962if test "$want_winidn" = "yes"; then
2963 dnl winidn library support has been requested
2964 clean_CPPFLAGS="$CPPFLAGS"
2965 clean_LDFLAGS="$LDFLAGS"
2966 clean_LIBS="$LIBS"
2967 WINIDN_LIBS="-lnormaliz"
Elliott Hughes82be86d2017-09-20 17:00:17 -07002968 WINIDN_CPPFLAGS="-DWINVER=0x0600"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002969 #
2970 if test "$want_winidn_path" != "default"; then
2971 dnl path has been specified
2972 dnl pkg-config not available or provides no info
2973 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2974 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2975 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2976 fi
2977 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07002978 CPPFLAGS="$CPPFLAGS $WINIDN_CPPFLAGS"
2979 LDFLAGS="$LDFLAGS $WINIDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002980 LIBS="$WINIDN_LIBS $LIBS"
2981 #
2982 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2983 AC_LINK_IFELSE([
Elliott Hughes82be86d2017-09-20 17:00:17 -07002984 AC_LANG_PROGRAM([[
2985 #include <windows.h>
2986 ]],[[
2987 IdnToUnicode(0, NULL, 0, NULL, 0);
2988 ]])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002989 ],[
2990 AC_MSG_RESULT([yes])
2991 tst_links_winidn="yes"
2992 ],[
2993 AC_MSG_RESULT([no])
2994 tst_links_winidn="no"
2995 ])
2996 #
2997 if test "$tst_links_winidn" = "yes"; then
2998 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2999 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
3000 AC_SUBST([IDN_ENABLED], [1])
3001 curl_idn_msg="enabled (Windows-native)"
3002 else
3003 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3004 CPPFLAGS="$clean_CPPFLAGS"
3005 LDFLAGS="$clean_LDFLAGS"
3006 LIBS="$clean_LIBS"
3007 fi
3008fi
3009
3010dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003011dnl Check for the presence of IDN libraries and headers
3012dnl **********************************************************************
3013
Elliott Hughescee03382017-06-23 12:17:18 -07003014AC_MSG_CHECKING([whether to build with libidn2])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003015OPT_IDN="default"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003016AC_ARG_WITH(libidn2,
Elliott Hughescee03382017-06-23 12:17:18 -07003017AC_HELP_STRING([--with-libidn2=PATH],[Enable libidn2 usage])
3018AC_HELP_STRING([--without-libidn2],[Disable libidn2 usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003019 [OPT_IDN=$withval])
3020case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003021 no)
Elliott Hughescee03382017-06-23 12:17:18 -07003022 dnl --without-libidn2 option used
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003023 want_idn="no"
3024 AC_MSG_RESULT([no])
3025 ;;
3026 default)
3027 dnl configure option not specified
3028 want_idn="yes"
3029 want_idn_path="default"
3030 AC_MSG_RESULT([(assumed) yes])
3031 ;;
3032 yes)
Elliott Hughescee03382017-06-23 12:17:18 -07003033 dnl --with-libidn2 option used without path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003034 want_idn="yes"
3035 want_idn_path="default"
3036 AC_MSG_RESULT([yes])
3037 ;;
3038 *)
Elliott Hughescee03382017-06-23 12:17:18 -07003039 dnl --with-libidn2 option used with path
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003040 want_idn="yes"
3041 want_idn_path="$withval"
3042 AC_MSG_RESULT([yes ($withval)])
3043 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003044esac
3045
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003046if test "$want_idn" = "yes"; then
3047 dnl idn library support has been requested
3048 clean_CPPFLAGS="$CPPFLAGS"
3049 clean_LDFLAGS="$LDFLAGS"
3050 clean_LIBS="$LIBS"
3051 PKGCONFIG="no"
3052 #
3053 if test "$want_idn_path" != "default"; then
3054 dnl path has been specified
3055 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
Elliott Hughescee03382017-06-23 12:17:18 -07003056 CURL_CHECK_PKGCONFIG(libidn2, [$IDN_PCDIR])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003057 if test "$PKGCONFIG" != "no"; then
3058 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003059 $PKGCONFIG --libs-only-l libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003060 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003061 $PKGCONFIG --libs-only-L libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003062 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
Elliott Hughescee03382017-06-23 12:17:18 -07003063 $PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003064 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3065 else
3066 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003067 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003068 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
3069 IDN_CPPFLAGS="-I$want_idn_path/include"
3070 IDN_DIR="$want_idn_path/lib$libsuff"
3071 fi
3072 else
3073 dnl path not specified
Elliott Hughescee03382017-06-23 12:17:18 -07003074 CURL_CHECK_PKGCONFIG(libidn2)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003075 if test "$PKGCONFIG" != "no"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003076 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn2 2>/dev/null`
3077 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn2 2>/dev/null`
3078 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn2 2>/dev/null`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003079 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
3080 else
3081 dnl pkg-config not available or provides no info
Elliott Hughescee03382017-06-23 12:17:18 -07003082 IDN_LIBS="-lidn2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003083 fi
3084 fi
3085 #
3086 if test "$PKGCONFIG" != "no"; then
3087 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
3088 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
3089 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3090 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
3091 else
3092 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
3093 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
3094 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
3095 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
3096 fi
3097 #
Elliott Hughes82be86d2017-09-20 17:00:17 -07003098 CPPFLAGS="$CPPFLAGS $IDN_CPPFLAGS"
3099 LDFLAGS="$LDFLAGS $IDN_LDFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003100 LIBS="$IDN_LIBS $LIBS"
3101 #
Elliott Hughescee03382017-06-23 12:17:18 -07003102 AC_MSG_CHECKING([if idn2_lookup_ul can be linked])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003103 AC_LINK_IFELSE([
Elliott Hughescee03382017-06-23 12:17:18 -07003104 AC_LANG_FUNC_LINK_TRY([idn2_lookup_ul])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003105 ],[
3106 AC_MSG_RESULT([yes])
3107 tst_links_libidn="yes"
3108 ],[
3109 AC_MSG_RESULT([no])
3110 tst_links_libidn="no"
3111 ])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003112 #
Elliott Hughescee03382017-06-23 12:17:18 -07003113 AC_CHECK_HEADERS( idn2.h )
3114
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003115 if test "$tst_links_libidn" = "yes"; then
Elliott Hughescee03382017-06-23 12:17:18 -07003116 AC_DEFINE(HAVE_LIBIDN2, 1, [Define to 1 if you have the `idn2' library (-lidn2).])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003117 dnl different versions of libidn have different setups of these:
Elliott Hughescee03382017-06-23 12:17:18 -07003118
3119 AC_SUBST([IDN_ENABLED], [1])
3120 curl_idn_msg="enabled (libidn2)"
3121 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
3122 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
3123 export LD_LIBRARY_PATH
3124 AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003125 fi
3126 else
3127 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
3128 CPPFLAGS="$clean_CPPFLAGS"
3129 LDFLAGS="$clean_LDFLAGS"
3130 LIBS="$clean_LIBS"
3131 fi
3132fi
3133
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003134
3135dnl Let's hope this split URL remains working:
3136dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
3137dnl genprogc/thread_quick_ref.htm
3138
3139
3140dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003141dnl Check for nghttp2
3142dnl **********************************************************************
3143
3144OPT_H2="yes"
Elliott Hughes82be86d2017-09-20 17:00:17 -07003145
3146if test "x$disable_http" = "xyes"; then
3147 # without HTTP, nghttp2 is no use
3148 OPT_H2="no"
3149fi
3150
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003151AC_ARG_WITH(nghttp2,
3152AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
3153AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
3154 [OPT_H2=$withval])
3155case "$OPT_H2" in
3156 no)
3157 dnl --without-nghttp2 option used
3158 want_h2="no"
3159 ;;
3160 yes)
3161 dnl --with-nghttp2 option used without path
3162 want_h2="default"
3163 want_h2_path=""
3164 ;;
3165 *)
3166 dnl --with-nghttp2 option used with path
3167 want_h2="yes"
3168 want_h2_path="$withval/lib/pkgconfig"
3169 ;;
3170esac
3171
3172curl_h2_msg="disabled (--with-nghttp2)"
3173if test X"$want_h2" != Xno; then
3174 dnl backup the pre-nghttp2 variables
3175 CLEANLDFLAGS="$LDFLAGS"
3176 CLEANCPPFLAGS="$CPPFLAGS"
3177 CLEANLIBS="$LIBS"
3178
3179 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
3180
3181 if test "$PKGCONFIG" != "no" ; then
3182 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3183 $PKGCONFIG --libs-only-l libnghttp2`
3184 AC_MSG_NOTICE([-l is $LIB_H2])
3185
3186 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
3187 $PKGCONFIG --cflags-only-I libnghttp2`
3188 AC_MSG_NOTICE([-I is $CPP_H2])
3189
3190 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
3191 $PKGCONFIG --libs-only-L libnghttp2`
3192 AC_MSG_NOTICE([-L is $LD_H2])
3193
3194 LDFLAGS="$LDFLAGS $LD_H2"
3195 CPPFLAGS="$CPPFLAGS $CPP_H2"
3196 LIBS="$LIB_H2 $LIBS"
3197
3198 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3199 # >= 1.0.0
3200 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3201 [
3202 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3203 curl_h2_msg="enabled (nghttp2)"
3204 NGHTTP2_ENABLED=1
3205 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3206 AC_SUBST(USE_NGHTTP2, [1])
3207 )
3208 ],
3209 dnl not found, revert back to clean variables
3210 LDFLAGS=$CLEANLDFLAGS
3211 CPPFLAGS=$CLEANCPPFLAGS
3212 LIBS=$CLEANLIBS
3213 )
3214
3215 else
3216 dnl no nghttp2 pkg-config found, deal with it
3217 if test X"$want_h2" != Xdefault; then
3218 dnl To avoid link errors, we do not allow --with-nghttp2 without
3219 dnl a pkgconfig file
3220 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3221 fi
3222 fi
3223
3224fi
3225
3226dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07003227dnl Check for zsh completion path
3228dnl **********************************************************************
3229
3230OPT_ZSH_FPATH=default
3231AC_ARG_WITH(zsh-functions-dir,
3232AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3233AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3234 [OPT_ZSH_FPATH=$withval])
3235case "$OPT_ZSH_FPATH" in
3236 no)
3237 dnl --without-zsh-functions-dir option used
3238 ;;
3239 default|yes)
3240 dnl --with-zsh-functions-dir option used without path
3241 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3242 AC_SUBST(ZSH_FUNCTIONS_DIR)
3243 ;;
3244 *)
3245 dnl --with-zsh-functions-dir option used with path
3246 ZSH_FUNCTIONS_DIR="$withval"
3247 AC_SUBST(ZSH_FUNCTIONS_DIR)
3248 ;;
3249esac
3250
3251dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003252dnl Back to "normal" configuring
3253dnl **********************************************************************
3254
3255dnl Checks for header files.
3256AC_HEADER_STDC
3257
3258CURL_CHECK_HEADER_MALLOC
3259CURL_CHECK_HEADER_MEMORY
3260
3261dnl Now check for the very most basic headers. Then we can use these
3262dnl ones as default-headers when checking for the rest!
3263AC_CHECK_HEADERS(
3264 sys/types.h \
3265 sys/time.h \
3266 sys/select.h \
3267 sys/socket.h \
3268 sys/ioctl.h \
3269 sys/uio.h \
3270 assert.h \
3271 unistd.h \
3272 stdlib.h \
3273 limits.h \
3274 arpa/inet.h \
3275 net/if.h \
3276 netinet/in.h \
3277 sys/un.h \
Alex Deymo486467e2017-12-19 19:04:07 +01003278 linux/tcp.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003279 netinet/tcp.h \
3280 netdb.h \
3281 sys/sockio.h \
3282 sys/stat.h \
3283 sys/param.h \
3284 termios.h \
3285 termio.h \
3286 sgtty.h \
3287 fcntl.h \
3288 alloca.h \
3289 time.h \
3290 io.h \
3291 pwd.h \
3292 utime.h \
3293 sys/utime.h \
3294 sys/poll.h \
3295 poll.h \
3296 socket.h \
3297 sys/resource.h \
3298 libgen.h \
3299 locale.h \
3300 errno.h \
3301 stdbool.h \
3302 arpa/tftp.h \
3303 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003304 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003305 setjmp.h,
3306dnl to do if not found
3307[],
3308dnl to do if found
3309[],
3310dnl default includes
3311[
3312#ifdef HAVE_SYS_TYPES_H
3313#include <sys/types.h>
3314#endif
3315#ifdef HAVE_SYS_TIME_H
3316#include <sys/time.h>
3317#endif
3318#ifdef HAVE_SYS_SELECT_H
3319#include <sys/select.h>
3320#endif
3321#ifdef HAVE_SYS_SOCKET_H
3322#include <sys/socket.h>
3323#endif
3324#ifdef HAVE_NETINET_IN_H
3325#include <netinet/in.h>
3326#endif
3327#ifdef HAVE_SYS_UN_H
3328#include <sys/un.h>
3329#endif
3330]
3331)
3332
3333dnl Checks for typedefs, structures, and compiler characteristics.
3334AC_C_CONST
3335CURL_CHECK_VARIADIC_MACROS
3336AC_TYPE_SIZE_T
3337AC_HEADER_TIME
3338CURL_CHECK_STRUCT_TIMEVAL
3339CURL_VERIFY_RUNTIMELIBS
3340
Elliott Hughes82be86d2017-09-20 17:00:17 -07003341AC_CHECK_SIZEOF(size_t)
3342AC_CHECK_SIZEOF(long)
3343AC_CHECK_SIZEOF(int)
3344AC_CHECK_SIZEOF(short)
Elliott Hughes82be86d2017-09-20 17:00:17 -07003345AC_CHECK_SIZEOF(time_t)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003346AC_CHECK_SIZEOF(off_t)
3347
Alex Deymo486467e2017-12-19 19:04:07 +01003348o=$CPPFLAGS
3349CPPFLAGS="-I$srcdir/include $CPPFLAGS"
3350AC_CHECK_SIZEOF(curl_off_t, unused , [
3351#include <curl/system.h>
3352])
3353CPPFLAGS=$o
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003354
3355AC_CHECK_TYPE(long long,
3356 [AC_DEFINE(HAVE_LONGLONG, 1,
3357 [Define to 1 if the compiler supports the 'long long' data type.])]
3358 longlong="yes"
3359)
3360
3361if test "xyes" = "x$longlong"; then
3362 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003363 AC_COMPILE_IFELSE([
3364 AC_LANG_PROGRAM([[
3365 ]],[[
3366 long long val = 1000LL;
3367 ]])
3368 ],[
3369 AC_MSG_RESULT([yes])
3370 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3371 ],[
3372 AC_MSG_RESULT([no])
3373 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003374fi
3375
3376
3377# check for ssize_t
3378AC_CHECK_TYPE(ssize_t, ,
3379 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3380
3381# check for bool type
3382AC_CHECK_TYPE([bool],[
3383 AC_DEFINE(HAVE_BOOL_T, 1,
3384 [Define to 1 if bool is an available type.])
3385], ,[
3386#ifdef HAVE_SYS_TYPES_H
3387#include <sys/types.h>
3388#endif
3389#ifdef HAVE_STDBOOL_H
3390#include <stdbool.h>
3391#endif
3392])
3393
3394CURL_CONFIGURE_CURL_SOCKLEN_T
3395
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003396CURL_CONFIGURE_PULL_SYS_POLL
3397
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003398TYPE_IN_ADDR_T
3399
3400TYPE_SOCKADDR_STORAGE
3401
3402TYPE_SIG_ATOMIC_T
3403
3404AC_TYPE_SIGNAL
3405
3406CURL_CHECK_FUNC_SELECT
3407
3408CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003409CURL_CHECK_FUNC_SEND
3410CURL_CHECK_MSG_NOSIGNAL
3411
3412CURL_CHECK_FUNC_ALARM
3413CURL_CHECK_FUNC_BASENAME
3414CURL_CHECK_FUNC_CLOSESOCKET
3415CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3416CURL_CHECK_FUNC_CONNECT
3417CURL_CHECK_FUNC_FCNTL
3418CURL_CHECK_FUNC_FDOPEN
3419CURL_CHECK_FUNC_FREEADDRINFO
3420CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003421CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003422CURL_CHECK_FUNC_FTRUNCATE
3423CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003424CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003425CURL_CHECK_FUNC_GETHOSTBYADDR
3426CURL_CHECK_FUNC_GETHOSTBYADDR_R
3427CURL_CHECK_FUNC_GETHOSTBYNAME
3428CURL_CHECK_FUNC_GETHOSTBYNAME_R
3429CURL_CHECK_FUNC_GETHOSTNAME
3430CURL_CHECK_FUNC_GETIFADDRS
3431CURL_CHECK_FUNC_GETSERVBYPORT_R
3432CURL_CHECK_FUNC_GMTIME_R
3433CURL_CHECK_FUNC_INET_NTOA_R
3434CURL_CHECK_FUNC_INET_NTOP
3435CURL_CHECK_FUNC_INET_PTON
3436CURL_CHECK_FUNC_IOCTL
3437CURL_CHECK_FUNC_IOCTLSOCKET
3438CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3439CURL_CHECK_FUNC_LOCALTIME_R
3440CURL_CHECK_FUNC_MEMRCHR
3441CURL_CHECK_FUNC_POLL
3442CURL_CHECK_FUNC_SETSOCKOPT
3443CURL_CHECK_FUNC_SIGACTION
3444CURL_CHECK_FUNC_SIGINTERRUPT
3445CURL_CHECK_FUNC_SIGNAL
3446CURL_CHECK_FUNC_SIGSETJMP
3447CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003448CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003449CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003450CURL_CHECK_FUNC_STRCMPI
3451CURL_CHECK_FUNC_STRDUP
3452CURL_CHECK_FUNC_STRERROR_R
3453CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003454CURL_CHECK_FUNC_STRNCASECMP
3455CURL_CHECK_FUNC_STRNCMPI
3456CURL_CHECK_FUNC_STRNICMP
3457CURL_CHECK_FUNC_STRSTR
3458CURL_CHECK_FUNC_STRTOK_R
3459CURL_CHECK_FUNC_STRTOLL
3460CURL_CHECK_FUNC_WRITEV
3461
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003462case $host in
3463 *msdosdjgpp)
3464 ac_cv_func_pipe=no
3465 skipcheck_pipe=yes
3466 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3467 ;;
3468esac
3469
Elliott Hughes82be86d2017-09-20 17:00:17 -07003470AC_CHECK_FUNCS([geteuid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003471 getpass_r \
3472 getppid \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003473 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003474 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003475 getrlimit \
3476 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003477 if_nametoindex \
Alex Deymo486467e2017-12-19 19:04:07 +01003478 mach_absolute_time \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003479 pipe \
3480 setlocale \
3481 setmode \
3482 setrlimit \
Elliott Hughes82be86d2017-09-20 17:00:17 -07003483 utime \
3484 utimes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003485],[
3486],[
3487 func="$ac_func"
3488 eval skipcheck=\$skipcheck_$func
3489 if test "x$skipcheck" != "xyes"; then
3490 AC_MSG_CHECKING([deeper for $func])
3491 AC_LINK_IFELSE([
3492 AC_LANG_PROGRAM([[
3493 ]],[[
3494 $func ();
3495 ]])
3496 ],[
3497 AC_MSG_RESULT([yes])
3498 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003499 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003500 [Define to 1 if you have the $func function.])
3501 ],[
3502 AC_MSG_RESULT([but still no])
3503 ])
3504 fi
3505])
3506
3507dnl Check if the getnameinfo function is available
3508dnl and get the types of five of its arguments.
3509CURL_CHECK_FUNC_GETNAMEINFO
3510
3511if test "$ipv6" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07003512 if test "$curl_cv_func_getaddrinfo" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003513 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3514 IPV6_ENABLED=1
3515 AC_SUBST(IPV6_ENABLED)
3516 fi
3517 CURL_CHECK_NI_WITHSCOPEID
3518fi
3519
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003520CURL_CHECK_NONBLOCKING_SOCKET
3521
3522dnl ************************************************************
3523dnl nroff tool stuff
3524dnl
3525
3526AC_PATH_PROG( PERL, perl, ,
3527 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3528AC_SUBST(PERL)
3529
3530AC_PATH_PROGS( NROFF, gnroff nroff, ,
3531 $PATH:/usr/bin/:/usr/local/bin )
3532AC_SUBST(NROFF)
3533
3534if test -n "$NROFF"; then
3535 dnl only check for nroff options if an nroff command was found
3536
3537 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3538 MANOPT="-man"
3539 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3540 if test -z "$mancheck"; then
3541 MANOPT="-mandoc"
3542 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3543 if test -z "$mancheck"; then
3544 MANOPT=""
3545 AC_MSG_RESULT([failed])
3546 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3547 else
3548 AC_MSG_RESULT([$MANOPT])
3549 fi
3550 else
3551 AC_MSG_RESULT([$MANOPT])
3552 fi
3553 AC_SUBST(MANOPT)
3554fi
3555
3556if test -z "$MANOPT"
3557then
3558 dnl if no nroff tool was found, or no option that could convert man pages
3559 dnl was found, then disable the built-in manual stuff
3560 AC_MSG_WARN([disabling built-in manual])
3561 USE_MANUAL="no";
3562fi
3563
3564dnl *************************************************************************
3565dnl If the manual variable still is set, then we go with providing a built-in
3566dnl manual
3567
3568if test "$USE_MANUAL" = "1"; then
3569 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3570 curl_manual_msg="enabled"
3571fi
3572
3573dnl set variable for use in automakefile(s)
3574AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3575
3576CURL_CHECK_LIB_ARES
3577AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3578
Alex Deymod15eaac2016-06-28 14:49:26 -07003579if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003580 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003581 build_libhostname=yes
3582else
3583 build_libhostname=no
3584fi
3585AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3586
Elliott Hughes82be86d2017-09-20 17:00:17 -07003587if test "x$want_ares" != xyes; then
3588 CURL_CHECK_OPTION_THREADED_RESOLVER
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003589fi
3590
Elliott Hughes82be86d2017-09-20 17:00:17 -07003591dnl ************************************************************
3592dnl disable POSIX threads
3593dnl
3594AC_MSG_CHECKING([whether to use POSIX threads for threaded resolver])
3595AC_ARG_ENABLE(pthreads,
3596AC_HELP_STRING([--enable-pthreads],
3597 [Enable POSIX threads (default for threaded resolver)])
3598AC_HELP_STRING([--disable-pthreads],[Disable POSIX threads]),
3599[ case "$enableval" in
3600 no) AC_MSG_RESULT(no)
3601 want_pthreads=no
3602 ;;
3603 *) AC_MSG_RESULT(yes)
3604 want_pthreads=yes
3605 ;;
3606 esac ], [
3607 AC_MSG_RESULT(auto)
3608 want_pthreads=auto
3609 ]
3610)
3611
3612dnl turn off pthreads if rt is disabled
3613if test "$want_pthreads" != "no"; then
3614 if test "$want_pthreads" = "yes" && test "$dontwant_rt" = "yes"; then
3615 AC_MSG_ERROR([options --enable-pthreads and --disable-rt are mutually exclusive])
3616 fi
3617 if test "$dontwant_rt" != "no"; then
3618 dnl if --enable-pthreads was explicit then warn it's being ignored
3619 if test "$want_pthreads" = "yes"; then
3620 AC_MSG_WARN([--enable-pthreads Ignored since librt is disabled.])
3621 fi
3622 want_pthreads=no
3623 fi
3624fi
3625
3626dnl turn off pthreads if no threaded resolver
3627if test "$want_pthreads" != "no" && test "$want_thres" != "yes"; then
3628 want_pthreads=no
3629fi
3630
3631dnl detect pthreads
3632if test "$want_pthreads" != "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003633 AC_CHECK_HEADER(pthread.h,
3634 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3635 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003636
3637 dnl first check for function without lib
3638 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3639
3640 dnl if it wasn't found without lib, search for it in pthread lib
3641 if test "$USE_THREADS_POSIX" != "1"
3642 then
3643 CFLAGS="$CFLAGS -pthread"
3644 AC_CHECK_LIB(pthread, pthread_create,
3645 [USE_THREADS_POSIX=1],
3646 [ CFLAGS="$save_CFLAGS"])
3647 fi
3648
3649 if test "x$USE_THREADS_POSIX" = "x1"
3650 then
3651 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3652 curl_res_msg="POSIX threaded"
3653 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003654 ])
3655fi
3656
Elliott Hughes82be86d2017-09-20 17:00:17 -07003657dnl threaded resolver check
3658if test "$want_thres" = "yes" && test "x$USE_THREADS_POSIX" != "x1"; then
3659 if test "$want_pthreads" = "yes"; then
3660 AC_MSG_ERROR([--enable-pthreads but pthreads was not found])
3661 fi
3662 dnl If native Windows fallback on Win32 threads since no POSIX threads
3663 if test "$curl_cv_native_windows" = "yes"; then
3664 USE_THREADS_WIN32=1
3665 AC_DEFINE(USE_THREADS_WIN32, 1, [if you want Win32 threaded DNS lookup])
3666 curl_res_msg="Win32 threaded"
3667 else
3668 AC_MSG_ERROR([Threaded resolver enabled but no thread library found])
3669 fi
3670fi
3671
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003672dnl ************************************************************
3673dnl disable verbose text strings
3674dnl
3675AC_MSG_CHECKING([whether to enable verbose strings])
3676AC_ARG_ENABLE(verbose,
3677AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3678AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3679[ case "$enableval" in
3680 no)
3681 AC_MSG_RESULT(no)
3682 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3683 curl_verbose_msg="no"
3684 ;;
3685 *) AC_MSG_RESULT(yes)
3686 ;;
3687 esac ],
3688 AC_MSG_RESULT(yes)
3689)
3690
3691dnl ************************************************************
3692dnl enable SSPI support
3693dnl
3694AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3695AC_ARG_ENABLE(sspi,
3696AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3697AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3698[ case "$enableval" in
3699 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07003700 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003701 AC_MSG_RESULT(yes)
3702 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3703 AC_SUBST(USE_WINDOWS_SSPI, [1])
3704 curl_sspi_msg="enabled"
3705 else
3706 AC_MSG_RESULT(no)
3707 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3708 fi
3709 ;;
3710 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003711 if test "x$WINSSL_ENABLED" = "x1"; then
3712 # --with-winssl implies --enable-sspi
3713 AC_MSG_RESULT(yes)
3714 else
3715 AC_MSG_RESULT(no)
3716 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003717 ;;
3718 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003719 if test "x$WINSSL_ENABLED" = "x1"; then
3720 # --with-winssl implies --enable-sspi
3721 AC_MSG_RESULT(yes)
3722 else
3723 AC_MSG_RESULT(no)
3724 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003725)
3726
3727dnl ************************************************************
3728dnl disable cryptographic authentication
3729dnl
3730AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3731AC_ARG_ENABLE(crypto-auth,
3732AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3733AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3734[ case "$enableval" in
3735 no)
3736 AC_MSG_RESULT(no)
3737 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003738 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003739 ;;
3740 *) AC_MSG_RESULT(yes)
3741 ;;
3742 esac ],
3743 AC_MSG_RESULT(yes)
3744)
3745
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003746CURL_CHECK_OPTION_NTLM_WB
3747
3748CURL_CHECK_NTLM_WB
3749
3750dnl ************************************************************
3751dnl disable TLS-SRP authentication
3752dnl
3753AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3754AC_ARG_ENABLE(tls-srp,
3755AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3756AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3757[ case "$enableval" in
3758 no)
3759 AC_MSG_RESULT(no)
3760 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3761 want_tls_srp=no
3762 ;;
3763 *) AC_MSG_RESULT(yes)
3764 want_tls_srp=yes
3765 ;;
3766 esac ],
3767 AC_MSG_RESULT(yes)
3768 want_tls_srp=yes
3769)
3770
3771if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3772 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3773 USE_TLS_SRP=1
3774 curl_tls_srp_msg="enabled"
3775fi
3776
3777dnl ************************************************************
3778dnl disable Unix domain sockets support
3779dnl
3780AC_MSG_CHECKING([whether to enable Unix domain sockets])
3781AC_ARG_ENABLE(unix-sockets,
3782AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3783AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3784[ case "$enableval" in
3785 no) AC_MSG_RESULT(no)
3786 want_unix_sockets=no
3787 ;;
3788 *) AC_MSG_RESULT(yes)
3789 want_unix_sockets=yes
3790 ;;
3791 esac ], [
3792 AC_MSG_RESULT(auto)
3793 want_unix_sockets=auto
3794 ]
3795)
3796if test "x$want_unix_sockets" != "xno"; then
3797 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3798 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3799 AC_SUBST(USE_UNIX_SOCKETS, [1])
3800 curl_unix_sockets_msg="enabled"
3801 ], [
3802 if test "x$want_unix_sockets" = "xyes"; then
3803 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3804 fi
3805 ], [
3806 #include <sys/un.h>
3807 ])
3808fi
3809
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003810dnl ************************************************************
3811dnl disable cookies support
3812dnl
3813AC_MSG_CHECKING([whether to enable support for cookies])
3814AC_ARG_ENABLE(cookies,
3815AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3816AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3817[ case "$enableval" in
3818 no)
3819 AC_MSG_RESULT(no)
3820 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3821 ;;
3822 *) AC_MSG_RESULT(yes)
3823 ;;
3824 esac ],
3825 AC_MSG_RESULT(yes)
3826)
3827
3828dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003829dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003830dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003831CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003832
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003833dnl
3834dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003835dnl
3836LIBCURL_LIBS=$LIBS
3837
3838AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003839AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003840AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3841
3842dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3843dnl LIBS variable used in generated makefile at makefile processing
3844dnl time. Doing this functionally prevents LIBS from being used for
3845dnl all link targets in given makefile.
3846BLANK_AT_MAKETIME=
3847AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003848
3849AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3850
3851dnl yes or no
3852ENABLE_SHARED="$enable_shared"
3853AC_SUBST(ENABLE_SHARED)
3854
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003855dnl to let curl-config output the static libraries correctly
3856ENABLE_STATIC="$enable_static"
3857AC_SUBST(ENABLE_STATIC)
3858
3859
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003860dnl
3861dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003862dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003863dnl
3864
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003865if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003866 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3867elif test -n "$SSL_ENABLED"; then
3868 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3869fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003870if test "x$IPV6_ENABLED" = "x1"; then
3871 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3872fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003873if test "x$USE_UNIX_SOCKETS" = "x1"; then
3874 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3875fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003876if test "x$HAVE_LIBZ" = "x1"; then
3877 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3878fi
Alex Deymo486467e2017-12-19 19:04:07 +01003879if test "x$HAVE_BROTLI" = "x1"; then
3880 SUPPORT_FEATURES="$SUPPORT_FEATURES brotli"
3881fi
Elliott Hughes82be86d2017-09-20 17:00:17 -07003882if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1" \
3883 -o "x$USE_THREADS_WIN32" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003884 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3885fi
3886if test "x$IDN_ENABLED" = "x1"; then
3887 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3888fi
3889if test "x$USE_WINDOWS_SSPI" = "x1"; then
3890 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3891fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003892
3893if test "x$HAVE_GSSAPI" = "x1"; then
3894 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3895fi
3896
Alex Deymod15eaac2016-06-28 14:49:26 -07003897if test "x$curl_psl_msg" = "xyes"; then
3898 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
3899fi
3900
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003901if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3902 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3903 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3904fi
3905
3906if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3907 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3908 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3909fi
3910
3911if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3912 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07003913 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
3914 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003915 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3916
3917 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3918 "x$NTLM_WB_ENABLED" = "x1"; then
3919 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3920 fi
3921 fi
3922fi
3923
3924if test "x$USE_TLS_SRP" = "x1"; then
3925 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3926fi
3927
3928if test "x$USE_NGHTTP2" = "x1"; then
3929 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003930fi
3931
Alex Deymo486467e2017-12-19 19:04:07 +01003932if test "x$CURL_WITH_MULTI_SSL" = "x1"; then
3933 SUPPORT_FEATURES="$SUPPORT_FEATURES MultiSSL"
3934fi
3935
Elliott Hughes82be86d2017-09-20 17:00:17 -07003936if test "x$OPENSSL_ENABLED" = "x1" -o "x$GNUTLS_ENABLED" = "x1" \
3937 -o "x$NSS_ENABLED" = "x1"; then
3938 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTPS-proxy"
3939fi
3940
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003941AC_SUBST(SUPPORT_FEATURES)
3942
3943dnl For supported protocols in pkg-config file
3944if test "x$CURL_DISABLE_HTTP" != "x1"; then
3945 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3946 if test "x$SSL_ENABLED" = "x1"; then
3947 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3948 fi
3949fi
3950if test "x$CURL_DISABLE_FTP" != "x1"; then
3951 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3952 if test "x$SSL_ENABLED" = "x1"; then
3953 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3954 fi
3955fi
3956if test "x$CURL_DISABLE_FILE" != "x1"; then
3957 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3958fi
3959if test "x$CURL_DISABLE_TELNET" != "x1"; then
3960 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3961fi
3962if test "x$CURL_DISABLE_LDAP" != "x1"; then
3963 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3964 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3965 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3966 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3967 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3968 fi
3969 fi
3970fi
3971if test "x$CURL_DISABLE_DICT" != "x1"; then
3972 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3973fi
3974if test "x$CURL_DISABLE_TFTP" != "x1"; then
3975 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3976fi
3977if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3978 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3979fi
3980if test "x$CURL_DISABLE_POP3" != "x1"; then
3981 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3982 if test "x$SSL_ENABLED" = "x1"; then
3983 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3984 fi
3985fi
3986if test "x$CURL_DISABLE_IMAP" != "x1"; then
3987 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3988 if test "x$SSL_ENABLED" = "x1"; then
3989 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3990 fi
3991fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003992if test "x$CURL_DISABLE_SMB" != "x1" \
3993 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3994 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
Elliott Hughescee03382017-06-23 12:17:18 -07003995 -o "x$GNUTLS_ENABLED" = "x1" -o "x$MBEDTLS_ENABLED" = "x1" \
3996 -o "x$NSS_ENABLED" = "x1" -o "x$DARWINSSL_ENABLED" = "x1" \); then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003997 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3998 if test "x$SSL_ENABLED" = "x1"; then
3999 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
4000 fi
4001fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004002if test "x$CURL_DISABLE_SMTP" != "x1"; then
4003 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
4004 if test "x$SSL_ENABLED" = "x1"; then
4005 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
4006 fi
4007fi
4008if test "x$USE_LIBSSH2" = "x1"; then
4009 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
4010 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
4011fi
4012if test "x$CURL_DISABLE_RTSP" != "x1"; then
4013 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
4014fi
4015if test "x$USE_LIBRTMP" = "x1"; then
4016 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
4017fi
4018
4019dnl replace spaces with newlines
4020dnl sort the lines
4021dnl replace the newlines back to spaces
4022SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
4023
4024AC_SUBST(SUPPORT_PROTOCOLS)
4025
4026dnl squeeze whitespace out of some variables
4027
4028squeeze CFLAGS
4029squeeze CPPFLAGS
4030squeeze DEFS
4031squeeze LDFLAGS
4032squeeze LIBS
4033
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004034squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004035squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004036squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004037
4038squeeze SUPPORT_FEATURES
4039squeeze SUPPORT_PROTOCOLS
4040
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004041XC_CHECK_BUILD_FLAGS
4042
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004043if test "x$want_curldebug_assumed" = "xyes" &&
4044 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
4045 ac_configure_args="$ac_configure_args --enable-curldebug"
4046fi
4047
4048AC_CONFIG_FILES([Makefile \
4049 docs/Makefile \
4050 docs/examples/Makefile \
4051 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004052 docs/libcurl/opts/Makefile \
Elliott Hughes82be86d2017-09-20 17:00:17 -07004053 docs/cmdline-opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004054 include/Makefile \
4055 include/curl/Makefile \
4056 src/Makefile \
4057 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07004058 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004059 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004060 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004061 tests/certs/Makefile \
4062 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004063 tests/data/Makefile \
4064 tests/server/Makefile \
4065 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004066 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004067 packages/Makefile \
4068 packages/Win32/Makefile \
4069 packages/Win32/cygwin/Makefile \
4070 packages/Linux/Makefile \
4071 packages/Linux/RPM/Makefile \
4072 packages/Linux/RPM/curl.spec \
4073 packages/Linux/RPM/curl-ssl.spec \
4074 packages/Solaris/Makefile \
4075 packages/EPM/curl.list \
4076 packages/EPM/Makefile \
4077 packages/vms/Makefile \
4078 packages/AIX/Makefile \
4079 packages/AIX/RPM/Makefile \
4080 packages/AIX/RPM/curl.spec \
4081 curl-config \
4082 libcurl.pc
4083])
4084AC_OUTPUT
4085
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004086CURL_GENERATE_CONFIGUREHELP_PM
4087
4088XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
4089
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004090AC_MSG_NOTICE([Configured to build curl/libcurl:
4091
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004092 curl version: ${CURLVERSION}
4093 Host setup: ${host}
4094 Install prefix: ${prefix}
4095 Compiler: ${CC}
4096 SSL support: ${curl_ssl_msg}
4097 SSH support: ${curl_ssh_msg}
4098 zlib support: ${curl_zlib_msg}
Alex Deymo486467e2017-12-19 19:04:07 +01004099 brotli support: ${curl_brotli_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004100 GSS-API support: ${curl_gss_msg}
4101 TLS-SRP support: ${curl_tls_srp_msg}
4102 resolver: ${curl_res_msg}
4103 IPv6 support: ${curl_ipv6_msg}
4104 Unix sockets support: ${curl_unix_sockets_msg}
4105 IDN support: ${curl_idn_msg}
4106 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
4107 Built-in manual: ${curl_manual_msg}
4108 --libcurl option: ${curl_libcurl_msg}
4109 Verbose errors: ${curl_verbose_msg}
4110 SSPI support: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004111 ca cert bundle: ${ca}${ca_warning}
4112 ca cert path: ${capath}${capath_warning}
4113 ca fallback: ${with_ca_fallback}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004114 LDAP support: ${curl_ldap_msg}
4115 LDAPS support: ${curl_ldaps_msg}
4116 RTSP support: ${curl_rtsp_msg}
4117 RTMP support: ${curl_rtmp_msg}
4118 metalink support: ${curl_mtlnk_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07004119 PSL support: ${curl_psl_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07004120 HTTP2 support: ${curl_h2_msg}
4121 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07004122])