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