Wei Liu writes ("[PATCH] m4: use test instead of []"):
> It is reported that [] was removed by autoconf, which caused the
> following error:
> 
>   ./configure: line 4681: -z: command not found
> 
> Switch to test. That's what is used throughout our configure scripts.

The reason for [ ] being removed is that configure.ac et al are
processed by m4 with quote characters set to [ ].

>      APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
>  done
> -if [ ! -z $EXTRA_PREFIX ]; then
> +if test ! -z $EXTRA_PREFIX ; then
>      CPPFLAGS="$CPPFLAGS -I$EXTRA_PREFIX/include"

If $EXTRA_PREFIX contains nothing (or just whitespace) this expands to
  test ! -z
which only works by accident.  It is parsed ax
  if not (string_is_nonempty("-z"))

Variable expansions in test expressions should generally be in " ".

Ian.

Reply via email to