This patch adds the `audio` option to meson_options.txt. It is
propagated into Kconfig as AUDIO. It is enabled by default.
The corresponding `--disable-audio` and `--enable-audio` options
for `configure` are also added.

For now, this option does nothing. In subsequent patches, it will
gradually disable audio in different places. The final goal is to stop
building sources from `audio/` and `hw/audio/` and other audio-related
files (except for some stubs). Note that this intent is different from
`-audio none`, which mutes audio but still compiles the audio subsystem.

Signed-off-by: Sergei Heifetz <[email protected]>
---
 Kconfig.host      | 3 +++
 configure         | 4 ++++
 meson.build       | 3 +++
 meson_options.txt | 3 +++
 4 files changed, 13 insertions(+)

diff --git a/Kconfig.host b/Kconfig.host
index 933425c74b..ec129aa4fc 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -29,6 +29,9 @@ config IVSHMEM
 config TPM
     bool
 
+config AUDIO
+    bool
+
 config FDT
     bool
 
diff --git a/configure b/configure
index 4b61fd3bbf..ff391c79a1 100755
--- a/configure
+++ b/configure
@@ -762,6 +762,10 @@ for opt do
   ;;
   --wasm64-32bit-address-limit)
   ;;
+  --enable-audio) meson_option_add -Daudio=true
+  ;;
+  --disable-audio) meson_option_add -Daudio=false
+  ;;
   # everything else has the same name in configure and meson
   --*) meson_option_parse "$opt" "$optarg"
   ;;
diff --git a/meson.build b/meson.build
index 8c6c0a9a32..69aa7cd189 100644
--- a/meson.build
+++ b/meson.build
@@ -68,6 +68,8 @@ foreach target : target_dirs
 endforeach
 have_user = have_linux_user or have_bsd_user
 
+audio_enabled = get_option('audio')
+
 ############
 # Programs #
 ############
@@ -3244,6 +3246,7 @@ disassemblers = {
 have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
 host_kconfig = \
   (get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
+  (audio_enabled ? ['CONFIG_AUDIO=y'] : []) + \
   (have_tpm ? ['CONFIG_TPM=y'] : []) + \
   (pixman.found() ? ['CONFIG_PIXMAN=y'] : []) + \
   (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
diff --git a/meson_options.txt b/meson_options.txt
index 2836156257..172ed10ead 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -71,6 +71,9 @@ option('malloc_trim', type : 'feature', value : 'auto',
 option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
        value: 'system', description: 'choose memory allocator to use')
 
+option('audio', type: 'boolean', value: true,
+       description: 'Audio support')
+
 option('kvm', type: 'feature', value: 'auto',
        description: 'KVM acceleration support')
 option('mshv', type: 'feature', value: 'auto',
-- 
2.34.1


Reply via email to