245
244
dnl Checks for libraries.
248
dnl $with_ssl can be one of:
249
dnl - empty string or "auto", meaning autodetect SSL and use it if found.
250
dnl - "yes", meaning link with SSL or bail out.
251
dnl - "no", meaning don't link with SSL.
252
dnl - anything else, meaning use that as the SSL root, and bail out
255
if test x"$with_ssl" = x; then
256
dnl Canonicalize unspecified with-ssl setting to "auto". This
257
dnl implements the "auto-detect by default" feature. If you want to
258
dnl change this to "ignore SSL by default", change "auto" to "no".
262
dnl Detection of OpenSSL is much hairier than the detection of other
263
dnl libraries because OpenSSL can be compiled as a third-party
264
dnl library, which means it will not be found without additional
265
dnl linker magic. It would be really nice to rework this check into
266
dnl an AC_DEFUN so that we can reuse it for other third-party
269
if test x"$with_ssl" != x"no"; then
272
if test x"$with_ssl" = x"yes"; then
276
if test x"$with_ssl" = x"yes" || test x"$with_ssl" = x"auto"; then
277
dnl OpenSSL's root was not specified, so we have to guess. First
278
dnl try the system default location, then "/usr/local/ssl" (where
279
dnl OpenSSL installs by default), then "/usr/local" (traditional
280
dnl choice for installation root), then "/opt".
281
ssl_all_roots="system-default /usr/local/ssl /usr/local /opt"
283
dnl Root has been specified by the user.
284
ssl_all_roots=$with_ssl
290
wget_save_LDFLAGS=$LDFLAGS
291
wget_save_CPPFLAGS=$CPPFLAGS
293
dnl Use libtool for OpenSSL tests so we can specify "-R<rpath>"
294
dnl without having to know how the linker handles it.
295
CC="$SHELL ./libtool $CC"
297
dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
298
dnl shared library doesn't record its dependency on libdl, so we
299
dnl need to check for it ourselves so we won't fail to link due to a
300
dnl lack of -ldl. Most OSes use dlopen(), but HP-UX uses
302
AC_CHECK_LIB(dl,dlopen)
303
AC_CHECK_LIB(dl,shl_load)
307
dnl Now try to find SSL libraries in each of the likely SSL roots.
308
for ssl_root in $ssl_all_roots
310
if test x"$ssl_root" = x"system-default"; then
311
dnl Try the default include and library locations.
314
dnl Try this specific root.
315
SSL_INCLUDES=-I$ssl_root/include
316
dnl It's OK to use -R directly because libtool will
317
dnl interpret it for us.
318
LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
321
AC_MSG_NOTICE([looking for SSL libraries in $ssl_root])
323
dnl Check whether the compiler can find the include files. On
324
dnl some systems Gcc finds libraries in /usr/local/lib, but fails
325
dnl to find the includes in /usr/local/include.
327
ssl_found_includes=no
328
CPPFLAGS="$SSL_INCLUDES $wget_save_CPPFLAGS"
330
dnl Check for all the OpenSSL includes that Wget actually uses.
331
dnl This will prune both invalid installations and ancient
332
dnl versions of OpenSSL that we can't use.
333
AC_MSG_CHECKING([for includes])
247
dnl Check for OpenSSL
248
if test x"$with_ssl" != x"no"
250
dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
251
dnl doesn't record its dependency on libdl, so we need to make sure
252
dnl -ldl ends up in LIBS on systems that have it. Most OSes use
253
dnl dlopen(), but HP-UX uses shl_load().
254
AC_CHECK_LIB(dl, dlopen, [], [
255
AC_CHECK_LIB(dl, shl_load)
258
dnl Now actually check for -lssl
259
AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [
335
260
#include <openssl/ssl.h>
336
261
#include <openssl/x509.h>
337
262
#include <openssl/err.h>
339
264
#include <openssl/des.h>
340
265
#include <openssl/md4.h>
341
266
#include <openssl/md5.h>
344
ssl_found_includes=yes
346
AC_MSG_RESULT([not found])
349
if test x"$ssl_found_includes" = xno; then
355
dnl Make sure that the checks don't run afoul of the cache. It
356
dnl would be nicer to temporarily turn off the cache, but
357
dnl apparently Autoconf doesn't allow that.
359
unset ac_cv_lib_crypto_RSA_new
360
unset ac_cv_lib_ssl_SSL_new
362
dnl These checks need to be in this order, or you'll get a link
363
dnl failure if you use a static libcrypto.a and libssl.a rather
364
dnl than shared libraries.
366
AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
367
AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
369
if test x"$ssl_link_failure" = xyes; then
370
dnl One or both libs failed to link.
374
dnl The libraries link. But we still need to check if the program
375
dnl linked with those libraries under these settings with run. On
376
dnl some systems (Solaris), Gcc adds -L/usr/local/lib to the
377
dnl linking line, but fails to add -R/usr/local/lib, thus creating
378
dnl executables that link, but fail to run.
380
dnl If we are cross-compiling, just assume that working linkage
381
dnl implies working executable.
385
AC_MSG_CHECKING([whether SSL libs are resolved at runtime])
392
AC_MSG_RESULT(no); ssl_run_failure=yes,
396
if test x"$ssl_run_failure" = xno; then
402
if test x"$ssl_success" = xyes; then
403
AC_MSG_NOTICE([compiling in support for SSL in $ssl_root])
267
], [SSL_library_init ()])
268
if test x"$LIBSSL" != x
270
AC_MSG_NOTICE([compiling in support for SSL])
404
271
AC_DEFINE([HAVE_SSL], 1,
405
[Define if SSL support should be compiled in.])
406
AC_SUBST(SSL_INCLUDES)
272
[Define if SSL support is being compiled in.])
407
273
SSL_OBJ='openssl$o'
410
LDFLAGS=$wget_save_LDFLAGS
413
dnl If linking with SSL was forced rather than auto-detected, then
414
dnl bail out if SSL failed.
415
if test x"$wget_force_ssl" = x"yes"; then
416
AC_MSG_ERROR([failed to find OpenSSL libraries], 2)
274
elif test x"$with_ssl" != x
276
AC_MSG_ERROR([--with-ssl was given, but OpenSSL is not available.])
420
dnl Restore the compiler setting.
423
dnl Restore the CPPFLAGS. Do this regardless of whether linking
424
dnl with SSL succeeded -- SSL includes will be handled using
426
CPPFLAGS=$wget_save_CPPFLAGS
429
281
dnl Enable NTLM if requested and if SSL is available.
431
if test x"$ssl_success" = xyes
283
if test x"$LIBSSL" != x
433
285
if test x"$ENABLE_NTLM" != xno
461
314
dnl Check for the system MD5 library on Solaris. We don't check for
462
315
dnl something simple like "MD5Update" because there are a number of
463
dnl MD5 implementations that use that name. md5_calc is, hopefully,
464
dnl specific to the Solaris MD5 library.
316
dnl MD5 implementations that use that name, but have an otherwise
317
dnl incompatible interface. md5_calc is, hopefully, specific to the
318
dnl Solaris MD5 library.
465
319
if test x"$found_md5" = xno; then
466
320
AC_CHECK_LIB(md5, md5_calc, [
467
321
dnl Some installations have bogus <md5.h> in the compiler's
504
358
dnl **********************************************************************
507
dnl If --enable-ipv6 is specified, we try to use IPv6 (as long as
508
dnl getaddrinfo is also present). If --disable-ipv6 is specified, we
509
dnl don't use IPv6 or getaddrinfo. Otherwise we detect IPv6 and use
510
dnl it where available.
361
dnl We test for IPv6 by checking, in turn, for availability of
362
dnl getaddrinfo, presence of the INET6 address/protocol family, and
363
dnl the existence of struct sockaddr_in6. If any of them is missing,
364
dnl IPv6 is disabled, and the code reverts to old-style gethostbyname.
366
dnl If --enable-ipv6 is explicitly specified on the configure command
367
dnl line, we check for IPv6 and abort if not found. If --disable-ipv6
368
dnl is specified, we disable IPv6 and don't check for it. The default
369
dnl is to autodetect IPv6 and use it where available.
513
372
AC_ARG_ENABLE(ipv6,