aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2023-07-07 16:12:19 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2023-09-07 13:32:14 +0200
commit3c7ee49b81d2fc2930c09f9e0206227516d406e1 (patch)
tree66c445b0ba1d11f545988454a75149839e62f7f4 /configure
parentb3403ed00b0dbf14a77d6a7be797861e7b7f4907 (diff)
configure: create native file with contents of $host_cc
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>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure15
1 files changed, 11 insertions, 4 deletions
diff --git a/configure b/configure
index 7743c18f2f..378a0de9fb 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