blob: da0e9d882e99edcb0ef1798070173155f92f98fa [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Alex Deymod15eaac2016-06-28 14:49:26 -07008# Copyright (C) 1998 - 2016, 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
Alex Deymod15eaac2016-06-28 14:49:26 -070034AC_COPYRIGHT([Copyright (c) 1998 - 2016 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])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070039AC_CONFIG_HEADERS(lib/curl_config.h include/curl/curlbuild.h)
40AC_CONFIG_MACRO_DIR([m4])
Lucas Eckels9bd90e62012-08-06 15:07:02 -070041AM_MAINTAINER_MODE
Alex Deymod15eaac2016-06-28 14:49:26 -070042m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -070043
44CURL_CHECK_OPTION_DEBUG
45CURL_CHECK_OPTION_OPTIMIZE
46CURL_CHECK_OPTION_WARNINGS
47CURL_CHECK_OPTION_WERROR
48CURL_CHECK_OPTION_CURLDEBUG
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070049CURL_CHECK_OPTION_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -070050CURL_CHECK_OPTION_ARES
Alex Deymod15eaac2016-06-28 14:49:26 -070051CURL_CHECK_OPTION_RT
Lucas Eckels9bd90e62012-08-06 15:07:02 -070052
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070053XC_CHECK_PATH_SEPARATOR
Lucas Eckels9bd90e62012-08-06 15:07:02 -070054
55#
56# save the configure arguments
57#
58CONFIGURE_OPTIONS="\"$ac_configure_args\""
59AC_SUBST(CONFIGURE_OPTIONS)
60
61CURL_CFLAG_EXTRAS=""
62if test X"$want_werror" = Xyes; then
63 CURL_CFLAG_EXTRAS="-Werror"
64fi
65AC_SUBST(CURL_CFLAG_EXTRAS)
66
67dnl SED is mandatory for configure process and libtool.
68dnl Set it now, allowing it to be changed later.
69if test -z "$SED"; then
70 dnl allow it to be overridden
71 AC_PATH_PROG([SED], [sed], [not_found],
72 [$PATH:/usr/bin:/usr/local/bin])
73 if test -z "$SED" || test "$SED" = "not_found"; then
74 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
75 fi
76fi
77AC_SUBST([SED])
78
79dnl GREP is mandatory for configure process and libtool.
80dnl Set it now, allowing it to be changed later.
81if test -z "$GREP"; then
82 dnl allow it to be overridden
83 AC_PATH_PROG([GREP], [grep], [not_found],
84 [$PATH:/usr/bin:/usr/local/bin])
85 if test -z "$GREP" || test "$GREP" = "not_found"; then
86 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
87 fi
88fi
89AC_SUBST([GREP])
90
91dnl EGREP is mandatory for configure process and libtool.
92dnl Set it now, allowing it to be changed later.
93if test -z "$EGREP"; then
94 dnl allow it to be overridden
95 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
96 AC_MSG_CHECKING([for egrep])
97 EGREP="$GREP -E"
98 AC_MSG_RESULT([$EGREP])
99 else
100 AC_PATH_PROG([EGREP], [egrep], [not_found],
101 [$PATH:/usr/bin:/usr/local/bin])
102 fi
103fi
104if test -z "$EGREP" || test "$EGREP" = "not_found"; then
105 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
106fi
107AC_SUBST([EGREP])
108
109dnl AR is mandatory for configure process and libtool.
110dnl This is target dependent, so check it as a tool.
111if test -z "$AR"; then
112 dnl allow it to be overridden
113 AC_PATH_TOOL([AR], [ar], [not_found],
114 [$PATH:/usr/bin:/usr/local/bin])
115 if test -z "$AR" || test "$AR" = "not_found"; then
116 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
117 fi
118fi
119AC_SUBST([AR])
120
121AC_SUBST(libext)
122
123dnl Remove non-configure distributed curlbuild.h
124if test -f ${srcdir}/include/curl/curlbuild.h; then
125 rm -f ${srcdir}/include/curl/curlbuild.h
126fi
127
128dnl figure out the libcurl version
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700129CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
130XC_CHECK_PROG_CC
131XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700132AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700133AC_MSG_RESULT($CURLVERSION)
134
135AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700136
137dnl
138dnl we extract the numerical version for curl-config only
139VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
140AC_SUBST(VERSIONNUM)
141
142dnl Solaris pkgadd support definitions
143PKGADD_PKG="HAXXcurl"
144PKGADD_NAME="cURL - a client that groks URLs"
145PKGADD_VENDOR="curl.haxx.se"
146AC_SUBST(PKGADD_PKG)
147AC_SUBST(PKGADD_NAME)
148AC_SUBST(PKGADD_VENDOR)
149
150dnl
151dnl initialize all the info variables
Alex Deymod15eaac2016-06-28 14:49:26 -0700152 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700153 curl_ssh_msg="no (--with-libssh2)"
154 curl_zlib_msg="no (--with-zlib)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700155 curl_gss_msg="no (--with-gssapi)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700156curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700157 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
158 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700159curl_unix_sockets_msg="no (--enable-unix-sockets)"
160 curl_idn_msg="no (--with-{libidn,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700161 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700162curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700163curl_verbose_msg="enabled (--disable-verbose)"
164 curl_sspi_msg="no (--enable-sspi)"
165 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
166 curl_ldaps_msg="no (--enable-ldaps)"
167 curl_rtsp_msg="no (--enable-rtsp)"
168 curl_rtmp_msg="no (--with-librtmp)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700169 curl_mtlnk_msg="no (--with-libmetalink)"
Alex Deymod15eaac2016-06-28 14:49:26 -0700170 curl_psl_msg="no (--with-libpsl)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700171
172 init_ssl_msg=${curl_ssl_msg}
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700173
174dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700175dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700176dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700177INITIAL_LDFLAGS=$LDFLAGS
178INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700179
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700180dnl Checks for programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700181
182dnl Our curl_off_t internal and external configure settings
183CURL_CONFIGURE_CURL_OFF_T
184
185dnl This defines _ALL_SOURCE for AIX
186CURL_CHECK_AIX_ALL_SOURCE
187
188dnl Our configure and build reentrant settings
189CURL_CONFIGURE_THREAD_SAFE
190CURL_CONFIGURE_REENTRANT
191
192dnl check for how to do large files
193AC_SYS_LARGEFILE
194
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700195XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700196
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700197#
198# Automake conditionals based on libtool related checks
199#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700200
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700201AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
202 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
203AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
204 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
205AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
206 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700207
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700208#
209# Due to libtool and automake machinery limitations of not allowing
210# specifying separate CPPFLAGS or CFLAGS when compiling objects for
211# inclusion of these in shared or static libraries, we are forced to
212# build using separate configure runs for shared and static libraries
213# on systems where different CPPFLAGS or CFLAGS are mandatory in order
214# to compile objects for each kind of library. Notice that relying on
215# the '-DPIC' CFLAG that libtool provides is not valid given that the
216# user might for example choose to build static libraries with PIC.
217#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700218
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700219#
220# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
221# targeting a static library and not building its shared counterpart.
222#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700223
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700224AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
225 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700226
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700227#
228# Make staticlib CPPFLAG variable and its definition visible in output
229# files unconditionally, providing an empty definition unless strictly
230# targeting a static library and not building its shared counterpart.
231#
232
233CPPFLAG_CURL_STATICLIB=
234if test "x$xc_lt_build_static_only" = 'xyes'; then
235 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
236fi
237AC_SUBST([CPPFLAG_CURL_STATICLIB])
238
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700239
240# Determine whether all dependent libraries must be specified when linking
241if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
242then
243 REQUIRE_LIB_DEPS=no
244else
245 REQUIRE_LIB_DEPS=yes
246fi
247AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700248AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700249
250dnl check if there's a way to force code inline
251AC_C_INLINE
252
253dnl **********************************************************************
254dnl platform/compiler/architecture specific checks/flags
255dnl **********************************************************************
256
257CURL_CHECK_COMPILER
258CURL_SET_COMPILER_BASIC_OPTS
259CURL_SET_COMPILER_DEBUG_OPTS
260CURL_SET_COMPILER_OPTIMIZE_OPTS
261CURL_SET_COMPILER_WARNING_OPTS
262
263if test "$compiler_id" = "INTEL_UNIX_C"; then
264 #
265 if test "$compiler_num" -ge "1000"; then
266 dnl icc 10.X or later
267 CFLAGS="$CFLAGS -shared-intel"
268 elif test "$compiler_num" -ge "900"; then
269 dnl icc 9.X specific
270 CFLAGS="$CFLAGS -i-dynamic"
271 fi
272 #
273fi
274
275CURL_CHECK_COMPILER_HALT_ON_ERROR
276CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700277CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
278CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700279
280CURL_CHECK_CURLDEBUG
281AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
282
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700283supports_unittests=yes
284# cross-compilation of unit tests static library/programs fails when
285# libcurl shared library is built. This might be due to a libtool or
286# automake issue. In this case we disable unit tests.
287if test "x$cross_compiling" != "xno" &&
288 test "x$enable_shared" != "xno"; then
289 supports_unittests=no
290fi
291
292# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
293# a problem related with OpenSSL headers and library versions not matching.
294# Disable unit tests while time to further investigate this is found.
295case $host in
296 mips-sgi-irix6.5)
297 if test "$compiler_id" = "GNU_C"; then
298 supports_unittests=no
299 fi
300 ;;
301esac
302
303# All AIX autobuilds fails unit tests linking against unittests library
304# due to unittests library being built with no symbols or members. Libtool ?
305# Disable unit tests while time to further investigate this is found.
306case $host_os in
307 aix*)
308 supports_unittests=no
309 ;;
310esac
311
312dnl Build unit tests when option --enable-debug is given.
313if test "x$want_debug" = "xyes" &&
314 test "x$supports_unittests" = "xyes"; then
315 want_unittests=yes
316else
317 want_unittests=no
318fi
319AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
320
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700321dnl **********************************************************************
322dnl Compilation based checks should not be done before this point.
323dnl **********************************************************************
324
325dnl **********************************************************************
326dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
327dnl and ws2tcpip.h take precedence over any other further checks which
328dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
329dnl this specific header files. And do them before its results are used.
330dnl **********************************************************************
331
332CURL_CHECK_HEADER_WINDOWS
333CURL_CHECK_NATIVE_WINDOWS
Alex Deymod15eaac2016-06-28 14:49:26 -0700334case X-"$curl_cv_native_windows" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700335 X-yes)
336 CURL_CHECK_HEADER_WINSOCK
337 CURL_CHECK_HEADER_WINSOCK2
338 CURL_CHECK_HEADER_WS2TCPIP
339 CURL_CHECK_HEADER_WINLDAP
340 CURL_CHECK_HEADER_WINBER
341 ;;
342 *)
Alex Deymod15eaac2016-06-28 14:49:26 -0700343 curl_cv_header_winsock_h="no"
344 curl_cv_header_winsock2_h="no"
345 curl_cv_header_ws2tcpip_h="no"
346 curl_cv_header_winldap_h="no"
347 curl_cv_header_winber_h="no"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700348 ;;
349esac
350CURL_CHECK_WIN32_LARGEFILE
351
352dnl ************************************************************
353dnl switch off particular protocols
354dnl
355AC_MSG_CHECKING([whether to support http])
356AC_ARG_ENABLE(http,
357AC_HELP_STRING([--enable-http],[Enable HTTP support])
358AC_HELP_STRING([--disable-http],[Disable HTTP support]),
359[ case "$enableval" in
360 no)
361 AC_MSG_RESULT(no)
362 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
363 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
364 AC_SUBST(CURL_DISABLE_HTTP, [1])
365 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
366 AC_SUBST(CURL_DISABLE_RTSP, [1])
367 ;;
368 *) AC_MSG_RESULT(yes)
369 ;;
370 esac ],
371 AC_MSG_RESULT(yes)
372)
373AC_MSG_CHECKING([whether to support ftp])
374AC_ARG_ENABLE(ftp,
375AC_HELP_STRING([--enable-ftp],[Enable FTP support])
376AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
377[ case "$enableval" in
378 no)
379 AC_MSG_RESULT(no)
380 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
381 AC_SUBST(CURL_DISABLE_FTP, [1])
382 ;;
383 *) AC_MSG_RESULT(yes)
384 ;;
385 esac ],
386 AC_MSG_RESULT(yes)
387)
388AC_MSG_CHECKING([whether to support file])
389AC_ARG_ENABLE(file,
390AC_HELP_STRING([--enable-file],[Enable FILE support])
391AC_HELP_STRING([--disable-file],[Disable FILE support]),
392[ case "$enableval" in
393 no)
394 AC_MSG_RESULT(no)
395 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
396 AC_SUBST(CURL_DISABLE_FILE, [1])
397 ;;
398 *) AC_MSG_RESULT(yes)
399 ;;
400 esac ],
401 AC_MSG_RESULT(yes)
402)
403AC_MSG_CHECKING([whether to support ldap])
404AC_ARG_ENABLE(ldap,
405AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
406AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
407[ case "$enableval" in
408 no)
409 AC_MSG_RESULT(no)
410 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
411 AC_SUBST(CURL_DISABLE_LDAP, [1])
412 ;;
413 *)
414 AC_MSG_RESULT(yes)
415 ;;
416 esac ],[
417 AC_MSG_RESULT(yes) ]
418)
419AC_MSG_CHECKING([whether to support ldaps])
420AC_ARG_ENABLE(ldaps,
421AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
422AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
423[ case "$enableval" in
424 no)
425 AC_MSG_RESULT(no)
426 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
427 AC_SUBST(CURL_DISABLE_LDAPS, [1])
428 ;;
429 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
430 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
431 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
432 AC_SUBST(CURL_DISABLE_LDAPS, [1])
433 else
434 AC_MSG_RESULT(yes)
435 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
436 AC_SUBST(HAVE_LDAP_SSL, [1])
437 fi
438 ;;
439 esac ],[
440 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
441 AC_MSG_RESULT(no)
442 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
443 AC_SUBST(CURL_DISABLE_LDAPS, [1])
444 else
445 AC_MSG_RESULT(yes)
446 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
447 AC_SUBST(HAVE_LDAP_SSL, [1])
448 fi ]
449)
450
451AC_MSG_CHECKING([whether to support rtsp])
452AC_ARG_ENABLE(rtsp,
453AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
454AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
455[ case "$enableval" in
456 no)
457 AC_MSG_RESULT(no)
458 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
459 AC_SUBST(CURL_DISABLE_RTSP, [1])
460 ;;
461 *) if test x$CURL_DISABLE_HTTP = x1 ; then
462 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
463 else
464 AC_MSG_RESULT(yes)
465 curl_rtsp_msg="enabled"
466 fi
467 ;;
468 esac ],
469 if test "x$CURL_DISABLE_HTTP" != "x1"; then
470 AC_MSG_RESULT(yes)
471 curl_rtsp_msg="enabled"
472 else
473 AC_MSG_RESULT(no)
474 fi
475)
476
477AC_MSG_CHECKING([whether to support proxies])
478AC_ARG_ENABLE(proxy,
479AC_HELP_STRING([--enable-proxy],[Enable proxy support])
480AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
481[ case "$enableval" in
482 no)
483 AC_MSG_RESULT(no)
484 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
485 AC_SUBST(CURL_DISABLE_PROXY, [1])
486 ;;
487 *) AC_MSG_RESULT(yes)
488 ;;
489 esac ],
490 AC_MSG_RESULT(yes)
491)
492
493AC_MSG_CHECKING([whether to support dict])
494AC_ARG_ENABLE(dict,
495AC_HELP_STRING([--enable-dict],[Enable DICT support])
496AC_HELP_STRING([--disable-dict],[Disable DICT support]),
497[ case "$enableval" in
498 no)
499 AC_MSG_RESULT(no)
500 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
501 AC_SUBST(CURL_DISABLE_DICT, [1])
502 ;;
503 *) AC_MSG_RESULT(yes)
504 ;;
505 esac ],
506 AC_MSG_RESULT(yes)
507)
508AC_MSG_CHECKING([whether to support telnet])
509AC_ARG_ENABLE(telnet,
510AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
511AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
512[ case "$enableval" in
513 no)
514 AC_MSG_RESULT(no)
515 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
516 AC_SUBST(CURL_DISABLE_TELNET, [1])
517 ;;
518 *) AC_MSG_RESULT(yes)
519 ;;
520 esac ],
521 AC_MSG_RESULT(yes)
522)
523AC_MSG_CHECKING([whether to support tftp])
524AC_ARG_ENABLE(tftp,
525AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
526AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
527[ case "$enableval" in
528 no)
529 AC_MSG_RESULT(no)
530 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
531 AC_SUBST(CURL_DISABLE_TFTP, [1])
532 ;;
533 *) AC_MSG_RESULT(yes)
534 ;;
535 esac ],
536 AC_MSG_RESULT(yes)
537)
538
539AC_MSG_CHECKING([whether to support pop3])
540AC_ARG_ENABLE(pop3,
541AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
542AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
543[ case "$enableval" in
544 no)
545 AC_MSG_RESULT(no)
546 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
547 AC_SUBST(CURL_DISABLE_POP3, [1])
548 ;;
549 *) AC_MSG_RESULT(yes)
550 ;;
551 esac ],
552 AC_MSG_RESULT(yes)
553)
554
555
556AC_MSG_CHECKING([whether to support imap])
557AC_ARG_ENABLE(imap,
558AC_HELP_STRING([--enable-imap],[Enable IMAP support])
559AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
560[ case "$enableval" in
561 no)
562 AC_MSG_RESULT(no)
563 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
564 AC_SUBST(CURL_DISABLE_IMAP, [1])
565 ;;
566 *) AC_MSG_RESULT(yes)
567 ;;
568 esac ],
569 AC_MSG_RESULT(yes)
570)
571
572
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700573AC_MSG_CHECKING([whether to support smb])
574AC_ARG_ENABLE(smb,
575AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
576AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
577[ case "$enableval" in
578 no)
579 AC_MSG_RESULT(no)
580 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
581 AC_SUBST(CURL_DISABLE_SMB, [1])
582 ;;
583 *) AC_MSG_RESULT(yes)
584 ;;
585 esac ],
586 AC_MSG_RESULT(yes)
587)
588
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700589AC_MSG_CHECKING([whether to support smtp])
590AC_ARG_ENABLE(smtp,
591AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
592AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
593[ case "$enableval" in
594 no)
595 AC_MSG_RESULT(no)
596 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
597 AC_SUBST(CURL_DISABLE_SMTP, [1])
598 ;;
599 *) AC_MSG_RESULT(yes)
600 ;;
601 esac ],
602 AC_MSG_RESULT(yes)
603)
604
605AC_MSG_CHECKING([whether to support gopher])
606AC_ARG_ENABLE(gopher,
607AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
608AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
609[ case "$enableval" in
610 no)
611 AC_MSG_RESULT(no)
612 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
613 AC_SUBST(CURL_DISABLE_GOPHER, [1])
614 ;;
615 *) AC_MSG_RESULT(yes)
616 ;;
617 esac ],
618 AC_MSG_RESULT(yes)
619)
620
621
622dnl **********************************************************************
623dnl Check for built-in manual
624dnl **********************************************************************
625
626AC_MSG_CHECKING([whether to provide built-in manual])
627AC_ARG_ENABLE(manual,
628AC_HELP_STRING([--enable-manual],[Enable built-in manual])
629AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
630[ case "$enableval" in
631 no)
632 AC_MSG_RESULT(no)
633 ;;
634 *) AC_MSG_RESULT(yes)
635 USE_MANUAL="1"
636 ;;
637 esac ],
638 AC_MSG_RESULT(yes)
639 USE_MANUAL="1"
640)
641dnl The actual use of the USE_MANUAL variable is done much later in this
642dnl script to allow other actions to disable it as well.
643
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700644dnl ************************************************************
645dnl disable C code generation support
646dnl
647AC_MSG_CHECKING([whether to enable generation of C code])
648AC_ARG_ENABLE(libcurl_option,
649AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
650AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
651[ case "$enableval" in
652 no)
653 AC_MSG_RESULT(no)
654 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
655 curl_libcurl_msg="no"
656 ;;
657 *) AC_MSG_RESULT(yes)
658 ;;
659 esac ],
660 AC_MSG_RESULT(yes)
661)
662
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700663dnl **********************************************************************
664dnl Checks for libraries.
665dnl **********************************************************************
666
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700667AC_MSG_CHECKING([whether to use libgcc])
668AC_ARG_ENABLE(libgcc,
669AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
670[ case "$enableval" in
671 yes)
672 LIBS="-lgcc $LIBS"
673 AC_MSG_RESULT(yes)
674 ;;
675 *) AC_MSG_RESULT(no)
676 ;;
677 esac ],
678 AC_MSG_RESULT(no)
679)
680
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700681CURL_CHECK_LIB_XNET
682
683dnl gethostbyname without lib or in the nsl lib?
684AC_CHECK_FUNC(gethostbyname,
685 [HAVE_GETHOSTBYNAME="1"
686 ],
687 [ AC_CHECK_LIB(nsl, gethostbyname,
688 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700689 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700690 ])
691 ])
692
693if test "$HAVE_GETHOSTBYNAME" != "1"
694then
695 dnl gethostbyname in the socket lib?
696 AC_CHECK_LIB(socket, gethostbyname,
697 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700698 LIBS="-lsocket $LIBS"
699 ])
700fi
701
702if test "$HAVE_GETHOSTBYNAME" != "1"
703then
704 dnl gethostbyname in the watt lib?
705 AC_CHECK_LIB(watt, gethostbyname,
706 [HAVE_GETHOSTBYNAME="1"
707 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
708 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
709 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700710 ])
711fi
712
713dnl At least one system has been identified to require BOTH nsl and socket
714dnl libs at the same time to link properly.
715if test "$HAVE_GETHOSTBYNAME" != "1"
716then
717 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
718 my_ac_save_LIBS=$LIBS
719 LIBS="-lnsl -lsocket $LIBS"
720 AC_LINK_IFELSE([
721 AC_LANG_PROGRAM([[
722 ]],[[
723 gethostbyname();
724 ]])
725 ],[
726 AC_MSG_RESULT([yes])
727 HAVE_GETHOSTBYNAME="1"
728 ],[
729 AC_MSG_RESULT([no])
730 LIBS=$my_ac_save_LIBS
731 ])
732fi
733
734if test "$HAVE_GETHOSTBYNAME" != "1"
735then
736 dnl This is for winsock systems
Alex Deymod15eaac2016-06-28 14:49:26 -0700737 if test "$curl_cv_header_windows_h" = "yes"; then
738 if test "$curl_cv_header_winsock_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700739 case $host in
740 *-*-mingw32ce*)
741 winsock_LIB="-lwinsock"
742 ;;
743 *)
744 winsock_LIB="-lwsock32"
745 ;;
746 esac
747 fi
Alex Deymod15eaac2016-06-28 14:49:26 -0700748 if test "$curl_cv_header_winsock2_h" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700749 winsock_LIB="-lws2_32"
750 fi
751 if test ! -z "$winsock_LIB"; then
752 my_ac_save_LIBS=$LIBS
753 LIBS="$winsock_LIB $LIBS"
754 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
755 AC_LINK_IFELSE([
756 AC_LANG_PROGRAM([[
757#ifdef HAVE_WINDOWS_H
758#ifndef WIN32_LEAN_AND_MEAN
759#define WIN32_LEAN_AND_MEAN
760#endif
761#include <windows.h>
762#ifdef HAVE_WINSOCK2_H
763#include <winsock2.h>
764#else
765#ifdef HAVE_WINSOCK_H
766#include <winsock.h>
767#endif
768#endif
769#endif
770 ]],[[
771 gethostbyname("www.dummysite.com");
772 ]])
773 ],[
774 AC_MSG_RESULT([yes])
775 HAVE_GETHOSTBYNAME="1"
776 ],[
777 AC_MSG_RESULT([no])
778 winsock_LIB=""
779 LIBS=$my_ac_save_LIBS
780 ])
781 fi
782 fi
783fi
784
785if test "$HAVE_GETHOSTBYNAME" != "1"
786then
787 dnl This is for Minix 3.1
788 AC_MSG_CHECKING([for gethostbyname for Minix 3])
789 AC_LINK_IFELSE([
790 AC_LANG_PROGRAM([[
791/* Older Minix versions may need <net/gen/netdb.h> here instead */
792#include <netdb.h>
793 ]],[[
794 gethostbyname("www.dummysite.com");
795 ]])
796 ],[
797 AC_MSG_RESULT([yes])
798 HAVE_GETHOSTBYNAME="1"
799 ],[
800 AC_MSG_RESULT([no])
801 ])
802fi
803
804if test "$HAVE_GETHOSTBYNAME" != "1"
805then
806 dnl This is for eCos with a stubbed DNS implementation
807 AC_MSG_CHECKING([for gethostbyname for eCos])
808 AC_LINK_IFELSE([
809 AC_LANG_PROGRAM([[
810#include <stdio.h>
811#include <netdb.h>
812 ]],[[
813 gethostbyname("www.dummysite.com");
814 ]])
815 ],[
816 AC_MSG_RESULT([yes])
817 HAVE_GETHOSTBYNAME="1"
818 ],[
819 AC_MSG_RESULT([no])
820 ])
821fi
822
823if test "$HAVE_GETHOSTBYNAME" != "1"
824then
825 dnl gethostbyname in the network lib - for Haiku OS
826 AC_CHECK_LIB(network, gethostbyname,
827 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700828 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700829 ])
830fi
831
832if test "$HAVE_GETHOSTBYNAME" != "1"
833then
834 dnl gethostbyname in the net lib - for BeOS
835 AC_CHECK_LIB(net, gethostbyname,
836 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700837 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700838 ])
839fi
840
841
842if test "$HAVE_GETHOSTBYNAME" != "1"; then
843 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
844fi
845
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700846CURL_CHECK_LIBS_CONNECT
847
848CURL_NETWORK_LIBS=$LIBS
849
850dnl **********************************************************************
851dnl In case that function clock_gettime with monotonic timer is available,
852dnl check for additional required libraries.
853dnl **********************************************************************
854CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
855
856dnl **********************************************************************
857dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700858dnl servers and libtest cases which require networking and clock_gettime
859dnl support. Save the list of required libraries at this point for use
860dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700861dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700862CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700863
864dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700865dnl Check for the presence of ZLIB libraries and headers
866dnl **********************************************************************
867
868dnl Check for & handle argument to --with-zlib.
869
870clean_CPPFLAGS=$CPPFLAGS
871clean_LDFLAGS=$LDFLAGS
872clean_LIBS=$LIBS
873ZLIB_LIBS=""
874AC_ARG_WITH(zlib,
875AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
876AC_HELP_STRING([--without-zlib],[disable use of zlib]),
877 [OPT_ZLIB="$withval"])
878
879if test "$OPT_ZLIB" = "no" ; then
880 AC_MSG_WARN([zlib disabled])
881else
882 if test "$OPT_ZLIB" = "yes" ; then
883 OPT_ZLIB=""
884 fi
885
886 if test -z "$OPT_ZLIB" ; then
887 dnl check for the lib first without setting any new path, since many
888 dnl people have it in the default path
889
890 AC_CHECK_LIB(z, inflateEnd,
891 dnl libz found, set the variable
892 [HAVE_LIBZ="1"
893 LIBS="-lz $LIBS"],
894 dnl if no lib found, try /usr/local
895 [OPT_ZLIB="/usr/local"])
896
897 fi
898
899 dnl Add a nonempty path to the compiler flags
900 if test -n "$OPT_ZLIB"; then
901 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
902 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
903 fi
904
905 AC_CHECK_HEADER(zlib.h,
906 [
907 dnl zlib.h was found
908 HAVE_ZLIB_H="1"
909 dnl if the lib wasn't found already, try again with the new paths
910 if test "$HAVE_LIBZ" != "1"; then
911 AC_CHECK_LIB(z, gzread,
912 [
913 dnl the lib was found!
914 HAVE_LIBZ="1"
915 LIBS="-lz $LIBS"
916 ],
917 [ CPPFLAGS=$clean_CPPFLAGS
918 LDFLAGS=$clean_LDFLAGS])
919 fi
920 ],
921 [
922 dnl zlib.h was not found, restore the flags
923 CPPFLAGS=$clean_CPPFLAGS
924 LDFLAGS=$clean_LDFLAGS]
925 )
926
927 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
928 then
929 AC_MSG_WARN([configure found only the libz lib, not the header file!])
930 HAVE_LIBZ=""
931 CPPFLAGS=$clean_CPPFLAGS
932 LDFLAGS=$clean_LDFLAGS
933 LIBS=$clean_LIBS
934 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
935 then
936 AC_MSG_WARN([configure found only the libz header file, not the lib!])
937 CPPFLAGS=$clean_CPPFLAGS
938 LDFLAGS=$clean_LDFLAGS
939 LIBS=$clean_LIBS
940 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
941 then
942 dnl both header and lib were found!
943 AC_SUBST(HAVE_LIBZ)
944 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
945 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
946
947 ZLIB_LIBS="-lz"
948 LIBS="-lz $clean_LIBS"
949
950 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
951 AMFIXLIB="1"
952 AC_MSG_NOTICE([found both libz and libz.h header])
953 curl_zlib_msg="enabled"
954 fi
955fi
956
957dnl set variable for use in automakefile(s)
958AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
959AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700960
961dnl **********************************************************************
962dnl Check for LDAP
963dnl **********************************************************************
964
965LDAPLIBNAME=""
966AC_ARG_WITH(ldap-lib,
967AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
968 [LDAPLIBNAME="$withval"])
969
970LBERLIBNAME=""
971AC_ARG_WITH(lber-lib,
972AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
973 [LBERLIBNAME="$withval"])
974
975if test x$CURL_DISABLE_LDAP != x1 ; then
976
977 CURL_CHECK_HEADER_LBER
978 CURL_CHECK_HEADER_LDAP
979 CURL_CHECK_HEADER_LDAPSSL
980 CURL_CHECK_HEADER_LDAP_SSL
981
982 if test -z "$LDAPLIBNAME" ; then
Alex Deymod15eaac2016-06-28 14:49:26 -0700983 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700984 dnl Windows uses a single and unique LDAP library name
985 LDAPLIBNAME="wldap32"
986 LBERLIBNAME="no"
987 fi
988 fi
989
990 if test "$LDAPLIBNAME" ; then
991 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
992 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
993 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700994 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700995 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700996 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700997 else
998 dnl Try to find the right ldap libraries for this system
999 CURL_CHECK_LIBS_LDAP
1000 case X-"$curl_cv_ldap_LIBS" in
1001 X-unknown)
1002 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1003 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1004 AC_SUBST(CURL_DISABLE_LDAP, [1])
1005 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1006 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1007 ;;
1008 esac
1009 fi
1010fi
1011
1012if test x$CURL_DISABLE_LDAP != x1 ; then
1013
1014 if test "$LBERLIBNAME" ; then
1015 dnl If name is "no" then don't define this library at all
1016 dnl (it's only needed if libldap.so's dependencies are broken).
1017 if test "$LBERLIBNAME" != "no" ; then
1018 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1019 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1020 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001021 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001022 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001023 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001024 fi
1025 fi
1026fi
1027
1028if test x$CURL_DISABLE_LDAP != x1 ; then
1029 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1030
1031 if test "$LDAPLIBNAME" = "wldap32"; then
1032 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001033 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001034 else
1035 curl_ldap_msg="enabled (OpenLDAP)"
1036 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1037 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1038 AC_SUBST(USE_OPENLDAP, [1])
1039 fi
1040 fi
1041fi
1042
1043if test x$CURL_DISABLE_LDAPS != x1 ; then
1044 curl_ldaps_msg="enabled"
1045fi
1046
1047dnl **********************************************************************
1048dnl Checks for IPv6
1049dnl **********************************************************************
1050
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001051AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001052AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001053AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1054AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001055[ case "$enableval" in
1056 no)
1057 AC_MSG_RESULT(no)
1058 ipv6=no
1059 ;;
1060 *) AC_MSG_RESULT(yes)
1061 ipv6=yes
1062 ;;
1063 esac ],
1064
1065 AC_TRY_RUN([ /* is AF_INET6 available? */
1066#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001067#ifdef HAVE_WINSOCK2_H
1068#include <winsock2.h>
1069#else
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001070#include <sys/socket.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001071#endif
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001072#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001073main()
1074{
1075 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1076 exit(1);
1077 else
1078 exit(0);
1079}
1080],
1081 AC_MSG_RESULT(yes)
1082 ipv6=yes,
1083 AC_MSG_RESULT(no)
1084 ipv6=no,
Alex Deymod15eaac2016-06-28 14:49:26 -07001085 AC_MSG_RESULT(yes)
1086 ipv6=yes
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001087))
1088
1089if test "$ipv6" = "yes"; then
1090 curl_ipv6_msg="enabled"
1091fi
1092
1093# Check if struct sockaddr_in6 have sin6_scope_id member
1094if test "$ipv6" = yes; then
1095 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1096 AC_TRY_COMPILE([
1097#include <sys/types.h>
Alex Deymod15eaac2016-06-28 14:49:26 -07001098#ifdef HAVE_WINSOCK2_H
1099#include <winsock2.h>
1100#include <ws2tcpip.h>
1101#else
1102#include <netinet/in.h>
1103#endif] ,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001104 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1105 if test "$have_sin6_scope_id" = yes; then
1106 AC_MSG_RESULT([yes])
1107 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1108 else
1109 AC_MSG_RESULT([no])
1110 fi
1111fi
1112
1113dnl **********************************************************************
1114dnl Check if the operating system allows programs to write to their own argv[]
1115dnl **********************************************************************
1116
1117AC_MSG_CHECKING([if argv can be written to])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001118AC_RUN_IFELSE([
1119 AC_LANG_SOURCE([[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001120int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001121 argv[0][0] = ' ';
1122 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001123}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001124 ]])
1125],[
1126 curl_cv_writable_argv=yes
1127],[
1128 curl_cv_writable_argv=no
1129],[
1130 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001131])
1132case $curl_cv_writable_argv in
1133yes)
1134 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1135 AC_MSG_RESULT(yes)
1136 ;;
1137no)
1138 AC_MSG_RESULT(no)
1139 ;;
1140*)
1141 AC_MSG_RESULT(no)
1142 AC_MSG_WARN([the previous check could not be made default was used])
1143 ;;
1144esac
1145
1146dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001147dnl Check for GSS-API libraries
1148dnl **********************************************************************
1149
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001150dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001151
1152GSSAPI_ROOT="/usr"
1153AC_ARG_WITH(gssapi-includes,
1154 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001155 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001156 [ GSSAPI_INCS="-I$withval"
1157 want_gss="yes" ]
1158)
1159
1160AC_ARG_WITH(gssapi-libs,
1161 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001162 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001163 [ GSSAPI_LIB_DIR="-L$withval"
1164 want_gss="yes" ]
1165)
1166
1167AC_ARG_WITH(gssapi,
1168 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001169 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001170 GSSAPI_ROOT="$withval"
1171 if test x"$GSSAPI_ROOT" != xno; then
1172 want_gss="yes"
1173 if test x"$GSSAPI_ROOT" = xyes; then
1174 dnl if yes, then use default root
1175 GSSAPI_ROOT="/usr"
1176 fi
1177 fi
1178])
1179
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001180: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1181
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001182save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001183AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001184if test x"$want_gss" = xyes; then
1185 AC_MSG_RESULT(yes)
1186
1187 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001188 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1189 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1190 elif test -f "$KRB5CONFIG"; then
1191 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001192 elif test "$GSSAPI_ROOT" != "yes"; then
1193 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1194 fi
1195 fi
1196
1197 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1198
1199 AC_CHECK_HEADER(gss.h,
1200 [
1201 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001202 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001203 gnu_gss=yes
1204 ],
1205 [
1206 dnl not found, check Heimdal or MIT
1207 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1208 AC_CHECK_HEADERS(
1209 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1210 [],
1211 [not_mit=1],
1212 [
1213AC_INCLUDES_DEFAULT
1214#ifdef HAVE_GSSAPI_GSSAPI_H
1215#include <gssapi/gssapi.h>
1216#endif
1217 ])
1218 if test "x$not_mit" = "x1"; then
1219 dnl MIT not found, check for Heimdal
1220 AC_CHECK_HEADER(gssapi.h,
1221 [
1222 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001223 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001224 ],
1225 [
1226 dnl no header found, disabling GSS
1227 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001228 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001229 ]
1230 )
1231 else
1232 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001233 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1234 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1235 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001236 AC_COMPILE_IFELSE([
1237 AC_LANG_PROGRAM([[
1238#include <gssapi/gssapi.h>
1239#include <gssapi/gssapi_generic.h>
1240#include <gssapi/gssapi_krb5.h>
1241 ]],[[
1242 gss_import_name(
1243 (OM_uint32 *)0,
1244 (gss_buffer_t)0,
1245 GSS_C_NT_HOSTBASED_SERVICE,
1246 (gss_name_t *)0);
1247 ]])
1248 ],[
1249 AC_MSG_RESULT([yes])
1250 ],[
1251 AC_MSG_RESULT([no])
1252 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001253 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001254 ])
1255 fi
1256 ]
1257 )
1258else
1259 AC_MSG_RESULT(no)
1260fi
1261if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001262 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1263 HAVE_GSSAPI=1
1264 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001265
1266 if test -n "$gnu_gss"; then
1267 curl_gss_msg="enabled (GNU GSS)"
1268 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001269 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001270 elif test -z "$GSSAPI_LIB_DIR"; then
1271 case $host in
1272 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001273 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001274 ;;
1275 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001276 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001277 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1278 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001279 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1280 LIBS="$gss_libs $LIBS"
1281 elif test -f "$KRB5CONFIG"; then
1282 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1283 dnl into LIBS
1284 gss_libs=`$KRB5CONFIG --libs gssapi`
1285 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001286 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001287 case $host in
1288 *-hp-hpux*)
1289 gss_libname="gss"
1290 ;;
1291 *)
1292 gss_libname="gssapi"
1293 ;;
1294 esac
1295
1296 if test "$GSSAPI_ROOT" != "yes"; then
1297 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1298 LIBS="-l$gss_libname $LIBS"
1299 else
1300 LIBS="-l$gss_libname $LIBS"
1301 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001302 fi
1303 ;;
1304 esac
1305 else
1306 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001307 case $host in
1308 *-hp-hpux*)
1309 LIBS="-lgss $LIBS"
1310 ;;
1311 *)
1312 LIBS="-lgssapi $LIBS"
1313 ;;
1314 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001315 fi
1316else
1317 CPPFLAGS="$save_CPPFLAGS"
1318fi
1319
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001320dnl -------------------------------------------------
1321dnl check winssl option before other SSL libraries
1322dnl -------------------------------------------------
1323
1324OPT_WINSSL=no
1325AC_ARG_WITH(winssl,dnl
1326AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1327AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1328 OPT_WINSSL=$withval)
1329
1330AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
1331if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1332 if test "x$OPT_WINSSL" != "xno" &&
Alex Deymod15eaac2016-06-28 14:49:26 -07001333 test "x$curl_cv_native_windows" = "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001334 AC_MSG_RESULT(yes)
1335 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1336 AC_SUBST(USE_SCHANNEL, [1])
1337 curl_ssl_msg="enabled (Windows-native)"
1338 WINSSL_ENABLED=1
1339 # --with-winssl implies --enable-sspi
1340 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1341 AC_SUBST(USE_WINDOWS_SSPI, [1])
1342 curl_sspi_msg="enabled"
1343 else
1344 AC_MSG_RESULT(no)
1345 fi
1346else
1347 AC_MSG_RESULT(no)
1348fi
1349
1350OPT_DARWINSSL=no
1351AC_ARG_WITH(darwinssl,dnl
1352AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
1353AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
1354 OPT_DARWINSSL=$withval)
1355
1356AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
1357if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1358 if test "x$OPT_DARWINSSL" != "xno" &&
1359 test -d "/System/Library/Frameworks/Security.framework"; then
1360 AC_MSG_RESULT(yes)
1361 AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
1362 AC_SUBST(USE_DARWINSSL, [1])
1363 curl_ssl_msg="enabled (iOS/Mac OS X-native)"
1364 DARWINSSL_ENABLED=1
1365 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1366 else
1367 AC_MSG_RESULT(no)
1368 fi
1369else
1370 AC_MSG_RESULT(no)
1371fi
1372
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001373dnl **********************************************************************
1374dnl Check for the presence of SSL libraries and headers
1375dnl **********************************************************************
1376
1377dnl Default to compiler & linker defaults for SSL files & libraries.
1378OPT_SSL=off
1379dnl Default to no CA bundle
1380ca="no"
1381AC_ARG_WITH(ssl,dnl
1382AC_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])
1383AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1384 OPT_SSL=$withval)
1385
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001386if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001387 dnl backup the pre-ssl variables
1388 CLEANLDFLAGS="$LDFLAGS"
1389 CLEANCPPFLAGS="$CPPFLAGS"
1390 CLEANLIBS="$LIBS"
1391
Alex Deymod15eaac2016-06-28 14:49:26 -07001392 dnl This is for Msys/Mingw
1393 case $host in
1394 *-*-msys* | *-*-mingw*)
1395 AC_MSG_CHECKING([for gdi32])
1396 my_ac_save_LIBS=$LIBS
1397 LIBS="-lgdi32 $LIBS"
1398 AC_TRY_LINK([#include <windef.h>
1399 #include <wingdi.h>],
1400 [GdiFlush();],
1401 [ dnl worked!
1402 AC_MSG_RESULT([yes])],
1403 [ dnl failed, restore LIBS
1404 LIBS=$my_ac_save_LIBS
1405 AC_MSG_RESULT(no)]
1406 )
1407 ;;
1408 esac
1409
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001410 case "$OPT_SSL" in
1411 yes)
1412 dnl --with-ssl (without path) used
1413 if test x$cross_compiling != xyes; then
1414 dnl only do pkg-config magic when not cross-compiling
1415 PKGTEST="yes"
1416 fi
1417 PREFIX_OPENSSL=/usr/local/ssl
1418 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1419 ;;
1420 off)
1421 dnl no --with-ssl option given, just check default places
1422 if test x$cross_compiling != xyes; then
1423 dnl only do pkg-config magic when not cross-compiling
1424 PKGTEST="yes"
1425 fi
1426 PREFIX_OPENSSL=
1427 ;;
1428 *)
1429 dnl check the given --with-ssl spot
1430 PKGTEST="no"
1431 PREFIX_OPENSSL=$OPT_SSL
1432
1433 dnl Try pkg-config even when cross-compiling. Since we
1434 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1435 dnl the user told us to look
1436 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1437 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001438 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001439 PKGTEST="yes"
1440 fi
1441
1442 dnl in case pkg-config comes up empty, use what we got
1443 dnl via --with-ssl
1444 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1445 if test "$PREFIX_OPENSSL" != "/usr" ; then
1446 SSL_LDFLAGS="-L$LIB_OPENSSL"
1447 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1448 fi
1449 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1450 ;;
1451 esac
1452
1453 if test "$PKGTEST" = "yes"; then
1454
1455 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1456
1457 if test "$PKGCONFIG" != "no" ; then
1458 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1459 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1460
1461 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1462 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1463
1464 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1465 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1466
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001467 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001468 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1469 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1470 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1471
1472 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1473
1474 dnl use the values pkg-config reported. This is here
1475 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1476 dnl learn about this via pkg-config. If we only have
1477 dnl the argument to --with-ssl we don't know what
1478 dnl additional libs may be necessary. Hope that we
1479 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001480 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001481 fi
1482 fi
1483
1484 dnl finally, set flags to use SSL
1485 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1486 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1487
Alex Deymod15eaac2016-06-28 14:49:26 -07001488 AC_CHECK_LIB(crypto, HMAC_Update,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001489 HAVECRYPTO="yes"
1490 LIBS="-lcrypto $LIBS"
1491 ],[
1492 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1493 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
Alex Deymod15eaac2016-06-28 14:49:26 -07001494 AC_CHECK_LIB(crypto, HMAC_Init_ex,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001495 HAVECRYPTO="yes"
1496 LIBS="-lcrypto $LIBS"], [
1497 LDFLAGS="$CLEANLDFLAGS"
1498 CPPFLAGS="$CLEANCPPFLAGS"
1499 LIBS="$CLEANLIBS"
1500 ])
1501 ])
1502
1503
1504 if test X"$HAVECRYPTO" = X"yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07001505 AC_MSG_CHECKING([OpenSSL linking without -ldl])
1506 saved_libs=$LIBS
1507 AC_TRY_LINK(
1508 [
1509 #include <openssl/evp.h>
1510 ],
1511 [
1512 SSLeay_add_all_algorithms();
1513 ],
1514 [
1515 AC_MSG_RESULT(yes)
1516 LIBS="$saved_libs"
1517 ],
1518 [
1519 AC_MSG_RESULT(no)
1520 AC_MSG_CHECKING([OpenSSL linking with -ldl])
1521 LIBS="-ldl $LIBS"
1522 AC_TRY_LINK(
1523 [
1524 #include <openssl/evp.h>
1525 ],
1526 [
1527 SSLeay_add_all_algorithms();
1528 ],
1529 [
1530 AC_MSG_RESULT(yes)
1531 LIBS="$saved_libs -ldl"
1532 ],
1533 [
1534 AC_MSG_RESULT(no)
1535 LIBS="$saved_libs"
1536 ]
1537 )
1538
1539 ]
1540 )
1541
1542 fi
1543
1544 if test X"$HAVECRYPTO" = X"yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001545 dnl This is only reasonable to do if crypto actually is there: check for
1546 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1547
1548 AC_CHECK_LIB(ssl, SSL_connect)
1549
1550 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1551 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1552 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1553 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001554 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001555 AC_CHECK_LIB(ssl, SSL_connect)
1556 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1557 dnl still no SSL_connect
1558 AC_MSG_RESULT(no)
1559 LIBS=$OLIBS
1560 else
1561 AC_MSG_RESULT(yes)
1562 fi
1563
1564 else
1565
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001566 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001567 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1568 openssl/pem.h openssl/ssl.h openssl/err.h,
1569 curl_ssl_msg="enabled (OpenSSL)"
1570 OPENSSL_ENABLED=1
1571 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1572
1573 if test $ac_cv_header_openssl_x509_h = no; then
1574 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1575 dnl since 'err.h' might in fact find a krb4 header with the same
1576 dnl name
1577 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1578
1579 if test $ac_cv_header_x509_h = yes &&
1580 test $ac_cv_header_crypto_h = yes &&
1581 test $ac_cv_header_ssl_h = yes; then
1582 dnl three matches
1583 curl_ssl_msg="enabled (OpenSSL)"
1584 OPENSSL_ENABLED=1
1585 fi
1586 fi
1587 fi
1588
1589 if test X"$OPENSSL_ENABLED" = X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001590 dnl is there a pkcs12.h header present?
1591 AC_CHECK_HEADERS(openssl/pkcs12.h)
1592 else
1593 LIBS="$CLEANLIBS"
1594 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001595
1596 if test X"$OPT_SSL" != Xoff &&
1597 test "$OPENSSL_ENABLED" != "1"; then
1598 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1599 fi
1600 fi
1601
1602 if test X"$OPENSSL_ENABLED" = X"1"; then
1603 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1604 dnl stuff, it is kind of "separated" from the main SSL check
1605 AC_CHECK_FUNC(ENGINE_init,
1606 [
1607 AC_CHECK_HEADERS(openssl/engine.h)
1608 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1609 ])
1610
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001611 dnl These can only exist if OpenSSL exists
1612 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1613 dnl SSL_get_shutdown (but this check won't actually detect it there
1614 dnl as it's a macro that needs the header files be included)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001615
1616 AC_CHECK_FUNCS( RAND_status \
1617 RAND_screen \
1618 RAND_egd \
1619 ENGINE_cleanup \
1620 CRYPTO_cleanup_all_ex_data \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001621 SSL_get_shutdown \
Alex Deymod15eaac2016-06-28 14:49:26 -07001622 SSLv2_client_method )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001623
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001624 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001625 AC_COMPILE_IFELSE([
Alex Deymod15eaac2016-06-28 14:49:26 -07001626 AC_LANG_PROGRAM([[
1627 #include <openssl/base.h>
1628 ]],[[
1629 #ifndef OPENSSL_IS_BORINGSSL
1630 #error not boringssl
1631 #endif
1632 ]])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001633 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001634 AC_MSG_RESULT([yes])
1635 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1636 [Define to 1 if using BoringSSL.])
1637 curl_ssl_msg="enabled (BoringSSL)"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001638 ],[
Alex Deymod15eaac2016-06-28 14:49:26 -07001639 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001640 ])
1641
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001642 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001643 AC_COMPILE_IFELSE([
1644 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001645#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001646 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001647 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001648 ]])
1649 ],[
1650 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001651 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1652 [Define to 1 if using libressl.])
1653 curl_ssl_msg="enabled (libressl)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001654 ],[
1655 AC_MSG_RESULT([no])
1656 ])
1657 fi
1658
1659 if test "$OPENSSL_ENABLED" = "1"; then
1660 if test -n "$LIB_OPENSSL"; then
1661 dnl when the ssl shared libs were found in a path that the run-time
1662 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1663 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001664 if test "x$cross_compiling" != "xyes"; then
1665 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1666 export LD_LIBRARY_PATH
1667 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1668 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001669 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001670 CURL_CHECK_OPENSSL_API
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001671 fi
1672
1673fi
1674
1675dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001676dnl Check for the random seed preferences
1677dnl **********************************************************************
1678
1679if test X"$OPENSSL_ENABLED" = X"1"; then
1680 AC_ARG_WITH(egd-socket,
1681 AC_HELP_STRING([--with-egd-socket=FILE],
1682 [Entropy Gathering Daemon socket pathname]),
1683 [ EGD_SOCKET="$withval" ]
1684 )
1685 if test -n "$EGD_SOCKET" ; then
1686 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1687 [your Entropy Gathering Daemon socket pathname] )
1688 fi
1689
1690 dnl Check for user-specified random device
1691 AC_ARG_WITH(random,
1692 AC_HELP_STRING([--with-random=FILE],
1693 [read randomness from FILE (default=/dev/urandom)]),
1694 [ RANDOM_FILE="$withval" ],
1695 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001696 if test x$cross_compiling != xyes; then
1697 dnl Check for random device
1698 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1699 else
1700 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1701 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001702 ]
1703 )
1704 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1705 AC_SUBST(RANDOM_FILE)
1706 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1707 [a suitable file to read random data from])
1708 fi
1709fi
1710
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001711dnl ---
1712dnl We require OpenSSL with SRP support.
1713dnl ---
1714if test "$OPENSSL_ENABLED" = "1"; then
1715 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1716 [
1717 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1718 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1719 ])
1720fi
1721
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001722dnl ----------------------------------------------------
1723dnl check for GnuTLS
1724dnl ----------------------------------------------------
1725
1726dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1727OPT_GNUTLS=no
1728
1729AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001730AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001731AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1732 OPT_GNUTLS=$withval)
1733
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001734if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001735
1736 if test X"$OPT_GNUTLS" != Xno; then
1737
1738 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001739 addlib=""
1740 gtlslib=""
1741 version=""
1742 addcflags=""
1743
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001744 if test "x$OPT_GNUTLS" = "xyes"; then
1745 dnl this is with no partiular path given
1746 CURL_CHECK_PKGCONFIG(gnutls)
1747
1748 if test "$PKGCONFIG" != "no" ; then
1749 addlib=`$PKGCONFIG --libs-only-l gnutls`
1750 addld=`$PKGCONFIG --libs-only-L gnutls`
1751 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1752 version=`$PKGCONFIG --modversion gnutls`
1753 gtlslib=`echo $addld | $SED -e 's/-L//'`
1754 else
1755 dnl without pkg-config, we try libgnutls-config as that was how it
1756 dnl used to be done
1757 check=`libgnutls-config --version 2>/dev/null`
1758 if test -n "$check"; then
1759 addlib=`libgnutls-config --libs`
1760 addcflags=`libgnutls-config --cflags`
1761 version=`libgnutls-config --version`
1762 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1763 fi
1764 fi
1765 else
1766 dnl this is with a given path, first check if there's a libgnutls-config
1767 dnl there and if not, make an educated guess
1768 cfg=$OPT_GNUTLS/bin/libgnutls-config
1769 check=`$cfg --version 2>/dev/null`
1770 if test -n "$check"; then
1771 addlib=`$cfg --libs`
1772 addcflags=`$cfg --cflags`
1773 version=`$cfg --version`
1774 gtlslib=`$cfg --prefix`/lib$libsuff
1775 else
1776 dnl without pkg-config and libgnutls-config, we guess a lot!
1777 addlib=-lgnutls
1778 addld=-L$OPT_GNUTLS/lib$libsuff
1779 addcflags=-I$OPT_GNUTLS/include
1780 version="" # we just don't know
1781 gtlslib=$OPT_GNUTLS/lib$libsuff
1782 fi
1783 fi
1784
1785 if test -z "$version"; then
1786 dnl lots of efforts, still no go
1787 version="unknown"
1788 fi
1789
1790 if test -n "$addlib"; then
1791
1792 CLEANLIBS="$LIBS"
1793 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001794 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001795
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001796 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001797 LDFLAGS="$LDFLAGS $addld"
1798 if test "$addcflags" != "-I/usr/include"; then
1799 CPPFLAGS="$CPPFLAGS $addcflags"
1800 fi
1801
1802 AC_CHECK_LIB(gnutls, gnutls_check_version,
1803 [
1804 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1805 AC_SUBST(USE_GNUTLS, [1])
1806 GNUTLS_ENABLED=1
1807 USE_GNUTLS="yes"
1808 curl_ssl_msg="enabled (GnuTLS)"
1809 ],
1810 [
1811 LIBS="$CLEANLIBS"
1812 CPPFLAGS="$CLEANCPPFLAGS"
1813 ])
1814
1815 if test "x$USE_GNUTLS" = "xyes"; then
1816 AC_MSG_NOTICE([detected GnuTLS version $version])
1817
1818 if test -n "$gtlslib"; then
1819 dnl when shared libs were found in a path that the run-time
1820 dnl linker doesn't search through, we need to add it to
1821 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1822 dnl due to this
Alex Deymod15eaac2016-06-28 14:49:26 -07001823 if test "x$cross_compiling" != "xyes"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001824 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1825 export LD_LIBRARY_PATH
1826 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1827 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001828 fi
Alex Deymod15eaac2016-06-28 14:49:26 -07001829 AC_CHECK_FUNCS(gnutls_certificate_set_x509_key_file2)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001830 fi
1831
1832 fi
1833
1834 fi dnl GNUTLS not disabled
1835
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001836fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001837
1838dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001839dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001840dnl ---
1841
1842if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001843 USE_GNUTLS_NETTLE=
1844 # First check if we can detect either crypto library via transitive linking
1845 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1846 if test "$USE_GNUTLS_NETTLE" = ""; then
1847 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1848 fi
1849 # If not, try linking directly to both of them to see if they are available
1850 if test "$USE_GNUTLS_NETTLE" = ""; then
1851 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1852 fi
1853 if test "$USE_GNUTLS_NETTLE" = ""; then
1854 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1855 fi
1856 if test "$USE_GNUTLS_NETTLE" = ""; then
1857 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
1858 fi
1859 if test "$USE_GNUTLS_NETTLE" = "1"; then
1860 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
1861 AC_SUBST(USE_GNUTLS_NETTLE, [1])
1862 LIBS="-lnettle $LIBS"
1863 else
1864 LIBS="-lgcrypt $LIBS"
1865 fi
1866fi
1867
1868dnl ---
1869dnl We require GnuTLS with SRP support.
1870dnl ---
1871if test "$GNUTLS_ENABLED" = "1"; then
1872 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
1873 [
1874 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
1875 AC_SUBST(HAVE_GNUTLS_SRP, [1])
1876 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001877fi
1878
1879dnl ----------------------------------------------------
1880dnl check for PolarSSL
1881dnl ----------------------------------------------------
1882
1883dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1884OPT_POLARSSL=no
1885
1886_cppflags=$CPPFLAGS
1887_ldflags=$LDFLAGS
1888AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001889AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001890AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1891 OPT_POLARSSL=$withval)
1892
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001893if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001894
1895 if test X"$OPT_POLARSSL" != Xno; then
1896
1897 if test "$OPT_POLARSSL" = "yes"; then
1898 OPT_POLARSSL=""
1899 fi
1900
1901 if test -z "$OPT_POLARSSL" ; then
1902 dnl check for lib first without setting any new path
1903
1904 AC_CHECK_LIB(polarssl, havege_init,
1905 dnl libpolarssl found, set the variable
1906 [
1907 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1908 AC_SUBST(USE_POLARSSL, [1])
1909 POLARSSL_ENABLED=1
1910 USE_POLARSSL="yes"
1911 curl_ssl_msg="enabled (PolarSSL)"
1912 ])
1913 fi
1914
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001915 addld=""
1916 addlib=""
1917 addcflags=""
1918 polarssllib=""
1919
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001920 if test "x$USE_POLARSSL" != "xyes"; then
1921 dnl add the path and test again
1922 addld=-L$OPT_POLARSSL/lib$libsuff
1923 addcflags=-I$OPT_POLARSSL/include
1924 polarssllib=$OPT_POLARSSL/lib$libsuff
1925
1926 LDFLAGS="$LDFLAGS $addld"
1927 if test "$addcflags" != "-I/usr/include"; then
1928 CPPFLAGS="$CPPFLAGS $addcflags"
1929 fi
1930
1931 AC_CHECK_LIB(polarssl, ssl_init,
1932 [
1933 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1934 AC_SUBST(USE_POLARSSL, [1])
1935 POLARSSL_ENABLED=1
1936 USE_POLARSSL="yes"
1937 curl_ssl_msg="enabled (PolarSSL)"
1938 ],
1939 [
1940 CPPFLAGS=$_cppflags
1941 LDFLAGS=$_ldflags
1942 ])
1943 fi
1944
1945 if test "x$USE_POLARSSL" = "xyes"; then
1946 AC_MSG_NOTICE([detected PolarSSL])
1947
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001948 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001949
1950 if test -n "$polarssllib"; then
1951 dnl when shared libs were found in a path that the run-time
1952 dnl linker doesn't search through, we need to add it to
1953 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1954 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001955 if test "x$cross_compiling" != "xyes"; then
1956 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
1957 export LD_LIBRARY_PATH
1958 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
1959 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001960 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001961 fi
1962
1963 fi dnl PolarSSL not disabled
1964
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001965fi
1966
1967dnl ----------------------------------------------------
Alex Deymod15eaac2016-06-28 14:49:26 -07001968dnl check for mbedTLS
1969dnl ----------------------------------------------------
1970
1971OPT_MBEDTLS=no
1972
1973_cppflags=$CPPFLAGS
1974_ldflags=$LDFLAGS
1975AC_ARG_WITH(mbedtls,dnl
1976AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
1977AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
1978 OPT_MBEDTLS=$withval)
1979
1980if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1981
1982 if test X"$OPT_MBEDTLS" != Xno; then
1983
1984 if test "$OPT_MBEDTLS" = "yes"; then
1985 OPT_MBEDTLS=""
1986 fi
1987
1988 if test -z "$OPT_MBEDTLS" ; then
1989 dnl check for lib first without setting any new path
1990
1991 AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
1992 dnl libmbedtls found, set the variable
1993 [
1994 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
1995 AC_SUBST(USE_MBEDTLS, [1])
1996 MBEDTLS_ENABLED=1
1997 USE_MBEDTLS="yes"
1998 curl_ssl_msg="enabled (mbedTLS)"
1999 ], [], -lmbedx509 -lmbedcrypto)
2000 fi
2001
2002 addld=""
2003 addlib=""
2004 addcflags=""
2005 mbedtlslib=""
2006
2007 if test "x$USE_MBEDTLS" != "xyes"; then
2008 dnl add the path and test again
2009 addld=-L$OPT_MBEDTLS/lib$libsuff
2010 addcflags=-I$OPT_MBEDTLS/include
2011 mbedtlslib=$OPT_MBEDTLS/lib$libsuff
2012
2013 LDFLAGS="$LDFLAGS $addld"
2014 if test "$addcflags" != "-I/usr/include"; then
2015 CPPFLAGS="$CPPFLAGS $addcflags"
2016 fi
2017
2018 AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
2019 [
2020 AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
2021 AC_SUBST(USE_MBEDTLS, [1])
2022 MBEDTLS_ENABLED=1
2023 USE_MBEDTLS="yes"
2024 curl_ssl_msg="enabled (mbedTLS)"
2025 ],
2026 [
2027 CPPFLAGS=$_cppflags
2028 LDFLAGS=$_ldflags
2029 ], -lmbedx509 -lmbedcrypto)
2030 fi
2031
2032 if test "x$USE_MBEDTLS" = "xyes"; then
2033 AC_MSG_NOTICE([detected mbedTLS])
2034
2035 LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
2036
2037 if test -n "$mbedtlslib"; then
2038 dnl when shared libs were found in a path that the run-time
2039 dnl linker doesn't search through, we need to add it to
2040 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2041 dnl due to this
2042 if test "x$cross_compiling" != "xyes"; then
2043 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib"
2044 export LD_LIBRARY_PATH
2045 AC_MSG_NOTICE([Added $mbedtlslib to LD_LIBRARY_PATH])
2046 fi
2047 fi
2048 fi
2049
2050 fi dnl mbedTLS not disabled
2051
2052fi
2053
2054dnl ----------------------------------------------------
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002055dnl check for CyaSSL
2056dnl ----------------------------------------------------
2057
2058dnl Default to compiler & linker defaults for CyaSSL files & libraries.
2059OPT_CYASSL=no
2060
2061_cppflags=$CPPFLAGS
2062_ldflags=$LDFLAGS
2063AC_ARG_WITH(cyassl,dnl
2064AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
2065AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
2066 OPT_CYASSL=$withval)
2067
2068if test "$curl_ssl_msg" = "$init_ssl_msg"; then
2069
2070 if test X"$OPT_CYASSL" != Xno; then
2071
2072 if test "$OPT_CYASSL" = "yes"; then
2073 OPT_CYASSL=""
2074 fi
2075
2076 dnl This should be reworked to use pkg-config instead
2077
2078 cyassllibname=cyassl
2079
2080 if test -z "$OPT_CYASSL" ; then
2081 dnl check for lib in system default first
2082
2083 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2084 dnl libcyassl found, set the variable
2085 [
2086 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2087 AC_SUBST(USE_CYASSL, [1])
2088 CYASSL_ENABLED=1
2089 USE_CYASSL="yes"
2090 curl_ssl_msg="enabled (CyaSSL)"
2091 ])
2092 fi
2093
2094 addld=""
2095 addlib=""
2096 addcflags=""
2097 cyassllib=""
2098
2099 if test "x$USE_CYASSL" != "xyes"; then
2100 dnl add the path and test again
2101 addld=-L$OPT_CYASSL/lib$libsuff
2102 addcflags=-I$OPT_CYASSL/include
2103 cyassllib=$OPT_CYASSL/lib$libsuff
2104
2105 LDFLAGS="$LDFLAGS $addld"
2106 if test "$addcflags" != "-I/usr/include"; then
2107 CPPFLAGS="$CPPFLAGS $addcflags"
2108 fi
2109
2110 AC_CHECK_LIB(cyassl, CyaSSL_Init,
2111 [
2112 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2113 AC_SUBST(USE_CYASSL, [1])
2114 CYASSL_ENABLED=1
2115 USE_CYASSL="yes"
2116 curl_ssl_msg="enabled (CyaSSL)"
2117 ],
2118 [
2119 CPPFLAGS=$_cppflags
2120 LDFLAGS=$_ldflags
2121 cyassllib=""
2122 ])
2123 fi
2124
2125 addld=""
2126 addlib=""
2127 addcflags=""
2128
2129 if test "x$USE_CYASSL" != "xyes"; then
2130 dnl libcyassl renamed to libwolfssl as of 3.4.0
2131 addld=-L$OPT_CYASSL/lib$libsuff
2132 addcflags=-I$OPT_CYASSL/include
2133 cyassllib=$OPT_CYASSL/lib$libsuff
2134
2135 LDFLAGS="$LDFLAGS $addld"
2136 if test "$addcflags" != "-I/usr/include"; then
2137 CPPFLAGS="$CPPFLAGS $addcflags"
2138 fi
2139
2140 cyassllibname=wolfssl
2141 my_ac_save_LIBS="$LIBS"
2142 LIBS="-l$cyassllibname -lm $LIBS"
2143
2144 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2145 AC_LINK_IFELSE([
2146 AC_LANG_PROGRAM([[
2147/* These aren't needed for detection and confuse WolfSSL.
2148 They are set up properly later if it is detected. */
2149#undef SIZEOF_LONG
2150#undef SIZEOF_LONG_LONG
2151#include <cyassl/ssl.h>
2152 ]],[[
2153 return CyaSSL_Init();
2154 ]])
2155 ],[
2156 AC_MSG_RESULT(yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07002157 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002158 AC_SUBST(USE_CYASSL, [1])
2159 CYASSL_ENABLED=1
2160 USE_CYASSL="yes"
Alex Deymod15eaac2016-06-28 14:49:26 -07002161 curl_ssl_msg="enabled (WolfSSL)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002162 ],
2163 [
2164 AC_MSG_RESULT(no)
2165 CPPFLAGS=$_cppflags
2166 LDFLAGS=$_ldflags
2167 cyassllib=""
2168 ])
2169 LIBS="$my_ac_save_LIBS"
2170 fi
2171
2172 if test "x$USE_CYASSL" = "xyes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07002173 AC_MSG_NOTICE([detected $cyassllibname])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002174
2175 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2176 AC_CHECK_SIZEOF(long long)
2177
2178 dnl Versions since at least 2.6.0 may have options.h
2179 AC_CHECK_HEADERS(cyassl/options.h)
2180
2181 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2182 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2183
2184 LIBS="-l$cyassllibname -lm $LIBS"
2185
Alex Deymod15eaac2016-06-28 14:49:26 -07002186 if test "x$cyassllibname" = "xwolfssl"; then
2187 dnl Recent WolfSSL versions build without SSLv3 by default
2188 dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
2189 AC_CHECK_FUNCS(wolfSSLv3_client_method \
2190 wolfSSL_CTX_UseSupportedCurve \
2191 wolfSSL_get_peer_certificate \
2192 wolfSSL_UseALPN)
2193 else
2194 dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
2195 AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
2196 CyaSSL_get_peer_certificate)
2197 fi
2198
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002199 if test -n "$cyassllib"; then
2200 dnl when shared libs were found in a path that the run-time
2201 dnl linker doesn't search through, we need to add it to
2202 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2203 dnl due to this
2204 if test "x$cross_compiling" != "xyes"; then
2205 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
2206 export LD_LIBRARY_PATH
2207 AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
2208 fi
2209 fi
2210
2211 fi
2212
2213 fi dnl CyaSSL not disabled
2214
2215fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002216
2217dnl ----------------------------------------------------
2218dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2219dnl ----------------------------------------------------
2220
2221dnl Default to compiler & linker defaults for NSS files & libraries.
2222OPT_NSS=no
2223
2224AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002225AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002226AC_HELP_STRING([--without-nss], [disable NSS detection]),
2227 OPT_NSS=$withval)
2228
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002229if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002230
2231 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002232
2233 addld=""
2234 addlib=""
2235 addcflags=""
2236 nssprefix=""
2237 version=""
2238
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002239 if test "x$OPT_NSS" = "xyes"; then
2240
2241 CURL_CHECK_PKGCONFIG(nss)
2242
2243 if test "$PKGCONFIG" != "no" ; then
2244 addlib=`$PKGCONFIG --libs nss`
2245 addcflags=`$PKGCONFIG --cflags nss`
2246 version=`$PKGCONFIG --modversion nss`
2247 nssprefix=`$PKGCONFIG --variable=prefix nss`
2248 else
2249 dnl Without pkg-config, we check for nss-config
2250
2251 check=`nss-config --version 2>/dev/null`
2252 if test -n "$check"; then
2253 addlib=`nss-config --libs`
2254 addcflags=`nss-config --cflags`
2255 version=`nss-config --version`
2256 nssprefix=`nss-config --prefix`
2257 else
2258 addlib="-lnss3"
2259 addcflags=""
2260 version="unknown"
2261 fi
2262 fi
2263 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002264 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2265 if test -f "$NSS_PCDIR/nss.pc"; then
2266 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2267 if test "$PKGCONFIG" != "no" ; then
2268 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2269 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2270 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2271 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2272 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2273 fi
2274 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002275 fi
2276
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002277 if test -z "$addlib"; then
2278 # Without pkg-config, we'll kludge in some defaults
2279 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2280 addld="-L$OPT_NSS/lib"
2281 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2282 addcflags="-I$OPT_NSS/include"
2283 version="unknown"
2284 nssprefix=$OPT_NSS
2285 fi
2286
2287 CLEANLDFLAGS="$LDFLAGS"
2288 CLEANLIBS="$LIBS"
2289 CLEANCPPFLAGS="$CPPFLAGS"
2290
2291 LDFLAGS="$addld $LDFLAGS"
2292 LIBS="$addlib $LIBS"
2293 if test "$addcflags" != "-I/usr/include"; then
2294 CPPFLAGS="$CPPFLAGS $addcflags"
2295 fi
2296
2297 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2298 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002299 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002300 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2301 AC_SUBST(USE_NSS, [1])
2302 USE_NSS="yes"
2303 NSS_ENABLED=1
2304 curl_ssl_msg="enabled (NSS)"
2305 ],
2306 [
2307 LDFLAGS="$CLEANLDFLAGS"
2308 LIBS="$CLEANLIBS"
2309 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002310 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002311
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002312 if test "x$USE_NSS" = "xyes"; then
2313 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002314
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002315 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2316 NSS_LIBS=$addlib
2317 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002318
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002319 dnl when shared libs were found in a path that the run-time
2320 dnl linker doesn't search through, we need to add it to
2321 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2322 dnl due to this
2323 if test "x$cross_compiling" != "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002324 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2325 export LD_LIBRARY_PATH
2326 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2327 fi
2328
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002329 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002330
2331 fi dnl NSS not disabled
2332
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002333fi dnl curl_ssl_msg = init_ssl_msg
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002334
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002335OPT_AXTLS=off
2336
2337AC_ARG_WITH(axtls,dnl
2338AC_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.])
2339AC_HELP_STRING([--without-axtls], [disable axTLS]),
2340 OPT_AXTLS=$withval)
2341
2342if test "$curl_ssl_msg" = "$init_ssl_msg"; then
2343 if test X"$OPT_AXTLS" != Xno; then
2344 dnl backup the pre-axtls variables
2345 CLEANLDFLAGS="$LDFLAGS"
2346 CLEANCPPFLAGS="$CPPFLAGS"
2347 CLEANLIBS="$LIBS"
2348
2349 case "$OPT_AXTLS" in
2350 yes)
2351 dnl --with-axtls (without path) used
2352 PREFIX_AXTLS=/usr/local
2353 LIB_AXTLS="$PREFIX_AXTLS/lib"
2354 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2355 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2356 ;;
2357 off)
2358 dnl no --with-axtls option given, just check default places
2359 PREFIX_AXTLS=
2360 ;;
2361 *)
2362 dnl check the given --with-axtls spot
2363 PREFIX_AXTLS=$OPT_AXTLS
2364 LIB_AXTLS="$PREFIX_AXTLS/lib"
2365 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2366 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2367 ;;
2368 esac
2369
2370 AC_CHECK_LIB(axtls, ssl_version,[
2371 LIBS="-laxtls $LIBS"
2372 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2373 AC_SUBST(USE_AXTLS, [1])
2374 AXTLS_ENABLED=1
2375 USE_AXTLS="yes"
2376 curl_ssl_msg="enabled (axTLS)"
2377
2378 if test "x$cross_compiling" != "xyes"; then
2379 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2380 export LD_LIBRARY_PATH
2381 AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2382 fi
2383 ],[
2384 LDFLAGS="$CLEANLDFLAGS"
2385 CPPFLAGS="$CLEANCPPFLAGS"
2386 LIBS="$CLEANLIBS"
2387 ])
2388 fi
2389fi
2390
Alex Deymod15eaac2016-06-28 14:49:26 -07002391if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002392 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002393 AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002394else
2395 # SSL is enabled, genericly
2396 AC_SUBST(SSL_ENABLED)
2397 SSL_ENABLED="1"
2398fi
2399
2400dnl **********************************************************************
2401dnl Check for the CA bundle
2402dnl **********************************************************************
2403
2404CURL_CHECK_CA_BUNDLE
2405
2406dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07002407dnl Check for libpsl
2408dnl **********************************************************************
2409
2410AC_ARG_WITH(libpsl,
2411 AS_HELP_STRING([--without-libpsl],
2412 [disable support for libpsl cookie checking]),
2413 with_libpsl=$withval,
2414 with_libpsl=yes)
2415if test $with_libpsl != "no"; then
2416 AC_SEARCH_LIBS(psl_builtin, psl,
2417 [curl_psl_msg="yes";
2418 AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
2419 ],
2420 [curl_psl_msg="no (libpsl not found)";
2421 AC_MSG_WARN([libpsl was not found])
2422 ]
2423 )
2424fi
2425AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
2426
2427dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002428dnl Check for libmetalink
2429dnl **********************************************************************
2430
2431OPT_LIBMETALINK=no
2432
2433AC_ARG_WITH(libmetalink,dnl
2434AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2435AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2436 OPT_LIBMETALINK=$withval)
2437
2438if test X"$OPT_LIBMETALINK" != Xno; then
2439
2440 addld=""
2441 addlib=""
2442 addcflags=""
2443 version=""
2444 libmetalinklib=""
2445
2446 PKGTEST="no"
2447 if test "x$OPT_LIBMETALINK" = "xyes"; then
2448 dnl this is with no partiular path given
2449 PKGTEST="yes"
2450 CURL_CHECK_PKGCONFIG(libmetalink)
2451 else
2452 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2453 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2454 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2455 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2456 PKGTEST="yes"
2457 fi
2458 if test "$PKGTEST" = "yes"; then
2459 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2460 fi
2461 fi
2462 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2463 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2464 $PKGCONFIG --libs-only-l libmetalink`
2465 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2466 $PKGCONFIG --libs-only-L libmetalink`
2467 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2468 $PKGCONFIG --cflags-only-I libmetalink`
2469 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2470 $PKGCONFIG --modversion libmetalink`
2471 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2472 fi
2473 if test -n "$addlib"; then
2474
2475 clean_CPPFLAGS="$CPPFLAGS"
2476 clean_LDFLAGS="$LDFLAGS"
2477 clean_LIBS="$LIBS"
2478 CPPFLAGS="$addcflags $clean_CPPFLAGS"
2479 LDFLAGS="$addld $clean_LDFLAGS"
2480 LIBS="$addlib $clean_LIBS"
2481 AC_MSG_CHECKING([if libmetalink is recent enough])
2482 AC_LINK_IFELSE([
2483 AC_LANG_PROGRAM([[
2484# include <metalink/metalink.h>
2485 ]],[[
2486 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2487 return 1;
2488 ]])
2489 ],[
2490 AC_MSG_RESULT([yes ($version)])
2491 want_metalink="yes"
2492 ],[
2493 AC_MSG_RESULT([no ($version)])
2494 AC_MSG_NOTICE([libmetalink library defective or too old])
2495 want_metalink="no"
2496 ])
2497 CPPFLAGS="$clean_CPPFLAGS"
2498 LDFLAGS="$clean_LDFLAGS"
2499 LIBS="$clean_LIBS"
2500 if test "$want_metalink" = "yes"; then
2501 dnl finally libmetalink will be used
2502 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2503 LIBMETALINK_LIBS=$addlib
2504 LIBMETALINK_LDFLAGS=$addld
2505 LIBMETALINK_CPPFLAGS=$addcflags
2506 AC_SUBST([LIBMETALINK_LIBS])
2507 AC_SUBST([LIBMETALINK_LDFLAGS])
2508 AC_SUBST([LIBMETALINK_CPPFLAGS])
2509 curl_mtlnk_msg="enabled"
2510 fi
2511
2512 fi
2513fi
2514
2515dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002516dnl Check for the presence of LIBSSH2 libraries and headers
2517dnl **********************************************************************
2518
2519dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2520OPT_LIBSSH2=off
2521AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002522AC_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 -07002523AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2524 OPT_LIBSSH2=$withval)
2525
2526if test X"$OPT_LIBSSH2" != Xno; then
2527 dnl backup the pre-libssh2 variables
2528 CLEANLDFLAGS="$LDFLAGS"
2529 CLEANCPPFLAGS="$CPPFLAGS"
2530 CLEANLIBS="$LIBS"
2531
2532 case "$OPT_LIBSSH2" in
2533 yes)
2534 dnl --with-libssh2 (without path) used
2535 CURL_CHECK_PKGCONFIG(libssh2)
2536
2537 if test "$PKGCONFIG" != "no" ; then
2538 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2539 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2540 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2541 version=`$PKGCONFIG --modversion libssh2`
2542 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2543 fi
2544
2545 ;;
2546 off)
2547 dnl no --with-libssh2 option given, just check default places
2548 ;;
2549 *)
2550 dnl use the given --with-libssh2 spot
2551 PREFIX_SSH2=$OPT_LIBSSH2
2552 ;;
2553 esac
2554
2555 dnl if given with a prefix, we set -L and -I based on that
2556 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002557 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002558 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2559 CPP_SSH2=-I${PREFIX_SSH2}/include
2560 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2561 fi
2562
2563 LDFLAGS="$LDFLAGS $LD_SSH2"
2564 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002565 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002566
2567 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2568
2569 AC_CHECK_HEADERS(libssh2.h,
2570 curl_ssh_msg="enabled (libSSH2)"
2571 LIBSSH2_ENABLED=1
2572 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2573 AC_SUBST(USE_LIBSSH2, [1])
2574 )
2575
2576 if test X"$OPT_LIBSSH2" != Xoff &&
2577 test "$LIBSSH2_ENABLED" != "1"; then
2578 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2579 fi
2580
2581 if test "$LIBSSH2_ENABLED" = "1"; then
2582 if test -n "$DIR_SSH2"; then
2583 dnl when the libssh2 shared libs were found in a path that the run-time
2584 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2585 dnl to prevent further configure tests to fail due to this
2586
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002587 if test "x$cross_compiling" != "xyes"; then
2588 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2589 export LD_LIBRARY_PATH
2590 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2591 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002592 fi
2593 else
2594 dnl no libssh2, revert back to clean variables
2595 LDFLAGS=$CLEANLDFLAGS
2596 CPPFLAGS=$CLEANCPPFLAGS
2597 LIBS=$CLEANLIBS
2598 fi
2599fi
2600
2601dnl **********************************************************************
2602dnl Check for the presence of LIBRTMP libraries and headers
2603dnl **********************************************************************
2604
2605dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2606OPT_LIBRTMP=off
2607AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002608AC_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 -07002609AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2610 OPT_LIBRTMP=$withval)
2611
2612if test X"$OPT_LIBRTMP" != Xno; then
2613 dnl backup the pre-librtmp variables
2614 CLEANLDFLAGS="$LDFLAGS"
2615 CLEANCPPFLAGS="$CPPFLAGS"
2616 CLEANLIBS="$LIBS"
2617
2618 case "$OPT_LIBRTMP" in
2619 yes)
2620 dnl --with-librtmp (without path) used
2621 CURL_CHECK_PKGCONFIG(librtmp)
2622
2623 if test "$PKGCONFIG" != "no" ; then
2624 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2625 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2626 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2627 version=`$PKGCONFIG --modversion librtmp`
2628 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002629 else
2630 dnl To avoid link errors, we do not allow --librtmp without
2631 dnl a pkgconfig file
2632 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002633 fi
2634
2635 ;;
2636 off)
2637 dnl no --with-librtmp option given, just check default places
2638 LIB_RTMP="-lrtmp"
2639 ;;
2640 *)
2641 dnl use the given --with-librtmp spot
2642 PREFIX_RTMP=$OPT_LIBRTMP
2643 ;;
2644 esac
2645
2646 dnl if given with a prefix, we set -L and -I based on that
2647 if test -n "$PREFIX_RTMP"; then
2648 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2649 CPP_RTMP=-I${PREFIX_RTMP}/include
2650 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2651 fi
2652
2653 LDFLAGS="$LDFLAGS $LD_RTMP"
2654 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002655 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002656
2657 AC_CHECK_LIB(rtmp, RTMP_Init,
2658 [
2659 AC_CHECK_HEADERS(librtmp/rtmp.h,
2660 curl_rtmp_msg="enabled (librtmp)"
2661 LIBRTMP_ENABLED=1
2662 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2663 AC_SUBST(USE_LIBRTMP, [1])
2664 )
2665 ],
2666 dnl not found, revert back to clean variables
2667 LDFLAGS=$CLEANLDFLAGS
2668 CPPFLAGS=$CLEANCPPFLAGS
2669 LIBS=$CLEANLIBS
2670 )
2671
2672 if test X"$OPT_LIBRTMP" != Xoff &&
2673 test "$LIBRTMP_ENABLED" != "1"; then
2674 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2675 fi
2676
2677fi
2678
2679dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002680dnl Check for linker switch for versioned symbols
2681dnl **********************************************************************
2682
2683versioned_symbols_flavour=
2684AC_MSG_CHECKING([whether versioned symbols are wanted])
2685AC_ARG_ENABLE(versioned-symbols,
2686AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2687AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2688[ case "$enableval" in
2689 yes) AC_MSG_RESULT(yes)
2690 AC_MSG_CHECKING([if libraries can be versioned])
2691 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2692 if test -z "$GLD"; then
2693 AC_MSG_RESULT(no)
2694 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2695 else
2696 AC_MSG_RESULT(yes)
2697 if test "x$OPENSSL_ENABLED" = "x1"; then
2698 versioned_symbols_flavour="OPENSSL_"
2699 elif test "x$GNUTLS_ENABLED" = "x1"; then
2700 versioned_symbols_flavour="GNUTLS_"
2701 elif test "x$NSS_ENABLED" = "x1"; then
2702 versioned_symbols_flavour="NSS_"
2703 elif test "x$POLARSSL_ENABLED" = "x1"; then
2704 versioned_symbols_flavour="POLARSSL_"
2705 elif test "x$CYASSL_ENABLED" = "x1"; then
2706 versioned_symbols_flavour="CYASSL_"
2707 elif test "x$AXTLS_ENABLED" = "x1"; then
2708 versioned_symbols_flavour="AXTLS_"
2709 elif test "x$WINSSL_ENABLED" = "x1"; then
2710 versioned_symbols_flavour="WINSSL_"
2711 elif test "x$DARWINSSL_ENABLED" = "x1"; then
2712 versioned_symbols_flavour="DARWINSSL_"
2713 else
2714 versioned_symbols_flavour=""
2715 fi
2716 versioned_symbols="yes"
2717 fi
2718 ;;
2719
2720 *) AC_MSG_RESULT(no)
2721 ;;
2722 esac
2723], [
2724AC_MSG_RESULT(no)
2725]
2726)
2727
2728AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2729 ["$versioned_symbols_flavour"])
2730AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2731 [test "x$versioned_symbols" = 'xyes'])
2732
2733dnl -------------------------------------------------
2734dnl check winidn option before other IDN libraries
2735dnl -------------------------------------------------
2736
2737AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2738OPT_WINIDN="default"
2739AC_ARG_WITH(winidn,
2740AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2741AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
2742 OPT_WINIDN=$withval)
2743case "$OPT_WINIDN" in
2744 no|default)
2745 dnl --without-winidn option used or configure option not specified
2746 want_winidn="no"
2747 AC_MSG_RESULT([no])
2748 ;;
2749 yes)
2750 dnl --with-winidn option used without path
2751 want_winidn="yes"
2752 want_winidn_path="default"
2753 AC_MSG_RESULT([yes])
2754 ;;
2755 *)
2756 dnl --with-winidn option used with path
2757 want_winidn="yes"
2758 want_winidn_path="$withval"
2759 AC_MSG_RESULT([yes ($withval)])
2760 ;;
2761esac
2762
2763if test "$want_winidn" = "yes"; then
2764 dnl winidn library support has been requested
2765 clean_CPPFLAGS="$CPPFLAGS"
2766 clean_LDFLAGS="$LDFLAGS"
2767 clean_LIBS="$LIBS"
2768 WINIDN_LIBS="-lnormaliz"
2769 #
2770 if test "$want_winidn_path" != "default"; then
2771 dnl path has been specified
2772 dnl pkg-config not available or provides no info
2773 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2774 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2775 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2776 fi
2777 #
2778 CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
2779 LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
2780 LIBS="$WINIDN_LIBS $LIBS"
2781 #
2782 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2783 AC_LINK_IFELSE([
2784 AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
2785 ],[
2786 AC_MSG_RESULT([yes])
2787 tst_links_winidn="yes"
2788 ],[
2789 AC_MSG_RESULT([no])
2790 tst_links_winidn="no"
2791 ])
2792 #
2793 if test "$tst_links_winidn" = "yes"; then
2794 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2795 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
2796 AC_SUBST([IDN_ENABLED], [1])
2797 curl_idn_msg="enabled (Windows-native)"
2798 else
2799 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2800 CPPFLAGS="$clean_CPPFLAGS"
2801 LDFLAGS="$clean_LDFLAGS"
2802 LIBS="$clean_LIBS"
2803 fi
2804fi
2805
2806dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002807dnl Check for the presence of IDN libraries and headers
2808dnl **********************************************************************
2809
2810AC_MSG_CHECKING([whether to build with libidn])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002811OPT_IDN="default"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002812AC_ARG_WITH(libidn,
2813AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
2814AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002815 [OPT_IDN=$withval])
2816case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002817 no)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002818 dnl --without-libidn option used
2819 want_idn="no"
2820 AC_MSG_RESULT([no])
2821 ;;
2822 default)
2823 dnl configure option not specified
2824 want_idn="yes"
2825 want_idn_path="default"
2826 AC_MSG_RESULT([(assumed) yes])
2827 ;;
2828 yes)
2829 dnl --with-libidn option used without path
2830 want_idn="yes"
2831 want_idn_path="default"
2832 AC_MSG_RESULT([yes])
2833 ;;
2834 *)
2835 dnl --with-libidn option used with path
2836 want_idn="yes"
2837 want_idn_path="$withval"
2838 AC_MSG_RESULT([yes ($withval)])
2839 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002840esac
2841
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002842if test "$want_idn" = "yes"; then
2843 dnl idn library support has been requested
2844 clean_CPPFLAGS="$CPPFLAGS"
2845 clean_LDFLAGS="$LDFLAGS"
2846 clean_LIBS="$LIBS"
2847 PKGCONFIG="no"
2848 #
2849 if test "$want_idn_path" != "default"; then
2850 dnl path has been specified
2851 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
2852 CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
2853 if test "$PKGCONFIG" != "no"; then
2854 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2855 $PKGCONFIG --libs-only-l libidn 2>/dev/null`
2856 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2857 $PKGCONFIG --libs-only-L libidn 2>/dev/null`
2858 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2859 $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2860 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2861 else
2862 dnl pkg-config not available or provides no info
2863 IDN_LIBS="-lidn"
2864 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
2865 IDN_CPPFLAGS="-I$want_idn_path/include"
2866 IDN_DIR="$want_idn_path/lib$libsuff"
2867 fi
2868 else
2869 dnl path not specified
2870 CURL_CHECK_PKGCONFIG(libidn)
2871 if test "$PKGCONFIG" != "no"; then
2872 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
2873 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
2874 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2875 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2876 else
2877 dnl pkg-config not available or provides no info
2878 IDN_LIBS="-lidn"
2879 fi
2880 fi
2881 #
2882 if test "$PKGCONFIG" != "no"; then
2883 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
2884 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
2885 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2886 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
2887 else
2888 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
2889 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
2890 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2891 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
2892 fi
2893 #
2894 CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
2895 LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
2896 LIBS="$IDN_LIBS $LIBS"
2897 #
2898 AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
2899 AC_LINK_IFELSE([
2900 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
2901 ],[
2902 AC_MSG_RESULT([yes])
2903 tst_links_libidn="yes"
2904 ],[
2905 AC_MSG_RESULT([no])
2906 tst_links_libidn="no"
2907 ])
2908 if test "$tst_links_libidn" = "no"; then
2909 AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
2910 AC_LINK_IFELSE([
2911 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
2912 ],[
2913 AC_MSG_RESULT([yes])
2914 tst_links_libidn="yes"
2915 ],[
2916 AC_MSG_RESULT([no])
2917 tst_links_libidn="no"
2918 ])
2919 fi
2920 #
2921 if test "$tst_links_libidn" = "yes"; then
2922 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
2923 dnl different versions of libidn have different setups of these:
2924 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
2925 AC_CHECK_HEADERS( idn-free.h tld.h )
2926 if test "x$ac_cv_header_tld_h" = "xyes"; then
2927 AC_SUBST([IDN_ENABLED], [1])
2928 curl_idn_msg="enabled"
2929 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
2930 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
2931 export LD_LIBRARY_PATH
2932 AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
2933 fi
2934 else
2935 AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
2936 CPPFLAGS="$clean_CPPFLAGS"
2937 LDFLAGS="$clean_LDFLAGS"
2938 LIBS="$clean_LIBS"
2939 fi
2940 else
2941 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2942 CPPFLAGS="$clean_CPPFLAGS"
2943 LDFLAGS="$clean_LDFLAGS"
2944 LIBS="$clean_LIBS"
2945 fi
2946fi
2947
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002948
2949dnl Let's hope this split URL remains working:
2950dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
2951dnl genprogc/thread_quick_ref.htm
2952
2953
2954dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002955dnl Check for nghttp2
2956dnl **********************************************************************
2957
2958OPT_H2="yes"
2959AC_ARG_WITH(nghttp2,
2960AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
2961AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
2962 [OPT_H2=$withval])
2963case "$OPT_H2" in
2964 no)
2965 dnl --without-nghttp2 option used
2966 want_h2="no"
2967 ;;
2968 yes)
2969 dnl --with-nghttp2 option used without path
2970 want_h2="default"
2971 want_h2_path=""
2972 ;;
2973 *)
2974 dnl --with-nghttp2 option used with path
2975 want_h2="yes"
2976 want_h2_path="$withval/lib/pkgconfig"
2977 ;;
2978esac
2979
2980curl_h2_msg="disabled (--with-nghttp2)"
2981if test X"$want_h2" != Xno; then
2982 dnl backup the pre-nghttp2 variables
2983 CLEANLDFLAGS="$LDFLAGS"
2984 CLEANCPPFLAGS="$CPPFLAGS"
2985 CLEANLIBS="$LIBS"
2986
2987 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
2988
2989 if test "$PKGCONFIG" != "no" ; then
2990 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2991 $PKGCONFIG --libs-only-l libnghttp2`
2992 AC_MSG_NOTICE([-l is $LIB_H2])
2993
2994 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
2995 $PKGCONFIG --cflags-only-I libnghttp2`
2996 AC_MSG_NOTICE([-I is $CPP_H2])
2997
2998 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2999 $PKGCONFIG --libs-only-L libnghttp2`
3000 AC_MSG_NOTICE([-L is $LD_H2])
3001
3002 LDFLAGS="$LDFLAGS $LD_H2"
3003 CPPFLAGS="$CPPFLAGS $CPP_H2"
3004 LIBS="$LIB_H2 $LIBS"
3005
3006 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
3007 # >= 1.0.0
3008 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
3009 [
3010 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
3011 curl_h2_msg="enabled (nghttp2)"
3012 NGHTTP2_ENABLED=1
3013 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
3014 AC_SUBST(USE_NGHTTP2, [1])
3015 )
3016 ],
3017 dnl not found, revert back to clean variables
3018 LDFLAGS=$CLEANLDFLAGS
3019 CPPFLAGS=$CLEANCPPFLAGS
3020 LIBS=$CLEANLIBS
3021 )
3022
3023 else
3024 dnl no nghttp2 pkg-config found, deal with it
3025 if test X"$want_h2" != Xdefault; then
3026 dnl To avoid link errors, we do not allow --with-nghttp2 without
3027 dnl a pkgconfig file
3028 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
3029 fi
3030 fi
3031
3032fi
3033
3034dnl **********************************************************************
Alex Deymod15eaac2016-06-28 14:49:26 -07003035dnl Check for zsh completion path
3036dnl **********************************************************************
3037
3038OPT_ZSH_FPATH=default
3039AC_ARG_WITH(zsh-functions-dir,
3040AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
3041AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
3042 [OPT_ZSH_FPATH=$withval])
3043case "$OPT_ZSH_FPATH" in
3044 no)
3045 dnl --without-zsh-functions-dir option used
3046 ;;
3047 default|yes)
3048 dnl --with-zsh-functions-dir option used without path
3049 ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
3050 AC_SUBST(ZSH_FUNCTIONS_DIR)
3051 ;;
3052 *)
3053 dnl --with-zsh-functions-dir option used with path
3054 ZSH_FUNCTIONS_DIR="$withval"
3055 AC_SUBST(ZSH_FUNCTIONS_DIR)
3056 ;;
3057esac
3058
3059dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003060dnl Back to "normal" configuring
3061dnl **********************************************************************
3062
3063dnl Checks for header files.
3064AC_HEADER_STDC
3065
3066CURL_CHECK_HEADER_MALLOC
3067CURL_CHECK_HEADER_MEMORY
3068
3069dnl Now check for the very most basic headers. Then we can use these
3070dnl ones as default-headers when checking for the rest!
3071AC_CHECK_HEADERS(
3072 sys/types.h \
3073 sys/time.h \
3074 sys/select.h \
3075 sys/socket.h \
3076 sys/ioctl.h \
3077 sys/uio.h \
3078 assert.h \
3079 unistd.h \
3080 stdlib.h \
3081 limits.h \
3082 arpa/inet.h \
3083 net/if.h \
3084 netinet/in.h \
3085 sys/un.h \
3086 netinet/tcp.h \
3087 netdb.h \
3088 sys/sockio.h \
3089 sys/stat.h \
3090 sys/param.h \
3091 termios.h \
3092 termio.h \
3093 sgtty.h \
3094 fcntl.h \
3095 alloca.h \
3096 time.h \
3097 io.h \
3098 pwd.h \
3099 utime.h \
3100 sys/utime.h \
3101 sys/poll.h \
3102 poll.h \
3103 socket.h \
3104 sys/resource.h \
3105 libgen.h \
3106 locale.h \
3107 errno.h \
3108 stdbool.h \
3109 arpa/tftp.h \
3110 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003111 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003112 setjmp.h,
3113dnl to do if not found
3114[],
3115dnl to do if found
3116[],
3117dnl default includes
3118[
3119#ifdef HAVE_SYS_TYPES_H
3120#include <sys/types.h>
3121#endif
3122#ifdef HAVE_SYS_TIME_H
3123#include <sys/time.h>
3124#endif
3125#ifdef HAVE_SYS_SELECT_H
3126#include <sys/select.h>
3127#endif
3128#ifdef HAVE_SYS_SOCKET_H
3129#include <sys/socket.h>
3130#endif
3131#ifdef HAVE_NETINET_IN_H
3132#include <netinet/in.h>
3133#endif
3134#ifdef HAVE_SYS_UN_H
3135#include <sys/un.h>
3136#endif
3137]
3138)
3139
3140dnl Checks for typedefs, structures, and compiler characteristics.
3141AC_C_CONST
3142CURL_CHECK_VARIADIC_MACROS
3143AC_TYPE_SIZE_T
3144AC_HEADER_TIME
3145CURL_CHECK_STRUCT_TIMEVAL
3146CURL_VERIFY_RUNTIMELIBS
3147
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003148AC_CHECK_SIZEOF(off_t)
3149
3150soname_bump=no
Alex Deymod15eaac2016-06-28 14:49:26 -07003151if test x"$curl_cv_native_windows" != "xyes" &&
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003152 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
3153 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
3154 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
3155 soname_bump=yes
3156fi
3157
3158
3159AC_CHECK_TYPE(long long,
3160 [AC_DEFINE(HAVE_LONGLONG, 1,
3161 [Define to 1 if the compiler supports the 'long long' data type.])]
3162 longlong="yes"
3163)
3164
3165if test "xyes" = "x$longlong"; then
3166 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003167 AC_COMPILE_IFELSE([
3168 AC_LANG_PROGRAM([[
3169 ]],[[
3170 long long val = 1000LL;
3171 ]])
3172 ],[
3173 AC_MSG_RESULT([yes])
3174 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3175 ],[
3176 AC_MSG_RESULT([no])
3177 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003178fi
3179
3180
3181# check for ssize_t
3182AC_CHECK_TYPE(ssize_t, ,
3183 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3184
3185# check for bool type
3186AC_CHECK_TYPE([bool],[
3187 AC_DEFINE(HAVE_BOOL_T, 1,
3188 [Define to 1 if bool is an available type.])
3189], ,[
3190#ifdef HAVE_SYS_TYPES_H
3191#include <sys/types.h>
3192#endif
3193#ifdef HAVE_STDBOOL_H
3194#include <stdbool.h>
3195#endif
3196])
3197
3198CURL_CONFIGURE_CURL_SOCKLEN_T
3199
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003200CURL_CONFIGURE_PULL_SYS_POLL
3201
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003202TYPE_IN_ADDR_T
3203
3204TYPE_SOCKADDR_STORAGE
3205
3206TYPE_SIG_ATOMIC_T
3207
3208AC_TYPE_SIGNAL
3209
3210CURL_CHECK_FUNC_SELECT
3211
3212CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003213CURL_CHECK_FUNC_SEND
3214CURL_CHECK_MSG_NOSIGNAL
3215
3216CURL_CHECK_FUNC_ALARM
3217CURL_CHECK_FUNC_BASENAME
3218CURL_CHECK_FUNC_CLOSESOCKET
3219CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3220CURL_CHECK_FUNC_CONNECT
3221CURL_CHECK_FUNC_FCNTL
3222CURL_CHECK_FUNC_FDOPEN
3223CURL_CHECK_FUNC_FREEADDRINFO
3224CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003225CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003226CURL_CHECK_FUNC_FTRUNCATE
3227CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003228CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003229CURL_CHECK_FUNC_GETHOSTBYADDR
3230CURL_CHECK_FUNC_GETHOSTBYADDR_R
3231CURL_CHECK_FUNC_GETHOSTBYNAME
3232CURL_CHECK_FUNC_GETHOSTBYNAME_R
3233CURL_CHECK_FUNC_GETHOSTNAME
3234CURL_CHECK_FUNC_GETIFADDRS
3235CURL_CHECK_FUNC_GETSERVBYPORT_R
3236CURL_CHECK_FUNC_GMTIME_R
3237CURL_CHECK_FUNC_INET_NTOA_R
3238CURL_CHECK_FUNC_INET_NTOP
3239CURL_CHECK_FUNC_INET_PTON
3240CURL_CHECK_FUNC_IOCTL
3241CURL_CHECK_FUNC_IOCTLSOCKET
3242CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3243CURL_CHECK_FUNC_LOCALTIME_R
3244CURL_CHECK_FUNC_MEMRCHR
3245CURL_CHECK_FUNC_POLL
3246CURL_CHECK_FUNC_SETSOCKOPT
3247CURL_CHECK_FUNC_SIGACTION
3248CURL_CHECK_FUNC_SIGINTERRUPT
3249CURL_CHECK_FUNC_SIGNAL
3250CURL_CHECK_FUNC_SIGSETJMP
3251CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003252CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003253CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003254CURL_CHECK_FUNC_STRCMPI
3255CURL_CHECK_FUNC_STRDUP
3256CURL_CHECK_FUNC_STRERROR_R
3257CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003258CURL_CHECK_FUNC_STRNCASECMP
3259CURL_CHECK_FUNC_STRNCMPI
3260CURL_CHECK_FUNC_STRNICMP
3261CURL_CHECK_FUNC_STRSTR
3262CURL_CHECK_FUNC_STRTOK_R
3263CURL_CHECK_FUNC_STRTOLL
3264CURL_CHECK_FUNC_WRITEV
3265
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003266case $host in
3267 *msdosdjgpp)
3268 ac_cv_func_pipe=no
3269 skipcheck_pipe=yes
3270 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3271 ;;
3272esac
3273
3274AC_CHECK_FUNCS([fork \
3275 geteuid \
3276 getpass_r \
3277 getppid \
3278 getprotobyname \
3279 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003280 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003281 getrlimit \
3282 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003283 if_nametoindex \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003284 inet_addr \
3285 perror \
3286 pipe \
3287 setlocale \
3288 setmode \
3289 setrlimit \
3290 uname \
3291 utime
3292],[
3293],[
3294 func="$ac_func"
3295 eval skipcheck=\$skipcheck_$func
3296 if test "x$skipcheck" != "xyes"; then
3297 AC_MSG_CHECKING([deeper for $func])
3298 AC_LINK_IFELSE([
3299 AC_LANG_PROGRAM([[
3300 ]],[[
3301 $func ();
3302 ]])
3303 ],[
3304 AC_MSG_RESULT([yes])
3305 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003306 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003307 [Define to 1 if you have the $func function.])
3308 ],[
3309 AC_MSG_RESULT([but still no])
3310 ])
3311 fi
3312])
3313
3314dnl Check if the getnameinfo function is available
3315dnl and get the types of five of its arguments.
3316CURL_CHECK_FUNC_GETNAMEINFO
3317
3318if test "$ipv6" = "yes"; then
Alex Deymod15eaac2016-06-28 14:49:26 -07003319 if test "$curl_cv_func_getaddrinfo" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003320 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3321 IPV6_ENABLED=1
3322 AC_SUBST(IPV6_ENABLED)
3323 fi
3324 CURL_CHECK_NI_WITHSCOPEID
3325fi
3326
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003327CURL_CHECK_NONBLOCKING_SOCKET
3328
3329dnl ************************************************************
3330dnl nroff tool stuff
3331dnl
3332
3333AC_PATH_PROG( PERL, perl, ,
3334 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3335AC_SUBST(PERL)
3336
3337AC_PATH_PROGS( NROFF, gnroff nroff, ,
3338 $PATH:/usr/bin/:/usr/local/bin )
3339AC_SUBST(NROFF)
3340
3341if test -n "$NROFF"; then
3342 dnl only check for nroff options if an nroff command was found
3343
3344 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3345 MANOPT="-man"
3346 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3347 if test -z "$mancheck"; then
3348 MANOPT="-mandoc"
3349 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3350 if test -z "$mancheck"; then
3351 MANOPT=""
3352 AC_MSG_RESULT([failed])
3353 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3354 else
3355 AC_MSG_RESULT([$MANOPT])
3356 fi
3357 else
3358 AC_MSG_RESULT([$MANOPT])
3359 fi
3360 AC_SUBST(MANOPT)
3361fi
3362
3363if test -z "$MANOPT"
3364then
3365 dnl if no nroff tool was found, or no option that could convert man pages
3366 dnl was found, then disable the built-in manual stuff
3367 AC_MSG_WARN([disabling built-in manual])
3368 USE_MANUAL="no";
3369fi
3370
3371dnl *************************************************************************
3372dnl If the manual variable still is set, then we go with providing a built-in
3373dnl manual
3374
3375if test "$USE_MANUAL" = "1"; then
3376 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3377 curl_manual_msg="enabled"
3378fi
3379
3380dnl set variable for use in automakefile(s)
3381AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3382
3383CURL_CHECK_LIB_ARES
3384AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3385
Alex Deymod15eaac2016-06-28 14:49:26 -07003386if test "x$curl_cv_native_windows" != "xyes" &&
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003387 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003388 build_libhostname=yes
3389else
3390 build_libhostname=no
3391fi
3392AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3393
3394CURL_CHECK_OPTION_THREADED_RESOLVER
3395
3396if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
3397 AC_MSG_ERROR(
3398[Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
3399fi
3400
Alex Deymod15eaac2016-06-28 14:49:26 -07003401if test "$want_thres" = "yes" && test "$dontwant_rt" = "no"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003402 AC_CHECK_HEADER(pthread.h,
3403 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3404 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003405
3406 dnl first check for function without lib
3407 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3408
3409 dnl if it wasn't found without lib, search for it in pthread lib
3410 if test "$USE_THREADS_POSIX" != "1"
3411 then
3412 CFLAGS="$CFLAGS -pthread"
3413 AC_CHECK_LIB(pthread, pthread_create,
3414 [USE_THREADS_POSIX=1],
3415 [ CFLAGS="$save_CFLAGS"])
3416 fi
3417
3418 if test "x$USE_THREADS_POSIX" = "x1"
3419 then
3420 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3421 curl_res_msg="POSIX threaded"
3422 fi
3423
3424
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003425 ])
3426fi
3427
3428dnl ************************************************************
3429dnl disable verbose text strings
3430dnl
3431AC_MSG_CHECKING([whether to enable verbose strings])
3432AC_ARG_ENABLE(verbose,
3433AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3434AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3435[ case "$enableval" in
3436 no)
3437 AC_MSG_RESULT(no)
3438 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3439 curl_verbose_msg="no"
3440 ;;
3441 *) AC_MSG_RESULT(yes)
3442 ;;
3443 esac ],
3444 AC_MSG_RESULT(yes)
3445)
3446
3447dnl ************************************************************
3448dnl enable SSPI support
3449dnl
3450AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3451AC_ARG_ENABLE(sspi,
3452AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3453AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3454[ case "$enableval" in
3455 yes)
Alex Deymod15eaac2016-06-28 14:49:26 -07003456 if test "$curl_cv_native_windows" = "yes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003457 AC_MSG_RESULT(yes)
3458 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3459 AC_SUBST(USE_WINDOWS_SSPI, [1])
3460 curl_sspi_msg="enabled"
3461 else
3462 AC_MSG_RESULT(no)
3463 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3464 fi
3465 ;;
3466 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003467 if test "x$WINSSL_ENABLED" = "x1"; then
3468 # --with-winssl implies --enable-sspi
3469 AC_MSG_RESULT(yes)
3470 else
3471 AC_MSG_RESULT(no)
3472 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003473 ;;
3474 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003475 if test "x$WINSSL_ENABLED" = "x1"; then
3476 # --with-winssl implies --enable-sspi
3477 AC_MSG_RESULT(yes)
3478 else
3479 AC_MSG_RESULT(no)
3480 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003481)
3482
3483dnl ************************************************************
3484dnl disable cryptographic authentication
3485dnl
3486AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3487AC_ARG_ENABLE(crypto-auth,
3488AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3489AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3490[ case "$enableval" in
3491 no)
3492 AC_MSG_RESULT(no)
3493 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003494 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003495 ;;
3496 *) AC_MSG_RESULT(yes)
3497 ;;
3498 esac ],
3499 AC_MSG_RESULT(yes)
3500)
3501
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003502CURL_CHECK_OPTION_NTLM_WB
3503
3504CURL_CHECK_NTLM_WB
3505
3506dnl ************************************************************
3507dnl disable TLS-SRP authentication
3508dnl
3509AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3510AC_ARG_ENABLE(tls-srp,
3511AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3512AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3513[ case "$enableval" in
3514 no)
3515 AC_MSG_RESULT(no)
3516 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3517 want_tls_srp=no
3518 ;;
3519 *) AC_MSG_RESULT(yes)
3520 want_tls_srp=yes
3521 ;;
3522 esac ],
3523 AC_MSG_RESULT(yes)
3524 want_tls_srp=yes
3525)
3526
3527if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3528 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3529 USE_TLS_SRP=1
3530 curl_tls_srp_msg="enabled"
3531fi
3532
3533dnl ************************************************************
3534dnl disable Unix domain sockets support
3535dnl
3536AC_MSG_CHECKING([whether to enable Unix domain sockets])
3537AC_ARG_ENABLE(unix-sockets,
3538AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3539AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3540[ case "$enableval" in
3541 no) AC_MSG_RESULT(no)
3542 want_unix_sockets=no
3543 ;;
3544 *) AC_MSG_RESULT(yes)
3545 want_unix_sockets=yes
3546 ;;
3547 esac ], [
3548 AC_MSG_RESULT(auto)
3549 want_unix_sockets=auto
3550 ]
3551)
3552if test "x$want_unix_sockets" != "xno"; then
3553 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3554 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3555 AC_SUBST(USE_UNIX_SOCKETS, [1])
3556 curl_unix_sockets_msg="enabled"
3557 ], [
3558 if test "x$want_unix_sockets" = "xyes"; then
3559 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3560 fi
3561 ], [
3562 #include <sys/un.h>
3563 ])
3564fi
3565
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003566dnl ************************************************************
3567dnl disable cookies support
3568dnl
3569AC_MSG_CHECKING([whether to enable support for cookies])
3570AC_ARG_ENABLE(cookies,
3571AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3572AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3573[ case "$enableval" in
3574 no)
3575 AC_MSG_RESULT(no)
3576 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3577 ;;
3578 *) AC_MSG_RESULT(yes)
3579 ;;
3580 esac ],
3581 AC_MSG_RESULT(yes)
3582)
3583
3584dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003585dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003586dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003587CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003588
3589dnl ************************************************************
3590dnl enforce SONAME bump
3591dnl
3592
3593AC_MSG_CHECKING([whether to enforce SONAME bump])
3594AC_ARG_ENABLE(soname-bump,
3595AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
3596AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
3597[ case "$enableval" in
3598 yes) AC_MSG_RESULT(yes)
3599 soname_bump=yes
3600 ;;
3601 *)
3602 AC_MSG_RESULT(no)
3603 ;;
3604 esac ],
3605 AC_MSG_RESULT($soname_bump)
3606)
3607AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
3608
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003609dnl
3610dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003611dnl
3612LIBCURL_LIBS=$LIBS
3613
3614AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003615AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003616AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3617
3618dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3619dnl LIBS variable used in generated makefile at makefile processing
3620dnl time. Doing this functionally prevents LIBS from being used for
3621dnl all link targets in given makefile.
3622BLANK_AT_MAKETIME=
3623AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003624
3625AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3626
3627dnl yes or no
3628ENABLE_SHARED="$enable_shared"
3629AC_SUBST(ENABLE_SHARED)
3630
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003631dnl to let curl-config output the static libraries correctly
3632ENABLE_STATIC="$enable_static"
3633AC_SUBST(ENABLE_STATIC)
3634
3635
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003636dnl
3637dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003638dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003639dnl
3640
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003641if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003642 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3643elif test -n "$SSL_ENABLED"; then
3644 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3645fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003646if test "x$IPV6_ENABLED" = "x1"; then
3647 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3648fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003649if test "x$USE_UNIX_SOCKETS" = "x1"; then
3650 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3651fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003652if test "x$HAVE_LIBZ" = "x1"; then
3653 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3654fi
3655if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
3656 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3657fi
3658if test "x$IDN_ENABLED" = "x1"; then
3659 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3660fi
3661if test "x$USE_WINDOWS_SSPI" = "x1"; then
3662 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3663fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003664
3665if test "x$HAVE_GSSAPI" = "x1"; then
3666 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3667fi
3668
Alex Deymod15eaac2016-06-28 14:49:26 -07003669if test "x$curl_psl_msg" = "xyes"; then
3670 SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
3671fi
3672
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003673if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3674 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3675 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3676fi
3677
3678if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3679 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3680 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3681fi
3682
3683if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3684 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3685 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3686 -o "x$DARWINSSL_ENABLED" = "x1"; then
3687 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3688
3689 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3690 "x$NTLM_WB_ENABLED" = "x1"; then
3691 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3692 fi
3693 fi
3694fi
3695
3696if test "x$USE_TLS_SRP" = "x1"; then
3697 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3698fi
3699
3700if test "x$USE_NGHTTP2" = "x1"; then
3701 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003702fi
3703
3704AC_SUBST(SUPPORT_FEATURES)
3705
3706dnl For supported protocols in pkg-config file
3707if test "x$CURL_DISABLE_HTTP" != "x1"; then
3708 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3709 if test "x$SSL_ENABLED" = "x1"; then
3710 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3711 fi
3712fi
3713if test "x$CURL_DISABLE_FTP" != "x1"; then
3714 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3715 if test "x$SSL_ENABLED" = "x1"; then
3716 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3717 fi
3718fi
3719if test "x$CURL_DISABLE_FILE" != "x1"; then
3720 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3721fi
3722if test "x$CURL_DISABLE_TELNET" != "x1"; then
3723 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3724fi
3725if test "x$CURL_DISABLE_LDAP" != "x1"; then
3726 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3727 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3728 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3729 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3730 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3731 fi
3732 fi
3733fi
3734if test "x$CURL_DISABLE_DICT" != "x1"; then
3735 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3736fi
3737if test "x$CURL_DISABLE_TFTP" != "x1"; then
3738 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3739fi
3740if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3741 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3742fi
3743if test "x$CURL_DISABLE_POP3" != "x1"; then
3744 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3745 if test "x$SSL_ENABLED" = "x1"; then
3746 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3747 fi
3748fi
3749if test "x$CURL_DISABLE_IMAP" != "x1"; then
3750 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3751 if test "x$SSL_ENABLED" = "x1"; then
3752 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3753 fi
3754fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003755if test "x$CURL_DISABLE_SMB" != "x1" \
3756 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3757 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3758 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3759 -o "x$DARWINSSL_ENABLED" = "x1" \); then
3760 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3761 if test "x$SSL_ENABLED" = "x1"; then
3762 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
3763 fi
3764fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003765if test "x$CURL_DISABLE_SMTP" != "x1"; then
3766 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3767 if test "x$SSL_ENABLED" = "x1"; then
3768 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3769 fi
3770fi
3771if test "x$USE_LIBSSH2" = "x1"; then
3772 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3773 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3774fi
3775if test "x$CURL_DISABLE_RTSP" != "x1"; then
3776 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3777fi
3778if test "x$USE_LIBRTMP" = "x1"; then
3779 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3780fi
3781
3782dnl replace spaces with newlines
3783dnl sort the lines
3784dnl replace the newlines back to spaces
3785SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3786
3787AC_SUBST(SUPPORT_PROTOCOLS)
3788
3789dnl squeeze whitespace out of some variables
3790
3791squeeze CFLAGS
3792squeeze CPPFLAGS
3793squeeze DEFS
3794squeeze LDFLAGS
3795squeeze LIBS
3796
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003797squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003798squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003799squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003800
3801squeeze SUPPORT_FEATURES
3802squeeze SUPPORT_PROTOCOLS
3803
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003804XC_CHECK_BUILD_FLAGS
3805
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003806if test "x$want_curldebug_assumed" = "xyes" &&
3807 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3808 ac_configure_args="$ac_configure_args --enable-curldebug"
3809fi
3810
3811AC_CONFIG_FILES([Makefile \
3812 docs/Makefile \
3813 docs/examples/Makefile \
3814 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003815 docs/libcurl/opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003816 include/Makefile \
3817 include/curl/Makefile \
3818 src/Makefile \
3819 lib/Makefile \
Alex Deymod15eaac2016-06-28 14:49:26 -07003820 scripts/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003821 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003822 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003823 tests/certs/Makefile \
3824 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003825 tests/data/Makefile \
3826 tests/server/Makefile \
3827 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003828 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003829 packages/Makefile \
3830 packages/Win32/Makefile \
3831 packages/Win32/cygwin/Makefile \
3832 packages/Linux/Makefile \
3833 packages/Linux/RPM/Makefile \
3834 packages/Linux/RPM/curl.spec \
3835 packages/Linux/RPM/curl-ssl.spec \
3836 packages/Solaris/Makefile \
3837 packages/EPM/curl.list \
3838 packages/EPM/Makefile \
3839 packages/vms/Makefile \
3840 packages/AIX/Makefile \
3841 packages/AIX/RPM/Makefile \
3842 packages/AIX/RPM/curl.spec \
3843 curl-config \
3844 libcurl.pc
3845])
3846AC_OUTPUT
3847
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003848CURL_GENERATE_CONFIGUREHELP_PM
3849
3850XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
3851
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003852AC_MSG_NOTICE([Configured to build curl/libcurl:
3853
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003854 curl version: ${CURLVERSION}
3855 Host setup: ${host}
3856 Install prefix: ${prefix}
3857 Compiler: ${CC}
3858 SSL support: ${curl_ssl_msg}
3859 SSH support: ${curl_ssh_msg}
3860 zlib support: ${curl_zlib_msg}
3861 GSS-API support: ${curl_gss_msg}
3862 TLS-SRP support: ${curl_tls_srp_msg}
3863 resolver: ${curl_res_msg}
3864 IPv6 support: ${curl_ipv6_msg}
3865 Unix sockets support: ${curl_unix_sockets_msg}
3866 IDN support: ${curl_idn_msg}
3867 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
3868 Built-in manual: ${curl_manual_msg}
3869 --libcurl option: ${curl_libcurl_msg}
3870 Verbose errors: ${curl_verbose_msg}
3871 SSPI support: ${curl_sspi_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07003872 ca cert bundle: ${ca}${ca_warning}
3873 ca cert path: ${capath}${capath_warning}
3874 ca fallback: ${with_ca_fallback}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003875 LDAP support: ${curl_ldap_msg}
3876 LDAPS support: ${curl_ldaps_msg}
3877 RTSP support: ${curl_rtsp_msg}
3878 RTMP support: ${curl_rtmp_msg}
3879 metalink support: ${curl_mtlnk_msg}
Alex Deymod15eaac2016-06-28 14:49:26 -07003880 PSL support: ${curl_psl_msg}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003881 HTTP2 support: ${curl_h2_msg}
3882 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003883])
3884
3885if test "x$soname_bump" = "xyes"; then
3886
3887cat <<EOM
3888 SONAME bump: yes - WARNING: this library will be built with the SONAME
3889 number bumped due to (a detected) ABI breakage.
3890 See lib/README.curl_off_t for details on this.
3891EOM
3892
3893fi
3894