AC_CHECK_LIB(socks, Rconnect)
fi
-dnl OpenSSL is a third-party library, which makes checking for it a
-dnl pain. Before proceeding, we need to figure out whether to use the
-dnl `-R' flag.
-
-dnl Try to autodetect runtime library flag (usually -R), and whether
-dnl it works (or at least does no harm). Note that this is used
-dnl merely for the configure test below. The actual linking is
-dnl performed by libtool. Wouldn't it be nice if libtool also
-dnl provided "querying" that we need in configure?
-AC_MSG_CHECKING("for runtime libraries flag")
-case "$host_os" in
- sol2 ) dash_r="-R" ;;
- decosf* | linux* | irix*) dash_r="-rpath " ;;
- *)
- dash_r=""
- for try_dash_r in "-R" "-R " "-rpath "; do
- OLD_LDFLAGS=$LDFLAGS
- LDFLAGS="${try_dash_r}/no/such/file-or-directory $LDFLAGS"
- AC_TRY_LINK(, , dash_r="$try_dash_r")
- LDFLAGS=$ODL_LDFLAGS
- test -n "$dash_r" && break
- done ;;
-esac
-if test -n "$dash_r";
- then AC_MSG_RESULT("\"${dash_r}\"")
- else AC_MSG_RESULT(NONE)
-fi
-
dnl If --with-ssl was specified, make sure we can link with the
dnl OpenSSL libs. We should probably auto-detect this by default.
ssl_all_roots=$with_ssl
fi
- OLD_LIBS=$LIBS
- OLD_LDFLAGS=$LDFLAGS
+ wget_save_LIBS=$LIBS
+ wget_save_LDFLAGS=$LDFLAGS
+ wget_save_CC=$CC
+
+ dnl Use libtool for OpenSSL tests to handle the "-R<rpath>" option.
+ CC="$SHELL ./libtool $CC"
dnl Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
dnl shared library doesn't record its dependency on libdl, so we
dnl Now try to find SSL libraries in each of the likely SSL roots.
for ssl_root in $ssl_all_roots
do
- LIBS=$OLD_LIBS
-
if test x"$ssl_root" = xdefault; then
dnl Try the default library locations.
SSL_INCLUDES=
- LDFLAGS=$OLD_LDFLAGS
else
dnl Try this specific root.
SSL_INCLUDES=-I$ssl_root/include
- SSL_DASH_L="-L$ssl_root/lib"
- SSL_DASH_R=
- dnl Only use -R<foo> on systems which support a -R variant.
- if test x"$dash_r" != x; then
- SSL_DASH_R="${dash_r}$ssl_root/lib"
- fi
- LDFLAGS="$SSL_DASH_L $SSL_DASH_R $OLD_LDFLAGS"
+ dnl It's OK to use -R directly because libtool will
+ dnl interpret it for us.
+ LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
fi
ssl_link_failure=no
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)
+ AC_CHECK_LIB(crypto, RSA_new, , ssl_link_failure=yes)
+ AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
dnl If ssl_link_failure is still no, the libraries link. But we
dnl still need to check if the program linked with those libraries
done
if test x"$ssl_linked" = xno; then
- LD_FLAGS=$OLD_LDFLAGS
- LIBS=$OLD_LIBS
- dnl Perhaps we should abort here. Remember that the user
- dnl explicitly requested linking with SSL.
+ LD_FLAGS=$wget_save_LDFLAGS
+ LIBS=$wget_save_LIBS
+
+ dnl Perhaps we should abort here. Dan argues that configure
+ dnl scripts shouldn't abort out of principle, but on the other
+ dnl hand remember that the user explicitly requested linking with
+ dnl SSL.
+
+ dnl IMHO there should be a way to specify whether SSL should be
+ dnl avoided, auto-detected, or required, defaulting to
+ dnl `autodetect'. Only in the `require' mode the script would
+ dnl abort if SSL is not found.
echo
echo "WARNING: Failed to link with OpenSSL libraries in $ssl_root/lib."
echo " Wget will be built without support for https://... URLs."
echo
fi
+
+ CC=$wget_save_CC
fi
dnl