From: Paul Eggert Date: Fri, 26 Oct 2001 19:52:43 +0000 (+0000) Subject: (_AS_LINENO_WORKS): New macro. X-Git-Tag: AUTOCONF-2.52f~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4cb525873a3c55fbe6c8325f0fc0d175f423df4;p=thirdparty%2Fautoconf.git (_AS_LINENO_WORKS): New macro. (_AS_LINENO_PREPARE): Use it instead of shell eval, since eval $LINENO is not portable in practice. --- diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 4ea6d0365..5cb299fb8 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -459,6 +459,17 @@ else fi ])# _AS_EXPR_PREPARE +# _AS_LINENO_WORKS +# --------------- +# Succeed if the currently executing shell supports LINENO. +m4_define([_AS_LINENO_WORKS], +[{ + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" +}]) # _AS_LINENO_PREPARE # ------------------ @@ -473,16 +484,7 @@ fi # it protects us from repetitive rewrites. Be sure to have a test # that does detect non LINENO support... m4_define([_AS_LINENO_PREPARE], -[as_command=' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" -' -if eval "$as_command"; then - : -else +[_AS_LINENO_WORKS || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $[0] in @@ -505,7 +507,7 @@ else [for as_base in sh bash ksh sh5; do case $as_dir in /*) - if ("$as_dir/$as_base" -c "$as_command") 2>/dev/null; then + if ("$as_dir/$as_base" -c '_AS_LINENO_WORKS') 2>/dev/null; then CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$[0]" ${1+"$[@]"} @@ -533,7 +535,7 @@ else . ./$as_me.lineno # Exit status is that of the last command. exit -fi +} ])# _AS_LINENO_PREPARE