Re: Final(?) patch to update libtool in GCC and src trees

Paolo Bonzini
2007-04-12T07:03:14Z

> It's a little unorthodox (and assumes a lot about libtool's
> implementation) but we COULD:
>
> (1) hardlink/copy ${ORIGINAL_AS_FOR_TARGET--without-$exeext} .
> (2) hardlink/copy ${ORIGINAL_AS_FOR_TARGET--with_$exeext} .
> (3) mkdir .libs
> (4) hardlink/copy ${ORIGINAL_AS_FOR_TARGET--with-/.libs/-inserted} .libs/

Another possibility (and I would be grateful if you would test this) is
to confine all this stuff into a script, something like this (I'll call
it exec-tool.in):

#! /bin/sh

ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@"
ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"

invoked=`basename "$0"`
case "$invoked" in
as)
original=$ORIGINAL_AS_FOR_TARGET
prog=as-new
dir=gas
;;
collect-ld)
original=$ORIGINAL_LD_FOR_TARGET
prog=ld-new
dir=ld
;;
nm)
original=$ORIGINAL_NM_FOR_TARGET
prog=nm-new
dir=binutils
;;
esac

case "$original" in
../*)
if test -x ../$dir/$prog; then
exec ../$dir/$prog ${1+"$@"}
else
exec ../prev-$dir/$prog ${1+"$@"}
fi
;;
*)
exec "$original" ${1+"$@"}
;;
esac

Then, you *can* use symlinks. So in configure.ac you can simply do

AC_CONFIG_FILES(exec-tool.sh:exec-tool.in, [chmod +x exec-tool.sh])
case "$ORIGINAL_AS_FOR_TARGET" in
./as) ;;
*) AC_CONFIG_LINKS(as:exec-tool.sh) ;;
esac
case "$ORIGINAL_LD_FOR_TARGET" in
./collect-ld) ;;
*) AC_CONFIG_LINKS(collect-ld:exec-tool.sh) ;;
esac
case "$ORIGINAL_NM_FOR_TARGET" in
./nm) ;;
*) AC_CONFIG_LINKS(nm:exec-tool.sh) ;;
esac

and drop all the as/collect-ld/nm rules from Makefile.in.

Paolo