When QEMU is configured with `--disable-audio`, we do not need to add the
audio drivers list to config_host_data. We also do not need to print this
list.
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
---
meson.build | 80 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 35 deletions(-)
diff --git a/meson.build b/meson.build
index 69aa7cd189..a1224c9695 100644
--- a/meson.build
+++ b/meson.build
@@ -2266,46 +2266,55 @@ endif
config_host_data = configuration_data()
config_host_data.set('CONFIG_HAVE_RUST', have_rust)
-audio_drivers_selected = []
-if have_system
- audio_drivers_available = {
- 'alsa': alsa.found(),
- 'coreaudio': coreaudio.found(),
- 'dsound': dsound.found(),
- 'jack': jack.found(),
- 'oss': oss.found(),
- 'pa': pulse.found(),
- 'pipewire': pipewire.found(),
- 'sdl': sdl.found(),
- 'sndio': sndio.found(),
- }
- foreach k, v: audio_drivers_available
- config_host_data.set('CONFIG_AUDIO_' + k.to_upper(), v)
- endforeach
+config_host_data.set('CONFIG_AUDIO', audio_enabled)
+if audio_enabled
+ audio_drivers_selected = []
+ if have_system
+ audio_drivers_available = {
+ 'alsa': alsa.found(),
+ 'coreaudio': coreaudio.found(),
+ 'dsound': dsound.found(),
+ 'jack': jack.found(),
+ 'oss': oss.found(),
+ 'pa': pulse.found(),
+ 'pipewire': pipewire.found(),
+ 'sdl': sdl.found(),
+ 'sndio': sndio.found(),
+ }
+ foreach k, v: audio_drivers_available
+ config_host_data.set('CONFIG_AUDIO_' + k.to_upper(), v)
+ endforeach
- # Default to native drivers first, OSS second, SDL third
- audio_drivers_priority = \
- [ 'pa', 'coreaudio', 'dsound', 'sndio', 'oss' ] + \
- (host_os == 'linux' ? [] : [ 'sdl' ])
- audio_drivers_default = []
- foreach k: audio_drivers_priority
- if audio_drivers_available[k]
- audio_drivers_default += k
- endif
- endforeach
+ # Default to native drivers first, OSS second, SDL third
+ audio_drivers_priority = \
+ [ 'pa', 'coreaudio', 'dsound', 'sndio', 'oss' ] + \
+ (host_os == 'linux' ? [] : [ 'sdl' ])
+ audio_drivers_default = []
+ foreach k: audio_drivers_priority
+ if audio_drivers_available[k]
+ audio_drivers_default += k
+ endif
+ endforeach
+ foreach k: get_option('audio_drv_list')
+ if k == 'default'
+ audio_drivers_selected += audio_drivers_default
+ elif not audio_drivers_available[k]
+ error('Audio driver "@0@" not available.'.format(k))
+ else
+ audio_drivers_selected += k
+ endif
+ endforeach
+ endif
+ config_host_data.set('CONFIG_AUDIO_DRIVERS',
+ '"' + '", "'.join(audio_drivers_selected) + '", ')
+else
foreach k: get_option('audio_drv_list')
- if k == 'default'
- audio_drivers_selected += audio_drivers_default
- elif not audio_drivers_available[k]
- error('Audio driver "@0@" not available.'.format(k))
- else
- audio_drivers_selected += k
+ if k != 'default'
+ error('Audio drivers are not supported because audio is disabled.')
endif
endforeach
endif
-config_host_data.set('CONFIG_AUDIO_DRIVERS',
- '"' + '", "'.join(audio_drivers_selected) + '", ')
have_host_block_device = (host_os != 'darwin' or
cc.has_header('IOKit/storage/IOMedia.h'))
@@ -4660,7 +4669,8 @@ if enable_modules
summary_info += {'alternative module path': get_option('module_upgrades')}
endif
summary_info += {'fuzzing support': get_option('fuzzing')}
-if have_system
+summary_info += {'Audio': get_option('audio')}
+if have_system and audio_enabled
summary_info += {'Audio drivers': ' '.join(audio_drivers_selected)}
endif
summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
--
2.34.1