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