configure: fix parameter expansion of --cross-cc-cflags options
PATCH 1/1 configure: fix parameter expansion of --cross-cc-cflags options
From: Matheus Ferst <[email protected]>
Without this fix, any use of --cross-cc-cflags-* causes a message like:
$ ../configure --cross-cc-ppc64le=clang --cross-cc-cflags-ppc64le="-target powerpc64le-unknown-linux-gnu -sysroot ..." ../configure: 1: eval: cross_cc_cflags_--cross-cc-cflags-ppc64le=-target: not found ../configure: 3816: export: cross_cc_cflags_--cross-cc-cflags-ppc64le: bad variable name
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -402,7 +402,7 @@ for opt do ;; --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" ;; - --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} + --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*} eval "cross_cc_cflags_${cc_arch}=\$optarg" cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" ;;
Signature · 1 line
2.25.1
Quoted 17 lines · On 20/1/22 18:31, [email protected] wrote:
From: Matheus Ferst <[email protected]>
Without this fix, any use of --cross-cc-cflags-* causes a message like:
$ ../configure --cross-cc-ppc64le=clang --cross-cc-cflags-ppc64le="-target powerpc64le-unknown-linux-gnu -sysroot ..." ../configure: 1: eval: cross_cc_cflags_--cross-cc-cflags-ppc64le=-target: not found ../configure: 3816: export: cross_cc_cflags_--cross-cc-cflags-ppc64le: bad variable nameSigned-off-by Matheus Ferst <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure for opt do · line 408
Quoted 8 lines
configure +1
-1@@ -402,7 +402,7 @@ for opt do ;; --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" ;; - --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} + --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*} eval "cross_cc_cflags_${cc_arch}=\$optarg" cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" ;;
Commit d422b2bc23 subject is "configure: allow user to specify --cross-cc-cflags-foo=" but then documented "--cross-cc-flags":
$ git grep cc-flag
configure:409: --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
configure:1338: --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
docs/devel/testing.rst:1327:There is also a ``--cross-cc-flags-ARCH`` flag in case additional$ git grep cross.*flag
configure:409: --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*}
configure:410: eval "cross_cc_cflags_${cc_arch}=\$optarg"
configure:411: cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
configure:1338: --cross-cc-flags-ARCH= use compiler flags when building ARCH guest tests
docs/devel/testing.rst:1327:There is also a ``--cross-cc-flags-ARCH`` flag in case additional
tests/tcg/configure.sh:48:: ${cross_cc_cflags_aarch64_be="-mbig-endian"}
tests/tcg/configure.sh:51:: ${cross_cc_cflags_armeb="-mbig-endian"}
tests/tcg/configure.sh:53:: ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
tests/tcg/configure.sh:56:: ${cross_cc_cflags_i386="-m32"}
tests/tcg/configure.sh:65:: ${cross_cc_cflags_ppc="-m32"}
tests/tcg/configure.sh:67:: ${cross_cc_cflags_ppc64="-m64 -mbig"}
tests/tcg/configure.sh:69:: ${cross_cc_cflags_ppc64le="-m64 -mlittle"}
tests/tcg/configure.sh:73:: ${cross_cc_cflags_sparc="-m32 -mv8plus -mcpu=ultrasparc"}
tests/tcg/configure.sh:75:: ${cross_cc_cflags_sparc64="-m64 -mcpu=ultrasparc"}
tests/tcg/configure.sh:77:: ${cross_cc_cflags_x86_64="-m64"}
tests/tcg/configure.sh:244: eval "target_compiler_cflags=\${cross_cc_cflags_$arch}"OK, 'cflags' wins over 'flags'.
I agree this requires cleanup, but all occurrences need to be updated.
Please Cc Alex in v2, and add:
Thanks,
Phil.
Paolo Bonzini
AppliedQuoted 17 lines · On 1/20/22 18:31, [email protected] wrote:
From: Matheus Ferst <[email protected]>
Without this fix, any use of --cross-cc-cflags-* causes a message like:
$ ../configure --cross-cc-ppc64le=clang --cross-cc-cflags-ppc64le="-target powerpc64le-unknown-linux-gnu -sysroot ..." ../configure: 1: eval: cross_cc_cflags_--cross-cc-cflags-ppc64le=-target: not found ../configure: 3816: export: cross_cc_cflags_--cross-cc-cflags-ppc64le: bad variable nameSigned-off-by Matheus Ferst <[email protected]>--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)configure +0
-0
configure for opt do · line 408
Quoted 8 lines
configure +1
-1@@ -402,7 +402,7 @@ for opt do ;; --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option" ;; - --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-flags-}; cc_arch=${cc_arch%%=*} + --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*} eval "cross_cc_cflags_${cc_arch}=\$optarg" cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}" ;;
Queued, thanks.
Paolo