diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-12-21 12:38:27 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-02-21 10:35:53 +0100 |
commit | 0d04c4c9de3f260eb65f832983655d1a1206cc15 (patch) | |
tree | 02b3251defa7bbbc0d66861699ed105c69d69e00 | |
parent | 488a8c73fbd72cbf4387ff3150271fe414b0dd4a (diff) |
configure, meson: move TPM check to meson
The check is simply for a POSIX system.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | backends/tpm/meson.build | 14 | ||||
-rwxr-xr-x | configure | 25 | ||||
-rw-r--r-- | docs/devel/kconfig.rst | 2 | ||||
-rw-r--r-- | hw/acpi/meson.build | 4 | ||||
-rw-r--r-- | meson.build | 9 | ||||
-rw-r--r-- | meson_options.txt | 2 | ||||
-rw-r--r-- | scripts/meson-buildoptions.sh | 3 | ||||
-rw-r--r-- | softmmu/meson.build | 5 |
8 files changed, 26 insertions, 38 deletions
diff --git a/backends/tpm/meson.build b/backends/tpm/meson.build index 857929082e..7f2503f84e 100644 --- a/backends/tpm/meson.build +++ b/backends/tpm/meson.build @@ -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 @@ -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 @@ -2396,21 +2390,6 @@ if test "$modules" = yes; then 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 case "$fdt" in @@ -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 diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst index a1cdbec751..d6b55a6fe0 100644 --- a/docs/devel/kconfig.rst +++ b/docs/devel/kconfig.rst @@ -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'] : []) + \ ... diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index f5b22983bb..8bea2e6933 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -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', diff --git a/meson.build b/meson.build index f8b83f64db..02137be91e 100644 --- a/meson.build +++ b/meson.build @@ -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} diff --git a/meson_options.txt b/meson_options.txt index b903c11be8..8488528a35 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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. diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index d46d7181e7..3f107e5724 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -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 ;; diff --git a/softmmu/meson.build b/softmmu/meson.build index d8e03018ab..39f766ce7c 100644 --- a/softmmu/meson.build +++ b/softmmu/meson.build @@ -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')) |