bug-libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: allow $ORIGIN in the run-path


From: Laszlo PETER
Subject: Re: RFE: allow $ORIGIN in the run-path
Date: Fri, 11 May 2001 14:42:03 +0100

Robert Boehne wrote:
> 
> Laszlo PETER wrote:
> > >
> > > Can you escape $ORIGIN/../lib in a way that would cause Libtool
> > > to interpret it?
> > >
> > > Rob
> >
> > Hmmm.... Not quite sure how you mean.
> > The goal is to pass this string as it is to ld, so it gets fixed in
> > the binary, but libtool checks if the path starts with a "/" and if
> > not then stops with an error. I can't think of a way to escape it
> > so that it starts with a "/" but the linker receives the original string.
> >
> > Am I missing something?
> >
> > Laca
> 
> How about /$ORIGIN/../lib ?

Yes, that should work, but it will result in something like 
//path/to/binary/../lib
(with 2 /'s at the beginning) which works but isn't nice.

Looking at the script closer I found that if you have a run-path with
several comma separated directories it will only check the first one.
(e.g. it will accept "/something:anything:after:the:first:dir")
It will also accept something like c:/bla/bla. I guess it's some cygwin thing.

Here's the piece of code:

      -R*)
        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
        # We need an absolute path.
        case $dir in
        [\\/]* | [A-Za-z]:[\\/]*) ;;
        *)
          $echo "$modename: only absolute run-paths are allowed" 1>&2
          exit 1
          ;;
        esac
        case "$xrpath " in
        *" $dir "*) ;;
        *) xrpath="$xrpath $dir" ;;
        esac
        continue
        ;;

I think it should work something like this:

        old_IFS=$IFS
        IFS=$rpath_sep          # I guess on windows you need to use a 
different separator.
        for d in $dir; do
          case $d in
          [\\/]*) ;;
          *)
            $echo "....."
            exit 1
            ;;
          esac
        done
        IFS=$old_IFS

And then it's only a little change to accept $ORIGIN on Solaris (-;

        old_IFS=$IFS
        IFS=$rpath_sep          # I guess on windows you need to use a 
different separator.
        for d in $dir; do
          case $d in
          [\\/]*) ;;
          '$ORIGIN'*)
            case $host in
            *-*-sunos*) ;;
            *)
              $echo "... \$ORIGIN is not supported on your platform"
              exit 1
              ;;
            esac
          *)
            $echo "....."
            exit 1
            ;;
          esac
        done
        IFS=$old_IFS

What do you think?

Laca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]