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