628666ba86819c7d76ad8c946ef6131fb8fbc2a4
[platform/upstream/curl.git] / configure.ac
1 #***************************************************************************
2 #                                  _   _ ____  _
3 #  Project                     ___| | | |  _ \| |
4 #                             / __| | | | |_) | |
5 #                            | (__| |_| |  _ <| |___
6 #                             \___|\___/|_| \_\_____|
7 #
8 # Copyright (C) 1998 - 2011, 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 http://curl.haxx.se/docs/copyright.html.
13 #
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
17 #
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
20 #
21 #***************************************************************************
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: http://curl.haxx.se/mail/])
28
29 CURL_OVERRIDE_AUTOCONF
30
31 dnl configure script copyright
32 AC_COPYRIGHT([Copyright (c) 1998 - 2011 Daniel Stenberg, <daniel@haxx.se>
33 This configure script may be copied, distributed and modified under the
34 terms of the curl license; see COPYING for more details])
35
36 AC_CONFIG_SRCDIR([lib/urldata.h])
37 AM_CONFIG_HEADER(lib/curl_config.h src/curl_config.h include/curl/curlbuild.h)
38 AC_CONFIG_MACRO_DIR([m4])
39 AM_MAINTAINER_MODE
40
41 CURL_CHECK_OPTION_DEBUG
42 CURL_CHECK_OPTION_OPTIMIZE
43 CURL_CHECK_OPTION_WARNINGS
44 CURL_CHECK_OPTION_WERROR
45 CURL_CHECK_OPTION_CURLDEBUG
46 CURL_CHECK_OPTION_ARES
47
48 CURL_CHECK_PATH_SEPARATOR_REQUIRED
49
50 #
51 # save the configure arguments
52 #
53 CONFIGURE_OPTIONS="\"$ac_configure_args\""
54 AC_SUBST(CONFIGURE_OPTIONS)
55
56 CURL_CFLAG_EXTRAS=""
57 if test X"$want_werror" = Xyes; then
58   CURL_CFLAG_EXTRAS="-Werror"
59 fi
60 AC_SUBST(CURL_CFLAG_EXTRAS)
61
62 dnl SED is mandatory for configure process and libtool.
63 dnl Set it now, allowing it to be changed later.
64 if test -z "$SED"; then
65   dnl allow it to be overridden
66   AC_PATH_PROG([SED], [sed], [not_found],
67     [$PATH:/usr/bin:/usr/local/bin])
68   if test -z "$SED" || test "$SED" = "not_found"; then
69     AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
70   fi
71 fi
72 AC_SUBST([SED])
73
74 dnl GREP is mandatory for configure process and libtool.
75 dnl Set it now, allowing it to be changed later.
76 if test -z "$GREP"; then
77   dnl allow it to be overridden
78   AC_PATH_PROG([GREP], [grep], [not_found],
79     [$PATH:/usr/bin:/usr/local/bin])
80   if test -z "$GREP" || test "$GREP" = "not_found"; then
81     AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
82   fi
83 fi
84 AC_SUBST([GREP])
85
86 dnl EGREP is mandatory for configure process and libtool.
87 dnl Set it now, allowing it to be changed later.
88 if test -z "$EGREP"; then
89   dnl allow it to be overridden
90   if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
91     AC_MSG_CHECKING([for egrep])
92     EGREP="$GREP -E"
93     AC_MSG_RESULT([$EGREP])
94   else
95     AC_PATH_PROG([EGREP], [egrep], [not_found],
96       [$PATH:/usr/bin:/usr/local/bin])
97   fi
98 fi
99 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
100   AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
101 fi
102 AC_SUBST([EGREP])
103
104 dnl AR is mandatory for configure process and libtool.
105 dnl This is target dependent, so check it as a tool.
106 if test -z "$AR"; then
107   dnl allow it to be overridden
108   AC_PATH_TOOL([AR], [ar], [not_found],
109     [$PATH:/usr/bin:/usr/local/bin])
110   if test -z "$AR" || test "$AR" = "not_found"; then
111     AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
112   fi
113 fi
114 AC_SUBST([AR])
115
116 AC_SUBST(libext)
117
118 dnl Remove non-configure distributed curlbuild.h
119 if test -f ${srcdir}/include/curl/curlbuild.h; then
120   rm -f ${srcdir}/include/curl/curlbuild.h
121 fi
122
123 dnl figure out the libcurl version
124 CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
125 AM_INIT_AUTOMAKE
126 AC_MSG_CHECKING([curl version])
127 AC_MSG_RESULT($CURLVERSION)
128
129 dnl
130 dnl we extract the numerical version for curl-config only
131 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
132 AC_SUBST(VERSIONNUM)
133
134 dnl Solaris pkgadd support definitions
135 PKGADD_PKG="HAXXcurl"
136 PKGADD_NAME="cURL - a client that groks URLs"
137 PKGADD_VENDOR="curl.haxx.se"
138 AC_SUBST(PKGADD_PKG)
139 AC_SUBST(PKGADD_NAME)
140 AC_SUBST(PKGADD_VENDOR)
141
142 dnl
143 dnl initialize all the info variables
144     curl_ssl_msg="no      (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls} )"
145     curl_ssh_msg="no      (--with-libssh2)"
146    curl_zlib_msg="no      (--with-zlib)"
147    curl_krb4_msg="no      (--with-krb4*)"
148     curl_gss_msg="no      (--with-gssapi)"
149  curl_spnego_msg="no      (--with-spnego)"
150 curl_tls_srp_msg="no      (--enable-tls-srp)"
151     curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
152    curl_ipv6_msg="no      (--enable-ipv6)"
153     curl_idn_msg="no      (--with-libidn)"
154  curl_manual_msg="no      (--enable-manual)"
155 curl_verbose_msg="enabled (--disable-verbose)"
156    curl_sspi_msg="no      (--enable-sspi)"
157    curl_ldap_msg="no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
158   curl_ldaps_msg="no      (--enable-ldaps)"
159    curl_rtsp_msg="no      (--enable-rtsp)"
160    curl_rtmp_msg="no      (--with-librtmp)"
161     init_ssl_msg=${curl_ssl_msg}
162
163 dnl
164 dnl Save anything in $LIBS for later
165 dnl
166 ALL_LIBS=$LIBS
167
168 dnl
169 dnl Detect the canonical host and target build environment
170 dnl
171
172 AC_CANONICAL_HOST
173 dnl Get system canonical name
174 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
175
176 dnl Checks for programs.
177 CURL_CHECK_PROG_CC
178
179 dnl Our curl_off_t internal and external configure settings
180 CURL_CONFIGURE_CURL_OFF_T
181
182 dnl This defines _ALL_SOURCE for AIX
183 CURL_CHECK_AIX_ALL_SOURCE
184
185 dnl Our configure and build reentrant settings
186 CURL_CONFIGURE_THREAD_SAFE
187 CURL_CONFIGURE_REENTRANT
188
189 dnl check for how to do large files
190 AC_SYS_LARGEFILE
191
192 dnl support building of Windows DLLs
193 AC_LIBTOOL_WIN32_DLL
194
195 dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
196 AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
197 case $host in
198   x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
199     AC_MSG_RESULT([yes])
200     with_pic=yes
201     ;;
202   *)
203     AC_MSG_RESULT([no])
204     ;;
205 esac
206
207 AC_MSG_CHECKING([if compiler is icc (to build with PIC)])
208 case $CC in
209   icc | */icc)
210     AC_MSG_RESULT([yes])
211     with_pic=yes
212     ;;
213   *)
214     AC_MSG_RESULT([no])
215     ;;
216 esac
217
218 dnl libtool setup
219 AC_PROG_LIBTOOL
220
221 AC_MSG_CHECKING([if we need -mimpure-text])
222 mimpure=no
223 case $host in
224   *-*-solaris2*)
225     if test "$GCC" = "yes"; then
226       mimpure="yes"
227     fi
228     ;;
229   *)
230     ;;
231 esac
232 AC_MSG_RESULT($mimpure)
233 AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
234
235 dnl 'STATICLIB' is, in spite of its name, not generic but only for static-only
236 dnl builds on Windows
237 AM_CONDITIONAL(STATICLIB, false)
238
239 AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
240 case $host in
241   *-*-mingw*)
242     AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
243     AC_MSG_RESULT(yes)
244     AC_MSG_CHECKING([if we need CURL_STATICLIB])
245     if test "X$enable_shared" = "Xno"
246     then
247       AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
248       AC_MSG_RESULT(yes)
249       AM_CONDITIONAL(STATICLIB, true)
250     else
251       AC_MSG_RESULT(no)
252     fi
253     ;;
254   *)
255     AC_MSG_RESULT(no)
256     ;;
257 esac
258
259 # Determine whether all dependent libraries must be specified when linking
260 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
261 then
262     REQUIRE_LIB_DEPS=no
263 else
264     REQUIRE_LIB_DEPS=yes
265 fi
266 AC_SUBST(REQUIRE_LIB_DEPS)
267
268 dnl The install stuff has already been taken care of by the automake stuff
269 dnl AC_PROG_INSTALL
270 AC_PROG_MAKE_SET
271
272 dnl check if there's a way to force code inline
273 AC_C_INLINE
274
275 dnl **********************************************************************
276 dnl platform/compiler/architecture specific checks/flags
277 dnl **********************************************************************
278
279 CURL_CHECK_COMPILER
280 CURL_SET_COMPILER_BASIC_OPTS
281 CURL_SET_COMPILER_DEBUG_OPTS
282 CURL_SET_COMPILER_OPTIMIZE_OPTS
283 CURL_SET_COMPILER_WARNING_OPTS
284
285 if test "$compiler_id" = "INTEL_UNIX_C"; then
286   #
287   if test "$compiler_num" -ge "1000"; then
288     dnl icc 10.X or later
289     CFLAGS="$CFLAGS -shared-intel"
290   elif test "$compiler_num" -ge "900"; then
291     dnl icc 9.X specific
292     CFLAGS="$CFLAGS -i-dynamic"
293   fi
294   #
295 fi
296
297 CURL_CHECK_COMPILER_HALT_ON_ERROR
298 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
299
300 CURL_CHECK_NO_UNDEFINED
301 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
302
303 CURL_CHECK_CURLDEBUG
304 AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
305
306 dnl **********************************************************************
307 dnl Compilation based checks should not be done before this point.
308 dnl **********************************************************************
309
310 dnl **********************************************************************
311 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
312 dnl and ws2tcpip.h take precedence over any other further checks which
313 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
314 dnl this specific header files. And do them before its results are used.
315 dnl **********************************************************************
316
317 CURL_CHECK_HEADER_WINDOWS
318 CURL_CHECK_NATIVE_WINDOWS
319 case X-"$ac_cv_native_windows" in
320   X-yes)
321     CURL_CHECK_HEADER_WINSOCK
322     CURL_CHECK_HEADER_WINSOCK2
323     CURL_CHECK_HEADER_WS2TCPIP
324     CURL_CHECK_HEADER_WINLDAP
325     CURL_CHECK_HEADER_WINBER
326     ;;
327   *)
328     ac_cv_header_winsock_h="no"
329     ac_cv_header_winsock2_h="no"
330     ac_cv_header_ws2tcpip_h="no"
331     ac_cv_header_winldap_h="no"
332     ac_cv_header_winber_h="no"
333     ;;
334 esac
335 CURL_CHECK_WIN32_LARGEFILE
336
337 dnl ************************************************************
338 dnl switch off particular protocols
339 dnl
340 AC_MSG_CHECKING([whether to support http])
341 AC_ARG_ENABLE(http,
342 AC_HELP_STRING([--enable-http],[Enable HTTP support])
343 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
344 [ case "$enableval" in
345   no)
346        AC_MSG_RESULT(no)
347        AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
348        AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
349        AC_SUBST(CURL_DISABLE_HTTP, [1])
350        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
351        AC_SUBST(CURL_DISABLE_RTSP, [1])
352        ;;
353   *)   AC_MSG_RESULT(yes)
354        ;;
355   esac ],
356        AC_MSG_RESULT(yes)
357 )
358 AC_MSG_CHECKING([whether to support ftp])
359 AC_ARG_ENABLE(ftp,
360 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
361 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
362 [ case "$enableval" in
363   no)
364        AC_MSG_RESULT(no)
365        AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
366        AC_SUBST(CURL_DISABLE_FTP, [1])
367        ;;
368   *)   AC_MSG_RESULT(yes)
369        ;;
370   esac ],
371        AC_MSG_RESULT(yes)
372 )
373 AC_MSG_CHECKING([whether to support file])
374 AC_ARG_ENABLE(file,
375 AC_HELP_STRING([--enable-file],[Enable FILE support])
376 AC_HELP_STRING([--disable-file],[Disable FILE support]),
377 [ case "$enableval" in
378   no)
379        AC_MSG_RESULT(no)
380        AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
381        AC_SUBST(CURL_DISABLE_FILE, [1])
382        ;;
383   *)   AC_MSG_RESULT(yes)
384        ;;
385   esac ],
386        AC_MSG_RESULT(yes)
387 )
388 AC_MSG_CHECKING([whether to support ldap])
389 AC_ARG_ENABLE(ldap,
390 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
391 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
392 [ case "$enableval" in
393   no)
394        AC_MSG_RESULT(no)
395        AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
396        AC_SUBST(CURL_DISABLE_LDAP, [1])
397        ;;
398   *)
399        AC_MSG_RESULT(yes)
400        ;;
401   esac ],[
402        AC_MSG_RESULT(yes) ]
403 )
404 AC_MSG_CHECKING([whether to support ldaps])
405 AC_ARG_ENABLE(ldaps,
406 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
407 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
408 [ case "$enableval" in
409   no)
410        AC_MSG_RESULT(no)
411        AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
412        AC_SUBST(CURL_DISABLE_LDAPS, [1])
413        ;;
414   *)   if test "x$CURL_DISABLE_LDAP" = "x1" ; then
415          AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
416          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
417          AC_SUBST(CURL_DISABLE_LDAPS, [1])
418        else
419          AC_MSG_RESULT(yes)
420          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
421          AC_SUBST(HAVE_LDAP_SSL, [1])
422        fi
423        ;;
424   esac ],[
425        if test "x$CURL_DISABLE_LDAP" = "x1" ; then
426          AC_MSG_RESULT(no)
427          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
428          AC_SUBST(CURL_DISABLE_LDAPS, [1])
429        else
430          AC_MSG_RESULT(yes)
431          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
432          AC_SUBST(HAVE_LDAP_SSL, [1])
433        fi ]
434 )
435
436 AC_MSG_CHECKING([whether to support rtsp])
437 AC_ARG_ENABLE(rtsp,
438 AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
439 AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
440 [ case "$enableval" in
441   no)
442        AC_MSG_RESULT(no)
443        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
444        AC_SUBST(CURL_DISABLE_RTSP, [1])
445        ;;
446   *)   if test x$CURL_DISABLE_HTTP = x1 ; then
447           AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
448        else
449           AC_MSG_RESULT(yes)
450           curl_rtsp_msg="enabled"
451        fi
452        ;;
453   esac ],
454        if test "x$CURL_DISABLE_HTTP" != "x1"; then
455           AC_MSG_RESULT(yes)
456           curl_rtsp_msg="enabled"
457        else
458           AC_MSG_RESULT(no)
459        fi
460 )
461
462 AC_MSG_CHECKING([whether to support proxies])
463 AC_ARG_ENABLE(proxy,
464 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
465 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
466 [ case "$enableval" in
467   no)
468        AC_MSG_RESULT(no)
469        AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
470        AC_SUBST(CURL_DISABLE_PROXY, [1])
471        ;;
472   *)   AC_MSG_RESULT(yes)
473        ;;
474   esac ],
475        AC_MSG_RESULT(yes)
476 )
477
478 AC_MSG_CHECKING([whether to support dict])
479 AC_ARG_ENABLE(dict,
480 AC_HELP_STRING([--enable-dict],[Enable DICT support])
481 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
482 [ case "$enableval" in
483   no)
484        AC_MSG_RESULT(no)
485        AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
486        AC_SUBST(CURL_DISABLE_DICT, [1])
487        ;;
488   *)   AC_MSG_RESULT(yes)
489        ;;
490   esac ],
491        AC_MSG_RESULT(yes)
492 )
493 AC_MSG_CHECKING([whether to support telnet])
494 AC_ARG_ENABLE(telnet,
495 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
496 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
497 [ case "$enableval" in
498   no)
499        AC_MSG_RESULT(no)
500        AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
501        AC_SUBST(CURL_DISABLE_TELNET, [1])
502        ;;
503   *)   AC_MSG_RESULT(yes)
504        ;;
505   esac ],
506        AC_MSG_RESULT(yes)
507 )
508 AC_MSG_CHECKING([whether to support tftp])
509 AC_ARG_ENABLE(tftp,
510 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
511 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
512 [ case "$enableval" in
513   no)
514        AC_MSG_RESULT(no)
515        AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
516        AC_SUBST(CURL_DISABLE_TFTP, [1])
517        ;;
518   *)   AC_MSG_RESULT(yes)
519        ;;
520   esac ],
521        AC_MSG_RESULT(yes)
522 )
523
524 AC_MSG_CHECKING([whether to support pop3])
525 AC_ARG_ENABLE(pop3,
526 AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
527 AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
528 [ case "$enableval" in
529   no)
530        AC_MSG_RESULT(no)
531        AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
532        AC_SUBST(CURL_DISABLE_POP3, [1])
533        ;;
534   *)   AC_MSG_RESULT(yes)
535        ;;
536   esac ],
537        AC_MSG_RESULT(yes)
538 )
539
540
541 AC_MSG_CHECKING([whether to support imap])
542 AC_ARG_ENABLE(imap,
543 AC_HELP_STRING([--enable-imap],[Enable IMAP support])
544 AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
545 [ case "$enableval" in
546   no)
547        AC_MSG_RESULT(no)
548        AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
549        AC_SUBST(CURL_DISABLE_IMAP, [1])
550        ;;
551   *)   AC_MSG_RESULT(yes)
552        ;;
553   esac ],
554        AC_MSG_RESULT(yes)
555 )
556
557
558 AC_MSG_CHECKING([whether to support smtp])
559 AC_ARG_ENABLE(smtp,
560 AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
561 AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
562 [ case "$enableval" in
563   no)
564        AC_MSG_RESULT(no)
565        AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
566        AC_SUBST(CURL_DISABLE_SMTP, [1])
567        ;;
568   *)   AC_MSG_RESULT(yes)
569        ;;
570   esac ],
571        AC_MSG_RESULT(yes)
572 )
573
574 AC_MSG_CHECKING([whether to support gopher])
575 AC_ARG_ENABLE(gopher,
576 AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
577 AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
578 [ case "$enableval" in
579   no)
580        AC_MSG_RESULT(no)
581        AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
582        AC_SUBST(CURL_DISABLE_GOPHER, [1])
583        ;;
584   *)   AC_MSG_RESULT(yes)
585        ;;
586   esac ],
587        AC_MSG_RESULT(yes)
588 )
589
590
591 dnl **********************************************************************
592 dnl Check for built-in manual
593 dnl **********************************************************************
594
595 AC_MSG_CHECKING([whether to provide built-in manual])
596 AC_ARG_ENABLE(manual,
597 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
598 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
599 [ case "$enableval" in
600   no)
601        AC_MSG_RESULT(no)
602        ;;
603   *)   AC_MSG_RESULT(yes)
604        USE_MANUAL="1"
605        ;;
606   esac ],
607        AC_MSG_RESULT(yes)
608        USE_MANUAL="1"
609 )
610 dnl The actual use of the USE_MANUAL variable is done much later in this
611 dnl script to allow other actions to disable it as well.
612
613 dnl **********************************************************************
614 dnl Checks for libraries.
615 dnl **********************************************************************
616
617 CURL_CHECK_LIB_XNET
618
619 dnl gethostbyname without lib or in the nsl lib?
620 AC_CHECK_FUNC(gethostbyname,
621               [HAVE_GETHOSTBYNAME="1"
622               ],
623               [ AC_CHECK_LIB(nsl, gethostbyname,
624                              [HAVE_GETHOSTBYNAME="1"
625                              LIBS="$LIBS -lnsl"
626                              ])
627               ])
628
629 if test "$HAVE_GETHOSTBYNAME" != "1"
630 then
631   dnl gethostbyname in the socket lib?
632   AC_CHECK_LIB(socket, gethostbyname,
633                [HAVE_GETHOSTBYNAME="1"
634                LIBS="$LIBS -lsocket"
635                ])
636 fi
637
638 dnl At least one system has been identified to require BOTH nsl and socket
639 dnl libs at the same time to link properly.
640 if test "$HAVE_GETHOSTBYNAME" != "1"
641 then
642   AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
643   my_ac_save_LIBS=$LIBS
644   LIBS="-lnsl -lsocket $LIBS"
645   AC_LINK_IFELSE([
646     AC_LANG_PROGRAM([[
647     ]],[[
648       gethostbyname();
649     ]])
650   ],[
651     AC_MSG_RESULT([yes])
652     HAVE_GETHOSTBYNAME="1"
653   ],[
654     AC_MSG_RESULT([no])
655     LIBS=$my_ac_save_LIBS
656   ])
657 fi
658
659 if test "$HAVE_GETHOSTBYNAME" != "1"
660 then
661   dnl This is for winsock systems
662   if test "$ac_cv_header_windows_h" = "yes"; then
663     if test "$ac_cv_header_winsock_h" = "yes"; then
664       case $host in
665         *-*-mingw32ce*)
666           winsock_LIB="-lwinsock"
667           ;;
668         *)
669           winsock_LIB="-lwsock32"
670           ;;
671       esac
672     fi
673     if test "$ac_cv_header_winsock2_h" = "yes"; then
674       winsock_LIB="-lws2_32"
675     fi
676     if test ! -z "$winsock_LIB"; then
677       my_ac_save_LIBS=$LIBS
678       LIBS="$winsock_LIB $LIBS"
679       AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
680       AC_LINK_IFELSE([
681         AC_LANG_PROGRAM([[
682 #ifdef HAVE_WINDOWS_H
683 #ifndef WIN32_LEAN_AND_MEAN
684 #define WIN32_LEAN_AND_MEAN
685 #endif
686 #include <windows.h>
687 #ifdef HAVE_WINSOCK2_H
688 #include <winsock2.h>
689 #else
690 #ifdef HAVE_WINSOCK_H
691 #include <winsock.h>
692 #endif
693 #endif
694 #endif
695         ]],[[
696           gethostbyname("www.dummysite.com");
697         ]])
698       ],[
699         AC_MSG_RESULT([yes])
700         HAVE_GETHOSTBYNAME="1"
701       ],[
702         AC_MSG_RESULT([no])
703         winsock_LIB=""
704         LIBS=$my_ac_save_LIBS
705       ])
706     fi
707   fi
708 fi
709
710 if test "$HAVE_GETHOSTBYNAME" != "1"
711 then
712   dnl This is for Minix 3.1
713   AC_MSG_CHECKING([for gethostbyname for Minix 3])
714   AC_LINK_IFELSE([
715     AC_LANG_PROGRAM([[
716 /* Older Minix versions may need <net/gen/netdb.h> here instead */
717 #include <netdb.h>
718     ]],[[
719       gethostbyname("www.dummysite.com");
720     ]])
721   ],[
722     AC_MSG_RESULT([yes])
723     HAVE_GETHOSTBYNAME="1"
724   ],[
725     AC_MSG_RESULT([no])
726   ])
727 fi
728
729 if test "$HAVE_GETHOSTBYNAME" != "1"
730 then
731   dnl This is for eCos with a stubbed DNS implementation
732   AC_MSG_CHECKING([for gethostbyname for eCos])
733   AC_LINK_IFELSE([
734     AC_LANG_PROGRAM([[
735 #include <stdio.h>
736 #include <netdb.h>
737     ]],[[
738       gethostbyname("www.dummysite.com");
739     ]])
740   ],[
741     AC_MSG_RESULT([yes])
742     HAVE_GETHOSTBYNAME="1"
743   ],[
744     AC_MSG_RESULT([no])
745   ])
746 fi
747
748 if test "$HAVE_GETHOSTBYNAME" != "1"
749 then
750   dnl gethostbyname in the network lib - for Haiku OS
751   AC_CHECK_LIB(network, gethostbyname,
752                [HAVE_GETHOSTBYNAME="1"
753                LIBS="$LIBS -lnetwork"
754                ])
755 fi
756
757 if test "$HAVE_GETHOSTBYNAME" != "1"
758 then
759   dnl gethostbyname in the net lib - for BeOS
760   AC_CHECK_LIB(net, gethostbyname,
761                [HAVE_GETHOSTBYNAME="1"
762                LIBS="$LIBS -lnet"
763                ])
764 fi
765
766
767 if test "$HAVE_GETHOSTBYNAME" != "1"; then
768   AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
769 fi
770
771 dnl resolve lib?
772 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
773
774 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
775   AC_CHECK_LIB(resolve, strcasecmp,
776               [LIBS="-lresolve $LIBS"],
777                ,
778                -lnsl)
779 fi
780 ac_cv_func_strcasecmp="no"
781
782 CURL_CHECK_LIBS_CONNECT
783
784 CURL_NETWORK_LIBS=$LIBS
785
786 dnl **********************************************************************
787 dnl In case that function clock_gettime with monotonic timer is available,
788 dnl check for additional required libraries.
789 dnl **********************************************************************
790 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
791
792 dnl **********************************************************************
793 dnl The preceding library checks are all potentially useful for test
794 dnl servers (for providing networking support).  Save the list of required
795 dnl libraries at this point for use while linking those test servers.
796 dnl **********************************************************************
797 TEST_SERVER_LIBS=$LIBS
798
799 dnl **********************************************************************
800 AC_MSG_CHECKING([whether to use libgcc])
801 AC_ARG_ENABLE(libgcc,
802 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
803 [ case "$enableval" in
804   yes)
805         ALL_LIBS="$ALL_LIBS -lgcc"
806        AC_MSG_RESULT(yes)
807        ;;
808   *)   AC_MSG_RESULT(no)
809        ;;
810   esac ],
811        AC_MSG_RESULT(no)
812 )
813
814 dnl **********************************************************************
815 dnl Check for LDAP
816 dnl **********************************************************************
817
818 LDAPLIBNAME=""
819 AC_ARG_WITH(ldap-lib,
820 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
821  [LDAPLIBNAME="$withval"])
822
823 LBERLIBNAME=""
824 AC_ARG_WITH(lber-lib,
825 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
826  [LBERLIBNAME="$withval"])
827
828 if test x$CURL_DISABLE_LDAP != x1 ; then
829
830   CURL_CHECK_HEADER_LBER
831   CURL_CHECK_HEADER_LDAP
832   CURL_CHECK_HEADER_LDAPSSL
833   CURL_CHECK_HEADER_LDAP_SSL
834
835   if test -z "$LDAPLIBNAME" ; then
836     if test "$ac_cv_native_windows" = "yes"; then
837       dnl Windows uses a single and unique LDAP library name
838       LDAPLIBNAME="wldap32"
839       LBERLIBNAME="no"
840     fi
841   fi
842
843   if test "$LDAPLIBNAME" ; then
844     AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
845       AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
846       AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
847       AC_SUBST(CURL_DISABLE_LDAP, [1])])
848       AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
849       AC_SUBST(CURL_DISABLE_LDAPS, [1])
850   else
851     dnl Try to find the right ldap libraries for this system
852     CURL_CHECK_LIBS_LDAP
853     case X-"$curl_cv_ldap_LIBS" in
854       X-unknown)
855         AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
856         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
857         AC_SUBST(CURL_DISABLE_LDAP, [1])
858         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
859         AC_SUBST(CURL_DISABLE_LDAPS, [1])
860         ;;
861     esac
862   fi
863 fi
864
865 if test x$CURL_DISABLE_LDAP != x1 ; then
866
867   if test "$LBERLIBNAME" ; then
868     dnl If name is "no" then don't define this library at all
869     dnl (it's only needed if libldap.so's dependencies are broken).
870     if test "$LBERLIBNAME" != "no" ; then
871       AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
872         AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
873         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
874         AC_SUBST(CURL_DISABLE_LDAP, [1])])
875         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
876         AC_SUBST(CURL_DISABLE_LDAPS, [1])
877     fi
878   fi
879 fi
880
881 if test x$CURL_DISABLE_LDAP != x1 ; then
882   AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
883
884   if test "$LDAPLIBNAME" = "wldap32"; then
885     curl_ldap_msg="enabled (winldap)"
886     AC_DEFINE(CURL_LDAP_WIN, 1, [Use Windows LDAP implementation])
887   else
888     curl_ldap_msg="enabled (OpenLDAP)"
889     if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
890       AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
891       AC_SUBST(USE_OPENLDAP, [1])
892     fi
893   fi
894 fi
895
896 if test x$CURL_DISABLE_LDAPS != x1 ; then
897     curl_ldaps_msg="enabled"
898 fi
899
900 dnl **********************************************************************
901 dnl Checks for IPv6
902 dnl **********************************************************************
903
904 AC_MSG_CHECKING([whether to enable ipv6])
905 AC_ARG_ENABLE(ipv6,
906 AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
907 AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
908 [ case "$enableval" in
909   no)
910        AC_MSG_RESULT(no)
911        ipv6=no
912        ;;
913   *)   AC_MSG_RESULT(yes)
914        ipv6=yes
915        ;;
916   esac ],
917
918   AC_TRY_RUN([ /* is AF_INET6 available? */
919 #include <sys/types.h>
920 #include <sys/socket.h>
921 main()
922 {
923  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
924    exit(1);
925  else
926    exit(0);
927 }
928 ],
929   AC_MSG_RESULT(yes)
930   ipv6=yes,
931   AC_MSG_RESULT(no)
932   ipv6=no,
933   AC_MSG_RESULT(no)
934   ipv6=no
935 ))
936
937 if test "$ipv6" = "yes"; then
938   curl_ipv6_msg="enabled"
939 fi
940
941 # Check if struct sockaddr_in6 have sin6_scope_id member
942 if test "$ipv6" = yes; then
943   AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
944   AC_TRY_COMPILE([
945 #include <sys/types.h>
946 #include <netinet/in.h>] ,
947   struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
948   if test "$have_sin6_scope_id" = yes; then
949     AC_MSG_RESULT([yes])
950     AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
951   else
952     AC_MSG_RESULT([no])
953   fi
954 fi
955
956 dnl **********************************************************************
957 dnl Check if the operating system allows programs to write to their own argv[]
958 dnl **********************************************************************
959
960 AC_MSG_CHECKING([if argv can be written to])
961 AC_RUN_IFELSE([
962   AC_LANG_SOURCE([[
963 int main(int argc, char ** argv) {
964     argv[0][0] = ' ';
965     return (argv[0][0] == ' ')?0:1;
966 }
967   ]])
968 ],[
969   curl_cv_writable_argv=yes
970 ],[
971   curl_cv_writable_argv=no
972 ],[
973   curl_cv_writable_argv=cross
974 ])
975 case $curl_cv_writable_argv in
976 yes)
977         AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
978         AC_MSG_RESULT(yes)
979         ;;
980 no)
981         AC_MSG_RESULT(no)
982         ;;
983 *)
984         AC_MSG_RESULT(no)
985         AC_MSG_WARN([the previous check could not be made default was used])
986         ;;
987 esac
988
989 dnl **********************************************************************
990 dnl Check for the presence of Kerberos4 libraries and headers
991 dnl **********************************************************************
992
993 AC_ARG_WITH(krb4-includes,
994 AC_HELP_STRING([--with-krb4-includes=DIR],
995                [Specify location of kerberos4 headers]),[
996  CPPFLAGS="$CPPFLAGS -I$withval"
997  KRB4INC="$withval"
998  want_krb4=yes
999  ])
1000
1001 AC_ARG_WITH(krb4-libs,
1002 AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
1003  LDFLAGS="$LDFLAGS -L$withval"
1004  KRB4LIB="$withval"
1005  want_krb4=yes
1006  ])
1007
1008
1009 OPT_KRB4=off
1010 AC_ARG_WITH(krb4,dnl
1011 AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
1012   OPT_KRB4="$withval"
1013   if test X"$OPT_KRB4" != Xno; then
1014     want_krb4="yes"
1015     if test X"$OPT_KRB4" != Xyes; then
1016       LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
1017       KRB4LIB="$OPT_KRB4/lib$libsuff"
1018       CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
1019       KRB4INC="$OPT_KRB4/include"
1020     fi
1021   fi
1022  ])
1023
1024 AC_MSG_CHECKING([if Kerberos4 support is requested])
1025
1026 if test "$want_krb4" = yes
1027 then
1028   if test "$ipv6" = "yes"; then
1029     echo krb4 is not compatible with IPv6
1030     exit 1
1031   fi
1032   AC_MSG_RESULT(yes)
1033
1034   dnl Check for & handle argument to --with-krb4
1035
1036   AC_MSG_CHECKING(where to look for Kerberos4)
1037   if test X"$OPT_KRB4" = Xyes
1038   then
1039     AC_MSG_RESULT([defaults])
1040   else
1041     AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
1042   fi
1043
1044   dnl Check for DES library
1045   AC_CHECK_LIB(des, des_pcbc_encrypt,
1046   [
1047     AC_CHECK_HEADERS(des.h)
1048
1049     dnl resolv lib?
1050     AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
1051
1052     dnl Check for the Kerberos4 library
1053     AC_CHECK_LIB(krb, krb_net_read,
1054     [
1055       dnl Check for header files
1056       AC_CHECK_HEADERS(krb.h)
1057
1058       dnl we found the required libraries, add to LIBS
1059       LIBS="-lkrb -lcom_err -ldes $LIBS"
1060
1061       dnl Check for function krb_get_our_ip_for_realm
1062       dnl this is needed for NAT networks
1063       AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
1064
1065       dnl add define KRB4
1066       AC_DEFINE(HAVE_KRB4, 1,
1067       [if you have the Kerberos4 libraries (including -ldes)])
1068
1069       dnl substitute it too!
1070       KRB4_ENABLED=1
1071       AC_SUBST(KRB4_ENABLED)
1072
1073       curl_krb4_msg="enabled"
1074
1075       dnl the krb4 stuff needs a strlcpy()
1076       AC_CHECK_FUNCS(strlcpy)
1077
1078     ])
1079   ])
1080 else
1081   AC_MSG_RESULT(no)
1082 fi
1083
1084 dnl **********************************************************************
1085 dnl Check for FBopenssl(SPNEGO) libraries
1086 dnl **********************************************************************
1087
1088 AC_ARG_WITH(spnego,
1089   AC_HELP_STRING([--with-spnego=DIR],
1090                  [Specify location of SPNEGO library fbopenssl]), [
1091   SPNEGO_ROOT="$withval"
1092   if test x"$SPNEGO_ROOT" != xno; then
1093     want_spnego="yes"
1094   fi
1095 ])
1096
1097 AC_MSG_CHECKING([if SPNEGO support is requested])
1098 if test x"$want_spnego" = xyes; then
1099
1100   if test X"$SPNEGO_ROOT" = Xyes; then
1101      AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
1102      AC_MSG_RESULT(no)
1103   else
1104      if test -z "$SPNEGO_LIB_DIR"; then
1105         LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
1106      else
1107         LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
1108      fi
1109
1110      AC_MSG_RESULT(yes)
1111      AC_DEFINE(HAVE_SPNEGO, 1,
1112                [Define this if you have the SPNEGO library fbopenssl])
1113      curl_spnego_msg="enabled"
1114   fi
1115 else
1116   AC_MSG_RESULT(no)
1117 fi
1118
1119 dnl **********************************************************************
1120 dnl Check for GSS-API libraries
1121 dnl **********************************************************************
1122
1123 dnl check for gss stuff in the /usr as default
1124
1125 GSSAPI_ROOT="/usr"
1126 AC_ARG_WITH(gssapi-includes,
1127   AC_HELP_STRING([--with-gssapi-includes=DIR],
1128                  [Specify location of GSSAPI header]),
1129   [ GSSAPI_INCS="-I$withval"
1130     want_gss="yes" ]
1131 )
1132
1133 AC_ARG_WITH(gssapi-libs,
1134   AC_HELP_STRING([--with-gssapi-libs=DIR],
1135                  [Specify location of GSSAPI libs]),
1136   [ GSSAPI_LIB_DIR="-L$withval"
1137     want_gss="yes" ]
1138 )
1139
1140 AC_ARG_WITH(gssapi,
1141   AC_HELP_STRING([--with-gssapi=DIR],
1142                  [Where to look for GSSAPI]), [
1143   GSSAPI_ROOT="$withval"
1144   if test x"$GSSAPI_ROOT" != xno; then
1145     want_gss="yes"
1146     if test x"$GSSAPI_ROOT" = xyes; then
1147       dnl if yes, then use default root
1148       GSSAPI_ROOT="/usr"
1149     fi
1150   fi
1151 ])
1152
1153 save_CPPFLAGS="$CPPFLAGS"
1154 AC_MSG_CHECKING([if GSSAPI support is requested])
1155 if test x"$want_gss" = xyes; then
1156   AC_MSG_RESULT(yes)
1157
1158   if test -z "$GSSAPI_INCS"; then
1159      if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1160         GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1161      elif test "$GSSAPI_ROOT" != "yes"; then
1162         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1163      fi
1164   fi
1165
1166   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1167
1168   AC_CHECK_HEADER(gss.h,
1169     [
1170       dnl found in the given dirs
1171       AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
1172       gnu_gss=yes
1173     ],
1174     [
1175       dnl not found, check Heimdal or MIT
1176       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
1177       AC_CHECK_HEADERS(
1178         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1179         [],
1180         [not_mit=1],
1181         [
1182 AC_INCLUDES_DEFAULT
1183 #ifdef HAVE_GSSAPI_GSSAPI_H
1184 #include <gssapi/gssapi.h>
1185 #endif
1186         ])
1187       if test "x$not_mit" = "x1"; then
1188         dnl MIT not found, check for Heimdal
1189         AC_CHECK_HEADER(gssapi.h,
1190             [
1191               dnl found
1192               AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
1193             ],
1194             [
1195               dnl no header found, disabling GSS
1196               want_gss=no
1197               AC_MSG_WARN(disabling GSSAPI since no header files was found)
1198             ]
1199           )
1200       else
1201         dnl MIT found
1202         AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
1203         dnl check if we have a really old MIT kerberos (<= 1.2)
1204         AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1205         AC_COMPILE_IFELSE([
1206           AC_LANG_PROGRAM([[
1207 #include <gssapi/gssapi.h>
1208 #include <gssapi/gssapi_generic.h>
1209 #include <gssapi/gssapi_krb5.h>
1210           ]],[[
1211             gss_import_name(
1212                             (OM_uint32 *)0,
1213                             (gss_buffer_t)0,
1214                             GSS_C_NT_HOSTBASED_SERVICE,
1215                             (gss_name_t *)0);
1216           ]])
1217         ],[
1218           AC_MSG_RESULT([yes])
1219         ],[
1220           AC_MSG_RESULT([no])
1221           AC_DEFINE(HAVE_OLD_GSSMIT, 1,
1222             [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1223         ])
1224       fi
1225     ]
1226   )
1227 else
1228   AC_MSG_RESULT(no)
1229 fi
1230 if test x"$want_gss" = xyes; then
1231   AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
1232
1233   curl_gss_msg="enabled (MIT/Heimdal)"
1234
1235   if test -n "$gnu_gss"; then
1236     curl_gss_msg="enabled (GNU GSS)"
1237     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1238     LIBS="$LIBS -lgss"
1239   elif test -z "$GSSAPI_LIB_DIR"; then
1240      case $host in
1241      *-*-darwin*)
1242         LIBS="$LIBS -lgssapi_krb5 -lresolv"
1243         ;;
1244      *)
1245         if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1246            dnl krb5-config doesn't have --libs-only-L or similar, put everything
1247            dnl into LIBS
1248            gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1249            LIBS="$LIBS $gss_libs"
1250         elif test "$GSSAPI_ROOT" != "yes"; then
1251            LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1252            LIBS="$LIBS -lgssapi"
1253         else
1254            LIBS="$LIBS -lgssapi"
1255         fi
1256         ;;
1257      esac
1258   else
1259      LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1260      LIBS="$LIBS -lgssapi"
1261   fi
1262 else
1263   CPPFLAGS="$save_CPPFLAGS"
1264 fi
1265
1266 dnl **********************************************************************
1267 dnl Check for the presence of SSL libraries and headers
1268 dnl **********************************************************************
1269
1270 dnl Default to compiler & linker defaults for SSL files & libraries.
1271 OPT_SSL=off
1272 dnl Default to no CA bundle
1273 ca="no"
1274 AC_ARG_WITH(ssl,dnl
1275 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])
1276 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1277   OPT_SSL=$withval)
1278
1279 if test X"$OPT_SSL" != Xno; then
1280   dnl backup the pre-ssl variables
1281   CLEANLDFLAGS="$LDFLAGS"
1282   CLEANCPPFLAGS="$CPPFLAGS"
1283   CLEANLIBS="$LIBS"
1284
1285   case "$OPT_SSL" in
1286   yes)
1287     dnl --with-ssl (without path) used
1288     if test x$cross_compiling != xyes; then
1289       dnl only do pkg-config magic when not cross-compiling
1290       PKGTEST="yes"
1291     fi
1292     PREFIX_OPENSSL=/usr/local/ssl
1293     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1294     ;;
1295   off)
1296     dnl no --with-ssl option given, just check default places
1297     if test x$cross_compiling != xyes; then
1298       dnl only do pkg-config magic when not cross-compiling
1299       PKGTEST="yes"
1300     fi
1301     PREFIX_OPENSSL=
1302     ;;
1303   *)
1304     dnl check the given --with-ssl spot
1305     PKGTEST="no"
1306     PREFIX_OPENSSL=$OPT_SSL
1307
1308     dnl Try pkg-config even when cross-compiling.  Since we
1309     dnl specify PKG_CONFIG_LIBDIR we're only looking where
1310     dnl the user told us to look
1311     OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
1312     AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
1313     if test -e "$OPENSSL_PCDIR/openssl.pc"; then
1314       PKGTEST="yes"
1315     fi
1316
1317     dnl in case pkg-config comes up empty, use what we got
1318     dnl via --with-ssl
1319     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1320     if test "$PREFIX_OPENSSL" != "/usr" ; then
1321       SSL_LDFLAGS="-L$LIB_OPENSSL"
1322       SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
1323     fi
1324     SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
1325     ;;
1326   esac
1327
1328   if test "$PKGTEST" = "yes"; then
1329
1330     CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
1331
1332     if test "$PKGCONFIG" != "no" ; then
1333       SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1334         $PKGCONFIG --libs-only-l openssl 2>/dev/null`
1335
1336       SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1337         $PKGCONFIG --libs-only-L openssl 2>/dev/null`
1338
1339       SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
1340         $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1341
1342       AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
1343       AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
1344       AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
1345
1346       LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1347
1348       dnl use the values pkg-config reported.  This is here
1349       dnl instead of below with CPPFLAGS and LDFLAGS because we only
1350       dnl learn about this via pkg-config.  If we only have
1351       dnl the argument to --with-ssl we don't know what
1352       dnl additional libs may be necessary.  Hope that we
1353       dnl don't need any.
1354       LIBS="$LIBS $SSL_LIBS"
1355     fi
1356   fi
1357
1358   dnl finally, set flags to use SSL
1359   CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1360   LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1361
1362   dnl This is for Msys/Mingw
1363   case $host in
1364     *-*-msys* | *-*-mingw*)
1365       AC_MSG_CHECKING([for gdi32])
1366       my_ac_save_LIBS=$LIBS
1367       LIBS="-lgdi32 $LIBS"
1368       AC_TRY_LINK([#include <windef.h>
1369                    #include <wingdi.h>],
1370                    [GdiFlush();],
1371                    [ dnl worked!
1372                    AC_MSG_RESULT([yes])],
1373                    [ dnl failed, restore LIBS
1374                    LIBS=$my_ac_save_LIBS
1375                    AC_MSG_RESULT(no)]
1376                   )
1377       ;;
1378   esac
1379
1380   AC_CHECK_LIB(crypto, CRYPTO_lock,[
1381      HAVECRYPTO="yes"
1382      LIBS="-lcrypto $LIBS"
1383      ],[
1384      LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1385      CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1386      AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
1387        HAVECRYPTO="yes"
1388        LIBS="-lcrypto $LIBS"], [
1389        LDFLAGS="$CLEANLDFLAGS"
1390        CPPFLAGS="$CLEANCPPFLAGS"
1391        LIBS="$CLEANLIBS"
1392        ])
1393     ])
1394
1395
1396   if test X"$HAVECRYPTO" = X"yes"; then
1397     dnl This is only reasonable to do if crypto actually is there: check for
1398     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1399
1400     AC_CHECK_LIB(ssl, SSL_connect)
1401
1402     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1403         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1404         AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1405         OLIBS=$LIBS
1406         LIBS="$LIBS -lRSAglue -lrsaref"
1407         AC_CHECK_LIB(ssl, SSL_connect)
1408         if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1409             dnl still no SSL_connect
1410             AC_MSG_RESULT(no)
1411             LIBS=$OLIBS
1412         else
1413             AC_MSG_RESULT(yes)
1414         fi
1415
1416     else
1417
1418       dnl Have the libraries--check for SSLeay/OpenSSL headers
1419       AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1420                        openssl/pem.h openssl/ssl.h openssl/err.h,
1421         curl_ssl_msg="enabled (OpenSSL)"
1422         OPENSSL_ENABLED=1
1423         AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1424
1425       if test $ac_cv_header_openssl_x509_h = no; then
1426         dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1427         dnl since 'err.h' might in fact find a krb4 header with the same
1428         dnl name
1429         AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1430
1431         if test $ac_cv_header_x509_h = yes &&
1432            test $ac_cv_header_crypto_h = yes &&
1433            test $ac_cv_header_ssl_h = yes; then
1434           dnl three matches
1435           curl_ssl_msg="enabled (OpenSSL)"
1436           OPENSSL_ENABLED=1
1437         fi
1438       fi
1439     fi
1440
1441     if test X"$OPENSSL_ENABLED" = X"1"; then
1442        AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
1443
1444        dnl is there a pkcs12.h header present?
1445        AC_CHECK_HEADERS(openssl/pkcs12.h)
1446     else
1447        LIBS="$CLEANLIBS"
1448     fi
1449     dnl USE_SSLEAY is the historical name for what configure calls
1450     dnl OPENSSL_ENABLED; the names should really be unified
1451     USE_SSLEAY="$OPENSSL_ENABLED"
1452     AC_SUBST(USE_SSLEAY)
1453
1454     if test X"$OPT_SSL" != Xoff &&
1455        test "$OPENSSL_ENABLED" != "1"; then
1456       AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1457     fi
1458   fi
1459
1460   if test X"$OPENSSL_ENABLED" = X"1"; then
1461     dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1462     dnl stuff, it is kind of "separated" from the main SSL check
1463     AC_CHECK_FUNC(ENGINE_init,
1464               [
1465                 AC_CHECK_HEADERS(openssl/engine.h)
1466                 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1467               ])
1468
1469     dnl these can only exist if openssl exists
1470     dnl yassl doesn't have SSL_get_shutdown
1471
1472     AC_CHECK_FUNCS( RAND_status \
1473                     RAND_screen \
1474                     RAND_egd \
1475                     ENGINE_cleanup \
1476                     CRYPTO_cleanup_all_ex_data \
1477                     SSL_get_shutdown )
1478
1479     dnl Make an attempt to detect if this is actually yassl's headers and
1480     dnl OpenSSL emulation layer. We still leave everything else believing
1481     dnl and acting like OpenSSL.
1482
1483     AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
1484     AC_COMPILE_IFELSE([
1485       AC_LANG_PROGRAM([[
1486 #include <openssl/ssl.h>
1487       ]],[[
1488 #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
1489         int dummy = SSL_ERROR_NONE;
1490 #else
1491         Not the yaSSL OpenSSL compatibility header.
1492 #endif
1493       ]])
1494     ],[
1495       AC_MSG_RESULT([yes])
1496       AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
1497         [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
1498       curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
1499     ],[
1500       AC_MSG_RESULT([no])
1501     ])
1502   fi
1503
1504   if test "$OPENSSL_ENABLED" = "1"; then
1505     if test -n "$LIB_OPENSSL"; then
1506        dnl when the ssl shared libs were found in a path that the run-time
1507        dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1508        dnl to prevent further configure tests to fail due to this
1509
1510        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1511        export LD_LIBRARY_PATH
1512        AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1513     fi
1514   fi
1515
1516 fi
1517
1518 dnl **********************************************************************
1519 dnl Check for the presence of ZLIB libraries and headers
1520 dnl **********************************************************************
1521
1522 dnl Check for & handle argument to --with-zlib.
1523
1524 _cppflags=$CPPFLAGS
1525 _ldflags=$LDFLAGS
1526 AC_ARG_WITH(zlib,
1527 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
1528 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
1529                [OPT_ZLIB="$withval"])
1530
1531 if test "$OPT_ZLIB" = "no" ; then
1532     AC_MSG_WARN([zlib disabled])
1533 else
1534   if test "$OPT_ZLIB" = "yes" ; then
1535      OPT_ZLIB=""
1536   fi
1537
1538   if test -z "$OPT_ZLIB" ; then
1539     dnl check for the lib first without setting any new path, since many
1540     dnl people have it in the default path
1541
1542     AC_CHECK_LIB(z, inflateEnd,
1543                    dnl libz found, set the variable
1544                    [HAVE_LIBZ="1"],
1545                    dnl if no lib found, try /usr/local
1546                    [OPT_ZLIB="/usr/local"])
1547
1548   fi
1549
1550   dnl Add a nonempty path to the compiler flags
1551   if test -n "$OPT_ZLIB"; then
1552      CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
1553      LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
1554   fi
1555
1556   AC_CHECK_HEADER(zlib.h,
1557     [
1558     dnl zlib.h was found
1559     HAVE_ZLIB_H="1"
1560     dnl if the lib wasn't found already, try again with the new paths
1561     if test "$HAVE_LIBZ" != "1"; then
1562       AC_CHECK_LIB(z, gzread,
1563                    [
1564                    dnl the lib was found!
1565                    HAVE_LIBZ="1"
1566                    ],
1567                    [ CPPFLAGS=$_cppflags
1568                    LDFLAGS=$_ldflags])
1569     fi
1570     ],
1571     [
1572       dnl zlib.h was not found, restore the flags
1573       CPPFLAGS=$_cppflags
1574       LDFLAGS=$_ldflags]
1575     )
1576
1577   if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
1578   then
1579     AC_MSG_WARN([configure found only the libz lib, not the header file!])
1580     HAVE_LIBZ=""
1581   elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
1582   then
1583     AC_MSG_WARN([configure found only the libz header file, not the lib!])
1584   elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
1585   then
1586     dnl both header and lib were found!
1587     AC_SUBST(HAVE_LIBZ)
1588     AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
1589     AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
1590
1591     CURL_LIBS="$CURL_LIBS -lz"
1592     LIBS="$LIBS -lz"
1593
1594     dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1595     AMFIXLIB="1"
1596     AC_MSG_NOTICE([found both libz and libz.h header])
1597     curl_zlib_msg="enabled"
1598   fi
1599 fi
1600
1601 dnl set variable for use in automakefile(s)
1602 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1603
1604 dnl **********************************************************************
1605 dnl Check for the random seed preferences
1606 dnl **********************************************************************
1607
1608 if test X"$OPENSSL_ENABLED" = X"1"; then
1609   AC_ARG_WITH(egd-socket,
1610   AC_HELP_STRING([--with-egd-socket=FILE],
1611                  [Entropy Gathering Daemon socket pathname]),
1612       [ EGD_SOCKET="$withval" ]
1613   )
1614   if test -n "$EGD_SOCKET" ; then
1615           AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1616           [your Entropy Gathering Daemon socket pathname] )
1617   fi
1618
1619   dnl Check for user-specified random device
1620   AC_ARG_WITH(random,
1621   AC_HELP_STRING([--with-random=FILE],
1622                  [read randomness from FILE (default=/dev/urandom)]),
1623       [ RANDOM_FILE="$withval" ],
1624       [
1625           dnl Check for random device
1626           AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1627       ]
1628   )
1629   if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1630           AC_SUBST(RANDOM_FILE)
1631           AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1632           [a suitable file to read random data from])
1633   fi
1634 fi
1635
1636 dnl ---
1637 dnl We require OpenSSL with SRP support.
1638 dnl ---
1639 if test "$OPENSSL_ENABLED" = "1"; then
1640   AC_CHECK_LIB(crypto, SRP_Calc_client_key,
1641    [
1642      AC_DEFINE(HAVE_SSLEAY_SRP, 1, [if you have the function SRP_Calc_client_key])
1643      AC_SUBST(HAVE_SSLEAY_SRP, [1])
1644    ])
1645 fi
1646
1647 dnl ----------------------------------------------------
1648 dnl check for GnuTLS
1649 dnl ----------------------------------------------------
1650
1651 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1652 OPT_GNUTLS=no
1653
1654 AC_ARG_WITH(gnutls,dnl
1655 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
1656 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1657   OPT_GNUTLS=$withval)
1658
1659 if test "$OPENSSL_ENABLED" != "1"; then
1660
1661   if test X"$OPT_GNUTLS" != Xno; then
1662
1663     addld=""
1664     if test "x$OPT_GNUTLS" = "xyes"; then
1665       dnl this is with no partiular path given
1666       CURL_CHECK_PKGCONFIG(gnutls)
1667
1668       if test "$PKGCONFIG" != "no" ; then
1669         addlib=`$PKGCONFIG --libs-only-l gnutls`
1670         addld=`$PKGCONFIG --libs-only-L gnutls`
1671         addcflags=`$PKGCONFIG --cflags-only-I gnutls`
1672         version=`$PKGCONFIG --modversion gnutls`
1673         gtlslib=`echo $addld | $SED -e 's/-L//'`
1674       else
1675         dnl without pkg-config, we try libgnutls-config as that was how it
1676         dnl used to be done
1677         check=`libgnutls-config --version 2>/dev/null`
1678         if test -n "$check"; then
1679           addlib=`libgnutls-config --libs`
1680           addcflags=`libgnutls-config --cflags`
1681           version=`libgnutls-config --version`
1682           gtlslib=`libgnutls-config --prefix`/lib$libsuff
1683         fi
1684       fi
1685     else
1686       dnl this is with a given path, first check if there's a libgnutls-config
1687       dnl there and if not, make an educated guess
1688       cfg=$OPT_GNUTLS/bin/libgnutls-config
1689       check=`$cfg --version 2>/dev/null`
1690       if test -n "$check"; then
1691         addlib=`$cfg --libs`
1692         addcflags=`$cfg --cflags`
1693         version=`$cfg --version`
1694         gtlslib=`$cfg --prefix`/lib$libsuff
1695       else
1696         dnl without pkg-config and libgnutls-config, we guess a lot!
1697         addlib=-lgnutls
1698         addld=-L$OPT_GNUTLS/lib$libsuff
1699         addcflags=-I$OPT_GNUTLS/include
1700         version="" # we just don't know
1701         gtlslib=$OPT_GNUTLS/lib$libsuff
1702       fi
1703     fi
1704
1705     if test -z "$version"; then
1706       dnl lots of efforts, still no go
1707       version="unknown"
1708     fi
1709
1710     if test -n "$addlib"; then
1711
1712       CLEANLIBS="$LIBS"
1713       CLEANCPPFLAGS="$CPPFLAGS"
1714       CLEADLDFLAGS="$LDFLAGS"
1715
1716       LIBS="$LIBS $addlib"
1717       LDFLAGS="$LDFLAGS $addld"
1718       if test "$addcflags" != "-I/usr/include"; then
1719          CPPFLAGS="$CPPFLAGS $addcflags"
1720       fi
1721
1722       AC_CHECK_LIB(gnutls, gnutls_check_version,
1723        [
1724        AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1725        AC_SUBST(USE_GNUTLS, [1])
1726        GNUTLS_ENABLED=1
1727        USE_GNUTLS="yes"
1728        curl_ssl_msg="enabled (GnuTLS)"
1729        ],
1730        [
1731          LIBS="$CLEANLIBS"
1732          CPPFLAGS="$CLEANCPPFLAGS"
1733        ])
1734
1735       if test "x$USE_GNUTLS" = "xyes"; then
1736         AC_MSG_NOTICE([detected GnuTLS version $version])
1737
1738         if test -n "$gtlslib"; then
1739           dnl when shared libs were found in a path that the run-time
1740           dnl linker doesn't search through, we need to add it to
1741           dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1742           dnl due to this
1743
1744           LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
1745           export LD_LIBRARY_PATH
1746           AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
1747         fi
1748       fi
1749
1750     fi
1751
1752   fi dnl GNUTLS not disabled
1753
1754 fi dnl OPENSSL != 1
1755
1756 dnl ---
1757 dnl If GnuTLS is enabled, we MUST verify that it uses libgcrypt since
1758 dnl curl code relies on that but recent GnuTLS versions can in fact build
1759 dnl with different crypto libraries which curl right now cannot handle
1760 dnl ---
1761
1762 if test "$GNUTLS_ENABLED" = "1"; then
1763   AC_CHECK_LIB(gcrypt,
1764                gcry_control, ,
1765     [
1766       AC_MSG_ERROR([need GnuTLS built with gcrypt to function with GnuTLS])
1767     ])
1768 fi
1769
1770 dnl ---
1771 dnl We require GnuTLS with SRP support.
1772 dnl ---
1773 if test "$GNUTLS_ENABLED" = "1"; then
1774   AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
1775    [
1776      AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
1777      AC_SUBST(HAVE_GNUTLS_SRP, [1])
1778    ])
1779 fi
1780
1781 dnl ----------------------------------------------------
1782 dnl check for PolarSSL
1783 dnl ----------------------------------------------------
1784
1785 dnl Default to compiler & linker defaults for PolarSSL files & libraries.
1786 OPT_POLARSSL=no
1787
1788 _cppflags=$CPPFLAGS
1789 _ldflags=$LDFLAGS
1790 AC_ARG_WITH(polarssl,dnl
1791 AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
1792 AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
1793   OPT_POLARSSL=$withval)
1794
1795 if test "$OPENSSL_ENABLED" != "1"; then
1796
1797   if test X"$OPT_POLARSSL" != Xno; then
1798
1799     if test "$OPT_POLARSSL" = "yes"; then
1800       OPT_POLARSSL=""
1801     fi
1802
1803     if test -z "$OPT_POLARSSL" ; then
1804       dnl check for lib first without setting any new path
1805
1806       AC_CHECK_LIB(polarssl, havege_init,
1807       dnl libpolarssl found, set the variable
1808        [
1809          AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1810          AC_SUBST(USE_POLARSSL, [1])
1811          POLARSSL_ENABLED=1
1812          USE_POLARSSL="yes"
1813          curl_ssl_msg="enabled (PolarSSL)"
1814         ])
1815     fi
1816
1817     if test "x$USE_POLARSSL" != "xyes"; then
1818       dnl add the path and test again
1819       addld=-L$OPT_POLARSSL/lib$libsuff
1820       addcflags=-I$OPT_POLARSSL/include
1821       polarssllib=$OPT_POLARSSL/lib$libsuff
1822
1823       LDFLAGS="$LDFLAGS $addld"
1824       if test "$addcflags" != "-I/usr/include"; then
1825          CPPFLAGS="$CPPFLAGS $addcflags"
1826       fi
1827
1828       AC_CHECK_LIB(polarssl, ssl_init,
1829        [
1830        AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
1831        AC_SUBST(USE_POLARSSL, [1])
1832        POLARSSL_ENABLED=1
1833        USE_POLARSSL="yes"
1834        curl_ssl_msg="enabled (PolarSSL)"
1835        ],
1836        [
1837          CPPFLAGS=$_cppflags
1838          LDFLAGS=$_ldflags
1839        ])
1840     fi
1841
1842     if test "x$USE_POLARSSL" = "xyes"; then
1843       AC_MSG_NOTICE([detected PolarSSL])
1844
1845       CURL_LIBS="$CURL_LIBS -lpolarssl"
1846       LIBS="$LIBS -lpolarssl"
1847
1848       if test -n "$polarssllib"; then
1849         dnl when shared libs were found in a path that the run-time
1850         dnl linker doesn't search through, we need to add it to
1851         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1852         dnl due to this
1853
1854         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
1855         export LD_LIBRARY_PATH
1856         AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
1857       fi
1858
1859     fi
1860
1861   fi dnl PolarSSL not disabled
1862
1863 fi dnl OPENSSL != 1
1864
1865 dnl ----------------------------------------------------
1866 dnl check for CyaSSL
1867 dnl ----------------------------------------------------
1868
1869 dnl Default to compiler & linker defaults for CyaSSL files & libraries.
1870 OPT_CYASSL=no
1871
1872 _cppflags=$CPPFLAGS
1873 _ldflags=$LDFLAGS
1874 AC_ARG_WITH(cyassl,dnl
1875 AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: /usr/local/cyassl)])
1876 AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
1877   OPT_CYASSL=$withval)
1878
1879 if test "$OPENSSL_ENABLED" != "1"; then
1880
1881   if test X"$OPT_CYASSL" != Xno; then
1882
1883     if test "$OPT_CYASSL" = "yes"; then
1884       OPT_CYASSL=""
1885     fi
1886
1887     if test -z "$OPT_CYASSL" ; then
1888       dnl check for lib in default first
1889
1890       trycyassldir="/usr/local/cyassl"
1891
1892       LDFLAGS="$LDFLAGS -L$trycyassldir/lib"
1893       CPPFLAGS="$CPPFLAGS -I$trycyassldir/include"
1894
1895       AC_CHECK_LIB(cyassl, InitCyaSSL,
1896       dnl libcyassl found, set the variable
1897        [
1898          AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1899          AC_SUBST(USE_CYASSL, [1])
1900          CYASSL_ENABLED=1
1901          USE_CYASSL="yes"
1902          curl_ssl_msg="enabled (CyaSSL)"
1903         ])
1904     fi
1905
1906     if test "x$USE_CYASSL" != "xyes"; then
1907       dnl add the path and test again
1908       addld=-L$OPT_CYASSL/lib$libsuff
1909       addcflags=-I$OPT_CYASSL/include
1910       cyassllib=$OPT_CYASSL/lib$libsuff
1911
1912       LDFLAGS="$LDFLAGS $addld"
1913       if test "$addcflags" != "-I/usr/include"; then
1914          CPPFLAGS="$CPPFLAGS $addcflags"
1915       fi
1916
1917       AC_CHECK_LIB(cyassl, InitCyaSSL,
1918        [
1919        AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
1920        AC_SUBST(USE_CYASSL, [1])
1921        CYASSL_ENABLED=1
1922        USE_CYASSL="yes"
1923        curl_ssl_msg="enabled (CyaSSL)"
1924        ],
1925        [
1926          CPPFLAGS=$_cppflags
1927          LDFLAGS=$_ldflags
1928        ])
1929     fi
1930
1931     if test "x$USE_CYASSL" = "xyes"; then
1932       AC_MSG_NOTICE([detected CyaSSL])
1933
1934       CURL_LIBS="$CURL_LIBS -lcyassl -lm"
1935       LIBS="$LIBS -lcyassl -lm"
1936
1937       if test -n "$cyassllib"; then
1938         dnl when shared libs were found in a path that the run-time
1939         dnl linker doesn't search through, we need to add it to
1940         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1941         dnl due to this
1942
1943         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
1944         export LD_LIBRARY_PATH
1945         AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
1946       fi
1947
1948     fi
1949
1950   fi dnl CyaSSL not disabled
1951
1952 fi dnl OPENSSL != 1
1953
1954 dnl ----------------------------------------------------
1955 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
1956 dnl ----------------------------------------------------
1957
1958 dnl Default to compiler & linker defaults for NSS files & libraries.
1959 OPT_NSS=no
1960
1961 AC_ARG_WITH(nss,dnl
1962 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
1963 AC_HELP_STRING([--without-nss], [disable NSS detection]),
1964   OPT_NSS=$withval)
1965
1966 if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
1967
1968   if test X"$OPT_NSS" != Xno; then
1969     if test "x$OPT_NSS" = "xyes"; then
1970
1971       CURL_CHECK_PKGCONFIG(nss)
1972
1973       if test "$PKGCONFIG" != "no" ; then
1974         addlib=`$PKGCONFIG --libs nss`
1975         addcflags=`$PKGCONFIG --cflags nss`
1976         version=`$PKGCONFIG --modversion nss`
1977         nssprefix=`$PKGCONFIG --variable=prefix nss`
1978       else
1979         dnl Without pkg-config, we check for nss-config
1980
1981         check=`nss-config --version 2>/dev/null`
1982         if test -n "$check"; then
1983           addlib=`nss-config --libs`
1984           addcflags=`nss-config --cflags`
1985           version=`nss-config --version`
1986           nssprefix=`nss-config --prefix`
1987         else
1988           addlib="-lnss3"
1989           addcflags=""
1990           version="unknown"
1991         fi
1992       fi
1993     else
1994         # Without pkg-config, we'll kludge in some defaults
1995         addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
1996         addcflags="-I$OPT_NSS/include"
1997         version="unknown"
1998         nssprefix=$OPT_NSS
1999     fi
2000
2001     dnl Check for functionPK11_CreateGenericObject
2002     dnl this is needed for using the PEM PKCS#11 module
2003     AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
2004      [
2005      AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject])
2006      AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1])
2007      ])
2008     if test -n "$addlib"; then
2009
2010       CLEANLIBS="$LIBS"
2011       CLEANCPPFLAGS="$CPPFLAGS"
2012
2013       LIBS="$LIBS $addlib"
2014       if test "$addcflags" != "-I/usr/include"; then
2015          CPPFLAGS="$CPPFLAGS $addcflags"
2016       fi
2017
2018       AC_CHECK_LIB(nss3, NSS_Initialize,
2019        [
2020        AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
2021        AC_SUBST(USE_NSS, [1])
2022        USE_NSS="yes"
2023        NSS_ENABLED=1
2024        curl_ssl_msg="enabled (NSS)"
2025        ],
2026        [
2027          LIBS="$CLEANLIBS"
2028          CPPFLAGS="$CLEANCPPFLAGS"
2029        ])
2030
2031       if test "x$USE_NSS" = "xyes"; then
2032         AC_MSG_NOTICE([detected NSS version $version])
2033
2034         dnl when shared libs were found in a path that the run-time
2035         dnl linker doesn't search through, we need to add it to
2036         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
2037         dnl due to this
2038
2039         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
2040         export LD_LIBRARY_PATH
2041         AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
2042       fi
2043
2044     fi
2045
2046   fi dnl NSS not disabled
2047
2048 fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
2049
2050 OPT_AXTLS=off
2051
2052 AC_ARG_WITH(axtls,dnl
2053 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.])
2054 AC_HELP_STRING([--without-axtls], [disable axTLS]),
2055   OPT_AXTLS=$withval)
2056
2057 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
2058   if test X"$OPT_AXTLS" != Xno; then
2059     dnl backup the pre-axtls variables
2060     CLEANLDFLAGS="$LDFLAGS"
2061     CLEANCPPFLAGS="$CPPFLAGS"
2062     CLEANLIBS="$LIBS"
2063
2064     case "$OPT_AXTLS" in
2065     yes)
2066       dnl --with-axtls (without path) used
2067       PREFIX_AXTLS=/usr/local
2068       LIB_AXTLS="$PREFIX_AXTLS/lib"
2069       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2070       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2071       ;;
2072     off)
2073       dnl no --with-axtls option given, just check default places
2074       PREFIX_AXTLS=
2075       ;;
2076     *)
2077       dnl check the given --with-axtls spot
2078       PREFIX_AXTLS=$OPT_AXTLS
2079       LIB_AXTLS="$PREFIX_AXTLS/lib"
2080       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
2081       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
2082       ;;
2083     esac
2084
2085     AC_CHECK_LIB(axtls, ssl_version,[
2086       LIBS="-laxtls $LIBS"
2087       AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
2088       AC_SUBST(USE_AXTLS, [1])
2089       AXTLS_ENABLED=1
2090       USE_AXTLS="yes"
2091       curl_ssl_msg="enabled (axTLS)"
2092
2093
2094       LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
2095       export LD_LIBRARY_PATH
2096       AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
2097       ],[
2098       LDFLAGS="$CLEANLDFLAGS"
2099       CPPFLAGS="$CLEANCPPFLAGS"
2100       LIBS="$CLEANLIBS"
2101     ])
2102   fi
2103 fi
2104
2105 if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED" = "x"; then
2106   AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
2107   AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss or --with-axtls to address this.])
2108 else
2109   # SSL is enabled, genericly
2110   AC_SUBST(SSL_ENABLED)
2111   SSL_ENABLED="1"
2112 fi
2113
2114 dnl **********************************************************************
2115 dnl Check for the CA bundle
2116 dnl **********************************************************************
2117
2118 CURL_CHECK_CA_BUNDLE
2119
2120 dnl **********************************************************************
2121 dnl Check for the presence of LIBSSH2 libraries and headers
2122 dnl **********************************************************************
2123
2124 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
2125 OPT_LIBSSH2=off
2126 AC_ARG_WITH(libssh2,dnl
2127 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])
2128 AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
2129   OPT_LIBSSH2=$withval)
2130
2131 if test X"$OPT_LIBSSH2" != Xno; then
2132   dnl backup the pre-libssh2 variables
2133   CLEANLDFLAGS="$LDFLAGS"
2134   CLEANCPPFLAGS="$CPPFLAGS"
2135   CLEANLIBS="$LIBS"
2136
2137   case "$OPT_LIBSSH2" in
2138   yes)
2139     dnl --with-libssh2 (without path) used
2140     CURL_CHECK_PKGCONFIG(libssh2)
2141
2142     if test "$PKGCONFIG" != "no" ; then
2143       LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
2144       LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
2145       CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
2146       version=`$PKGCONFIG --modversion libssh2`
2147       DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
2148     fi
2149
2150     ;;
2151   off)
2152     dnl no --with-libssh2 option given, just check default places
2153     ;;
2154   *)
2155     dnl use the given --with-libssh2 spot
2156     PREFIX_SSH2=$OPT_LIBSSH2
2157     ;;
2158   esac
2159
2160   dnl if given with a prefix, we set -L and -I based on that
2161   if test -n "$PREFIX_SSH2"; then
2162     LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
2163     CPP_SSH2=-I${PREFIX_SSH2}/include
2164     DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
2165   fi
2166
2167   LDFLAGS="$LDFLAGS $LD_SSH2"
2168   CPPFLAGS="$CPPFLAGS $CPP_SSH2"
2169   LIBS="$LIBS $LIB_SSH2"
2170
2171   AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
2172
2173   AC_CHECK_HEADERS(libssh2.h,
2174     curl_ssh_msg="enabled (libSSH2)"
2175     LIBSSH2_ENABLED=1
2176     AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
2177     AC_SUBST(USE_LIBSSH2, [1])
2178   )
2179
2180   if test X"$OPT_LIBSSH2" != Xoff &&
2181      test "$LIBSSH2_ENABLED" != "1"; then
2182     AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2183   fi
2184
2185   if test "$LIBSSH2_ENABLED" = "1"; then
2186     if test -n "$DIR_SSH2"; then
2187        dnl when the libssh2 shared libs were found in a path that the run-time
2188        dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
2189        dnl to prevent further configure tests to fail due to this
2190
2191        dnl libssh2_version is a post 1.0 addition
2192        dnl libssh2_init and libssh2_exit were added in 1.2.5
2193        dnl libssh2_scp_send64 was added in 1.2.6
2194        dnl libssh2_session_handshake was added in 1.2.8
2195        AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
2196                        libssh2_scp_send64 libssh2_session_handshake)
2197
2198        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
2199        export LD_LIBRARY_PATH
2200        AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
2201     fi
2202   else
2203     dnl no libssh2, revert back to clean variables
2204     LDFLAGS=$CLEANLDFLAGS
2205     CPPFLAGS=$CLEANCPPFLAGS
2206     LIBS=$CLEANLIBS
2207   fi
2208 fi
2209
2210 dnl **********************************************************************
2211 dnl Check for the presence of LIBRTMP libraries and headers
2212 dnl **********************************************************************
2213
2214 dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
2215 OPT_LIBRTMP=off
2216 AC_ARG_WITH(librtmp,dnl
2217 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])
2218 AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
2219   OPT_LIBRTMP=$withval)
2220
2221 if test X"$OPT_LIBRTMP" != Xno; then
2222   dnl backup the pre-librtmp variables
2223   CLEANLDFLAGS="$LDFLAGS"
2224   CLEANCPPFLAGS="$CPPFLAGS"
2225   CLEANLIBS="$LIBS"
2226
2227   case "$OPT_LIBRTMP" in
2228   yes)
2229     dnl --with-librtmp (without path) used
2230     CURL_CHECK_PKGCONFIG(librtmp)
2231
2232     if test "$PKGCONFIG" != "no" ; then
2233       LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
2234       LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
2235       CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
2236       version=`$PKGCONFIG --modversion librtmp`
2237       DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
2238     else
2239       dnl To avoid link errors, we do not allow --librtmp without
2240       dnl a pkgconfig file
2241       AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
2242     fi
2243
2244     ;;
2245   off)
2246     dnl no --with-librtmp option given, just check default places
2247     LIB_RTMP="-lrtmp"
2248     ;;
2249   *)
2250     dnl use the given --with-librtmp spot
2251     PREFIX_RTMP=$OPT_LIBRTMP
2252     ;;
2253   esac
2254
2255   dnl if given with a prefix, we set -L and -I based on that
2256   if test -n "$PREFIX_RTMP"; then
2257     LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
2258     CPP_RTMP=-I${PREFIX_RTMP}/include
2259     DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
2260   fi
2261
2262   LDFLAGS="$LDFLAGS $LD_RTMP"
2263   CPPFLAGS="$CPPFLAGS $CPP_RTMP"
2264   LIBS="$LIBS $LIB_RTMP"
2265
2266   AC_CHECK_LIB(rtmp, RTMP_Init,
2267     [
2268      AC_CHECK_HEADERS(librtmp/rtmp.h,
2269         curl_rtmp_msg="enabled (librtmp)"
2270         LIBRTMP_ENABLED=1
2271         AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
2272         AC_SUBST(USE_LIBRTMP, [1])
2273      )
2274     ],
2275       dnl not found, revert back to clean variables
2276       LDFLAGS=$CLEANLDFLAGS
2277       CPPFLAGS=$CLEANCPPFLAGS
2278       LIBS=$CLEANLIBS
2279   )
2280
2281   if test X"$OPT_LIBRTMP" != Xoff &&
2282      test "$LIBRTMP_ENABLED" != "1"; then
2283     AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
2284   fi
2285
2286 fi
2287
2288 dnl **********************************************************************
2289 dnl Check for the presence of IDN libraries and headers
2290 dnl **********************************************************************
2291
2292 AC_MSG_CHECKING([whether to build with libidn])
2293 AC_ARG_WITH(libidn,
2294 AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
2295 AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
2296   [LIBIDN="$withval"])
2297
2298 case "$LIBIDN" in
2299   no)
2300        AC_MSG_RESULT(no)
2301        ;;
2302   *)   AC_MSG_RESULT(yes)
2303
2304        idn=""
2305        dnl if there is a given path, check that FIRST
2306        if test -n "$LIBIDN"; then
2307          if test "x$LIBIDN" != "xyes"; then
2308             oldLDFLAGS=$LDFLAGS
2309             oldCPPFLAGS=$CPPFLAGS
2310             LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
2311             CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
2312             idn="yes"
2313             AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
2314                          idn=""
2315                          LDFLAGS=$oldLDFLAGS
2316                          CPPFLAGS=$oldCPPFLAGS)
2317          fi
2318        fi
2319
2320        if test "x$idn" != "xyes"; then
2321           dnl check with default paths
2322           idn="yes"
2323           AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
2324                        idn="")
2325        fi
2326
2327        if test "x$idn" = "xyes"; then
2328          curl_idn_msg="enabled"
2329          AC_SUBST(IDN_ENABLED, [1])
2330          dnl different versions of libidn have different setups of these:
2331          AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
2332          AC_CHECK_HEADERS( idn-free.h tld.h )
2333        fi
2334
2335        ;;
2336 esac
2337
2338
2339 dnl Let's hope this split URL remains working:
2340 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
2341 dnl genprogc/thread_quick_ref.htm
2342
2343
2344 dnl **********************************************************************
2345 dnl Back to "normal" configuring
2346 dnl **********************************************************************
2347
2348 dnl Checks for header files.
2349 AC_HEADER_STDC
2350
2351 CURL_CHECK_HEADER_MALLOC
2352 CURL_CHECK_HEADER_MEMORY
2353
2354 dnl Now check for the very most basic headers. Then we can use these
2355 dnl ones as default-headers when checking for the rest!
2356 AC_CHECK_HEADERS(
2357         sys/types.h \
2358         sys/time.h \
2359         sys/select.h \
2360         sys/socket.h \
2361         sys/ioctl.h \
2362         sys/uio.h \
2363         assert.h \
2364         unistd.h \
2365         stdlib.h \
2366         limits.h \
2367         arpa/inet.h \
2368         net/if.h \
2369         netinet/in.h \
2370         sys/un.h \
2371         netinet/tcp.h \
2372         netdb.h \
2373         sys/sockio.h \
2374         sys/stat.h \
2375         sys/param.h \
2376         termios.h \
2377         termio.h \
2378         sgtty.h \
2379         fcntl.h \
2380         alloca.h \
2381         time.h \
2382         io.h \
2383         pwd.h \
2384         utime.h \
2385         sys/utime.h \
2386         sys/poll.h \
2387         poll.h \
2388         socket.h \
2389         sys/resource.h \
2390         libgen.h \
2391         locale.h \
2392         errno.h \
2393         stdbool.h \
2394         arpa/tftp.h \
2395         sys/filio.h \
2396         setjmp.h,
2397 dnl to do if not found
2398 [],
2399 dnl to do if found
2400 [],
2401 dnl default includes
2402 [
2403 #ifdef HAVE_SYS_TYPES_H
2404 #include <sys/types.h>
2405 #endif
2406 #ifdef HAVE_SYS_TIME_H
2407 #include <sys/time.h>
2408 #endif
2409 #ifdef HAVE_SYS_SELECT_H
2410 #include <sys/select.h>
2411 #endif
2412 #ifdef HAVE_SYS_SOCKET_H
2413 #include <sys/socket.h>
2414 #endif
2415 #ifdef HAVE_NETINET_IN_H
2416 #include <netinet/in.h>
2417 #endif
2418 #ifdef HAVE_SYS_UN_H
2419 #include <sys/un.h>
2420 #endif
2421 ]
2422 )
2423
2424 dnl Checks for typedefs, structures, and compiler characteristics.
2425 AC_C_CONST
2426 CURL_CHECK_VARIADIC_MACROS
2427 AC_TYPE_SIZE_T
2428 AC_HEADER_TIME
2429 CURL_CHECK_STRUCT_TIMEVAL
2430 CURL_VERIFY_RUNTIMELIBS
2431
2432 AC_CHECK_SIZEOF(size_t)
2433 AC_CHECK_SIZEOF(long)
2434 AC_CHECK_SIZEOF(int)
2435 AC_CHECK_SIZEOF(short)
2436 CURL_CONFIGURE_LONG
2437 AC_CHECK_SIZEOF(time_t)
2438 AC_CHECK_SIZEOF(off_t)
2439
2440 soname_bump=no
2441 if test x"$ac_cv_native_windows" != "xyes" &&
2442    test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2443   AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2444   AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2445   soname_bump=yes
2446 fi
2447
2448
2449 AC_CHECK_TYPE(long long,
2450    [AC_DEFINE(HAVE_LONGLONG, 1,
2451       [Define to 1 if the compiler supports the 'long long' data type.])]
2452    longlong="yes"
2453 )
2454
2455 if test "xyes" = "x$longlong"; then
2456   AC_MSG_CHECKING([if numberLL works])
2457   AC_COMPILE_IFELSE([
2458     AC_LANG_PROGRAM([[
2459     ]],[[
2460       long long val = 1000LL;
2461     ]])
2462   ],[
2463     AC_MSG_RESULT([yes])
2464     AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
2465   ],[
2466     AC_MSG_RESULT([no])
2467   ])
2468 fi
2469
2470
2471 # check for ssize_t
2472 AC_CHECK_TYPE(ssize_t, ,
2473    AC_DEFINE(ssize_t, int, [the signed version of size_t]))
2474
2475 # check for bool type
2476 AC_CHECK_TYPE([bool],[
2477   AC_DEFINE(HAVE_BOOL_T, 1,
2478     [Define to 1 if bool is an available type.])
2479 ], ,[
2480 #ifdef HAVE_SYS_TYPES_H
2481 #include <sys/types.h>
2482 #endif
2483 #ifdef HAVE_STDBOOL_H
2484 #include <stdbool.h>
2485 #endif
2486 ])
2487
2488 CURL_CONFIGURE_CURL_SOCKLEN_T
2489
2490 TYPE_IN_ADDR_T
2491
2492 TYPE_SOCKADDR_STORAGE
2493
2494 TYPE_SIG_ATOMIC_T
2495
2496 AC_TYPE_SIGNAL
2497
2498 CURL_CHECK_FUNC_SELECT
2499
2500 CURL_CHECK_FUNC_RECV
2501 CURL_CHECK_FUNC_RECVFROM
2502 CURL_CHECK_FUNC_SEND
2503 CURL_CHECK_MSG_NOSIGNAL
2504
2505 CURL_CHECK_FUNC_ALARM
2506 CURL_CHECK_FUNC_BASENAME
2507 CURL_CHECK_FUNC_CLOSESOCKET
2508 CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
2509 CURL_CHECK_FUNC_CONNECT
2510 CURL_CHECK_FUNC_FCNTL
2511 CURL_CHECK_FUNC_FDOPEN
2512 CURL_CHECK_FUNC_FREEADDRINFO
2513 CURL_CHECK_FUNC_FREEIFADDRS
2514 CURL_CHECK_FUNC_FSETXATTR
2515 CURL_CHECK_FUNC_FTRUNCATE
2516 CURL_CHECK_FUNC_GETADDRINFO
2517 CURL_CHECK_FUNC_GETHOSTBYADDR
2518 CURL_CHECK_FUNC_GETHOSTBYADDR_R
2519 CURL_CHECK_FUNC_GETHOSTBYNAME
2520 CURL_CHECK_FUNC_GETHOSTBYNAME_R
2521 CURL_CHECK_FUNC_GETHOSTNAME
2522 CURL_CHECK_FUNC_GETIFADDRS
2523 CURL_CHECK_FUNC_GETSERVBYPORT_R
2524 CURL_CHECK_FUNC_GMTIME_R
2525 CURL_CHECK_FUNC_INET_NTOA_R
2526 CURL_CHECK_FUNC_INET_NTOP
2527 CURL_CHECK_FUNC_INET_PTON
2528 CURL_CHECK_FUNC_IOCTL
2529 CURL_CHECK_FUNC_IOCTLSOCKET
2530 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
2531 CURL_CHECK_FUNC_LOCALTIME_R
2532 CURL_CHECK_FUNC_MEMRCHR
2533 CURL_CHECK_FUNC_POLL
2534 CURL_CHECK_FUNC_SETSOCKOPT
2535 CURL_CHECK_FUNC_SIGACTION
2536 CURL_CHECK_FUNC_SIGINTERRUPT
2537 CURL_CHECK_FUNC_SIGNAL
2538 CURL_CHECK_FUNC_SIGSETJMP
2539 CURL_CHECK_FUNC_SOCKET
2540 CURL_CHECK_FUNC_STRCASECMP
2541 CURL_CHECK_FUNC_STRCASESTR
2542 CURL_CHECK_FUNC_STRCMPI
2543 CURL_CHECK_FUNC_STRDUP
2544 CURL_CHECK_FUNC_STRERROR_R
2545 CURL_CHECK_FUNC_STRICMP
2546 CURL_CHECK_FUNC_STRLCAT
2547 CURL_CHECK_FUNC_STRNCASECMP
2548 CURL_CHECK_FUNC_STRNCMPI
2549 CURL_CHECK_FUNC_STRNICMP
2550 CURL_CHECK_FUNC_STRSTR
2551 CURL_CHECK_FUNC_STRTOK_R
2552 CURL_CHECK_FUNC_STRTOLL
2553 CURL_CHECK_FUNC_WRITEV
2554
2555 case $host in
2556   *msdosdjgpp)
2557      ac_cv_func_pipe=no
2558      skipcheck_pipe=yes
2559      AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
2560     ;;
2561 esac
2562
2563 AC_CHECK_FUNCS([fork \
2564   geteuid \
2565   getpass_r \
2566   getppid \
2567   getprotobyname \
2568   getpwuid \
2569   getrlimit \
2570   gettimeofday \
2571   inet_addr \
2572   perror \
2573   pipe \
2574   setlocale \
2575   setmode \
2576   setrlimit \
2577   uname \
2578   utime
2579 ],[
2580 ],[
2581   func="$ac_func"
2582   eval skipcheck=\$skipcheck_$func
2583   if test "x$skipcheck" != "xyes"; then
2584     AC_MSG_CHECKING([deeper for $func])
2585     AC_LINK_IFELSE([
2586       AC_LANG_PROGRAM([[
2587       ]],[[
2588         $func ();
2589       ]])
2590     ],[
2591       AC_MSG_RESULT([yes])
2592       eval "ac_cv_func_$func=yes"
2593       AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$func]), [1],
2594         [Define to 1 if you have the $func function.])
2595     ],[
2596       AC_MSG_RESULT([but still no])
2597     ])
2598   fi
2599 ])
2600
2601 dnl Check if the getnameinfo function is available
2602 dnl and get the types of five of its arguments.
2603 CURL_CHECK_FUNC_GETNAMEINFO
2604
2605 if test "$ipv6" = "yes"; then
2606   if test "$ac_cv_func_getaddrinfo" = "yes"; then
2607     AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
2608     IPV6_ENABLED=1
2609     AC_SUBST(IPV6_ENABLED)
2610   fi
2611   CURL_CHECK_NI_WITHSCOPEID
2612 fi
2613
2614 dnl ************************************************************
2615 dnl enable non-blocking communications
2616 dnl
2617 CURL_CHECK_OPTION_NONBLOCKING
2618 CURL_CHECK_NONBLOCKING_SOCKET
2619
2620 dnl ************************************************************
2621 dnl nroff tool stuff
2622 dnl
2623
2624 AC_PATH_PROG( PERL, perl, ,
2625   $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
2626 AC_SUBST(PERL)
2627
2628 AC_PATH_PROGS( NROFF, gnroff nroff, ,
2629   $PATH:/usr/bin/:/usr/local/bin )
2630 AC_SUBST(NROFF)
2631
2632 if test -n "$NROFF"; then
2633   dnl only check for nroff options if an nroff command was found
2634
2635   AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
2636   MANOPT="-man"
2637   mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2638   if test -z "$mancheck"; then
2639     MANOPT="-mandoc"
2640    mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2641     if test -z "$mancheck"; then
2642       MANOPT=""
2643       AC_MSG_RESULT([failed])
2644       AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
2645     else
2646       AC_MSG_RESULT([$MANOPT])
2647     fi
2648   else
2649     AC_MSG_RESULT([$MANOPT])
2650   fi
2651   AC_SUBST(MANOPT)
2652 fi
2653
2654 if test -z "$MANOPT"
2655 then
2656   dnl if no nroff tool was found, or no option that could convert man pages
2657   dnl was found, then disable the built-in manual stuff
2658   AC_MSG_WARN([disabling built-in manual])
2659   USE_MANUAL="no";
2660 fi
2661
2662 dnl *************************************************************************
2663 dnl If the manual variable still is set, then we go with providing a built-in
2664 dnl manual
2665
2666 if test "$USE_MANUAL" = "1"; then
2667   AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
2668   curl_manual_msg="enabled"
2669 fi
2670
2671 dnl set variable for use in automakefile(s)
2672 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
2673
2674 CURL_CHECK_LIB_ARES
2675 AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
2676
2677 if test "x$ac_cv_native_windows" != "xyes" &&
2678    test "x$enable_shared" = "xyes"; then
2679   build_libhostname=yes
2680 else
2681   build_libhostname=no
2682 fi
2683 AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
2684
2685 CURL_CHECK_OPTION_THREADED_RESOLVER
2686
2687 if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
2688   AC_MSG_ERROR(
2689 [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
2690 fi
2691
2692 if test "$want_thres" = "yes"; then
2693   AC_CHECK_HEADER(pthread.h,
2694     [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
2695       save_CFLAGS="$CFLAGS"
2696       CFLAGS="$CFLAGS -pthread"
2697       AC_CHECK_LIB(pthread, pthread_create,
2698         [ AC_MSG_NOTICE([using POSIX threaded DNS lookup])
2699           AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
2700           USE_THREADS_POSIX=1
2701           curl_res_msg="threaded"
2702         ],
2703         [ CFLAGS="$save_CFLAGS"])
2704   ])
2705 fi
2706
2707 dnl ************************************************************
2708 dnl disable verbose text strings
2709 dnl
2710 AC_MSG_CHECKING([whether to enable verbose strings])
2711 AC_ARG_ENABLE(verbose,
2712 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
2713 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
2714 [ case "$enableval" in
2715   no)
2716        AC_MSG_RESULT(no)
2717        AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
2718        curl_verbose_msg="no"
2719        ;;
2720   *)   AC_MSG_RESULT(yes)
2721        ;;
2722   esac ],
2723        AC_MSG_RESULT(yes)
2724 )
2725
2726 dnl ************************************************************
2727 dnl enable SSPI support
2728 dnl
2729 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
2730 AC_ARG_ENABLE(sspi,
2731 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
2732 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
2733 [ case "$enableval" in
2734   yes)
2735        if test "$ac_cv_native_windows" = "yes"; then
2736          AC_MSG_RESULT(yes)
2737          AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
2738          AC_SUBST(USE_WINDOWS_SSPI, [1])
2739          curl_sspi_msg="enabled"
2740        else
2741          AC_MSG_RESULT(no)
2742          AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
2743        fi
2744        ;;
2745   *)
2746        AC_MSG_RESULT(no)
2747        ;;
2748   esac ],
2749        AC_MSG_RESULT(no)
2750 )
2751
2752 dnl ************************************************************
2753 dnl disable cryptographic authentication
2754 dnl
2755 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
2756 AC_ARG_ENABLE(crypto-auth,
2757 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
2758 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
2759 [ case "$enableval" in
2760   no)
2761        AC_MSG_RESULT(no)
2762        AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
2763        ;;
2764   *)   AC_MSG_RESULT(yes)
2765        ;;
2766   esac ],
2767        AC_MSG_RESULT(yes)
2768 )
2769
2770 dnl ************************************************************
2771 dnl disable TLS-SRP authentication
2772 dnl
2773 AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
2774 AC_ARG_ENABLE(tls-srp,
2775 AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
2776 AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
2777 [ case "$enableval" in
2778   no)
2779        AC_MSG_RESULT(no)
2780        AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
2781        want_tls_srp=no
2782        ;;
2783   *)   AC_MSG_RESULT(yes)
2784        want_tls_srp=yes
2785        ;;
2786   esac ],
2787        AC_MSG_RESULT(yes)
2788        want_tls_srp=yes
2789 )
2790
2791 if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_SSLEAY_SRP" = "x1") ; then
2792    AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
2793    USE_TLS_SRP=1
2794    curl_tls_srp_msg="enabled"
2795 fi
2796
2797 dnl ************************************************************
2798 dnl disable cookies support
2799 dnl
2800 AC_MSG_CHECKING([whether to enable support for cookies])
2801 AC_ARG_ENABLE(cookies,
2802 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
2803 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
2804 [ case "$enableval" in
2805   no)
2806        AC_MSG_RESULT(no)
2807        AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
2808        ;;
2809   *)   AC_MSG_RESULT(yes)
2810        ;;
2811   esac ],
2812        AC_MSG_RESULT(yes)
2813 )
2814
2815 dnl ************************************************************
2816 dnl Enable hiding of internal symbols in library to reduce its size and
2817 dnl speed dynamic linking of applications.  This currently is only supported
2818 dnl on gcc >= 4.0 and SunPro C.
2819 dnl
2820 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
2821 AC_ARG_ENABLE(hidden-symbols,
2822 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
2823 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
2824 [ case "$enableval" in
2825   no)
2826        AC_MSG_RESULT(no)
2827        ;;
2828   *)
2829        AC_MSG_CHECKING([whether $CC supports it])
2830        if test "$GCC" = yes ; then
2831          if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ||
2832            dnl clang always supports -fvisibility= but it doesn't show up
2833            dnl under --help.
2834            test "$compiler_id" = "CLANG"; then
2835            AC_MSG_RESULT(yes)
2836            AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2837            AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
2838            CFLAGS="$CFLAGS -fvisibility=hidden"
2839          else
2840             AC_MSG_RESULT(no)
2841           fi
2842
2843        else
2844          dnl Test for SunPro cc
2845          if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
2846            AC_MSG_RESULT(yes)
2847            AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2848            AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
2849            CFLAGS="$CFLAGS -xldscope=hidden"
2850          else
2851            AC_MSG_RESULT(no)
2852          fi
2853        fi
2854        ;;
2855   esac ],
2856        AC_MSG_RESULT(no)
2857 )
2858
2859 dnl ************************************************************
2860 dnl enforce SONAME bump
2861 dnl
2862
2863 AC_MSG_CHECKING([whether to enforce SONAME bump])
2864 AC_ARG_ENABLE(soname-bump,
2865 AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
2866 AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
2867 [ case "$enableval" in
2868   yes)   AC_MSG_RESULT(yes)
2869          soname_bump=yes
2870          ;;
2871   *)
2872          AC_MSG_RESULT(no)
2873          ;;
2874   esac ],
2875         AC_MSG_RESULT($soname_bump)
2876 )
2877 AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
2878
2879
2880 dnl ************************************************************
2881 if test ! -z "$winsock_LIB"; then
2882
2883   dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
2884   dnl things work when built with c-ares). But we can't just move it last
2885   dnl since then other stuff (SSL) won't build. So we simply append it to the
2886   dnl end.
2887
2888   LIBS="$LIBS $winsock_LIB"
2889   TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
2890
2891 fi
2892
2893 dnl
2894 dnl All the library dependencies put into $LIB apply to libcurl only.
2895 dnl Those in $CURL_LIBS apply to the curl command-line client only.
2896 dnl Those in $TEST_SERVER_LIBS apply to test servers only.
2897 dnl Those in $ALL_LIBS apply to all targets, including test targets.
2898 dnl
2899 LIBCURL_LIBS=$LIBS
2900
2901 AC_SUBST(LIBCURL_LIBS)
2902 AC_SUBST(CURL_LIBS)
2903 AC_SUBST(TEST_SERVER_LIBS)
2904 AC_SUBST(CURL_NETWORK_LIBS)
2905 LIBS=$ALL_LIBS  dnl LIBS is a magic variable that's used for every link
2906
2907 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
2908
2909 dnl yes or no
2910 ENABLE_SHARED="$enable_shared"
2911 AC_SUBST(ENABLE_SHARED)
2912
2913 dnl
2914 dnl For keeping supported features and protocols also in pkg-config file
2915 dnl since it is more cross-compile frient than curl-config
2916 dnl
2917
2918 if test "x$USE_SSLEAY" = "x1"; then
2919   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2920 elif test -n "$SSL_ENABLED"; then
2921   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2922 fi
2923 if test "@KRB4_ENABLED@" = "x1"; then
2924   SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
2925 fi
2926 if test "x$IPV6_ENABLED" = "x1"; then
2927   SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
2928 fi
2929 if test "x$HAVE_LIBZ" = "x1"; then
2930   SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
2931 fi
2932 if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
2933   SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
2934 fi
2935 if test "x$IDN_ENABLED" = "x1"; then
2936   SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
2937 fi
2938 if test "x$USE_WINDOWS_SSPI" = "x1"; then
2939   SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
2940 fi
2941 if test "x$CURL_DISABLE_HTTP" != "x1"; then
2942   if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
2943       -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1"; then
2944     SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
2945   fi
2946 fi
2947 if test "x$USE_TLS_SRP" = "x1"; then
2948   SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
2949 fi
2950
2951 AC_SUBST(SUPPORT_FEATURES)
2952
2953 dnl For supported protocols in pkg-config file
2954 if test "x$CURL_DISABLE_HTTP" != "x1"; then
2955   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
2956   if test "x$SSL_ENABLED" = "x1"; then
2957     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
2958   fi
2959 fi
2960 if test "x$CURL_DISABLE_FTP" != "x1"; then
2961   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
2962   if test "x$SSL_ENABLED" = "x1"; then
2963     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
2964   fi
2965 fi
2966 if test "x$CURL_DISABLE_FILE" != "x1"; then
2967   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
2968 fi
2969 if test "x$CURL_DISABLE_TELNET" != "x1"; then
2970   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
2971 fi
2972 if test "x$CURL_DISABLE_LDAP" != "x1"; then
2973   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
2974   if test "x$CURL_DISABLE_LDAPS" != "x1"; then
2975     if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
2976       (test "x$USE_OPENLDAP" != "x1"  && test "x$HAVE_LDAP_SSL" = "x1"); then
2977       SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
2978     fi
2979   fi
2980 fi
2981 if test "x$CURL_DISABLE_DICT" != "x1"; then
2982   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
2983 fi
2984 if test "x$CURL_DISABLE_TFTP" != "x1"; then
2985   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
2986 fi
2987 if test "x$CURL_DISABLE_GOPHER" != "x1"; then
2988   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
2989 fi
2990 if test "x$CURL_DISABLE_POP3" != "x1"; then
2991   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
2992   if test "x$SSL_ENABLED" = "x1"; then
2993     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
2994   fi
2995 fi
2996 if test "x$CURL_DISABLE_IMAP" != "x1"; then
2997   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
2998   if test "x$SSL_ENABLED" = "x1"; then
2999     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
3000   fi
3001 fi
3002 if test "x$CURL_DISABLE_SMTP" != "x1"; then
3003   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
3004   if test "x$SSL_ENABLED" = "x1"; then
3005     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
3006   fi
3007 fi
3008 if test "x$USE_LIBSSH2" = "x1"; then
3009   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
3010   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
3011 fi
3012 if test "x$CURL_DISABLE_RTSP" != "x1"; then
3013   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
3014 fi
3015 if test "x$USE_LIBRTMP" = "x1"; then
3016   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
3017 fi
3018
3019 dnl replace spaces with newlines
3020 dnl sort the lines
3021 dnl replace the newlines back to spaces
3022 SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
3023
3024 AC_SUBST(SUPPORT_PROTOCOLS)
3025
3026 dnl squeeze whitespace out of some variables
3027
3028 squeeze CFLAGS
3029 squeeze CPPFLAGS
3030 squeeze DEFS
3031 squeeze LDFLAGS
3032 squeeze LIBS
3033
3034 squeeze CURL_LIBS
3035 squeeze LIBCURL_LIBS
3036 squeeze TEST_SERVER_LIBS
3037 squeeze CURL_NETWORK_LIBS
3038
3039 squeeze SUPPORT_FEATURES
3040 squeeze SUPPORT_PROTOCOLS
3041
3042 if test "x$want_curldebug_assumed" = "xyes" &&
3043   test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
3044   ac_configure_args="$ac_configure_args --enable-curldebug"
3045 fi
3046
3047 AC_CONFIG_FILES([Makefile \
3048            docs/Makefile \
3049            docs/examples/Makefile \
3050            docs/libcurl/Makefile \
3051            include/Makefile \
3052            include/curl/Makefile \
3053            src/Makefile \
3054            lib/Makefile \
3055            tests/Makefile \
3056            tests/data/Makefile \
3057            tests/server/Makefile \
3058            tests/libtest/Makefile \
3059            tests/unit/Makefile \
3060            packages/Makefile \
3061            packages/Win32/Makefile \
3062            packages/Win32/cygwin/Makefile \
3063            packages/Linux/Makefile \
3064            packages/Linux/RPM/Makefile \
3065            packages/Linux/RPM/curl.spec \
3066            packages/Linux/RPM/curl-ssl.spec \
3067            packages/Solaris/Makefile \
3068            packages/EPM/curl.list \
3069            packages/EPM/Makefile \
3070            packages/vms/Makefile \
3071            packages/AIX/Makefile \
3072            packages/AIX/RPM/Makefile \
3073            packages/AIX/RPM/curl.spec \
3074            curl-config \
3075            libcurl.pc
3076 ])
3077 AC_OUTPUT
3078
3079 CURL_GENERATE_CONFIGUREHELP_PM
3080
3081 AC_MSG_NOTICE([Configured to build curl/libcurl:
3082
3083   curl version:    ${CURLVERSION}
3084   Host setup:      ${host}
3085   Install prefix:  ${prefix}
3086   Compiler:        ${CC}
3087   SSL support:     ${curl_ssl_msg}
3088   SSH support:     ${curl_ssh_msg}
3089   zlib support:    ${curl_zlib_msg}
3090   krb4 support:    ${curl_krb4_msg}
3091   GSSAPI support:  ${curl_gss_msg}
3092   SPNEGO support:  ${curl_spnego_msg}
3093   TLS-SRP support: ${curl_tls_srp_msg}
3094   resolver:        ${curl_res_msg}
3095   ipv6 support:    ${curl_ipv6_msg}
3096   IDN support:     ${curl_idn_msg}
3097   Build libcurl:   Shared=${enable_shared}, Static=${enable_static}
3098   Built-in manual: ${curl_manual_msg}
3099   Verbose errors:  ${curl_verbose_msg}
3100   SSPI support:    ${curl_sspi_msg}
3101   ca cert bundle:  ${ca}
3102   ca cert path:    ${capath}
3103   LDAP support:    ${curl_ldap_msg}
3104   LDAPS support:   ${curl_ldaps_msg}
3105   RTSP support:    ${curl_rtsp_msg}
3106   RTMP support:    ${curl_rtmp_msg}
3107   Protocols:       ${SUPPORT_PROTOCOLS}
3108 ])
3109
3110 if test "x$soname_bump" = "xyes"; then
3111
3112 cat <<EOM
3113   SONAME bump:     yes - WARNING: this library will be built with the SONAME
3114                    number bumped due to (a detected) ABI breakage.
3115                    See lib/README.curl_off_t for details on this.
3116 EOM
3117
3118 fi
3119