]> git.ipfire.org Git - thirdparty/curl.git/blame - configure.ac
Fixed a few compiler warnings. Try to do a slightly better job of
[thirdparty/curl.git] / configure.ac
CommitLineData
d551412a
DS
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
c185cdf2 8# Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
d551412a
DS
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# $Id$
22###########################################################################
ae1912cb 23dnl Process this file with autoconf to produce a configure script.
7349940b 24
a147a079 25AC_PREREQ(2.57)
7349940b 26
d5ba0309 27dnl We don't know the version number "staticly" so we use a dash here
e3fc0d5e 28AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
d5ba0309
DS
29
30dnl configure script copyright
772a985d 31AC_COPYRIGHT([Copyright (c) 1998 - 2006 Daniel Stenberg, <daniel@haxx.se>
e16c1b8e 32This configure script may be copied, distributed and modified under the
d5ba0309
DS
33terms of the curl license; see COPYING for more details])
34
93c53424 35AC_CONFIG_SRCDIR([lib/urldata.h])
1a4fddb9 36AM_CONFIG_HEADER(lib/config.h src/config.h)
ed29552b 37AM_MAINTAINER_MODE
8f5ffd94 38
9f7c6341 39dnl SED is needed by some of the tools
3fc39a6e
DS
40AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
41 $PATH:/usr/bin:/usr/local/bin)
075c5342
DS
42AC_SUBST(SED)
43
3fc39a6e
DS
44if test "x$SED" = "xsed-was-not-found-by-configure"; then
45 AC_MSG_WARN([sed was not found, this may ruin your chances to build fine])
46fi
47
9f7c6341 48dnl AR is used by libtool, and try the odd Solaris path too
91018f4f
DS
49dnl we use AC_CHECK_TOOL since this should make a library for the target
50dnl platform
51AC_CHECK_TOOL(AR, ar,
3fc39a6e
DS
52 ar-was-not-found-by-configure,
53 $PATH:/usr/bin:/usr/local/bin:/usr/ccs/bin)
9f7c6341 54AC_SUBST(AR)
3fc39a6e
DS
55if test "x$AR" = "xar-was-not-found-by-configure"; then
56 AC_MSG_WARN([ar was not found, this may ruin your chances to build fine])
57fi
9f7c6341 58
7349940b 59dnl figure out the libcurl version
593170d1 60VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
8f5ffd94 61AM_INIT_AUTOMAKE(curl,$VERSION)
075c5342
DS
62AC_MSG_CHECKING([curl version])
63AC_MSG_RESULT($VERSION)
caf8c01e 64
1e5e0f9a
DS
65dnl
66dnl we extract the numerical version for curl-config only
593170d1 67VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
1e5e0f9a
DS
68AC_SUBST(VERSIONNUM)
69
c503930b
CB
70dnl Solaris pkgadd support definitions
71PKGADD_PKG="HAXXcurl"
72PKGADD_NAME="cURL - a client that groks URLs"
73PKGADD_VENDOR="curl.haxx.se"
74AC_SUBST(PKGADD_PKG)
75AC_SUBST(PKGADD_NAME)
76AC_SUBST(PKGADD_VENDOR)
77
cff90cf3 78dnl
710e370c 79dnl initialize all the info variables
bebd5dbc 80 curl_ssl_msg="no (--with-ssl / --with-gnutls)"
2147284c 81 curl_ssh_msg="no (--with-libssh2)"
710e370c
DS
82 curl_zlib_msg="no (--with-zlib)"
83 curl_krb4_msg="no (--with-krb4*)"
84 curl_gss_msg="no (--with-gssapi)"
85 curl_spnego_msg="no (--with-spnego)"
86 curl_ares_msg="no (--enable-ares)"
87 curl_ipv6_msg="no (--enable-ipv6)"
88 curl_idn_msg="no (--with-libidn)"
89 curl_manual_msg="no (--enable-manual)"
90curl_verbose_msg="enabled (--disable-verbose)"
8ed31c48 91 curl_sspi_msg="no (--enable-sspi)"
d0edb478 92 curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
c503930b 93
a0a47f27
DF
94dnl
95dnl Save anything in $LIBS for later
96dnl
97ALL_LIBS=$LIBS
98
caf8c01e
DS
99dnl
100dnl Detect the canonical host and target build environment
101dnl
ae1912cb 102
c77f77a1 103AC_CANONICAL_HOST
93c53424 104dnl Get system canonical name
22a32389 105AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
1b1f143c
DS
106
107dnl Check for AIX weirdos
108AC_AIX
109
93c53424
DS
110dnl Checks for programs.
111AC_PROG_CC
112
d4ffc5ef 113dnl check for how to do large files
1b1f143c 114AC_SYS_LARGEFILE
d4ffc5ef 115
c84f84c7 116dnl support building of Windows DLLs
1e8f0c57
DS
117AC_LIBTOOL_WIN32_DLL
118
23786eae 119dnl skip libtool C++ and Fortran compiler checks
d31feb8f 120m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
c84f84c7 121m4_defun([AC_PROG_CXX],[])
60588b24
DS
122m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
123m4_defun([AC_PROG_CXXCPP],[true])
d31feb8f 124m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
c84f84c7
YT
125m4_defun([AC_PROG_F77],[])
126
23786eae 127dnl skip libtool C++ and Fortran linker checks
d31feb8f 128m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
23786eae 129m4_defun([AC_LIBTOOL_CXX],[])
60588b24
DS
130m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
131m4_defun([AC_LIBTOOL_CXXCPP],[true])
d31feb8f 132m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
23786eae
YT
133m4_defun([AC_LIBTOOL_F77],[])
134
5c7c79bd
YT
135dnl force libtool to build static libraries with PIC on AMD64-linux
136AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
74befdfb 137case $host in
389a15a8 138 x86_64*linux*)
74befdfb
YT
139 AC_MSG_RESULT([yes])
140 with_pic=yes
141 ;;
142 *)
143 AC_MSG_RESULT([no])
144 ;;
145esac
146
1e8f0c57 147dnl libtool setup
d20a0516 148AC_PROG_LIBTOOL
93c53424 149
fcfc6de9 150AC_MSG_CHECKING([if we need -no-undefined])
ecf3aee4 151case $host in
c2e2c98d 152 *-*-cygwin | *-*-mingw* | *-*-pw32*)
ecf3aee4
DS
153 need_no_undefined=yes
154 ;;
155 *)
156 need_no_undefined=no
157 ;;
158esac
fcfc6de9 159AC_MSG_RESULT($need_no_undefined)
ecf3aee4
DS
160AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
161
fcfc6de9 162AC_MSG_CHECKING([if we need -mimpure-text])
5ab9d72e 163mimpure=no
fcfc6de9
DS
164case $host in
165 *-*-solaris2*)
166 if test "$GCC" = "yes"; then
167 mimpure="yes"
168 fi
169 ;;
170 *)
fcfc6de9
DS
171 ;;
172esac
173AC_MSG_RESULT($mimpure)
174AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
175
4d815c99
DS
176AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
177case $host in
178 *-*-mingw*)
179 AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
180 AC_MSG_RESULT(yes)
b29017f1 181 AC_MSG_CHECKING([if we need CURL_STATICLIB])
0bb04082
DS
182 if test "X$enable_shared" = "Xno"
183 then
184 AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
185 AC_MSG_RESULT(yes)
b29017f1
DS
186 else
187 AC_MSG_RESULT(no)
0bb04082 188 fi
4d815c99
DS
189 ;;
190 *)
191 AC_MSG_RESULT(no)
192 ;;
193esac
194
9de4e5eb
DF
195# Determine whether all dependent libraries must be specified when linking
196if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
197then
198 REQUIRE_LIB_DEPS=no
199else
200 REQUIRE_LIB_DEPS=yes
201fi
202AC_SUBST(REQUIRE_LIB_DEPS)
203
d1a1fcc6
DS
204dnl The install stuff has already been taken care of by the automake stuff
205dnl AC_PROG_INSTALL
ae1912cb
DS
206AC_PROG_MAKE_SET
207
375cdf89
DS
208dnl check if there's a way to force code inline
209AC_C_INLINE
210
02c7cf6f 211dnl **********************************************************************
e16c1b8e
GK
212dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
213dnl and ws2tcpip.h take precedence over any other further checks which
02c7cf6f
YT
214dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
215dnl this specific header files. And do them before its results are used.
216dnl **********************************************************************
217
218CURL_CHECK_HEADER_WINDOWS
219CURL_CHECK_HEADER_WINSOCK
220CURL_CHECK_HEADER_WINSOCK2
221CURL_CHECK_HEADER_WS2TCPIP
222
223
fd3881ea
DS
224dnl ************************************************************
225dnl switch off particular protocols
226dnl
227AC_MSG_CHECKING([whether to support http])
228AC_ARG_ENABLE(http,
f136f435
DS
229AC_HELP_STRING([--enable-http],[Enable HTTP support])
230AC_HELP_STRING([--disable-http],[Disable HTTP support]),
fd3881ea
DS
231[ case "$enableval" in
232 no)
233 AC_MSG_RESULT(no)
22a32389 234 AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
67a83c1b 235 AC_MSG_WARN([disable HTTP disables FTP over proxy])
3955b313 236 AC_SUBST(CURL_DISABLE_HTTP, [1])
fd3881ea
DS
237 ;;
238 *) AC_MSG_RESULT(yes)
239 ;;
240 esac ],
241 AC_MSG_RESULT(yes)
242)
243AC_MSG_CHECKING([whether to support ftp])
244AC_ARG_ENABLE(ftp,
f136f435
DS
245AC_HELP_STRING([--enable-ftp],[Enable FTP support])
246AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
fd3881ea
DS
247[ case "$enableval" in
248 no)
249 AC_MSG_RESULT(no)
22a32389 250 AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
3955b313 251 AC_SUBST(CURL_DISABLE_FTP, [1])
fd3881ea
DS
252 ;;
253 *) AC_MSG_RESULT(yes)
254 ;;
255 esac ],
256 AC_MSG_RESULT(yes)
257)
fd3881ea
DS
258AC_MSG_CHECKING([whether to support file])
259AC_ARG_ENABLE(file,
f136f435
DS
260AC_HELP_STRING([--enable-file],[Enable FILE support])
261AC_HELP_STRING([--disable-file],[Disable FILE support]),
fd3881ea
DS
262[ case "$enableval" in
263 no)
264 AC_MSG_RESULT(no)
22a32389 265 AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
3955b313 266 AC_SUBST(CURL_DISABLE_FILE, [1])
fd3881ea
DS
267 ;;
268 *) AC_MSG_RESULT(yes)
269 ;;
270 esac ],
271 AC_MSG_RESULT(yes)
272)
273AC_MSG_CHECKING([whether to support ldap])
274AC_ARG_ENABLE(ldap,
f136f435
DS
275AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
276AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
fd3881ea
DS
277[ case "$enableval" in
278 no)
279 AC_MSG_RESULT(no)
22a32389 280 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
3955b313 281 AC_SUBST(CURL_DISABLE_LDAP, [1])
fd3881ea
DS
282 ;;
283 *) AC_MSG_RESULT(yes)
284 ;;
285 esac ],
286 AC_MSG_RESULT(yes)
287)
288AC_MSG_CHECKING([whether to support dict])
289AC_ARG_ENABLE(dict,
f136f435
DS
290AC_HELP_STRING([--enable-dict],[Enable DICT support])
291AC_HELP_STRING([--disable-dict],[Disable DICT support]),
fd3881ea
DS
292[ case "$enableval" in
293 no)
294 AC_MSG_RESULT(no)
b9c60df0 295 AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
3955b313 296 AC_SUBST(CURL_DISABLE_DICT, [1])
fd3881ea
DS
297 ;;
298 *) AC_MSG_RESULT(yes)
299 ;;
300 esac ],
301 AC_MSG_RESULT(yes)
302)
303AC_MSG_CHECKING([whether to support telnet])
304AC_ARG_ENABLE(telnet,
f136f435
DS
305AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
306AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
fd3881ea
DS
307[ case "$enableval" in
308 no)
309 AC_MSG_RESULT(no)
22a32389 310 AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
3955b313 311 AC_SUBST(CURL_DISABLE_TELNET, [1])
fd3881ea
DS
312 ;;
313 *) AC_MSG_RESULT(yes)
314 ;;
315 esac ],
316 AC_MSG_RESULT(yes)
317)
56d9624b
DS
318AC_MSG_CHECKING([whether to support tftp])
319AC_ARG_ENABLE(tftp,
320AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
321AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
322[ case "$enableval" in
323 no)
324 AC_MSG_RESULT(no)
325 AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
326 AC_SUBST(CURL_DISABLE_TFTP, [1])
327 ;;
328 *) AC_MSG_RESULT(yes)
329 ;;
330 esac ],
331 AC_MSG_RESULT(yes)
332)
fd3881ea 333
f3663a9d
DS
334dnl **********************************************************************
335dnl Check for built-in manual
336dnl **********************************************************************
337
338AC_MSG_CHECKING([whether to provide built-in manual])
339AC_ARG_ENABLE(manual,
340AC_HELP_STRING([--enable-manual],[Enable built-in manual])
341AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
342[ case "$enableval" in
343 no)
344 AC_MSG_RESULT(no)
345 ;;
346 *) AC_MSG_RESULT(yes)
347 USE_MANUAL="1"
348 ;;
349 esac ],
350 AC_MSG_RESULT(yes)
351 USE_MANUAL="1"
352)
353dnl The actual use of the USE_MANUAL variable is done much later in this
354dnl script to allow other actions to disable it as well.
355
2df622fd
DS
356dnl **********************************************************************
357dnl check if this is the Intel ICC compiler, and if so make it stricter
358dnl (convert warning 147 into an error) so that it properly can detect the
359dnl gethostbyname_r() version
360dnl **********************************************************************
361CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
362
ae1912cb
DS
363dnl **********************************************************************
364dnl Checks for libraries.
365dnl **********************************************************************
366
9f2780a2
DS
367dnl gethostbyname without lib or in the nsl lib?
368AC_CHECK_FUNC(gethostbyname,
369 [HAVE_GETHOSTBYNAME="1"
370 ],
371 [ AC_CHECK_LIB(nsl, gethostbyname,
372 [HAVE_GETHOSTBYNAME="1"
373 LIBS="$LIBS -lnsl"
374 ])
375 ])
376
377if test "$HAVE_GETHOSTBYNAME" != "1"
378then
61fb8fea 379 dnl gethostbyname in the socket lib?
9f2780a2
DS
380 AC_CHECK_LIB(socket, gethostbyname,
381 [HAVE_GETHOSTBYNAME="1"
382 LIBS="$LIBS -lsocket"
383 ])
61fb8fea
DS
384fi
385
9f2780a2
DS
386dnl At least one system has been identified to require BOTH nsl and socket
387dnl libs at the same time to link properly.
388if test "$HAVE_GETHOSTBYNAME" != "1"
389then
af43ce73 390 AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
caf8c01e
DS
391 my_ac_save_LIBS=$LIBS
392 LIBS="-lnsl -lsocket $LIBS"
393 AC_TRY_LINK( ,
394 [gethostbyname();],
9f2780a2 395 [ dnl found it!
5c7dcc6c 396 HAVE_GETHOSTBYNAME="1"
9f2780a2
DS
397 AC_MSG_RESULT([yes])],
398 [ dnl failed!
399 AC_MSG_RESULT([no])
400 dnl restore LIBS
401 LIBS=$my_ac_save_LIBS]
402 )
403fi
caf8c01e 404
9f2780a2
DS
405if test "$HAVE_GETHOSTBYNAME" != "1"
406then
407 dnl This is for Msys/Mingw
408 AC_MSG_CHECKING([for gethostbyname in ws2_32])
409 my_ac_save_LIBS=$LIBS
410 LIBS="-lws2_32 $LIBS"
411 AC_TRY_LINK([#include <winsock2.h>],
412 [gethostbyname("www.dummysite.com");],
413 [ dnl worked!
9f3d9da1 414 ws2="yes"
a3d39efa 415 AC_MSG_RESULT([yes])
9f2780a2
DS
416 HAVE_GETHOSTBYNAME="1"],
417 [ dnl failed, restore LIBS
418 LIBS=$my_ac_save_LIBS
419 AC_MSG_RESULT(no)]
420 )
684245d6
DF
421fi
422
0427e944
DF
423if test "$HAVE_GETHOSTBYNAME" != "1"
424then
425 dnl This is for Minix 3.1
426 AC_MSG_CHECKING([for gethostbyname for Minix 3])
427 AC_TRY_LINK([
428/* Older Minix versions may need <net/gen/netdb.h> here instead */
429#include <netdb.h>],
430 [gethostbyname("www.dummysite.com");],
431 [ dnl worked!
432 AC_MSG_RESULT([yes])
433 HAVE_GETHOSTBYNAME="1"],
434 AC_MSG_RESULT(no)
435 )
436fi
437
684245d6
DF
438if test "$HAVE_GETHOSTBYNAME" != "1"
439then
440 dnl This is for eCos with a stubbed DNS implementation
441 AC_MSG_CHECKING([for gethostbyname for eCos])
442 AC_TRY_LINK([
443#include <stdio.h>
444#include <netdb.h>],
445 [gethostbyname("www.dummysite.com");],
446 [ dnl worked!
447 AC_MSG_RESULT([yes])
448 HAVE_GETHOSTBYNAME="1"],
449 AC_MSG_RESULT(no)
450 )
9f2780a2
DS
451fi
452
58f4af79
DS
453if test "$HAVE_GETHOSTBYNAME" != "1"
454then
455 dnl gethostbyname in the net lib - for BeOS
456 AC_CHECK_LIB(net, gethostbyname,
457 [HAVE_GETHOSTBYNAME="1"
458 LIBS="$LIBS -lnet"
459 ])
460fi
461
462
9f2780a2
DS
463if test "$HAVE_GETHOSTBYNAME" = "1"; then
464 AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
465else
466 AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
caf8c01e
DS
467fi
468
ae1912cb 469dnl resolve lib?
22a32389 470AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
ae1912cb 471
b174aeaa
DS
472if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
473 AC_CHECK_LIB(resolve, strcasecmp,
474 [LIBS="-lresolve $LIBS"],
475 ,
476 -lnsl)
477fi
478
ae1912cb 479dnl socket lib?
22a32389 480AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
ae1912cb 481
c461254d
DF
482dnl **********************************************************************
483dnl The preceding library checks are all potentially useful for test
484dnl servers (for providing networking support). Save the list of required
485dnl libraries at this point for use while linking those test servers.
486dnl **********************************************************************
487TEST_SERVER_LIBS=$LIBS
ae1912cb 488
c461254d 489dnl **********************************************************************
075c5342
DS
490AC_MSG_CHECKING([whether to use libgcc])
491AC_ARG_ENABLE(libgcc,
492AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
493[ case "$enableval" in
494 yes)
a0a47f27 495 ALL_LIBS="$ALL_LIBS -lgcc"
075c5342
DS
496 AC_MSG_RESULT(yes)
497 ;;
498 *) AC_MSG_RESULT(no)
499 ;;
500 esac ],
501 AC_MSG_RESULT(no)
502)
503
3ec605de 504dnl **********************************************************************
d0edb478 505dnl Check for LDAP
205f8b26
DF
506dnl **********************************************************************
507
508LDAPLIBNAME=""
509AC_ARG_WITH(ldap-lib,
d0edb478 510AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
205f8b26
DF
511 [LDAPLIBNAME="$withval"])
512
513LBERLIBNAME=""
514AC_ARG_WITH(lber-lib,
d0edb478 515AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
205f8b26
DF
516 [LBERLIBNAME="$withval"])
517
518if test x$CURL_DISABLE_LDAP != x1 ; then
519
520 if test -z "$LDAPLIBNAME" ; then
521 case $host in
d0edb478 522 *-*-cygwin* | *-*-mingw* | *-*-pw32*)
205f8b26 523 dnl Windows uses a single and unique OpenLDAP DLL name
d0edb478 524 LDAPLIBNAME="wldap32"
205f8b26
DF
525 LBERLIBNAME="no"
526 ;;
527 esac
528 fi
529
530 if test "$LDAPLIBNAME" ; then
d0edb478
DS
531 AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
532 AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
533 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
534 AC_SUBST(CURL_DISABLE_LDAP, [1])])
205f8b26
DF
535 else
536 dnl Try to find the right ldap library name for this system
d0edb478
DS
537 AC_SEARCH_LIBS(ldap_init, [ldap],, [
538 AC_MSG_WARN([Cannot find LDAP library: LDAP disabled])
539 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
540 AC_SUBST(CURL_DISABLE_LDAP, [1])])
205f8b26 541 fi
d0edb478
DS
542fi
543
544if test x$CURL_DISABLE_LDAP != x1 ; then
205f8b26
DF
545
546 if test "$LBERLIBNAME" ; then
d0edb478 547 dnl If name is "no" then don't define this library at all
205f8b26 548 dnl (it's only needed if libldap.so's dependencies are broken).
e16c1b8e 549 if test "$LBERLIBNAME" != "no" ; then
d0edb478
DS
550 AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
551 AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
552 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
553 AC_SUBST(CURL_DISABLE_LDAP, [1])])
205f8b26 554 fi
205f8b26
DF
555 else
556 dnl Try to find the right lber library name for this system
d0edb478
DS
557 AC_SEARCH_LIBS(ber_free, [lber],, [
558 AC_MSG_WARN([Cannot find a library defining ber_free(): LDAP disabled])
559 AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
560 AC_SUBST(CURL_DISABLE_LDAP, [1])])
561 fi
562fi
563
564if test x$CURL_DISABLE_LDAP != x1 ; then
565 AC_CHECK_FUNCS([ldap_url_parse])
566
567 if test "$LDAPLIBNAME" = "wldap32"; then
568 curl_ldap_msg="yes (winldap)"
569 AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
570 case $host in
72e675ca 571 *-*-cygwin* | *-*-pw32*)
d0edb478
DS
572 AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
573 ;;
574 esac
575 else
576 curl_ldap_msg="yes (OpenLDAP)"
205f8b26
DF
577 fi
578fi
579
580dnl **********************************************************************
3ec605de
DS
581dnl Check for the presence of the winmm library.
582dnl **********************************************************************
583
990e56fb
DS
584case $host in
585 *-*-cygwin*)
586 dnl Under Cygwin, winmm exists but is not needed as WIN32 is not #defined
587 dnl and gettimeofday() will be used regardless of the outcome of this test.
588 dnl Skip this test, otherwise -lwinmm will be needlessly added to LIBS
589 dnl (and recorded as such in the .la file, potentially affecting downstream
590 dnl clients of the library.)
591 ;;
592 *)
593 AC_MSG_CHECKING([for timeGetTime in winmm])
594 my_ac_save_LIBS=$LIBS
595 LIBS="-lwinmm $LIBS"
596 AC_TRY_LINK([#include <windef.h>
597 #include <mmsystem.h>
598 ],
599 [timeGetTime();],
600 [ dnl worked!
601 AC_MSG_RESULT([yes])
602 ],
603 [ dnl failed, restore LIBS
604 LIBS=$my_ac_save_LIBS
605 AC_MSG_RESULT(no)]
606 )
607 ;;
608esac
3ec605de 609
d1b17779
DS
610dnl **********************************************************************
611dnl Checks for IPv6
612dnl **********************************************************************
613
614AC_MSG_CHECKING([whether to enable ipv6])
615AC_ARG_ENABLE(ipv6,
616AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
617AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
618[ case "$enableval" in
619 no)
620 AC_MSG_RESULT(no)
621 ipv6=no
622 ;;
623 *) AC_MSG_RESULT(yes)
624 ipv6=yes
625 ;;
626 esac ],
627
628 AC_TRY_RUN([ /* is AF_INET6 available? */
629#include <sys/types.h>
630#include <sys/socket.h>
631main()
632{
633 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
634 exit(1);
635 else
636 exit(0);
637}
638],
639 AC_MSG_RESULT(yes)
640 ipv6=yes,
641 AC_MSG_RESULT(no)
642 ipv6=no,
643 AC_MSG_RESULT(no)
644 ipv6=no
645))
646
647if test "$ipv6" = "yes"; then
cff90cf3 648 curl_ipv6_msg="enabled"
d1b17779
DS
649fi
650
6ca45bea
DS
651dnl **********************************************************************
652dnl Check how non-blocking sockets are set
653dnl **********************************************************************
654AC_ARG_ENABLE(nonblocking,
f136f435
DS
655AC_HELP_STRING([--enable-nonblocking],[Enable detecting how to do it])
656AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
6ca45bea
DS
657[
658 if test "$enableval" = "no" ; then
659 AC_MSG_WARN([non-blocking sockets disabled])
22a32389
DS
660 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
661 [to disable NON-BLOCKING connections])
6ca45bea
DS
662 else
663 CURL_CHECK_NONBLOCKING_SOCKET
664 fi
665],
666[
667 CURL_CHECK_NONBLOCKING_SOCKET
668])
669
7f67a28c
DS
670dnl **********************************************************************
671dnl Check if the operating system allows programs to write to their own argv[]
672dnl **********************************************************************
673
674AC_MSG_CHECKING([if argv can be written to])
0717e469 675AC_CACHE_VAL(curl_cv_writable_argv, [
a139ce90 676AC_RUN_IFELSE([[
7f67a28c 677int main(int argc, char ** argv) {
77431568
GK
678 argv[0][0] = ' ';
679 return (argv[0][0] == ' ')?0:1;
7f67a28c 680}
77431568
GK
681 ]],
682 curl_cv_writable_argv=yes,
683 curl_cv_writable_argv=no,
684 curl_cv_writable_argv=cross)
0717e469
DS
685])
686case $curl_cv_writable_argv in
687yes)
77431568
GK
688 AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
689 AC_MSG_RESULT(yes)
690 ;;
0717e469 691no)
77431568
GK
692 AC_MSG_RESULT(no)
693 ;;
0717e469 694*)
a139ce90
DS
695 AC_MSG_RESULT(no)
696 AC_MSG_WARN([the previous check could not be made default was used])
77431568 697 ;;
0717e469 698esac
7f67a28c 699
00505c92
DS
700dnl **********************************************************************
701dnl Check for the presence of Kerberos4 libraries and headers
702dnl **********************************************************************
703
704AC_ARG_WITH(krb4-includes,
f136f435
DS
705AC_HELP_STRING([--with-krb4-includes=DIR],
706 [Specify location of kerberos4 headers]),[
00505c92
DS
707 CPPFLAGS="$CPPFLAGS -I$withval"
708 KRB4INC="$withval"
709 want_krb4=yes
710 ])
711
712AC_ARG_WITH(krb4-libs,
f136f435 713AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
00505c92
DS
714 LDFLAGS="$LDFLAGS -L$withval"
715 KRB4LIB="$withval"
716 want_krb4=yes
717 ])
718
719
720OPT_KRB4=off
721AC_ARG_WITH(krb4,dnl
f136f435 722AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
00505c92 723 OPT_KRB4="$withval"
5872e8dd
DF
724 if test X"$OPT_KRB4" != Xno; then
725 want_krb4="yes"
726 if test X"$OPT_KRB4" != Xyes; then
727 LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
728 KRB4LIB="$OPT_KRB4/lib$libsuff"
729 CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
730 KRB4INC="$OPT_KRB4/include"
731 fi
00505c92 732 fi
00505c92
DS
733 ])
734
735AC_MSG_CHECKING([if Kerberos4 support is requested])
736
737if test "$want_krb4" = yes
738then
f6e2bfd4
DS
739 if test "$ipv6" = "yes"; then
740 echo krb4 is not compatible with IPv6
741 exit 1
742 fi
00505c92
DS
743 AC_MSG_RESULT(yes)
744
745 dnl Check for & handle argument to --with-krb4
746
747 AC_MSG_CHECKING(where to look for Kerberos4)
748 if test X"$OPT_KRB4" = Xyes
749 then
750 AC_MSG_RESULT([defaults])
751 else
752 AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
753 fi
754
755 dnl Check for DES library
756 AC_CHECK_LIB(des, des_pcbc_encrypt,
757 [
758 AC_CHECK_HEADERS(des.h)
759
760 dnl resolv lib?
22a32389 761 AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
00505c92
DS
762
763 dnl Check for the Kerberos4 library
764 AC_CHECK_LIB(krb, krb_net_read,
765 [
766 dnl Check for header files
767 AC_CHECK_HEADERS(krb.h)
768
769 dnl we found the required libraries, add to LIBS
b55507c8 770 LIBS="-lkrb -lcom_err -ldes $LIBS"
00505c92
DS
771
772 dnl Check for function krb_get_our_ip_for_realm
773 dnl this is needed for NAT networks
774 AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
775
776 dnl add define KRB4
d4629fd3 777 AC_DEFINE(HAVE_KRB4, 1,
22a32389 778 [if you have the Kerberos4 libraries (including -ldes)])
00505c92 779
1ee7f92c
DS
780 dnl substitute it too!
781 KRB4_ENABLED=1
782 AC_SUBST(KRB4_ENABLED)
783
cff90cf3
DS
784 curl_krb4_msg="enabled"
785
00505c92
DS
786 dnl the krb4 stuff needs a strlcpy()
787 AC_CHECK_FUNCS(strlcpy)
788
789 ])
790 ])
791else
792 AC_MSG_RESULT(no)
793fi
794
09ccfcdc
DS
795dnl **********************************************************************
796dnl Check for FBopenssl(SPNEGO) libraries
797dnl **********************************************************************
798
799AC_ARG_WITH(spnego,
800 AC_HELP_STRING([--with-spnego=DIR],
5872e8dd
DF
801 [Specify location of SPNEGO library fbopenssl]), [
802 SPNEGO_ROOT="$withval"
803 if test x"$SPNEGO_ROOT" != xno; then
804 want_spnego="yes"
805 fi
806])
807
09ccfcdc
DS
808AC_MSG_CHECKING([if SPNEGO support is requested])
809if test x"$want_spnego" = xyes; then
f6413f2c
DS
810
811 if test X"$SPNEGO_ROOT" = Xyes; then
812 AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
813 AC_MSG_RESULT(no)
09ccfcdc 814 else
f6413f2c 815 if test -z "$SPNEGO_LIB_DIR"; then
202e54cf 816 LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
f6413f2c
DS
817 else
818 LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
819 fi
e16c1b8e 820
f6413f2c 821 AC_MSG_RESULT(yes)
cff90cf3
DS
822 AC_DEFINE(HAVE_SPNEGO, 1,
823 [Define this if you have the SPNEGO library fbopenssl])
824 curl_spnego_msg="enabled"
f6413f2c 825 fi
09ccfcdc
DS
826else
827 AC_MSG_RESULT(no)
828fi
829
e56ae142
DS
830dnl **********************************************************************
831dnl Check for GSS-API libraries
832dnl **********************************************************************
833
834AC_ARG_WITH(gssapi-includes,
835 AC_HELP_STRING([--with-gssapi-includes=DIR],
836 [Specify location of GSSAPI header]),
e16c1b8e 837 [ GSSAPI_INCS="-I$withval"
e56ae142
DS
838 want_gss="yes" ]
839)
840
841AC_ARG_WITH(gssapi-libs,
842 AC_HELP_STRING([--with-gssapi-libs=DIR],
77431568 843 [Specify location of GSSAPI libs]),
2723eda1 844 [ GSSAPI_LIB_DIR="-L$withval"
e56ae142
DS
845 want_gss="yes" ]
846)
847
848AC_ARG_WITH(gssapi,
849 AC_HELP_STRING([--with-gssapi=DIR],
5872e8dd
DF
850 [Where to look for GSSAPI]), [
851 GSSAPI_ROOT="$withval"
852 if test x"$GSSAPI_ROOT" != xno; then
e16c1b8e 853 want_gss="yes"
5872e8dd
DF
854 fi
855])
e56ae142 856
982ba214 857save_CPPFLAGS="$CPPFLAGS"
e56ae142
DS
858AC_MSG_CHECKING([if GSSAPI support is requested])
859if test x"$want_gss" = xyes; then
5effe8f3
DS
860 AC_MSG_RESULT(yes)
861
e56ae142
DS
862 if test -z "$GSSAPI_INCS"; then
863 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
f4046763 864 GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
49111a63 865 elif test "$GSSAPI_ROOT" != "yes"; then
533519cc 866 GSSAPI_INCS="-I$GSSAPI_ROOT/include"
e56ae142 867 fi
e56ae142 868 fi
f4046763 869 CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
5effe8f3
DS
870
871 AC_CHECK_HEADER(gss.h,
872 [
873 dnl found in the given dirs
874 AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
875 gnu_gss=yes
876 ],
877 [
878 dnl not found, check Heimdal
879 AC_CHECK_HEADER(gssapi.h,
880 [
881 dnl found in the given dirs
882 AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
883 ],
884 [
e16c1b8e 885 dnl not found, check in gssapi/ subdir
5effe8f3
DS
886 AC_CHECK_HEADER(gssapi/gssapi.h,
887 [
e16c1b8e 888 dnl found
5effe8f3
DS
889 AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
890 ],
891 [
892 dnl no header found, disabling GSS
893 want_gss=no
894 AC_MSG_WARN(disabling GSSAPI since no header files was found)
895 ]
896 )
897 ]
e16c1b8e 898 )
5effe8f3
DS
899 ]
900 )
901else
902 AC_MSG_RESULT(no)
903fi
904if test x"$want_gss" = xyes; then
905 AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
906
907 curl_gss_msg="enabled (MIT/Heimdal)"
908
909 if test -n "$gnu_gss"; then
910 curl_gss_msg="enabled (GNU GSS)"
911 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgss"
912 elif test -z "$GSSAPI_LIB_DIR"; then
e56ae142
DS
913 if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
914 gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
77431568 915 LDFLAGS="$LDFLAGS $gss_ldflags"
49111a63 916 elif test "$GSSAPI_ROOT" != "yes"; then
81f83506 917 LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff -lgssapi"
49111a63
DS
918 else
919 LDFLAGS="$LDFLAGS -lgssapi"
e56ae142
DS
920 fi
921 else
5effe8f3 922 LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgssapi"
e56ae142 923 fi
e56ae142 924else
5effe8f3 925 CPPFLAGS="$save_CPPFLAGS"
e56ae142 926fi
e16c1b8e 927
ae1912cb
DS
928dnl **********************************************************************
929dnl Check for the presence of SSL libraries and headers
930dnl **********************************************************************
931
932dnl Default to compiler & linker defaults for SSL files & libraries.
933OPT_SSL=off
2c2baa93
DS
934dnl Default to no CA bundle
935ca="no"
ae1912cb 936AC_ARG_WITH(ssl,dnl
d7a29388 937AC_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])
0abccc67 938AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
e890113f 939 OPT_SSL=$withval)
ae1912cb 940
bebd5dbc 941if test X"$OPT_SSL" != Xno; then
6bd02a3a 942 dnl backup the pre-ssl variables
4ac7a087
DS
943 CLEANLDFLAGS="$LDFLAGS"
944 CLEANCPPFLAGS="$CPPFLAGS"
6bd02a3a
DS
945 CLEANLIBS="$LIBS"
946
4836154c
DS
947 case "$OPT_SSL" in
948 yes)
75e5967a 949 dnl --with-ssl (without path) used
736a40fe
DS
950 if test x$cross_compiling != xyes; then
951 dnl only do pkg-config magic when not cross-compiling
952 PKGTEST="yes"
953 fi
4370e92d
DS
954 PREFIX_OPENSSL=/usr/local/ssl
955 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
956 ;;
4398151f 957 off)
75e5967a 958 dnl no --with-ssl option given, just check default places
736a40fe
DS
959 if test x$cross_compiling != xyes; then
960 dnl only do pkg-config magic when not cross-compiling
961 PKGTEST="yes"
962 fi
4370e92d
DS
963 PREFIX_OPENSSL=
964 ;;
4836154c 965 *)
75e5967a
DS
966 dnl check the given --with-ssl spot
967 PKGTEST="no"
4370e92d
DS
968 PREFIX_OPENSSL=$OPT_SSL
969 LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
970 LDFLAGS="$LDFLAGS -L$LIB_OPENSSL"
971 CPPFLAGS="$CPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
4ac7a087 972 ;;
4836154c
DS
973 esac
974
75e5967a
DS
975 if test "$PKGTEST" = "yes"; then
976
977 dnl Detect the pkg-config tool, as it may have extra info about the
978 dnl openssl installation we can use. I *believe* this is what we are
979 dnl expected to do on really recent Redhat Linux hosts.
980
981 AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
982 if test "$PKGCONFIG" != "no" ; then
983 AC_MSG_CHECKING([OpenSSL options with pkg-config])
984
985 $PKGCONFIG --exists openssl
986 SSL_EXISTS=$?
987
988 if test "$SSL_EXISTS" -eq "0"; then
989 SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
990 SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
991 SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
992
77431568 993 LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
4370e92d 994
75e5967a
DS
995 dnl use the values pkg-config reported
996 LIBS="$LIBS $SSL_LIBS"
997 CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
998 LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
999 AC_MSG_RESULT([found])
1000 else
1001 AC_MSG_RESULT([no])
1002 fi
1003 fi
1004 fi
1005
93fcb94b 1006 dnl This is for Msys/Mingw
e16c1b8e 1007 case $host in
990e56fb
DS
1008 *-*-cygwin*)
1009 dnl Under Cygwin this is extraneous and causes an unnecessary -lgdi32
1010 dnl to be added to LIBS and recorded in the .la file.
1011 ;;
1012 *)
1013 AC_MSG_CHECKING([for gdi32])
1014 my_ac_save_LIBS=$LIBS
1015 LIBS="-lgdi32 $LIBS"
1016 AC_TRY_LINK([#include <windef.h>
1017 #include <wingdi.h>],
1018 [GdiFlush();],
1019 [ dnl worked!
1020 AC_MSG_RESULT([yes])],
1021 [ dnl failed, restore LIBS
1022 LIBS=$my_ac_save_LIBS
1023 AC_MSG_RESULT(no)]
1024 )
1025 ;;
1026 esac
93fcb94b 1027
4836154c
DS
1028 AC_CHECK_LIB(crypto, CRYPTO_lock,[
1029 HAVECRYPTO="yes"
c4f7570a 1030 LIBS="-lcrypto $LIBS"
4836154c 1031 ],[
4370e92d
DS
1032 LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
1033 CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
4836154c 1034 AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
c4f7570a
DF
1035 HAVECRYPTO="yes"
1036 LIBS="-lcrypto $LIBS"], [
6bd02a3a
DS
1037 LDFLAGS="$CLEANLDFLAGS"
1038 CPPFLAGS="$CLEANCPPFLAGS"
1039 LIBS="$CLEANLIBS"
4836154c
DS
1040 ])
1041 ])
ae1912cb 1042
ae1912cb 1043
21337f47 1044 if test X"$HAVECRYPTO" = X"yes"; then
ae1912cb
DS
1045 dnl This is only reasonable to do if crypto actually is there: check for
1046 dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
4836154c 1047
ae1912cb
DS
1048 AC_CHECK_LIB(ssl, SSL_connect)
1049
b32bf427
DS
1050 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1051 dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
1052 AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
1053 OLIBS=$LIBS
1054 LIBS="$LIBS -lRSAglue -lrsaref"
1055 AC_CHECK_LIB(ssl, SSL_connect)
1056 if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
1057 dnl still no SSL_connect
1058 AC_MSG_RESULT(no)
1059 LIBS=$OLIBS
1060 else
1061 AC_MSG_RESULT(yes)
1062 fi
b32bf427 1063
df3ca591 1064 else
b32bf427 1065
df3ca591
DS
1066 dnl Have the libraries--check for SSLeay/OpenSSL headers
1067 AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
1068 openssl/pem.h openssl/ssl.h openssl/err.h,
bebd5dbc 1069 curl_ssl_msg="enabled (OpenSSL)"
df3ca591
DS
1070 OPENSSL_ENABLED=1
1071 AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
1072
1073 if test $ac_cv_header_openssl_x509_h = no; then
d99c20f6
DS
1074 dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
1075 dnl since 'err.h' might in fact find a krb4 header with the same
1076 dnl name
1077 AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
1078
e16c1b8e 1079 if test $ac_cv_header_x509_h = yes &&
d99c20f6
DS
1080 test $ac_cv_header_crypto_h = yes &&
1081 test $ac_cv_header_ssl_h = yes; then
1082 dnl three matches
bebd5dbc 1083 curl_ssl_msg="enabled (OpenSSL)"
d99c20f6
DS
1084 OPENSSL_ENABLED=1
1085 fi
df3ca591
DS
1086 fi
1087 fi
1088
f966dad3
DS
1089 if test X"$OPENSSL_ENABLED" = X"1"; then
1090 AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
090a7f38
DS
1091
1092 dnl is there a pkcs12.h header present?
1093 AC_CHECK_HEADERS(openssl/pkcs12.h)
c4f7570a
DF
1094 else
1095 LIBS="$CLEANLIBS"
f966dad3 1096 fi
c4f7570a
DF
1097 dnl USE_SSLEAY is the historical name for what configure calls
1098 dnl OPENSSL_ENABLED; the names should really be unified
df3ca591 1099 USE_SSLEAY="$OPENSSL_ENABLED"
df3ca591 1100 AC_SUBST(USE_SSLEAY)
df3ca591
DS
1101
1102 if test X"$OPT_SSL" != Xoff &&
1103 test "$OPENSSL_ENABLED" != "1"; then
1104 AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
1ee7f92c 1105 fi
df3ca591
DS
1106 fi
1107
df3ca591 1108 if test X"$OPENSSL_ENABLED" = X"1"; then
e157aabd 1109 dnl If the ENGINE library seems to be around, check for the OpenSSL engine
f169b750
DS
1110 dnl stuff, it is kind of "separated" from the main SSL check
1111 AC_CHECK_FUNC(ENGINE_init,
1112 [
1113 AC_CHECK_HEADERS(openssl/engine.h)
1114 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
1115 ])
af6c3947 1116
2c2baa93 1117 dnl these can only exist if openssl exists
d052e545 1118 dnl yassl doesn't have SSL_get_shutdown
2c2baa93
DS
1119
1120 AC_CHECK_FUNCS( RAND_status \
1121 RAND_screen \
e16bc916 1122 RAND_egd \
d052e545
DS
1123 CRYPTO_cleanup_all_ex_data \
1124 SSL_get_shutdown )
1125
1126 dnl Make an attempt to detect if this is actually yassl's headers and
1127 dnl OpenSSL emulation layer. We still leave everything else believing
1128 dnl and acting like OpenSSL.
2c2baa93 1129
248f0571
YT
1130 AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
1131 AC_TRY_COMPILE([
d052e545 1132#include <openssl/ssl.h>
248f0571
YT
1133 ],[
1134#if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
1135 int dummy = SSL_ERROR_NONE;
1136#else
1137 Not the yaSSL OpenSSL compatibility header.
1138#endif
e16c1b8e 1139 ],[
248f0571
YT
1140 AC_MSG_RESULT([yes])
1141 AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
1142 [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
1143 curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
1144 ],[
1145 AC_MSG_RESULT([no])
1146 ])
ae1912cb 1147 fi
00505c92 1148
df3ca591 1149 if test "$OPENSSL_ENABLED" = "1"; then
8882d1fa
DS
1150 if test -n "$LIB_OPENSSL"; then
1151 dnl when the ssl shared libs were found in a path that the run-time
1152 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1153 dnl to prevent further configure tests to fail due to this
1154
1155 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
1156 export LD_LIBRARY_PATH
1157 AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
1158 fi
1ee7f92c
DS
1159 fi
1160
ae1912cb
DS
1161fi
1162
c518c52a
DS
1163dnl **********************************************************************
1164dnl Check for the presence of ZLIB libraries and headers
1165dnl **********************************************************************
1166
1167dnl Check for & handle argument to --with-zlib.
1168
1169_cppflags=$CPPFLAGS
1170_ldflags=$LDFLAGS
1171AC_ARG_WITH(zlib,
1172AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
1173AC_HELP_STRING([--without-zlib],[disable use of zlib]),
1174 [OPT_ZLIB="$withval"])
1175
1176if test "$OPT_ZLIB" = "no" ; then
1177 AC_MSG_WARN([zlib disabled])
1178else
1179 if test "$OPT_ZLIB" = "yes" ; then
1180 OPT_ZLIB=""
1181 fi
1182
1183 if test -z "$OPT_ZLIB" ; then
1184 dnl check for the lib first without setting any new path, since many
1185 dnl people have it in the default path
1186
1187 AC_CHECK_LIB(z, inflateEnd,
1188 dnl libz found, set the variable
1189 [HAVE_LIBZ="1"],
1190 dnl if no lib found, try /usr/local
1191 [OPT_ZLIB="/usr/local"])
1192
1193 fi
1194
1195 dnl Add a nonempty path to the compiler flags
1196 if test -n "$OPT_ZLIB"; then
1197 CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
1198 LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
1199 fi
1200
1201 AC_CHECK_HEADER(zlib.h,
1202 [
1203 dnl zlib.h was found
1204 HAVE_ZLIB_H="1"
1205 dnl if the lib wasn't found already, try again with the new paths
1206 if test "$HAVE_LIBZ" != "1"; then
1207 AC_CHECK_LIB(z, gzread,
1208 [
1209 dnl the lib was found!
1210 HAVE_LIBZ="1"
1211 ],
1212 [ CPPFLAGS=$_cppflags
1213 LDFLAGS=$_ldflags])
1214 fi
1215 ],
1216 [
1217 dnl zlib.h was not found, restore the flags
1218 CPPFLAGS=$_cppflags
1219 LDFLAGS=$_ldflags]
1220 )
1221
1222 if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
1223 then
1224 AC_MSG_WARN([configure found only the libz lib, not the header file!])
1225 elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
1226 then
1227 AC_MSG_WARN([configure found only the libz header file, not the lib!])
1228 elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
1229 then
1230 dnl both header and lib were found!
1231 AC_SUBST(HAVE_LIBZ)
1232 AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
1233 AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
1234
1235 CURL_LIBS="$CURL_LIBS -lz"
1236 LIBS="$LIBS -lz"
1237
1238 dnl replace 'HAVE_LIBZ' in the automake makefile.ams
1239 AMFIXLIB="1"
1240 AC_MSG_NOTICE([found both libz and libz.h header])
1241 curl_zlib_msg="enabled"
1242 fi
1243fi
1244
1245dnl set variable for use in automakefile(s)
1246AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
1247
2147284c
DS
1248dnl **********************************************************************
1249dnl Check for the presence of LIBSSH2 libraries and headers
1250dnl **********************************************************************
1251
1252dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
1253OPT_LIBSSH2=off
1254AC_ARG_WITH(libssh2,dnl
1255AC_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])
1256AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
1257 OPT_LIBSSH2=$withval)
1258
1259if test X"$OPT_LIBSSH2" != Xno; then
1260 dnl backup the pre-libssh2 variables
1261 CLEANLDFLAGS="$LDFLAGS"
1262 CLEANCPPFLAGS="$CPPFLAGS"
1263 CLEANLIBS="$LIBS"
1264
1265 case "$OPT_LIBSSH2" in
1266 yes)
1267 dnl --with-libssh2 (without path) used
1268 PREFIX_LIBSSH2=/usr/local/lib
1269 LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
1270 ;;
1271 off)
1272 dnl no --with-libssh2 option given, just check default places
1273 PREFIX_LIBSSH2=
1274 ;;
1275 *)
b9af0d89 1276 dnl use the given --with-libssh2 spot
2147284c
DS
1277 PREFIX_LIBSSH2=$OPT_LIBSSH2
1278 LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
1279 LDFLAGS="$LDFLAGS -L$LIB_LIBSSH2"
b9af0d89 1280 CPPFLAGS="$CPPFLAGS -I$PREFIX_LIBSSH2/include"
2147284c
DS
1281 ;;
1282 esac
1283
c185cdf2 1284 AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
e16c1b8e 1285
c185cdf2
DS
1286 AC_CHECK_HEADERS(libssh2.h,
1287 curl_ssh_msg="enabled (libSSH2)"
1288 LIBSSH2_ENABLED=1
1289 AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use]))
1290
1291 if test X"$OPT_LIBSSH2" != Xoff &&
1292 test "$LIBSSH2_ENABLED" != "1"; then
1293 AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
2147284c
DS
1294 fi
1295
1296 if test "$LIBSSH2_ENABLED" = "1"; then
1297 if test -n "$LIB_LIBSSH2"; then
1298 dnl when the libssh2 shared libs were found in a path that the run-time
1299 dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
1300 dnl to prevent further configure tests to fail due to this
1301
1302 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_LIBSSH2"
1303 export LD_LIBRARY_PATH
1304 AC_MSG_NOTICE([Added $LIB_LIBSSH2 to LD_LIBRARY_PATH])
1305 fi
1306 fi
1307fi
1308
df3ca591 1309dnl **********************************************************************
e16c1b8e 1310dnl Check for the random seed preferences
df3ca591
DS
1311dnl **********************************************************************
1312
1313if test X"$OPENSSL_ENABLED" = X"1"; then
1314 AC_ARG_WITH(egd-socket,
1315 AC_HELP_STRING([--with-egd-socket=FILE],
1316 [Entropy Gathering Daemon socket pathname]),
1317 [ EGD_SOCKET="$withval" ]
1318 )
1319 if test -n "$EGD_SOCKET" ; then
1320 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
1321 [your Entropy Gathering Daemon socket pathname] )
1322 fi
1323
1324 dnl Check for user-specified random device
1325 AC_ARG_WITH(random,
1326 AC_HELP_STRING([--with-random=FILE],
1327 [read randomness from FILE (default=/dev/urandom)]),
1328 [ RANDOM_FILE="$withval" ],
1329 [
1330 dnl Check for random device
1331 AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
1332 ]
1333 )
1334 if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
1335 AC_SUBST(RANDOM_FILE)
1336 AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
1337 [a suitable file to read random data from])
1338 fi
1339fi
1340
bebd5dbc
DS
1341dnl ----------------------------------------------------
1342dnl FIX: only check for GnuTLS if OpenSSL is not enabled
1343dnl ----------------------------------------------------
1344
1345dnl Default to compiler & linker defaults for GnuTLS files & libraries.
e49a7e36 1346OPT_GNUTLS=no
bebd5dbc
DS
1347
1348AC_ARG_WITH(gnutls,dnl
1349AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
1350AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
1351 OPT_GNUTLS=$withval)
1352
1353if test "$OPENSSL_ENABLED" != "1"; then
1354
e49a7e36 1355 if test X"$OPT_GNUTLS" != Xno; then
bebd5dbc
DS
1356 if test "x$OPT_GNUTLS" = "xyes"; then
1357 check=`libgnutls-config --version 2>/dev/null`
1358 if test -n "$check"; then
1359 addlib=`libgnutls-config --libs`
1360 addcflags=`libgnutls-config --cflags`
1361 version=`libgnutls-config --version`
241b2b4a 1362 gtlsprefix=`libgnutls-config --prefix`
bebd5dbc
DS
1363 fi
1364 else
313f1a1e
DS
1365 addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
1366 addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
c2fcdf3a 1367 version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
241b2b4a 1368 gtlsprefix=$OPT_GNUTLS
c2fcdf3a
DS
1369 if test -z "$version"; then
1370 version="unknown"
1371 fi
bebd5dbc 1372 fi
313f1a1e 1373 if test -n "$addlib"; then
bebd5dbc 1374
b0bc2f00 1375 CLEANLIBS="$LIBS"
313f1a1e 1376 CLEANCPPFLAGS="$CPPFLAGS"
e16c1b8e 1377
b0bc2f00 1378 LIBS="$LIBS $addlib"
313f1a1e
DS
1379 if test "$addcflags" != "-I/usr/include"; then
1380 CPPFLAGS="$CPPFLAGS $addcflags"
1381 fi
e16c1b8e 1382
313f1a1e 1383 AC_CHECK_LIB(gnutls, gnutls_check_version,
bebd5dbc
DS
1384 [
1385 AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
1386 AC_SUBST(USE_GNUTLS, [1])
02267eba 1387 GNUTLS_ENABLED=1
bebd5dbc 1388 USE_GNUTLS="yes"
313f1a1e 1389 curl_ssl_msg="enabled (GnuTLS)"
bebd5dbc
DS
1390 ],
1391 [
b0bc2f00 1392 LIBS="$CLEANLIBS"
bebd5dbc
DS
1393 CPPFLAGS="$CLEANCPPFLAGS"
1394 ])
e16c1b8e 1395
313f1a1e
DS
1396 if test "x$USE_GNUTLS" = "xyes"; then
1397 AC_MSG_NOTICE([detected GnuTLS version $version])
241b2b4a 1398
313f1a1e
DS
1399 dnl when shared libs were found in a path that the run-time
1400 dnl linker doesn't search through, we need to add it to
1401 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1402 dnl due to this
1403
1404 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
1405 export LD_LIBRARY_PATH
4370e92d 1406 AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
313f1a1e 1407 fi
241b2b4a 1408
bebd5dbc 1409 fi
313f1a1e 1410
bebd5dbc
DS
1411 fi dnl GNUTLS not disabled
1412
bebd5dbc 1413fi dnl OPENSSL != 1
779ca097 1414
7f70dbca
DS
1415dnl ----------------------------------------------------
1416dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
1417dnl ----------------------------------------------------
1418
1419dnl Default to compiler & linker defaults for NSS files & libraries.
1420OPT_NSS=no
1421
1422AC_ARG_WITH(nss,dnl
1423AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)])
1424AC_HELP_STRING([--without-nss], [disable NSS detection]),
1425 OPT_NSS=$withval)
1426
1427if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
1428
1429 if test X"$OPT_NSS" != Xno; then
1430 if test "x$OPT_NSS" = "xyes"; then
1431 check=`pkg-config --version 2>/dev/null`
1432 if test -n "$check"; then
1433 addlib=`pkg-config --libs nss`
1434 addcflags=`pkg-config --cflags nss`
1435 version=`pkg-config --modversion nss`
1436 nssprefix=`pkg-config --variable=prefix nss`
1437 fi
1438 else
1439 # Without pkg-config, we'll kludge in some defaults
1440 addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
e16c1b8e 1441 addcflags="-I$OPT_NSS/include"
7f70dbca
DS
1442 version="unknown"
1443 gtlsprefix=$OPT_GNUTLS
1444 fi
1445 if test -n "$addlib"; then
1446
1447 CLEANLIBS="$LIBS"
1448 CLEANCPPFLAGS="$CPPFLAGS"
e16c1b8e 1449
7f70dbca
DS
1450 LIBS="$LIBS $addlib"
1451 if test "$addcflags" != "-I/usr/include"; then
1452 CPPFLAGS="$CPPFLAGS $addcflags"
1453 fi
e16c1b8e 1454
7f70dbca
DS
1455 AC_CHECK_LIB(nss3, NSS_Initialize,
1456 [
1457 AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
1458 AC_SUBST(USE_NSS, [1])
1459 USE_NSS="yes"
1460 NSS_ENABLED=1
1461 curl_ssl_msg="enabled (NSS)"
1462 ],
1463 [
1464 LIBS="$CLEANLIBS"
1465 CPPFLAGS="$CLEANCPPFLAGS"
1466 ])
e16c1b8e 1467
7f70dbca
DS
1468 if test "x$USE_NSS" = "xyes"; then
1469 AC_MSG_NOTICE([detected NSS version $version])
1470
1471 dnl when shared libs were found in a path that the run-time
1472 dnl linker doesn't search through, we need to add it to
1473 dnl LD_LIBRARY_PATH to prevent further configure tests to fail
1474 dnl due to this
1475
1476 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
1477 export LD_LIBRARY_PATH
1478 AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
1479 fi
1480
1481 fi
1482
1483 fi dnl NSS not disabled
1484
1485fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
1486
1487if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
1488 AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
1489 AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
1490fi
1491
779ca097
DS
1492dnl **********************************************************************
1493dnl Check for the CA bundle
1494dnl **********************************************************************
1495
1496if test X"$USE_GNUTLS$OPENSSL_ENABLED" != "X"; then
1497
1498 AC_MSG_CHECKING([CA cert bundle install path])
1499
1500 AC_ARG_WITH(ca-bundle,
1501AC_HELP_STRING([--with-ca-bundle=FILE], [File name to install the CA bundle as])
1502AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
1503 [ ca="$withval" ],
1504 [
1505 if test "x$prefix" != xNONE; then
1506 ca="\${prefix}/share/curl/curl-ca-bundle.crt"
1507 else
1508 ca="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
1509 fi
1510 ] )
1511
1512 if test "x$ca" != "xno"; then
1513 CURL_CA_BUNDLE='"'$ca'"'
e16c1b8e 1514 AC_SUBST(CURL_CA_BUNDLE)
779ca097
DS
1515 fi
1516 AC_MSG_RESULT([$ca])
1517fi dnl only done if some kind of SSL was enabled
1518
1519AM_CONDITIONAL(CABUNDLE, test x$ca != xno)
1520
c461254d
DF
1521dnl **********************************************************************
1522dnl Check for the presence of IDN libraries and headers
1523dnl **********************************************************************
1524
cff90cf3 1525AC_MSG_CHECKING([whether to build with libidn])
96002646 1526AC_ARG_WITH(libidn,
cff90cf3
DS
1527AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
1528AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
96002646 1529 [LIBIDN="$withval"])
cff90cf3
DS
1530
1531case "$LIBIDN" in
1532 no)
1533 AC_MSG_RESULT(no)
1534 ;;
1535 *) AC_MSG_RESULT(yes)
19a568a9
DS
1536
1537 idn=""
1538 dnl if there is a given path, check that FIRST
7bb6d76d
DS
1539 if test -n "$LIBIDN"; then
1540 if test "x$LIBIDN" != "xyes"; then
7bb6d76d
DS
1541 oldLDFLAGS=$LDFLAGS
1542 oldCPPFLAGS=$CPPFLAGS
1543 LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
1544 CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
1545 idn="yes"
1546 AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
1547 idn=""
1548 LDFLAGS=$oldLDFLAGS
1549 CPPFLAGS=$oldCPPFLAGS)
1550 fi
19a568a9
DS
1551 fi
1552
1553 if test "x$idn" != "xyes"; then
1554 dnl check with default paths
8c16696f 1555 idn="yes"
19a568a9
DS
1556 AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
1557 idn="")
1558 fi
1559
1560 if test "x$idn" = "xyes"; then
cff90cf3 1561 curl_idn_msg="enabled"
d6460aff 1562 AC_SUBST(IDN_ENABLED, [1])
4e7575fc 1563 dnl different versions of libidn have different setups of these:
1239e483 1564 AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
c6881660 1565 AC_CHECK_HEADERS( idn-free.h tld.h )
cff90cf3 1566 fi
e16c1b8e
GK
1567
1568 ;;
cff90cf3
DS
1569esac
1570
b174aeaa
DS
1571dnl Default is to try the thread-safe versions of a few functions
1572OPT_THREAD=on
243942a7
DS
1573
1574dnl detect AIX 4.3 or later
1575dnl see full docs on this reasoning in the lib/hostip.c source file
1576AC_MSG_CHECKING([AIX 4.3 or later])
1577AC_PREPROC_IFELSE([
1578#if defined(_AIX) && defined(_AIX43)
1579printf("just fine");
1580#else
1581#error "this is not AIX 4.3 or later"
1582#endif
1583],
1584 [ AC_MSG_RESULT([yes])
abd65e21 1585 RECENTAIX=yes
243942a7
DS
1586 OPT_THREAD=off ],
1587 [ AC_MSG_RESULT([no]) ]
1588)
1589
b174aeaa 1590AC_ARG_ENABLE(thread,dnl
a53d7848
DS
1591AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
1592AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
1593[ case "$enableval" in
1594 no)
1595 OPT_THREAD=off
1596 AC_MSG_WARN(libcurl will not get built using thread-safe functions)
1597 ;;
1598 *)
1599 ;;
1600 esac
1601]
b174aeaa
DS
1602)
1603
1604if test X"$OPT_THREAD" = Xoff
1605then
fd0d560b
YT
1606 AC_DEFINE(DISABLED_THREADSAFE, 1,
1607 [Set to explicitly specify we don't want to use thread-safe functions])
b174aeaa 1608else
9f2780a2
DS
1609 if test "$ipv6" != "yes"; then
1610 dnl dig around for gethostbyname_r()
1611 CURL_CHECK_GETHOSTBYNAME_R()
b174aeaa 1612
9f2780a2 1613 dnl dig around for gethostbyaddr_r()
f633ab68 1614 dnl CURL_CHECK_GETHOSTBYADDR_R()
9f2780a2 1615 fi
d4731b70 1616
61fb8fea
DS
1617 dnl poke around for inet_ntoa_r()
1618 CURL_CHECK_INET_NTOA_R()
d4731b70 1619
61fb8fea
DS
1620 dnl is there a localtime_r()
1621 CURL_CHECK_LOCALTIME_R()
d4731b70 1622
242be557
DS
1623 dnl is there a strerror_r()
1624 CURL_CHECK_STRERROR_R()
1625
f425a25c 1626 checkfor_gmtime_r="yes"
b174aeaa
DS
1627fi
1628
abd65e21 1629dnl for recent AIX versions, we skip all the thread-safe checks above since
0eace2fe
DS
1630dnl they claim a thread-safe libc using the standard API. But there are
1631dnl some functions still not thread-safe. Check for these!
1632
1633dnl Let's hope this split URL remains working:
1634dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
1635dnl genprogc/thread_quick_ref.htm
abd65e21
DS
1636
1637if test "x$RECENTAIX" = "xyes"; then
db302a10
DS
1638
1639 AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
62af3fb7
DS
1640
1641 dnl check if this is the IMB xlc compiler
1642 dnl Details thanks to => http://predef.sourceforge.net/
1643 AC_MSG_CHECKING([if this is the xlc compiler])
1644 AC_EGREP_CPP([^__xlC__], [__xlC__],
1645 dnl action if the text is found, this it has not been replaced by the
1646 dnl cpp
1647 XLC="no"
1648 AC_MSG_RESULT([no]),
1649 dnl the text was not found, it was replaced by the cpp
1650 XLC="yes"
1651 AC_MSG_RESULT([yes])
1652 CFLAGS="$CFLAGS -qthreaded"
4ab91a93
YT
1653 dnl AIX xlc has to have strict aliasing turned off. If not,
1654 dnl the optimizer assumes that pointers can only point to
1655 dnl an object of the same type.
1656 CFLAGS="$CFLAGS -qnoansialias"
62af3fb7
DS
1657 )
1658
62ff567c
DS
1659
1660 dnl is there a localtime_r()
1661 CURL_CHECK_LOCALTIME_R()
1662
1663 dnl is there a strerror_r()
1664 CURL_CHECK_STRERROR_R()
1665
f425a25c 1666 checkfor_gmtime_r="yes"
abd65e21
DS
1667fi
1668
3f16d9fb 1669if test x$cross_compiling != xyes; then
f425a25c
DS
1670
1671 if test x$checkfor_gmtime_r = xyes; then
1672
c461254d 1673 dnl if gmtime_r was found, verify that it actually works, as (at least) HPUX
f425a25c
DS
1674 dnl 10.20 is known to have a buggy one. If it doesn't work, disable use of
1675 dnl it.
1676
1677 AC_MSG_CHECKING([if gmtime_r exists and works])
1678 AC_RUN_IFELSE([[
1679 #include <time.h>
1680 int main(void)
1681 {
3f16d9fb
DS
1682 time_t local = 1170352587;
1683 struct tm *gmt;
1684 struct tm keeper;
1685 putenv("TZ=CST6CDT");
1686 tzset();
1687 gmt = gmtime_r(&local, &keeper);
1688 if(gmt) {
1689 return 0;
1690 }
1691 return 1; /* failure */
f425a25c
DS
1692 }
1693 ]],
1694 dnl success, do nothing
1695 AC_MSG_RESULT(yes)
1696 AC_DEFINE(HAVE_GMTIME_R, 1, [if you have (a working) gmtime_r])
1697 ,
1698 dnl failure, now disable the function
1699 AC_MSG_RESULT(no)
1700 ,
1701 dnl not invoked when crosscompiling)
3752b3ae
DS
1702 echo "hej"
1703 )
f425a25c
DS
1704 fi
1705else
1706 dnl and for crosscompilings
1707 AC_CHECK_FUNCS(gmtime_r)
3f16d9fb
DS
1708fi
1709
abd65e21 1710
ae1912cb
DS
1711dnl **********************************************************************
1712dnl Back to "normal" configuring
1713dnl **********************************************************************
1714
1715dnl Checks for header files.
1716AC_HEADER_STDC
075c5342 1717
4d95d23d 1718CURL_CHECK_HEADER_MALLOC
a6a5bba0
YT
1719
1720dnl Now check for the very most basic headers. Then we can use these
075c5342
DS
1721dnl ones as default-headers when checking for the rest!
1722AC_CHECK_HEADERS(
1723 sys/types.h \
1724 sys/time.h \
1725 sys/select.h \
1726 sys/socket.h \
a4351517 1727 sys/ioctl.h \
24ac5b8a 1728 assert.h \
ae1912cb 1729 unistd.h \
8898ff9e 1730 stdlib.h \
e347cff0 1731 ldap_ssl.h \
3d66d10f 1732 limits.h \
ae1912cb
DS
1733 arpa/inet.h \
1734 net/if.h \
1735 netinet/in.h \
43137cf5 1736 netinet/tcp.h \
ae1912cb 1737 netdb.h \
ae1912cb
DS
1738 sys/sockio.h \
1739 sys/stat.h \
ae1912cb
DS
1740 sys/param.h \
1741 termios.h \
1742 termio.h \
1743 sgtty.h \
1744 fcntl.h \
ae1912cb 1745 alloca.h \
ae1912cb
DS
1746 time.h \
1747 io.h \
5900c0f7 1748 pwd.h \
82d3ded9 1749 utime.h \
3c49b405 1750 sys/utime.h \
99dfdebc 1751 sys/poll.h \
a4e1ac79 1752 sys/resource.h \
8e872231 1753 libgen.h \
82d6cfa7 1754 locale.h \
65dbee01 1755 errno.h \
69565afa 1756 stdbool.h \
528a149d
DS
1757 arpa/tftp.h \
1758 sys/filio.h \
075c5342
DS
1759 setjmp.h,
1760dnl to do if not found
1761[],
1762dnl to do if found
1763[],
1764dnl default includes
1765[
1766#ifdef HAVE_SYS_TYPES_H
1767#include <sys/types.h>
1768#endif
1769#ifdef HAVE_SYS_TIME_H
1770#include <sys/time.h>
1771#endif
1772#ifdef HAVE_SYS_SELECT_H
1773#include <sys/select.h>
1774#endif
1775#ifdef HAVE_SYS_SOCKET_H
1776#include <sys/socket.h>
1777#endif
d85c2199
DS
1778#ifdef HAVE_NETINET_IN_H
1779#include <netinet/in.h>
1780#endif
075c5342 1781]
ae1912cb
DS
1782)
1783
ae1912cb
DS
1784dnl Checks for typedefs, structures, and compiler characteristics.
1785AC_C_CONST
273b2b23 1786CURL_CHECK_VARIADIC_MACROS
ae1912cb
DS
1787AC_TYPE_SIZE_T
1788AC_HEADER_TIME
32ac4ede 1789CURL_CHECK_STRUCT_TIMEVAL
67e8d229 1790CURL_VERIFY_RUNTIMELIBS
ae1912cb 1791
6cd0a90b
DS
1792AC_CHECK_SIZEOF(curl_off_t, ,[
1793#include <stdio.h>
1794#include "$srcdir/include/curl/curl.h"
1795])
78e6508e 1796AC_CHECK_SIZEOF(size_t)
af677c4e 1797AC_CHECK_SIZEOF(long)
cd73a733 1798AC_CHECK_SIZEOF(time_t)
ae1912cb 1799
a147a079 1800AC_CHECK_TYPE(long long,
af677c4e 1801 [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
e16c1b8e 1802 longlong="yes"
af677c4e
DS
1803)
1804
1805if test "xyes" = "x$longlong"; then
1806 AC_MSG_CHECKING([if numberLL works])
1807 AC_COMPILE_IFELSE([long long val = 1000LL;],
1808 [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
1809 AC_MSG_RESULT(yes),
1810 AC_MSG_RESULT(no)
1811 )
1812fi
1813
ae1912cb 1814
61e2a810 1815# check for ssize_t
a147a079
DS
1816AC_CHECK_TYPE(ssize_t, ,
1817 AC_DEFINE(ssize_t, int, [the signed version of size_t]))
61e2a810 1818
69565afa
YT
1819# check for bool type
1820AC_CHECK_TYPE([bool],[
1821 AC_DEFINE(HAVE_BOOL_T, 1,
1822 [Define to 1 if bool is an available type.])
1823], ,[
2a6a22a3
YT
1824#ifdef HAVE_SYS_TYPES_H
1825#include <sys/types.h>
1826#endif
69565afa
YT
1827#ifdef HAVE_STDBOOL_H
1828#include <stdbool.h>
1829#endif
1830])
1831
d6ffb4c1 1832# Check for socklen_t or equivalent
a6a5bba0
YT
1833CURL_CHECK_TYPE_SOCKLEN_T
1834
d09b4369 1835TYPE_IN_ADDR_T
11693c0f 1836
a31ddd36
DS
1837TYPE_SOCKADDR_STORAGE
1838
73226415
YT
1839TYPE_SIG_ATOMIC_T
1840
a46f55b9
YT
1841AC_TYPE_SIGNAL
1842
ad05d0a8
DS
1843AC_FUNC_SELECT_ARGTYPES
1844
01fa02d0
YT
1845CURL_CHECK_FUNC_RECV
1846
1847CURL_CHECK_FUNC_SEND
1848
77b3bc23
YT
1849CURL_CHECK_MSG_NOSIGNAL
1850
ae1912cb
DS
1851dnl Checks for library functions.
1852dnl AC_PROG_GCC_TRADITIONAL
a46f55b9 1853
f8e916db 1854dnl AC_FUNC_VPRINTF
74e5beab
DS
1855case $host in
1856 *msdosdjgpp)
1857 ac_cv_func_pipe=no
1858 skipcheck_pipe=yes
1859 AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
1860 ;;
1861esac
4eb9ac08
DS
1862AC_CHECK_FUNCS( strtoll \
1863 socket \
ae1912cb
DS
1864 select \
1865 strdup \
1866 strstr \
4e376a2f 1867 strtok_r \
ae1912cb
DS
1868 uname \
1869 strcasecmp \
95c2534a
DS
1870 stricmp \
1871 strcmpi \
ae1912cb 1872 gethostbyaddr \
ae1912cb
DS
1873 gettimeofday \
1874 inet_addr \
1875 inet_ntoa \
c86768d8 1876 inet_pton \
ae1912cb 1877 perror \
0e31dadf 1878 closesocket \
02437b2d 1879 siginterrupt \
852b664e 1880 sigaction \
1ff573c6 1881 signal \
f6e2bfd4 1882 getpass_r \
92186dc3
DS
1883 strlcat \
1884 getpwuid \
43d0d756 1885 geteuid \
3c49b405 1886 utime \
6a3e2272 1887 sigsetjmp \
8e872231 1888 basename \
82d6cfa7 1889 setlocale \
2e973684 1890 ftruncate \
facfa19c 1891 pipe \
a4e1ac79 1892 poll \
f13eba4c 1893 getprotobyname \
a4e1ac79 1894 getrlimit \
a2c28964 1895 setrlimit \
5e7164f8
DS
1896 fork \
1897 setmode,
70b80b01
DS
1898dnl if found
1899[],
1900dnl if not found, $ac_func is the name we check for
74e5beab 1901func="$ac_func"
d2a27e02
DS
1902eval skipcheck=\$skipcheck_$func
1903if test "x$skipcheck" != "xyes"; then
70b80b01
DS
1904 AC_MSG_CHECKING([deeper for $func])
1905 AC_TRY_LINK( [],
1906 [ $func ();],
1907 AC_MSG_RESULT(yes!)
d65587b0 1908 eval "ac_cv_func_$func=yes"
70b80b01 1909 def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
d65587b0 1910 AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
70b80b01
DS
1911 AC_MSG_RESULT(but still no)
1912 )
74e5beab 1913fi
ae1912cb
DS
1914)
1915
25559ac0
DS
1916dnl For some reason, the check above doesn't properly detect select() with
1917dnl Msys/Mingw
cc542269 1918if test "$ac_cv_func_select" = "no"; then
25559ac0 1919 AC_MSG_CHECKING([for select in ws2_32])
74ed5b5e
YT
1920 AC_TRY_LINK([
1921#undef inline
1922#ifdef HAVE_WINDOWS_H
1923#ifndef WIN32_LEAN_AND_MEAN
1924#define WIN32_LEAN_AND_MEAN
1925#endif
1926#include <windows.h>
1927#ifdef HAVE_WINSOCK2_H
1928#include <winsock2.h>
1929#else
1930#ifdef HAVE_WINSOCK_H
1931#include <winsock.h>
1932#endif
1933#endif
1934#endif
cc542269
YT
1935 ],[
1936 select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
e16c1b8e 1937 ],[
cc542269
YT
1938 AC_MSG_RESULT([yes])
1939 HAVE_SELECT="1"
1940 AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
1941 [Define to 1 if you have the select function.])
1942 ],[
fd0d560b 1943 AC_MSG_ERROR([You can't compile without a select])
cc542269 1944 ])
25559ac0
DS
1945fi
1946
3c49b405
DS
1947dnl sigsetjmp() might be a macro and no function so if it isn't found already
1948dnl we make an extra check here!
1949if test "$ac_cv_func_sigsetjmp" != "yes"; then
1950 AC_MSG_CHECKING([for sigsetjmp defined as macro])
1951 AC_TRY_LINK( [#include <setjmp.h>],
1952 [sigjmp_buf jmpenv;
1953 sigsetjmp(jmpenv, 1);],
1954 AC_MSG_RESULT(yes)
22a32389 1955 AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]),
3c49b405
DS
1956 AC_MSG_RESULT(no)
1957 )
1958fi
1959
76637759
DS
1960AC_CHECK_DECL(basename, ,
1961 AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
1962#ifdef HAVE_STRING_H
1963#include <string.h>
1964#endif
1965#ifdef HAVE_LIBGEN_H
1966#include <libgen.h>
1967#endif
74e5beab
DS
1968#ifdef HAVE_UNISTD_H
1969#include <unistd.h>
1970#endif
76637759
DS
1971)
1972
b222b230 1973AC_CHECK_DECL(inet_pton, ,
84d30dff
DS
1974 AC_DEFINE(HAVE_NO_INET_PTON_PROTO, 1,
1975 [Defined if no inet_pton() prototype available]),
b222b230
DS
1976[
1977#ifdef HAVE_ARPA_INET_H
1978#include <arpa/inet.h>
1979#endif
1980]
1981)
1982
e4388643
YT
1983dnl Check if the getnameinfo function is available
1984dnl and get the types of five of its arguments.
1985CURL_CHECK_FUNC_GETNAMEINFO
2e5cccd1 1986
bec19771
YT
1987if test "$ipv6" = "yes"; then
1988 CURL_CHECK_WORKING_GETADDRINFO
1989 CURL_CHECK_NI_WITHSCOPEID
1990fi
1991
c2862742 1992AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
0b3decee
DS
1993disable_poll=no
1994case $host in
c2862742 1995 *-*-darwin*)
0b3decee
DS
1996 disable_poll="yes";
1997 ;;
1998 *)
1999 ;;
2000esac
2001AC_MSG_RESULT($disable_poll)
2002
2003if test "$disable_poll" = "no"; then
2004
2005 dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
2006 dnl to find out we make an extra check here!
2007 if test "$ac_cv_func_poll" = "yes"; then
2008 AC_MSG_CHECKING([if poll works with NULL inputs])
2009 AC_RUN_IFELSE([
a7b99fc4
DS
2010#ifdef HAVE_SYS_POLL_H
2011#include <sys/poll.h>
2012#endif
2013
2014 int main(void)
2015 {
2016 /* make this return 0 == timeout since there's nothing to read from */
2017 return poll((void *)0, 0, 10 /*ms*/);
2018 }
2019],
0b3decee
DS
2020 AC_MSG_RESULT(yes)
2021 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
2022 AC_MSG_RESULT(no),
2023 AC_MSG_RESULT(cross-compiling assumes yes)
2024 AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
2025 ) dnl end of AC_RUN_IFELSE
2026 fi dnl poll() was found
2027fi dnl poll()-check is not disabled
a7b99fc4
DS
2028
2029
e16c1b8e 2030AC_PATH_PROG( PERL, perl, ,
7dc36344
DS
2031 $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
2032AC_SUBST(PERL)
ae1912cb 2033
e16c1b8e 2034AC_PATH_PROGS( NROFF, gnroff nroff, ,
ae1912cb 2035 $PATH:/usr/bin/:/usr/local/bin )
96dde76b 2036AC_SUBST(NROFF)
ae1912cb 2037
773e7e87
DS
2038if test -n "$NROFF"; then
2039 dnl only check for nroff options if an nroff command was found
2040
2041 AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
2042 MANOPT="-man"
37685848
DS
2043 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2044 if test -z "$mancheck"; then
773e7e87
DS
2045 MANOPT="-mandoc"
2046 mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
2047 if test -z "$mancheck"; then
2048 MANOPT=""
2049 AC_MSG_RESULT([failed])
2050 AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
2051 else
2052 AC_MSG_RESULT([$MANOPT])
2053 fi
37685848
DS
2054 else
2055 AC_MSG_RESULT([$MANOPT])
2056 fi
773e7e87
DS
2057 AC_SUBST(MANOPT)
2058fi
2059
2060if test -z "$MANOPT"
2061then
2062 dnl if no nroff tool was found, or no option that could convert man pages
2063 dnl was found, then disable the built-in manual stuff
2064 AC_MSG_WARN([disabling built-in manual])
2065 USE_MANUAL="no";
37685848 2066fi
37685848 2067
f3663a9d
DS
2068dnl *************************************************************************
2069dnl If the manual variable still is set, then we go with providing a built-in
2070dnl manual
2071
2072if test "$USE_MANUAL" = "1"; then
2073 AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
cff90cf3 2074 curl_manual_msg="enabled"
f3663a9d
DS
2075fi
2076
2077dnl set variable for use in automakefile(s)
2078AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
2079
4c663ba9 2080AC_MSG_CHECKING([whether to enable c-ares])
673ff5eb 2081AC_ARG_ENABLE(ares,
4c663ba9
DS
2082AC_HELP_STRING([--enable-ares=PATH],[Enable c-ares for name lookups])
2083AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
673ff5eb
DS
2084[ case "$enableval" in
2085 no)
2086 AC_MSG_RESULT(no)
2087 ;;
2088 *) AC_MSG_RESULT(yes)
2089
2090 if test "x$IPV6_ENABLED" = "x1"; then
4c663ba9 2091 AC_MSG_NOTICE([c-ares may not work properly with ipv6])
673ff5eb
DS
2092 fi
2093
4c663ba9 2094 AC_DEFINE(USE_ARES, 1, [Define if you want to enable c-ares support])
673ff5eb
DS
2095 dnl substitute HAVE_ARES for curl-config and similar
2096 HAVE_ARES="1"
2097 AC_SUBST(HAVE_ARES)
2098 curl_ares_msg="enabled"
2099
f7503863 2100 LIBS="-lcares $LIBS"
673ff5eb
DS
2101
2102 dnl For backwards compatibility default to includes/lib in srcdir/ares
2103 dnl If a value is specified it is assumed that the libs are in $val/lib
2104 dnl and the includes are in $val/include. This is the default setup for
2105 dnl ares so it should not be a problem.
2106 if test "x$enableval" = "xyes" ; then
2107 if test -d "$srcdir/ares"; then
2108 aresembedded="yes"
2109 AC_CONFIG_SUBDIRS(ares)
2110 aresinc=`cd $srcdir/ares && pwd`
2111 CPPFLAGS="$CPPFLAGS -I$aresinc"
2112
2113 dnl the pwd= below cannot 'cd' into the ares dir to get the full
2114 dnl path to it, since it may not exist yet if we build outside of
2115 dnl the source tree
2116 pwd=`pwd`
2117 LDFLAGS="$LDFLAGS -L$pwd/ares"
2118 fi
2119 else
2120 CPPFLAGS="$CPPFLAGS -I$enableval/include"
2121 LDFLAGS="$LDFLAGS -L$enableval/lib"
2122 fi
2123
2124 if test -z "$aresembedded"; then
2125 dnl verify that a sufficient c-ares is here if we have pointed one
2126 dnl out and don't use the "embedded" ares dir (in which case we don't
2127 dnl check it because it might not have been built yet)
2128 AC_MSG_CHECKING([that c-ares is good and recent enough])
2129 AC_LINK_IFELSE( [
2130#include <ares.h>
2131/* provide a set of dummy functions in case c-ares was built with debug */
2132void curl_dofree() { }
2133void curl_sclose() { }
2134void curl_domalloc() { }
f3663a9d 2135
673ff5eb
DS
2136int main(void)
2137{
2138 ares_channel channel;
4c663ba9
DS
2139 ares_cancel(channel); /* added in 1.2.0 */
2140 ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
673ff5eb
DS
2141 return 0;
2142}
2143],
2144 AC_MSG_RESULT(yes),
2145 AC_MSG_RESULT(no)
2146 AC_MSG_ERROR([c-ares library defective or too old])
2147 )
2148 fi
2149 ;;
2150 esac ],
2151 AC_MSG_RESULT(no)
2152)
ae1912cb 2153
710e370c
DS
2154dnl ************************************************************
2155dnl disable verbose text strings
2156dnl
2157AC_MSG_CHECKING([whether to enable verbose strings])
2158AC_ARG_ENABLE(verbose,
2159AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
2160AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
2161[ case "$enableval" in
2162 no)
2163 AC_MSG_RESULT(no)
2164 AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
2165 AC_SUBST(CURL_DISABLE_VERBOSE_STRINGS)
2166 curl_verbose_msg="no"
2167 ;;
2168 *) AC_MSG_RESULT(yes)
2169 ;;
2170 esac ],
2171 AC_MSG_RESULT(yes)
2172)
2173
d8d3dc93
YT
2174CURL_CHECK_NATIVE_WINDOWS
2175
8ed31c48
DS
2176dnl ************************************************************
2177dnl enable SSPI support
2178dnl
d8d3dc93 2179AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
8ed31c48
DS
2180AC_ARG_ENABLE(sspi,
2181AC_HELP_STRING([--enable-sspi],[Enable SSPI])
2182AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
2183[ case "$enableval" in
2184 yes)
d8d3dc93
YT
2185 if test "$ac_cv_native_windows" = "yes"; then
2186 AC_MSG_RESULT(yes)
2187 AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
2188 AC_SUBST(USE_WINDOWS_SSPI)
2189 curl_sspi_msg="yes"
2190 else
2191 AC_MSG_RESULT(no)
2192 AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
2193 fi
8ed31c48
DS
2194 ;;
2195 *)
2196 AC_MSG_RESULT(no)
2197 ;;
2198 esac ],
2199 AC_MSG_RESULT(no)
2200)
2201
3c49b405
DS
2202dnl ************************************************************
2203dnl lame option to switch on debug options
2204dnl
2205AC_MSG_CHECKING([whether to enable debug options])
2206AC_ARG_ENABLE(debug,
f136f435
DS
2207AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
2208AC_HELP_STRING([--disable-debug],[Disable debug options]),
3c49b405
DS
2209[ case "$enableval" in
2210 no)
2211 AC_MSG_RESULT(no)
2212 ;;
2213 *) AC_MSG_RESULT(yes)
2214
f8c3b3aa 2215 CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
4fa58560 2216 CFLAGS="$CFLAGS -g"
455b1af2 2217
4fa58560
DS
2218 dnl set compiler "debug" options to become more picky, and remove
2219 dnl optimize options from CFLAGS
2220 CURL_CC_DEBUG_OPTS
3c49b405 2221 ;;
4fa58560
DS
2222 esac
2223 ],
3c49b405
DS
2224 AC_MSG_RESULT(no)
2225)
2226
94043b11
DS
2227dnl ************************************************************
2228dnl disable cryptographic authentication
2229dnl
2230AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
2231AC_ARG_ENABLE(crypto-auth,
2232AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
2233AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
2234[ case "$enableval" in
2235 no)
2236 AC_MSG_RESULT(no)
2237 AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
2238 AC_SUBST(CURL_DISABLE_CRYPTO_AUTH)
2239 ;;
2240 *) AC_MSG_RESULT(yes)
2241 ;;
2242 esac ],
2243 AC_MSG_RESULT(yes)
2244)
2245
ac269a8f
DS
2246dnl ************************************************************
2247dnl disable cookies support
2248dnl
2249AC_MSG_CHECKING([whether to enable support for cookies])
2250AC_ARG_ENABLE(cookies,
2251AC_HELP_STRING([--enable-cookies],[Enable cookies support])
2252AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
2253[ case "$enableval" in
2254 no)
2255 AC_MSG_RESULT(no)
2256 AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
2257 AC_SUBST(CURL_DISABLE_COOKIES)
2258 ;;
2259 *) AC_MSG_RESULT(yes)
2260 ;;
2261 esac ],
2262 AC_MSG_RESULT(yes)
2263)
2264
59582a9d
DF
2265dnl ************************************************************
2266dnl Enable hiding of internal symbols in library to reduce its size and
2267dnl speed dynamic linking of applications. This currently is only supported
10489879 2268dnl on gcc >= 4.0 and SunPro C.
59582a9d
DF
2269dnl
2270AC_MSG_CHECKING([whether to enable hidden symbols in the library])
2271AC_ARG_ENABLE(hidden-symbols,
10489879 2272AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
59582a9d
DF
2273AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
2274[ case "$enableval" in
2275 no)
2276 AC_MSG_RESULT(no)
2277 ;;
e16c1b8e 2278 *)
10489879 2279 AC_MSG_CHECKING([whether $CC supports it])
f13ac35e 2280 if test "$GCC" = yes ; then
f13ac35e 2281 if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
77431568
GK
2282 AC_MSG_RESULT(yes)
2283 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2284 AC_SUBST(CURL_HIDDEN_SYMBOLS)
2285 AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
2286 AC_SUBST(CURL_EXTERN_SYMBOL)
2287 CFLAGS="$CFLAGS -fvisibility=hidden"
f13ac35e
DF
2288 else
2289 AC_MSG_RESULT(no)
2290 fi
10489879 2291
f13ac35e 2292 else
77431568
GK
2293 dnl Test for SunPro cc
2294 if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
10489879 2295 AC_MSG_RESULT(yes)
77431568
GK
2296 AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
2297 AC_SUBST(CURL_HIDDEN_SYMBOLS)
2298 AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
2299 AC_SUBST(CURL_EXTERN_SYMBOL)
2300 CFLAGS="$CFLAGS -xldscope=hidden"
10489879
DF
2301 else
2302 AC_MSG_RESULT(no)
2303 fi
f13ac35e 2304 fi
59582a9d
DF
2305 ;;
2306 esac ],
2307 AC_MSG_RESULT(no)
2308)
2309
2310dnl ************************************************************
9f3d9da1
DS
2311if test "x$ws2" = "xyes"; then
2312
2313 dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
2314 dnl things work when built with c-ares). But we can't just move it last
2315 dnl since then other stuff (SSL) won't build. So we simply append it to the
2316 dnl end.
2317
2318 LIBS="$LIBS -lws2_32"
c461254d 2319 TEST_SERVER_LIBS="$TEST_SERVER_LIBS -lws2_32"
9f3d9da1
DS
2320
2321fi
2322
a0a47f27
DF
2323dnl
2324dnl All the library dependencies put into $LIB apply to libcurl only.
2325dnl Those in $CURL_LIBS apply to the curl command-line client only.
c461254d 2326dnl Those in $TEST_SERVER_LIBS apply to test servers only.
a0a47f27
DF
2327dnl Those in $ALL_LIBS apply to all targets, including test targets.
2328dnl
2329LIBCURL_LIBS=$LIBS
a0a47f27
DF
2330
2331AC_SUBST(LIBCURL_LIBS)
2332AC_SUBST(CURL_LIBS)
2333AC_SUBST(TEST_SERVER_LIBS)
c461254d 2334LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
a0a47f27 2335
20705ca3
DS
2336AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
2337
93c53424 2338AC_CONFIG_FILES([Makefile \
77431568 2339 docs/Makefile \
d54cdf29 2340 docs/examples/Makefile \
e22657ea 2341 docs/libcurl/Makefile \
77431568
GK
2342 include/Makefile \
2343 include/curl/Makefile \
2344 src/Makefile \
172f0ba1 2345 lib/Makefile \
044ca343 2346 tests/Makefile \
b915ca68 2347 tests/data/Makefile \
fd8bf5f1 2348 tests/server/Makefile \
2aa0c6c4 2349 tests/libtest/Makefile \
77431568
GK
2350 packages/Makefile \
2351 packages/Win32/Makefile \
2352 packages/Win32/cygwin/Makefile \
2353 packages/Linux/Makefile \
2354 packages/Linux/RPM/Makefile \
2355 packages/Linux/RPM/curl.spec \
2356 packages/Linux/RPM/curl-ssl.spec \
c503930b 2357 packages/Solaris/Makefile \
d78ec593 2358 packages/DOS/Makefile \
34f9ab10
DS
2359 packages/EPM/curl.list \
2360 packages/EPM/Makefile \
f19cade5 2361 packages/vms/Makefile \
c7e9e60b
DS
2362 packages/AIX/Makefile \
2363 packages/AIX/RPM/Makefile \
15f2647d 2364 packages/AIX/RPM/curl.spec \
df3ca591
DS
2365 curl-config \
2366 libcurl.pc
93c53424
DS
2367])
2368AC_OUTPUT
cff90cf3
DS
2369
2370AC_MSG_NOTICE([Configured to build curl/libcurl:
2371
2372 curl version: ${VERSION}
2373 Host setup: ${host}
2374 Install prefix: ${prefix}
2375 Compiler: ${CC}
2376 SSL support: ${curl_ssl_msg}
2147284c 2377 SSH support: ${curl_ssh_msg}
cff90cf3
DS
2378 zlib support: ${curl_zlib_msg}
2379 krb4 support: ${curl_krb4_msg}
2380 GSSAPI support: ${curl_gss_msg}
48975876 2381 SPNEGO support: ${curl_spnego_msg}
cff90cf3
DS
2382 c-ares support: ${curl_ares_msg}
2383 ipv6 support: ${curl_ipv6_msg}
96002646 2384 IDN support: ${curl_idn_msg}
e16c1b8e 2385 Build libcurl: Shared=${enable_shared}, Static=${enable_static}
cff90cf3 2386 Built-in manual: ${curl_manual_msg}
710e370c 2387 Verbose errors: ${curl_verbose_msg}
8ed31c48 2388 SSPI support: ${curl_sspi_msg}
779ca097 2389 ca cert path: ${ca}
d0edb478 2390 LDAP support: ${curl_ldap_msg}
cff90cf3 2391])