[MPlayer-dev-eng] [PATCH] clean up tests in configure

Zoltan Hidvegi mplayer at hzoli.2y.net
Thu Jul 7 01:18:56 CEST 2005


Ivan Kalvachev wrote:
> Well, well, well.
> OK. If this link is correct 
> http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
> then `test` is not standard extension for /bin/sh . I guess it is
> bash-ism and this is the reason it is implemented also as external
> program.

Why do you think so?  The link you have provided has nothing to do
with test.  See here:
http://www.opengroup.org/onlinepubs/007908799/xcu/test.html

The standard only requires that the shell implements a few special
builtins.  Most other utilities can be either builtins or external
utilities.  But even builtins must be in the path, because the
standard requires the shell to search the PATH first, and fail if the
command is not found in the path even if it is implemented as a
builtin, and call the builtin only if it's found in the PATH.  This is
stupid, and most shells ignore this part of the standard.  The
standard describes and requires the test utility, but it does not
require it to be a builtin, even though all shells I've tried
implement it as a builtin.

Btw., Diego's patch is fine, but there are more subshells that can be
removed: there are several instances of ( $_cc ... ) >> "$TMPLOG" 2>&1
where the subshell is unnecessary.  Same for ( $_ldd ...) etc.  Also
things like `( uname -s ) 2>&1` do not need subshell either.  But
these usually do not hurt, because shell often optimize the subshell
away, by turning ( uname -s ) into ( exec uname -s ), at least zsh
does that, and I remember that bash had similar optimizations,
although not as thorough as zsh.

Btw., the SUSv2 by opengroup is a superset of POSIX.  I believe POSIX
does not define -o/-a, ! and parenthesis for test, but SUSv2 does.
Also remember that if you want to use test, do not forget that if you
want to use parenthesized subexpressions, the parenthesis must be
quoted by a backslash.

Zoli




More information about the MPlayer-dev-eng mailing list