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