]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (file_magic): follow soft-links before running `file'
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Wed, 20 Jan 1999 20:24:54 +0000 (20:24 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 20 Jan 1999 20:24:54 +0000 (20:24 +0000)
on the candidate library; try to avoid entering endless loop
Suggested by Nix <nix@esperi.demon.co.uk>

ChangeLog
ltmain.in

index 833da692455829ee0466f6f41eb7abbac3f96c9d..8e729b1f1fe29eab9b74445a63e6c5426d13f584 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 1999-01-20  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
+       * ltmain.in (file_magic): follow soft-links before running `file'
+       on the candidate library; try to avoid entering endless loop
+       Suggested by Nix <nix@esperi.demon.co.uk>
+       
        * ltconfig.in (linux*, solaris*, bsdi4*, sys_lib_search_path):
        remove expansion of $LD_LIBRARY_PATH
        * ltmain.in (lib_search_path): append the expansion of $shlibpath_var
index 66a8d77ea3d23edd3b04c91e16460b6b8831bfc7..e3a0398d6e2e779533f9b789ec80a106baa9df61 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -1658,7 +1658,26 @@ EOF
                   # strict.  What do you think Gordon?
                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                    for potent_lib in $potential_libs; do
-                     file_output=`eval $file_magic_command $potent_lib \
+                     # Follow soft links.
+                     if ls -lLd "$potlib" 2>/dev/null \
+                        | grep " -> " >/dev/null; then
+                       continue 
+                     fi
+                     # The statement above tries to avoid entering an
+                     # endless loop below, in case of cyclic links.
+                     # We might still enter an endless loop, since a link
+                     # loop can be closed while we follow links,
+                     # but so what?
+                     potlib="$potent_lib"
+                     while test -h "$potlib" 2>/dev/null; do
+                       potliblink=`ls -ld $potlib | sed 's/.* -> //'`
+                       case "$potliblink" in
+                       /*) potlib="$potliblink";;
+                       *) potlib=`$echo "X$potlib" \
+                                  | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       esac
+                     done
+                     file_output=`eval $file_magic_command \"\$potlib\" \
                                   | sed '11,$d'`
                      if test `expr "X$file_output" : "X.*$file_magic_regex"` -ne 0 ; then
                        newdeplibs="$newdeplibs $a_deplib"
@@ -1682,7 +1701,7 @@ EOF
                  done
                  ;;
              esac
-             if test "$a_deplib" != "" ; then
+             if test -n "$a_deplib" ; then
                echo
                echo "*** Warning: This library needs some functionality provided by $a_deplib."
                echo "*** I have the capability to make that library automatically link in when"