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