blob: 57ac11fce62ea0e94b420c25979a2c003f8a810a [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"
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001501 AC_CHECK_LIB(crypto, HMAC_Init,[
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001502 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])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001594 AC_COMPILE_IFELSE([
1595 AC_LANG_PROGRAM([[
1596#include <openssl/base.h>
1597 ]],[[
1598#ifndef OPENSSL_IS_BORINGSSL
1599#error not boringssl
1600#endif
1601 ]])
1602 ],[
1603 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001604 AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
1605 [Define to 1 if using BoringSSL.])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001606 ],[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001607 AC_MSG_RESULT([no])
Bertrand SIMONNETf5510282015-07-06 14:58:49 -07001608 ])
1609
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001610 AC_MSG_CHECKING([for libressl])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001611 AC_COMPILE_IFELSE([
1612 AC_LANG_PROGRAM([[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001613#include <openssl/opensslv.h>
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001614 ]],[[
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001615 int dummy = LIBRESSL_VERSION_NUMBER;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001616 ]])
1617 ],[
1618 AC_MSG_RESULT([yes])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001619 AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
1620 [Define to 1 if using libressl.])
1621 curl_ssl_msg="enabled (libressl)"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001622 ],[
1623 AC_MSG_RESULT([no])
1624 ])
1625 fi
1626
1627 if test "$OPENSSL_ENABLED" = "1"; then
1628 if test -n "$LIB_OPENSSL"; then
1629 dnl when the ssl shared libs were found in a path that the run-time
1630 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1631 dnl to prevent further configure tests to fail due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001632 if test "x$cross_compiling" != "xyes"; then
1633 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1634 export LD_LIBRARY_PATH
1635 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1636 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001637 fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001638 CURL_CHECK_OPENSSL_API
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001639 fi
1640
1641fi
1642
1643dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001644dnl Check for the random seed preferences
1645dnl **********************************************************************
1646
1647if test X"$OPENSSL_ENABLED" = X"1"; then
1648 AC_ARG_WITH(egd-socket,
1649 AC_HELP_STRING([--with-egd-socket=FILE],
1650 [Entropy Gathering Daemon socket pathname]),
1651 [ EGD_SOCKET="$withval" ]
1652 )
1653 if test -n "$EGD_SOCKET" ; then
1654 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1655 [your Entropy Gathering Daemon socket pathname] )
1656 fi
1657
1658 dnl Check for user-specified random device
1659 AC_ARG_WITH(random,
1660 AC_HELP_STRING([--with-random=FILE],
1661 [read randomness from FILE (default=/dev/urandom)]),
1662 [ RANDOM_FILE="$withval" ],
1663 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001664 if test x$cross_compiling != xyes; then
1665 dnl Check for random device
1666 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1667 else
1668 AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
1669 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001670 ]
1671 )
1672 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1673 AC_SUBST(RANDOM_FILE)
1674 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1675 [a suitable file to read random data from])
1676 fi
1677fi
1678
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001679dnl ---
1680dnl We require OpenSSL with SRP support.
1681dnl ---
1682if test "$OPENSSL_ENABLED" = "1"; then
1683 AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1684 [
1685 AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
1686 AC_SUBST(HAVE_OPENSSL_SRP, [1])
1687 ])
1688fi
1689
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001690dnl ----------------------------------------------------
1691dnl check for GnuTLS
1692dnl ----------------------------------------------------
1693
1694dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1695OPT_GNUTLS=no
1696
1697AC_ARG_WITH(gnutls,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001698AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001699AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1700 OPT_GNUTLS=$withval)
1701
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001702if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001703
1704 if test X"$OPT_GNUTLS" != Xno; then
1705
1706 addld=""
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001707 addlib=""
1708 gtlslib=""
1709 version=""
1710 addcflags=""
1711
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001712 if test "x$OPT_GNUTLS" = "xyes"; then
1713 dnl this is with no partiular path given
1714 CURL_CHECK_PKGCONFIG(gnutls)
1715
1716 if test "$PKGCONFIG" != "no" ; then
1717 addlib=`$PKGCONFIG --libs-only-l gnutls`
1718 addld=`$PKGCONFIG --libs-only-L gnutls`
1719 addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1720 version=`$PKGCONFIG --modversion gnutls`
1721 gtlslib=`echo $addld | $SED -e 's/-L//'`
1722 else
1723 dnl without pkg-config, we try libgnutls-config as that was how it
1724 dnl used to be done
1725 check=`libgnutls-config --version 2>/dev/null`
1726 if test -n "$check"; then
1727 addlib=`libgnutls-config --libs`
1728 addcflags=`libgnutls-config --cflags`
1729 version=`libgnutls-config --version`
1730 gtlslib=`libgnutls-config --prefix`/lib$libsuff
1731 fi
1732 fi
1733 else
1734 dnl this is with a given path, first check if there's a libgnutls-config
1735 dnl there and if not, make an educated guess
1736 cfg=$OPT_GNUTLS/bin/libgnutls-config
1737 check=`$cfg --version 2>/dev/null`
1738 if test -n "$check"; then
1739 addlib=`$cfg --libs`
1740 addcflags=`$cfg --cflags`
1741 version=`$cfg --version`
1742 gtlslib=`$cfg --prefix`/lib$libsuff
1743 else
1744 dnl without pkg-config and libgnutls-config, we guess a lot!
1745 addlib=-lgnutls
1746 addld=-L$OPT_GNUTLS/lib$libsuff
1747 addcflags=-I$OPT_GNUTLS/include
1748 version="" # we just don't know
1749 gtlslib=$OPT_GNUTLS/lib$libsuff
1750 fi
1751 fi
1752
1753 if test -z "$version"; then
1754 dnl lots of efforts, still no go
1755 version="unknown"
1756 fi
1757
1758 if test -n "$addlib"; then
1759
1760 CLEANLIBS="$LIBS"
1761 CLEANCPPFLAGS="$CPPFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001762 CLEANLDFLAGS="$LDFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001763
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001764 LIBS="$addlib $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001765 LDFLAGS="$LDFLAGS $addld"
1766 if test "$addcflags" != "-I/usr/include"; then
1767 CPPFLAGS="$CPPFLAGS $addcflags"
1768 fi
1769
1770 AC_CHECK_LIB(gnutls, gnutls_check_version,
1771 [
1772 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1773 AC_SUBST(USE_GNUTLS, [1])
1774 GNUTLS_ENABLED=1
1775 USE_GNUTLS="yes"
1776 curl_ssl_msg="enabled (GnuTLS)"
1777 ],
1778 [
1779 LIBS="$CLEANLIBS"
1780 CPPFLAGS="$CLEANCPPFLAGS"
1781 ])
1782
1783 if test "x$USE_GNUTLS" = "xyes"; then
1784 AC_MSG_NOTICE([detected GnuTLS version $version])
1785
1786 if test -n "$gtlslib"; then
1787 dnl when shared libs were found in a path that the run-time
1788 dnl linker doesn't search through, we need to add it to
1789 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1790 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001791 if test "x$cross_compiling" != "xyes"; then
1792 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1793 export LD_LIBRARY_PATH
1794 AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1795 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001796 fi
1797 fi
1798
1799 fi
1800
1801 fi dnl GNUTLS not disabled
1802
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001803fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001804
1805dnl ---
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001806dnl Check which crypto backend GnuTLS uses
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001807dnl ---
1808
1809if test "$GNUTLS_ENABLED" = "1"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001810 USE_GNUTLS_NETTLE=
1811 # First check if we can detect either crypto library via transitive linking
1812 AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1813 if test "$USE_GNUTLS_NETTLE" = ""; then
1814 AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1815 fi
1816 # If not, try linking directly to both of them to see if they are available
1817 if test "$USE_GNUTLS_NETTLE" = ""; then
1818 AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
1819 fi
1820 if test "$USE_GNUTLS_NETTLE" = ""; then
1821 AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
1822 fi
1823 if test "$USE_GNUTLS_NETTLE" = ""; then
1824 AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
1825 fi
1826 if test "$USE_GNUTLS_NETTLE" = "1"; then
1827 AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
1828 AC_SUBST(USE_GNUTLS_NETTLE, [1])
1829 LIBS="-lnettle $LIBS"
1830 else
1831 LIBS="-lgcrypt $LIBS"
1832 fi
1833fi
1834
1835dnl ---
1836dnl We require GnuTLS with SRP support.
1837dnl ---
1838if test "$GNUTLS_ENABLED" = "1"; then
1839 AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
1840 [
1841 AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
1842 AC_SUBST(HAVE_GNUTLS_SRP, [1])
1843 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001844fi
1845
1846dnl ----------------------------------------------------
1847dnl check for PolarSSL
1848dnl ----------------------------------------------------
1849
1850dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1851OPT_POLARSSL=no
1852
1853_cppflags=$CPPFLAGS
1854_ldflags=$LDFLAGS
1855AC_ARG_WITH(polarssl,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001856AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001857AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1858 OPT_POLARSSL=$withval)
1859
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001860if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001861
1862 if test X"$OPT_POLARSSL" != Xno; then
1863
1864 if test "$OPT_POLARSSL" = "yes"; then
1865 OPT_POLARSSL=""
1866 fi
1867
1868 if test -z "$OPT_POLARSSL" ; then
1869 dnl check for lib first without setting any new path
1870
1871 AC_CHECK_LIB(polarssl, havege_init,
1872 dnl libpolarssl found, set the variable
1873 [
1874 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1875 AC_SUBST(USE_POLARSSL, [1])
1876 POLARSSL_ENABLED=1
1877 USE_POLARSSL="yes"
1878 curl_ssl_msg="enabled (PolarSSL)"
1879 ])
1880 fi
1881
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001882 addld=""
1883 addlib=""
1884 addcflags=""
1885 polarssllib=""
1886
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001887 if test "x$USE_POLARSSL" != "xyes"; then
1888 dnl add the path and test again
1889 addld=-L$OPT_POLARSSL/lib$libsuff
1890 addcflags=-I$OPT_POLARSSL/include
1891 polarssllib=$OPT_POLARSSL/lib$libsuff
1892
1893 LDFLAGS="$LDFLAGS $addld"
1894 if test "$addcflags" != "-I/usr/include"; then
1895 CPPFLAGS="$CPPFLAGS $addcflags"
1896 fi
1897
1898 AC_CHECK_LIB(polarssl, ssl_init,
1899 [
1900 AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1901 AC_SUBST(USE_POLARSSL, [1])
1902 POLARSSL_ENABLED=1
1903 USE_POLARSSL="yes"
1904 curl_ssl_msg="enabled (PolarSSL)"
1905 ],
1906 [
1907 CPPFLAGS=$_cppflags
1908 LDFLAGS=$_ldflags
1909 ])
1910 fi
1911
1912 if test "x$USE_POLARSSL" = "xyes"; then
1913 AC_MSG_NOTICE([detected PolarSSL])
1914
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001915 LIBS="-lpolarssl $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001916
1917 if test -n "$polarssllib"; then
1918 dnl when shared libs were found in a path that the run-time
1919 dnl linker doesn't search through, we need to add it to
1920 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1921 dnl due to this
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001922 if test "x$cross_compiling" != "xyes"; then
1923 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
1924 export LD_LIBRARY_PATH
1925 AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
1926 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001927 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07001928 fi
1929
1930 fi dnl PolarSSL not disabled
1931
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001932fi
1933
1934dnl ----------------------------------------------------
1935dnl check for CyaSSL
1936dnl ----------------------------------------------------
1937
1938dnl Default to compiler & linker defaults for CyaSSL files & libraries.
1939OPT_CYASSL=no
1940
1941_cppflags=$CPPFLAGS
1942_ldflags=$LDFLAGS
1943AC_ARG_WITH(cyassl,dnl
1944AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
1945AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
1946 OPT_CYASSL=$withval)
1947
1948if test "$curl_ssl_msg" = "$init_ssl_msg"; then
1949
1950 if test X"$OPT_CYASSL" != Xno; then
1951
1952 if test "$OPT_CYASSL" = "yes"; then
1953 OPT_CYASSL=""
1954 fi
1955
1956 dnl This should be reworked to use pkg-config instead
1957
1958 cyassllibname=cyassl
1959
1960 if test -z "$OPT_CYASSL" ; then
1961 dnl check for lib in system default first
1962
1963 AC_CHECK_LIB(cyassl, CyaSSL_Init,
1964 dnl libcyassl found, set the variable
1965 [
1966 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1967 AC_SUBST(USE_CYASSL, [1])
1968 CYASSL_ENABLED=1
1969 USE_CYASSL="yes"
1970 curl_ssl_msg="enabled (CyaSSL)"
1971 ])
1972 fi
1973
1974 addld=""
1975 addlib=""
1976 addcflags=""
1977 cyassllib=""
1978
1979 if test "x$USE_CYASSL" != "xyes"; then
1980 dnl add the path and test again
1981 addld=-L$OPT_CYASSL/lib$libsuff
1982 addcflags=-I$OPT_CYASSL/include
1983 cyassllib=$OPT_CYASSL/lib$libsuff
1984
1985 LDFLAGS="$LDFLAGS $addld"
1986 if test "$addcflags" != "-I/usr/include"; then
1987 CPPFLAGS="$CPPFLAGS $addcflags"
1988 fi
1989
1990 AC_CHECK_LIB(cyassl, CyaSSL_Init,
1991 [
1992 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1993 AC_SUBST(USE_CYASSL, [1])
1994 CYASSL_ENABLED=1
1995 USE_CYASSL="yes"
1996 curl_ssl_msg="enabled (CyaSSL)"
1997 ],
1998 [
1999 CPPFLAGS=$_cppflags
2000 LDFLAGS=$_ldflags
2001 cyassllib=""
2002 ])
2003 fi
2004
2005 addld=""
2006 addlib=""
2007 addcflags=""
2008
2009 if test "x$USE_CYASSL" != "xyes"; then
2010 dnl libcyassl renamed to libwolfssl as of 3.4.0
2011 addld=-L$OPT_CYASSL/lib$libsuff
2012 addcflags=-I$OPT_CYASSL/include
2013 cyassllib=$OPT_CYASSL/lib$libsuff
2014
2015 LDFLAGS="$LDFLAGS $addld"
2016 if test "$addcflags" != "-I/usr/include"; then
2017 CPPFLAGS="$CPPFLAGS $addcflags"
2018 fi
2019
2020 cyassllibname=wolfssl
2021 my_ac_save_LIBS="$LIBS"
2022 LIBS="-l$cyassllibname -lm $LIBS"
2023
2024 AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
2025 AC_LINK_IFELSE([
2026 AC_LANG_PROGRAM([[
2027/* These aren't needed for detection and confuse WolfSSL.
2028 They are set up properly later if it is detected. */
2029#undef SIZEOF_LONG
2030#undef SIZEOF_LONG_LONG
2031#include <cyassl/ssl.h>
2032 ]],[[
2033 return CyaSSL_Init();
2034 ]])
2035 ],[
2036 AC_MSG_RESULT(yes)
2037 AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
2038 AC_SUBST(USE_CYASSL, [1])
2039 CYASSL_ENABLED=1
2040 USE_CYASSL="yes"
2041 curl_ssl_msg="enabled (CyaSSL)"
2042 ],
2043 [
2044 AC_MSG_RESULT(no)
2045 CPPFLAGS=$_cppflags
2046 LDFLAGS=$_ldflags
2047 cyassllib=""
2048 ])
2049 LIBS="$my_ac_save_LIBS"
2050 fi
2051
2052 if test "x$USE_CYASSL" = "xyes"; then
2053 AC_MSG_NOTICE([detected CyaSSL])
2054
2055 dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
2056 AC_CHECK_SIZEOF(long long)
2057
2058 dnl Versions since at least 2.6.0 may have options.h
2059 AC_CHECK_HEADERS(cyassl/options.h)
2060
2061 dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
2062 AC_CHECK_HEADERS(cyassl/error-ssl.h)
2063
2064 LIBS="-l$cyassllibname -lm $LIBS"
2065
2066 if test -n "$cyassllib"; then
2067 dnl when shared libs were found in a path that the run-time
2068 dnl linker doesn't search through, we need to add it to
2069 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2070 dnl due to this
2071 if test "x$cross_compiling" != "xyes"; then
2072 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
2073 export LD_LIBRARY_PATH
2074 AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
2075 fi
2076 fi
2077
2078 fi
2079
2080 fi dnl CyaSSL not disabled
2081
2082fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002083
2084dnl ----------------------------------------------------
2085dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
2086dnl ----------------------------------------------------
2087
2088dnl Default to compiler & linker defaults for NSS files & libraries.
2089OPT_NSS=no
2090
2091AC_ARG_WITH(nss,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002092AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002093AC_HELP_STRING([--without-nss], [disable NSS detection]),
2094 OPT_NSS=$withval)
2095
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002096if test "$curl_ssl_msg" = "$init_ssl_msg"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002097
2098 if test X"$OPT_NSS" != Xno; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002099
2100 addld=""
2101 addlib=""
2102 addcflags=""
2103 nssprefix=""
2104 version=""
2105
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002106 if test "x$OPT_NSS" = "xyes"; then
2107
2108 CURL_CHECK_PKGCONFIG(nss)
2109
2110 if test "$PKGCONFIG" != "no" ; then
2111 addlib=`$PKGCONFIG --libs nss`
2112 addcflags=`$PKGCONFIG --cflags nss`
2113 version=`$PKGCONFIG --modversion nss`
2114 nssprefix=`$PKGCONFIG --variable=prefix nss`
2115 else
2116 dnl Without pkg-config, we check for nss-config
2117
2118 check=`nss-config --version 2>/dev/null`
2119 if test -n "$check"; then
2120 addlib=`nss-config --libs`
2121 addcflags=`nss-config --cflags`
2122 version=`nss-config --version`
2123 nssprefix=`nss-config --prefix`
2124 else
2125 addlib="-lnss3"
2126 addcflags=""
2127 version="unknown"
2128 fi
2129 fi
2130 else
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002131 NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
2132 if test -f "$NSS_PCDIR/nss.pc"; then
2133 CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
2134 if test "$PKGCONFIG" != "no" ; then
2135 addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
2136 addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
2137 addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
2138 version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
2139 nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
2140 fi
2141 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002142 fi
2143
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002144 if test -z "$addlib"; then
2145 # Without pkg-config, we'll kludge in some defaults
2146 AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
2147 addld="-L$OPT_NSS/lib"
2148 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
2149 addcflags="-I$OPT_NSS/include"
2150 version="unknown"
2151 nssprefix=$OPT_NSS
2152 fi
2153
2154 CLEANLDFLAGS="$LDFLAGS"
2155 CLEANLIBS="$LIBS"
2156 CLEANCPPFLAGS="$CPPFLAGS"
2157
2158 LDFLAGS="$addld $LDFLAGS"
2159 LIBS="$addlib $LIBS"
2160 if test "$addcflags" != "-I/usr/include"; then
2161 CPPFLAGS="$CPPFLAGS $addcflags"
2162 fi
2163
2164 dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
2165 AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002166 [
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002167 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2168 AC_SUBST(USE_NSS, [1])
2169 USE_NSS="yes"
2170 NSS_ENABLED=1
2171 curl_ssl_msg="enabled (NSS)"
2172 ],
2173 [
2174 LDFLAGS="$CLEANLDFLAGS"
2175 LIBS="$CLEANLIBS"
2176 CPPFLAGS="$CLEANCPPFLAGS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002177 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002178
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002179 if test "x$USE_NSS" = "xyes"; then
2180 AC_MSG_NOTICE([detected NSS version $version])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002181
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002182 dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
2183 NSS_LIBS=$addlib
2184 AC_SUBST([NSS_LIBS])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002185
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002186 dnl when shared libs were found in a path that the run-time
2187 dnl linker doesn't search through, we need to add it to
2188 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2189 dnl due to this
2190 if test "x$cross_compiling" != "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002191 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2192 export LD_LIBRARY_PATH
2193 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2194 fi
2195
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002196 fi dnl NSS found
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002197
2198 fi dnl NSS not disabled
2199
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002200fi dnl curl_ssl_msg = init_ssl_msg
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002201
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002202OPT_AXTLS=off
2203
2204AC_ARG_WITH(axtls,dnl
2205AC_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.])
2206AC_HELP_STRING([--without-axtls], [disable axTLS]),
2207 OPT_AXTLS=$withval)
2208
2209if test "$curl_ssl_msg" = "$init_ssl_msg"; then
2210 if test X"$OPT_AXTLS" != Xno; then
2211 dnl backup the pre-axtls variables
2212 CLEANLDFLAGS="$LDFLAGS"
2213 CLEANCPPFLAGS="$CPPFLAGS"
2214 CLEANLIBS="$LIBS"
2215
2216 case "$OPT_AXTLS" in
2217 yes)
2218 dnl --with-axtls (without path) used
2219 PREFIX_AXTLS=/usr/local
2220 LIB_AXTLS="$PREFIX_AXTLS/lib"
2221 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2222 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2223 ;;
2224 off)
2225 dnl no --with-axtls option given, just check default places
2226 PREFIX_AXTLS=
2227 ;;
2228 *)
2229 dnl check the given --with-axtls spot
2230 PREFIX_AXTLS=$OPT_AXTLS
2231 LIB_AXTLS="$PREFIX_AXTLS/lib"
2232 LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2233 CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2234 ;;
2235 esac
2236
2237 AC_CHECK_LIB(axtls, ssl_version,[
2238 LIBS="-laxtls $LIBS"
2239 AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2240 AC_SUBST(USE_AXTLS, [1])
2241 AXTLS_ENABLED=1
2242 USE_AXTLS="yes"
2243 curl_ssl_msg="enabled (axTLS)"
2244
2245 if test "x$cross_compiling" != "xyes"; then
2246 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2247 export LD_LIBRARY_PATH
2248 AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2249 fi
2250 ],[
2251 LDFLAGS="$CLEANLDFLAGS"
2252 CPPFLAGS="$CLEANCPPFLAGS"
2253 LIBS="$CLEANLIBS"
2254 ])
2255 fi
2256fi
2257
2258if 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 -07002259 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002260 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 -07002261else
2262 # SSL is enabled, genericly
2263 AC_SUBST(SSL_ENABLED)
2264 SSL_ENABLED="1"
2265fi
2266
2267dnl **********************************************************************
2268dnl Check for the CA bundle
2269dnl **********************************************************************
2270
2271CURL_CHECK_CA_BUNDLE
2272
2273dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002274dnl Check for libmetalink
2275dnl **********************************************************************
2276
2277OPT_LIBMETALINK=no
2278
2279AC_ARG_WITH(libmetalink,dnl
2280AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
2281AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
2282 OPT_LIBMETALINK=$withval)
2283
2284if test X"$OPT_LIBMETALINK" != Xno; then
2285
2286 addld=""
2287 addlib=""
2288 addcflags=""
2289 version=""
2290 libmetalinklib=""
2291
2292 PKGTEST="no"
2293 if test "x$OPT_LIBMETALINK" = "xyes"; then
2294 dnl this is with no partiular path given
2295 PKGTEST="yes"
2296 CURL_CHECK_PKGCONFIG(libmetalink)
2297 else
2298 dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
2299 LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
2300 AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
2301 if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
2302 PKGTEST="yes"
2303 fi
2304 if test "$PKGTEST" = "yes"; then
2305 CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
2306 fi
2307 fi
2308 if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
2309 addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2310 $PKGCONFIG --libs-only-l libmetalink`
2311 addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2312 $PKGCONFIG --libs-only-L libmetalink`
2313 addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2314 $PKGCONFIG --cflags-only-I libmetalink`
2315 version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
2316 $PKGCONFIG --modversion libmetalink`
2317 libmetalinklib=`echo $addld | $SED -e 's/-L//'`
2318 fi
2319 if test -n "$addlib"; then
2320
2321 clean_CPPFLAGS="$CPPFLAGS"
2322 clean_LDFLAGS="$LDFLAGS"
2323 clean_LIBS="$LIBS"
2324 CPPFLAGS="$addcflags $clean_CPPFLAGS"
2325 LDFLAGS="$addld $clean_LDFLAGS"
2326 LIBS="$addlib $clean_LIBS"
2327 AC_MSG_CHECKING([if libmetalink is recent enough])
2328 AC_LINK_IFELSE([
2329 AC_LANG_PROGRAM([[
2330# include <metalink/metalink.h>
2331 ]],[[
2332 if(0 != metalink_strerror(0)) /* added in 0.1.0 */
2333 return 1;
2334 ]])
2335 ],[
2336 AC_MSG_RESULT([yes ($version)])
2337 want_metalink="yes"
2338 ],[
2339 AC_MSG_RESULT([no ($version)])
2340 AC_MSG_NOTICE([libmetalink library defective or too old])
2341 want_metalink="no"
2342 ])
2343 CPPFLAGS="$clean_CPPFLAGS"
2344 LDFLAGS="$clean_LDFLAGS"
2345 LIBS="$clean_LIBS"
2346 if test "$want_metalink" = "yes"; then
2347 dnl finally libmetalink will be used
2348 AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
2349 LIBMETALINK_LIBS=$addlib
2350 LIBMETALINK_LDFLAGS=$addld
2351 LIBMETALINK_CPPFLAGS=$addcflags
2352 AC_SUBST([LIBMETALINK_LIBS])
2353 AC_SUBST([LIBMETALINK_LDFLAGS])
2354 AC_SUBST([LIBMETALINK_CPPFLAGS])
2355 curl_mtlnk_msg="enabled"
2356 fi
2357
2358 fi
2359fi
2360
2361dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002362dnl Check for the presence of LIBSSH2 libraries and headers
2363dnl **********************************************************************
2364
2365dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2366OPT_LIBSSH2=off
2367AC_ARG_WITH(libssh2,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002368AC_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 -07002369AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2370 OPT_LIBSSH2=$withval)
2371
2372if test X"$OPT_LIBSSH2" != Xno; then
2373 dnl backup the pre-libssh2 variables
2374 CLEANLDFLAGS="$LDFLAGS"
2375 CLEANCPPFLAGS="$CPPFLAGS"
2376 CLEANLIBS="$LIBS"
2377
2378 case "$OPT_LIBSSH2" in
2379 yes)
2380 dnl --with-libssh2 (without path) used
2381 CURL_CHECK_PKGCONFIG(libssh2)
2382
2383 if test "$PKGCONFIG" != "no" ; then
2384 LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2385 LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2386 CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2387 version=`$PKGCONFIG --modversion libssh2`
2388 DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2389 fi
2390
2391 ;;
2392 off)
2393 dnl no --with-libssh2 option given, just check default places
2394 ;;
2395 *)
2396 dnl use the given --with-libssh2 spot
2397 PREFIX_SSH2=$OPT_LIBSSH2
2398 ;;
2399 esac
2400
2401 dnl if given with a prefix, we set -L and -I based on that
2402 if test -n "$PREFIX_SSH2"; then
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002403 LIB_SSH2="-lssh2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002404 LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2405 CPP_SSH2=-I${PREFIX_SSH2}/include
2406 DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2407 fi
2408
2409 LDFLAGS="$LDFLAGS $LD_SSH2"
2410 CPPFLAGS="$CPPFLAGS $CPP_SSH2"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002411 LIBS="$LIB_SSH2 $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002412
2413 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2414
2415 AC_CHECK_HEADERS(libssh2.h,
2416 curl_ssh_msg="enabled (libSSH2)"
2417 LIBSSH2_ENABLED=1
2418 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2419 AC_SUBST(USE_LIBSSH2, [1])
2420 )
2421
2422 if test X"$OPT_LIBSSH2" != Xoff &&
2423 test "$LIBSSH2_ENABLED" != "1"; then
2424 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2425 fi
2426
2427 if test "$LIBSSH2_ENABLED" = "1"; then
2428 if test -n "$DIR_SSH2"; then
2429 dnl when the libssh2 shared libs were found in a path that the run-time
2430 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2431 dnl to prevent further configure tests to fail due to this
2432
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002433 if test "x$cross_compiling" != "xyes"; then
2434 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2435 export LD_LIBRARY_PATH
2436 AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2437 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002438 fi
2439 else
2440 dnl no libssh2, revert back to clean variables
2441 LDFLAGS=$CLEANLDFLAGS
2442 CPPFLAGS=$CLEANCPPFLAGS
2443 LIBS=$CLEANLIBS
2444 fi
2445fi
2446
2447dnl **********************************************************************
2448dnl Check for the presence of LIBRTMP libraries and headers
2449dnl **********************************************************************
2450
2451dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2452OPT_LIBRTMP=off
2453AC_ARG_WITH(librtmp,dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002454AC_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 -07002455AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2456 OPT_LIBRTMP=$withval)
2457
2458if test X"$OPT_LIBRTMP" != Xno; then
2459 dnl backup the pre-librtmp variables
2460 CLEANLDFLAGS="$LDFLAGS"
2461 CLEANCPPFLAGS="$CPPFLAGS"
2462 CLEANLIBS="$LIBS"
2463
2464 case "$OPT_LIBRTMP" in
2465 yes)
2466 dnl --with-librtmp (without path) used
2467 CURL_CHECK_PKGCONFIG(librtmp)
2468
2469 if test "$PKGCONFIG" != "no" ; then
2470 LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2471 LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2472 CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2473 version=`$PKGCONFIG --modversion librtmp`
2474 DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002475 else
2476 dnl To avoid link errors, we do not allow --librtmp without
2477 dnl a pkgconfig file
2478 AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002479 fi
2480
2481 ;;
2482 off)
2483 dnl no --with-librtmp option given, just check default places
2484 LIB_RTMP="-lrtmp"
2485 ;;
2486 *)
2487 dnl use the given --with-librtmp spot
2488 PREFIX_RTMP=$OPT_LIBRTMP
2489 ;;
2490 esac
2491
2492 dnl if given with a prefix, we set -L and -I based on that
2493 if test -n "$PREFIX_RTMP"; then
2494 LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2495 CPP_RTMP=-I${PREFIX_RTMP}/include
2496 DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2497 fi
2498
2499 LDFLAGS="$LDFLAGS $LD_RTMP"
2500 CPPFLAGS="$CPPFLAGS $CPP_RTMP"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002501 LIBS="$LIB_RTMP $LIBS"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002502
2503 AC_CHECK_LIB(rtmp, RTMP_Init,
2504 [
2505 AC_CHECK_HEADERS(librtmp/rtmp.h,
2506 curl_rtmp_msg="enabled (librtmp)"
2507 LIBRTMP_ENABLED=1
2508 AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2509 AC_SUBST(USE_LIBRTMP, [1])
2510 )
2511 ],
2512 dnl not found, revert back to clean variables
2513 LDFLAGS=$CLEANLDFLAGS
2514 CPPFLAGS=$CLEANCPPFLAGS
2515 LIBS=$CLEANLIBS
2516 )
2517
2518 if test X"$OPT_LIBRTMP" != Xoff &&
2519 test "$LIBRTMP_ENABLED" != "1"; then
2520 AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2521 fi
2522
2523fi
2524
2525dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002526dnl Check for linker switch for versioned symbols
2527dnl **********************************************************************
2528
2529versioned_symbols_flavour=
2530AC_MSG_CHECKING([whether versioned symbols are wanted])
2531AC_ARG_ENABLE(versioned-symbols,
2532AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
2533AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
2534[ case "$enableval" in
2535 yes) AC_MSG_RESULT(yes)
2536 AC_MSG_CHECKING([if libraries can be versioned])
2537 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
2538 if test -z "$GLD"; then
2539 AC_MSG_RESULT(no)
2540 AC_MSG_WARN([You need an ld version supporting the --version-script option])
2541 else
2542 AC_MSG_RESULT(yes)
2543 if test "x$OPENSSL_ENABLED" = "x1"; then
2544 versioned_symbols_flavour="OPENSSL_"
2545 elif test "x$GNUTLS_ENABLED" = "x1"; then
2546 versioned_symbols_flavour="GNUTLS_"
2547 elif test "x$NSS_ENABLED" = "x1"; then
2548 versioned_symbols_flavour="NSS_"
2549 elif test "x$POLARSSL_ENABLED" = "x1"; then
2550 versioned_symbols_flavour="POLARSSL_"
2551 elif test "x$CYASSL_ENABLED" = "x1"; then
2552 versioned_symbols_flavour="CYASSL_"
2553 elif test "x$AXTLS_ENABLED" = "x1"; then
2554 versioned_symbols_flavour="AXTLS_"
2555 elif test "x$WINSSL_ENABLED" = "x1"; then
2556 versioned_symbols_flavour="WINSSL_"
2557 elif test "x$DARWINSSL_ENABLED" = "x1"; then
2558 versioned_symbols_flavour="DARWINSSL_"
2559 else
2560 versioned_symbols_flavour=""
2561 fi
2562 versioned_symbols="yes"
2563 fi
2564 ;;
2565
2566 *) AC_MSG_RESULT(no)
2567 ;;
2568 esac
2569], [
2570AC_MSG_RESULT(no)
2571]
2572)
2573
2574AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
2575 ["$versioned_symbols_flavour"])
2576AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
2577 [test "x$versioned_symbols" = 'xyes'])
2578
2579dnl -------------------------------------------------
2580dnl check winidn option before other IDN libraries
2581dnl -------------------------------------------------
2582
2583AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
2584OPT_WINIDN="default"
2585AC_ARG_WITH(winidn,
2586AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
2587AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
2588 OPT_WINIDN=$withval)
2589case "$OPT_WINIDN" in
2590 no|default)
2591 dnl --without-winidn option used or configure option not specified
2592 want_winidn="no"
2593 AC_MSG_RESULT([no])
2594 ;;
2595 yes)
2596 dnl --with-winidn option used without path
2597 want_winidn="yes"
2598 want_winidn_path="default"
2599 AC_MSG_RESULT([yes])
2600 ;;
2601 *)
2602 dnl --with-winidn option used with path
2603 want_winidn="yes"
2604 want_winidn_path="$withval"
2605 AC_MSG_RESULT([yes ($withval)])
2606 ;;
2607esac
2608
2609if test "$want_winidn" = "yes"; then
2610 dnl winidn library support has been requested
2611 clean_CPPFLAGS="$CPPFLAGS"
2612 clean_LDFLAGS="$LDFLAGS"
2613 clean_LIBS="$LIBS"
2614 WINIDN_LIBS="-lnormaliz"
2615 #
2616 if test "$want_winidn_path" != "default"; then
2617 dnl path has been specified
2618 dnl pkg-config not available or provides no info
2619 WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
2620 WINIDN_CPPFLAGS="-I$want_winidn_path/include"
2621 WINIDN_DIR="$want_winidn_path/lib$libsuff"
2622 fi
2623 #
2624 CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
2625 LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
2626 LIBS="$WINIDN_LIBS $LIBS"
2627 #
2628 AC_MSG_CHECKING([if IdnToUnicode can be linked])
2629 AC_LINK_IFELSE([
2630 AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
2631 ],[
2632 AC_MSG_RESULT([yes])
2633 tst_links_winidn="yes"
2634 ],[
2635 AC_MSG_RESULT([no])
2636 tst_links_winidn="no"
2637 ])
2638 #
2639 if test "$tst_links_winidn" = "yes"; then
2640 AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
2641 AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
2642 AC_SUBST([IDN_ENABLED], [1])
2643 curl_idn_msg="enabled (Windows-native)"
2644 else
2645 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2646 CPPFLAGS="$clean_CPPFLAGS"
2647 LDFLAGS="$clean_LDFLAGS"
2648 LIBS="$clean_LIBS"
2649 fi
2650fi
2651
2652dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002653dnl Check for the presence of IDN libraries and headers
2654dnl **********************************************************************
2655
2656AC_MSG_CHECKING([whether to build with libidn])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002657OPT_IDN="default"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002658AC_ARG_WITH(libidn,
2659AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
2660AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002661 [OPT_IDN=$withval])
2662case "$OPT_IDN" in
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002663 no)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002664 dnl --without-libidn option used
2665 want_idn="no"
2666 AC_MSG_RESULT([no])
2667 ;;
2668 default)
2669 dnl configure option not specified
2670 want_idn="yes"
2671 want_idn_path="default"
2672 AC_MSG_RESULT([(assumed) yes])
2673 ;;
2674 yes)
2675 dnl --with-libidn option used without path
2676 want_idn="yes"
2677 want_idn_path="default"
2678 AC_MSG_RESULT([yes])
2679 ;;
2680 *)
2681 dnl --with-libidn option used with path
2682 want_idn="yes"
2683 want_idn_path="$withval"
2684 AC_MSG_RESULT([yes ($withval)])
2685 ;;
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002686esac
2687
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002688if test "$want_idn" = "yes"; then
2689 dnl idn library support has been requested
2690 clean_CPPFLAGS="$CPPFLAGS"
2691 clean_LDFLAGS="$LDFLAGS"
2692 clean_LIBS="$LIBS"
2693 PKGCONFIG="no"
2694 #
2695 if test "$want_idn_path" != "default"; then
2696 dnl path has been specified
2697 IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
2698 CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
2699 if test "$PKGCONFIG" != "no"; then
2700 IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2701 $PKGCONFIG --libs-only-l libidn 2>/dev/null`
2702 IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2703 $PKGCONFIG --libs-only-L libidn 2>/dev/null`
2704 IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
2705 $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2706 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2707 else
2708 dnl pkg-config not available or provides no info
2709 IDN_LIBS="-lidn"
2710 IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
2711 IDN_CPPFLAGS="-I$want_idn_path/include"
2712 IDN_DIR="$want_idn_path/lib$libsuff"
2713 fi
2714 else
2715 dnl path not specified
2716 CURL_CHECK_PKGCONFIG(libidn)
2717 if test "$PKGCONFIG" != "no"; then
2718 IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
2719 IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
2720 IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
2721 IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
2722 else
2723 dnl pkg-config not available or provides no info
2724 IDN_LIBS="-lidn"
2725 fi
2726 fi
2727 #
2728 if test "$PKGCONFIG" != "no"; then
2729 AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
2730 AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
2731 AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2732 AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
2733 else
2734 AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
2735 AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
2736 AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
2737 AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
2738 fi
2739 #
2740 CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
2741 LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
2742 LIBS="$IDN_LIBS $LIBS"
2743 #
2744 AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
2745 AC_LINK_IFELSE([
2746 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
2747 ],[
2748 AC_MSG_RESULT([yes])
2749 tst_links_libidn="yes"
2750 ],[
2751 AC_MSG_RESULT([no])
2752 tst_links_libidn="no"
2753 ])
2754 if test "$tst_links_libidn" = "no"; then
2755 AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
2756 AC_LINK_IFELSE([
2757 AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
2758 ],[
2759 AC_MSG_RESULT([yes])
2760 tst_links_libidn="yes"
2761 ],[
2762 AC_MSG_RESULT([no])
2763 tst_links_libidn="no"
2764 ])
2765 fi
2766 #
2767 if test "$tst_links_libidn" = "yes"; then
2768 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
2769 dnl different versions of libidn have different setups of these:
2770 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
2771 AC_CHECK_HEADERS( idn-free.h tld.h )
2772 if test "x$ac_cv_header_tld_h" = "xyes"; then
2773 AC_SUBST([IDN_ENABLED], [1])
2774 curl_idn_msg="enabled"
2775 if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
2776 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
2777 export LD_LIBRARY_PATH
2778 AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
2779 fi
2780 else
2781 AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
2782 CPPFLAGS="$clean_CPPFLAGS"
2783 LDFLAGS="$clean_LDFLAGS"
2784 LIBS="$clean_LIBS"
2785 fi
2786 else
2787 AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
2788 CPPFLAGS="$clean_CPPFLAGS"
2789 LDFLAGS="$clean_LDFLAGS"
2790 LIBS="$clean_LIBS"
2791 fi
2792fi
2793
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002794
2795dnl Let's hope this split URL remains working:
2796dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
2797dnl genprogc/thread_quick_ref.htm
2798
2799
2800dnl **********************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002801dnl Check for nghttp2
2802dnl **********************************************************************
2803
2804OPT_H2="yes"
2805AC_ARG_WITH(nghttp2,
2806AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
2807AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
2808 [OPT_H2=$withval])
2809case "$OPT_H2" in
2810 no)
2811 dnl --without-nghttp2 option used
2812 want_h2="no"
2813 ;;
2814 yes)
2815 dnl --with-nghttp2 option used without path
2816 want_h2="default"
2817 want_h2_path=""
2818 ;;
2819 *)
2820 dnl --with-nghttp2 option used with path
2821 want_h2="yes"
2822 want_h2_path="$withval/lib/pkgconfig"
2823 ;;
2824esac
2825
2826curl_h2_msg="disabled (--with-nghttp2)"
2827if test X"$want_h2" != Xno; then
2828 dnl backup the pre-nghttp2 variables
2829 CLEANLDFLAGS="$LDFLAGS"
2830 CLEANCPPFLAGS="$CPPFLAGS"
2831 CLEANLIBS="$LIBS"
2832
2833 CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
2834
2835 if test "$PKGCONFIG" != "no" ; then
2836 LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2837 $PKGCONFIG --libs-only-l libnghttp2`
2838 AC_MSG_NOTICE([-l is $LIB_H2])
2839
2840 CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
2841 $PKGCONFIG --cflags-only-I libnghttp2`
2842 AC_MSG_NOTICE([-I is $CPP_H2])
2843
2844 LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
2845 $PKGCONFIG --libs-only-L libnghttp2`
2846 AC_MSG_NOTICE([-L is $LD_H2])
2847
2848 LDFLAGS="$LDFLAGS $LD_H2"
2849 CPPFLAGS="$CPPFLAGS $CPP_H2"
2850 LIBS="$LIB_H2 $LIBS"
2851
2852 # use nghttp2_option_set_no_recv_client_magic to require nghttp2
2853 # >= 1.0.0
2854 AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
2855 [
2856 AC_CHECK_HEADERS(nghttp2/nghttp2.h,
2857 curl_h2_msg="enabled (nghttp2)"
2858 NGHTTP2_ENABLED=1
2859 AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
2860 AC_SUBST(USE_NGHTTP2, [1])
2861 )
2862 ],
2863 dnl not found, revert back to clean variables
2864 LDFLAGS=$CLEANLDFLAGS
2865 CPPFLAGS=$CLEANCPPFLAGS
2866 LIBS=$CLEANLIBS
2867 )
2868
2869 else
2870 dnl no nghttp2 pkg-config found, deal with it
2871 if test X"$want_h2" != Xdefault; then
2872 dnl To avoid link errors, we do not allow --with-nghttp2 without
2873 dnl a pkgconfig file
2874 AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
2875 fi
2876 fi
2877
2878fi
2879
2880dnl **********************************************************************
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002881dnl Back to "normal" configuring
2882dnl **********************************************************************
2883
2884dnl Checks for header files.
2885AC_HEADER_STDC
2886
2887CURL_CHECK_HEADER_MALLOC
2888CURL_CHECK_HEADER_MEMORY
2889
2890dnl Now check for the very most basic headers. Then we can use these
2891dnl ones as default-headers when checking for the rest!
2892AC_CHECK_HEADERS(
2893 sys/types.h \
2894 sys/time.h \
2895 sys/select.h \
2896 sys/socket.h \
2897 sys/ioctl.h \
2898 sys/uio.h \
2899 assert.h \
2900 unistd.h \
2901 stdlib.h \
2902 limits.h \
2903 arpa/inet.h \
2904 net/if.h \
2905 netinet/in.h \
2906 sys/un.h \
2907 netinet/tcp.h \
2908 netdb.h \
2909 sys/sockio.h \
2910 sys/stat.h \
2911 sys/param.h \
2912 termios.h \
2913 termio.h \
2914 sgtty.h \
2915 fcntl.h \
2916 alloca.h \
2917 time.h \
2918 io.h \
2919 pwd.h \
2920 utime.h \
2921 sys/utime.h \
2922 sys/poll.h \
2923 poll.h \
2924 socket.h \
2925 sys/resource.h \
2926 libgen.h \
2927 locale.h \
2928 errno.h \
2929 stdbool.h \
2930 arpa/tftp.h \
2931 sys/filio.h \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002932 sys/wait.h \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07002933 setjmp.h,
2934dnl to do if not found
2935[],
2936dnl to do if found
2937[],
2938dnl default includes
2939[
2940#ifdef HAVE_SYS_TYPES_H
2941#include <sys/types.h>
2942#endif
2943#ifdef HAVE_SYS_TIME_H
2944#include <sys/time.h>
2945#endif
2946#ifdef HAVE_SYS_SELECT_H
2947#include <sys/select.h>
2948#endif
2949#ifdef HAVE_SYS_SOCKET_H
2950#include <sys/socket.h>
2951#endif
2952#ifdef HAVE_NETINET_IN_H
2953#include <netinet/in.h>
2954#endif
2955#ifdef HAVE_SYS_UN_H
2956#include <sys/un.h>
2957#endif
2958]
2959)
2960
2961dnl Checks for typedefs, structures, and compiler characteristics.
2962AC_C_CONST
2963CURL_CHECK_VARIADIC_MACROS
2964AC_TYPE_SIZE_T
2965AC_HEADER_TIME
2966CURL_CHECK_STRUCT_TIMEVAL
2967CURL_VERIFY_RUNTIMELIBS
2968
2969AC_CHECK_SIZEOF(size_t)
2970AC_CHECK_SIZEOF(long)
2971AC_CHECK_SIZEOF(int)
2972AC_CHECK_SIZEOF(short)
2973CURL_CONFIGURE_LONG
2974AC_CHECK_SIZEOF(time_t)
2975AC_CHECK_SIZEOF(off_t)
2976
2977soname_bump=no
2978if test x"$ac_cv_native_windows" != "xyes" &&
2979 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2980 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2981 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2982 soname_bump=yes
2983fi
2984
2985
2986AC_CHECK_TYPE(long long,
2987 [AC_DEFINE(HAVE_LONGLONG, 1,
2988 [Define to 1 if the compiler supports the 'long long' data type.])]
2989 longlong="yes"
2990)
2991
2992if test "xyes" = "x$longlong"; then
2993 AC_MSG_CHECKING([if numberLL works])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07002994 AC_COMPILE_IFELSE([
2995 AC_LANG_PROGRAM([[
2996 ]],[[
2997 long long val = 1000LL;
2998 ]])
2999 ],[
3000 AC_MSG_RESULT([yes])
3001 AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
3002 ],[
3003 AC_MSG_RESULT([no])
3004 ])
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003005fi
3006
3007
3008# check for ssize_t
3009AC_CHECK_TYPE(ssize_t, ,
3010 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
3011
3012# check for bool type
3013AC_CHECK_TYPE([bool],[
3014 AC_DEFINE(HAVE_BOOL_T, 1,
3015 [Define to 1 if bool is an available type.])
3016], ,[
3017#ifdef HAVE_SYS_TYPES_H
3018#include <sys/types.h>
3019#endif
3020#ifdef HAVE_STDBOOL_H
3021#include <stdbool.h>
3022#endif
3023])
3024
3025CURL_CONFIGURE_CURL_SOCKLEN_T
3026
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003027CURL_CONFIGURE_PULL_SYS_POLL
3028
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003029TYPE_IN_ADDR_T
3030
3031TYPE_SOCKADDR_STORAGE
3032
3033TYPE_SIG_ATOMIC_T
3034
3035AC_TYPE_SIGNAL
3036
3037CURL_CHECK_FUNC_SELECT
3038
3039CURL_CHECK_FUNC_RECV
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003040CURL_CHECK_FUNC_SEND
3041CURL_CHECK_MSG_NOSIGNAL
3042
3043CURL_CHECK_FUNC_ALARM
3044CURL_CHECK_FUNC_BASENAME
3045CURL_CHECK_FUNC_CLOSESOCKET
3046CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
3047CURL_CHECK_FUNC_CONNECT
3048CURL_CHECK_FUNC_FCNTL
3049CURL_CHECK_FUNC_FDOPEN
3050CURL_CHECK_FUNC_FREEADDRINFO
3051CURL_CHECK_FUNC_FREEIFADDRS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003052CURL_CHECK_FUNC_FSETXATTR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003053CURL_CHECK_FUNC_FTRUNCATE
3054CURL_CHECK_FUNC_GETADDRINFO
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003055CURL_CHECK_FUNC_GAI_STRERROR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003056CURL_CHECK_FUNC_GETHOSTBYADDR
3057CURL_CHECK_FUNC_GETHOSTBYADDR_R
3058CURL_CHECK_FUNC_GETHOSTBYNAME
3059CURL_CHECK_FUNC_GETHOSTBYNAME_R
3060CURL_CHECK_FUNC_GETHOSTNAME
3061CURL_CHECK_FUNC_GETIFADDRS
3062CURL_CHECK_FUNC_GETSERVBYPORT_R
3063CURL_CHECK_FUNC_GMTIME_R
3064CURL_CHECK_FUNC_INET_NTOA_R
3065CURL_CHECK_FUNC_INET_NTOP
3066CURL_CHECK_FUNC_INET_PTON
3067CURL_CHECK_FUNC_IOCTL
3068CURL_CHECK_FUNC_IOCTLSOCKET
3069CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3070CURL_CHECK_FUNC_LOCALTIME_R
3071CURL_CHECK_FUNC_MEMRCHR
3072CURL_CHECK_FUNC_POLL
3073CURL_CHECK_FUNC_SETSOCKOPT
3074CURL_CHECK_FUNC_SIGACTION
3075CURL_CHECK_FUNC_SIGINTERRUPT
3076CURL_CHECK_FUNC_SIGNAL
3077CURL_CHECK_FUNC_SIGSETJMP
3078CURL_CHECK_FUNC_SOCKET
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003079CURL_CHECK_FUNC_SOCKETPAIR
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003080CURL_CHECK_FUNC_STRCASECMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003081CURL_CHECK_FUNC_STRCMPI
3082CURL_CHECK_FUNC_STRDUP
3083CURL_CHECK_FUNC_STRERROR_R
3084CURL_CHECK_FUNC_STRICMP
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003085CURL_CHECK_FUNC_STRNCASECMP
3086CURL_CHECK_FUNC_STRNCMPI
3087CURL_CHECK_FUNC_STRNICMP
3088CURL_CHECK_FUNC_STRSTR
3089CURL_CHECK_FUNC_STRTOK_R
3090CURL_CHECK_FUNC_STRTOLL
3091CURL_CHECK_FUNC_WRITEV
3092
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003093case $host in
3094 *msdosdjgpp)
3095 ac_cv_func_pipe=no
3096 skipcheck_pipe=yes
3097 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
3098 ;;
3099esac
3100
3101AC_CHECK_FUNCS([fork \
3102 geteuid \
3103 getpass_r \
3104 getppid \
3105 getprotobyname \
3106 getpwuid \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003107 getpwuid_r \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003108 getrlimit \
3109 gettimeofday \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003110 if_nametoindex \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003111 inet_addr \
3112 perror \
3113 pipe \
3114 setlocale \
3115 setmode \
3116 setrlimit \
3117 uname \
3118 utime
3119],[
3120],[
3121 func="$ac_func"
3122 eval skipcheck=\$skipcheck_$func
3123 if test "x$skipcheck" != "xyes"; then
3124 AC_MSG_CHECKING([deeper for $func])
3125 AC_LINK_IFELSE([
3126 AC_LANG_PROGRAM([[
3127 ]],[[
3128 $func ();
3129 ]])
3130 ],[
3131 AC_MSG_RESULT([yes])
3132 eval "ac_cv_func_$func=yes"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003133 AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003134 [Define to 1 if you have the $func function.])
3135 ],[
3136 AC_MSG_RESULT([but still no])
3137 ])
3138 fi
3139])
3140
3141dnl Check if the getnameinfo function is available
3142dnl and get the types of five of its arguments.
3143CURL_CHECK_FUNC_GETNAMEINFO
3144
3145if test "$ipv6" = "yes"; then
3146 if test "$ac_cv_func_getaddrinfo" = "yes"; then
3147 AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
3148 IPV6_ENABLED=1
3149 AC_SUBST(IPV6_ENABLED)
3150 fi
3151 CURL_CHECK_NI_WITHSCOPEID
3152fi
3153
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003154CURL_CHECK_NONBLOCKING_SOCKET
3155
3156dnl ************************************************************
3157dnl nroff tool stuff
3158dnl
3159
3160AC_PATH_PROG( PERL, perl, ,
3161 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
3162AC_SUBST(PERL)
3163
3164AC_PATH_PROGS( NROFF, gnroff nroff, ,
3165 $PATH:/usr/bin/:/usr/local/bin )
3166AC_SUBST(NROFF)
3167
3168if test -n "$NROFF"; then
3169 dnl only check for nroff options if an nroff command was found
3170
3171 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
3172 MANOPT="-man"
3173 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3174 if test -z "$mancheck"; then
3175 MANOPT="-mandoc"
3176 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
3177 if test -z "$mancheck"; then
3178 MANOPT=""
3179 AC_MSG_RESULT([failed])
3180 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
3181 else
3182 AC_MSG_RESULT([$MANOPT])
3183 fi
3184 else
3185 AC_MSG_RESULT([$MANOPT])
3186 fi
3187 AC_SUBST(MANOPT)
3188fi
3189
3190if test -z "$MANOPT"
3191then
3192 dnl if no nroff tool was found, or no option that could convert man pages
3193 dnl was found, then disable the built-in manual stuff
3194 AC_MSG_WARN([disabling built-in manual])
3195 USE_MANUAL="no";
3196fi
3197
3198dnl *************************************************************************
3199dnl If the manual variable still is set, then we go with providing a built-in
3200dnl manual
3201
3202if test "$USE_MANUAL" = "1"; then
3203 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
3204 curl_manual_msg="enabled"
3205fi
3206
3207dnl set variable for use in automakefile(s)
3208AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
3209
3210CURL_CHECK_LIB_ARES
3211AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
3212
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003213if test "x$ac_cv_native_windows" != "xyes" &&
3214 test "x$enable_shared" = "xyes"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003215 build_libhostname=yes
3216else
3217 build_libhostname=no
3218fi
3219AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
3220
3221CURL_CHECK_OPTION_THREADED_RESOLVER
3222
3223if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
3224 AC_MSG_ERROR(
3225[Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
3226fi
3227
3228if test "$want_thres" = "yes"; then
3229 AC_CHECK_HEADER(pthread.h,
3230 [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
3231 save_CFLAGS="$CFLAGS"
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003232
3233 dnl first check for function without lib
3234 AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
3235
3236 dnl if it wasn't found without lib, search for it in pthread lib
3237 if test "$USE_THREADS_POSIX" != "1"
3238 then
3239 CFLAGS="$CFLAGS -pthread"
3240 AC_CHECK_LIB(pthread, pthread_create,
3241 [USE_THREADS_POSIX=1],
3242 [ CFLAGS="$save_CFLAGS"])
3243 fi
3244
3245 if test "x$USE_THREADS_POSIX" = "x1"
3246 then
3247 AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
3248 curl_res_msg="POSIX threaded"
3249 fi
3250
3251
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003252 ])
3253fi
3254
3255dnl ************************************************************
3256dnl disable verbose text strings
3257dnl
3258AC_MSG_CHECKING([whether to enable verbose strings])
3259AC_ARG_ENABLE(verbose,
3260AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
3261AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
3262[ case "$enableval" in
3263 no)
3264 AC_MSG_RESULT(no)
3265 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
3266 curl_verbose_msg="no"
3267 ;;
3268 *) AC_MSG_RESULT(yes)
3269 ;;
3270 esac ],
3271 AC_MSG_RESULT(yes)
3272)
3273
3274dnl ************************************************************
3275dnl enable SSPI support
3276dnl
3277AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
3278AC_ARG_ENABLE(sspi,
3279AC_HELP_STRING([--enable-sspi],[Enable SSPI])
3280AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
3281[ case "$enableval" in
3282 yes)
3283 if test "$ac_cv_native_windows" = "yes"; then
3284 AC_MSG_RESULT(yes)
3285 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
3286 AC_SUBST(USE_WINDOWS_SSPI, [1])
3287 curl_sspi_msg="enabled"
3288 else
3289 AC_MSG_RESULT(no)
3290 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
3291 fi
3292 ;;
3293 *)
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 esac ],
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003302 if test "x$WINSSL_ENABLED" = "x1"; then
3303 # --with-winssl implies --enable-sspi
3304 AC_MSG_RESULT(yes)
3305 else
3306 AC_MSG_RESULT(no)
3307 fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003308)
3309
3310dnl ************************************************************
3311dnl disable cryptographic authentication
3312dnl
3313AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
3314AC_ARG_ENABLE(crypto-auth,
3315AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
3316AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
3317[ case "$enableval" in
3318 no)
3319 AC_MSG_RESULT(no)
3320 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003321 CURL_DISABLE_CRYPTO_AUTH=1
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003322 ;;
3323 *) AC_MSG_RESULT(yes)
3324 ;;
3325 esac ],
3326 AC_MSG_RESULT(yes)
3327)
3328
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003329CURL_CHECK_OPTION_NTLM_WB
3330
3331CURL_CHECK_NTLM_WB
3332
3333dnl ************************************************************
3334dnl disable TLS-SRP authentication
3335dnl
3336AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
3337AC_ARG_ENABLE(tls-srp,
3338AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
3339AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
3340[ case "$enableval" in
3341 no)
3342 AC_MSG_RESULT(no)
3343 AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
3344 want_tls_srp=no
3345 ;;
3346 *) AC_MSG_RESULT(yes)
3347 want_tls_srp=yes
3348 ;;
3349 esac ],
3350 AC_MSG_RESULT(yes)
3351 want_tls_srp=yes
3352)
3353
3354if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
3355 AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
3356 USE_TLS_SRP=1
3357 curl_tls_srp_msg="enabled"
3358fi
3359
3360dnl ************************************************************
3361dnl disable Unix domain sockets support
3362dnl
3363AC_MSG_CHECKING([whether to enable Unix domain sockets])
3364AC_ARG_ENABLE(unix-sockets,
3365AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
3366AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
3367[ case "$enableval" in
3368 no) AC_MSG_RESULT(no)
3369 want_unix_sockets=no
3370 ;;
3371 *) AC_MSG_RESULT(yes)
3372 want_unix_sockets=yes
3373 ;;
3374 esac ], [
3375 AC_MSG_RESULT(auto)
3376 want_unix_sockets=auto
3377 ]
3378)
3379if test "x$want_unix_sockets" != "xno"; then
3380 AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
3381 AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
3382 AC_SUBST(USE_UNIX_SOCKETS, [1])
3383 curl_unix_sockets_msg="enabled"
3384 ], [
3385 if test "x$want_unix_sockets" = "xyes"; then
3386 AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
3387 fi
3388 ], [
3389 #include <sys/un.h>
3390 ])
3391fi
3392
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003393dnl ************************************************************
3394dnl disable cookies support
3395dnl
3396AC_MSG_CHECKING([whether to enable support for cookies])
3397AC_ARG_ENABLE(cookies,
3398AC_HELP_STRING([--enable-cookies],[Enable cookies support])
3399AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
3400[ case "$enableval" in
3401 no)
3402 AC_MSG_RESULT(no)
3403 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
3404 ;;
3405 *) AC_MSG_RESULT(yes)
3406 ;;
3407 esac ],
3408 AC_MSG_RESULT(yes)
3409)
3410
3411dnl ************************************************************
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003412dnl hiding of library internal symbols
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003413dnl
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003414CURL_CONFIGURE_SYMBOL_HIDING
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003415
3416dnl ************************************************************
3417dnl enforce SONAME bump
3418dnl
3419
3420AC_MSG_CHECKING([whether to enforce SONAME bump])
3421AC_ARG_ENABLE(soname-bump,
3422AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
3423AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
3424[ case "$enableval" in
3425 yes) AC_MSG_RESULT(yes)
3426 soname_bump=yes
3427 ;;
3428 *)
3429 AC_MSG_RESULT(no)
3430 ;;
3431 esac ],
3432 AC_MSG_RESULT($soname_bump)
3433)
3434AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
3435
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003436dnl
3437dnl All the library dependencies put into $LIB apply to libcurl only.
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003438dnl
3439LIBCURL_LIBS=$LIBS
3440
3441AC_SUBST(LIBCURL_LIBS)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003442AC_SUBST(CURL_NETWORK_LIBS)
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003443AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
3444
3445dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
3446dnl LIBS variable used in generated makefile at makefile processing
3447dnl time. Doing this functionally prevents LIBS from being used for
3448dnl all link targets in given makefile.
3449BLANK_AT_MAKETIME=
3450AC_SUBST(BLANK_AT_MAKETIME)
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003451
3452AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
3453
3454dnl yes or no
3455ENABLE_SHARED="$enable_shared"
3456AC_SUBST(ENABLE_SHARED)
3457
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003458dnl to let curl-config output the static libraries correctly
3459ENABLE_STATIC="$enable_static"
3460AC_SUBST(ENABLE_STATIC)
3461
3462
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003463dnl
3464dnl For keeping supported features and protocols also in pkg-config file
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003465dnl since it is more cross-compile friendly than curl-config
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003466dnl
3467
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003468if test "x$OPENSSL_ENABLED" = "x1"; then
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003469 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3470elif test -n "$SSL_ENABLED"; then
3471 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
3472fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003473if test "x$IPV6_ENABLED" = "x1"; then
3474 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
3475fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003476if test "x$USE_UNIX_SOCKETS" = "x1"; then
3477 SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
3478fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003479if test "x$HAVE_LIBZ" = "x1"; then
3480 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
3481fi
3482if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
3483 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
3484fi
3485if test "x$IDN_ENABLED" = "x1"; then
3486 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
3487fi
3488if test "x$USE_WINDOWS_SSPI" = "x1"; then
3489 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
3490fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003491
3492if test "x$HAVE_GSSAPI" = "x1"; then
3493 SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
3494fi
3495
3496if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3497 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3498 SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
3499fi
3500
3501if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
3502 \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
3503 SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
3504fi
3505
3506if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
3507 if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3508 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3509 -o "x$DARWINSSL_ENABLED" = "x1"; then
3510 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
3511
3512 if test "x$CURL_DISABLE_HTTP" != "x1" -a \
3513 "x$NTLM_WB_ENABLED" = "x1"; then
3514 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
3515 fi
3516 fi
3517fi
3518
3519if test "x$USE_TLS_SRP" = "x1"; then
3520 SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
3521fi
3522
3523if test "x$USE_NGHTTP2" = "x1"; then
3524 SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003525fi
3526
3527AC_SUBST(SUPPORT_FEATURES)
3528
3529dnl For supported protocols in pkg-config file
3530if test "x$CURL_DISABLE_HTTP" != "x1"; then
3531 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
3532 if test "x$SSL_ENABLED" = "x1"; then
3533 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
3534 fi
3535fi
3536if test "x$CURL_DISABLE_FTP" != "x1"; then
3537 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
3538 if test "x$SSL_ENABLED" = "x1"; then
3539 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
3540 fi
3541fi
3542if test "x$CURL_DISABLE_FILE" != "x1"; then
3543 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
3544fi
3545if test "x$CURL_DISABLE_TELNET" != "x1"; then
3546 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
3547fi
3548if test "x$CURL_DISABLE_LDAP" != "x1"; then
3549 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
3550 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
3551 if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
3552 (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
3553 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
3554 fi
3555 fi
3556fi
3557if test "x$CURL_DISABLE_DICT" != "x1"; then
3558 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
3559fi
3560if test "x$CURL_DISABLE_TFTP" != "x1"; then
3561 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
3562fi
3563if test "x$CURL_DISABLE_GOPHER" != "x1"; then
3564 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
3565fi
3566if test "x$CURL_DISABLE_POP3" != "x1"; then
3567 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
3568 if test "x$SSL_ENABLED" = "x1"; then
3569 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
3570 fi
3571fi
3572if test "x$CURL_DISABLE_IMAP" != "x1"; then
3573 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
3574 if test "x$SSL_ENABLED" = "x1"; then
3575 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3576 fi
3577fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003578if test "x$CURL_DISABLE_SMB" != "x1" \
3579 -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
3580 -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
3581 -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
3582 -o "x$DARWINSSL_ENABLED" = "x1" \); then
3583 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
3584 if test "x$SSL_ENABLED" = "x1"; then
3585 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
3586 fi
3587fi
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003588if test "x$CURL_DISABLE_SMTP" != "x1"; then
3589 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3590 if test "x$SSL_ENABLED" = "x1"; then
3591 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3592 fi
3593fi
3594if test "x$USE_LIBSSH2" = "x1"; then
3595 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3596 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3597fi
3598if test "x$CURL_DISABLE_RTSP" != "x1"; then
3599 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3600fi
3601if test "x$USE_LIBRTMP" = "x1"; then
3602 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3603fi
3604
3605dnl replace spaces with newlines
3606dnl sort the lines
3607dnl replace the newlines back to spaces
3608SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3609
3610AC_SUBST(SUPPORT_PROTOCOLS)
3611
3612dnl squeeze whitespace out of some variables
3613
3614squeeze CFLAGS
3615squeeze CPPFLAGS
3616squeeze DEFS
3617squeeze LDFLAGS
3618squeeze LIBS
3619
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003620squeeze LIBCURL_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003621squeeze CURL_NETWORK_LIBS
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003622squeeze CURL_NETWORK_AND_TIME_LIBS
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003623
3624squeeze SUPPORT_FEATURES
3625squeeze SUPPORT_PROTOCOLS
3626
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003627XC_CHECK_BUILD_FLAGS
3628
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003629if test "x$want_curldebug_assumed" = "xyes" &&
3630 test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3631 ac_configure_args="$ac_configure_args --enable-curldebug"
3632fi
3633
3634AC_CONFIG_FILES([Makefile \
3635 docs/Makefile \
3636 docs/examples/Makefile \
3637 docs/libcurl/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003638 docs/libcurl/opts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003639 include/Makefile \
3640 include/curl/Makefile \
3641 src/Makefile \
3642 lib/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003643 lib/libcurl.vers \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003644 tests/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003645 tests/certs/Makefile \
3646 tests/certs/scripts/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003647 tests/data/Makefile \
3648 tests/server/Makefile \
3649 tests/libtest/Makefile \
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003650 tests/unit/Makefile \
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003651 packages/Makefile \
3652 packages/Win32/Makefile \
3653 packages/Win32/cygwin/Makefile \
3654 packages/Linux/Makefile \
3655 packages/Linux/RPM/Makefile \
3656 packages/Linux/RPM/curl.spec \
3657 packages/Linux/RPM/curl-ssl.spec \
3658 packages/Solaris/Makefile \
3659 packages/EPM/curl.list \
3660 packages/EPM/Makefile \
3661 packages/vms/Makefile \
3662 packages/AIX/Makefile \
3663 packages/AIX/RPM/Makefile \
3664 packages/AIX/RPM/curl.spec \
3665 curl-config \
3666 libcurl.pc
3667])
3668AC_OUTPUT
3669
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003670CURL_GENERATE_CONFIGUREHELP_PM
3671
3672XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
3673
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003674AC_MSG_NOTICE([Configured to build curl/libcurl:
3675
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07003676 curl version: ${CURLVERSION}
3677 Host setup: ${host}
3678 Install prefix: ${prefix}
3679 Compiler: ${CC}
3680 SSL support: ${curl_ssl_msg}
3681 SSH support: ${curl_ssh_msg}
3682 zlib support: ${curl_zlib_msg}
3683 GSS-API support: ${curl_gss_msg}
3684 TLS-SRP support: ${curl_tls_srp_msg}
3685 resolver: ${curl_res_msg}
3686 IPv6 support: ${curl_ipv6_msg}
3687 Unix sockets support: ${curl_unix_sockets_msg}
3688 IDN support: ${curl_idn_msg}
3689 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
3690 Built-in manual: ${curl_manual_msg}
3691 --libcurl option: ${curl_libcurl_msg}
3692 Verbose errors: ${curl_verbose_msg}
3693 SSPI support: ${curl_sspi_msg}
3694 ca cert bundle: ${ca}
3695 ca cert path: ${capath}
3696 LDAP support: ${curl_ldap_msg}
3697 LDAPS support: ${curl_ldaps_msg}
3698 RTSP support: ${curl_rtsp_msg}
3699 RTMP support: ${curl_rtmp_msg}
3700 metalink support: ${curl_mtlnk_msg}
3701 HTTP2 support: ${curl_h2_msg}
3702 Protocols: ${SUPPORT_PROTOCOLS}
Lucas Eckels9bd90e62012-08-06 15:07:02 -07003703])
3704
3705if test "x$soname_bump" = "xyes"; then
3706
3707cat <<EOM
3708 SONAME bump: yes - WARNING: this library will be built with the SONAME
3709 number bumped due to (a detected) ABI breakage.
3710 See lib/README.curl_off_t for details on this.
3711EOM
3712
3713fi
3714