]> sjero.net Git - wget/commitdiff
[svn] Use `libtool' to test linking of external libraries.
authorhniksic <devnull@localhost>
Thu, 14 Jun 2001 20:16:55 +0000 (13:16 -0700)
committerhniksic <devnull@localhost>
Thu, 14 Jun 2001 20:16:55 +0000 (13:16 -0700)
Contributed by Maciej W. Rozycki.
Published in <sxsvglyrfpc.fsf@florida.arsdigita.de>.

ChangeLog
configure.in

index 4c84424a7f62fe78d7fa5b47c195c40eb2cc65a8..90e4f8ec4973512a1dd831bb73583c0482e8b3f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * po/cs.po: Updated to match the 1.7 POT.
index e2bf7b45deb529a86eb5f1e78f18f44361001b2b..dea539929fdd5641314ad303dc90f89a1d37234d 100644 (file)
@@ -193,34 +193,6 @@ then
   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.
 
@@ -235,8 +207,12 @@ if test x"$with_ssl" != x -a x"$with_ssl" != x"no"; then
     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
@@ -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.
   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
@@ -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 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
@@ -324,15 +293,25 @@ main(){return 0;}
   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