configure, meson: move TPM check to meson

The check is simply for a POSIX system.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-12-21 12:38:27 +01:00
parent 488a8c73fb
commit 0d04c4c9de
8 changed files with 26 additions and 38 deletions

View File

@ -1,8 +1,6 @@
tpm_ss = ss.source_set()
tpm_ss.add(files('tpm_backend.c'))
tpm_ss.add(files('tpm_util.c'))
tpm_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
tpm_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
softmmu_ss.add_all(when: 'CONFIG_TPM', if_true: tpm_ss)
if have_tpm
softmmu_ss.add(files('tpm_backend.c'))
softmmu_ss.add(files('tpm_util.c'))
softmmu_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
softmmu_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
endif

25
configure vendored
View File

@ -330,7 +330,6 @@ coroutine=""
coroutine_pool="$default_feature"
debug_stack_usage="no"
tls_priority="NORMAL"
tpm="$default_feature"
live_block_migration=${default_feature:-yes}
replication=${default_feature:-yes}
bochs=${default_feature:-yes}
@ -1039,10 +1038,6 @@ for opt do
;;
--disable-pvrdma) pvrdma="no"
;;
--disable-tpm) tpm="no"
;;
--enable-tpm) tpm="yes"
;;
--disable-live-block-migration) live_block_migration="no"
;;
--enable-live-block-migration) live_block_migration="yes"
@ -1378,7 +1373,6 @@ cat << EOF
vhost-vdpa vhost-vdpa kernel backend support
live-block-migration Block migration in the main migration stream
coroutine-pool coroutine freelist (better performance)
tpm TPM support
replication replication support
opengl opengl support
qom-cast-debug cast debugging support
@ -2395,21 +2389,6 @@ if test "$modules" = yes; then
fi
fi
##########################################
# TPM emulation is only on POSIX
if test "$tpm" = ""; then
if test "$mingw32" = "yes"; then
tpm=no
else
tpm=yes
fi
elif test "$tpm" = "yes"; then
if test "$mingw32" = "yes" ; then
error_exit "TPM emulation only available on POSIX systems"
fi
fi
##########################################
# fdt probe
@ -3274,10 +3253,6 @@ if test "$live_block_migration" = "yes" ; then
echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
fi
if test "$tpm" = "yes"; then
echo 'CONFIG_TPM=y' >> $config_host_mak
fi
if test "$rdma" = "yes" ; then
echo "CONFIG_RDMA=y" >> $config_host_mak
echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak

View File

@ -301,7 +301,7 @@ and also listed as follows in the top-level meson.build's host_kconfig
variable::
host_kconfig = \
('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
(have_tpm ? ['CONFIG_TPM=y'] : []) + \
('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
...

View File

@ -25,7 +25,9 @@ acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c'))
acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))
acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c'))
acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
if have_tpm
acpi_ss.add(files('tpm.c'))
endif
softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c'))
softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c',

View File

@ -276,6 +276,10 @@ multiprocess_allowed = get_option('multiprocess') \
.require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
.allowed()
have_tpm = get_option('tpm') \
.require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
.allowed()
# Target-specific libraries and flags
libm = cc.find_library('m', required: false)
threads = dependency('threads')
@ -1492,6 +1496,7 @@ config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
config_host_data.set('CONFIG_SNAPPY', snappy.found())
config_host_data.set('CONFIG_TPM', have_tpm)
config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
config_host_data.set('CONFIG_VDE', vde.found())
config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@ -1942,7 +1947,7 @@ endif
have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
host_kconfig = \
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
(have_tpm ? ['CONFIG_TPM=y'] : []) + \
(spice.found() ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
@ -3556,7 +3561,7 @@ if targetos == 'windows'
endif
summary_info += {'seccomp support': seccomp}
summary_info += {'GlusterFS support': glusterfs}
summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
summary_info += {'TPM support': have_tpm}
summary_info += {'libssh support': libssh}
summary_info += {'lzo support': lzo}
summary_info += {'snappy support': snappy}

View File

@ -68,6 +68,8 @@ option('multiprocess', type: 'feature', value: 'auto',
description: 'Out of process device emulation support')
option('dbus_display', type: 'feature', value: 'auto',
description: '-display dbus support')
option('tpm', type : 'feature', value : 'auto',
description: 'TPM support')
# Do not enable it by default even for Mingw32, because it doesn't
# work on Wine.

View File

@ -86,6 +86,7 @@ meson_options_help() {
printf "%s\n" ' spice Spice server support'
printf "%s\n" ' spice-protocol Spice protocol support'
printf "%s\n" ' tcg TCG support'
printf "%s\n" ' tpm TPM support'
printf "%s\n" ' u2f U2F emulation support'
printf "%s\n" ' usb-redir libusbredir support'
printf "%s\n" ' vde vde network backend support'
@ -256,6 +257,8 @@ _meson_option_parse() {
--disable-tcg) printf "%s" -Dtcg=disabled ;;
--enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
--disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
--enable-tpm) printf "%s" -Dtpm=enabled ;;
--disable-tpm) printf "%s" -Dtpm=disabled ;;
--enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
--enable-u2f) printf "%s" -Du2f=enabled ;;
--disable-u2f) printf "%s" -Du2f=disabled ;;

View File

@ -27,6 +27,9 @@ softmmu_ss.add(files(
'qdev-monitor.c',
), sdl, libpmem, libdaxctl)
softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
if have_tpm
softmmu_ss.add(files('tpm.c'))
endif
softmmu_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
softmmu_ss.add(when: fdt, if_true: files('device_tree.c'))