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