On 08/11/2021 09.43, Paolo Bonzini wrote:
> meson_quote assumes a non-empty argument list, and incorrectly returns a
> one-entry array if passed nothing. Move the check for an empty argument
> list from the invocations to the function itself.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configure | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 33682cb971..369b5455b6 100755
> --- a/configure
> +++ b/configure
> @@ -3894,6 +3894,7 @@ echo "TOPSRC_DIR=$source_path" >> $config_mak
> if test "$skip_meson" = no; then
> cross="config-meson.cross.new"
> meson_quote() {
> + test $# = 0 && return
> echo "'$(echo $* | sed "s/ /','/g")'"
> }
>
> @@ -3908,10 +3909,10 @@ if test "$skip_meson" = no; then
>
> test -z "$cxx" && echo "link_language = 'c'" >> $cross
> echo "[built-in options]" >> $cross
> - echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross
> - echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross
> - echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
> - echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
> + echo "c_args = [$(meson_quote $CFLAGS)]" >> $cross
> + echo "cpp_args = [$(meson_quote $CXXFLAGS)]" >> $cross
> + echo "c_link_args = [$(meson_quote $LDFLAGS)]" >> $cross
> + echo "cpp_link_args = [$(meson_quote $LDFLAGS)]" >> $cross
> echo "[binaries]" >> $cross
> echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
> test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
>
Reviewed-by: Thomas Huth <thuth@redhat.com>