qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Daniel P . Berrangé" <berrange@redhat.com>
Subject: [PATCH 04/15] configure: create native file with contents of $host_cc
Date: Sat,  2 Sep 2023 14:59:23 +0200	[thread overview]
Message-ID: <20230902125934.113017-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20230902125934.113017-1-pbonzini@redhat.com>

The argument of --host-cc is not obeyed when cross compiling.  To avoid
this issue, place it in a configuration file and pass it to meson
with --native-file.

While at it, clarify that --host-cc is not obeyed anyway when _not_
cross compiling, because cc="$host_cc" is placed before --host-cc is
processed.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 7743c18f2fe..378a0de9fb6 100755
--- a/configure
+++ b/configure
@@ -288,7 +288,7 @@ static="no"
 #  ${cross_prefix}gcc (if cross-prefix specified)
 #  system compiler
 if test -z "${CC}${cross_prefix}"; then
-  cc="$host_cc"
+  cc="cc"
 else
   cc="${CC-${cross_prefix}gcc}"
 fi
@@ -927,8 +927,8 @@ Advanced options (experts only):
   -Dmesonoptname=val       passthrough option to meson unmodified
   --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
   --cc=CC                  use C compiler CC [$cc]
-  --host-cc=CC             use C compiler CC [$host_cc] for code run at
-                           build time
+  --host-cc=CC             when cross compiling, use C compiler CC for code run
+                           at build time [$host_cc]
   --cxx=CXX                use C++ compiler CXX [$cxx]
   --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
   --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS
@@ -1892,7 +1892,6 @@ if test "$skip_meson" = no; then
   echo "windres = [$(meson_quote $windres)]" >> $cross
   echo "windmc = [$(meson_quote $windmc)]" >> $cross
   if test "$cross_compile" = "yes"; then
-    cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
     echo "system = '$targetos'" >> $cross
     case "$cpu" in
@@ -1909,6 +1908,14 @@ if test "$skip_meson" = no; then
     else
         echo "endian = 'little'" >> $cross
     fi
+    cross_arg="--cross-file config-meson.cross"
+
+    native="config-meson.native.new"
+    echo "# Automatically generated by configure - do not modify" > $native
+    echo "[binaries]" >> $native
+    echo "c = [$(meson_quote $host_cc)]" >> $native
+    mv $native config-meson.native
+    cross_arg="$cross_arg --native-file config-meson.native"
   else
     cross_arg="--native-file config-meson.cross"
   fi
-- 
2.41.0



  parent reply	other threads:[~2023-09-02 13:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02 12:59 [PATCH v2 00/15] configure cleanups for QEMU 8.2 Paolo Bonzini
2023-09-02 12:59 ` [PATCH 01/15] meson: do not unnecessarily use cmake for dependencies Paolo Bonzini
2023-09-02 12:59 ` [PATCH 02/15] meson: update unsupported host/CPU messages Paolo Bonzini
2023-09-04  8:09   ` Thomas Huth
2023-09-02 12:59 ` [PATCH 03/15] configure: remove HOST_CC Paolo Bonzini
2023-09-02 12:59 ` Paolo Bonzini [this message]
2023-09-02 12:59 ` [PATCH 05/15] meson: compile bundled device trees Paolo Bonzini
2023-09-02 12:59 ` [PATCH 06/15] configure: remove boolean variables for targets Paolo Bonzini
2023-09-02 23:30   ` Richard Henderson
2023-09-04  8:15   ` Thomas Huth
2023-09-05  6:00     ` Paolo Bonzini
2023-09-02 12:59 ` [PATCH 07/15] configure: move --enable-debug-tcg to meson Paolo Bonzini
2023-09-02 12:59 ` [PATCH 08/15] meson: test for CONFIG_TCG in config_all Paolo Bonzini
2023-09-02 12:59 ` [PATCH 09/15] contrib/plugins: use an independent makefile Paolo Bonzini
2023-09-02 12:59 ` [PATCH 10/15] configure: unify recursion into sub-Makefiles Paolo Bonzini
2023-09-02 12:59 ` [PATCH 11/15] configure, meson: move --enable-plugins to meson Paolo Bonzini
2023-09-02 12:59 ` [PATCH 12/15] configure, meson: remove CONFIG_SOLARIS from config-host.mak Paolo Bonzini
2023-09-02 12:59 ` [PATCH 13/15] configure, meson: remove target OS symbols " Paolo Bonzini
2023-09-02 12:59 ` [PATCH 14/15] meson: list leftover CONFIG_* symbols Paolo Bonzini
2023-09-02 12:59 ` [PATCH 15/15] configure: remove dead code Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230902125934.113017-5-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).