blob: a5e8b4ced8e2abdac4af724bd468ac2288889728 [file] [log] [blame]
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07008# Copyright (C) 1998 - 2015, 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
12# are also available at http://curl.haxx.se/docs/copyright.html.
13#
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
27AC_INIT([curl], [-], [a suitable curl mailing list: http://curl.haxx.se/mail/])
28
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
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070034AC_COPYRIGHT([Copyright (c) 1998 - 2014 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
42
43CURL_CHECK_OPTION_DEBUG
44CURL_CHECK_OPTION_OPTIMIZE
45CURL_CHECK_OPTION_WARNINGS
46CURL_CHECK_OPTION_WERROR
47CURL_CHECK_OPTION_CURLDEBUG
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070048CURL_CHECK_OPTION_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -070049CURL_CHECK_OPTION_ARES
50
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070051XC_CHECK_PATH_SEPARATOR
Lucas Eckels9bd90e62012-08-06 15:07:02 -070052
53#
54# save the configure arguments
55#
56CONFIGURE_OPTIONS="\"$ac_configure_args\""
57AC_SUBST(CONFIGURE_OPTIONS)
58
59CURL_CFLAG_EXTRAS=""
60if test X"$want_werror" = Xyes; then
61 CURL_CFLAG_EXTRAS="-Werror"
62fi
63AC_SUBST(CURL_CFLAG_EXTRAS)
64
65dnl SED is mandatory for configure process and libtool.
66dnl Set it now, allowing it to be changed later.
67if test -z "$SED"; then
68 dnl allow it to be overridden
69 AC_PATH_PROG([SED], [sed], [not_found],
70 [$PATH:/usr/bin:/usr/local/bin])
71 if test -z "$SED" || test "$SED" = "not_found"; then
72 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
73 fi
74fi
75AC_SUBST([SED])
76
77dnl GREP is mandatory for configure process and libtool.
78dnl Set it now, allowing it to be changed later.
79if test -z "$GREP"; then
80 dnl allow it to be overridden
81 AC_PATH_PROG([GREP], [grep], [not_found],
82 [$PATH:/usr/bin:/usr/local/bin])
83 if test -z "$GREP" || test "$GREP" = "not_found"; then
84 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
85 fi
86fi
87AC_SUBST([GREP])
88
89dnl EGREP is mandatory for configure process and libtool.
90dnl Set it now, allowing it to be changed later.
91if test -z "$EGREP"; then
92 dnl allow it to be overridden
93 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
94 AC_MSG_CHECKING([for egrep])
95 EGREP="$GREP -E"
96 AC_MSG_RESULT([$EGREP])
97 else
98 AC_PATH_PROG([EGREP], [egrep], [not_found],
99 [$PATH:/usr/bin:/usr/local/bin])
100 fi
101fi
102if test -z "$EGREP" || test "$EGREP" = "not_found"; then
103 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
104fi
105AC_SUBST([EGREP])
106
107dnl AR is mandatory for configure process and libtool.
108dnl This is target dependent, so check it as a tool.
109if test -z "$AR"; then
110 dnl allow it to be overridden
111 AC_PATH_TOOL([AR], [ar], [not_found],
112 [$PATH:/usr/bin:/usr/local/bin])
113 if test -z "$AR" || test "$AR" = "not_found"; then
114 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
115 fi
116fi
117AC_SUBST([AR])
118
119AC_SUBST(libext)
120
121dnl Remove non-configure distributed curlbuild.h
122if test -f ${srcdir}/include/curl/curlbuild.h; then
123 rm -f ${srcdir}/include/curl/curlbuild.h
124fi
125
126dnl figure out the libcurl version
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700127CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
128XC_CHECK_PROG_CC
129XC_AUTOMAKE
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700130AC_MSG_CHECKING([curl version])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700131AC_MSG_RESULT($CURLVERSION)
132
133AC_SUBST(CURLVERSION)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700134
135dnl
136dnl we extract the numerical version for curl-config only
137VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
138AC_SUBST(VERSIONNUM)
139
140dnl Solaris pkgadd support definitions
141PKGADD_PKG="HAXXcurl"
142PKGADD_NAME="cURL - a client that groks URLs"
143PKGADD_VENDOR="curl.haxx.se"
144AC_SUBST(PKGADD_PKG)
145AC_SUBST(PKGADD_NAME)
146AC_SUBST(PKGADD_VENDOR)
147
148dnl
149dnl initialize all the info variables
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700150 curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700151 curl_ssh_msg="no (--with-libssh2)"
152 curl_zlib_msg="no (--with-zlib)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700153 curl_gss_msg="no (--with-gssapi)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700154curl_tls_srp_msg="no (--enable-tls-srp)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700155 curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
156 curl_ipv6_msg="no (--enable-ipv6)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700157curl_unix_sockets_msg="no (--enable-unix-sockets)"
158 curl_idn_msg="no (--with-{libidn,winidn})"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700159 curl_manual_msg="no (--enable-manual)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700160curl_libcurl_msg="enabled (--disable-libcurl-option)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700161curl_verbose_msg="enabled (--disable-verbose)"
162 curl_sspi_msg="no (--enable-sspi)"
163 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
164 curl_ldaps_msg="no (--enable-ldaps)"
165 curl_rtsp_msg="no (--enable-rtsp)"
166 curl_rtmp_msg="no (--with-librtmp)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700167 curl_mtlnk_msg="no (--with-libmetalink)"
168
169 init_ssl_msg=${curl_ssl_msg}
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700170
171dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700172dnl Save some initial values the user might have provided
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700173dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700174INITIAL_LDFLAGS=$LDFLAGS
175INITIAL_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700176
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700177dnl Checks for programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700178
179dnl Our curl_off_t internal and external configure settings
180CURL_CONFIGURE_CURL_OFF_T
181
182dnl This defines _ALL_SOURCE for AIX
183CURL_CHECK_AIX_ALL_SOURCE
184
185dnl Our configure and build reentrant settings
186CURL_CONFIGURE_THREAD_SAFE
187CURL_CONFIGURE_REENTRANT
188
189dnl check for how to do large files
190AC_SYS_LARGEFILE
191
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700192XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700193
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700194#
195# Automake conditionals based on libtool related checks
196#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700197
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700198AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
199 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
200AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
201 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
202AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
203 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700204
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700205#
206# Due to libtool and automake machinery limitations of not allowing
207# specifying separate CPPFLAGS or CFLAGS when compiling objects for
208# inclusion of these in shared or static libraries, we are forced to
209# build using separate configure runs for shared and static libraries
210# on systems where different CPPFLAGS or CFLAGS are mandatory in order
211# to compile objects for each kind of library. Notice that relying on
212# the '-DPIC' CFLAG that libtool provides is not valid given that the
213# user might for example choose to build static libraries with PIC.
214#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700215
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700216#
217# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
218# targeting a static library and not building its shared counterpart.
219#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700220
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700221AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
222 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700223
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700224#
225# Make staticlib CPPFLAG variable and its definition visible in output
226# files unconditionally, providing an empty definition unless strictly
227# targeting a static library and not building its shared counterpart.
228#
229
230CPPFLAG_CURL_STATICLIB=
231if test "x$xc_lt_build_static_only" = 'xyes'; then
232 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
233fi
234AC_SUBST([CPPFLAG_CURL_STATICLIB])
235
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700236
237# Determine whether all dependent libraries must be specified when linking
238if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
239then
240 REQUIRE_LIB_DEPS=no
241else
242 REQUIRE_LIB_DEPS=yes
243fi
244AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700245AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700246
247dnl check if there's a way to force code inline
248AC_C_INLINE
249
250dnl **********************************************************************
251dnl platform/compiler/architecture specific checks/flags
252dnl **********************************************************************
253
254CURL_CHECK_COMPILER
255CURL_SET_COMPILER_BASIC_OPTS
256CURL_SET_COMPILER_DEBUG_OPTS
257CURL_SET_COMPILER_OPTIMIZE_OPTS
258CURL_SET_COMPILER_WARNING_OPTS
259
260if test "$compiler_id" = "INTEL_UNIX_C"; then
261 #
262 if test "$compiler_num" -ge "1000"; then
263 dnl icc 10.X or later
264 CFLAGS="$CFLAGS -shared-intel"
265 elif test "$compiler_num" -ge "900"; then
266 dnl icc 9.X specific
267 CFLAGS="$CFLAGS -i-dynamic"
268 fi
269 #
270fi
271
272CURL_CHECK_COMPILER_HALT_ON_ERROR
273CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700274CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
275CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700276
277CURL_CHECK_CURLDEBUG
278AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
279
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700280supports_unittests=yes
281# cross-compilation of unit tests static library/programs fails when
282# libcurl shared library is built. This might be due to a libtool or
283# automake issue. In this case we disable unit tests.
284if test "x$cross_compiling" != "xno" &&
285 test "x$enable_shared" != "xno"; then
286 supports_unittests=no
287fi
288
289# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
290# a problem related with OpenSSL headers and library versions not matching.
291# Disable unit tests while time to further investigate this is found.
292case $host in
293 mips-sgi-irix6.5)
294 if test "$compiler_id" = "GNU_C"; then
295 supports_unittests=no
296 fi
297 ;;
298esac
299
300# All AIX autobuilds fails unit tests linking against unittests library
301# due to unittests library being built with no symbols or members. Libtool ?
302# Disable unit tests while time to further investigate this is found.
303case $host_os in
304 aix*)
305 supports_unittests=no
306 ;;
307esac
308
309dnl Build unit tests when option --enable-debug is given.
310if test "x$want_debug" = "xyes" &&
311 test "x$supports_unittests" = "xyes"; then
312 want_unittests=yes
313else
314 want_unittests=no
315fi
316AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
317
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700318dnl **********************************************************************
319dnl Compilation based checks should not be done before this point.
320dnl **********************************************************************
321
322dnl **********************************************************************
323dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
324dnl and ws2tcpip.h take precedence over any other further checks which
325dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
326dnl this specific header files. And do them before its results are used.
327dnl **********************************************************************
328
329CURL_CHECK_HEADER_WINDOWS
330CURL_CHECK_NATIVE_WINDOWS
331case X-"$ac_cv_native_windows" in
332 X-yes)
333 CURL_CHECK_HEADER_WINSOCK
334 CURL_CHECK_HEADER_WINSOCK2
335 CURL_CHECK_HEADER_WS2TCPIP
336 CURL_CHECK_HEADER_WINLDAP
337 CURL_CHECK_HEADER_WINBER
338 ;;
339 *)
340 ac_cv_header_winsock_h="no"
341 ac_cv_header_winsock2_h="no"
342 ac_cv_header_ws2tcpip_h="no"
343 ac_cv_header_winldap_h="no"
344 ac_cv_header_winber_h="no"
345 ;;
346esac
347CURL_CHECK_WIN32_LARGEFILE
348
349dnl ************************************************************
350dnl switch off particular protocols
351dnl
352AC_MSG_CHECKING([whether to support http])
353AC_ARG_ENABLE(http,
354AC_HELP_STRING([--enable-http],[Enable HTTP support])
355AC_HELP_STRING([--disable-http],[Disable HTTP support]),
356[ case "$enableval" in
357 no)
358 AC_MSG_RESULT(no)
359 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
360 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
361 AC_SUBST(CURL_DISABLE_HTTP, [1])
362 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
363 AC_SUBST(CURL_DISABLE_RTSP, [1])
364 ;;
365 *) AC_MSG_RESULT(yes)
366 ;;
367 esac ],
368 AC_MSG_RESULT(yes)
369)
370AC_MSG_CHECKING([whether to support ftp])
371AC_ARG_ENABLE(ftp,
372AC_HELP_STRING([--enable-ftp],[Enable FTP support])
373AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
374[ case "$enableval" in
375 no)
376 AC_MSG_RESULT(no)
377 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
378 AC_SUBST(CURL_DISABLE_FTP, [1])
379 ;;
380 *) AC_MSG_RESULT(yes)
381 ;;
382 esac ],
383 AC_MSG_RESULT(yes)
384)
385AC_MSG_CHECKING([whether to support file])
386AC_ARG_ENABLE(file,
387AC_HELP_STRING([--enable-file],[Enable FILE support])
388AC_HELP_STRING([--disable-file],[Disable FILE support]),
389[ case "$enableval" in
390 no)
391 AC_MSG_RESULT(no)
392 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
393 AC_SUBST(CURL_DISABLE_FILE, [1])
394 ;;
395 *) AC_MSG_RESULT(yes)
396 ;;
397 esac ],
398 AC_MSG_RESULT(yes)
399)
400AC_MSG_CHECKING([whether to support ldap])
401AC_ARG_ENABLE(ldap,
402AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
403AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
404[ case "$enableval" in
405 no)
406 AC_MSG_RESULT(no)
407 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
408 AC_SUBST(CURL_DISABLE_LDAP, [1])
409 ;;
410 *)
411 AC_MSG_RESULT(yes)
412 ;;
413 esac ],[
414 AC_MSG_RESULT(yes) ]
415)
416AC_MSG_CHECKING([whether to support ldaps])
417AC_ARG_ENABLE(ldaps,
418AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
419AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
420[ case "$enableval" in
421 no)
422 AC_MSG_RESULT(no)
423 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
424 AC_SUBST(CURL_DISABLE_LDAPS, [1])
425 ;;
426 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
427 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
428 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
429 AC_SUBST(CURL_DISABLE_LDAPS, [1])
430 else
431 AC_MSG_RESULT(yes)
432 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
433 AC_SUBST(HAVE_LDAP_SSL, [1])
434 fi
435 ;;
436 esac ],[
437 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
438 AC_MSG_RESULT(no)
439 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
440 AC_SUBST(CURL_DISABLE_LDAPS, [1])
441 else
442 AC_MSG_RESULT(yes)
443 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
444 AC_SUBST(HAVE_LDAP_SSL, [1])
445 fi ]
446)
447
448AC_MSG_CHECKING([whether to support rtsp])
449AC_ARG_ENABLE(rtsp,
450AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
451AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
452[ case "$enableval" in
453 no)
454 AC_MSG_RESULT(no)
455 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
456 AC_SUBST(CURL_DISABLE_RTSP, [1])
457 ;;
458 *) if test x$CURL_DISABLE_HTTP = x1 ; then
459 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
460 else
461 AC_MSG_RESULT(yes)
462 curl_rtsp_msg="enabled"
463 fi
464 ;;
465 esac ],
466 if test "x$CURL_DISABLE_HTTP" != "x1"; then
467 AC_MSG_RESULT(yes)
468 curl_rtsp_msg="enabled"
469 else
470 AC_MSG_RESULT(no)
471 fi
472)
473
474AC_MSG_CHECKING([whether to support proxies])
475AC_ARG_ENABLE(proxy,
476AC_HELP_STRING([--enable-proxy],[Enable proxy support])
477AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
478[ case "$enableval" in
479 no)
480 AC_MSG_RESULT(no)
481 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
482 AC_SUBST(CURL_DISABLE_PROXY, [1])
483 ;;
484 *) AC_MSG_RESULT(yes)
485 ;;
486 esac ],
487 AC_MSG_RESULT(yes)
488)
489
490AC_MSG_CHECKING([whether to support dict])
491AC_ARG_ENABLE(dict,
492AC_HELP_STRING([--enable-dict],[Enable DICT support])
493AC_HELP_STRING([--disable-dict],[Disable DICT support]),
494[ case "$enableval" in
495 no)
496 AC_MSG_RESULT(no)
497 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
498 AC_SUBST(CURL_DISABLE_DICT, [1])
499 ;;
500 *) AC_MSG_RESULT(yes)
501 ;;
502 esac ],
503 AC_MSG_RESULT(yes)
504)
505AC_MSG_CHECKING([whether to support telnet])
506AC_ARG_ENABLE(telnet,
507AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
508AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
509[ case "$enableval" in
510 no)
511 AC_MSG_RESULT(no)
512 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
513 AC_SUBST(CURL_DISABLE_TELNET, [1])
514 ;;
515 *) AC_MSG_RESULT(yes)
516 ;;
517 esac ],
518 AC_MSG_RESULT(yes)
519)
520AC_MSG_CHECKING([whether to support tftp])
521AC_ARG_ENABLE(tftp,
522AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
523AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
524[ case "$enableval" in
525 no)
526 AC_MSG_RESULT(no)
527 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
528 AC_SUBST(CURL_DISABLE_TFTP, [1])
529 ;;
530 *) AC_MSG_RESULT(yes)
531 ;;
532 esac ],
533 AC_MSG_RESULT(yes)
534)
535
536AC_MSG_CHECKING([whether to support pop3])
537AC_ARG_ENABLE(pop3,
538AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
539AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
540[ case "$enableval" in
541 no)
542 AC_MSG_RESULT(no)
543 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
544 AC_SUBST(CURL_DISABLE_POP3, [1])
545 ;;
546 *) AC_MSG_RESULT(yes)
547 ;;
548 esac ],
549 AC_MSG_RESULT(yes)
550)
551
552
553AC_MSG_CHECKING([whether to support imap])
554AC_ARG_ENABLE(imap,
555AC_HELP_STRING([--enable-imap],[Enable IMAP support])
556AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
557[ case "$enableval" in
558 no)
559 AC_MSG_RESULT(no)
560 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
561 AC_SUBST(CURL_DISABLE_IMAP, [1])
562 ;;
563 *) AC_MSG_RESULT(yes)
564 ;;
565 esac ],
566 AC_MSG_RESULT(yes)
567)
568
569
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700570AC_MSG_CHECKING([whether to support smb])
571AC_ARG_ENABLE(smb,
572AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
573AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
574[ case "$enableval" in
575 no)
576 AC_MSG_RESULT(no)
577 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
578 AC_SUBST(CURL_DISABLE_SMB, [1])
579 ;;
580 *) AC_MSG_RESULT(yes)
581 ;;
582 esac ],
583 AC_MSG_RESULT(yes)
584)
585
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700586AC_MSG_CHECKING([whether to support smtp])
587AC_ARG_ENABLE(smtp,
588AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
589AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
590[ case "$enableval" in
591 no)
592 AC_MSG_RESULT(no)
593 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
594 AC_SUBST(CURL_DISABLE_SMTP, [1])
595 ;;
596 *) AC_MSG_RESULT(yes)
597 ;;
598 esac ],
599 AC_MSG_RESULT(yes)
600)
601
602AC_MSG_CHECKING([whether to support gopher])
603AC_ARG_ENABLE(gopher,
604AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
605AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
606[ case "$enableval" in
607 no)
608 AC_MSG_RESULT(no)
609 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
610 AC_SUBST(CURL_DISABLE_GOPHER, [1])
611 ;;
612 *) AC_MSG_RESULT(yes)
613 ;;
614 esac ],
615 AC_MSG_RESULT(yes)
616)
617
618
619dnl **********************************************************************
620dnl Check for built-in manual
621dnl **********************************************************************
622
623AC_MSG_CHECKING([whether to provide built-in manual])
624AC_ARG_ENABLE(manual,
625AC_HELP_STRING([--enable-manual],[Enable built-in manual])
626AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
627[ case "$enableval" in
628 no)
629 AC_MSG_RESULT(no)
630 ;;
631 *) AC_MSG_RESULT(yes)
632 USE_MANUAL="1"
633 ;;
634 esac ],
635 AC_MSG_RESULT(yes)
636 USE_MANUAL="1"
637)
638dnl The actual use of the USE_MANUAL variable is done much later in this
639dnl script to allow other actions to disable it as well.
640
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700641dnl ************************************************************
642dnl disable C code generation support
643dnl
644AC_MSG_CHECKING([whether to enable generation of C code])
645AC_ARG_ENABLE(libcurl_option,
646AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
647AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
648[ case "$enableval" in
649 no)
650 AC_MSG_RESULT(no)
651 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
652 curl_libcurl_msg="no"
653 ;;
654 *) AC_MSG_RESULT(yes)
655 ;;
656 esac ],
657 AC_MSG_RESULT(yes)
658)
659
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700660dnl **********************************************************************
661dnl Checks for libraries.
662dnl **********************************************************************
663
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700664AC_MSG_CHECKING([whether to use libgcc])
665AC_ARG_ENABLE(libgcc,
666AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
667[ case "$enableval" in
668 yes)
669 LIBS="-lgcc $LIBS"
670 AC_MSG_RESULT(yes)
671 ;;
672 *) AC_MSG_RESULT(no)
673 ;;
674 esac ],
675 AC_MSG_RESULT(no)
676)
677
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700678CURL_CHECK_LIB_XNET
679
680dnl gethostbyname without lib or in the nsl lib?
681AC_CHECK_FUNC(gethostbyname,
682 [HAVE_GETHOSTBYNAME="1"
683 ],
684 [ AC_CHECK_LIB(nsl, gethostbyname,
685 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700686 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700687 ])
688 ])
689
690if test "$HAVE_GETHOSTBYNAME" != "1"
691then
692 dnl gethostbyname in the socket lib?
693 AC_CHECK_LIB(socket, gethostbyname,
694 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700695 LIBS="-lsocket $LIBS"
696 ])
697fi
698
699if test "$HAVE_GETHOSTBYNAME" != "1"
700then
701 dnl gethostbyname in the watt lib?
702 AC_CHECK_LIB(watt, gethostbyname,
703 [HAVE_GETHOSTBYNAME="1"
704 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
705 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
706 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700707 ])
708fi
709
710dnl At least one system has been identified to require BOTH nsl and socket
711dnl libs at the same time to link properly.
712if test "$HAVE_GETHOSTBYNAME" != "1"
713then
714 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
715 my_ac_save_LIBS=$LIBS
716 LIBS="-lnsl -lsocket $LIBS"
717 AC_LINK_IFELSE([
718 AC_LANG_PROGRAM([[
719 ]],[[
720 gethostbyname();
721 ]])
722 ],[
723 AC_MSG_RESULT([yes])
724 HAVE_GETHOSTBYNAME="1"
725 ],[
726 AC_MSG_RESULT([no])
727 LIBS=$my_ac_save_LIBS
728 ])
729fi
730
731if test "$HAVE_GETHOSTBYNAME" != "1"
732then
733 dnl This is for winsock systems
734 if test "$ac_cv_header_windows_h" = "yes"; then
735 if test "$ac_cv_header_winsock_h" = "yes"; then
736 case $host in
737 *-*-mingw32ce*)
738 winsock_LIB="-lwinsock"
739 ;;
740 *)
741 winsock_LIB="-lwsock32"
742 ;;
743 esac
744 fi
745 if test "$ac_cv_header_winsock2_h" = "yes"; then
746 winsock_LIB="-lws2_32"
747 fi
748 if test ! -z "$winsock_LIB"; then
749 my_ac_save_LIBS=$LIBS
750 LIBS="$winsock_LIB $LIBS"
751 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
752 AC_LINK_IFELSE([
753 AC_LANG_PROGRAM([[
754#ifdef HAVE_WINDOWS_H
755#ifndef WIN32_LEAN_AND_MEAN
756#define WIN32_LEAN_AND_MEAN
757#endif
758#include <windows.h>
759#ifdef HAVE_WINSOCK2_H
760#include <winsock2.h>
761#else
762#ifdef HAVE_WINSOCK_H
763#include <winsock.h>
764#endif
765#endif
766#endif
767 ]],[[
768 gethostbyname("www.dummysite.com");
769 ]])
770 ],[
771 AC_MSG_RESULT([yes])
772 HAVE_GETHOSTBYNAME="1"
773 ],[
774 AC_MSG_RESULT([no])
775 winsock_LIB=""
776 LIBS=$my_ac_save_LIBS
777 ])
778 fi
779 fi
780fi
781
782if test "$HAVE_GETHOSTBYNAME" != "1"
783then
784 dnl This is for Minix 3.1
785 AC_MSG_CHECKING([for gethostbyname for Minix 3])
786 AC_LINK_IFELSE([
787 AC_LANG_PROGRAM([[
788/* Older Minix versions may need <net/gen/netdb.h> here instead */
789#include <netdb.h>
790 ]],[[
791 gethostbyname("www.dummysite.com");
792 ]])
793 ],[
794 AC_MSG_RESULT([yes])
795 HAVE_GETHOSTBYNAME="1"
796 ],[
797 AC_MSG_RESULT([no])
798 ])
799fi
800
801if test "$HAVE_GETHOSTBYNAME" != "1"
802then
803 dnl This is for eCos with a stubbed DNS implementation
804 AC_MSG_CHECKING([for gethostbyname for eCos])
805 AC_LINK_IFELSE([
806 AC_LANG_PROGRAM([[
807#include <stdio.h>
808#include <netdb.h>
809 ]],[[
810 gethostbyname("www.dummysite.com");
811 ]])
812 ],[
813 AC_MSG_RESULT([yes])
814 HAVE_GETHOSTBYNAME="1"
815 ],[
816 AC_MSG_RESULT([no])
817 ])
818fi
819
820if test "$HAVE_GETHOSTBYNAME" != "1"
821then
822 dnl gethostbyname in the network lib - for Haiku OS
823 AC_CHECK_LIB(network, gethostbyname,
824 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700825 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700826 ])
827fi
828
829if test "$HAVE_GETHOSTBYNAME" != "1"
830then
831 dnl gethostbyname in the net lib - for BeOS
832 AC_CHECK_LIB(net, gethostbyname,
833 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700834 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700835 ])
836fi
837
838
839if test "$HAVE_GETHOSTBYNAME" != "1"; then
840 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
841fi
842
843dnl resolve lib?
844AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
845
846if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
847 AC_CHECK_LIB(resolve, strcasecmp,
848 [LIBS="-lresolve $LIBS"],
849 ,
850 -lnsl)
851fi
852ac_cv_func_strcasecmp="no"
853
854CURL_CHECK_LIBS_CONNECT
855
856CURL_NETWORK_LIBS=$LIBS
857
858dnl **********************************************************************
859dnl In case that function clock_gettime with monotonic timer is available,
860dnl check for additional required libraries.
861dnl **********************************************************************
862CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
863
864dnl **********************************************************************
865dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700866dnl servers and libtest cases which require networking and clock_gettime
867dnl support. Save the list of required libraries at this point for use
868dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700869dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700870CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700871
872dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700873dnl Check for the presence of ZLIB libraries and headers
874dnl **********************************************************************
875
876dnl Check for & handle argument to --with-zlib.
877
878clean_CPPFLAGS=$CPPFLAGS
879clean_LDFLAGS=$LDFLAGS
880clean_LIBS=$LIBS
881ZLIB_LIBS=""
882AC_ARG_WITH(zlib,
883AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
884AC_HELP_STRING([--without-zlib],[disable use of zlib]),
885 [OPT_ZLIB="$withval"])
886
887if test "$OPT_ZLIB" = "no" ; then
888 AC_MSG_WARN([zlib disabled])
889else
890 if test "$OPT_ZLIB" = "yes" ; then
891 OPT_ZLIB=""
892 fi
893
894 if test -z "$OPT_ZLIB" ; then
895 dnl check for the lib first without setting any new path, since many
896 dnl people have it in the default path
897
898 AC_CHECK_LIB(z, inflateEnd,
899 dnl libz found, set the variable
900 [HAVE_LIBZ="1"
901 LIBS="-lz $LIBS"],
902 dnl if no lib found, try /usr/local
903 [OPT_ZLIB="/usr/local"])
904
905 fi
906
907 dnl Add a nonempty path to the compiler flags
908 if test -n "$OPT_ZLIB"; then
909 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
910 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
911 fi
912
913 AC_CHECK_HEADER(zlib.h,
914 [
915 dnl zlib.h was found
916 HAVE_ZLIB_H="1"
917 dnl if the lib wasn't found already, try again with the new paths
918 if test "$HAVE_LIBZ" != "1"; then
919 AC_CHECK_LIB(z, gzread,
920 [
921 dnl the lib was found!
922 HAVE_LIBZ="1"
923 LIBS="-lz $LIBS"
924 ],
925 [ CPPFLAGS=$clean_CPPFLAGS
926 LDFLAGS=$clean_LDFLAGS])
927 fi
928 ],
929 [
930 dnl zlib.h was not found, restore the flags
931 CPPFLAGS=$clean_CPPFLAGS
932 LDFLAGS=$clean_LDFLAGS]
933 )
934
935 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
936 then
937 AC_MSG_WARN([configure found only the libz lib, not the header file!])
938 HAVE_LIBZ=""
939 CPPFLAGS=$clean_CPPFLAGS
940 LDFLAGS=$clean_LDFLAGS
941 LIBS=$clean_LIBS
942 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
943 then
944 AC_MSG_WARN([configure found only the libz header file, not the lib!])
945 CPPFLAGS=$clean_CPPFLAGS
946 LDFLAGS=$clean_LDFLAGS
947 LIBS=$clean_LIBS
948 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
949 then
950 dnl both header and lib were found!
951 AC_SUBST(HAVE_LIBZ)
952 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
953 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
954
955 ZLIB_LIBS="-lz"
956 LIBS="-lz $clean_LIBS"
957
958 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
959 AMFIXLIB="1"
960 AC_MSG_NOTICE([found both libz and libz.h header])
961 curl_zlib_msg="enabled"
962 fi
963fi
964
965dnl set variable for use in automakefile(s)
966AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
967AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700968
969dnl **********************************************************************
970dnl Check for LDAP
971dnl **********************************************************************
972
973LDAPLIBNAME=""
974AC_ARG_WITH(ldap-lib,
975AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
976 [LDAPLIBNAME="$withval"])
977
978LBERLIBNAME=""
979AC_ARG_WITH(lber-lib,
980AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
981 [LBERLIBNAME="$withval"])
982
983if test x$CURL_DISABLE_LDAP != x1 ; then
984
985 CURL_CHECK_HEADER_LBER
986 CURL_CHECK_HEADER_LDAP
987 CURL_CHECK_HEADER_LDAPSSL
988 CURL_CHECK_HEADER_LDAP_SSL
989
990 if test -z "$LDAPLIBNAME" ; then
991 if test "$ac_cv_native_windows" = "yes"; then
992 dnl Windows uses a single and unique LDAP library name
993 LDAPLIBNAME="wldap32"
994 LBERLIBNAME="no"
995 fi
996 fi
997
998 if test "$LDAPLIBNAME" ; then
999 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1000 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1001 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001002 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001003 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001004 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001005 else
1006 dnl Try to find the right ldap libraries for this system
1007 CURL_CHECK_LIBS_LDAP
1008 case X-"$curl_cv_ldap_LIBS" in
1009 X-unknown)
1010 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1011 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1012 AC_SUBST(CURL_DISABLE_LDAP, [1])
1013 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1014 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1015 ;;
1016 esac
1017 fi
1018fi
1019
1020if test x$CURL_DISABLE_LDAP != x1 ; then
1021
1022 if test "$LBERLIBNAME" ; then
1023 dnl If name is "no" then don't define this library at all
1024 dnl (it's only needed if libldap.so's dependencies are broken).
1025 if test "$LBERLIBNAME" != "no" ; then
1026 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1027 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1028 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001029 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001030 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001031 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001032 fi
1033 fi
1034fi
1035
1036if test x$CURL_DISABLE_LDAP != x1 ; then
1037 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1038
1039 if test "$LDAPLIBNAME" = "wldap32"; then
1040 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001041 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001042 else
1043 curl_ldap_msg="enabled (OpenLDAP)"
1044 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1045 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1046 AC_SUBST(USE_OPENLDAP, [1])
1047 fi
1048 fi
1049fi
1050
1051if test x$CURL_DISABLE_LDAPS != x1 ; then
1052 curl_ldaps_msg="enabled"
1053fi
1054
1055dnl **********************************************************************
1056dnl Checks for IPv6
1057dnl **********************************************************************
1058
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001059AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001060AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001061AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1062AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001063[ case "$enableval" in
1064 no)
1065 AC_MSG_RESULT(no)
1066 ipv6=no
1067 ;;
1068 *) AC_MSG_RESULT(yes)
1069 ipv6=yes
1070 ;;
1071 esac ],
1072
1073 AC_TRY_RUN([ /* is AF_INET6 available? */
1074#include <sys/types.h>
1075#include <sys/socket.h>
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001076#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001077main()
1078{
1079 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1080 exit(1);
1081 else
1082 exit(0);
1083}
1084],
1085 AC_MSG_RESULT(yes)
1086 ipv6=yes,
1087 AC_MSG_RESULT(no)
1088 ipv6=no,
1089 AC_MSG_RESULT(no)
1090 ipv6=no
1091))
1092
1093if test "$ipv6" = "yes"; then
1094 curl_ipv6_msg="enabled"
1095fi
1096
1097# Check if struct sockaddr_in6 have sin6_scope_id member
1098if test "$ipv6" = yes; then
1099 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1100 AC_TRY_COMPILE([
1101#include <sys/types.h>
1102#include <netinet/in.h>] ,
1103 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1104 if test "$have_sin6_scope_id" = yes; then
1105 AC_MSG_RESULT([yes])
1106 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1107 else
1108 AC_MSG_RESULT([no])
1109 fi
1110fi
1111
1112dnl **********************************************************************
1113dnl Check if the operating system allows programs to write to their own argv[]
1114dnl **********************************************************************
1115
1116AC_MSG_CHECKING([if argv can be written to])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001117AC_RUN_IFELSE([
1118 AC_LANG_SOURCE([[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001119int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001120 argv[0][0] = ' ';
1121 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001122}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001123 ]])
1124],[
1125 curl_cv_writable_argv=yes
1126],[
1127 curl_cv_writable_argv=no
1128],[
1129 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001130])
1131case $curl_cv_writable_argv in
1132yes)
1133 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1134 AC_MSG_RESULT(yes)
1135 ;;
1136no)
1137 AC_MSG_RESULT(no)
1138 ;;
1139*)
1140 AC_MSG_RESULT(no)
1141 AC_MSG_WARN([the previous check could not be made default was used])
1142 ;;
1143esac
1144
1145dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001146dnl Check for GSS-API libraries
1147dnl **********************************************************************
1148
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001149dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001150
1151GSSAPI_ROOT="/usr"
1152AC_ARG_WITH(gssapi-includes,
1153 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001154 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001155 [ GSSAPI_INCS="-I$withval"
1156 want_gss="yes" ]
1157)
1158
1159AC_ARG_WITH(gssapi-libs,
1160 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001161 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001162 [ GSSAPI_LIB_DIR="-L$withval"
1163 want_gss="yes" ]
1164)
1165
1166AC_ARG_WITH(gssapi,
1167 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001168 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001169 GSSAPI_ROOT="$withval"
1170 if test x"$GSSAPI_ROOT" != xno; then
1171 want_gss="yes"
1172 if test x"$GSSAPI_ROOT" = xyes; then
1173 dnl if yes, then use default root
1174 GSSAPI_ROOT="/usr"
1175 fi
1176 fi
1177])
1178
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001179: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1180
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001181save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001182AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001183if test x"$want_gss" = xyes; then
1184 AC_MSG_RESULT(yes)
1185
1186 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001187 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1188 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1189 elif test -f "$KRB5CONFIG"; then
1190 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001191 elif test "$GSSAPI_ROOT" != "yes"; then
1192 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1193 fi
1194 fi
1195
1196 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1197
1198 AC_CHECK_HEADER(gss.h,
1199 [
1200 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001201 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001202 gnu_gss=yes
1203 ],
1204 [
1205 dnl not found, check Heimdal or MIT
1206 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1207 AC_CHECK_HEADERS(
1208 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1209 [],
1210 [not_mit=1],
1211 [
1212AC_INCLUDES_DEFAULT
1213#ifdef HAVE_GSSAPI_GSSAPI_H
1214#include <gssapi/gssapi.h>
1215#endif
1216 ])
1217 if test "x$not_mit" = "x1"; then
1218 dnl MIT not found, check for Heimdal
1219 AC_CHECK_HEADER(gssapi.h,
1220 [
1221 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001222 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001223 ],
1224 [
1225 dnl no header found, disabling GSS
1226 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001227 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001228 ]
1229 )
1230 else
1231 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001232 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1233 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1234 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001235 AC_COMPILE_IFELSE([
1236 AC_LANG_PROGRAM([[
1237#include <gssapi/gssapi.h>
1238#include <gssapi/gssapi_generic.h>
1239#include <gssapi/gssapi_krb5.h>
1240 ]],[[
1241 gss_import_name(
1242 (OM_uint32 *)0,
1243 (gss_buffer_t)0,
1244 GSS_C_NT_HOSTBASED_SERVICE,
1245 (gss_name_t *)0);
1246 ]])
1247 ],[
1248 AC_MSG_RESULT([yes])
1249 ],[
1250 AC_MSG_RESULT([no])
1251 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001252 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001253 ])
1254 fi
1255 ]
1256 )
1257else
1258 AC_MSG_RESULT(no)
1259fi
1260if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001261 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1262 HAVE_GSSAPI=1
1263 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001264
1265 if test -n "$gnu_gss"; then
1266 curl_gss_msg="enabled (GNU GSS)"
1267 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001268 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001269 elif test -z "$GSSAPI_LIB_DIR"; then
1270 case $host in
1271 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001272 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001273 ;;
1274 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001275 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001276 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1277 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001278 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1279 LIBS="$gss_libs $LIBS"
1280 elif test -f "$KRB5CONFIG"; then
1281 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1282 dnl into LIBS
1283 gss_libs=`$KRB5CONFIG --libs gssapi`
1284 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001285 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001286 case $host in
1287 *-hp-hpux*)
1288 gss_libname="gss"
1289 ;;
1290 *)
1291 gss_libname="gssapi"
1292 ;;
1293 esac
1294
1295 if test "$GSSAPI_ROOT" != "yes"; then
1296 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1297 LIBS="-l$gss_libname $LIBS"
1298 else
1299 LIBS="-l$gss_libname $LIBS"
1300 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001301 fi
1302 ;;
1303 esac
1304 else
1305 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001306 case $host in
1307 *-hp-hpux*)
1308 LIBS="-lgss $LIBS"
1309 ;;
1310 *)
1311 LIBS="-lgssapi $LIBS"
1312 ;;
1313 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001314 fi
1315else
1316 CPPFLAGS="$save_CPPFLAGS"
1317fi
1318
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001319dnl -------------------------------------------------
1320dnl check winssl option before other SSL libraries
1321dnl -------------------------------------------------
1322
1323OPT_WINSSL=no
1324AC_ARG_WITH(winssl,dnl
1325AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1326AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1327 OPT_WINSSL=$withval)
1328
1329AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
1330if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1331 if test "x$OPT_WINSSL" != "xno" &&
1332 test "x$ac_cv_native_windows" = "xyes"; then
1333 AC_MSG_RESULT(yes)
1334 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1335 AC_SUBST(USE_SCHANNEL, [1])
1336 curl_ssl_msg="enabled (Windows-native)"
1337 WINSSL_ENABLED=1
1338 # --with-winssl implies --enable-sspi
1339 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1340 AC_SUBST(USE_WINDOWS_SSPI, [1])
1341 curl_sspi_msg="enabled"
1342 else
1343 AC_MSG_RESULT(no)
1344 fi
1345else
1346 AC_MSG_RESULT(no)
1347fi
1348
1349OPT_DARWINSSL=no
1350AC_ARG_WITH(darwinssl,dnl
1351AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
1352AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
1353 OPT_DARWINSSL=$withval)
1354
1355AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
1356if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1357 if test "x$OPT_DARWINSSL" != "xno" &&
1358 test -d "/System/Library/Frameworks/Security.framework"; then
1359 AC_MSG_RESULT(yes)
1360 AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
1361 AC_SUBST(USE_DARWINSSL, [1])
1362 curl_ssl_msg="enabled (iOS/Mac OS X-native)"
1363 DARWINSSL_ENABLED=1
1364 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1365 else
1366 AC_MSG_RESULT(no)
1367 fi
1368else
1369 AC_MSG_RESULT(no)
1370fi
1371
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001372dnl **********************************************************************
1373dnl Check for the presence of SSL libraries and headers
1374dnl **********************************************************************
1375
1376dnl Default to compiler & linker defaults for SSL files & libraries.
1377OPT_SSL=off
1378dnl Default to no CA bundle
1379ca="no"
1380AC_ARG_WITH(ssl,dnl
1381AC_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])
1382AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1383 OPT_SSL=$withval)
1384
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001385if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001386 dnl backup the pre-ssl variables
1387 CLEANLDFLAGS="$LDFLAGS"
1388 CLEANCPPFLAGS="$CPPFLAGS"
1389 CLEANLIBS="$LIBS"
1390
1391 case "$OPT_SSL" in
1392 yes)
1393 dnl --with-ssl (without path) used
1394 if test x$cross_compiling != xyes; then
1395 dnl only do pkg-config magic when not cross-compiling
1396 PKGTEST="yes"
1397 fi
1398 PREFIX_OPENSSL=/usr/local/ssl
1399 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1400 ;;
1401 off)
1402 dnl no --with-ssl option given, just check default places
1403 if test x$cross_compiling != xyes; then
1404 dnl only do pkg-config magic when not cross-compiling
1405 PKGTEST="yes"
1406 fi
1407 PREFIX_OPENSSL=
1408 ;;
1409 *)
1410 dnl check the given --with-ssl spot
1411 PKGTEST="no"
1412 PREFIX_OPENSSL=$OPT_SSL
1413
1414 dnl Try pkg-config even when cross-compiling. Since we
1415 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1416 dnl the user told us to look
1417 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1418 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001419 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001420 PKGTEST="yes"
1421 fi
1422
1423 dnl in case pkg-config comes up empty, use what we got
1424 dnl via --with-ssl
1425 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1426 if test "$PREFIX_OPENSSL" != "/usr" ; then
1427 SSL_LDFLAGS="-L$LIB_OPENSSL"
1428 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1429 fi
1430 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1431 ;;
1432 esac
1433
1434 if test "$PKGTEST" = "yes"; then
1435
1436 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1437
1438 if test "$PKGCONFIG" != "no" ; then
1439 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1440 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1441
1442 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1443 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1444
1445 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1446 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1447
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001448 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001449 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1450 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1451 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1452
1453 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1454
1455 dnl use the values pkg-config reported. This is here
1456 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1457 dnl learn about this via pkg-config. If we only have
1458 dnl the argument to --with-ssl we don't know what
1459 dnl additional libs may be necessary. Hope that we
1460 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001461 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001462 fi
1463 fi
1464
1465 dnl finally, set flags to use SSL
1466 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1467 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1468
1469 dnl This is for Msys/Mingw
1470 case $host in
1471 *-*-msys* | *-*-mingw*)
1472 AC_MSG_CHECKING([for gdi32])
1473 my_ac_save_LIBS=$LIBS
1474 LIBS="-lgdi32 $LIBS"
1475 AC_TRY_LINK([#include <windef.h>
1476 #include <wingdi.h>],
1477 [GdiFlush();],
1478 [ dnl worked!
1479 AC_MSG_RESULT([yes])],
1480 [ dnl failed, restore LIBS
1481 LIBS=$my_ac_save_LIBS
1482 AC_MSG_RESULT(no)]
1483 )
1484 ;;
1485 esac
1486
1487 AC_CHECK_LIB(crypto, CRYPTO_lock,[
1488 HAVECRYPTO="yes"
1489 LIBS="-lcrypto $LIBS"
1490 ],[
1491 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1492 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001493 AC_CHECK_LIB(crypto, HMAC_Init,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001494 HAVECRYPTO="yes"
1495 LIBS="-lcrypto $LIBS"], [
1496 LDFLAGS="$CLEANLDFLAGS"
1497 CPPFLAGS="$CLEANCPPFLAGS"
1498 LIBS="$CLEANLIBS"
1499 ])
1500 ])
1501
1502
1503 if test X"$HAVECRYPTO" = X"yes"; then
1504 dnl This is only reasonable to do if crypto actually is there: check for
1505 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1506
1507 AC_CHECK_LIB(ssl, SSL_connect)
1508
1509 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1510 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1511 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1512 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001513 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001514 AC_CHECK_LIB(ssl, SSL_connect)
1515 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1516 dnl still no SSL_connect
1517 AC_MSG_RESULT(no)
1518 LIBS=$OLIBS
1519 else
1520 AC_MSG_RESULT(yes)
1521 fi
1522
1523 else
1524
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001525 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001526 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1527 openssl/pem.h openssl/ssl.h openssl/err.h,
1528 curl_ssl_msg="enabled (OpenSSL)"
1529 OPENSSL_ENABLED=1
1530 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1531
1532 if test $ac_cv_header_openssl_x509_h = no; then
1533 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1534 dnl since 'err.h' might in fact find a krb4 header with the same
1535 dnl name
1536 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1537
1538 if test $ac_cv_header_x509_h = yes &&
1539 test $ac_cv_header_crypto_h = yes &&
1540 test $ac_cv_header_ssl_h = yes; then
1541 dnl three matches
1542 curl_ssl_msg="enabled (OpenSSL)"
1543 OPENSSL_ENABLED=1
1544 fi
1545 fi
1546 fi
1547
1548 if test X"$OPENSSL_ENABLED" = X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001549 dnl is there a pkcs12.h header present?
1550 AC_CHECK_HEADERS(openssl/pkcs12.h)
1551 else
1552 LIBS="$CLEANLIBS"
1553 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001554
1555 if test X"$OPT_SSL" != Xoff &&
1556 test "$OPENSSL_ENABLED" != "1"; then
1557 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1558 fi
1559 fi
1560
1561 if test X"$OPENSSL_ENABLED" = X"1"; then
1562 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1563 dnl stuff, it is kind of "separated" from the main SSL check
1564 AC_CHECK_FUNC(ENGINE_init,
1565 [
1566 AC_CHECK_HEADERS(openssl/engine.h)
1567 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1568 ])
1569
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001570 dnl These can only exist if OpenSSL exists
1571 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1572 dnl SSL_get_shutdown (but this check won't actually detect it there
1573 dnl as it's a macro that needs the header files be included)
1574 dnl BoringSSL doesn't have DES_set_odd_parity
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001575
1576 AC_CHECK_FUNCS( RAND_status \
1577 RAND_screen \
1578 RAND_egd \
1579 ENGINE_cleanup \
1580 CRYPTO_cleanup_all_ex_data \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001581 SSL_get_shutdown \
1582 SSLv2_client_method \
1583 DES_set_odd_parity )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001584
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001585 AC_MSG_CHECKING([for BoringSSL])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001586 AC_COMPILE_IFELSE([
1587 AC_LANG_PROGRAM([[
1588#include <openssl/base.h>
1589 ]],[[
1590#ifndef OPENSSL_IS_BORINGSSL
1591#error not boringssl
1592#endif
1593 ]])
1594 ],[
1595 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001596 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1597 [Define to 1 if using BoringSSL.])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001598 ],[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001599 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001600 ])
1601
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001602 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001603 AC_COMPILE_IFELSE([
1604 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001605#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001606 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001607 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001608 ]])
1609 ],[
1610 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001611 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1612 [Define to 1 if using libressl.])
1613 curl_ssl_msg="enabled (libressl)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001614 ],[
1615 AC_MSG_RESULT([no])
1616 ])
1617 fi
1618
1619 if test "$OPENSSL_ENABLED" = "1"; then
1620 if test -n "$LIB_OPENSSL"; then
1621 dnl when the ssl shared libs were found in a path that the run-time
1622 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1623 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001624 if test "x$cross_compiling" != "xyes"; then
1625 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1626 export LD_LIBRARY_PATH
1627 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1628 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001629 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001630 CURL_CHECK_OPENSSL_API
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001631 fi
1632
1633fi
1634
1635dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001636dnl Check for the random seed preferences
1637dnl **********************************************************************
1638
1639if test X"$OPENSSL_ENABLED" = X"1"; then
1640 AC_ARG_WITH(egd-socket,
1641 AC_HELP_STRING([--with-egd-socket=FILE],
1642 [Entropy Gathering Daemon socket pathname]),
1643 [ EGD_SOCKET="$withval" ]
1644 )
1645 if test -n "$EGD_SOCKET" ; then
1646 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1647 [your Entropy Gathering Daemon socket pathname] )
1648 fi
1649
1650 dnl Check for user-specified random device
1651 AC_ARG_WITH(random,
1652 AC_HELP_STRING([--with-random=FILE],
1653 [read randomness from FILE (default=/dev/urandom)]),
1654 [ RANDOM_FILE="$withval" ],
1655 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001656 if test x$cross_compiling != xyes; then
1657 dnl Check for random device
1658 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1659 else
1660 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1661 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001662 ]
1663 )
1664 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1665 AC_SUBST(RANDOM_FILE)
1666 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1667 [a suitable file to read random data from])
1668 fi
1669fi
1670
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001671dnl ---
1672dnl We require OpenSSL with SRP support.
1673dnl ---
1674if test "$OPENSSL_ENABLED" = "1"; then
1675 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1676 [
1677 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1678 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1679 ])
1680fi
1681
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001682dnl ----------------------------------------------------
1683dnl check for GnuTLS
1684dnl ----------------------------------------------------
1685
1686dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1687OPT_GNUTLS=no
1688
1689AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001690AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001691AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1692 OPT_GNUTLS=$withval)
1693
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001694if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001695
1696 if test X"$OPT_GNUTLS" != Xno; then
1697
1698 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001699 addlib=""
1700 gtlslib=""
1701 version=""
1702 addcflags=""
1703
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001704 if test "x$OPT_GNUTLS" = "xyes"; then
1705 dnl this is with no partiular path given
1706 CURL_CHECK_PKGCONFIG(gnutls)
1707
1708 if test "$PKGCONFIG" != "no" ; then
1709 addlib=`$PKGCONFIG --libs-only-l gnutls`
1710 addld=`$PKGCONFIG --libs-only-L gnutls`
1711 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1712 version=`$PKGCONFIG --modversion gnutls`
1713 gtlslib=`echo $addld | $SED -e 's/-L//'`
1714 else
1715 dnl without pkg-config, we try libgnutls-config as that was how it
1716 dnl used to be done
1717 check=`libgnutls-config --version 2>/dev/null`
1718 if test -n "$check"; then
1719 addlib=`libgnutls-config --libs`
1720 addcflags=`libgnutls-config --cflags`
1721 version=`libgnutls-config --version`
1722 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1723 fi
1724 fi
1725 else
1726 dnl this is with a given path, first check if there's a libgnutls-config
1727 dnl there and if not, make an educated guess
1728 cfg=$OPT_GNUTLS/bin/libgnutls-config
1729 check=`$cfg --version 2>/dev/null`
1730 if test -n "$check"; then
1731 addlib=`$cfg --libs`
1732 addcflags=`$cfg --cflags`
1733 version=`$cfg --version`
1734 gtlslib=`$cfg --prefix`/lib$libsuff
1735 else
1736 dnl without pkg-config and libgnutls-config, we guess a lot!
1737 addlib=-lgnutls
1738 addld=-L$OPT_GNUTLS/lib$libsuff
1739 addcflags=-I$OPT_GNUTLS/include
1740 version="" # we just don't know
1741 gtlslib=$OPT_GNUTLS/lib$libsuff
1742 fi
1743 fi
1744
1745 if test -z "$version"; then
1746 dnl lots of efforts, still no go
1747 version="unknown"
1748 fi
1749
1750 if test -n "$addlib"; then
1751
1752 CLEANLIBS="$LIBS"
1753 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001754 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001755
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001756 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001757 LDFLAGS="$LDFLAGS $addld"
1758 if test "$addcflags" != "-I/usr/include"; then
1759 CPPFLAGS="$CPPFLAGS $addcflags"
1760 fi
1761
1762 AC_CHECK_LIB(gnutls, gnutls_check_version,
1763 [
1764 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1765 AC_SUBST(USE_GNUTLS, [1])
1766 GNUTLS_ENABLED=1
1767 USE_GNUTLS="yes"
1768 curl_ssl_msg="enabled (GnuTLS)"
1769 ],
1770 [
1771 LIBS="$CLEANLIBS"
1772 CPPFLAGS="$CLEANCPPFLAGS"
1773 ])
1774
1775 if test "x$USE_GNUTLS" = "xyes"; then
1776 AC_MSG_NOTICE([detected GnuTLS version $version])
1777
1778 if test -n "$gtlslib"; then
1779 dnl when shared libs were found in a path that the run-time
1780 dnl linker doesn't search through, we need to add it to
1781 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1782 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001783 if test "x$cross_compiling" != "xyes"; then
1784 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1785 export LD_LIBRARY_PATH
1786 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1787 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001788 fi
1789 fi
1790
1791 fi
1792
1793 fi dnl GNUTLS not disabled
1794
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001795fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001796
1797dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001798dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001799dnl ---
1800
1801if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001802 USE_GNUTLS_NETTLE=
1803 # First check if we can detect either crypto library via transitive linking
1804 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1805 if test "$USE_GNUTLS_NETTLE" = ""; then
1806 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1807 fi
1808 # If not, try linking directly to both of them to see if they are available
1809 if test "$USE_GNUTLS_NETTLE" = ""; then
1810 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1811 fi
1812 if test "$USE_GNUTLS_NETTLE" = ""; then
1813 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1814 fi
1815 if test "$USE_GNUTLS_NETTLE" = ""; then
1816 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
1817 fi
1818 if test "$USE_GNUTLS_NETTLE" = "1"; then
1819 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
1820 AC_SUBST(USE_GNUTLS_NETTLE, [1])
1821 LIBS="-lnettle $LIBS"
1822 else
1823 LIBS="-lgcrypt $LIBS"
1824 fi
1825fi
1826
1827dnl ---
1828dnl We require GnuTLS with SRP support.
1829dnl ---
1830if test "$GNUTLS_ENABLED" = "1"; then
1831 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
1832 [
1833 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
1834 AC_SUBST(HAVE_GNUTLS_SRP, [1])
1835 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001836fi
1837
1838dnl ----------------------------------------------------
1839dnl check for PolarSSL
1840dnl ----------------------------------------------------
1841
1842dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1843OPT_POLARSSL=no
1844
1845_cppflags=$CPPFLAGS
1846_ldflags=$LDFLAGS
1847AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001848AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001849AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1850 OPT_POLARSSL=$withval)
1851
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001852if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001853
1854 if test X"$OPT_POLARSSL" != Xno; then
1855
1856 if test "$OPT_POLARSSL" = "yes"; then
1857 OPT_POLARSSL=""
1858 fi
1859
1860 if test -z "$OPT_POLARSSL" ; then
1861 dnl check for lib first without setting any new path
1862
1863 AC_CHECK_LIB(polarssl, havege_init,
1864 dnl libpolarssl found, set the variable
1865 [
1866 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1867 AC_SUBST(USE_POLARSSL, [1])
1868 POLARSSL_ENABLED=1
1869 USE_POLARSSL="yes"
1870 curl_ssl_msg="enabled (PolarSSL)"
1871 ])
1872 fi
1873
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001874 addld=""
1875 addlib=""
1876 addcflags=""
1877 polarssllib=""
1878
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001879 if test "x$USE_POLARSSL" != "xyes"; then
1880 dnl add the path and test again
1881 addld=-L$OPT_POLARSSL/lib$libsuff
1882 addcflags=-I$OPT_POLARSSL/include
1883 polarssllib=$OPT_POLARSSL/lib$libsuff
1884
1885 LDFLAGS="$LDFLAGS $addld"
1886 if test "$addcflags" != "-I/usr/include"; then
1887 CPPFLAGS="$CPPFLAGS $addcflags"
1888 fi
1889
1890 AC_CHECK_LIB(polarssl, ssl_init,
1891 [
1892 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1893 AC_SUBST(USE_POLARSSL, [1])
1894 POLARSSL_ENABLED=1
1895 USE_POLARSSL="yes"
1896 curl_ssl_msg="enabled (PolarSSL)"
1897 ],
1898 [
1899 CPPFLAGS=$_cppflags
1900 LDFLAGS=$_ldflags
1901 ])
1902 fi
1903
1904 if test "x$USE_POLARSSL" = "xyes"; then
1905 AC_MSG_NOTICE([detected PolarSSL])
1906
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001907 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001908
1909 if test -n "$polarssllib"; then
1910 dnl when shared libs were found in a path that the run-time
1911 dnl linker doesn't search through, we need to add it to
1912 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1913 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001914 if test "x$cross_compiling" != "xyes"; then
1915 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
1916 export LD_LIBRARY_PATH
1917 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
1918 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001919 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001920 fi
1921
1922 fi dnl PolarSSL not disabled
1923
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001924fi
1925
1926dnl ----------------------------------------------------
1927dnl check for CyaSSL
1928dnl ----------------------------------------------------
1929
1930dnl Default to compiler & linker defaults for CyaSSL files & libraries.
1931OPT_CYASSL=no
1932
1933_cppflags=$CPPFLAGS
1934_ldflags=$LDFLAGS
1935AC_ARG_WITH(cyassl,dnl
1936AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
1937AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
1938 OPT_CYASSL=$withval)
1939
1940if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1941
1942 if test X"$OPT_CYASSL" != Xno; then
1943
1944 if test "$OPT_CYASSL" = "yes"; then
1945 OPT_CYASSL=""
1946 fi
1947
1948 dnl This should be reworked to use pkg-config instead
1949
1950 cyassllibname=cyassl
1951
1952 if test -z "$OPT_CYASSL" ; then
1953 dnl check for lib in system default first
1954
1955 AC_CHECK_LIB(cyassl, CyaSSL_Init,
1956 dnl libcyassl found, set the variable
1957 [
1958 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1959 AC_SUBST(USE_CYASSL, [1])
1960 CYASSL_ENABLED=1
1961 USE_CYASSL="yes"
1962 curl_ssl_msg="enabled (CyaSSL)"
1963 ])
1964 fi
1965
1966 addld=""
1967 addlib=""
1968 addcflags=""
1969 cyassllib=""
1970
1971 if test "x$USE_CYASSL" != "xyes"; then
1972 dnl add the path and test again
1973 addld=-L$OPT_CYASSL/lib$libsuff
1974 addcflags=-I$OPT_CYASSL/include
1975 cyassllib=$OPT_CYASSL/lib$libsuff
1976
1977 LDFLAGS="$LDFLAGS $addld"
1978 if test "$addcflags" != "-I/usr/include"; then
1979 CPPFLAGS="$CPPFLAGS $addcflags"
1980 fi
1981
1982 AC_CHECK_LIB(cyassl, CyaSSL_Init,
1983 [
1984 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1985 AC_SUBST(USE_CYASSL, [1])
1986 CYASSL_ENABLED=1
1987 USE_CYASSL="yes"
1988 curl_ssl_msg="enabled (CyaSSL)"
1989 ],
1990 [
1991 CPPFLAGS=$_cppflags
1992 LDFLAGS=$_ldflags
1993 cyassllib=""
1994 ])
1995 fi
1996
1997 addld=""
1998 addlib=""
1999 addcflags=""
2000
2001 if test "x$USE_CYASSL" != "xyes"; then
2002 dnl libcyassl renamed to libwolfssl as of 3.4.0
2003 addld=-L$OPT_CYASSL/lib$libsuff
2004 addcflags=-I$OPT_CYASSL/include
2005 cyassllib=$OPT_CYASSL/lib$libsuff
2006
2007 LDFLAGS="$LDFLAGS $addld"
2008 if test "$addcflags" != "-I/usr/include"; then
2009 CPPFLAGS="$CPPFLAGS $addcflags"
2010 fi
2011
2012 cyassllibname=wolfssl
2013 my_ac_save_LIBS="$LIBS"
2014 LIBS="-l$cyassllibname -lm $LIBS"
2015
2016 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2017 AC_LINK_IFELSE([
2018 AC_LANG_PROGRAM([[
2019/* These aren't needed for detection and confuse WolfSSL.
2020 They are set up properly later if it is detected. */
2021#undef SIZEOF_LONG
2022#undef SIZEOF_LONG_LONG
2023#include <cyassl/ssl.h>
2024 ]],[[
2025 return CyaSSL_Init();
2026 ]])
2027 ],[
2028 AC_MSG_RESULT(yes)
2029 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2030 AC_SUBST(USE_CYASSL, [1])
2031 CYASSL_ENABLED=1
2032 USE_CYASSL="yes"
2033 curl_ssl_msg="enabled (CyaSSL)"
2034 ],
2035 [
2036 AC_MSG_RESULT(no)
2037 CPPFLAGS=$_cppflags
2038 LDFLAGS=$_ldflags
2039 cyassllib=""
2040 ])
2041 LIBS="$my_ac_save_LIBS"
2042 fi
2043
2044 if test "x$USE_CYASSL" = "xyes"; then
2045 AC_MSG_NOTICE([detected CyaSSL])
2046
2047 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2048 AC_CHECK_SIZEOF(long long)
2049
2050 dnl Versions since at least 2.6.0 may have options.h
2051 AC_CHECK_HEADERS(cyassl/options.h)
2052
2053 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2054 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2055
2056 LIBS="-l$cyassllibname -lm $LIBS"
2057
2058 if test -n "$cyassllib"; then
2059 dnl when shared libs were found in a path that the run-time
2060 dnl linker doesn't search through, we need to add it to
2061 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2062 dnl due to this
2063 if test "x$cross_compiling" != "xyes"; then
2064 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
2065 export LD_LIBRARY_PATH
2066 AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
2067 fi
2068 fi
2069
2070 fi
2071
2072 fi dnl CyaSSL not disabled
2073
2074fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002075
2076dnl ----------------------------------------------------
2077dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2078dnl ----------------------------------------------------
2079
2080dnl Default to compiler & linker defaults for NSS files & libraries.
2081OPT_NSS=no
2082
2083AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002084AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002085AC_HELP_STRING([--without-nss], [disable NSS detection]),
2086 OPT_NSS=$withval)
2087
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002088if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002089
2090 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002091
2092 addld=""
2093 addlib=""
2094 addcflags=""
2095 nssprefix=""
2096 version=""
2097
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002098 if test "x$OPT_NSS" = "xyes"; then
2099
2100 CURL_CHECK_PKGCONFIG(nss)
2101
2102 if test "$PKGCONFIG" != "no" ; then
2103 addlib=`$PKGCONFIG --libs nss`
2104 addcflags=`$PKGCONFIG --cflags nss`
2105 version=`$PKGCONFIG --modversion nss`
2106 nssprefix=`$PKGCONFIG --variable=prefix nss`
2107 else
2108 dnl Without pkg-config, we check for nss-config
2109
2110 check=`nss-config --version 2>/dev/null`
2111 if test -n "$check"; then
2112 addlib=`nss-config --libs`
2113 addcflags=`nss-config --cflags`
2114 version=`nss-config --version`
2115 nssprefix=`nss-config --prefix`
2116 else
2117 addlib="-lnss3"
2118 addcflags=""
2119 version="unknown"
2120 fi
2121 fi
2122 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002123 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2124 if test -f "$NSS_PCDIR/nss.pc"; then
2125 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2126 if test "$PKGCONFIG" != "no" ; then
2127 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2128 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2129 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2130 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2131 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2132 fi
2133 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002134 fi
2135
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002136 if test -z "$addlib"; then
2137 # Without pkg-config, we'll kludge in some defaults
2138 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2139 addld="-L$OPT_NSS/lib"
2140 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2141 addcflags="-I$OPT_NSS/include"
2142 version="unknown"
2143 nssprefix=$OPT_NSS
2144 fi
2145
2146 CLEANLDFLAGS="$LDFLAGS"
2147 CLEANLIBS="$LIBS"
2148 CLEANCPPFLAGS="$CPPFLAGS"
2149
2150 LDFLAGS="$addld $LDFLAGS"
2151 LIBS="$addlib $LIBS"
2152 if test "$addcflags" != "-I/usr/include"; then
2153 CPPFLAGS="$CPPFLAGS $addcflags"
2154 fi
2155
2156 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2157 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002158 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002159 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2160 AC_SUBST(USE_NSS, [1])
2161 USE_NSS="yes"
2162 NSS_ENABLED=1
2163 curl_ssl_msg="enabled (NSS)"
2164 ],
2165 [
2166 LDFLAGS="$CLEANLDFLAGS"
2167 LIBS="$CLEANLIBS"
2168 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002169 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002170
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002171 if test "x$USE_NSS" = "xyes"; then
2172 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002173
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002174 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2175 NSS_LIBS=$addlib
2176 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002177
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002178 dnl when shared libs were found in a path that the run-time
2179 dnl linker doesn't search through, we need to add it to
2180 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2181 dnl due to this
2182 if test "x$cross_compiling" != "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002183 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2184 export LD_LIBRARY_PATH
2185 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2186 fi
2187
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002188 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002189
2190 fi dnl NSS not disabled
2191
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002192fi dnl curl_ssl_msg = init_ssl_msg
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002193
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002194OPT_AXTLS=off
2195
2196AC_ARG_WITH(axtls,dnl
2197AC_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.])
2198AC_HELP_STRING([--without-axtls], [disable axTLS]),
2199 OPT_AXTLS=$withval)
2200
2201if test "$curl_ssl_msg" = "$init_ssl_msg"; then
2202 if test X"$OPT_AXTLS" != Xno; then
2203 dnl backup the pre-axtls variables
2204 CLEANLDFLAGS="$LDFLAGS"
2205 CLEANCPPFLAGS="$CPPFLAGS"
2206 CLEANLIBS="$LIBS"
2207
2208 case "$OPT_AXTLS" in
2209 yes)
2210 dnl --with-axtls (without path) used
2211 PREFIX_AXTLS=/usr/local
2212 LIB_AXTLS="$PREFIX_AXTLS/lib"
2213 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2214 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2215 ;;
2216 off)
2217 dnl no --with-axtls option given, just check default places
2218 PREFIX_AXTLS=
2219 ;;
2220 *)
2221 dnl check the given --with-axtls spot
2222 PREFIX_AXTLS=$OPT_AXTLS
2223 LIB_AXTLS="$PREFIX_AXTLS/lib"
2224 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2225 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2226 ;;
2227 esac
2228
2229 AC_CHECK_LIB(axtls, ssl_version,[
2230 LIBS="-laxtls $LIBS"
2231 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2232 AC_SUBST(USE_AXTLS, [1])
2233 AXTLS_ENABLED=1
2234 USE_AXTLS="yes"
2235 curl_ssl_msg="enabled (axTLS)"
2236
2237 if test "x$cross_compiling" != "xyes"; then
2238 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2239 export LD_LIBRARY_PATH
2240 AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2241 fi
2242 ],[
2243 LDFLAGS="$CLEANLDFLAGS"
2244 CPPFLAGS="$CLEANCPPFLAGS"
2245 LIBS="$CLEANLIBS"
2246 ])
2247 fi
2248fi
2249
2250if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002251 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002252 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 -07002253else
2254 # SSL is enabled, genericly
2255 AC_SUBST(SSL_ENABLED)
2256 SSL_ENABLED="1"
2257fi
2258
2259dnl **********************************************************************
2260dnl Check for the CA bundle
2261dnl **********************************************************************
2262
2263CURL_CHECK_CA_BUNDLE
2264
2265dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002266dnl Check for libmetalink
2267dnl **********************************************************************
2268
2269OPT_LIBMETALINK=no
2270
2271AC_ARG_WITH(libmetalink,dnl
2272AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2273AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2274 OPT_LIBMETALINK=$withval)
2275
2276if test X"$OPT_LIBMETALINK" != Xno; then
2277
2278 addld=""
2279 addlib=""
2280 addcflags=""
2281 version=""
2282 libmetalinklib=""
2283
2284 PKGTEST="no"
2285 if test "x$OPT_LIBMETALINK" = "xyes"; then
2286 dnl this is with no partiular path given
2287 PKGTEST="yes"
2288 CURL_CHECK_PKGCONFIG(libmetalink)
2289 else
2290 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2291 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2292 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2293 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2294 PKGTEST="yes"
2295 fi
2296 if test "$PKGTEST" = "yes"; then
2297 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2298 fi
2299 fi
2300 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2301 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2302 $PKGCONFIG --libs-only-l libmetalink`
2303 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2304 $PKGCONFIG --libs-only-L libmetalink`
2305 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2306 $PKGCONFIG --cflags-only-I libmetalink`
2307 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2308 $PKGCONFIG --modversion libmetalink`
2309 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2310 fi
2311 if test -n "$addlib"; then
2312
2313 clean_CPPFLAGS="$CPPFLAGS"
2314 clean_LDFLAGS="$LDFLAGS"
2315 clean_LIBS="$LIBS"
2316 CPPFLAGS="$addcflags $clean_CPPFLAGS"
2317 LDFLAGS="$addld $clean_LDFLAGS"
2318 LIBS="$addlib $clean_LIBS"
2319 AC_MSG_CHECKING([if libmetalink is recent enough])
2320 AC_LINK_IFELSE([
2321 AC_LANG_PROGRAM([[
2322# include <metalink/metalink.h>
2323 ]],[[
2324 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2325 return 1;
2326 ]])
2327 ],[
2328 AC_MSG_RESULT([yes ($version)])
2329 want_metalink="yes"
2330 ],[
2331 AC_MSG_RESULT([no ($version)])
2332 AC_MSG_NOTICE([libmetalink library defective or too old])
2333 want_metalink="no"
2334 ])
2335 CPPFLAGS="$clean_CPPFLAGS"
2336 LDFLAGS="$clean_LDFLAGS"
2337 LIBS="$clean_LIBS"
2338 if test "$want_metalink" = "yes"; then
2339 dnl finally libmetalink will be used
2340 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2341 LIBMETALINK_LIBS=$addlib
2342 LIBMETALINK_LDFLAGS=$addld
2343 LIBMETALINK_CPPFLAGS=$addcflags
2344 AC_SUBST([LIBMETALINK_LIBS])
2345 AC_SUBST([LIBMETALINK_LDFLAGS])
2346 AC_SUBST([LIBMETALINK_CPPFLAGS])
2347 curl_mtlnk_msg="enabled"
2348 fi
2349
2350 fi
2351fi
2352
2353dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002354dnl Check for the presence of LIBSSH2 libraries and headers
2355dnl **********************************************************************
2356
2357dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2358OPT_LIBSSH2=off
2359AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002360AC_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 -07002361AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2362 OPT_LIBSSH2=$withval)
2363
2364if test X"$OPT_LIBSSH2" != Xno; then
2365 dnl backup the pre-libssh2 variables
2366 CLEANLDFLAGS="$LDFLAGS"
2367 CLEANCPPFLAGS="$CPPFLAGS"
2368 CLEANLIBS="$LIBS"
2369
2370 case "$OPT_LIBSSH2" in
2371 yes)
2372 dnl --with-libssh2 (without path) used
2373 CURL_CHECK_PKGCONFIG(libssh2)
2374
2375 if test "$PKGCONFIG" != "no" ; then
2376 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2377 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2378 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2379 version=`$PKGCONFIG --modversion libssh2`
2380 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2381 fi
2382
2383 ;;
2384 off)
2385 dnl no --with-libssh2 option given, just check default places
2386 ;;
2387 *)
2388 dnl use the given --with-libssh2 spot
2389 PREFIX_SSH2=$OPT_LIBSSH2
2390 ;;
2391 esac
2392
2393 dnl if given with a prefix, we set -L and -I based on that
2394 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002395 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002396 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2397 CPP_SSH2=-I${PREFIX_SSH2}/include
2398 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2399 fi
2400
2401 LDFLAGS="$LDFLAGS $LD_SSH2"
2402 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002403 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002404
2405 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2406
2407 AC_CHECK_HEADERS(libssh2.h,
2408 curl_ssh_msg="enabled (libSSH2)"
2409 LIBSSH2_ENABLED=1
2410 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2411 AC_SUBST(USE_LIBSSH2, [1])
2412 )
2413
2414 if test X"$OPT_LIBSSH2" != Xoff &&
2415 test "$LIBSSH2_ENABLED" != "1"; then
2416 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2417 fi
2418
2419 if test "$LIBSSH2_ENABLED" = "1"; then
2420 if test -n "$DIR_SSH2"; then
2421 dnl when the libssh2 shared libs were found in a path that the run-time
2422 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2423 dnl to prevent further configure tests to fail due to this
2424
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002425 if test "x$cross_compiling" != "xyes"; then
2426 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2427 export LD_LIBRARY_PATH
2428 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2429 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002430 fi
2431 else
2432 dnl no libssh2, revert back to clean variables
2433 LDFLAGS=$CLEANLDFLAGS
2434 CPPFLAGS=$CLEANCPPFLAGS
2435 LIBS=$CLEANLIBS
2436 fi
2437fi
2438
2439dnl **********************************************************************
2440dnl Check for the presence of LIBRTMP libraries and headers
2441dnl **********************************************************************
2442
2443dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2444OPT_LIBRTMP=off
2445AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002446AC_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 -07002447AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2448 OPT_LIBRTMP=$withval)
2449
2450if test X"$OPT_LIBRTMP" != Xno; then
2451 dnl backup the pre-librtmp variables
2452 CLEANLDFLAGS="$LDFLAGS"
2453 CLEANCPPFLAGS="$CPPFLAGS"
2454 CLEANLIBS="$LIBS"
2455
2456 case "$OPT_LIBRTMP" in
2457 yes)
2458 dnl --with-librtmp (without path) used
2459 CURL_CHECK_PKGCONFIG(librtmp)
2460
2461 if test "$PKGCONFIG" != "no" ; then
2462 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2463 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2464 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2465 version=`$PKGCONFIG --modversion librtmp`
2466 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002467 else
2468 dnl To avoid link errors, we do not allow --librtmp without
2469 dnl a pkgconfig file
2470 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002471 fi
2472
2473 ;;
2474 off)
2475 dnl no --with-librtmp option given, just check default places
2476 LIB_RTMP="-lrtmp"
2477 ;;
2478 *)
2479 dnl use the given --with-librtmp spot
2480 PREFIX_RTMP=$OPT_LIBRTMP
2481 ;;
2482 esac
2483
2484 dnl if given with a prefix, we set -L and -I based on that
2485 if test -n "$PREFIX_RTMP"; then
2486 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2487 CPP_RTMP=-I${PREFIX_RTMP}/include
2488 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2489 fi
2490
2491 LDFLAGS="$LDFLAGS $LD_RTMP"
2492 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002493 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002494
2495 AC_CHECK_LIB(rtmp, RTMP_Init,
2496 [
2497 AC_CHECK_HEADERS(librtmp/rtmp.h,
2498 curl_rtmp_msg="enabled (librtmp)"
2499 LIBRTMP_ENABLED=1
2500 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2501 AC_SUBST(USE_LIBRTMP, [1])
2502 )
2503 ],
2504 dnl not found, revert back to clean variables
2505 LDFLAGS=$CLEANLDFLAGS
2506 CPPFLAGS=$CLEANCPPFLAGS
2507 LIBS=$CLEANLIBS
2508 )
2509
2510 if test X"$OPT_LIBRTMP" != Xoff &&
2511 test "$LIBRTMP_ENABLED" != "1"; then
2512 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2513 fi
2514
2515fi
2516
2517dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002518dnl Check for linker switch for versioned symbols
2519dnl **********************************************************************
2520
2521versioned_symbols_flavour=
2522AC_MSG_CHECKING([whether versioned symbols are wanted])
2523AC_ARG_ENABLE(versioned-symbols,
2524AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2525AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2526[ case "$enableval" in
2527 yes) AC_MSG_RESULT(yes)
2528 AC_MSG_CHECKING([if libraries can be versioned])
2529 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2530 if test -z "$GLD"; then
2531 AC_MSG_RESULT(no)
2532 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2533 else
2534 AC_MSG_RESULT(yes)
2535 if test "x$OPENSSL_ENABLED" = "x1"; then
2536 versioned_symbols_flavour="OPENSSL_"
2537 elif test "x$GNUTLS_ENABLED" = "x1"; then
2538 versioned_symbols_flavour="GNUTLS_"
2539 elif test "x$NSS_ENABLED" = "x1"; then
2540 versioned_symbols_flavour="NSS_"
2541 elif test "x$POLARSSL_ENABLED" = "x1"; then
2542 versioned_symbols_flavour="POLARSSL_"
2543 elif test "x$CYASSL_ENABLED" = "x1"; then
2544 versioned_symbols_flavour="CYASSL_"
2545 elif test "x$AXTLS_ENABLED" = "x1"; then
2546 versioned_symbols_flavour="AXTLS_"
2547 elif test "x$WINSSL_ENABLED" = "x1"; then
2548 versioned_symbols_flavour="WINSSL_"
2549 elif test "x$DARWINSSL_ENABLED" = "x1"; then
2550 versioned_symbols_flavour="DARWINSSL_"
2551 else
2552 versioned_symbols_flavour=""
2553 fi
2554 versioned_symbols="yes"
2555 fi
2556 ;;
2557
2558 *) AC_MSG_RESULT(no)
2559 ;;
2560 esac
2561], [
2562AC_MSG_RESULT(no)
2563]
2564)
2565
2566AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2567 ["$versioned_symbols_flavour"])
2568AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2569 [test "x$versioned_symbols" = 'xyes'])
2570
2571dnl -------------------------------------------------
2572dnl check winidn option before other IDN libraries
2573dnl -------------------------------------------------
2574
2575AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2576OPT_WINIDN="default"
2577AC_ARG_WITH(winidn,
2578AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2579AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
2580 OPT_WINIDN=$withval)
2581case "$OPT_WINIDN" in
2582 no|default)
2583 dnl --without-winidn option used or configure option not specified
2584 want_winidn="no"
2585 AC_MSG_RESULT([no])
2586 ;;
2587 yes)
2588 dnl --with-winidn option used without path
2589 want_winidn="yes"
2590 want_winidn_path="default"
2591 AC_MSG_RESULT([yes])
2592 ;;
2593 *)
2594 dnl --with-winidn option used with path
2595 want_winidn="yes"
2596 want_winidn_path="$withval"
2597 AC_MSG_RESULT([yes ($withval)])
2598 ;;
2599esac
2600
2601if test "$want_winidn" = "yes"; then
2602 dnl winidn library support has been requested
2603 clean_CPPFLAGS="$CPPFLAGS"
2604 clean_LDFLAGS="$LDFLAGS"
2605 clean_LIBS="$LIBS"
2606 WINIDN_LIBS="-lnormaliz"
2607 #
2608 if test "$want_winidn_path" != "default"; then
2609 dnl path has been specified
2610 dnl pkg-config not available or provides no info
2611 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2612 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2613 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2614 fi
2615 #
2616 CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
2617 LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
2618 LIBS="$WINIDN_LIBS $LIBS"
2619 #
2620 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2621 AC_LINK_IFELSE([
2622 AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
2623 ],[
2624 AC_MSG_RESULT([yes])
2625 tst_links_winidn="yes"
2626 ],[
2627 AC_MSG_RESULT([no])
2628 tst_links_winidn="no"
2629 ])
2630 #
2631 if test "$tst_links_winidn" = "yes"; then
2632 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2633 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
2634 AC_SUBST([IDN_ENABLED], [1])
2635 curl_idn_msg="enabled (Windows-native)"
2636 else
2637 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2638 CPPFLAGS="$clean_CPPFLAGS"
2639 LDFLAGS="$clean_LDFLAGS"
2640 LIBS="$clean_LIBS"
2641 fi
2642fi
2643
2644dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002645dnl Check for the presence of IDN libraries and headers
2646dnl **********************************************************************
2647
2648AC_MSG_CHECKING([whether to build with libidn])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002649OPT_IDN="default"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002650AC_ARG_WITH(libidn,
2651AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
2652AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002653 [OPT_IDN=$withval])
2654case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002655 no)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002656 dnl --without-libidn option used
2657 want_idn="no"
2658 AC_MSG_RESULT([no])
2659 ;;
2660 default)
2661 dnl configure option not specified
2662 want_idn="yes"
2663 want_idn_path="default"
2664 AC_MSG_RESULT([(assumed) yes])
2665 ;;
2666 yes)
2667 dnl --with-libidn option used without path
2668 want_idn="yes"
2669 want_idn_path="default"
2670 AC_MSG_RESULT([yes])
2671 ;;
2672 *)
2673 dnl --with-libidn option used with path
2674 want_idn="yes"
2675 want_idn_path="$withval"
2676 AC_MSG_RESULT([yes ($withval)])
2677 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002678esac
2679
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002680if test "$want_idn" = "yes"; then
2681 dnl idn library support has been requested
2682 clean_CPPFLAGS="$CPPFLAGS"
2683 clean_LDFLAGS="$LDFLAGS"
2684 clean_LIBS="$LIBS"
2685 PKGCONFIG="no"
2686 #
2687 if test "$want_idn_path" != "default"; then
2688 dnl path has been specified
2689 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
2690 CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
2691 if test "$PKGCONFIG" != "no"; then
2692 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2693 $PKGCONFIG --libs-only-l libidn 2>/dev/null`
2694 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2695 $PKGCONFIG --libs-only-L libidn 2>/dev/null`
2696 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2697 $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2698 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2699 else
2700 dnl pkg-config not available or provides no info
2701 IDN_LIBS="-lidn"
2702 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
2703 IDN_CPPFLAGS="-I$want_idn_path/include"
2704 IDN_DIR="$want_idn_path/lib$libsuff"
2705 fi
2706 else
2707 dnl path not specified
2708 CURL_CHECK_PKGCONFIG(libidn)
2709 if test "$PKGCONFIG" != "no"; then
2710 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
2711 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
2712 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2713 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2714 else
2715 dnl pkg-config not available or provides no info
2716 IDN_LIBS="-lidn"
2717 fi
2718 fi
2719 #
2720 if test "$PKGCONFIG" != "no"; then
2721 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
2722 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
2723 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2724 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
2725 else
2726 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
2727 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
2728 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2729 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
2730 fi
2731 #
2732 CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
2733 LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
2734 LIBS="$IDN_LIBS $LIBS"
2735 #
2736 AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
2737 AC_LINK_IFELSE([
2738 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
2739 ],[
2740 AC_MSG_RESULT([yes])
2741 tst_links_libidn="yes"
2742 ],[
2743 AC_MSG_RESULT([no])
2744 tst_links_libidn="no"
2745 ])
2746 if test "$tst_links_libidn" = "no"; then
2747 AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
2748 AC_LINK_IFELSE([
2749 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
2750 ],[
2751 AC_MSG_RESULT([yes])
2752 tst_links_libidn="yes"
2753 ],[
2754 AC_MSG_RESULT([no])
2755 tst_links_libidn="no"
2756 ])
2757 fi
2758 #
2759 if test "$tst_links_libidn" = "yes"; then
2760 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
2761 dnl different versions of libidn have different setups of these:
2762 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
2763 AC_CHECK_HEADERS( idn-free.h tld.h )
2764 if test "x$ac_cv_header_tld_h" = "xyes"; then
2765 AC_SUBST([IDN_ENABLED], [1])
2766 curl_idn_msg="enabled"
2767 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
2768 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
2769 export LD_LIBRARY_PATH
2770 AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
2771 fi
2772 else
2773 AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
2774 CPPFLAGS="$clean_CPPFLAGS"
2775 LDFLAGS="$clean_LDFLAGS"
2776 LIBS="$clean_LIBS"
2777 fi
2778 else
2779 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2780 CPPFLAGS="$clean_CPPFLAGS"
2781 LDFLAGS="$clean_LDFLAGS"
2782 LIBS="$clean_LIBS"
2783 fi
2784fi
2785
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002786
2787dnl Let's hope this split URL remains working:
2788dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
2789dnl genprogc/thread_quick_ref.htm
2790
2791
2792dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002793dnl Check for nghttp2
2794dnl **********************************************************************
2795
2796OPT_H2="yes"
2797AC_ARG_WITH(nghttp2,
2798AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
2799AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
2800 [OPT_H2=$withval])
2801case "$OPT_H2" in
2802 no)
2803 dnl --without-nghttp2 option used
2804 want_h2="no"
2805 ;;
2806 yes)
2807 dnl --with-nghttp2 option used without path
2808 want_h2="default"
2809 want_h2_path=""
2810 ;;
2811 *)
2812 dnl --with-nghttp2 option used with path
2813 want_h2="yes"
2814 want_h2_path="$withval/lib/pkgconfig"
2815 ;;
2816esac
2817
2818curl_h2_msg="disabled (--with-nghttp2)"
2819if test X"$want_h2" != Xno; then
2820 dnl backup the pre-nghttp2 variables
2821 CLEANLDFLAGS="$LDFLAGS"
2822 CLEANCPPFLAGS="$CPPFLAGS"
2823 CLEANLIBS="$LIBS"
2824
2825 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
2826
2827 if test "$PKGCONFIG" != "no" ; then
2828 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2829 $PKGCONFIG --libs-only-l libnghttp2`
2830 AC_MSG_NOTICE([-l is $LIB_H2])
2831
2832 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
2833 $PKGCONFIG --cflags-only-I libnghttp2`
2834 AC_MSG_NOTICE([-I is $CPP_H2])
2835
2836 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2837 $PKGCONFIG --libs-only-L libnghttp2`
2838 AC_MSG_NOTICE([-L is $LD_H2])
2839
2840 LDFLAGS="$LDFLAGS $LD_H2"
2841 CPPFLAGS="$CPPFLAGS $CPP_H2"
2842 LIBS="$LIB_H2 $LIBS"
2843
2844 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
2845 # >= 1.0.0
2846 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
2847 [
2848 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
2849 curl_h2_msg="enabled (nghttp2)"
2850 NGHTTP2_ENABLED=1
2851 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
2852 AC_SUBST(USE_NGHTTP2, [1])
2853 )
2854 ],
2855 dnl not found, revert back to clean variables
2856 LDFLAGS=$CLEANLDFLAGS
2857 CPPFLAGS=$CLEANCPPFLAGS
2858 LIBS=$CLEANLIBS
2859 )
2860
2861 else
2862 dnl no nghttp2 pkg-config found, deal with it
2863 if test X"$want_h2" != Xdefault; then
2864 dnl To avoid link errors, we do not allow --with-nghttp2 without
2865 dnl a pkgconfig file
2866 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
2867 fi
2868 fi
2869
2870fi
2871
2872dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002873dnl Back to "normal" configuring
2874dnl **********************************************************************
2875
2876dnl Checks for header files.
2877AC_HEADER_STDC
2878
2879CURL_CHECK_HEADER_MALLOC
2880CURL_CHECK_HEADER_MEMORY
2881
2882dnl Now check for the very most basic headers. Then we can use these
2883dnl ones as default-headers when checking for the rest!
2884AC_CHECK_HEADERS(
2885 sys/types.h \
2886 sys/time.h \
2887 sys/select.h \
2888 sys/socket.h \
2889 sys/ioctl.h \
2890 sys/uio.h \
2891 assert.h \
2892 unistd.h \
2893 stdlib.h \
2894 limits.h \
2895 arpa/inet.h \
2896 net/if.h \
2897 netinet/in.h \
2898 sys/un.h \
2899 netinet/tcp.h \
2900 netdb.h \
2901 sys/sockio.h \
2902 sys/stat.h \
2903 sys/param.h \
2904 termios.h \
2905 termio.h \
2906 sgtty.h \
2907 fcntl.h \
2908 alloca.h \
2909 time.h \
2910 io.h \
2911 pwd.h \
2912 utime.h \
2913 sys/utime.h \
2914 sys/poll.h \
2915 poll.h \
2916 socket.h \
2917 sys/resource.h \
2918 libgen.h \
2919 locale.h \
2920 errno.h \
2921 stdbool.h \
2922 arpa/tftp.h \
2923 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002924 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002925 setjmp.h,
2926dnl to do if not found
2927[],
2928dnl to do if found
2929[],
2930dnl default includes
2931[
2932#ifdef HAVE_SYS_TYPES_H
2933#include <sys/types.h>
2934#endif
2935#ifdef HAVE_SYS_TIME_H
2936#include <sys/time.h>
2937#endif
2938#ifdef HAVE_SYS_SELECT_H
2939#include <sys/select.h>
2940#endif
2941#ifdef HAVE_SYS_SOCKET_H
2942#include <sys/socket.h>
2943#endif
2944#ifdef HAVE_NETINET_IN_H
2945#include <netinet/in.h>
2946#endif
2947#ifdef HAVE_SYS_UN_H
2948#include <sys/un.h>
2949#endif
2950]
2951)
2952
2953dnl Checks for typedefs, structures, and compiler characteristics.
2954AC_C_CONST
2955CURL_CHECK_VARIADIC_MACROS
2956AC_TYPE_SIZE_T
2957AC_HEADER_TIME
2958CURL_CHECK_STRUCT_TIMEVAL
2959CURL_VERIFY_RUNTIMELIBS
2960
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002961AC_CHECK_SIZEOF(off_t)
2962
2963soname_bump=no
2964if test x"$ac_cv_native_windows" != "xyes" &&
2965 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2966 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2967 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2968 soname_bump=yes
2969fi
2970
2971
2972AC_CHECK_TYPE(long long,
2973 [AC_DEFINE(HAVE_LONGLONG, 1,
2974 [Define to 1 if the compiler supports the 'long long' data type.])]
2975 longlong="yes"
2976)
2977
2978if test "xyes" = "x$longlong"; then
2979 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002980 AC_COMPILE_IFELSE([
2981 AC_LANG_PROGRAM([[
2982 ]],[[
2983 long long val = 1000LL;
2984 ]])
2985 ],[
2986 AC_MSG_RESULT([yes])
2987 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
2988 ],[
2989 AC_MSG_RESULT([no])
2990 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002991fi
2992
2993
2994# check for ssize_t
2995AC_CHECK_TYPE(ssize_t, ,
2996 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
2997
2998# check for bool type
2999AC_CHECK_TYPE([bool],[
3000 AC_DEFINE(HAVE_BOOL_T, 1,
3001 [Define to 1 if bool is an available type.])
3002], ,[
3003#ifdef HAVE_SYS_TYPES_H
3004#include <sys/types.h>
3005#endif
3006#ifdef HAVE_STDBOOL_H
3007#include <stdbool.h>
3008#endif
3009])
3010
3011CURL_CONFIGURE_CURL_SOCKLEN_T
3012
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003013CURL_CONFIGURE_PULL_SYS_POLL
3014
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003015TYPE_IN_ADDR_T
3016
3017TYPE_SOCKADDR_STORAGE
3018
3019TYPE_SIG_ATOMIC_T
3020
3021AC_TYPE_SIGNAL
3022
3023CURL_CHECK_FUNC_SELECT
3024
3025CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003026CURL_CHECK_FUNC_SEND
3027CURL_CHECK_MSG_NOSIGNAL
3028
3029CURL_CHECK_FUNC_ALARM
3030CURL_CHECK_FUNC_BASENAME
3031CURL_CHECK_FUNC_CLOSESOCKET
3032CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3033CURL_CHECK_FUNC_CONNECT
3034CURL_CHECK_FUNC_FCNTL
3035CURL_CHECK_FUNC_FDOPEN
3036CURL_CHECK_FUNC_FREEADDRINFO
3037CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003038CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003039CURL_CHECK_FUNC_FTRUNCATE
3040CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003041CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003042CURL_CHECK_FUNC_GETHOSTBYADDR
3043CURL_CHECK_FUNC_GETHOSTBYADDR_R
3044CURL_CHECK_FUNC_GETHOSTBYNAME
3045CURL_CHECK_FUNC_GETHOSTBYNAME_R
3046CURL_CHECK_FUNC_GETHOSTNAME
3047CURL_CHECK_FUNC_GETIFADDRS
3048CURL_CHECK_FUNC_GETSERVBYPORT_R
3049CURL_CHECK_FUNC_GMTIME_R
3050CURL_CHECK_FUNC_INET_NTOA_R
3051CURL_CHECK_FUNC_INET_NTOP
3052CURL_CHECK_FUNC_INET_PTON
3053CURL_CHECK_FUNC_IOCTL
3054CURL_CHECK_FUNC_IOCTLSOCKET
3055CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3056CURL_CHECK_FUNC_LOCALTIME_R
3057CURL_CHECK_FUNC_MEMRCHR
3058CURL_CHECK_FUNC_POLL
3059CURL_CHECK_FUNC_SETSOCKOPT
3060CURL_CHECK_FUNC_SIGACTION
3061CURL_CHECK_FUNC_SIGINTERRUPT
3062CURL_CHECK_FUNC_SIGNAL
3063CURL_CHECK_FUNC_SIGSETJMP
3064CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003065CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003066CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003067CURL_CHECK_FUNC_STRCMPI
3068CURL_CHECK_FUNC_STRDUP
3069CURL_CHECK_FUNC_STRERROR_R
3070CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003071CURL_CHECK_FUNC_STRNCASECMP
3072CURL_CHECK_FUNC_STRNCMPI
3073CURL_CHECK_FUNC_STRNICMP
3074CURL_CHECK_FUNC_STRSTR
3075CURL_CHECK_FUNC_STRTOK_R
3076CURL_CHECK_FUNC_STRTOLL
3077CURL_CHECK_FUNC_WRITEV
3078
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003079case $host in
3080 *msdosdjgpp)
3081 ac_cv_func_pipe=no
3082 skipcheck_pipe=yes
3083 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3084 ;;
3085esac
3086
3087AC_CHECK_FUNCS([fork \
3088 geteuid \
3089 getpass_r \
3090 getppid \
3091 getprotobyname \
3092 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003093 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003094 getrlimit \
3095 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003096 if_nametoindex \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003097 inet_addr \
3098 perror \
3099 pipe \
3100 setlocale \
3101 setmode \
3102 setrlimit \
3103 uname \
3104 utime
3105],[
3106],[
3107 func="$ac_func"
3108 eval skipcheck=\$skipcheck_$func
3109 if test "x$skipcheck" != "xyes"; then
3110 AC_MSG_CHECKING([deeper for $func])
3111 AC_LINK_IFELSE([
3112 AC_LANG_PROGRAM([[
3113 ]],[[
3114 $func ();
3115 ]])
3116 ],[
3117 AC_MSG_RESULT([yes])
3118 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003119 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003120 [Define to 1 if you have the $func function.])
3121 ],[
3122 AC_MSG_RESULT([but still no])
3123 ])
3124 fi
3125])
3126
3127dnl Check if the getnameinfo function is available
3128dnl and get the types of five of its arguments.
3129CURL_CHECK_FUNC_GETNAMEINFO
3130
3131if test "$ipv6" = "yes"; then
3132 if test "$ac_cv_func_getaddrinfo" = "yes"; then
3133 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3134 IPV6_ENABLED=1
3135 AC_SUBST(IPV6_ENABLED)
3136 fi
3137 CURL_CHECK_NI_WITHSCOPEID
3138fi
3139
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003140CURL_CHECK_NONBLOCKING_SOCKET
3141
3142dnl ************************************************************
3143dnl nroff tool stuff
3144dnl
3145
3146AC_PATH_PROG( PERL, perl, ,
3147 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3148AC_SUBST(PERL)
3149
3150AC_PATH_PROGS( NROFF, gnroff nroff, ,
3151 $PATH:/usr/bin/:/usr/local/bin )
3152AC_SUBST(NROFF)
3153
3154if test -n "$NROFF"; then
3155 dnl only check for nroff options if an nroff command was found
3156
3157 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3158 MANOPT="-man"
3159 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3160 if test -z "$mancheck"; then
3161 MANOPT="-mandoc"
3162 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3163 if test -z "$mancheck"; then
3164 MANOPT=""
3165 AC_MSG_RESULT([failed])
3166 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3167 else
3168 AC_MSG_RESULT([$MANOPT])
3169 fi
3170 else
3171 AC_MSG_RESULT([$MANOPT])
3172 fi
3173 AC_SUBST(MANOPT)
3174fi
3175
3176if test -z "$MANOPT"
3177then
3178 dnl if no nroff tool was found, or no option that could convert man pages
3179 dnl was found, then disable the built-in manual stuff
3180 AC_MSG_WARN([disabling built-in manual])
3181 USE_MANUAL="no";
3182fi
3183
3184dnl *************************************************************************
3185dnl If the manual variable still is set, then we go with providing a built-in
3186dnl manual
3187
3188if test "$USE_MANUAL" = "1"; then
3189 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3190 curl_manual_msg="enabled"
3191fi
3192
3193dnl set variable for use in automakefile(s)
3194AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3195
3196CURL_CHECK_LIB_ARES
3197AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3198
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003199if test "x$ac_cv_native_windows" != "xyes" &&
3200 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003201 build_libhostname=yes
3202else
3203 build_libhostname=no
3204fi
3205AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3206
3207CURL_CHECK_OPTION_THREADED_RESOLVER
3208
3209if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
3210 AC_MSG_ERROR(
3211[Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
3212fi
3213
3214if test "$want_thres" = "yes"; then
3215 AC_CHECK_HEADER(pthread.h,
3216 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3217 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003218
3219 dnl first check for function without lib
3220 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3221
3222 dnl if it wasn't found without lib, search for it in pthread lib
3223 if test "$USE_THREADS_POSIX" != "1"
3224 then
3225 CFLAGS="$CFLAGS -pthread"
3226 AC_CHECK_LIB(pthread, pthread_create,
3227 [USE_THREADS_POSIX=1],
3228 [ CFLAGS="$save_CFLAGS"])
3229 fi
3230
3231 if test "x$USE_THREADS_POSIX" = "x1"
3232 then
3233 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3234 curl_res_msg="POSIX threaded"
3235 fi
3236
3237
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003238 ])
3239fi
3240
3241dnl ************************************************************
3242dnl disable verbose text strings
3243dnl
3244AC_MSG_CHECKING([whether to enable verbose strings])
3245AC_ARG_ENABLE(verbose,
3246AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3247AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3248[ case "$enableval" in
3249 no)
3250 AC_MSG_RESULT(no)
3251 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3252 curl_verbose_msg="no"
3253 ;;
3254 *) AC_MSG_RESULT(yes)
3255 ;;
3256 esac ],
3257 AC_MSG_RESULT(yes)
3258)
3259
3260dnl ************************************************************
3261dnl enable SSPI support
3262dnl
3263AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3264AC_ARG_ENABLE(sspi,
3265AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3266AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3267[ case "$enableval" in
3268 yes)
3269 if test "$ac_cv_native_windows" = "yes"; then
3270 AC_MSG_RESULT(yes)
3271 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3272 AC_SUBST(USE_WINDOWS_SSPI, [1])
3273 curl_sspi_msg="enabled"
3274 else
3275 AC_MSG_RESULT(no)
3276 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3277 fi
3278 ;;
3279 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003280 if test "x$WINSSL_ENABLED" = "x1"; then
3281 # --with-winssl implies --enable-sspi
3282 AC_MSG_RESULT(yes)
3283 else
3284 AC_MSG_RESULT(no)
3285 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003286 ;;
3287 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003288 if test "x$WINSSL_ENABLED" = "x1"; then
3289 # --with-winssl implies --enable-sspi
3290 AC_MSG_RESULT(yes)
3291 else
3292 AC_MSG_RESULT(no)
3293 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003294)
3295
3296dnl ************************************************************
3297dnl disable cryptographic authentication
3298dnl
3299AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3300AC_ARG_ENABLE(crypto-auth,
3301AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3302AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3303[ case "$enableval" in
3304 no)
3305 AC_MSG_RESULT(no)
3306 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003307 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003308 ;;
3309 *) AC_MSG_RESULT(yes)
3310 ;;
3311 esac ],
3312 AC_MSG_RESULT(yes)
3313)
3314
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003315CURL_CHECK_OPTION_NTLM_WB
3316
3317CURL_CHECK_NTLM_WB
3318
3319dnl ************************************************************
3320dnl disable TLS-SRP authentication
3321dnl
3322AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3323AC_ARG_ENABLE(tls-srp,
3324AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3325AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3326[ case "$enableval" in
3327 no)
3328 AC_MSG_RESULT(no)
3329 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3330 want_tls_srp=no
3331 ;;
3332 *) AC_MSG_RESULT(yes)
3333 want_tls_srp=yes
3334 ;;
3335 esac ],
3336 AC_MSG_RESULT(yes)
3337 want_tls_srp=yes
3338)
3339
3340if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3341 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3342 USE_TLS_SRP=1
3343 curl_tls_srp_msg="enabled"
3344fi
3345
3346dnl ************************************************************
3347dnl disable Unix domain sockets support
3348dnl
3349AC_MSG_CHECKING([whether to enable Unix domain sockets])
3350AC_ARG_ENABLE(unix-sockets,
3351AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3352AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3353[ case "$enableval" in
3354 no) AC_MSG_RESULT(no)
3355 want_unix_sockets=no
3356 ;;
3357 *) AC_MSG_RESULT(yes)
3358 want_unix_sockets=yes
3359 ;;
3360 esac ], [
3361 AC_MSG_RESULT(auto)
3362 want_unix_sockets=auto
3363 ]
3364)
3365if test "x$want_unix_sockets" != "xno"; then
3366 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3367 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3368 AC_SUBST(USE_UNIX_SOCKETS, [1])
3369 curl_unix_sockets_msg="enabled"
3370 ], [
3371 if test "x$want_unix_sockets" = "xyes"; then
3372 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3373 fi
3374 ], [
3375 #include <sys/un.h>
3376 ])
3377fi
3378
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003379dnl ************************************************************
3380dnl disable cookies support
3381dnl
3382AC_MSG_CHECKING([whether to enable support for cookies])
3383AC_ARG_ENABLE(cookies,
3384AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3385AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3386[ case "$enableval" in
3387 no)
3388 AC_MSG_RESULT(no)
3389 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3390 ;;
3391 *) AC_MSG_RESULT(yes)
3392 ;;
3393 esac ],
3394 AC_MSG_RESULT(yes)
3395)
3396
3397dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003398dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003399dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003400CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003401
3402dnl ************************************************************
3403dnl enforce SONAME bump
3404dnl
3405
3406AC_MSG_CHECKING([whether to enforce SONAME bump])
3407AC_ARG_ENABLE(soname-bump,
3408AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
3409AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
3410[ case "$enableval" in
3411 yes) AC_MSG_RESULT(yes)
3412 soname_bump=yes
3413 ;;
3414 *)
3415 AC_MSG_RESULT(no)
3416 ;;
3417 esac ],
3418 AC_MSG_RESULT($soname_bump)
3419)
3420AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
3421
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003422dnl
3423dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003424dnl
3425LIBCURL_LIBS=$LIBS
3426
3427AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003428AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003429AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3430
3431dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3432dnl LIBS variable used in generated makefile at makefile processing
3433dnl time. Doing this functionally prevents LIBS from being used for
3434dnl all link targets in given makefile.
3435BLANK_AT_MAKETIME=
3436AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003437
3438AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3439
3440dnl yes or no
3441ENABLE_SHARED="$enable_shared"
3442AC_SUBST(ENABLE_SHARED)
3443
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003444dnl to let curl-config output the static libraries correctly
3445ENABLE_STATIC="$enable_static"
3446AC_SUBST(ENABLE_STATIC)
3447
3448
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003449dnl
3450dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003451dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003452dnl
3453
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003454if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003455 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3456elif test -n "$SSL_ENABLED"; then
3457 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3458fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003459if test "x$IPV6_ENABLED" = "x1"; then
3460 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3461fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003462if test "x$USE_UNIX_SOCKETS" = "x1"; then
3463 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3464fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003465if test "x$HAVE_LIBZ" = "x1"; then
3466 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3467fi
3468if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
3469 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3470fi
3471if test "x$IDN_ENABLED" = "x1"; then
3472 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3473fi
3474if test "x$USE_WINDOWS_SSPI" = "x1"; then
3475 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3476fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003477
3478if test "x$HAVE_GSSAPI" = "x1"; then
3479 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3480fi
3481
3482if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3483 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3484 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3485fi
3486
3487if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3488 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3489 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3490fi
3491
3492if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3493 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3494 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3495 -o "x$DARWINSSL_ENABLED" = "x1"; then
3496 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3497
3498 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3499 "x$NTLM_WB_ENABLED" = "x1"; then
3500 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3501 fi
3502 fi
3503fi
3504
3505if test "x$USE_TLS_SRP" = "x1"; then
3506 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3507fi
3508
3509if test "x$USE_NGHTTP2" = "x1"; then
3510 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003511fi
3512
3513AC_SUBST(SUPPORT_FEATURES)
3514
3515dnl For supported protocols in pkg-config file
3516if test "x$CURL_DISABLE_HTTP" != "x1"; then
3517 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3518 if test "x$SSL_ENABLED" = "x1"; then
3519 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3520 fi
3521fi
3522if test "x$CURL_DISABLE_FTP" != "x1"; then
3523 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3524 if test "x$SSL_ENABLED" = "x1"; then
3525 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3526 fi
3527fi
3528if test "x$CURL_DISABLE_FILE" != "x1"; then
3529 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3530fi
3531if test "x$CURL_DISABLE_TELNET" != "x1"; then
3532 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3533fi
3534if test "x$CURL_DISABLE_LDAP" != "x1"; then
3535 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3536 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3537 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3538 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3539 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3540 fi
3541 fi
3542fi
3543if test "x$CURL_DISABLE_DICT" != "x1"; then
3544 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3545fi
3546if test "x$CURL_DISABLE_TFTP" != "x1"; then
3547 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3548fi
3549if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3550 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3551fi
3552if test "x$CURL_DISABLE_POP3" != "x1"; then
3553 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3554 if test "x$SSL_ENABLED" = "x1"; then
3555 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3556 fi
3557fi
3558if test "x$CURL_DISABLE_IMAP" != "x1"; then
3559 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3560 if test "x$SSL_ENABLED" = "x1"; then
3561 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3562 fi
3563fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003564if test "x$CURL_DISABLE_SMB" != "x1" \
3565 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3566 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3567 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3568 -o "x$DARWINSSL_ENABLED" = "x1" \); then
3569 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3570 if test "x$SSL_ENABLED" = "x1"; then
3571 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
3572 fi
3573fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003574if test "x$CURL_DISABLE_SMTP" != "x1"; then
3575 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3576 if test "x$SSL_ENABLED" = "x1"; then
3577 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3578 fi
3579fi
3580if test "x$USE_LIBSSH2" = "x1"; then
3581 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3582 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3583fi
3584if test "x$CURL_DISABLE_RTSP" != "x1"; then
3585 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3586fi
3587if test "x$USE_LIBRTMP" = "x1"; then
3588 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3589fi
3590
3591dnl replace spaces with newlines
3592dnl sort the lines
3593dnl replace the newlines back to spaces
3594SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3595
3596AC_SUBST(SUPPORT_PROTOCOLS)
3597
3598dnl squeeze whitespace out of some variables
3599
3600squeeze CFLAGS
3601squeeze CPPFLAGS
3602squeeze DEFS
3603squeeze LDFLAGS
3604squeeze LIBS
3605
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003606squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003607squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003608squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003609
3610squeeze SUPPORT_FEATURES
3611squeeze SUPPORT_PROTOCOLS
3612
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003613XC_CHECK_BUILD_FLAGS
3614
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003615if test "x$want_curldebug_assumed" = "xyes" &&
3616 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3617 ac_configure_args="$ac_configure_args --enable-curldebug"
3618fi
3619
3620AC_CONFIG_FILES([Makefile \
3621 docs/Makefile \
3622 docs/examples/Makefile \
3623 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003624 docs/libcurl/opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003625 include/Makefile \
3626 include/curl/Makefile \
3627 src/Makefile \
3628 lib/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003629 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003630 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003631 tests/certs/Makefile \
3632 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003633 tests/data/Makefile \
3634 tests/server/Makefile \
3635 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003636 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003637 packages/Makefile \
3638 packages/Win32/Makefile \
3639 packages/Win32/cygwin/Makefile \
3640 packages/Linux/Makefile \
3641 packages/Linux/RPM/Makefile \
3642 packages/Linux/RPM/curl.spec \
3643 packages/Linux/RPM/curl-ssl.spec \
3644 packages/Solaris/Makefile \
3645 packages/EPM/curl.list \
3646 packages/EPM/Makefile \
3647 packages/vms/Makefile \
3648 packages/AIX/Makefile \
3649 packages/AIX/RPM/Makefile \
3650 packages/AIX/RPM/curl.spec \
3651 curl-config \
3652 libcurl.pc
3653])
3654AC_OUTPUT
3655
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003656CURL_GENERATE_CONFIGUREHELP_PM
3657
3658XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
3659
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003660AC_MSG_NOTICE([Configured to build curl/libcurl:
3661
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003662 curl version: ${CURLVERSION}
3663 Host setup: ${host}
3664 Install prefix: ${prefix}
3665 Compiler: ${CC}
3666 SSL support: ${curl_ssl_msg}
3667 SSH support: ${curl_ssh_msg}
3668 zlib support: ${curl_zlib_msg}
3669 GSS-API support: ${curl_gss_msg}
3670 TLS-SRP support: ${curl_tls_srp_msg}
3671 resolver: ${curl_res_msg}
3672 IPv6 support: ${curl_ipv6_msg}
3673 Unix sockets support: ${curl_unix_sockets_msg}
3674 IDN support: ${curl_idn_msg}
3675 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
3676 Built-in manual: ${curl_manual_msg}
3677 --libcurl option: ${curl_libcurl_msg}
3678 Verbose errors: ${curl_verbose_msg}
3679 SSPI support: ${curl_sspi_msg}
3680 ca cert bundle: ${ca}
3681 ca cert path: ${capath}
3682 LDAP support: ${curl_ldap_msg}
3683 LDAPS support: ${curl_ldaps_msg}
3684 RTSP support: ${curl_rtsp_msg}
3685 RTMP support: ${curl_rtmp_msg}
3686 metalink support: ${curl_mtlnk_msg}
3687 HTTP2 support: ${curl_h2_msg}
3688 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003689])
3690
3691if test "x$soname_bump" = "xyes"; then
3692
3693cat <<EOM
3694 SONAME bump: yes - WARNING: this library will be built with the SONAME
3695 number bumped due to (a detected) ABI breakage.
3696 See lib/README.curl_off_t for details on this.
3697EOM
3698
3699fi
3700