configure, meson: move ARCH to meson.build

$ARCH and the HOST_* symbols are only used by the QEMU build; configure
uses $cpu instead.  Remove it from config-host.mak.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-11-08 14:18:17 +01:00
parent ffb91f68b1
commit 823eb01345
2 changed files with 21 additions and 26 deletions

21
configure vendored
View File

@ -635,11 +635,9 @@ else
cpu=$(uname -m) cpu=$(uname -m)
fi fi
ARCH= # Normalise host CPU name, set multilib cflags
# Normalise host CPU name, set ARCH and multilib cflags
# Note that this case should only have supported host CPUs, not guests. # Note that this case should only have supported host CPUs, not guests.
case "$cpu" in case "$cpu" in
aarch64|riscv) ;;
armv*b|armv*l|arm) armv*b|armv*l|arm)
cpu="arm" ;; cpu="arm" ;;
@ -668,8 +666,7 @@ case "$cpu" in
CPU_CFLAGS="-m64 -mlittle" ;; CPU_CFLAGS="-m64 -mlittle" ;;
s390) s390)
CPU_CFLAGS="-m31" CPU_CFLAGS="-m31" ;;
ARCH=unknown ;;
s390x) s390x)
CPU_CFLAGS="-m64" ;; CPU_CFLAGS="-m64" ;;
@ -678,15 +675,7 @@ case "$cpu" in
CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;; CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
sparc64) sparc64)
CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;; CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
*)
# This will result in either an error or falling back to TCI later
ARCH=unknown
;;
esac esac
if test -z "$ARCH"; then
ARCH="$cpu"
fi
: ${make=${MAKE-make}} : ${make=${MAKE-make}}
@ -3406,8 +3395,6 @@ echo "GIT=$git" >> $config_host_mak
echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
echo "ARCH=$ARCH" >> $config_host_mak
if test "$debug_tcg" = "yes" ; then if test "$debug_tcg" = "yes" ; then
echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
fi fi
@ -3898,12 +3885,12 @@ if test "$skip_meson" = no; then
cross_arg="--cross-file config-meson.cross" cross_arg="--cross-file config-meson.cross"
echo "[host_machine]" >> $cross echo "[host_machine]" >> $cross
echo "system = '$targetos'" >> $cross echo "system = '$targetos'" >> $cross
case "$ARCH" in case "$cpu" in
i386) i386)
echo "cpu_family = 'x86'" >> $cross echo "cpu_family = 'x86'" >> $cross
;; ;;
*) *)
echo "cpu_family = '$ARCH'" >> $cross echo "cpu_family = '$cpu'" >> $cross
;; ;;
esac esac
echo "cpu = '$cpu'" >> $cross echo "cpu = '$cpu'" >> $cross

View File

@ -67,6 +67,14 @@ endif
targetos = host_machine.system() targetos = host_machine.system()
if cpu not in supported_cpus
host_arch = 'unknown'
elif cpu == 'x86'
host_arch = 'i386'
else
host_arch = cpu
endif
if cpu in ['x86', 'x86_64'] if cpu in ['x86', 'x86_64']
kvm_targets = ['i386-softmmu', 'x86_64-softmmu'] kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
elif cpu == 'aarch64' elif cpu == 'aarch64'
@ -335,9 +343,9 @@ if targetos == 'netbsd'
endif endif
endif endif
tcg_arch = config_host['ARCH'] tcg_arch = host_arch
if not get_option('tcg').disabled() if not get_option('tcg').disabled()
if cpu not in supported_cpus if host_arch == 'unknown'
if get_option('tcg_interpreter') if get_option('tcg_interpreter')
warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu)) warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
else else
@ -353,11 +361,11 @@ if not get_option('tcg').disabled()
endif endif
if get_option('tcg_interpreter') if get_option('tcg_interpreter')
tcg_arch = 'tci' tcg_arch = 'tci'
elif config_host['ARCH'] == 'sparc64' elif host_arch == 'sparc64'
tcg_arch = 'sparc' tcg_arch = 'sparc'
elif config_host['ARCH'] == 'x86_64' elif host_arch == 'x86_64'
tcg_arch = 'i386' tcg_arch = 'i386'
elif config_host['ARCH'] == 'ppc64' elif host_arch == 'ppc64'
tcg_arch = 'ppc' tcg_arch = 'ppc'
endif endif
add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
@ -1426,6 +1434,8 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
config_host_data.set('HOST_' + host_arch.to_upper(), 1)
config_host_data.set('CONFIG_ATTR', libattr.found()) config_host_data.set('CONFIG_ATTR', libattr.found())
config_host_data.set('CONFIG_BRLAPI', brlapi.found()) config_host_data.set('CONFIG_BRLAPI', brlapi.found())
config_host_data.set('CONFIG_COCOA', cocoa.found()) config_host_data.set('CONFIG_COCOA', cocoa.found())
@ -1775,8 +1785,6 @@ foreach k, v: config_host
v = '"' + '", "'.join(v.split()) + '", ' v = '"' + '", "'.join(v.split()) + '", '
endif endif
config_host_data.set(k, v) config_host_data.set(k, v)
elif k == 'ARCH'
config_host_data.set('HOST_' + v.to_upper(), 1)
elif strings.contains(k) elif strings.contains(k)
config_host_data.set_quoted(k, v) config_host_data.set_quoted(k, v)
elif k.startswith('CONFIG_') elif k.startswith('CONFIG_')
@ -1919,7 +1927,7 @@ foreach target : target_dirs
endif endif
foreach k, v: disassemblers foreach k, v: disassemblers
if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k) if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
foreach sym: v foreach sym: v
config_target += { sym: 'y' } config_target += { sym: 'y' }
config_all_disas += { sym: 'y' } config_all_disas += { sym: 'y' }
@ -2888,7 +2896,7 @@ foreach target : target_dirs
endif endif
if 'CONFIG_LINUX_USER' in config_target if 'CONFIG_LINUX_USER' in config_target
base_dir = 'linux-user' base_dir = 'linux-user'
target_inc += include_directories('linux-user/host/' / config_host['ARCH']) target_inc += include_directories('linux-user/host/' / host_arch)
endif endif
if 'CONFIG_BSD_USER' in config_target if 'CONFIG_BSD_USER' in config_target
base_dir = 'bsd-user' base_dir = 'bsd-user'