From 951fc9f2440fcd2cfd54ac6f12ce3b668cc979e3 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Wed, 20 Jan 1999 20:24:54 +0000 Subject: [PATCH] * ltmain.in (file_magic): follow soft-links before running `file' on the candidate library; try to avoid entering endless loop Suggested by Nix --- ChangeLog | 4 ++++ ltmain.in | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 833da6924..8e729b1f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 1999-01-20 Alexandre Oliva + * ltmain.in (file_magic): follow soft-links before running `file' + on the candidate library; try to avoid entering endless loop + Suggested by Nix + * 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 diff --git a/ltmain.in b/ltmain.in index 66a8d77ea..e3a0398d6 100644 --- 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" -- 2.47.2