--- libtool-1.5/ltmain.in.bak 2003-04-14 16:58:24.000000000 -0500 +++ libtool-1.5/ltmain.in 2004-01-28 18:16:02.000000000 -0600 @@ -2401,7 +2401,20 @@ add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" + if test "$linkmode" = prog ; then + # For programs I need to install placeholders for the + # install prefix so that it is replaced during install + # time + add="@address@hidden/address@hidden@$libdir/address@hidden@" + else + # When relinking libraries we need to pass path prefixes + # so that libraries interdependencies are resolved + if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + fi elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" @@ -4437,6 +4450,17 @@ # Now create the wrapper script. $show "creating $output" + # Fix relink command for HP-UX. + case $host in + *-*-hpux10* | *-*-hpux11*) + if test -n "$finalize_deplibs" + then + relink_command="$relink_command ; tem=\"$finalize_deplibs\" ; for i in \$tem ; do case \$i in /*) for j in \$i* ; do if test -f \$j ; then $echo chatr -l \$j @OUTPUT@ ; chatr -l \$j @OUTPUT@ > /dev/null ; fi ; done ;; esac ; done ; $echo chatr +s enable @OUTPUT@ ; chatr +s enable @OUTPUT@ > /dev/null" + fi + ;; + esac + + # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior @@ -5546,11 +5570,19 @@ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no + # finalize=no stops linking, even if the link would succeed + # that is, not finding libfile in the final directory + # does not mean that linking will fail + finalize=yes fi done relink_command= + # This is a huge cheat. When used in an automake generated Makefile + # the DESTDIR environment is defined if user defines it during the + # installation phase. It would be better to determine inst_prefix_dir + # in a similar fashion to how it is determined for libraries + inst_prefix_dir=${DESTDIR} # To insure that "foo" is sourced, and not "foo.exe", # finese the cygwin/MSYS system by explicitly sourcing "foo." # which disallows the automatic-append-.exe behavior. @@ -5579,6 +5611,16 @@ outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 'address@hidden@%'"$outputname"'%g'` + # Replace the inst_prefix_dir so that paths to libraries + # are corrected when installing into a staging directory. + # This is ugly, but I need to check that the library exists + # in the staging area first, so that in the case of libraries + # that have previously been installed in the same library + # library directory I don't inadvertently prefix them. + bt='\`' + relink_command=`$echo "X$relink_command" | $Xsed -e 'address@hidden@%'"${bt}if test -f $inst_prefix_dir"'%g'` + relink_command=`$echo "X$relink_command" | $Xsed -e 'address@hidden@%'" ; then $echo -n $inst_prefix_dir ; fi ; $echo -n "'%g'` + relink_command=`$echo "X$relink_command" | $Xsed -e 'address@hidden@%'"${bt}"'%g'` $show "$relink_command" if $run eval "$relink_command"; then :