configure: switch directory options to automatic parsing

While prefix, bindir and qemu_suffix needs special treatment due to
differences between Windows and POSIX systems, everything else
needs no extra code in configure.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2022-04-20 17:33:57 +02:00
parent f7fb6c6ad4
commit c09c1ce7e9
4 changed files with 34 additions and 60 deletions

58
configure vendored
View File

@ -311,6 +311,7 @@ plugins="$default_feature"
meson=""
meson_args=""
ninja=""
bindir="bin"
skip_meson=no
# The following Meson options are handled manually (still they
@ -670,6 +671,7 @@ if test "$mingw32" = "yes" ; then
CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
write_c_skeleton;
prefix="/qemu"
bindir=""
qemu_suffix=""
fi
@ -776,30 +778,10 @@ for opt do
static="yes"
QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
;;
--mandir=*) mandir="$optarg"
;;
--bindir=*) bindir="$optarg"
;;
--libdir=*) libdir="$optarg"
;;
--libexecdir=*) libexecdir="$optarg"
;;
--includedir=*) includedir="$optarg"
;;
--datadir=*) datadir="$optarg"
;;
--with-suffix=*) qemu_suffix="$optarg"
;;
--docdir=*) docdir="$optarg"
;;
--localedir=*) localedir="$optarg"
;;
--sysconfdir=*) sysconfdir="$optarg"
;;
--localstatedir=*) local_statedir="$optarg"
;;
--firmwarepath=*) firmwarepath="$optarg"
;;
--host=*|--build=*|\
--disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\
@ -1022,23 +1004,6 @@ case $git_submodules_action in
;;
esac
libdir="${libdir:-$prefix/lib}"
libexecdir="${libexecdir:-$prefix/libexec}"
includedir="${includedir:-$prefix/include}"
if test "$mingw32" = "yes" ; then
bindir="${bindir:-$prefix}"
else
bindir="${bindir:-$prefix/bin}"
fi
mandir="${mandir:-$prefix/share/man}"
datadir="${datadir:-$prefix/share}"
docdir="${docdir:-$prefix/share/doc}"
sysconfdir="${sysconfdir:-$prefix/etc}"
local_statedir="${local_statedir:-$prefix/var}"
firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
localedir="${localedir:-$datadir/locale}"
if eval test -z "\${cross_cc_$cpu}"; then
eval "cross_cc_${cpu}=\$cc"
cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
@ -1116,16 +1081,7 @@ Advanced options (experts only):
--with-git-submodules=validate fail if git submodules are not up to date
--with-git-submodules=ignore do not update or check git submodules (default if no .git dir)
--static enable static build [$static]
--mandir=PATH install man pages in PATH
--datadir=PATH install firmware in PATH/$qemu_suffix
--localedir=PATH install translation in PATH/$qemu_suffix
--docdir=PATH install documentation in PATH/$qemu_suffix
--bindir=PATH install binaries in PATH
--libdir=PATH install libraries in PATH
--libexecdir=PATH install helper binaries in PATH
--sysconfdir=PATH install config in PATH/$qemu_suffix
--localstatedir=PATH install local state in PATH (set at runtime on win32)
--firmwarepath=PATH search PATH for firmware files
--efi-aarch64=PATH PATH of efi file to use for aarch64 VMs.
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
--without-default-features default all --enable-* options to "disabled"
@ -2410,18 +2366,8 @@ if test "$skip_meson" = no; then
run_meson() {
NINJA=$ninja $meson setup \
--prefix "$prefix" \
--libdir "$libdir" \
--libexecdir "$libexecdir" \
--bindir "$bindir" \
--includedir "$includedir" \
--datadir "$datadir" \
--mandir "$mandir" \
--sysconfdir "$sysconfdir" \
--localedir "$localedir" \
--localstatedir "$local_statedir" \
-Ddefault_devices=$default_devices \
-Ddocdir="$docdir" \
-Dqemu_firmwarepath="$firmwarepath" \
-Dqemu_suffix="$qemu_suffix" \
-Dsmbd="$smbd" \
-Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \

View File

@ -4,9 +4,9 @@
option('qemu_suffix', type : 'string', value: 'qemu',
description: 'Suffix for QEMU data/modules/config directories (can be empty)')
option('docdir', type : 'string', value : 'doc',
option('docdir', type : 'string', value : 'share/doc',
description: 'Base directory for documentation installation (can be empty)')
option('qemu_firmwarepath', type : 'string', value : '',
option('qemu_firmwarepath', type : 'string', value : 'qemu-firmware',
description: 'search PATH for firmware files')
option('pkgversion', type : 'string', value : '',
description: 'use specified string as sub-version of the package')

View File

@ -27,9 +27,7 @@ import sys
SKIP_OPTIONS = {
"default_devices",
"docdir",
"fuzzing_engine",
"qemu_firmwarepath",
"qemu_suffix",
"smbd",
}
@ -37,12 +35,21 @@ SKIP_OPTIONS = {
OPTION_NAMES = {
"malloc": "enable-malloc",
"pkgversion": "with-pkgversion",
"qemu_firmwarepath": "firmwarepath",
"trace_backends": "enable-trace-backends",
"trace_file": "with-trace-file",
}
BUILTIN_OPTIONS = {
"datadir",
"includedir",
"libdir",
"libexecdir",
"localedir",
"localstatedir",
"mandir",
"strip",
"sysconfdir",
}
LINE_WIDTH = 76

View File

@ -8,8 +8,11 @@ meson_options_help() {
printf "%s\n" ' --block-drv-rw-whitelist=VALUE'
printf "%s\n" ' set block driver read-write whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools like qemu-img)'
printf "%s\n" ' --datadir=VALUE Data file directory [share]'
printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)'
printf "%s\n" ' --disable-install-blobs install provided firmware blobs'
printf "%s\n" ' --docdir=VALUE Base directory for documentation installation'
printf "%s\n" ' (can be empty) [share/doc]'
printf "%s\n" ' --enable-block-drv-whitelist-in-tools'
printf "%s\n" ' use block whitelist also in tools instead of only'
printf "%s\n" ' QEMU'
@ -40,10 +43,18 @@ meson_options_help() {
printf "%s\n" ' --enable-trace-backends=CHOICES'
printf "%s\n" ' Set available tracing backends [log] (choices:'
printf "%s\n" ' dtrace/ftrace/log/nop/simple/syslog/ust)'
printf "%s\n" ' --firmwarepath=VALUE search PATH for firmware files [qemu-firmware]'
printf "%s\n" ' --iasl=VALUE Path to ACPI disassembler'
printf "%s\n" ' --includedir=VALUE Header file directory [include]'
printf "%s\n" ' --interp-prefix=VALUE where to find shared libraries etc., use %M for'
printf "%s\n" ' cpu name [/usr/gnemul/qemu-%M]'
printf "%s\n" ' --libdir=VALUE Library directory [lib64]'
printf "%s\n" ' --libexecdir=VALUE Library executable directory [libexec]'
printf "%s\n" ' --localedir=VALUE Locale data directory [share/locale]'
printf "%s\n" ' --localstatedir=VALUE Localstate data directory [/var/local]'
printf "%s\n" ' --mandir=VALUE Manual page directory [share/man]'
printf "%s\n" ' --sphinx-build=VALUE Use specified sphinx-build for building document'
printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]'
printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string'
printf "%s\n" ' [NORMAL]'
printf "%s\n" ' --with-pkgversion=VALUE use specified string as sub-version of the'
@ -206,6 +217,7 @@ _meson_option_parse() {
--disable-curl) printf "%s" -Dcurl=disabled ;;
--enable-curses) printf "%s" -Dcurses=enabled ;;
--disable-curses) printf "%s" -Dcurses=disabled ;;
--datadir=*) quote_sh "-Ddatadir=$2" ;;
--enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
--disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
--enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
@ -214,6 +226,7 @@ _meson_option_parse() {
--disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=false ;;
--enable-dmg) printf "%s" -Ddmg=enabled ;;
--disable-dmg) printf "%s" -Ddmg=disabled ;;
--docdir=*) quote_sh "-Ddocdir=$2" ;;
--enable-docs) printf "%s" -Ddocs=enabled ;;
--disable-docs) printf "%s" -Ddocs=disabled ;;
--enable-dsound) printf "%s" -Ddsound=enabled ;;
@ -252,6 +265,7 @@ _meson_option_parse() {
--iasl=*) quote_sh "-Diasl=$2" ;;
--enable-iconv) printf "%s" -Diconv=enabled ;;
--disable-iconv) printf "%s" -Diconv=disabled ;;
--includedir=*) quote_sh "-Dincludedir=$2" ;;
--enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
--disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
--interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
@ -265,6 +279,8 @@ _meson_option_parse() {
--disable-l2tpv3) printf "%s" -Dl2tpv3=disabled ;;
--enable-libdaxctl) printf "%s" -Dlibdaxctl=enabled ;;
--disable-libdaxctl) printf "%s" -Dlibdaxctl=disabled ;;
--libdir=*) quote_sh "-Dlibdir=$2" ;;
--libexecdir=*) quote_sh "-Dlibexecdir=$2" ;;
--enable-libiscsi) printf "%s" -Dlibiscsi=enabled ;;
--disable-libiscsi) printf "%s" -Dlibiscsi=disabled ;;
--enable-libnfs) printf "%s" -Dlibnfs=enabled ;;
@ -283,6 +299,8 @@ _meson_option_parse() {
--disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;;
--enable-live-block-migration) printf "%s" -Dlive_block_migration=enabled ;;
--disable-live-block-migration) printf "%s" -Dlive_block_migration=disabled ;;
--localedir=*) quote_sh "-Dlocaledir=$2" ;;
--localstatedir=*) quote_sh "-Dlocalstatedir=$2" ;;
--enable-lzfse) printf "%s" -Dlzfse=enabled ;;
--disable-lzfse) printf "%s" -Dlzfse=disabled ;;
--enable-lzo) printf "%s" -Dlzo=enabled ;;
@ -290,6 +308,7 @@ _meson_option_parse() {
--enable-malloc=*) quote_sh "-Dmalloc=$2" ;;
--enable-malloc-trim) printf "%s" -Dmalloc_trim=enabled ;;
--disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
--mandir=*) quote_sh "-Dmandir=$2" ;;
--enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
--disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
--enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
@ -325,6 +344,7 @@ _meson_option_parse() {
--disable-qcow1) printf "%s" -Dqcow1=disabled ;;
--enable-qed) printf "%s" -Dqed=enabled ;;
--disable-qed) printf "%s" -Dqed=disabled ;;
--firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$2" ;;
--enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
--disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
--enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
@ -363,6 +383,7 @@ _meson_option_parse() {
--disable-spice-protocol) printf "%s" -Dspice_protocol=disabled ;;
--enable-strip) printf "%s" -Dstrip=true ;;
--disable-strip) printf "%s" -Dstrip=false ;;
--sysconfdir=*) quote_sh "-Dsysconfdir=$2" ;;
--enable-tcg) printf "%s" -Dtcg=enabled ;;
--disable-tcg) printf "%s" -Dtcg=disabled ;;
--enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;