- ssl_link_failure=no
-
- dnl Make sure that the checks don't run afoul of the cache. It
- dnl would be nicer to temporarily turn off the cache, but
- dnl apparently Autoconf doesn't allow that.
-
- unset ac_cv_lib_crypto_RSA_new
- unset ac_cv_lib_ssl_SSL_new
-
- dnl These checks need to be in this order, or you'll get a link
- dnl failure if you use a static libcrypto.a and libssl.a rather
- dnl than shared libraries.
-
- AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
- AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
-
- if test x"$ssl_link_failure" = xyes; then
- dnl One or both libs failed to link.
- continue
- fi
-
- dnl The libraries link. But we still need to check if the program
- dnl linked with those libraries under these settings with run. On
- dnl some systems (Solaris), Gcc adds -L/usr/local/lib to the
- dnl linking line, but fails to add -R/usr/local/lib, thus creating
- dnl executables that link, but fail to run.
-
- dnl If we are cross-compiling, just assume that working linkage
- dnl implies working executable.
-
- ssl_run_failure=no
-
- AC_MSG_CHECKING([whether SSL libs are resolved at runtime])
- AC_TRY_RUN([
-int RSA_new();
-int SSL_new();
-main(){return 0;}
-],
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no); ssl_run_failure=yes,
- AC_MSG_RESULT(cross)
- )
-
- if test x"$ssl_run_failure" = xno; then
- ssl_success=yes
- break
- fi
- done
-
- if test x"$ssl_success" = xyes; then
- AC_MSG_NOTICE([compiling in support for SSL in $ssl_root])
- AC_DEFINE([HAVE_SSL], 1,
- [Define if SSL support should be compiled in.])
- AC_SUBST(SSL_INCLUDES)
- SSL_OBJ='openssl.o'
- AC_SUBST(SSL_OBJ)
- else
- LDFLAGS=$wget_save_LDFLAGS
- LIBS=$wget_save_LIBS
-
- dnl If linking with SSL was forced rather than auto-detected, then
- dnl bail out if SSL failed.
- if test x"$wget_force_ssl" = x"yes"; then
- AC_MSG_ERROR([failed to find OpenSSL libraries], 2)
- fi
- fi
-
- dnl Restore the compiler setting.
- CC=$wget_save_CC
-
- dnl Restore the CPPFLAGS. Do this regardless of whether linking
- dnl with SSL succeeded -- SSL includes will be handled using
- dnl @SSL_INCLUDES@.
- CPPFLAGS=$wget_save_CPPFLAGS
-fi