1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Use `libtool' to test linking of external libraries.

Contributed by Maciej W. Rozycki.
Published in <sxsvglyrfpc.fsf@florida.arsdigita.de>.
This commit is contained in:
hniksic 2001-06-14 13:16:55 -07:00
parent 46550636fe
commit e96497a6b4
2 changed files with 30 additions and 46 deletions

View File

@ -1,3 +1,8 @@
2001-06-14 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* configure.in: Use `libtool' to test linking of external
libraries.
2001-06-05 Jan Prikryl <prikryl@cg.tuwien.ac.at> 2001-06-05 Jan Prikryl <prikryl@cg.tuwien.ac.at>
* po/cs.po: Updated to match the 1.7 POT. * po/cs.po: Updated to match the 1.7 POT.

View File

@ -193,34 +193,6 @@ then
AC_CHECK_LIB(socks, Rconnect) AC_CHECK_LIB(socks, Rconnect)
fi 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 If --with-ssl was specified, make sure we can link with the
dnl OpenSSL libs. We should probably auto-detect this by default. dnl OpenSSL libs. We should probably auto-detect this by default.
@ -235,8 +207,12 @@ if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
ssl_all_roots=$with_ssl ssl_all_roots=$with_ssl
fi fi
OLD_LIBS=$LIBS wget_save_LIBS=$LIBS
OLD_LDFLAGS=$LDFLAGS 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 Unfortunately, as of this writing (OpenSSL 0.9.6), the libcrypto
dnl shared library doesn't record its dependency on libdl, so we dnl shared library doesn't record its dependency on libdl, so we
@ -251,22 +227,15 @@ if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
dnl Now try to find SSL libraries in each of the likely SSL roots. dnl Now try to find SSL libraries in each of the likely SSL roots.
for ssl_root in $ssl_all_roots for ssl_root in $ssl_all_roots
do do
LIBS=$OLD_LIBS
if test x"$ssl_root" = xdefault; then if test x"$ssl_root" = xdefault; then
dnl Try the default library locations. dnl Try the default library locations.
SSL_INCLUDES= SSL_INCLUDES=
LDFLAGS=$OLD_LDFLAGS
else else
dnl Try this specific root. dnl Try this specific root.
SSL_INCLUDES=-I$ssl_root/include SSL_INCLUDES=-I$ssl_root/include
SSL_DASH_L="-L$ssl_root/lib" dnl It's OK to use -R directly because libtool will
SSL_DASH_R= dnl interpret it for us.
dnl Only use -R<foo> on systems which support a -R variant. LDFLAGS="-L$ssl_root/lib -R$ssl_root/lib $wget_save_LDFLAGS"
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"
fi fi
ssl_link_failure=no ssl_link_failure=no
@ -284,8 +253,8 @@ if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
dnl failure if you use a static libcrypto.a and libssl.a rather dnl failure if you use a static libcrypto.a and libssl.a rather
dnl than shared libraries. dnl than shared libraries.
AC_CHECK_LIB(crypto,RSA_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) AC_CHECK_LIB(ssl, SSL_new, , ssl_link_failure=yes)
dnl If ssl_link_failure is still no, the libraries link. But we 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 dnl still need to check if the program linked with those libraries
@ -324,15 +293,25 @@ main(){return 0;}
done done
if test x"$ssl_linked" = xno; then if test x"$ssl_linked" = xno; then
LD_FLAGS=$OLD_LDFLAGS LD_FLAGS=$wget_save_LDFLAGS
LIBS=$OLD_LIBS LIBS=$wget_save_LIBS
dnl Perhaps we should abort here. Remember that the user
dnl explicitly requested linking with SSL. 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
echo "WARNING: Failed to link with OpenSSL libraries in $ssl_root/lib." echo "WARNING: Failed to link with OpenSSL libraries in $ssl_root/lib."
echo " Wget will be built without support for https://... URLs." echo " Wget will be built without support for https://... URLs."
echo echo
fi fi
CC=$wget_save_CC
fi fi
dnl dnl