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