X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=ltmain.sh;h=a3c55f9a7513048bf549ec98b8a6a1d18e44c733;hb=79c835c9e5dc1f8a317ffde69517dbbde42163b2;hp=9882b46c96b624a53dd883c19d91382285fa6691;hpb=3fec05cabefa5f41151f85f0051cba33f902653d;p=pf3gnuchains%2Fgcc-fork.git diff --git a/ltmain.sh b/ltmain.sh index 9882b46c96b..a3c55f9a751 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -17,7 +17,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -829,6 +829,7 @@ EOF linker_flags= dllsearchpath= lib_search_path=`pwd` + inst_prefix_dir= avoid_version=no dlfiles= @@ -961,6 +962,11 @@ EOF prev= continue ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; release) release="-$arg" prev= @@ -1187,6 +1193,11 @@ EOF continue ;; + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) @@ -2171,6 +2182,14 @@ EOF add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" @@ -2229,6 +2248,14 @@ EOF else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi add="-l$name" fi @@ -3647,7 +3674,7 @@ EOF # Now hardcode the library paths rpath= hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do + for libdir in $compile_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then @@ -3812,7 +3839,13 @@ extern \"C\" { fi # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then : else grep -v "^: " < "$nlist" > "$nlist"S @@ -4460,7 +4493,7 @@ fi\ for tag in $taglist; do tagopts="$tagopts --tag $tag" done - relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args)" + relink_command="(cd `pwd`; $SHELL $0$tagopts --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` # Only create the output if not a dry run. @@ -4761,6 +4794,27 @@ relink_command=\"$relink_command\"" dir="$dir$objdir" if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit 1 + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"` + fi + $echo "$modename: warning: relinking \`$file'" 1>&2 $show "$relink_command" if $run eval "$relink_command"; then :