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