blob: accb03889fc01199dafcdc01a7993f9288c7a68a [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
177dnl
178dnl Detect the canonical host and target build environment
179dnl
180
181AC_CANONICAL_HOST
182dnl Get system canonical name
183AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
184
185dnl Checks for programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700186
187dnl Our curl_off_t internal and external configure settings
188CURL_CONFIGURE_CURL_OFF_T
189
190dnl This defines _ALL_SOURCE for AIX
191CURL_CHECK_AIX_ALL_SOURCE
192
193dnl Our configure and build reentrant settings
194CURL_CONFIGURE_THREAD_SAFE
195CURL_CONFIGURE_REENTRANT
196
197dnl check for how to do large files
198AC_SYS_LARGEFILE
199
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700200XC_LIBTOOL
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700201
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700202#
203# Automake conditionals based on libtool related checks
204#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700205
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700206AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
207 [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
208AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
209 [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
210AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
211 [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700212
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700213#
214# Due to libtool and automake machinery limitations of not allowing
215# specifying separate CPPFLAGS or CFLAGS when compiling objects for
216# inclusion of these in shared or static libraries, we are forced to
217# build using separate configure runs for shared and static libraries
218# on systems where different CPPFLAGS or CFLAGS are mandatory in order
219# to compile objects for each kind of library. Notice that relying on
220# the '-DPIC' CFLAG that libtool provides is not valid given that the
221# user might for example choose to build static libraries with PIC.
222#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700223
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700224#
225# Make our Makefile.am files use the staticlib CPPFLAG only when strictly
226# targeting a static library and not building its shared counterpart.
227#
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700228
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700229AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
230 [test "x$xc_lt_build_static_only" = 'xyes'])
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700231
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700232#
233# Make staticlib CPPFLAG variable and its definition visible in output
234# files unconditionally, providing an empty definition unless strictly
235# targeting a static library and not building its shared counterpart.
236#
237
238CPPFLAG_CURL_STATICLIB=
239if test "x$xc_lt_build_static_only" = 'xyes'; then
240 CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
241fi
242AC_SUBST([CPPFLAG_CURL_STATICLIB])
243
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700244
245# Determine whether all dependent libraries must be specified when linking
246if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
247then
248 REQUIRE_LIB_DEPS=no
249else
250 REQUIRE_LIB_DEPS=yes
251fi
252AC_SUBST(REQUIRE_LIB_DEPS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700253AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700254
255dnl check if there's a way to force code inline
256AC_C_INLINE
257
258dnl **********************************************************************
259dnl platform/compiler/architecture specific checks/flags
260dnl **********************************************************************
261
262CURL_CHECK_COMPILER
263CURL_SET_COMPILER_BASIC_OPTS
264CURL_SET_COMPILER_DEBUG_OPTS
265CURL_SET_COMPILER_OPTIMIZE_OPTS
266CURL_SET_COMPILER_WARNING_OPTS
267
268if test "$compiler_id" = "INTEL_UNIX_C"; then
269 #
270 if test "$compiler_num" -ge "1000"; then
271 dnl icc 10.X or later
272 CFLAGS="$CFLAGS -shared-intel"
273 elif test "$compiler_num" -ge "900"; then
274 dnl icc 9.X specific
275 CFLAGS="$CFLAGS -i-dynamic"
276 fi
277 #
278fi
279
280CURL_CHECK_COMPILER_HALT_ON_ERROR
281CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700282CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
283CURL_CHECK_COMPILER_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700284
285CURL_CHECK_CURLDEBUG
286AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
287
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700288supports_unittests=yes
289# cross-compilation of unit tests static library/programs fails when
290# libcurl shared library is built. This might be due to a libtool or
291# automake issue. In this case we disable unit tests.
292if test "x$cross_compiling" != "xno" &&
293 test "x$enable_shared" != "xno"; then
294 supports_unittests=no
295fi
296
297# IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
298# a problem related with OpenSSL headers and library versions not matching.
299# Disable unit tests while time to further investigate this is found.
300case $host in
301 mips-sgi-irix6.5)
302 if test "$compiler_id" = "GNU_C"; then
303 supports_unittests=no
304 fi
305 ;;
306esac
307
308# All AIX autobuilds fails unit tests linking against unittests library
309# due to unittests library being built with no symbols or members. Libtool ?
310# Disable unit tests while time to further investigate this is found.
311case $host_os in
312 aix*)
313 supports_unittests=no
314 ;;
315esac
316
317dnl Build unit tests when option --enable-debug is given.
318if test "x$want_debug" = "xyes" &&
319 test "x$supports_unittests" = "xyes"; then
320 want_unittests=yes
321else
322 want_unittests=no
323fi
324AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
325
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700326dnl **********************************************************************
327dnl Compilation based checks should not be done before this point.
328dnl **********************************************************************
329
330dnl **********************************************************************
331dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
332dnl and ws2tcpip.h take precedence over any other further checks which
333dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
334dnl this specific header files. And do them before its results are used.
335dnl **********************************************************************
336
337CURL_CHECK_HEADER_WINDOWS
338CURL_CHECK_NATIVE_WINDOWS
339case X-"$ac_cv_native_windows" in
340 X-yes)
341 CURL_CHECK_HEADER_WINSOCK
342 CURL_CHECK_HEADER_WINSOCK2
343 CURL_CHECK_HEADER_WS2TCPIP
344 CURL_CHECK_HEADER_WINLDAP
345 CURL_CHECK_HEADER_WINBER
346 ;;
347 *)
348 ac_cv_header_winsock_h="no"
349 ac_cv_header_winsock2_h="no"
350 ac_cv_header_ws2tcpip_h="no"
351 ac_cv_header_winldap_h="no"
352 ac_cv_header_winber_h="no"
353 ;;
354esac
355CURL_CHECK_WIN32_LARGEFILE
356
357dnl ************************************************************
358dnl switch off particular protocols
359dnl
360AC_MSG_CHECKING([whether to support http])
361AC_ARG_ENABLE(http,
362AC_HELP_STRING([--enable-http],[Enable HTTP support])
363AC_HELP_STRING([--disable-http],[Disable HTTP support]),
364[ case "$enableval" in
365 no)
366 AC_MSG_RESULT(no)
367 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
368 AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
369 AC_SUBST(CURL_DISABLE_HTTP, [1])
370 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
371 AC_SUBST(CURL_DISABLE_RTSP, [1])
372 ;;
373 *) AC_MSG_RESULT(yes)
374 ;;
375 esac ],
376 AC_MSG_RESULT(yes)
377)
378AC_MSG_CHECKING([whether to support ftp])
379AC_ARG_ENABLE(ftp,
380AC_HELP_STRING([--enable-ftp],[Enable FTP support])
381AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
382[ case "$enableval" in
383 no)
384 AC_MSG_RESULT(no)
385 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
386 AC_SUBST(CURL_DISABLE_FTP, [1])
387 ;;
388 *) AC_MSG_RESULT(yes)
389 ;;
390 esac ],
391 AC_MSG_RESULT(yes)
392)
393AC_MSG_CHECKING([whether to support file])
394AC_ARG_ENABLE(file,
395AC_HELP_STRING([--enable-file],[Enable FILE support])
396AC_HELP_STRING([--disable-file],[Disable FILE support]),
397[ case "$enableval" in
398 no)
399 AC_MSG_RESULT(no)
400 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
401 AC_SUBST(CURL_DISABLE_FILE, [1])
402 ;;
403 *) AC_MSG_RESULT(yes)
404 ;;
405 esac ],
406 AC_MSG_RESULT(yes)
407)
408AC_MSG_CHECKING([whether to support ldap])
409AC_ARG_ENABLE(ldap,
410AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
411AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
412[ case "$enableval" in
413 no)
414 AC_MSG_RESULT(no)
415 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
416 AC_SUBST(CURL_DISABLE_LDAP, [1])
417 ;;
418 *)
419 AC_MSG_RESULT(yes)
420 ;;
421 esac ],[
422 AC_MSG_RESULT(yes) ]
423)
424AC_MSG_CHECKING([whether to support ldaps])
425AC_ARG_ENABLE(ldaps,
426AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
427AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
428[ case "$enableval" in
429 no)
430 AC_MSG_RESULT(no)
431 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
432 AC_SUBST(CURL_DISABLE_LDAPS, [1])
433 ;;
434 *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
435 AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
436 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
437 AC_SUBST(CURL_DISABLE_LDAPS, [1])
438 else
439 AC_MSG_RESULT(yes)
440 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
441 AC_SUBST(HAVE_LDAP_SSL, [1])
442 fi
443 ;;
444 esac ],[
445 if test "x$CURL_DISABLE_LDAP" = "x1" ; then
446 AC_MSG_RESULT(no)
447 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
448 AC_SUBST(CURL_DISABLE_LDAPS, [1])
449 else
450 AC_MSG_RESULT(yes)
451 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
452 AC_SUBST(HAVE_LDAP_SSL, [1])
453 fi ]
454)
455
456AC_MSG_CHECKING([whether to support rtsp])
457AC_ARG_ENABLE(rtsp,
458AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
459AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
460[ case "$enableval" in
461 no)
462 AC_MSG_RESULT(no)
463 AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
464 AC_SUBST(CURL_DISABLE_RTSP, [1])
465 ;;
466 *) if test x$CURL_DISABLE_HTTP = x1 ; then
467 AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
468 else
469 AC_MSG_RESULT(yes)
470 curl_rtsp_msg="enabled"
471 fi
472 ;;
473 esac ],
474 if test "x$CURL_DISABLE_HTTP" != "x1"; then
475 AC_MSG_RESULT(yes)
476 curl_rtsp_msg="enabled"
477 else
478 AC_MSG_RESULT(no)
479 fi
480)
481
482AC_MSG_CHECKING([whether to support proxies])
483AC_ARG_ENABLE(proxy,
484AC_HELP_STRING([--enable-proxy],[Enable proxy support])
485AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
486[ case "$enableval" in
487 no)
488 AC_MSG_RESULT(no)
489 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
490 AC_SUBST(CURL_DISABLE_PROXY, [1])
491 ;;
492 *) AC_MSG_RESULT(yes)
493 ;;
494 esac ],
495 AC_MSG_RESULT(yes)
496)
497
498AC_MSG_CHECKING([whether to support dict])
499AC_ARG_ENABLE(dict,
500AC_HELP_STRING([--enable-dict],[Enable DICT support])
501AC_HELP_STRING([--disable-dict],[Disable DICT support]),
502[ case "$enableval" in
503 no)
504 AC_MSG_RESULT(no)
505 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
506 AC_SUBST(CURL_DISABLE_DICT, [1])
507 ;;
508 *) AC_MSG_RESULT(yes)
509 ;;
510 esac ],
511 AC_MSG_RESULT(yes)
512)
513AC_MSG_CHECKING([whether to support telnet])
514AC_ARG_ENABLE(telnet,
515AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
516AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
517[ case "$enableval" in
518 no)
519 AC_MSG_RESULT(no)
520 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
521 AC_SUBST(CURL_DISABLE_TELNET, [1])
522 ;;
523 *) AC_MSG_RESULT(yes)
524 ;;
525 esac ],
526 AC_MSG_RESULT(yes)
527)
528AC_MSG_CHECKING([whether to support tftp])
529AC_ARG_ENABLE(tftp,
530AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
531AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
532[ case "$enableval" in
533 no)
534 AC_MSG_RESULT(no)
535 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
536 AC_SUBST(CURL_DISABLE_TFTP, [1])
537 ;;
538 *) AC_MSG_RESULT(yes)
539 ;;
540 esac ],
541 AC_MSG_RESULT(yes)
542)
543
544AC_MSG_CHECKING([whether to support pop3])
545AC_ARG_ENABLE(pop3,
546AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
547AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
548[ case "$enableval" in
549 no)
550 AC_MSG_RESULT(no)
551 AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
552 AC_SUBST(CURL_DISABLE_POP3, [1])
553 ;;
554 *) AC_MSG_RESULT(yes)
555 ;;
556 esac ],
557 AC_MSG_RESULT(yes)
558)
559
560
561AC_MSG_CHECKING([whether to support imap])
562AC_ARG_ENABLE(imap,
563AC_HELP_STRING([--enable-imap],[Enable IMAP support])
564AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
565[ case "$enableval" in
566 no)
567 AC_MSG_RESULT(no)
568 AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
569 AC_SUBST(CURL_DISABLE_IMAP, [1])
570 ;;
571 *) AC_MSG_RESULT(yes)
572 ;;
573 esac ],
574 AC_MSG_RESULT(yes)
575)
576
577
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700578AC_MSG_CHECKING([whether to support smb])
579AC_ARG_ENABLE(smb,
580AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
581AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
582[ case "$enableval" in
583 no)
584 AC_MSG_RESULT(no)
585 AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
586 AC_SUBST(CURL_DISABLE_SMB, [1])
587 ;;
588 *) AC_MSG_RESULT(yes)
589 ;;
590 esac ],
591 AC_MSG_RESULT(yes)
592)
593
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700594AC_MSG_CHECKING([whether to support smtp])
595AC_ARG_ENABLE(smtp,
596AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
597AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
598[ case "$enableval" in
599 no)
600 AC_MSG_RESULT(no)
601 AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
602 AC_SUBST(CURL_DISABLE_SMTP, [1])
603 ;;
604 *) AC_MSG_RESULT(yes)
605 ;;
606 esac ],
607 AC_MSG_RESULT(yes)
608)
609
610AC_MSG_CHECKING([whether to support gopher])
611AC_ARG_ENABLE(gopher,
612AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
613AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
614[ case "$enableval" in
615 no)
616 AC_MSG_RESULT(no)
617 AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
618 AC_SUBST(CURL_DISABLE_GOPHER, [1])
619 ;;
620 *) AC_MSG_RESULT(yes)
621 ;;
622 esac ],
623 AC_MSG_RESULT(yes)
624)
625
626
627dnl **********************************************************************
628dnl Check for built-in manual
629dnl **********************************************************************
630
631AC_MSG_CHECKING([whether to provide built-in manual])
632AC_ARG_ENABLE(manual,
633AC_HELP_STRING([--enable-manual],[Enable built-in manual])
634AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
635[ case "$enableval" in
636 no)
637 AC_MSG_RESULT(no)
638 ;;
639 *) AC_MSG_RESULT(yes)
640 USE_MANUAL="1"
641 ;;
642 esac ],
643 AC_MSG_RESULT(yes)
644 USE_MANUAL="1"
645)
646dnl The actual use of the USE_MANUAL variable is done much later in this
647dnl script to allow other actions to disable it as well.
648
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700649dnl ************************************************************
650dnl disable C code generation support
651dnl
652AC_MSG_CHECKING([whether to enable generation of C code])
653AC_ARG_ENABLE(libcurl_option,
654AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
655AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
656[ case "$enableval" in
657 no)
658 AC_MSG_RESULT(no)
659 AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
660 curl_libcurl_msg="no"
661 ;;
662 *) AC_MSG_RESULT(yes)
663 ;;
664 esac ],
665 AC_MSG_RESULT(yes)
666)
667
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700668dnl **********************************************************************
669dnl Checks for libraries.
670dnl **********************************************************************
671
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700672AC_MSG_CHECKING([whether to use libgcc])
673AC_ARG_ENABLE(libgcc,
674AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
675[ case "$enableval" in
676 yes)
677 LIBS="-lgcc $LIBS"
678 AC_MSG_RESULT(yes)
679 ;;
680 *) AC_MSG_RESULT(no)
681 ;;
682 esac ],
683 AC_MSG_RESULT(no)
684)
685
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700686CURL_CHECK_LIB_XNET
687
688dnl gethostbyname without lib or in the nsl lib?
689AC_CHECK_FUNC(gethostbyname,
690 [HAVE_GETHOSTBYNAME="1"
691 ],
692 [ AC_CHECK_LIB(nsl, gethostbyname,
693 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700694 LIBS="-lnsl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700695 ])
696 ])
697
698if test "$HAVE_GETHOSTBYNAME" != "1"
699then
700 dnl gethostbyname in the socket lib?
701 AC_CHECK_LIB(socket, gethostbyname,
702 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700703 LIBS="-lsocket $LIBS"
704 ])
705fi
706
707if test "$HAVE_GETHOSTBYNAME" != "1"
708then
709 dnl gethostbyname in the watt lib?
710 AC_CHECK_LIB(watt, gethostbyname,
711 [HAVE_GETHOSTBYNAME="1"
712 CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
713 LDFLAGS="-L/dev/env/WATT_ROOT/lib"
714 LIBS="-lwatt $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700715 ])
716fi
717
718dnl At least one system has been identified to require BOTH nsl and socket
719dnl libs at the same time to link properly.
720if test "$HAVE_GETHOSTBYNAME" != "1"
721then
722 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
723 my_ac_save_LIBS=$LIBS
724 LIBS="-lnsl -lsocket $LIBS"
725 AC_LINK_IFELSE([
726 AC_LANG_PROGRAM([[
727 ]],[[
728 gethostbyname();
729 ]])
730 ],[
731 AC_MSG_RESULT([yes])
732 HAVE_GETHOSTBYNAME="1"
733 ],[
734 AC_MSG_RESULT([no])
735 LIBS=$my_ac_save_LIBS
736 ])
737fi
738
739if test "$HAVE_GETHOSTBYNAME" != "1"
740then
741 dnl This is for winsock systems
742 if test "$ac_cv_header_windows_h" = "yes"; then
743 if test "$ac_cv_header_winsock_h" = "yes"; then
744 case $host in
745 *-*-mingw32ce*)
746 winsock_LIB="-lwinsock"
747 ;;
748 *)
749 winsock_LIB="-lwsock32"
750 ;;
751 esac
752 fi
753 if test "$ac_cv_header_winsock2_h" = "yes"; then
754 winsock_LIB="-lws2_32"
755 fi
756 if test ! -z "$winsock_LIB"; then
757 my_ac_save_LIBS=$LIBS
758 LIBS="$winsock_LIB $LIBS"
759 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
760 AC_LINK_IFELSE([
761 AC_LANG_PROGRAM([[
762#ifdef HAVE_WINDOWS_H
763#ifndef WIN32_LEAN_AND_MEAN
764#define WIN32_LEAN_AND_MEAN
765#endif
766#include <windows.h>
767#ifdef HAVE_WINSOCK2_H
768#include <winsock2.h>
769#else
770#ifdef HAVE_WINSOCK_H
771#include <winsock.h>
772#endif
773#endif
774#endif
775 ]],[[
776 gethostbyname("www.dummysite.com");
777 ]])
778 ],[
779 AC_MSG_RESULT([yes])
780 HAVE_GETHOSTBYNAME="1"
781 ],[
782 AC_MSG_RESULT([no])
783 winsock_LIB=""
784 LIBS=$my_ac_save_LIBS
785 ])
786 fi
787 fi
788fi
789
790if test "$HAVE_GETHOSTBYNAME" != "1"
791then
792 dnl This is for Minix 3.1
793 AC_MSG_CHECKING([for gethostbyname for Minix 3])
794 AC_LINK_IFELSE([
795 AC_LANG_PROGRAM([[
796/* Older Minix versions may need <net/gen/netdb.h> here instead */
797#include <netdb.h>
798 ]],[[
799 gethostbyname("www.dummysite.com");
800 ]])
801 ],[
802 AC_MSG_RESULT([yes])
803 HAVE_GETHOSTBYNAME="1"
804 ],[
805 AC_MSG_RESULT([no])
806 ])
807fi
808
809if test "$HAVE_GETHOSTBYNAME" != "1"
810then
811 dnl This is for eCos with a stubbed DNS implementation
812 AC_MSG_CHECKING([for gethostbyname for eCos])
813 AC_LINK_IFELSE([
814 AC_LANG_PROGRAM([[
815#include <stdio.h>
816#include <netdb.h>
817 ]],[[
818 gethostbyname("www.dummysite.com");
819 ]])
820 ],[
821 AC_MSG_RESULT([yes])
822 HAVE_GETHOSTBYNAME="1"
823 ],[
824 AC_MSG_RESULT([no])
825 ])
826fi
827
828if test "$HAVE_GETHOSTBYNAME" != "1"
829then
830 dnl gethostbyname in the network lib - for Haiku OS
831 AC_CHECK_LIB(network, gethostbyname,
832 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700833 LIBS="-lnetwork $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700834 ])
835fi
836
837if test "$HAVE_GETHOSTBYNAME" != "1"
838then
839 dnl gethostbyname in the net lib - for BeOS
840 AC_CHECK_LIB(net, gethostbyname,
841 [HAVE_GETHOSTBYNAME="1"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700842 LIBS="-lnet $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700843 ])
844fi
845
846
847if test "$HAVE_GETHOSTBYNAME" != "1"; then
848 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
849fi
850
851dnl resolve lib?
852AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
853
854if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
855 AC_CHECK_LIB(resolve, strcasecmp,
856 [LIBS="-lresolve $LIBS"],
857 ,
858 -lnsl)
859fi
860ac_cv_func_strcasecmp="no"
861
862CURL_CHECK_LIBS_CONNECT
863
864CURL_NETWORK_LIBS=$LIBS
865
866dnl **********************************************************************
867dnl In case that function clock_gettime with monotonic timer is available,
868dnl check for additional required libraries.
869dnl **********************************************************************
870CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
871
872dnl **********************************************************************
873dnl The preceding library checks are all potentially useful for test
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700874dnl servers and libtest cases which require networking and clock_gettime
875dnl support. Save the list of required libraries at this point for use
876dnl while linking those test servers and programs.
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700877dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700878CURL_NETWORK_AND_TIME_LIBS=$LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700879
880dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -0700881dnl Check for the presence of ZLIB libraries and headers
882dnl **********************************************************************
883
884dnl Check for & handle argument to --with-zlib.
885
886clean_CPPFLAGS=$CPPFLAGS
887clean_LDFLAGS=$LDFLAGS
888clean_LIBS=$LIBS
889ZLIB_LIBS=""
890AC_ARG_WITH(zlib,
891AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
892AC_HELP_STRING([--without-zlib],[disable use of zlib]),
893 [OPT_ZLIB="$withval"])
894
895if test "$OPT_ZLIB" = "no" ; then
896 AC_MSG_WARN([zlib disabled])
897else
898 if test "$OPT_ZLIB" = "yes" ; then
899 OPT_ZLIB=""
900 fi
901
902 if test -z "$OPT_ZLIB" ; then
903 dnl check for the lib first without setting any new path, since many
904 dnl people have it in the default path
905
906 AC_CHECK_LIB(z, inflateEnd,
907 dnl libz found, set the variable
908 [HAVE_LIBZ="1"
909 LIBS="-lz $LIBS"],
910 dnl if no lib found, try /usr/local
911 [OPT_ZLIB="/usr/local"])
912
913 fi
914
915 dnl Add a nonempty path to the compiler flags
916 if test -n "$OPT_ZLIB"; then
917 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
918 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
919 fi
920
921 AC_CHECK_HEADER(zlib.h,
922 [
923 dnl zlib.h was found
924 HAVE_ZLIB_H="1"
925 dnl if the lib wasn't found already, try again with the new paths
926 if test "$HAVE_LIBZ" != "1"; then
927 AC_CHECK_LIB(z, gzread,
928 [
929 dnl the lib was found!
930 HAVE_LIBZ="1"
931 LIBS="-lz $LIBS"
932 ],
933 [ CPPFLAGS=$clean_CPPFLAGS
934 LDFLAGS=$clean_LDFLAGS])
935 fi
936 ],
937 [
938 dnl zlib.h was not found, restore the flags
939 CPPFLAGS=$clean_CPPFLAGS
940 LDFLAGS=$clean_LDFLAGS]
941 )
942
943 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
944 then
945 AC_MSG_WARN([configure found only the libz lib, not the header file!])
946 HAVE_LIBZ=""
947 CPPFLAGS=$clean_CPPFLAGS
948 LDFLAGS=$clean_LDFLAGS
949 LIBS=$clean_LIBS
950 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
951 then
952 AC_MSG_WARN([configure found only the libz header file, not the lib!])
953 CPPFLAGS=$clean_CPPFLAGS
954 LDFLAGS=$clean_LDFLAGS
955 LIBS=$clean_LIBS
956 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
957 then
958 dnl both header and lib were found!
959 AC_SUBST(HAVE_LIBZ)
960 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
961 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
962
963 ZLIB_LIBS="-lz"
964 LIBS="-lz $clean_LIBS"
965
966 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
967 AMFIXLIB="1"
968 AC_MSG_NOTICE([found both libz and libz.h header])
969 curl_zlib_msg="enabled"
970 fi
971fi
972
973dnl set variable for use in automakefile(s)
974AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
975AC_SUBST(ZLIB_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -0700976
977dnl **********************************************************************
978dnl Check for LDAP
979dnl **********************************************************************
980
981LDAPLIBNAME=""
982AC_ARG_WITH(ldap-lib,
983AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
984 [LDAPLIBNAME="$withval"])
985
986LBERLIBNAME=""
987AC_ARG_WITH(lber-lib,
988AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
989 [LBERLIBNAME="$withval"])
990
991if test x$CURL_DISABLE_LDAP != x1 ; then
992
993 CURL_CHECK_HEADER_LBER
994 CURL_CHECK_HEADER_LDAP
995 CURL_CHECK_HEADER_LDAPSSL
996 CURL_CHECK_HEADER_LDAP_SSL
997
998 if test -z "$LDAPLIBNAME" ; then
999 if test "$ac_cv_native_windows" = "yes"; then
1000 dnl Windows uses a single and unique LDAP library name
1001 LDAPLIBNAME="wldap32"
1002 LBERLIBNAME="no"
1003 fi
1004 fi
1005
1006 if test "$LDAPLIBNAME" ; then
1007 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
1008 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
1009 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001010 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001011 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001012 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001013 else
1014 dnl Try to find the right ldap libraries for this system
1015 CURL_CHECK_LIBS_LDAP
1016 case X-"$curl_cv_ldap_LIBS" in
1017 X-unknown)
1018 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
1019 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
1020 AC_SUBST(CURL_DISABLE_LDAP, [1])
1021 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
1022 AC_SUBST(CURL_DISABLE_LDAPS, [1])
1023 ;;
1024 esac
1025 fi
1026fi
1027
1028if test x$CURL_DISABLE_LDAP != x1 ; then
1029
1030 if test "$LBERLIBNAME" ; then
1031 dnl If name is "no" then don't define this library at all
1032 dnl (it's only needed if libldap.so's dependencies are broken).
1033 if test "$LBERLIBNAME" != "no" ; then
1034 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
1035 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
1036 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001037 AC_SUBST(CURL_DISABLE_LDAP, [1])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001038 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001039 AC_SUBST(CURL_DISABLE_LDAPS, [1])])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001040 fi
1041 fi
1042fi
1043
1044if test x$CURL_DISABLE_LDAP != x1 ; then
1045 AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
1046
1047 if test "$LDAPLIBNAME" = "wldap32"; then
1048 curl_ldap_msg="enabled (winldap)"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001049 AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001050 else
1051 curl_ldap_msg="enabled (OpenLDAP)"
1052 if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
1053 AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
1054 AC_SUBST(USE_OPENLDAP, [1])
1055 fi
1056 fi
1057fi
1058
1059if test x$CURL_DISABLE_LDAPS != x1 ; then
1060 curl_ldaps_msg="enabled"
1061fi
1062
1063dnl **********************************************************************
1064dnl Checks for IPv6
1065dnl **********************************************************************
1066
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001067AC_MSG_CHECKING([whether to enable IPv6])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001068AC_ARG_ENABLE(ipv6,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001069AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
1070AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001071[ case "$enableval" in
1072 no)
1073 AC_MSG_RESULT(no)
1074 ipv6=no
1075 ;;
1076 *) AC_MSG_RESULT(yes)
1077 ipv6=yes
1078 ;;
1079 esac ],
1080
1081 AC_TRY_RUN([ /* is AF_INET6 available? */
1082#include <sys/types.h>
1083#include <sys/socket.h>
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001084#include <stdlib.h> /* for exit() */
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001085main()
1086{
1087 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1088 exit(1);
1089 else
1090 exit(0);
1091}
1092],
1093 AC_MSG_RESULT(yes)
1094 ipv6=yes,
1095 AC_MSG_RESULT(no)
1096 ipv6=no,
1097 AC_MSG_RESULT(no)
1098 ipv6=no
1099))
1100
1101if test "$ipv6" = "yes"; then
1102 curl_ipv6_msg="enabled"
1103fi
1104
1105# Check if struct sockaddr_in6 have sin6_scope_id member
1106if test "$ipv6" = yes; then
1107 AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
1108 AC_TRY_COMPILE([
1109#include <sys/types.h>
1110#include <netinet/in.h>] ,
1111 struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
1112 if test "$have_sin6_scope_id" = yes; then
1113 AC_MSG_RESULT([yes])
1114 AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
1115 else
1116 AC_MSG_RESULT([no])
1117 fi
1118fi
1119
1120dnl **********************************************************************
1121dnl Check if the operating system allows programs to write to their own argv[]
1122dnl **********************************************************************
1123
1124AC_MSG_CHECKING([if argv can be written to])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001125AC_RUN_IFELSE([
1126 AC_LANG_SOURCE([[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001127int main(int argc, char ** argv) {
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001128 argv[0][0] = ' ';
1129 return (argv[0][0] == ' ')?0:1;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001130}
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001131 ]])
1132],[
1133 curl_cv_writable_argv=yes
1134],[
1135 curl_cv_writable_argv=no
1136],[
1137 curl_cv_writable_argv=cross
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001138])
1139case $curl_cv_writable_argv in
1140yes)
1141 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1142 AC_MSG_RESULT(yes)
1143 ;;
1144no)
1145 AC_MSG_RESULT(no)
1146 ;;
1147*)
1148 AC_MSG_RESULT(no)
1149 AC_MSG_WARN([the previous check could not be made default was used])
1150 ;;
1151esac
1152
1153dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001154dnl Check for GSS-API libraries
1155dnl **********************************************************************
1156
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001157dnl check for GSS-API stuff in the /usr as default
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001158
1159GSSAPI_ROOT="/usr"
1160AC_ARG_WITH(gssapi-includes,
1161 AC_HELP_STRING([--with-gssapi-includes=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001162 [Specify location of GSS-API headers]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001163 [ GSSAPI_INCS="-I$withval"
1164 want_gss="yes" ]
1165)
1166
1167AC_ARG_WITH(gssapi-libs,
1168 AC_HELP_STRING([--with-gssapi-libs=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001169 [Specify location of GSS-API libs]),
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001170 [ GSSAPI_LIB_DIR="-L$withval"
1171 want_gss="yes" ]
1172)
1173
1174AC_ARG_WITH(gssapi,
1175 AC_HELP_STRING([--with-gssapi=DIR],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001176 [Where to look for GSS-API]), [
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001177 GSSAPI_ROOT="$withval"
1178 if test x"$GSSAPI_ROOT" != xno; then
1179 want_gss="yes"
1180 if test x"$GSSAPI_ROOT" = xyes; then
1181 dnl if yes, then use default root
1182 GSSAPI_ROOT="/usr"
1183 fi
1184 fi
1185])
1186
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001187: ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
1188
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001189save_CPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001190AC_MSG_CHECKING([if GSS-API support is requested])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001191if test x"$want_gss" = xyes; then
1192 AC_MSG_RESULT(yes)
1193
1194 if test -z "$GSSAPI_INCS"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001195 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
1196 GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
1197 elif test -f "$KRB5CONFIG"; then
1198 GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001199 elif test "$GSSAPI_ROOT" != "yes"; then
1200 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1201 fi
1202 fi
1203
1204 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1205
1206 AC_CHECK_HEADER(gss.h,
1207 [
1208 dnl found in the given dirs
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001209 AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001210 gnu_gss=yes
1211 ],
1212 [
1213 dnl not found, check Heimdal or MIT
1214 AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1215 AC_CHECK_HEADERS(
1216 [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1217 [],
1218 [not_mit=1],
1219 [
1220AC_INCLUDES_DEFAULT
1221#ifdef HAVE_GSSAPI_GSSAPI_H
1222#include <gssapi/gssapi.h>
1223#endif
1224 ])
1225 if test "x$not_mit" = "x1"; then
1226 dnl MIT not found, check for Heimdal
1227 AC_CHECK_HEADER(gssapi.h,
1228 [
1229 dnl found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001230 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001231 ],
1232 [
1233 dnl no header found, disabling GSS
1234 want_gss=no
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001235 AC_MSG_WARN(disabling GSS-API support since no header files were found)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001236 ]
1237 )
1238 else
1239 dnl MIT found
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001240 AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
1241 dnl check if we have a really old MIT Kerberos version (<= 1.2)
1242 AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001243 AC_COMPILE_IFELSE([
1244 AC_LANG_PROGRAM([[
1245#include <gssapi/gssapi.h>
1246#include <gssapi/gssapi_generic.h>
1247#include <gssapi/gssapi_krb5.h>
1248 ]],[[
1249 gss_import_name(
1250 (OM_uint32 *)0,
1251 (gss_buffer_t)0,
1252 GSS_C_NT_HOSTBASED_SERVICE,
1253 (gss_name_t *)0);
1254 ]])
1255 ],[
1256 AC_MSG_RESULT([yes])
1257 ],[
1258 AC_MSG_RESULT([no])
1259 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001260 [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001261 ])
1262 fi
1263 ]
1264 )
1265else
1266 AC_MSG_RESULT(no)
1267fi
1268if test x"$want_gss" = xyes; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001269 AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
1270 HAVE_GSSAPI=1
1271 curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001272
1273 if test -n "$gnu_gss"; then
1274 curl_gss_msg="enabled (GNU GSS)"
1275 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001276 LIBS="-lgss $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001277 elif test -z "$GSSAPI_LIB_DIR"; then
1278 case $host in
1279 *-*-darwin*)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001280 LIBS="-lgssapi_krb5 -lresolv $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001281 ;;
1282 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001283 if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001284 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1285 dnl into LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001286 gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
1287 LIBS="$gss_libs $LIBS"
1288 elif test -f "$KRB5CONFIG"; then
1289 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1290 dnl into LIBS
1291 gss_libs=`$KRB5CONFIG --libs gssapi`
1292 LIBS="$gss_libs $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001293 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001294 case $host in
1295 *-hp-hpux*)
1296 gss_libname="gss"
1297 ;;
1298 *)
1299 gss_libname="gssapi"
1300 ;;
1301 esac
1302
1303 if test "$GSSAPI_ROOT" != "yes"; then
1304 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1305 LIBS="-l$gss_libname $LIBS"
1306 else
1307 LIBS="-l$gss_libname $LIBS"
1308 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001309 fi
1310 ;;
1311 esac
1312 else
1313 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001314 case $host in
1315 *-hp-hpux*)
1316 LIBS="-lgss $LIBS"
1317 ;;
1318 *)
1319 LIBS="-lgssapi $LIBS"
1320 ;;
1321 esac
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001322 fi
1323else
1324 CPPFLAGS="$save_CPPFLAGS"
1325fi
1326
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001327dnl -------------------------------------------------
1328dnl check winssl option before other SSL libraries
1329dnl -------------------------------------------------
1330
1331OPT_WINSSL=no
1332AC_ARG_WITH(winssl,dnl
1333AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
1334AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
1335 OPT_WINSSL=$withval)
1336
1337AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
1338if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1339 if test "x$OPT_WINSSL" != "xno" &&
1340 test "x$ac_cv_native_windows" = "xyes"; then
1341 AC_MSG_RESULT(yes)
1342 AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
1343 AC_SUBST(USE_SCHANNEL, [1])
1344 curl_ssl_msg="enabled (Windows-native)"
1345 WINSSL_ENABLED=1
1346 # --with-winssl implies --enable-sspi
1347 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
1348 AC_SUBST(USE_WINDOWS_SSPI, [1])
1349 curl_sspi_msg="enabled"
1350 else
1351 AC_MSG_RESULT(no)
1352 fi
1353else
1354 AC_MSG_RESULT(no)
1355fi
1356
1357OPT_DARWINSSL=no
1358AC_ARG_WITH(darwinssl,dnl
1359AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
1360AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
1361 OPT_DARWINSSL=$withval)
1362
1363AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
1364if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1365 if test "x$OPT_DARWINSSL" != "xno" &&
1366 test -d "/System/Library/Frameworks/Security.framework"; then
1367 AC_MSG_RESULT(yes)
1368 AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
1369 AC_SUBST(USE_DARWINSSL, [1])
1370 curl_ssl_msg="enabled (iOS/Mac OS X-native)"
1371 DARWINSSL_ENABLED=1
1372 LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
1373 else
1374 AC_MSG_RESULT(no)
1375 fi
1376else
1377 AC_MSG_RESULT(no)
1378fi
1379
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001380dnl **********************************************************************
1381dnl Check for the presence of SSL libraries and headers
1382dnl **********************************************************************
1383
1384dnl Default to compiler & linker defaults for SSL files & libraries.
1385OPT_SSL=off
1386dnl Default to no CA bundle
1387ca="no"
1388AC_ARG_WITH(ssl,dnl
1389AC_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])
1390AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1391 OPT_SSL=$withval)
1392
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001393if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001394 dnl backup the pre-ssl variables
1395 CLEANLDFLAGS="$LDFLAGS"
1396 CLEANCPPFLAGS="$CPPFLAGS"
1397 CLEANLIBS="$LIBS"
1398
1399 case "$OPT_SSL" in
1400 yes)
1401 dnl --with-ssl (without path) used
1402 if test x$cross_compiling != xyes; then
1403 dnl only do pkg-config magic when not cross-compiling
1404 PKGTEST="yes"
1405 fi
1406 PREFIX_OPENSSL=/usr/local/ssl
1407 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1408 ;;
1409 off)
1410 dnl no --with-ssl option given, just check default places
1411 if test x$cross_compiling != xyes; then
1412 dnl only do pkg-config magic when not cross-compiling
1413 PKGTEST="yes"
1414 fi
1415 PREFIX_OPENSSL=
1416 ;;
1417 *)
1418 dnl check the given --with-ssl spot
1419 PKGTEST="no"
1420 PREFIX_OPENSSL=$OPT_SSL
1421
1422 dnl Try pkg-config even when cross-compiling. Since we
1423 dnl specify PKG_CONFIG_LIBDIR we're only looking where
1424 dnl the user told us to look
1425 OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1426 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001427 if test -f "$OPENSSL_PCDIR/openssl.pc"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001428 PKGTEST="yes"
1429 fi
1430
1431 dnl in case pkg-config comes up empty, use what we got
1432 dnl via --with-ssl
1433 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1434 if test "$PREFIX_OPENSSL" != "/usr" ; then
1435 SSL_LDFLAGS="-L$LIB_OPENSSL"
1436 SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1437 fi
1438 SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1439 ;;
1440 esac
1441
1442 if test "$PKGTEST" = "yes"; then
1443
1444 CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1445
1446 if test "$PKGCONFIG" != "no" ; then
1447 SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1448 $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1449
1450 SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1451 $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1452
1453 SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1454 $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1455
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001456 AC_SUBST(SSL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001457 AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1458 AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1459 AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1460
1461 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1462
1463 dnl use the values pkg-config reported. This is here
1464 dnl instead of below with CPPFLAGS and LDFLAGS because we only
1465 dnl learn about this via pkg-config. If we only have
1466 dnl the argument to --with-ssl we don't know what
1467 dnl additional libs may be necessary. Hope that we
1468 dnl don't need any.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001469 LIBS="$SSL_LIBS $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001470 fi
1471 fi
1472
1473 dnl finally, set flags to use SSL
1474 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1475 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1476
1477 dnl This is for Msys/Mingw
1478 case $host in
1479 *-*-msys* | *-*-mingw*)
1480 AC_MSG_CHECKING([for gdi32])
1481 my_ac_save_LIBS=$LIBS
1482 LIBS="-lgdi32 $LIBS"
1483 AC_TRY_LINK([#include <windef.h>
1484 #include <wingdi.h>],
1485 [GdiFlush();],
1486 [ dnl worked!
1487 AC_MSG_RESULT([yes])],
1488 [ dnl failed, restore LIBS
1489 LIBS=$my_ac_save_LIBS
1490 AC_MSG_RESULT(no)]
1491 )
1492 ;;
1493 esac
1494
1495 AC_CHECK_LIB(crypto, CRYPTO_lock,[
1496 HAVECRYPTO="yes"
1497 LIBS="-lcrypto $LIBS"
1498 ],[
1499 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1500 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1501 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
1502 HAVECRYPTO="yes"
1503 LIBS="-lcrypto $LIBS"], [
1504 LDFLAGS="$CLEANLDFLAGS"
1505 CPPFLAGS="$CLEANCPPFLAGS"
1506 LIBS="$CLEANLIBS"
1507 ])
1508 ])
1509
1510
1511 if test X"$HAVECRYPTO" = X"yes"; then
1512 dnl This is only reasonable to do if crypto actually is there: check for
1513 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1514
1515 AC_CHECK_LIB(ssl, SSL_connect)
1516
1517 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1518 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1519 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1520 OLIBS=$LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001521 LIBS="-lRSAglue -lrsaref $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001522 AC_CHECK_LIB(ssl, SSL_connect)
1523 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1524 dnl still no SSL_connect
1525 AC_MSG_RESULT(no)
1526 LIBS=$OLIBS
1527 else
1528 AC_MSG_RESULT(yes)
1529 fi
1530
1531 else
1532
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001533 dnl Have the libraries--check for OpenSSL headers
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001534 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1535 openssl/pem.h openssl/ssl.h openssl/err.h,
1536 curl_ssl_msg="enabled (OpenSSL)"
1537 OPENSSL_ENABLED=1
1538 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1539
1540 if test $ac_cv_header_openssl_x509_h = no; then
1541 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1542 dnl since 'err.h' might in fact find a krb4 header with the same
1543 dnl name
1544 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1545
1546 if test $ac_cv_header_x509_h = yes &&
1547 test $ac_cv_header_crypto_h = yes &&
1548 test $ac_cv_header_ssl_h = yes; then
1549 dnl three matches
1550 curl_ssl_msg="enabled (OpenSSL)"
1551 OPENSSL_ENABLED=1
1552 fi
1553 fi
1554 fi
1555
1556 if test X"$OPENSSL_ENABLED" = X"1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001557 dnl is there a pkcs12.h header present?
1558 AC_CHECK_HEADERS(openssl/pkcs12.h)
1559 else
1560 LIBS="$CLEANLIBS"
1561 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001562
1563 if test X"$OPT_SSL" != Xoff &&
1564 test "$OPENSSL_ENABLED" != "1"; then
1565 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1566 fi
1567 fi
1568
1569 if test X"$OPENSSL_ENABLED" = X"1"; then
1570 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1571 dnl stuff, it is kind of "separated" from the main SSL check
1572 AC_CHECK_FUNC(ENGINE_init,
1573 [
1574 AC_CHECK_HEADERS(openssl/engine.h)
1575 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1576 ])
1577
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001578 dnl These can only exist if OpenSSL exists
1579 dnl Older versions of Cyassl (some time before 2.9.4) don't have
1580 dnl SSL_get_shutdown (but this check won't actually detect it there
1581 dnl as it's a macro that needs the header files be included)
1582 dnl BoringSSL doesn't have DES_set_odd_parity
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001583
1584 AC_CHECK_FUNCS( RAND_status \
1585 RAND_screen \
1586 RAND_egd \
1587 ENGINE_cleanup \
1588 CRYPTO_cleanup_all_ex_data \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001589 SSL_get_shutdown \
1590 SSLv2_client_method \
1591 DES_set_odd_parity )
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001592
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001593 AC_MSG_CHECKING([for BoringSSL])
1594 if test "x$ac_cv_func_DES_set_odd_parity" != "xyes"; then
1595 curl_ssl_msg="enabled (BoringSSL)"
1596 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1597 [Define to 1 if using BoringSSL.])
1598 AC_MSG_RESULT([yes])
1599 else
1600 AC_MSG_RESULT([no])
1601 fi
1602 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
2961AC_CHECK_SIZEOF(size_t)
2962AC_CHECK_SIZEOF(long)
2963AC_CHECK_SIZEOF(int)
2964AC_CHECK_SIZEOF(short)
2965CURL_CONFIGURE_LONG
2966AC_CHECK_SIZEOF(time_t)
2967AC_CHECK_SIZEOF(off_t)
2968
2969soname_bump=no
2970if test x"$ac_cv_native_windows" != "xyes" &&
2971 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2972 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2973 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2974 soname_bump=yes
2975fi
2976
2977
2978AC_CHECK_TYPE(long long,
2979 [AC_DEFINE(HAVE_LONGLONG, 1,
2980 [Define to 1 if the compiler supports the 'long long' data type.])]
2981 longlong="yes"
2982)
2983
2984if test "xyes" = "x$longlong"; then
2985 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002986 AC_COMPILE_IFELSE([
2987 AC_LANG_PROGRAM([[
2988 ]],[[
2989 long long val = 1000LL;
2990 ]])
2991 ],[
2992 AC_MSG_RESULT([yes])
2993 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
2994 ],[
2995 AC_MSG_RESULT([no])
2996 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002997fi
2998
2999
3000# check for ssize_t
3001AC_CHECK_TYPE(ssize_t, ,
3002 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3003
3004# check for bool type
3005AC_CHECK_TYPE([bool],[
3006 AC_DEFINE(HAVE_BOOL_T, 1,
3007 [Define to 1 if bool is an available type.])
3008], ,[
3009#ifdef HAVE_SYS_TYPES_H
3010#include <sys/types.h>
3011#endif
3012#ifdef HAVE_STDBOOL_H
3013#include <stdbool.h>
3014#endif
3015])
3016
3017CURL_CONFIGURE_CURL_SOCKLEN_T
3018
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003019CURL_CONFIGURE_PULL_SYS_POLL
3020
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003021TYPE_IN_ADDR_T
3022
3023TYPE_SOCKADDR_STORAGE
3024
3025TYPE_SIG_ATOMIC_T
3026
3027AC_TYPE_SIGNAL
3028
3029CURL_CHECK_FUNC_SELECT
3030
3031CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003032CURL_CHECK_FUNC_SEND
3033CURL_CHECK_MSG_NOSIGNAL
3034
3035CURL_CHECK_FUNC_ALARM
3036CURL_CHECK_FUNC_BASENAME
3037CURL_CHECK_FUNC_CLOSESOCKET
3038CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3039CURL_CHECK_FUNC_CONNECT
3040CURL_CHECK_FUNC_FCNTL
3041CURL_CHECK_FUNC_FDOPEN
3042CURL_CHECK_FUNC_FREEADDRINFO
3043CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003044CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003045CURL_CHECK_FUNC_FTRUNCATE
3046CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003047CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003048CURL_CHECK_FUNC_GETHOSTBYADDR
3049CURL_CHECK_FUNC_GETHOSTBYADDR_R
3050CURL_CHECK_FUNC_GETHOSTBYNAME
3051CURL_CHECK_FUNC_GETHOSTBYNAME_R
3052CURL_CHECK_FUNC_GETHOSTNAME
3053CURL_CHECK_FUNC_GETIFADDRS
3054CURL_CHECK_FUNC_GETSERVBYPORT_R
3055CURL_CHECK_FUNC_GMTIME_R
3056CURL_CHECK_FUNC_INET_NTOA_R
3057CURL_CHECK_FUNC_INET_NTOP
3058CURL_CHECK_FUNC_INET_PTON
3059CURL_CHECK_FUNC_IOCTL
3060CURL_CHECK_FUNC_IOCTLSOCKET
3061CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3062CURL_CHECK_FUNC_LOCALTIME_R
3063CURL_CHECK_FUNC_MEMRCHR
3064CURL_CHECK_FUNC_POLL
3065CURL_CHECK_FUNC_SETSOCKOPT
3066CURL_CHECK_FUNC_SIGACTION
3067CURL_CHECK_FUNC_SIGINTERRUPT
3068CURL_CHECK_FUNC_SIGNAL
3069CURL_CHECK_FUNC_SIGSETJMP
3070CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003071CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003072CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003073CURL_CHECK_FUNC_STRCMPI
3074CURL_CHECK_FUNC_STRDUP
3075CURL_CHECK_FUNC_STRERROR_R
3076CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003077CURL_CHECK_FUNC_STRNCASECMP
3078CURL_CHECK_FUNC_STRNCMPI
3079CURL_CHECK_FUNC_STRNICMP
3080CURL_CHECK_FUNC_STRSTR
3081CURL_CHECK_FUNC_STRTOK_R
3082CURL_CHECK_FUNC_STRTOLL
3083CURL_CHECK_FUNC_WRITEV
3084
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003085case $host in
3086 *msdosdjgpp)
3087 ac_cv_func_pipe=no
3088 skipcheck_pipe=yes
3089 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3090 ;;
3091esac
3092
3093AC_CHECK_FUNCS([fork \
3094 geteuid \
3095 getpass_r \
3096 getppid \
3097 getprotobyname \
3098 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003099 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003100 getrlimit \
3101 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003102 if_nametoindex \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003103 inet_addr \
3104 perror \
3105 pipe \
3106 setlocale \
3107 setmode \
3108 setrlimit \
3109 uname \
3110 utime
3111],[
3112],[
3113 func="$ac_func"
3114 eval skipcheck=\$skipcheck_$func
3115 if test "x$skipcheck" != "xyes"; then
3116 AC_MSG_CHECKING([deeper for $func])
3117 AC_LINK_IFELSE([
3118 AC_LANG_PROGRAM([[
3119 ]],[[
3120 $func ();
3121 ]])
3122 ],[
3123 AC_MSG_RESULT([yes])
3124 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003125 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003126 [Define to 1 if you have the $func function.])
3127 ],[
3128 AC_MSG_RESULT([but still no])
3129 ])
3130 fi
3131])
3132
3133dnl Check if the getnameinfo function is available
3134dnl and get the types of five of its arguments.
3135CURL_CHECK_FUNC_GETNAMEINFO
3136
3137if test "$ipv6" = "yes"; then
3138 if test "$ac_cv_func_getaddrinfo" = "yes"; then
3139 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3140 IPV6_ENABLED=1
3141 AC_SUBST(IPV6_ENABLED)
3142 fi
3143 CURL_CHECK_NI_WITHSCOPEID
3144fi
3145
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003146CURL_CHECK_NONBLOCKING_SOCKET
3147
3148dnl ************************************************************
3149dnl nroff tool stuff
3150dnl
3151
3152AC_PATH_PROG( PERL, perl, ,
3153 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3154AC_SUBST(PERL)
3155
3156AC_PATH_PROGS( NROFF, gnroff nroff, ,
3157 $PATH:/usr/bin/:/usr/local/bin )
3158AC_SUBST(NROFF)
3159
3160if test -n "$NROFF"; then
3161 dnl only check for nroff options if an nroff command was found
3162
3163 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3164 MANOPT="-man"
3165 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3166 if test -z "$mancheck"; then
3167 MANOPT="-mandoc"
3168 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3169 if test -z "$mancheck"; then
3170 MANOPT=""
3171 AC_MSG_RESULT([failed])
3172 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3173 else
3174 AC_MSG_RESULT([$MANOPT])
3175 fi
3176 else
3177 AC_MSG_RESULT([$MANOPT])
3178 fi
3179 AC_SUBST(MANOPT)
3180fi
3181
3182if test -z "$MANOPT"
3183then
3184 dnl if no nroff tool was found, or no option that could convert man pages
3185 dnl was found, then disable the built-in manual stuff
3186 AC_MSG_WARN([disabling built-in manual])
3187 USE_MANUAL="no";
3188fi
3189
3190dnl *************************************************************************
3191dnl If the manual variable still is set, then we go with providing a built-in
3192dnl manual
3193
3194if test "$USE_MANUAL" = "1"; then
3195 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3196 curl_manual_msg="enabled"
3197fi
3198
3199dnl set variable for use in automakefile(s)
3200AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3201
3202CURL_CHECK_LIB_ARES
3203AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3204
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003205if test "x$ac_cv_native_windows" != "xyes" &&
3206 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003207 build_libhostname=yes
3208else
3209 build_libhostname=no
3210fi
3211AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3212
3213CURL_CHECK_OPTION_THREADED_RESOLVER
3214
3215if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
3216 AC_MSG_ERROR(
3217[Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
3218fi
3219
3220if test "$want_thres" = "yes"; then
3221 AC_CHECK_HEADER(pthread.h,
3222 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3223 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003224
3225 dnl first check for function without lib
3226 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3227
3228 dnl if it wasn't found without lib, search for it in pthread lib
3229 if test "$USE_THREADS_POSIX" != "1"
3230 then
3231 CFLAGS="$CFLAGS -pthread"
3232 AC_CHECK_LIB(pthread, pthread_create,
3233 [USE_THREADS_POSIX=1],
3234 [ CFLAGS="$save_CFLAGS"])
3235 fi
3236
3237 if test "x$USE_THREADS_POSIX" = "x1"
3238 then
3239 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3240 curl_res_msg="POSIX threaded"
3241 fi
3242
3243
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003244 ])
3245fi
3246
3247dnl ************************************************************
3248dnl disable verbose text strings
3249dnl
3250AC_MSG_CHECKING([whether to enable verbose strings])
3251AC_ARG_ENABLE(verbose,
3252AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3253AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3254[ case "$enableval" in
3255 no)
3256 AC_MSG_RESULT(no)
3257 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3258 curl_verbose_msg="no"
3259 ;;
3260 *) AC_MSG_RESULT(yes)
3261 ;;
3262 esac ],
3263 AC_MSG_RESULT(yes)
3264)
3265
3266dnl ************************************************************
3267dnl enable SSPI support
3268dnl
3269AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3270AC_ARG_ENABLE(sspi,
3271AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3272AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3273[ case "$enableval" in
3274 yes)
3275 if test "$ac_cv_native_windows" = "yes"; then
3276 AC_MSG_RESULT(yes)
3277 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3278 AC_SUBST(USE_WINDOWS_SSPI, [1])
3279 curl_sspi_msg="enabled"
3280 else
3281 AC_MSG_RESULT(no)
3282 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3283 fi
3284 ;;
3285 *)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003286 if test "x$WINSSL_ENABLED" = "x1"; then
3287 # --with-winssl implies --enable-sspi
3288 AC_MSG_RESULT(yes)
3289 else
3290 AC_MSG_RESULT(no)
3291 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003292 ;;
3293 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003294 if test "x$WINSSL_ENABLED" = "x1"; then
3295 # --with-winssl implies --enable-sspi
3296 AC_MSG_RESULT(yes)
3297 else
3298 AC_MSG_RESULT(no)
3299 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003300)
3301
3302dnl ************************************************************
3303dnl disable cryptographic authentication
3304dnl
3305AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3306AC_ARG_ENABLE(crypto-auth,
3307AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3308AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3309[ case "$enableval" in
3310 no)
3311 AC_MSG_RESULT(no)
3312 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003313 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003314 ;;
3315 *) AC_MSG_RESULT(yes)
3316 ;;
3317 esac ],
3318 AC_MSG_RESULT(yes)
3319)
3320
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003321CURL_CHECK_OPTION_NTLM_WB
3322
3323CURL_CHECK_NTLM_WB
3324
3325dnl ************************************************************
3326dnl disable TLS-SRP authentication
3327dnl
3328AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3329AC_ARG_ENABLE(tls-srp,
3330AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3331AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3332[ case "$enableval" in
3333 no)
3334 AC_MSG_RESULT(no)
3335 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3336 want_tls_srp=no
3337 ;;
3338 *) AC_MSG_RESULT(yes)
3339 want_tls_srp=yes
3340 ;;
3341 esac ],
3342 AC_MSG_RESULT(yes)
3343 want_tls_srp=yes
3344)
3345
3346if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3347 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3348 USE_TLS_SRP=1
3349 curl_tls_srp_msg="enabled"
3350fi
3351
3352dnl ************************************************************
3353dnl disable Unix domain sockets support
3354dnl
3355AC_MSG_CHECKING([whether to enable Unix domain sockets])
3356AC_ARG_ENABLE(unix-sockets,
3357AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3358AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3359[ case "$enableval" in
3360 no) AC_MSG_RESULT(no)
3361 want_unix_sockets=no
3362 ;;
3363 *) AC_MSG_RESULT(yes)
3364 want_unix_sockets=yes
3365 ;;
3366 esac ], [
3367 AC_MSG_RESULT(auto)
3368 want_unix_sockets=auto
3369 ]
3370)
3371if test "x$want_unix_sockets" != "xno"; then
3372 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3373 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3374 AC_SUBST(USE_UNIX_SOCKETS, [1])
3375 curl_unix_sockets_msg="enabled"
3376 ], [
3377 if test "x$want_unix_sockets" = "xyes"; then
3378 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3379 fi
3380 ], [
3381 #include <sys/un.h>
3382 ])
3383fi
3384
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003385dnl ************************************************************
3386dnl disable cookies support
3387dnl
3388AC_MSG_CHECKING([whether to enable support for cookies])
3389AC_ARG_ENABLE(cookies,
3390AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3391AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3392[ case "$enableval" in
3393 no)
3394 AC_MSG_RESULT(no)
3395 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3396 ;;
3397 *) AC_MSG_RESULT(yes)
3398 ;;
3399 esac ],
3400 AC_MSG_RESULT(yes)
3401)
3402
3403dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003404dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003405dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003406CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003407
3408dnl ************************************************************
3409dnl enforce SONAME bump
3410dnl
3411
3412AC_MSG_CHECKING([whether to enforce SONAME bump])
3413AC_ARG_ENABLE(soname-bump,
3414AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
3415AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
3416[ case "$enableval" in
3417 yes) AC_MSG_RESULT(yes)
3418 soname_bump=yes
3419 ;;
3420 *)
3421 AC_MSG_RESULT(no)
3422 ;;
3423 esac ],
3424 AC_MSG_RESULT($soname_bump)
3425)
3426AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
3427
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003428dnl
3429dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003430dnl
3431LIBCURL_LIBS=$LIBS
3432
3433AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003434AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003435AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3436
3437dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3438dnl LIBS variable used in generated makefile at makefile processing
3439dnl time. Doing this functionally prevents LIBS from being used for
3440dnl all link targets in given makefile.
3441BLANK_AT_MAKETIME=
3442AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003443
3444AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3445
3446dnl yes or no
3447ENABLE_SHARED="$enable_shared"
3448AC_SUBST(ENABLE_SHARED)
3449
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003450dnl to let curl-config output the static libraries correctly
3451ENABLE_STATIC="$enable_static"
3452AC_SUBST(ENABLE_STATIC)
3453
3454
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003455dnl
3456dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003457dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003458dnl
3459
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003460if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003461 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3462elif test -n "$SSL_ENABLED"; then
3463 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3464fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003465if test "x$IPV6_ENABLED" = "x1"; then
3466 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3467fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003468if test "x$USE_UNIX_SOCKETS" = "x1"; then
3469 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3470fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003471if test "x$HAVE_LIBZ" = "x1"; then
3472 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3473fi
3474if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
3475 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3476fi
3477if test "x$IDN_ENABLED" = "x1"; then
3478 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3479fi
3480if test "x$USE_WINDOWS_SSPI" = "x1"; then
3481 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3482fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003483
3484if test "x$HAVE_GSSAPI" = "x1"; then
3485 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3486fi
3487
3488if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3489 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3490 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3491fi
3492
3493if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3494 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3495 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3496fi
3497
3498if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3499 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3500 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3501 -o "x$DARWINSSL_ENABLED" = "x1"; then
3502 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3503
3504 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3505 "x$NTLM_WB_ENABLED" = "x1"; then
3506 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3507 fi
3508 fi
3509fi
3510
3511if test "x$USE_TLS_SRP" = "x1"; then
3512 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3513fi
3514
3515if test "x$USE_NGHTTP2" = "x1"; then
3516 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003517fi
3518
3519AC_SUBST(SUPPORT_FEATURES)
3520
3521dnl For supported protocols in pkg-config file
3522if test "x$CURL_DISABLE_HTTP" != "x1"; then
3523 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3524 if test "x$SSL_ENABLED" = "x1"; then
3525 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3526 fi
3527fi
3528if test "x$CURL_DISABLE_FTP" != "x1"; then
3529 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3530 if test "x$SSL_ENABLED" = "x1"; then
3531 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3532 fi
3533fi
3534if test "x$CURL_DISABLE_FILE" != "x1"; then
3535 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3536fi
3537if test "x$CURL_DISABLE_TELNET" != "x1"; then
3538 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3539fi
3540if test "x$CURL_DISABLE_LDAP" != "x1"; then
3541 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3542 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3543 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3544 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3545 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3546 fi
3547 fi
3548fi
3549if test "x$CURL_DISABLE_DICT" != "x1"; then
3550 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3551fi
3552if test "x$CURL_DISABLE_TFTP" != "x1"; then
3553 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3554fi
3555if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3556 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3557fi
3558if test "x$CURL_DISABLE_POP3" != "x1"; then
3559 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3560 if test "x$SSL_ENABLED" = "x1"; then
3561 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3562 fi
3563fi
3564if test "x$CURL_DISABLE_IMAP" != "x1"; then
3565 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3566 if test "x$SSL_ENABLED" = "x1"; then
3567 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3568 fi
3569fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003570if test "x$CURL_DISABLE_SMB" != "x1" \
3571 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3572 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3573 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3574 -o "x$DARWINSSL_ENABLED" = "x1" \); then
3575 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3576 if test "x$SSL_ENABLED" = "x1"; then
3577 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
3578 fi
3579fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003580if test "x$CURL_DISABLE_SMTP" != "x1"; then
3581 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3582 if test "x$SSL_ENABLED" = "x1"; then
3583 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3584 fi
3585fi
3586if test "x$USE_LIBSSH2" = "x1"; then
3587 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3588 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3589fi
3590if test "x$CURL_DISABLE_RTSP" != "x1"; then
3591 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3592fi
3593if test "x$USE_LIBRTMP" = "x1"; then
3594 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3595fi
3596
3597dnl replace spaces with newlines
3598dnl sort the lines
3599dnl replace the newlines back to spaces
3600SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3601
3602AC_SUBST(SUPPORT_PROTOCOLS)
3603
3604dnl squeeze whitespace out of some variables
3605
3606squeeze CFLAGS
3607squeeze CPPFLAGS
3608squeeze DEFS
3609squeeze LDFLAGS
3610squeeze LIBS
3611
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003612squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003613squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003614squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003615
3616squeeze SUPPORT_FEATURES
3617squeeze SUPPORT_PROTOCOLS
3618
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003619XC_CHECK_BUILD_FLAGS
3620
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003621if test "x$want_curldebug_assumed" = "xyes" &&
3622 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3623 ac_configure_args="$ac_configure_args --enable-curldebug"
3624fi
3625
3626AC_CONFIG_FILES([Makefile \
3627 docs/Makefile \
3628 docs/examples/Makefile \
3629 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003630 docs/libcurl/opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003631 include/Makefile \
3632 include/curl/Makefile \
3633 src/Makefile \
3634 lib/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003635 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003636 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003637 tests/certs/Makefile \
3638 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003639 tests/data/Makefile \
3640 tests/server/Makefile \
3641 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003642 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003643 packages/Makefile \
3644 packages/Win32/Makefile \
3645 packages/Win32/cygwin/Makefile \
3646 packages/Linux/Makefile \
3647 packages/Linux/RPM/Makefile \
3648 packages/Linux/RPM/curl.spec \
3649 packages/Linux/RPM/curl-ssl.spec \
3650 packages/Solaris/Makefile \
3651 packages/EPM/curl.list \
3652 packages/EPM/Makefile \
3653 packages/vms/Makefile \
3654 packages/AIX/Makefile \
3655 packages/AIX/RPM/Makefile \
3656 packages/AIX/RPM/curl.spec \
3657 curl-config \
3658 libcurl.pc
3659])
3660AC_OUTPUT
3661
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003662CURL_GENERATE_CONFIGUREHELP_PM
3663
3664XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
3665
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003666AC_MSG_NOTICE([Configured to build curl/libcurl:
3667
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003668 curl version: ${CURLVERSION}
3669 Host setup: ${host}
3670 Install prefix: ${prefix}
3671 Compiler: ${CC}
3672 SSL support: ${curl_ssl_msg}
3673 SSH support: ${curl_ssh_msg}
3674 zlib support: ${curl_zlib_msg}
3675 GSS-API support: ${curl_gss_msg}
3676 TLS-SRP support: ${curl_tls_srp_msg}
3677 resolver: ${curl_res_msg}
3678 IPv6 support: ${curl_ipv6_msg}
3679 Unix sockets support: ${curl_unix_sockets_msg}
3680 IDN support: ${curl_idn_msg}
3681 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
3682 Built-in manual: ${curl_manual_msg}
3683 --libcurl option: ${curl_libcurl_msg}
3684 Verbose errors: ${curl_verbose_msg}
3685 SSPI support: ${curl_sspi_msg}
3686 ca cert bundle: ${ca}
3687 ca cert path: ${capath}
3688 LDAP support: ${curl_ldap_msg}
3689 LDAPS support: ${curl_ldaps_msg}
3690 RTSP support: ${curl_rtsp_msg}
3691 RTMP support: ${curl_rtmp_msg}
3692 metalink support: ${curl_mtlnk_msg}
3693 HTTP2 support: ${curl_h2_msg}
3694 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003695])
3696
3697if test "x$soname_bump" = "xyes"; then
3698
3699cat <<EOM
3700 SONAME bump: yes - WARNING: this library will be built with the SONAME
3701 number bumped due to (a detected) ABI breakage.
3702 See lib/README.curl_off_t for details on this.
3703EOM
3704
3705fi
3706