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

Zoltan Hidvegi mplayer at hzoli.2y.net
Thu Jun 30 20:36:41 CEST 2005


Diego Biurrun wrote:
> > > But if we should choose to have faster configure and to have easy to
> > > read&modify configure I choose the second.
> > 
> > I choose the former. :) It's already too damn slow like autosh*t...
> 
> I don't agree in principle but I don't see how -a/-o is less readable than
> &&/||.  It's shorter and faster so it should be preferred.

There is hardly any speed difference between -a/-o vs. &&/|| if you
use {...} for scoping instead of (...).  This is getting a bit off
topic, but the problem with -a/-o is that it can be ambiguous:

test "$foo" = "$bar" -a -z "$x"

And suppose that foo=-a bar=-o x=1, so it expands to:

test -n = -a -a -z 1

And this can be parsed as test (-n =) -a (-a -z 1) which is a syntax
error.  Sure, this does not happen often, and may never happen in
mplayer's configure script, but exactly because of these ambiguities
POSIX does not define -a/-o and recommends the use of &&/|| instead.
And also that's why you often see

test "x$foo" = "x$bar"

which ensures that there is no ambiguity.

Zoli




More information about the MPlayer-dev-eng mailing list