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