On 6/24/20 4:31 PM, Michele Denber wrote:
While trying to run configure in Solaris 11.4, I quickly run into:
root@hemlock:~/qemu-5.0.0# ./configure
./configure[62]: local: not found [No such file or directory]
grep: illegal option -- e
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
./configure[62]: local: not found [No such file or directory]
You've uncovered multiple portability issues, where even though
configure expects to run with #!/bin/sh, it uses some non-POSIX-isms.
Line 62 is
   local compiler="$1"
I'm not familiar with this construct. What does "local" do? It wasn't
in the configure file for QEMU 2.12. (And I already said "cc=gcc")
local is a bash-ism (ksh has it to) that changes how variables are
scoped within shell functions. The options to fix it are to either:
avoid local and use global variables everywhere (and worrying about
naming collisions when one function calls another), or to tweak
configure so that it re-exec's itself under bash if it detects that
/bin/sh is not up to our usage expectations. (configure scripts
generated by Autoconf do the latter, but qemu doesn't use autoconf).
grep -e is also a non-portable construct; it might be possible to change
that line to call egrep instead, or to rewrite the regex to not need
extended regex.
As a short-term workaround, you can always do:
/path/to/bash ./configure
to run it under a shell that won't choke on our use of non-posix constructs.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org