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