configure: move target-specific defaults to an external machine file

Enable Windows-specific defaults with a machine file, so that related
options can be automatically parsed and included in the help message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2023-10-16 08:18:08 +02:00
parent 050b439887
commit c36dd41ba2
4 changed files with 34 additions and 23 deletions

37
configure vendored
View file

@ -246,8 +246,6 @@ default_cflags='-O2 -g'
git_submodules_action="update"
docs="auto"
EXESUF=""
prefix="/usr/local"
qemu_suffix="qemu"
system="yes"
linux_user=""
bsd_user=""
@ -256,7 +254,6 @@ subdirs=""
ninja=""
python=
download="enabled"
bindir="bin"
skip_meson=no
use_containers="yes"
gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
@ -583,9 +580,6 @@ done
if test "$targetos" = "windows" ; then
EXESUF=".exe"
prefix="/qemu"
bindir=""
qemu_suffix=""
fi
meson_option_build_array() {
@ -622,6 +616,14 @@ meson_option_parse() {
fi
}
meson_add_machine_file() {
if test "$cross_compile" = "yes"; then
meson_option_add --cross-file "$1"
else
meson_option_add --native-file "$1"
fi
}
for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case "$opt" in
@ -629,8 +631,6 @@ for opt do
;;
--version|-V) exec cat "$source_path/VERSION"
;;
--prefix=*) prefix="$optarg"
;;
--cross-prefix=*)
;;
--cc=*)
@ -701,10 +701,6 @@ for opt do
;;
--static) static="yes"
;;
--bindir=*) bindir="$optarg"
;;
--with-suffix=*) qemu_suffix="$optarg"
;;
--host=*|--build=*|\
--disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\
@ -861,7 +857,6 @@ Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
--prefix=PREFIX install in PREFIX [$prefix]
--target-list=LIST set target list (default: build all)
$(echo Available targets: $default_target_list | \
fold -s -w 53 | sed -e 's/^/ /')
@ -886,8 +881,6 @@ Advanced options (experts only):
--ninja=NINJA use specified ninja [$ninja]
--smbd=SMBD use specified smbd [$smbd]
--static enable static build [$static]
--bindir=PATH install binaries in PATH
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
--without-default-features default all --enable-* options to "disabled"
--without-default-devices do not include any device that is not needed to
start the emulator (only use if you are including
@ -1803,24 +1796,25 @@ 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"
meson_option_add --native-file
meson_option_add config-meson.native
fi
mv $cross config-meson.cross
meson_add_machine_file config-meson.cross
if test -f "$source_path/configs/meson/$targetos.txt"; then
meson_add_machine_file $source_path/configs/meson/$targetos.txt
fi
rm -rf meson-private meson-info meson-logs
# Built-in options
test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
test "$default_feature" = no && meson_option_add -Dauto_features=disabled
test "$static" = yes && meson_option_add -Dprefer_static=true
test "$pie" = no && meson_option_add -Db_pie=false
@ -1831,11 +1825,10 @@ if test "$skip_meson" = no; then
test "$docs" != auto && meson_option_add "-Ddocs=$docs"
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
test "$plugins" = yes && meson_option_add "-Dplugins=true"
test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
run_meson() {
NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
}
eval run_meson $meson_options
if test "$?" -ne 0 ; then