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