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