configure: clean up plugin option handling

Keep together all the conditions that lead to disabling plugins, and
remove now-dead code.

Since the option was not in SKIP_OPTIONS, it was present twice in
the help message, both from configure and from meson-buildoptions.sh.
Remove the duplication and take the occasion to document the option as
autodetected, which it is.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2023-09-18 11:06:48 +02:00
parent a47dd5c516
commit 39fb3cfc28
3 changed files with 30 additions and 28 deletions

39
configure vendored
View File

@ -377,7 +377,6 @@ fi
case $targetos in
windows)
plugins="no"
pie="no"
;;
haiku)
@ -741,7 +740,6 @@ for opt do
default_cflags='-O0 -g'
;;
--disable-tcg) tcg="disabled"
plugins="no"
;;
--enable-tcg) tcg="enabled"
;;
@ -778,11 +776,7 @@ for opt do
;;
--enable-download) download="enabled"; git_submodules_action=update;
;;
--enable-plugins) if test "$targetos" = "windows"; then
error_exit "TCG plugins not currently supported on Windows platforms"
else
plugins="yes"
fi
--enable-plugins) plugins="yes"
;;
--disable-plugins) plugins="no"
;;
@ -808,11 +802,6 @@ then
git_submodules_action="validate"
fi
# test for any invalid configuration combinations
if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
error_exit "Can't enable plugins on non-TCG builds"
fi
if ! test -f "$source_path/subprojects/keycodemapdb/README" \
&& test "$download" = disabled
then
@ -923,8 +912,6 @@ Advanced options (experts only):
--enable-debug enable common debug build options
--disable-werror disable compilation abort on warning
--cpu=CPU Build for host CPU [$cpu]
--enable-plugins
enable plugins via shared library loading
--disable-containers don't use containers for cross-building
--container-engine=TYPE which container engine to use [$container_engine]
--gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
@ -1066,15 +1053,27 @@ if test "$targetos" = "bogus"; then
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
fi
# test for any invalid configuration combinations
if test "$targetos" = "windows"; then
if test "$plugins" = "yes"; then
error_exit "TCG plugins not currently supported on Windows platforms"
fi
plugins="no"
fi
if test "$tcg" = "disabled" ; then
if test "$plugins" = "yes"; then
error_exit "Can't enable plugins on non-TCG builds"
fi
plugins="no"
fi
if test "$static" = "yes" ; then
if test "$plugins" = "yes"; then
error_exit "static and plugins are mutually incompatible"
else
plugins="no"
fi
plugins="no"
fi
test "$plugins" = "" && plugins=yes
if test "$plugins" = "yes"; then
if test "$plugins" != "no"; then
plugins=yes
subdirs="$subdirs contrib/plugins"
fi
@ -1717,10 +1716,6 @@ mkdir -p tests/tcg
echo "# Automatically generated by configure - do not modify" > $config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
if test "$plugins" = "yes" ; then
echo "CONFIG_PLUGIN=y" >> $config_host_mak
fi
tcg_tests_targets=
for target in $target_list; do
arch=${target%%-*}

View File

@ -44,6 +44,11 @@ OPTION_NAMES = {
"trace_file": "with-trace-file",
}
# Options that configure autodetects, even though meson defines them as boolean
AUTO_OPTIONS = {
"plugins",
}
BUILTIN_OPTIONS = {
"b_coverage",
"b_lto",
@ -168,6 +173,7 @@ def cli_metavar(opt):
def print_help(options):
print("meson_options_help() {")
feature_opts = []
for opt in sorted(options, key=cli_help_key):
key = cli_help_key(opt)
# The first section includes options that have an arguments,
@ -176,7 +182,7 @@ def print_help(options):
metavar = cli_metavar(opt)
left = f"--{key}={metavar}"
help_line(left, opt, 27, True)
elif opt["type"] == "boolean":
elif opt["type"] == "boolean" and opt["name"] not in AUTO_OPTIONS:
left = f"--{key}"
help_line(left, opt, 27, False)
elif allow_arg(opt):
@ -185,15 +191,16 @@ def print_help(options):
else:
left = f"--{key}=CHOICE"
help_line(left, opt, 27, True)
else:
feature_opts.append(opt)
sh_print()
sh_print("Optional features, enabled with --enable-FEATURE and")
sh_print("disabled with --disable-FEATURE, default is enabled if available")
sh_print("(unless built with --without-default-features):")
sh_print()
for opt in options:
key = opt["name"].replace("_", "-")
if opt["type"] != "boolean" and not allow_arg(opt):
for opt in sorted(feature_opts, key=cli_option):
key = cli_option(opt)
help_line(key, opt, 18, False)
print("}")

View File

@ -40,7 +40,6 @@ meson_options_help() {
printf "%s\n" ' jemalloc/system/tcmalloc)'
printf "%s\n" ' --enable-module-upgrades try to load modules from alternate paths for'
printf "%s\n" ' upgrades'
printf "%s\n" ' --enable-plugins TCG plugins via shared library loading'
printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and'
printf "%s\n" ' getrandom()'
printf "%s\n" ' --enable-safe-stack SafeStack Stack Smash Protection (requires'
@ -149,6 +148,7 @@ meson_options_help() {
printf "%s\n" ' pa PulseAudio sound support'
printf "%s\n" ' parallels parallels image format support'
printf "%s\n" ' pipewire PipeWire sound support'
printf "%s\n" ' plugins TCG plugins via shared library loading'
printf "%s\n" ' png PNG support with libpng'
printf "%s\n" ' pvrdma Enable PVRDMA support'
printf "%s\n" ' qcow1 qcow1 image format support'