autoconf-patches
[Top][All Lists]
Advanced

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

Re: [Mingw-users] Re: MSYS ln -s to directory


From: Stepan Kasal
Subject: Re: [Mingw-users] Re: MSYS ln -s to directory
Date: Tue, 11 Apr 2006 21:48:28 +0200
User-agent: Mutt/1.4.1i

Hello Ralf,

> > Ralf Wildenhues <address@hidden> writes:
> > >   * lib/m4sugar/m4sh.m4 (_AS_LN_S_PREPARE): If `ln -s file1 file2'
> > >   succeeded, but `ln -s file dir' failed, take care to remove the
> > >   leftover target before the next test, to prevent its spurious
> > >   failure; also make sure `ln file dir' works before selecting it.
> > >   Thanks to Keith Marshall for pointing this out.

I don't like this; this is all getting very crufty in a course of just
a few days.

Let start from poit 0 again:

Iteration 0
-----------

The most natural thing to do is:

if ln -s f1 f2; then
  as_ln_s='ln -s'
elif ln f1 f2; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi

That is what was in Autoconf before 2001-01-23


Iteration 1
-----------

We have to catch on exception: DJGPP < 2.04 and its executable wrappers.
We know that the first `ln -s' succeeds there, so we know where the
additional code is to be inserted.

if ln -s f1 f2; then
  if test -f f2.exe; then
    # DJGPP < 2.04 has no links at all.
    as_ln_s='cp -p'
  else
    as_ln_s='ln -s'
  fi
elif ln f1 f2; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi

Note that this code has been present in Autoconf since 2001-01-23
until 2006-04-07.

Iteration 2
-----------

We need to catch yet another buggy platform, MSYS, where neither `ln -s'
nor `ln' work if the target is directory.  This means we cannot use
neither of them there, and have to default to `cp -p'.
Again, we know that `ln -s f1 f2' succeeds there, not creating `f2.exe',
so we know where the exception code should be placed.

if ln -s f1 f2; then
  if test -f f2.exe; then
    # DJGPP < 2.04 has no links at all.
    as_ln_s='cp -p'
  elif ln -s f1 dir; then
    as_ln_s='ln -s'
  else
    # MSYS bug:
    as_ln_s='cp -p'
  fi
elif ln f1 f2; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi

or, more compactly:

if ln -s f1 f2; then
  as_ln_s='ln -s'
  if test -f f2.exe; then
    # DJGPP < 2.04 has no links at all.
    as_ln_s='cp -p'
  else
    # Check for MSYS bug:
    ln -s f1 dir ||
      as_ln_s='cp -p'
  fi
elif ln f1 f2; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi

or, even more compactly:

if ln -s f1 f2; then
  as_ln_s='ln -s'
  # ... but check for MSYS and DJGPP < 2.04:
  ln -s f1 dir && test ! -f f2.exe ||
    as_ln_s='cp -p'
elif ln f1 f2; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi

Attached please find an implmentation of this change, to be applied
against current CVS.

Have a nice day,
        Stepan

Attachment: autoconf-20060411-ln.patch
Description: Text document


reply via email to

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