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