474 |
# _AS_LINENO_PREPARE |
# _AS_LINENO_PREPARE |
475 |
# ------------------ |
# ------------------ |
476 |
# If LINENO is not supported by the shell, produce a version of this |
# If LINENO is not supported by the shell, produce a version of this |
477 |
# script where LINENO is hard coded. Rewrite if not up to date only. |
# script where LINENO is hard coded. |
478 |
# Comparing LINENO against _oline_ is not a good solution, since in |
# Comparing LINENO against _oline_ is not a good solution, since in |
479 |
# the case of embedded executables (such as config.status within |
# the case of embedded executables (such as config.status within |
480 |
# configure) you'd compare LINENO wrt config.status vs. _oline_ vs |
# configure) you'd compare LINENO wrt config.status vs. _oline_ vs |
481 |
# configure. Hence a useless rewrite (not to mention the risk of |
# configure. |
|
# ``infinite'' rewrites. Merely check that LINENO is incremented |
|
|
# between two lines, which is a property guaranteed for _oline_, hence |
|
|
# it protects us from repetitive rewrites. Be sure to have a test |
|
|
# that does detect non LINENO support... |
|
482 |
m4_define([_AS_LINENO_PREPARE], |
m4_define([_AS_LINENO_PREPARE], |
483 |
[_AS_LINENO_WORKS || { |
[_AS_LINENO_WORKS || { |
484 |
# Find who we are. Look in the path if we contain no path at all |
# Find who we are. Look in the path if we contain no path at all |
511 |
esac |
esac |
512 |
done]);; |
done]);; |
513 |
esac |
esac |
514 |
if test ! -f "$as_me.lineno" || |
|
515 |
test x`ls -1dt "$as_me.lineno" "$as_myself" 2>/dev/null | sed 1q` \ |
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO |
516 |
!= x"$as_me.lineno"; then |
# uniformly replaced by the line number. The first 'sed' inserts a |
517 |
# Be sure to write the pattern so that it doesn't replace itself: |
# line-number line before each line; the second 'sed' does the real |
518 |
# it must not match itself. |
# work. The second script uses 'N' to pair each line-number line |
519 |
awk <$as_myself ' |
# with the numbered line, and appends trailing '-' during |
520 |
/[[$]]LINENO/ { printf "%d:", NR } |
# substitution so that $LINENO is not a special case at line end. |
521 |
{ print } |
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the |
522 |
' | |
# second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) |
523 |
sed ['/[$]LINENO/s/^\([0-9][0-9]*\):\(.*\)[$]LINENO/\2\1/'] \ |
sed '=' <$as_myself | |
524 |
>$as_me.lineno |
sed ' |
525 |
chmod +x $as_me.lineno |
N |
526 |
fi |
s,$,-, |
527 |
|
: loop |
528 |
|
s,^\([[0-9]]*\)\(.*\)[[$]]LINENO\([[^a-zA-Z0-9_]]\),\1\2\1\3, |
529 |
|
t loop |
530 |
|
s,-$,, |
531 |
|
s,^[[0-9]]*\n,, |
532 |
|
' >$as_me.lineno && |
533 |
|
chmod +x $as_me.lineno || |
534 |
|
AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell]) |
535 |
|
|
536 |
# Don't try to exec as it changes $[0], causing all sort of problems |
# Don't try to exec as it changes $[0], causing all sort of problems |
537 |
# (the dirname of $[0] is not the place where we might find the |
# (the dirname of $[0] is not the place where we might find the |