Hello Ralf,
On Sun, Apr 02, 2006 at 03:43:40PM +0200, Ralf Wildenhues wrote:
> So this patch was not only not fixing a bug, but merely an optimization,
> but also introducing a bug.
>
> Please leave the introduction of bugs to post 2.60 for now, unless you
> also fix actual bugs. Micro-optimization doesn't count for the latter.
Oh, I see, the problem was that the optimization was too small! ;-)
I can do better, if you please:
Eric's original problem was that the /usr/bin/posix/{sh,bash,ksh,sh5}
non-existent shells cause four extra forks. His patch was optimizg out
these forks.
But we can do better! We can optimize out _all_ extra forks for nonexistent
shells! I hope you will count this as a bug fix! :-)
And now for something completely different:
> > > > * lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Optimize nonexistent
> > > > directories, unless optional third argument supplied.
> > > > (AS_UNAME): Don't optimize PATH walk.
On a second thought, I shouldn't have accepted that patch.
If any caller needs to skip nonexistent directories, he can do so by
insering the command
test -d "$ac_dir" || continue
to the beginning of the second parameter.
So I'd like to back out Eric's patch, including the autotest fix that I
added later.
The patch follows, I won't commit it now, it's too late now. ;-)
Have a nice day,
Stepan
2006-04-03 Stepan Kasal <[EMAIL PROTECTED]>
* lib/m4sugar/m4sh.m4 (_AS_PATH_WALK): Do not optimize; do not skip
nonexistent directories.
(_AS_DETECT_BETTER_SHELL): The optimization is moved here--try only
shell candidates which exist.
(AS_UNAME): No need to give three parameters to _AS_PATH_WALK.
* lib/autotest/general.m4 (AT_INIT): No need to give three parameters
to _AS_PATH_WALK.
Index: lib/m4sugar/m4sh.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
retrieving revision 1.174
diff -u -r1.174 m4sh.m4
--- lib/m4sugar/m4sh.m4 1 Apr 2006 22:55:15 -0000 1.174
+++ lib/m4sugar/m4sh.m4 3 Apr 2006 21:43:19 -0000
@@ -236,7 +236,9 @@
esac])
for as_shell in $as_candidate_shells $SHELL; do
- AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY],
+ # Try only shells which exist, to save several forks.
+ AS_IF([test -f $as_shell &&
+ _AS_RUN([_AS_DETECT_REQUIRED_BODY],
[($as_shell) 2> /dev/null])],
[CONFIG_SHELL=$as_shell
as_have_required=yes
@@ -960,7 +962,6 @@
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- m4_ifvaln([$3], [], [test -d "$as_dir" || continue])dnl
$2
done
IFS=$as_save_IFS
@@ -1157,7 +1158,7 @@
_ASUNAME
-_AS_PATH_WALK([$PATH], [echo "PATH: $as_dir"], [:])
+_AS_PATH_WALK([$PATH], [echo "PATH: $as_dir"])
}])
Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.202
diff -u -r1.202 general.m4
--- lib/autotest/general.m4 3 Apr 2006 04:47:02 -0000 1.202
+++ lib/autotest/general.m4 3 Apr 2006 21:43:20 -0000
@@ -556,7 +556,7 @@
at_path=$at_path$at_top_srcdir/$as_dir
fi
;;
-esac], [:])
+esac])
# Now build and simplify PATH.
#