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