1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
22 #***************************************************************************
23 dnl Process this file with autoconf to produce a configure script.
27 dnl We don't know the version number "statically" so we use a dash here
28 AC_INIT([curl], [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
30 dnl configure script copyright
31 AC_COPYRIGHT([Copyright (c) 1998 - 2008 Daniel Stenberg, <daniel@haxx.se>
32 This configure script may be copied, distributed and modified under the
33 terms of the curl license; see COPYING for more details])
35 AC_CONFIG_SRCDIR([lib/urldata.h])
36 AM_CONFIG_HEADER(lib/config.h src/config.h include/curl/curlbuild.h)
39 dnl SED is mandatory for configure process and libtool.
40 dnl Set it now, allowing it to be changed later.
41 AC_PATH_PROG([SED], [sed], [not_found],
42 [$PATH:/usr/bin:/usr/local/bin])
43 if test -z "$SED" || test "$SED" = "not_found"; then
44 AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
48 dnl GREP is mandatory for configure process and libtool.
49 dnl Set it now, allowing it to be changed later.
50 AC_PATH_PROG([GREP], [grep], [not_found],
51 [$PATH:/usr/bin:/usr/local/bin])
52 if test -z "$GREP" || test "$GREP" = "not_found"; then
53 AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
57 dnl EGREP is mandatory for configure process and libtool.
58 dnl Set it now, allowing it to be changed later.
59 if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
60 AC_MSG_CHECKING([for egrep])
62 AC_MSG_RESULT([$EGREP])
64 AC_PATH_PROG([EGREP], [egrep], [not_found],
65 [$PATH:/usr/bin:/usr/local/bin])
67 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
68 AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
72 dnl AR is mandatory for configure process and libtool.
73 dnl This is target dependant, so check it as a tool.
74 AC_PATH_TOOL([AR], [ar], [not_found],
75 [$PATH:/usr/bin:/usr/local/bin])
76 if test -z "$AR" || test "$AR" = "not_found"; then
77 AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
83 dnl figure out the libcurl version
84 VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
85 AM_INIT_AUTOMAKE(curl,$VERSION)
86 AC_MSG_CHECKING([curl version])
87 AC_MSG_RESULT($VERSION)
90 dnl we extract the numerical version for curl-config only
91 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
94 dnl Solaris pkgadd support definitions
96 PKGADD_NAME="cURL - a client that groks URLs"
97 PKGADD_VENDOR="curl.haxx.se"
100 AC_SUBST(PKGADD_VENDOR)
103 dnl initialize all the info variables
104 curl_ssl_msg="no (--with-ssl / --with-gnutls)"
105 curl_ssh_msg="no (--with-libssh2)"
106 curl_zlib_msg="no (--with-zlib)"
107 curl_krb4_msg="no (--with-krb4*)"
108 curl_gss_msg="no (--with-gssapi)"
109 curl_spnego_msg="no (--with-spnego)"
110 curl_ares_msg="no (--enable-ares)"
111 curl_ipv6_msg="no (--enable-ipv6)"
112 curl_idn_msg="no (--with-libidn)"
113 curl_manual_msg="no (--enable-manual)"
114 curl_verbose_msg="enabled (--disable-verbose)"
115 curl_sspi_msg="no (--enable-sspi)"
116 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
117 curl_ldaps_msg="no (--enable-ldaps)"
120 dnl Save anything in $LIBS for later
125 dnl Detect the canonical host and target build environment
129 dnl Get system canonical name
130 AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
132 dnl Checks for programs.
135 dnl Our curl_off_t internal and external configure settings
136 CURL_CONFIGURE_CURL_OFF_T
138 dnl This defines _ALL_SOURCE for AIX
139 CURL_CHECK_AIX_ALL_SOURCE
141 dnl Our configure and build reentrant settings
142 CURL_CONFIGURE_REENTRANT
144 dnl check for how to do large files
147 dnl support building of Windows DLLs
150 dnl skip libtool C++ and Fortran compiler checks
151 m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
152 m4_defun([AC_PROG_CXX],[])
153 m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
154 m4_defun([AC_PROG_CXXCPP],[true])
155 m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
156 m4_defun([AC_PROG_F77],[])
158 dnl skip libtool C++ and Fortran linker checks
159 m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
160 m4_defun([AC_LIBTOOL_CXX],[])
161 m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
162 m4_defun([AC_LIBTOOL_CXXCPP],[true])
163 m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
164 m4_defun([AC_LIBTOOL_F77],[])
166 dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD
167 AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)])
169 x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
181 AC_MSG_CHECKING([if we need -no-undefined])
183 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
184 need_no_undefined=yes
190 AC_MSG_RESULT($need_no_undefined)
191 AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
193 AC_MSG_CHECKING([if we need -mimpure-text])
197 if test "$GCC" = "yes"; then
204 AC_MSG_RESULT($mimpure)
205 AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
206 AM_CONDITIONAL(STATICLIB, false)
208 AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
211 AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
213 AC_MSG_CHECKING([if we need CURL_STATICLIB])
214 if test "X$enable_shared" = "Xno"
216 AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
218 AM_CONDITIONAL(STATICLIB, true)
228 # Determine whether all dependent libraries must be specified when linking
229 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
235 AC_SUBST(REQUIRE_LIB_DEPS)
237 dnl The install stuff has already been taken care of by the automake stuff
241 dnl check if there's a way to force code inline
244 dnl **********************************************************************
245 dnl platform/compiler/architecture specific checks/flags
246 dnl **********************************************************************
248 ac_cv_compiler="unknown"
249 ac_cv_compiler_num="unknown"
251 AC_MSG_CHECKING([whether we are using the IBM C compiler])
252 CURL_CHECK_DEF([__IBMC__], [], [silent])
253 if test "$curl_cv_have_def___IBMC__" = "yes"; then
255 ac_cv_compiler="IBMC"
256 dnl Ensure that compiler optimizations are always thread-safe.
257 CFLAGS="$CFLAGS -qthreaded"
258 dnl Disable type based strict aliasing optimizations, using worst
259 dnl case aliasing assumptions when compiling. Type based aliasing
260 dnl would restrict the lvalues that could be safely used to access
262 CFLAGS="$CFLAGS -qnoansialias"
263 dnl Force compiler to stop after the compilation phase, without
264 dnl generating an object code file when compilation has errors.
265 CFLAGS="$CFLAGS -qhalt=e"
270 AC_MSG_CHECKING([whether we are using the Intel C compiler])
271 CURL_CHECK_DEF([__INTEL_COMPILER], [], [silent])
272 if test "$curl_cv_have_def___INTEL_COMPILER" = "yes"; then
275 ac_cv_compiler_num="$curl_cv_def___INTEL_COMPILER"
276 dnl On unix this compiler uses gcc's header files, so
277 dnl we select ANSI C89 dialect plus GNU extensions.
278 CPPFLAGS="$CPPFLAGS -std=gnu89"
279 if test "$ac_cv_compiler_num" -gt "600"; then
280 dnl Show errors, warnings, and remarks
281 CPPFLAGS="$CPPFLAGS -Wall"
282 dnl Perform extra compile-time code checking
283 CPPFLAGS="$CPPFLAGS -Wcheck"
285 dnl Change some warnings into errors
286 dnl #140: too many arguments in function call
287 dnl #147: declaration is incompatible with 'previous one'
288 dnl #165: too few arguments in function call
289 dnl #266: function declared implicitly
290 CPPFLAGS="$CPPFLAGS -we 140,147,165,266"
291 dnl Disable some remarks
292 dnl #279: controlling expression is constant
293 dnl #981: operands are evaluated in unspecified order
294 dnl #1469: "cc" clobber ignored
295 if test "$ac_cv_compiler_num" -lt "910"; then
296 CPPFLAGS="$CPPFLAGS -wd 279"
298 CPPFLAGS="$CPPFLAGS -wd 981,1469"
299 dnl Disable use of ANSI C aliasing rules in optimizations
300 CFLAGS="$CFLAGS -no-ansi-alias"
301 dnl Disable floating point optimizations
302 CFLAGS="$CFLAGS -fp-model precise -mp"
307 AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
308 CURL_CHECK_DEF([__DECC], [], [silent])
309 CURL_CHECK_DEF([__DECC_VER], [], [silent])
310 if test "$curl_cv_have_def___DECC" = "yes" &&
311 test "$curl_cv_have_def___DECC_VER" = "yes"; then
313 ac_cv_compiler="DECC"
314 dnl Select strict ANSI C compiler mode
315 CFLAGS="$CFLAGS -std1"
316 dnl Turn off optimizer ANSI C aliasing rules
317 CFLAGS="$CFLAGS -noansi_alias"
318 dnl Select a higher warning level than default level2
319 CFLAGS="$CFLAGS -msg_enable level3"
320 dnl Generate warnings for missing function prototypes
321 CFLAGS="$CFLAGS -warnprotos"
322 dnl Change some warnings into fatal errors
323 CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
328 AC_MSG_CHECKING([whether we are using the GNU C compiler])
329 CURL_CHECK_DEF([__GNUC__], [], [silent])
330 if test "$curl_cv_have_def___GNUC__" = "yes" &&
331 test "$ac_cv_compiler" = "unknown"; then
333 ac_cv_compiler="GNUC"
334 gccver=`$CC -dumpversion`
335 gccvhi=`echo $gccver | cut -d . -f1`
336 gccvlo=`echo $gccver | cut -d . -f2`
337 gccnum=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
338 ac_cv_compiler_num="$gccnum"
339 dnl this is a set of options we believe *ALL* gcc versions support:
340 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
341 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
342 if test "$ac_cv_compiler_num" -ge "207"; then
344 WARN="$WARN -Wmissing-declarations"
346 if test "$ac_cv_compiler_num" -gt "295"; then
347 dnl only if the compiler is newer than 2.95 since we got lots of
348 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
349 dnl gcc 2.95.4 on FreeBSD 4.9!
350 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
352 if test "$ac_cv_compiler_num" -ge "296"; then
353 dnl gcc 2.96 or later
354 WARN="$WARN -Wfloat-equal"
356 if test "$ac_cv_compiler_num" -gt "296"; then
357 dnl this option does not exist in 2.96
358 WARN="$WARN -Wno-format-nonliteral"
360 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
361 dnl on i686-Linux as it gives us heaps with false positives.
362 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
363 dnl over making it unusable for generic purposes. Let's not use it.
364 if test "$ac_cv_compiler_num" -ge "303"; then
365 dnl gcc 3.3 and later
366 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
368 if test "$ac_cv_compiler_num" -ge "304"; then
369 # try these on gcc 3.4
370 WARN="$WARN -Wdeclaration-after-statement"
372 for flag in $CPPFLAGS; do
375 dnl Include path, provide a -isystem option for the same dir
376 dnl to prevent warnings in those dirs. The -isystem was not very
377 dnl reliable on earlier gcc versions.
378 add=`echo $flag | sed 's/^-I/-isystem /g'`
383 CFLAGS="$CFLAGS $WARN"
384 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
391 x86_64*linux*|amd64*freebsd*|ia64*freebsd*)
393 if test "$ac_cv_compiler" = "ICC"; then
395 if test "$ac_cv_compiler_num" -ge "900" &&
396 test "$ac_cv_compiler_num" -lt "1000"; then
398 CFLAGS="$CFLAGS -i-dynamic"
401 if test "$ac_cv_compiler_num" -ge "1000"; then
402 dnl icc 10.X or later
403 CFLAGS="$CFLAGS -shared-intel"
411 CURL_CHECK_COMPILER_HALT_ON_ERROR
412 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
414 dnl **********************************************************************
415 dnl Compilation based checks should not be done before this point.
416 dnl **********************************************************************
418 dnl **********************************************************************
419 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
420 dnl and ws2tcpip.h take precedence over any other further checks which
421 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
422 dnl this specific header files. And do them before its results are used.
423 dnl **********************************************************************
425 CURL_CHECK_HEADER_WINDOWS
426 CURL_CHECK_NATIVE_WINDOWS
427 case X-"$ac_cv_native_windows" in
429 CURL_CHECK_HEADER_WINSOCK
430 CURL_CHECK_HEADER_WINSOCK2
431 CURL_CHECK_HEADER_WS2TCPIP
432 CURL_CHECK_HEADER_WINLDAP
433 CURL_CHECK_HEADER_WINBER
436 ac_cv_header_winsock_h="no"
437 ac_cv_header_winsock2_h="no"
438 ac_cv_header_ws2tcpip_h="no"
439 ac_cv_header_winldap_h="no"
440 ac_cv_header_winber_h="no"
443 CURL_CHECK_WIN32_LARGEFILE
445 dnl ************************************************************
446 dnl switch off particular protocols
448 AC_MSG_CHECKING([whether to support http])
450 AC_HELP_STRING([--enable-http],[Enable HTTP support])
451 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
452 [ case "$enableval" in
455 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
456 AC_MSG_WARN([disable HTTP disables FTP over proxy])
457 AC_SUBST(CURL_DISABLE_HTTP, [1])
459 *) AC_MSG_RESULT(yes)
464 AC_MSG_CHECKING([whether to support ftp])
466 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
467 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
468 [ case "$enableval" in
471 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
472 AC_SUBST(CURL_DISABLE_FTP, [1])
474 *) AC_MSG_RESULT(yes)
479 AC_MSG_CHECKING([whether to support file])
481 AC_HELP_STRING([--enable-file],[Enable FILE support])
482 AC_HELP_STRING([--disable-file],[Disable FILE support]),
483 [ case "$enableval" in
486 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
487 AC_SUBST(CURL_DISABLE_FILE, [1])
489 *) AC_MSG_RESULT(yes)
494 AC_MSG_CHECKING([whether to support ldap])
496 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
497 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
498 [ case "$enableval" in
501 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
502 AC_SUBST(CURL_DISABLE_LDAP, [1])
507 # Force no ldap. config/build process is broken for cygwin
508 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
509 AC_SUBST(CURL_DISABLE_LDAP, [1])
519 # Force no ldap. config/build process is broken for cygwin
520 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
521 AC_SUBST(CURL_DISABLE_LDAP, [1])
528 AC_MSG_CHECKING([whether to support ldaps])
530 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
531 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
532 [ case "$enableval" in
535 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
536 AC_SUBST(CURL_DISABLE_LDAPS, [1])
538 *) if test x$CURL_DISABLE_LDAP = x1 ; then
539 AC_MSG_RESULT(LDAP support needs to be enabled in order to enable LDAPS support!)
540 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
541 AC_SUBST(CURL_DISABLE_LDAPS, [1])
544 AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
545 curl_ldaps_msg="enabled"
550 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
551 AC_SUBST(CURL_DISABLE_LDAPS, [1])
554 AC_MSG_CHECKING([whether to support proxies])
556 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
557 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
558 [ case "$enableval" in
561 AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
562 AC_SUBST(CURL_DISABLE_PROXY, [1])
564 *) AC_MSG_RESULT(yes)
570 AC_MSG_CHECKING([whether to support dict])
572 AC_HELP_STRING([--enable-dict],[Enable DICT support])
573 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
574 [ case "$enableval" in
577 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
578 AC_SUBST(CURL_DISABLE_DICT, [1])
580 *) AC_MSG_RESULT(yes)
585 AC_MSG_CHECKING([whether to support telnet])
586 AC_ARG_ENABLE(telnet,
587 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
588 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
589 [ case "$enableval" in
592 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
593 AC_SUBST(CURL_DISABLE_TELNET, [1])
595 *) AC_MSG_RESULT(yes)
600 AC_MSG_CHECKING([whether to support tftp])
602 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
603 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
604 [ case "$enableval" in
607 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
608 AC_SUBST(CURL_DISABLE_TFTP, [1])
610 *) AC_MSG_RESULT(yes)
616 dnl **********************************************************************
617 dnl Check for built-in manual
618 dnl **********************************************************************
620 AC_MSG_CHECKING([whether to provide built-in manual])
621 AC_ARG_ENABLE(manual,
622 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
623 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
624 [ case "$enableval" in
628 *) AC_MSG_RESULT(yes)
635 dnl The actual use of the USE_MANUAL variable is done much later in this
636 dnl script to allow other actions to disable it as well.
638 dnl **********************************************************************
639 dnl Checks for libraries.
640 dnl **********************************************************************
642 dnl gethostbyname without lib or in the nsl lib?
643 AC_CHECK_FUNC(gethostbyname,
644 [HAVE_GETHOSTBYNAME="1"
646 [ AC_CHECK_LIB(nsl, gethostbyname,
647 [HAVE_GETHOSTBYNAME="1"
652 if test "$HAVE_GETHOSTBYNAME" != "1"
654 dnl gethostbyname in the socket lib?
655 AC_CHECK_LIB(socket, gethostbyname,
656 [HAVE_GETHOSTBYNAME="1"
657 LIBS="$LIBS -lsocket"
661 dnl At least one system has been identified to require BOTH nsl and socket
662 dnl libs at the same time to link properly.
663 if test "$HAVE_GETHOSTBYNAME" != "1"
665 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
666 my_ac_save_LIBS=$LIBS
667 LIBS="-lnsl -lsocket $LIBS"
675 HAVE_GETHOSTBYNAME="1"
678 LIBS=$my_ac_save_LIBS
682 if test "$HAVE_GETHOSTBYNAME" != "1"
684 dnl This is for winsock systems
685 if test "$ac_cv_header_windows_h" = "yes"; then
686 if test "$ac_cv_header_winsock_h" = "yes"; then
689 winsock_LIB="-lwinsock"
692 winsock_LIB="-lwsock32"
696 if test "$ac_cv_header_winsock2_h" = "yes"; then
697 winsock_LIB="-lws2_32"
699 if test ! -z "$winsock_LIB"; then
700 my_ac_save_LIBS=$LIBS
701 LIBS="$winsock_LIB $LIBS"
702 AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
705 #ifdef HAVE_WINDOWS_H
706 #ifndef WIN32_LEAN_AND_MEAN
707 #define WIN32_LEAN_AND_MEAN
710 #ifdef HAVE_WINSOCK2_H
711 #include <winsock2.h>
713 #ifdef HAVE_WINSOCK_H
719 gethostbyname("www.dummysite.com");
723 HAVE_GETHOSTBYNAME="1"
727 LIBS=$my_ac_save_LIBS
733 if test "$HAVE_GETHOSTBYNAME" != "1"
735 dnl This is for Minix 3.1
736 AC_MSG_CHECKING([for gethostbyname for Minix 3])
739 /* Older Minix versions may need <net/gen/netdb.h> here instead */
742 gethostbyname("www.dummysite.com");
746 HAVE_GETHOSTBYNAME="1"
752 if test "$HAVE_GETHOSTBYNAME" != "1"
754 dnl This is for eCos with a stubbed DNS implementation
755 AC_MSG_CHECKING([for gethostbyname for eCos])
761 gethostbyname("www.dummysite.com");
765 HAVE_GETHOSTBYNAME="1"
771 if test "$HAVE_GETHOSTBYNAME" != "1"
773 dnl gethostbyname in the network lib - for Haiku OS
774 AC_CHECK_LIB(network, gethostbyname,
775 [HAVE_GETHOSTBYNAME="1"
776 LIBS="$LIBS -lnetwork"
780 if test "$HAVE_GETHOSTBYNAME" != "1"
782 dnl gethostbyname in the net lib - for BeOS
783 AC_CHECK_LIB(net, gethostbyname,
784 [HAVE_GETHOSTBYNAME="1"
790 if test "$HAVE_GETHOSTBYNAME" = "1"; then
791 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
793 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
797 AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
799 if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
800 AC_CHECK_LIB(resolve, strcasecmp,
801 [LIBS="-lresolve $LIBS"],
805 ac_cv_func_strcasecmp="no"
808 AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
810 dnl **********************************************************************
811 dnl In case that function clock_gettime with monotonic timer is available,
812 dnl check for additional required libraries.
813 dnl **********************************************************************
814 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
816 dnl **********************************************************************
817 dnl The preceding library checks are all potentially useful for test
818 dnl servers (for providing networking support). Save the list of required
819 dnl libraries at this point for use while linking those test servers.
820 dnl **********************************************************************
821 TEST_SERVER_LIBS=$LIBS
823 dnl **********************************************************************
824 AC_MSG_CHECKING([whether to use libgcc])
825 AC_ARG_ENABLE(libgcc,
826 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
827 [ case "$enableval" in
829 ALL_LIBS="$ALL_LIBS -lgcc"
838 dnl **********************************************************************
840 dnl **********************************************************************
843 AC_ARG_WITH(ldap-lib,
844 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
845 [LDAPLIBNAME="$withval"])
848 AC_ARG_WITH(lber-lib,
849 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
850 [LBERLIBNAME="$withval"])
852 if test x$CURL_DISABLE_LDAP != x1 ; then
854 CURL_CHECK_HEADER_LBER
855 CURL_CHECK_HEADER_LDAP
856 CURL_CHECK_HEADER_LDAPSSL
857 CURL_CHECK_HEADER_LDAP_SSL
859 if test -z "$LDAPLIBNAME" ; then
861 *-*-cygwin* | *-*-mingw* | *-*-pw32*)
862 dnl Windows uses a single and unique OpenLDAP DLL name
863 LDAPLIBNAME="wldap32"
869 if test "$LDAPLIBNAME" ; then
870 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
871 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
872 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
873 AC_SUBST(CURL_DISABLE_LDAP, [1])])
874 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
875 AC_SUBST(CURL_DISABLE_LDAPS, [1])
877 dnl Try to find the right ldap libraries for this system
879 case X-"$curl_cv_ldap_LIBS" in
881 AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
882 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
883 AC_SUBST(CURL_DISABLE_LDAP, [1])
884 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
885 AC_SUBST(CURL_DISABLE_LDAPS, [1])
891 if test x$CURL_DISABLE_LDAP != x1 ; then
893 if test "$LBERLIBNAME" ; then
894 dnl If name is "no" then don't define this library at all
895 dnl (it's only needed if libldap.so's dependencies are broken).
896 if test "$LBERLIBNAME" != "no" ; then
897 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
898 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
899 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
900 AC_SUBST(CURL_DISABLE_LDAP, [1])])
901 AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
902 AC_SUBST(CURL_DISABLE_LDAPS, [1])
907 if test x$CURL_DISABLE_LDAP != x1 ; then
908 AC_CHECK_FUNCS([ldap_url_parse])
910 if test "$LDAPLIBNAME" = "wldap32"; then
911 curl_ldap_msg="enabled (winldap)"
912 AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
914 *-*-cygwin* | *-*-pw32*)
915 AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
919 curl_ldap_msg="enabled (OpenLDAP)"
923 dnl **********************************************************************
925 dnl **********************************************************************
927 AC_MSG_CHECKING([whether to enable ipv6])
929 AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
930 AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
931 [ case "$enableval" in
936 *) AC_MSG_RESULT(yes)
941 AC_TRY_RUN([ /* is AF_INET6 available? */
942 #include <sys/types.h>
943 #include <sys/socket.h>
946 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
960 if test "$ipv6" = "yes"; then
961 curl_ipv6_msg="enabled"
964 dnl **********************************************************************
965 dnl Check how non-blocking sockets are set
966 dnl **********************************************************************
967 AC_ARG_ENABLE(nonblocking,
968 AC_HELP_STRING([--enable-nonblocking],[Enable detecting how to do it])
969 AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
971 if test "$enableval" = "no" ; then
972 AC_MSG_WARN([non-blocking sockets disabled])
973 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
974 [to disable NON-BLOCKING connections])
976 CURL_CHECK_NONBLOCKING_SOCKET
980 CURL_CHECK_NONBLOCKING_SOCKET
983 dnl **********************************************************************
984 dnl Check if the operating system allows programs to write to their own argv[]
985 dnl **********************************************************************
987 AC_MSG_CHECKING([if argv can be written to])
988 AC_CACHE_VAL(curl_cv_writable_argv, [
990 int main(int argc, char ** argv) {
992 return (argv[0][0] == ' ')?0:1;
995 curl_cv_writable_argv=yes,
996 curl_cv_writable_argv=no,
997 curl_cv_writable_argv=cross)
999 case $curl_cv_writable_argv in
1001 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
1009 AC_MSG_WARN([the previous check could not be made default was used])
1013 dnl **********************************************************************
1014 dnl Check for the presence of Kerberos4 libraries and headers
1015 dnl **********************************************************************
1017 AC_ARG_WITH(krb4-includes,
1018 AC_HELP_STRING([--with-krb4-includes=DIR],
1019 [Specify location of kerberos4 headers]),[
1020 CPPFLAGS="$CPPFLAGS -I$withval"
1025 AC_ARG_WITH(krb4-libs,
1026 AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
1027 LDFLAGS="$LDFLAGS -L$withval"
1034 AC_ARG_WITH(krb4,dnl
1035 AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
1037 if test X"$OPT_KRB4" != Xno; then
1039 if test X"$OPT_KRB4" != Xyes; then
1040 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
1041 KRB4LIB="$OPT_KRB4/lib$libsuff"
1042 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
1043 KRB4INC="$OPT_KRB4/include"
1048 AC_MSG_CHECKING([if Kerberos4 support is requested])
1050 if test "$want_krb4" = yes
1052 if test "$ipv6" = "yes"; then
1053 echo krb4 is not compatible with IPv6
1058 dnl Check for & handle argument to --with-krb4
1060 AC_MSG_CHECKING(where to look for Kerberos4)
1061 if test X"$OPT_KRB4" = Xyes
1063 AC_MSG_RESULT([defaults])
1065 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
1068 dnl Check for DES library
1069 AC_CHECK_LIB(des, des_pcbc_encrypt,
1071 AC_CHECK_HEADERS(des.h)
1074 AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
1076 dnl Check for the Kerberos4 library
1077 AC_CHECK_LIB(krb, krb_net_read,
1079 dnl Check for header files
1080 AC_CHECK_HEADERS(krb.h)
1082 dnl we found the required libraries, add to LIBS
1083 LIBS="-lkrb -lcom_err -ldes $LIBS"
1085 dnl Check for function krb_get_our_ip_for_realm
1086 dnl this is needed for NAT networks
1087 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
1090 AC_DEFINE(HAVE_KRB4, 1,
1091 [if you have the Kerberos4 libraries (including -ldes)])
1093 dnl substitute it too!
1095 AC_SUBST(KRB4_ENABLED)
1097 curl_krb4_msg="enabled"
1099 dnl the krb4 stuff needs a strlcpy()
1100 AC_CHECK_FUNCS(strlcpy)
1108 dnl **********************************************************************
1109 dnl Check for FBopenssl(SPNEGO) libraries
1110 dnl **********************************************************************
1113 AC_HELP_STRING([--with-spnego=DIR],
1114 [Specify location of SPNEGO library fbopenssl]), [
1115 SPNEGO_ROOT="$withval"
1116 if test x"$SPNEGO_ROOT" != xno; then
1121 AC_MSG_CHECKING([if SPNEGO support is requested])
1122 if test x"$want_spnego" = xyes; then
1124 if test X"$SPNEGO_ROOT" = Xyes; then
1125 AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
1128 if test -z "$SPNEGO_LIB_DIR"; then
1129 LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
1131 LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
1135 AC_DEFINE(HAVE_SPNEGO, 1,
1136 [Define this if you have the SPNEGO library fbopenssl])
1137 curl_spnego_msg="enabled"
1143 dnl **********************************************************************
1144 dnl Check for GSS-API libraries
1145 dnl **********************************************************************
1147 dnl check for gss stuff in the /usr as default
1150 AC_ARG_WITH(gssapi-includes,
1151 AC_HELP_STRING([--with-gssapi-includes=DIR],
1152 [Specify location of GSSAPI header]),
1153 [ GSSAPI_INCS="-I$withval"
1157 AC_ARG_WITH(gssapi-libs,
1158 AC_HELP_STRING([--with-gssapi-libs=DIR],
1159 [Specify location of GSSAPI libs]),
1160 [ GSSAPI_LIB_DIR="-L$withval"
1165 AC_HELP_STRING([--with-gssapi=DIR],
1166 [Where to look for GSSAPI]), [
1167 GSSAPI_ROOT="$withval"
1168 if test x"$GSSAPI_ROOT" != xno; then
1170 if test x"$GSSAPI_ROOT" = xyes; then
1171 dnl if yes, then use default root
1177 save_CPPFLAGS="$CPPFLAGS"
1178 AC_MSG_CHECKING([if GSSAPI support is requested])
1179 if test x"$want_gss" = xyes; then
1182 if test -z "$GSSAPI_INCS"; then
1183 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1184 GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
1185 GSSAPI_LIBS=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1186 elif test "$GSSAPI_ROOT" != "yes"; then
1187 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
1188 GSSAPI_LIBS="-lgssapi"
1192 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
1193 LIBS="$LIBS $GSSAPI_LIBS"
1195 AC_CHECK_HEADER(gss.h,
1197 dnl found in the given dirs
1198 AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
1202 dnl not found, check Heimdal or MIT
1204 [gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
1207 if test "x$not_mit" = "x1"; then
1208 dnl MIT not found, check for Heimdal
1209 AC_CHECK_HEADER(gssapi.h,
1212 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
1215 dnl no header found, disabling GSS
1217 AC_MSG_WARN(disabling GSSAPI since no header files was found)
1222 AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
1223 dnl check if we have a really old MIT kerberos (<= 1.2)
1224 AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
1227 #include <gssapi/gssapi.h>
1228 #include <gssapi/gssapi_generic.h>
1229 #include <gssapi/gssapi_krb5.h>
1234 GSS_C_NT_HOSTBASED_SERVICE,
1238 AC_MSG_RESULT([yes])
1241 AC_DEFINE(HAVE_OLD_GSSMIT, 1,
1242 [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
1250 if test x"$want_gss" = xyes; then
1251 AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
1253 curl_gss_msg="enabled (MIT/Heimdal)"
1255 if test -n "$gnu_gss"; then
1256 curl_gss_msg="enabled (GNU GSS)"
1257 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1259 elif test -z "$GSSAPI_LIB_DIR"; then
1260 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
1261 dnl krb5-config doesn't have --libs-only-L or similar, put everything
1263 gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
1264 LIBS="$LIBS $gss_libs"
1265 elif test "$GSSAPI_ROOT" != "yes"; then
1266 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
1267 LIBS="$LIBS -lgssapi"
1269 LIBS="$LIBS -lgssapi"
1272 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
1273 LIBS="$LIBS -lgssapi"
1276 CPPFLAGS="$save_CPPFLAGS"
1279 dnl **********************************************************************
1280 dnl Check for the presence of SSL libraries and headers
1281 dnl **********************************************************************
1283 dnl Default to compiler & linker defaults for SSL files & libraries.
1285 dnl Default to no CA bundle
1288 AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1289 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
1292 if test X"$OPT_SSL" != Xno; then
1293 dnl backup the pre-ssl variables
1294 CLEANLDFLAGS="$LDFLAGS"
1295 CLEANCPPFLAGS="$CPPFLAGS"
1300 dnl --with-ssl (without path) used
1301 if test x$cross_compiling != xyes; then
1302 dnl only do pkg-config magic when not cross-compiling
1305 PREFIX_OPENSSL=/usr/local/ssl
1306 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1309 dnl no --with-ssl option given, just check default places
1310 if test x$cross_compiling != xyes; then
1311 dnl only do pkg-config magic when not cross-compiling
1317 dnl check the given --with-ssl spot
1319 PREFIX_OPENSSL=$OPT_SSL
1320 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
1321 LDFLAGS="$LDFLAGS -L$LIB_OPENSSL"
1322 CPPFLAGS="$CPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1326 if test "$PKGTEST" = "yes"; then
1328 dnl Detect the pkg-config tool, as it may have extra info about the
1329 dnl openssl installation we can use. I *believe* this is what we are
1330 dnl expected to do on really recent Redhat Linux hosts.
1332 AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
1333 if test "$PKGCONFIG" != "no" ; then
1334 AC_MSG_CHECKING([OpenSSL options with pkg-config])
1336 $PKGCONFIG --exists openssl
1339 if test "$SSL_EXISTS" -eq "0"; then
1340 SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
1341 SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
1342 SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
1344 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
1346 dnl use the values pkg-config reported
1347 LIBS="$LIBS $SSL_LIBS"
1348 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
1349 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
1350 AC_MSG_RESULT([found])
1357 dnl This is for Msys/Mingw
1359 *-*-msys* | *-*-mingw*)
1360 AC_MSG_CHECKING([for gdi32])
1361 my_ac_save_LIBS=$LIBS
1362 LIBS="-lgdi32 $LIBS"
1363 AC_TRY_LINK([#include <windef.h>
1364 #include <wingdi.h>],
1367 AC_MSG_RESULT([yes])],
1368 [ dnl failed, restore LIBS
1369 LIBS=$my_ac_save_LIBS
1375 AC_CHECK_LIB(crypto, CRYPTO_lock,[
1377 LIBS="-lcrypto $LIBS"
1379 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1380 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
1381 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
1383 LIBS="-lcrypto $LIBS"], [
1384 LDFLAGS="$CLEANLDFLAGS"
1385 CPPFLAGS="$CLEANCPPFLAGS"
1391 if test X"$HAVECRYPTO" = X"yes"; then
1392 dnl This is only reasonable to do if crypto actually is there: check for
1393 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
1395 AC_CHECK_LIB(ssl, SSL_connect)
1397 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1398 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1399 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1401 LIBS="$LIBS -lRSAglue -lrsaref"
1402 AC_CHECK_LIB(ssl, SSL_connect)
1403 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1404 dnl still no SSL_connect
1413 dnl Have the libraries--check for SSLeay/OpenSSL headers
1414 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1415 openssl/pem.h openssl/ssl.h openssl/err.h,
1416 curl_ssl_msg="enabled (OpenSSL)"
1418 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1420 if test $ac_cv_header_openssl_x509_h = no; then
1421 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1422 dnl since 'err.h' might in fact find a krb4 header with the same
1424 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1426 if test $ac_cv_header_x509_h = yes &&
1427 test $ac_cv_header_crypto_h = yes &&
1428 test $ac_cv_header_ssl_h = yes; then
1430 curl_ssl_msg="enabled (OpenSSL)"
1436 if test X"$OPENSSL_ENABLED" = X"1"; then
1437 AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
1439 dnl is there a pkcs12.h header present?
1440 AC_CHECK_HEADERS(openssl/pkcs12.h)
1444 dnl USE_SSLEAY is the historical name for what configure calls
1445 dnl OPENSSL_ENABLED; the names should really be unified
1446 USE_SSLEAY="$OPENSSL_ENABLED"
1447 AC_SUBST(USE_SSLEAY)
1449 if test X"$OPT_SSL" != Xoff &&
1450 test "$OPENSSL_ENABLED" != "1"; then
1451 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1455 if test X"$OPENSSL_ENABLED" = X"1"; then
1456 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
1457 dnl stuff, it is kind of "separated" from the main SSL check
1458 AC_CHECK_FUNC(ENGINE_init,
1460 AC_CHECK_HEADERS(openssl/engine.h)
1461 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1464 dnl these can only exist if openssl exists
1465 dnl yassl doesn't have SSL_get_shutdown
1467 AC_CHECK_FUNCS( RAND_status \
1470 CRYPTO_cleanup_all_ex_data \
1473 dnl Make an attempt to detect if this is actually yassl's headers and
1474 dnl OpenSSL emulation layer. We still leave everything else believing
1475 dnl and acting like OpenSSL.
1477 AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
1480 #include <openssl/ssl.h>
1482 #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
1483 int dummy = SSL_ERROR_NONE;
1485 Not the yaSSL OpenSSL compatibility header.
1489 AC_MSG_RESULT([yes])
1490 AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
1491 [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
1492 curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
1498 if test "$OPENSSL_ENABLED" = "1"; then
1499 if test -n "$LIB_OPENSSL"; then
1500 dnl when the ssl shared libs were found in a path that the run-time
1501 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1502 dnl to prevent further configure tests to fail due to this
1504 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1505 export LD_LIBRARY_PATH
1506 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1512 dnl **********************************************************************
1513 dnl Check for the presence of ZLIB libraries and headers
1514 dnl **********************************************************************
1516 dnl Check for & handle argument to --with-zlib.
1521 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
1522 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
1523 [OPT_ZLIB="$withval"])
1525 if test "$OPT_ZLIB" = "no" ; then
1526 AC_MSG_WARN([zlib disabled])
1528 if test "$OPT_ZLIB" = "yes" ; then
1532 if test -z "$OPT_ZLIB" ; then
1533 dnl check for the lib first without setting any new path, since many
1534 dnl people have it in the default path
1536 AC_CHECK_LIB(z, inflateEnd,
1537 dnl libz found, set the variable
1539 dnl if no lib found, try /usr/local
1540 [OPT_ZLIB="/usr/local"])
1544 dnl Add a nonempty path to the compiler flags
1545 if test -n "$OPT_ZLIB"; then
1546 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
1547 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
1550 AC_CHECK_HEADER(zlib.h,
1552 dnl zlib.h was found
1554 dnl if the lib wasn't found already, try again with the new paths
1555 if test "$HAVE_LIBZ" != "1"; then
1556 AC_CHECK_LIB(z, gzread,
1558 dnl the lib was found!
1561 [ CPPFLAGS=$_cppflags
1566 dnl zlib.h was not found, restore the flags
1571 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
1573 AC_MSG_WARN([configure found only the libz lib, not the header file!])
1575 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
1577 AC_MSG_WARN([configure found only the libz header file, not the lib!])
1578 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
1580 dnl both header and lib were found!
1582 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
1583 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
1585 CURL_LIBS="$CURL_LIBS -lz"
1588 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1590 AC_MSG_NOTICE([found both libz and libz.h header])
1591 curl_zlib_msg="enabled"
1595 dnl set variable for use in automakefile(s)
1596 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1598 dnl **********************************************************************
1599 dnl Check for the presence of LIBSSH2 libraries and headers
1600 dnl **********************************************************************
1602 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
1604 AC_ARG_WITH(libssh2,dnl
1605 AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
1606 AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
1607 OPT_LIBSSH2=$withval)
1609 if test X"$OPT_LIBSSH2" != Xno; then
1610 dnl backup the pre-libssh2 variables
1611 CLEANLDFLAGS="$LDFLAGS"
1612 CLEANCPPFLAGS="$CPPFLAGS"
1615 case "$OPT_LIBSSH2" in
1617 dnl --with-libssh2 (without path) used
1618 PREFIX_LIBSSH2=/usr/local/lib
1619 LIB_LIBSSH2="$PREFIX_LIBSSH2$libsuff"
1622 dnl no --with-libssh2 option given, just check default places
1626 dnl use the given --with-libssh2 spot
1627 PREFIX_LIBSSH2=$OPT_LIBSSH2
1628 LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
1629 LDFLAGS="$LDFLAGS -L$LIB_LIBSSH2"
1630 CPPFLAGS="$CPPFLAGS -I$PREFIX_LIBSSH2/include"
1634 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
1636 AC_CHECK_HEADERS(libssh2.h,
1637 curl_ssh_msg="enabled (libSSH2)"
1639 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
1640 AC_SUBST(USE_LIBSSH2, [1])
1643 if test X"$OPT_LIBSSH2" != Xoff &&
1644 test "$LIBSSH2_ENABLED" != "1"; then
1645 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
1648 if test "$LIBSSH2_ENABLED" = "1"; then
1649 if test -n "$LIB_LIBSSH2"; then
1650 dnl when the libssh2 shared libs were found in a path that the run-time
1651 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1652 dnl to prevent further configure tests to fail due to this
1654 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_LIBSSH2"
1655 export LD_LIBRARY_PATH
1656 AC_MSG_NOTICE([Added $LIB_LIBSSH2 to LD_LIBRARY_PATH])
1661 dnl **********************************************************************
1662 dnl Check for the random seed preferences
1663 dnl **********************************************************************
1665 if test X"$OPENSSL_ENABLED" = X"1"; then
1666 AC_ARG_WITH(egd-socket,
1667 AC_HELP_STRING([--with-egd-socket=FILE],
1668 [Entropy Gathering Daemon socket pathname]),
1669 [ EGD_SOCKET="$withval" ]
1671 if test -n "$EGD_SOCKET" ; then
1672 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1673 [your Entropy Gathering Daemon socket pathname] )
1676 dnl Check for user-specified random device
1678 AC_HELP_STRING([--with-random=FILE],
1679 [read randomness from FILE (default=/dev/urandom)]),
1680 [ RANDOM_FILE="$withval" ],
1682 dnl Check for random device
1683 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1686 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1687 AC_SUBST(RANDOM_FILE)
1688 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1689 [a suitable file to read random data from])
1693 dnl ----------------------------------------------------
1694 dnl FIX: only check for GnuTLS if OpenSSL is not enabled
1695 dnl ----------------------------------------------------
1697 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
1700 AC_ARG_WITH(gnutls,dnl
1701 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
1702 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1703 OPT_GNUTLS=$withval)
1705 if test "$OPENSSL_ENABLED" != "1"; then
1707 if test X"$OPT_GNUTLS" != Xno; then
1708 if test "x$OPT_GNUTLS" = "xyes"; then
1709 check=`libgnutls-config --version 2>/dev/null`
1710 if test -n "$check"; then
1711 addlib=`libgnutls-config --libs`
1712 addcflags=`libgnutls-config --cflags`
1713 version=`libgnutls-config --version`
1714 gtlsprefix=`libgnutls-config --prefix`
1717 addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
1718 addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
1719 version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
1720 gtlsprefix=$OPT_GNUTLS
1721 if test -z "$version"; then
1725 if test -n "$addlib"; then
1728 CLEANCPPFLAGS="$CPPFLAGS"
1730 LIBS="$LIBS $addlib"
1731 if test "$addcflags" != "-I/usr/include"; then
1732 CPPFLAGS="$CPPFLAGS $addcflags"
1735 AC_CHECK_LIB(gnutls, gnutls_check_version,
1737 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1738 AC_SUBST(USE_GNUTLS, [1])
1741 curl_ssl_msg="enabled (GnuTLS)"
1745 CPPFLAGS="$CLEANCPPFLAGS"
1748 if test "x$USE_GNUTLS" = "xyes"; then
1749 AC_MSG_NOTICE([detected GnuTLS version $version])
1751 dnl when shared libs were found in a path that the run-time
1752 dnl linker doesn't search through, we need to add it to
1753 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1756 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
1757 export LD_LIBRARY_PATH
1758 AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
1763 fi dnl GNUTLS not disabled
1767 dnl ----------------------------------------------------
1768 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
1769 dnl ----------------------------------------------------
1771 dnl Default to compiler & linker defaults for NSS files & libraries.
1775 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)])
1776 AC_HELP_STRING([--without-nss], [disable NSS detection]),
1779 if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
1781 if test X"$OPT_NSS" != Xno; then
1782 if test "x$OPT_NSS" = "xyes"; then
1783 check=`pkg-config --version 2>/dev/null`
1784 if test -n "$check"; then
1785 addlib=`pkg-config --libs nss`
1786 addcflags=`pkg-config --cflags nss`
1787 version=`pkg-config --modversion nss`
1788 nssprefix=`pkg-config --variable=prefix nss`
1791 # Without pkg-config, we'll kludge in some defaults
1792 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
1793 addcflags="-I$OPT_NSS/include"
1795 gtlsprefix=$OPT_GNUTLS
1798 dnl Check for functionPK11_CreateGenericObject
1799 dnl this is needed for using the PEM PKCS#11 module
1800 AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
1802 AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject])
1803 AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1])
1805 if test -n "$addlib"; then
1808 CLEANCPPFLAGS="$CPPFLAGS"
1810 LIBS="$LIBS $addlib"
1811 if test "$addcflags" != "-I/usr/include"; then
1812 CPPFLAGS="$CPPFLAGS $addcflags"
1815 AC_CHECK_LIB(nss3, NSS_Initialize,
1817 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
1818 AC_SUBST(USE_NSS, [1])
1821 curl_ssl_msg="enabled (NSS)"
1825 CPPFLAGS="$CLEANCPPFLAGS"
1828 if test "x$USE_NSS" = "xyes"; then
1829 AC_MSG_NOTICE([detected NSS version $version])
1831 dnl when shared libs were found in a path that the run-time
1832 dnl linker doesn't search through, we need to add it to
1833 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1836 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
1837 export LD_LIBRARY_PATH
1838 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
1843 fi dnl NSS not disabled
1845 fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
1847 if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
1848 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
1849 AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
1851 # SSL is enabled, genericly
1852 AC_SUBST(SSL_ENABLED)
1856 dnl **********************************************************************
1857 dnl Check for the CA bundle
1858 dnl **********************************************************************
1860 CURL_CHECK_CA_BUNDLE
1862 dnl **********************************************************************
1863 dnl Check for the presence of IDN libraries and headers
1864 dnl **********************************************************************
1866 AC_MSG_CHECKING([whether to build with libidn])
1868 AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
1869 AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
1870 [LIBIDN="$withval"])
1876 *) AC_MSG_RESULT(yes)
1879 dnl if there is a given path, check that FIRST
1880 if test -n "$LIBIDN"; then
1881 if test "x$LIBIDN" != "xyes"; then
1883 oldCPPFLAGS=$CPPFLAGS
1884 LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
1885 CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
1887 AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
1890 CPPFLAGS=$oldCPPFLAGS)
1894 if test "x$idn" != "xyes"; then
1895 dnl check with default paths
1897 AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
1901 if test "x$idn" = "xyes"; then
1902 curl_idn_msg="enabled"
1903 AC_SUBST(IDN_ENABLED, [1])
1904 dnl different versions of libidn have different setups of these:
1905 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
1906 AC_CHECK_HEADERS( idn-free.h tld.h )
1912 dnl Default is to try the thread-safe versions of a few functions
1915 dnl detect AIX 4.3 or later
1916 dnl see full docs on this reasoning in the lib/hostip.c source file
1917 AC_MSG_CHECKING([AIX 4.3 or later])
1919 #if defined(_AIX) && defined(_AIX43)
1920 printf("just fine");
1922 #error "this is not AIX 4.3 or later"
1925 [ AC_MSG_RESULT([yes])
1928 [ AC_MSG_RESULT([no]) ]
1931 AC_ARG_ENABLE(thread,dnl
1932 AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
1933 AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
1934 [ case "$enableval" in
1937 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
1945 if test X"$OPT_THREAD" = Xoff
1947 AC_DEFINE(DISABLED_THREADSAFE, 1,
1948 [Set to explicitly specify we don't want to use thread-safe functions])
1950 dnl if test "$ipv6" != "yes"; then
1951 dnl dig around for gethostbyname_r()
1952 dnl the old gethostbyname_r check was done here
1954 dnl dig around for gethostbyaddr_r()
1955 dnl the old gethostbyaddr_r check was here BUT COMMENTED OUT
1958 dnl poke around for inet_ntoa_r()
1959 dnl the old inet_ntoa_r check was done here
1961 dnl is there a localtime_r()
1962 dnl the old localtime_r check was done here
1964 dnl is there a strerror_r()
1965 dnl the old strerror_r check was done here
1967 checkfor_gmtime_r="yes"
1970 dnl for recent AIX versions, we skip all the thread-safe checks above since
1971 dnl they claim a thread-safe libc using the standard API. But there are
1972 dnl some functions still not thread-safe. Check for these!
1974 dnl Let's hope this split URL remains working:
1975 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
1976 dnl genprogc/thread_quick_ref.htm
1978 if test "x$RECENTAIX" = "xyes"; then
1980 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
1982 dnl is there a localtime_r()
1983 dnl the old localtime_r check was done here
1985 dnl is there a strerror_r()
1986 dnl the old strerror_r check was done here
1988 checkfor_gmtime_r="yes"
1992 dnl **********************************************************************
1993 dnl Back to "normal" configuring
1994 dnl **********************************************************************
1996 dnl Checks for header files.
1999 CURL_CHECK_HEADER_MALLOC
2001 dnl Now check for the very most basic headers. Then we can use these
2002 dnl ones as default-headers when checking for the rest!
2043 dnl to do if not found
2047 dnl default includes
2049 #ifdef HAVE_SYS_TYPES_H
2050 #include <sys/types.h>
2052 #ifdef HAVE_SYS_TIME_H
2053 #include <sys/time.h>
2055 #ifdef HAVE_SYS_SELECT_H
2056 #include <sys/select.h>
2058 #ifdef HAVE_SYS_SOCKET_H
2059 #include <sys/socket.h>
2061 #ifdef HAVE_NETINET_IN_H
2062 #include <netinet/in.h>
2064 #ifdef HAVE_SYS_UN_H
2070 dnl Checks for typedefs, structures, and compiler characteristics.
2072 CURL_CHECK_VARIADIC_MACROS
2075 CURL_CHECK_STRUCT_TIMEVAL
2076 CURL_VERIFY_RUNTIMELIBS
2078 AC_CHECK_SIZEOF(size_t)
2079 AC_CHECK_SIZEOF(int)
2080 AC_CHECK_SIZEOF(long)
2082 AC_CHECK_SIZEOF(time_t)
2083 AC_CHECK_SIZEOF(off_t)
2086 if test x"$ac_cv_native_windows" != "xyes" &&
2087 test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
2088 AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
2089 AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
2094 AC_CHECK_TYPE(long long,
2095 [AC_DEFINE(HAVE_LONGLONG, 1,
2096 [Define to 1 if the compiler supports the 'long long' data type.])]
2100 if test "xyes" = "x$longlong"; then
2101 AC_MSG_CHECKING([if numberLL works])
2102 AC_COMPILE_IFELSE([long long val = 1000LL;],
2103 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
2111 AC_CHECK_TYPE(ssize_t, ,
2112 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
2114 # check for bool type
2115 AC_CHECK_TYPE([bool],[
2116 AC_DEFINE(HAVE_BOOL_T, 1,
2117 [Define to 1 if bool is an available type.])
2119 #ifdef HAVE_SYS_TYPES_H
2120 #include <sys/types.h>
2122 #ifdef HAVE_STDBOOL_H
2123 #include <stdbool.h>
2127 # Check for socklen_t or equivalent
2128 CURL_CHECK_TYPE_SOCKLEN_T
2132 TYPE_SOCKADDR_STORAGE
2138 CURL_CHECK_FUNC_SELECT
2140 CURL_CHECK_FUNC_RECV
2141 CURL_CHECK_FUNC_RECVFROM
2142 CURL_CHECK_FUNC_SEND
2143 CURL_CHECK_MSG_NOSIGNAL
2145 CURL_CHECK_FUNC_ALARM
2146 CURL_CHECK_FUNC_FDOPEN
2147 CURL_CHECK_FUNC_FTRUNCATE
2148 CURL_CHECK_FUNC_GETHOSTBYADDR_R
2149 CURL_CHECK_FUNC_GETHOSTBYNAME_R
2150 CURL_CHECK_FUNC_GETHOSTNAME
2151 CURL_CHECK_FUNC_GETSERVBYPORT_R
2152 CURL_CHECK_FUNC_GMTIME_R
2153 CURL_CHECK_FUNC_INET_NTOA_R
2154 CURL_CHECK_FUNC_INET_NTOP
2155 CURL_CHECK_FUNC_INET_PTON
2156 CURL_CHECK_FUNC_LOCALTIME_R
2157 CURL_CHECK_FUNC_SIGACTION
2158 CURL_CHECK_FUNC_SIGINTERRUPT
2159 CURL_CHECK_FUNC_SIGNAL
2160 CURL_CHECK_FUNC_SIGSETJMP
2161 CURL_CHECK_FUNC_STRCASECMP
2162 CURL_CHECK_FUNC_STRCASESTR
2163 CURL_CHECK_FUNC_STRCMPI
2164 CURL_CHECK_FUNC_STRDUP
2165 CURL_CHECK_FUNC_STRERROR_R
2166 CURL_CHECK_FUNC_STRICMP
2167 CURL_CHECK_FUNC_STRLCAT
2168 CURL_CHECK_FUNC_STRNCASECMP
2169 CURL_CHECK_FUNC_STRNCMPI
2170 CURL_CHECK_FUNC_STRNICMP
2171 CURL_CHECK_FUNC_STRSTR
2172 CURL_CHECK_FUNC_STRTOK_R
2173 CURL_CHECK_FUNC_STRTOLL
2174 CURL_CHECK_FUNC_WRITEV
2176 dnl Checks for library functions.
2177 dnl AC_PROG_GCC_TRADITIONAL
2184 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
2188 AC_CHECK_FUNCS([basename \
2212 eval skipcheck=\$skipcheck_$func
2213 if test "x$skipcheck" != "xyes"; then
2214 AC_MSG_CHECKING([deeper for $func])
2221 AC_MSG_RESULT([yes])
2222 eval "ac_cv_func_$func=yes"
2223 AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
2224 [Define to 1 if you have the $func function.])
2226 AC_MSG_RESULT([but still no])
2232 AC_CHECK_DECL(basename, ,
2233 AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
2234 #ifdef HAVE_STRING_H
2237 #ifdef HAVE_LIBGEN_H
2240 #ifdef HAVE_UNISTD_H
2246 dnl Check if the getnameinfo function is available
2247 dnl and get the types of five of its arguments.
2248 CURL_CHECK_FUNC_GETNAMEINFO
2250 if test "$ipv6" = "yes"; then
2251 CURL_CHECK_WORKING_GETADDRINFO
2252 CURL_CHECK_NI_WITHSCOPEID
2255 AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
2264 AC_MSG_RESULT($disable_poll)
2266 if test "$disable_poll" = "no"; then
2268 dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
2269 dnl to find out we make an extra check here!
2270 if test "$ac_cv_func_poll" = "yes"; then
2271 AC_MSG_CHECKING([if poll works with NULL inputs])
2273 #ifdef HAVE_SYS_POLL_H
2274 #include <sys/poll.h>
2275 #elif defined(HAVE_POLL_H)
2281 /* make this return 0 == timeout since there's nothing to read from */
2282 return poll((void *)0, 0, 10 /*ms*/);
2286 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
2288 AC_MSG_RESULT(cross-compiling assumes yes)
2289 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
2290 ) dnl end of AC_RUN_IFELSE
2291 fi dnl poll() was found
2292 fi dnl poll()-check is not disabled
2295 AC_PATH_PROG( PERL, perl, ,
2296 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
2299 AC_PATH_PROGS( NROFF, gnroff nroff, ,
2300 $PATH:/usr/bin/:/usr/local/bin )
2303 if test -n "$NROFF"; then
2304 dnl only check for nroff options if an nroff command was found
2306 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
2308 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2309 if test -z "$mancheck"; then
2311 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2312 if test -z "$mancheck"; then
2314 AC_MSG_RESULT([failed])
2315 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
2317 AC_MSG_RESULT([$MANOPT])
2320 AC_MSG_RESULT([$MANOPT])
2325 if test -z "$MANOPT"
2327 dnl if no nroff tool was found, or no option that could convert man pages
2328 dnl was found, then disable the built-in manual stuff
2329 AC_MSG_WARN([disabling built-in manual])
2333 dnl *************************************************************************
2334 dnl If the manual variable still is set, then we go with providing a built-in
2337 if test "$USE_MANUAL" = "1"; then
2338 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
2339 curl_manual_msg="enabled"
2342 dnl set variable for use in automakefile(s)
2343 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
2345 AC_MSG_CHECKING([whether to enable c-ares])
2347 AC_HELP_STRING([--enable-ares=PATH],[Enable c-ares for name lookups])
2348 AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
2349 [ case "$enableval" in
2353 *) AC_MSG_RESULT(yes)
2355 if test "x$IPV6_ENABLED" = "x1"; then
2356 AC_MSG_NOTICE([c-ares may not work properly with ipv6])
2359 AC_DEFINE(USE_ARES, 1, [Define if you want to enable c-ares support])
2360 dnl substitute HAVE_ARES for curl-config and similar
2363 curl_ares_msg="enabled"
2365 LIBS="-lcares $LIBS"
2367 dnl For backwards compatibility default to includes/lib in srcdir/ares
2368 dnl If a value is specified it is assumed that the libs are in $val/lib
2369 dnl and the includes are in $val/include. This is the default setup for
2370 dnl ares so it should not be a problem.
2371 if test "x$enableval" = "xyes" ; then
2372 if test -d "$srcdir/ares"; then
2374 AC_CONFIG_SUBDIRS(ares)
2375 aresinc=`cd $srcdir/ares && pwd`
2376 CPPFLAGS="$CPPFLAGS -I$aresinc"
2378 dnl the pwd= below cannot 'cd' into the ares dir to get the full
2379 dnl path to it, since it may not exist yet if we build outside of
2382 LDFLAGS="$LDFLAGS -L$pwd/ares"
2385 CPPFLAGS="$CPPFLAGS -I$enableval/include"
2386 LDFLAGS="$LDFLAGS -L$enableval/lib"
2389 if test -z "$aresembedded"; then
2390 dnl verify that a sufficient c-ares is here if we have pointed one
2391 dnl out and don't use the "embedded" ares dir (in which case we don't
2392 dnl check it because it might not have been built yet)
2393 AC_MSG_CHECKING([that c-ares is good and recent enough])
2397 /* set of dummy functions in case c-ares was built with debug */
2398 void curl_dofree() { }
2399 void curl_sclose() { }
2400 void curl_domalloc() { }
2401 void curl_docalloc() { }
2402 void curl_socket() { }
2404 ares_channel channel;
2405 ares_cancel(channel); /* added in 1.2.0 */
2406 ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
2409 AC_MSG_RESULT([yes])
2412 AC_MSG_ERROR([c-ares library defective or too old])
2420 dnl ************************************************************
2421 dnl disable verbose text strings
2423 AC_MSG_CHECKING([whether to enable verbose strings])
2424 AC_ARG_ENABLE(verbose,
2425 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
2426 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
2427 [ case "$enableval" in
2430 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
2431 curl_verbose_msg="no"
2433 *) AC_MSG_RESULT(yes)
2439 dnl ************************************************************
2440 dnl enable SSPI support
2442 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
2444 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
2445 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
2446 [ case "$enableval" in
2448 if test "$ac_cv_native_windows" = "yes"; then
2450 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
2451 AC_SUBST(USE_WINDOWS_SSPI, [1])
2455 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
2465 dnl ************************************************************
2466 dnl lame option to switch on debug options
2468 AC_MSG_CHECKING([whether to enable debug options])
2469 AC_ARG_ENABLE(debug,
2470 AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
2471 AC_HELP_STRING([--disable-debug],[Disable debug options]),
2472 [ case "$enableval" in
2476 *) AC_MSG_RESULT(yes)
2478 CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
2481 dnl set compiler "debug" options to become more picky, and remove
2482 dnl optimize options from CFLAGS
2490 dnl ************************************************************
2491 dnl disable cryptographic authentication
2493 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
2494 AC_ARG_ENABLE(crypto-auth,
2495 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
2496 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
2497 [ case "$enableval" in
2500 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
2502 *) AC_MSG_RESULT(yes)
2508 dnl ************************************************************
2509 dnl disable cookies support
2511 AC_MSG_CHECKING([whether to enable support for cookies])
2512 AC_ARG_ENABLE(cookies,
2513 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
2514 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
2515 [ case "$enableval" in
2518 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
2520 *) AC_MSG_RESULT(yes)
2526 dnl ************************************************************
2527 dnl Enable hiding of internal symbols in library to reduce its size and
2528 dnl speed dynamic linking of applications. This currently is only supported
2529 dnl on gcc >= 4.0 and SunPro C.
2531 AC_MSG_CHECKING([whether to enable hidden symbols in the library])
2532 AC_ARG_ENABLE(hidden-symbols,
2533 AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
2534 AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
2535 [ case "$enableval" in
2540 AC_MSG_CHECKING([whether $CC supports it])
2541 if test "$GCC" = yes ; then
2542 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
2544 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2545 AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
2546 CFLAGS="$CFLAGS -fvisibility=hidden"
2552 dnl Test for SunPro cc
2553 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
2555 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2556 AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
2557 CFLAGS="$CFLAGS -xldscope=hidden"
2567 dnl ************************************************************
2568 dnl enforce SONAME bump
2571 AC_MSG_CHECKING([whether to enforce SONAME bump])
2572 AC_ARG_ENABLE(soname-bump,
2573 AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
2574 AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
2575 [ case "$enableval" in
2576 yes) AC_MSG_RESULT(yes)
2583 AC_MSG_RESULT($soname_bump)
2585 AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
2588 dnl ************************************************************
2589 if test ! -z "$winsock_LIB"; then
2591 dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
2592 dnl things work when built with c-ares). But we can't just move it last
2593 dnl since then other stuff (SSL) won't build. So we simply append it to the
2596 LIBS="$LIBS $winsock_LIB"
2597 TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
2602 dnl All the library dependencies put into $LIB apply to libcurl only.
2603 dnl Those in $CURL_LIBS apply to the curl command-line client only.
2604 dnl Those in $TEST_SERVER_LIBS apply to test servers only.
2605 dnl Those in $ALL_LIBS apply to all targets, including test targets.
2609 AC_SUBST(LIBCURL_LIBS)
2611 AC_SUBST(TEST_SERVER_LIBS)
2612 LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
2614 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
2617 dnl For keeping supported features and protocols also in pkg-config file
2618 dnl since it is more cross-compile frient than curl-config
2621 if test "x$USE_SSLEAY" = "x1"; then
2622 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2623 elif test -n "$SSL_ENABLED"; then
2624 SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
2626 if test "@KRB4_ENABLED@" = "x1"; then
2627 SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
2629 if test "x$IPV6_ENABLED" = "x1"; then
2630 SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
2632 if test "x$HAVE_LIBZ" = "x1"; then
2633 SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
2635 if test "x$HAVE_ARES" = "x1"; then
2636 SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
2638 if test "x$IDN_ENABLED" = "x1"; then
2639 SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
2641 if test "x$USE_WINDOWS_SSPI" = "x1"; then
2642 SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
2644 if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1"; then
2645 SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
2648 AC_SUBST(SUPPORT_FEATURES)
2650 dnl For supported protocols in pkg-config file
2651 if test "x$CURL_DISABLE_HTTP" != "x1"; then
2652 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
2653 if test "x$SSL_ENABLED" = "x1"; then
2654 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
2657 if test "x$CURL_DISABLE_FTP" != "x1"; then
2658 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
2659 if test "x$SSL_ENABLED" = "x1"; then
2660 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
2663 if test "x$CURL_DISABLE_FILE" != "x1"; then
2664 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
2666 if test "x$CURL_DISABLE_TELNET" != "x1"; then
2667 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
2669 if test "x$CURL_DISABLE_LDAP" != "x1"; then
2670 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
2672 if test "x$CURL_DISABLE_LDAPS" != "x1"; then
2673 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
2675 if test "x$CURL_DISABLE_DICT" != "x1"; then
2676 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
2678 if test "x$CURL_DISABLE_TFTP" != "x1"; then
2679 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
2681 if test "x$USE_LIBSSH2" = "x1"; then
2682 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
2683 SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
2686 AC_SUBST(SUPPORT_PROTOCOLS)
2688 AC_CONFIG_FILES([Makefile \
2690 docs/examples/Makefile \
2691 docs/libcurl/Makefile \
2693 include/curl/Makefile \
2697 tests/data/Makefile \
2698 tests/server/Makefile \
2699 tests/libtest/Makefile \
2701 packages/Win32/Makefile \
2702 packages/Win32/cygwin/Makefile \
2703 packages/Linux/Makefile \
2704 packages/Linux/RPM/Makefile \
2705 packages/Linux/RPM/curl.spec \
2706 packages/Linux/RPM/curl-ssl.spec \
2707 packages/Solaris/Makefile \
2708 packages/DOS/Makefile \
2709 packages/EPM/curl.list \
2710 packages/EPM/Makefile \
2711 packages/vms/Makefile \
2712 packages/AIX/Makefile \
2713 packages/AIX/RPM/Makefile \
2714 packages/AIX/RPM/curl.spec \
2720 AC_MSG_NOTICE([Configured to build curl/libcurl:
2722 curl version: ${VERSION}
2724 Install prefix: ${prefix}
2726 SSL support: ${curl_ssl_msg}
2727 SSH support: ${curl_ssh_msg}
2728 zlib support: ${curl_zlib_msg}
2729 krb4 support: ${curl_krb4_msg}
2730 GSSAPI support: ${curl_gss_msg}
2731 SPNEGO support: ${curl_spnego_msg}
2732 c-ares support: ${curl_ares_msg}
2733 ipv6 support: ${curl_ipv6_msg}
2734 IDN support: ${curl_idn_msg}
2735 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
2736 Built-in manual: ${curl_manual_msg}
2737 Verbose errors: ${curl_verbose_msg}
2738 SSPI support: ${curl_sspi_msg}
2739 ca cert bundle: ${ca}
2740 ca cert path: ${capath}
2741 LDAP support: ${curl_ldap_msg}
2742 LDAPS support: ${curl_ldaps_msg}
2745 if test "x$soname_bump" = "xyes"; then
2748 SONAME bump: yes - WARNING: this library will be built with the SONAME
2749 number bumped due to (a detected) ABI breakage.
2750 See lib/README.curl_off_t for details on this.