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