[Top][All Lists]

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

Re: 02-lineno.patch

From: Raja R Harinath
Subject: Re: 02-lineno.patch
Date: Tue, 25 Sep 2001 15:44:20 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.105


Akim Demaille <address@hidden> writes:
> +** $LINENO
> +  Is now used instead of hard coded line numbers.
> +  This eases the comparison of `configure's, and diminishes the
> +  pressure over control version archives.
> +  Automatic replacement for shells that don't support this feature.

The replacement doesn't appear to have been tested at all.  It has
many problems, as a quick configure on Solaris 2.6 showed.

> +as_lineno_1=$LINENO
> +as_lineno_2=$LINENO
> +# Compute as_lineno_1 in two steps: some shells restart LINENO for
> +# subshells.
> +as_lineno_1=`(expr $as_lineno_1 + 1) 2>/dev/null`
> +if test "x$as_lineno_1" != "x$as_lineno_2"; then

This is ineffective.  If $LINENO is not supported, 'expr + 1' is an
invalid command, and as_lineno_1 is set to empty.  So, the test will
always succeed.  Need something like

  as_lineno_1=`(expr $as_lineno_1 + 1) 2>/dev/null || echo not_a_number`

> +  if test ! -f $as_me.lineno ||
> +     test x`ls -1dt $as_me.lineno $as_me 2>/dev/null | sed 1q` \
> +     # Be sure to write the pattern so that it doesn't replace itself:
> +     # it must not match itself.
> +     awk '{
> +            if ($[0] ~ /[[$]]LINENO/)
> +              while (sub (/[[$]]LINENO/, NR))
> +                continue
> +            print
> +          }' <$as_me >$as_me.lineno

'$as_me' is the bareword 'configure'.  You want the whole directory
name it was invoked with.  You basically want

  awk '...' < $0

However, $0 may have been invoked on the path.  So, if '$0' is a
bareword, you'll have to search $PATH for it.

> +    chmod +x $as_me.lineno
> +  fi
> +  exec ${SHELL-/bin/sh} ./$as_me.lineno

What about all the arguments passed in to 'configure'?  

Also, you need to prevent the $as_me of that exec-ed script from being
'configure.lineno', so that it doesn't inf-loop generating
'configure.lineno.lineno' and 'configure.lineno.lineno.lineno' and so
on.  You also need to capture the directory of the original
'configure' call so that you can figure out $srcdir from it.

- Hari
Raja R Harinath ------------------------------ address@hidden
"When all else fails, read the instructions."      -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing."   -- Roy L Ash

reply via email to

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