autoconf-patches
[Top][All Lists]
Advanced

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

Re: 21-fyi-as-require.patch


From: Akim Demaille
Subject: Re: 21-fyi-as-require.patch
Date: 09 Oct 2001 09:42:49 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

| > From: Akim Demaille <address@hidden>
| > Date: Mon, 08 Oct 2001 10:29:42 +0200
| > 
| > foo=`if expr a : '\(a\)' >/dev/null 2>&1; then
| >   as_expr=expr
| > else
| >   as_expr=false
| > fi
| > 
| > $as_expr Xfoo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
| >          Xfoo : 'X\(//\)[^/]' \| \
| >          Xfoo : 'X\(//\)$' \| \
| >          Xfoo : 'X\(/\)' \| \
| >          .     : '\(.\)'`
| > 
| > 
| > (note that it is not only cosmetics: being set in backquotes, as_expr
| > is *not* defined in the top level of the shell script).
| 
| But doesn't this repeat the work of computing as_expr, and cause
| 'configure' to generate three processes for each invocation of expr,
| whereas before it would generate one for each invocation of expr (plus
| two at the start of execution)?  That could slow things down quite a
| bit.
|
| I don't think it'll matter much for this particular case, once I get
| the basename/dirname patches in, as 'expr' will be invoked only on
| ancient machines afterwards.  But I worry about the precedent for
| other programs.

I think there is some confusion somewhere, I don't no where exactly,
but we probably misunderstand each other.  The snippet above is
something I'm escaping _from_.  configure was not affected because
currently *all* the _PREPARE are run by hand in AC_SHELL_SANITIZE, but
a M4sh script has no such obligation.

So what happened for these scripts was basically

foo=`AS_DIRNAME_EXPR(foo)`
bar=`AS_DIRNAME_EXPR(bar)`

producing

| foo=`if expr a : '\(a\)' >/dev/null 2>&1; then
|   as_expr=expr
| else
|   as_expr=false
| fi
| 
| $as_expr Xfoo : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|          Xfoo : 'X\(//\)[^/]' \| \
|          Xfoo : 'X\(//\)$' \| \
|          Xfoo : 'X\(/\)' \| \
|          .     : '\(.\)'`
| bar=`$as_expr Xbar : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|          Xbar : 'X\(//\)[^/]' \| \
|          Xbar : 'X\(//\)$' \| \
|          Xbar : 'X\(/\)' \| \
|          .     : '\(.\)'`

with as_expr being undefined in bar.  Worse yet, using AS_DIRNAME
would have produced

| foo=`dirname foo \
| || if expr a : '\(a\)' >/dev/null 2>&1; then
|   as_expr=expr
| else
|   as_expr=false
| fi
| 
| EXPR-DIRNAME(foo) ||
| ECHO-SED-DIRNAME(foo)`



reply via email to

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