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>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
meson.build | 80 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 35 deletions(-)
diff --git a/meson.build b/meson.build
index d05533488f9..7f71dce3ae5 100644
--- a/meson.build
+++ b/meson.build
@@ -2280,46 +2280,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', have_audio)
+if have_audio
+ 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'))
@@ -4710,7 +4719,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 support': have_audio}
+if have_audio
summary_info += {'Audio drivers': ' '.join(audio_drivers_selected)}
endif
summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
--
2.34.1
On 15/3/26 21:16, Sergei Heifetz wrote:
> 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>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> meson.build | 80 ++++++++++++++++++++++++++++++-----------------------
> 1 file changed, 45 insertions(+), 35 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index d05533488f9..7f71dce3ae5 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2280,46 +2280,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', have_audio)
> +if have_audio
> + 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'))
> @@ -4710,7 +4719,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 support': have_audio}
> +if have_audio
> summary_info += {'Audio drivers': ' '.join(audio_drivers_selected)}
> endif
> summary_info += {'Trace backends': ','.join(get_option('trace_backends'))}
Shouldn't this be squashed with patch #1 as a single meson change?
On 1/4/26 12:10, Philippe Mathieu-Daudé wrote:
> On 15/3/26 21:16, Sergei Heifetz wrote:
>> 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>
>> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> ---
>> meson.build | 80 ++++++++++++++++++++++++++++++-----------------------
>> 1 file changed, 45 insertions(+), 35 deletions(-)
>>
>> diff --git a/meson.build b/meson.build
>> index d05533488f9..7f71dce3ae5 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -2280,46 +2280,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', have_audio)
>> +if have_audio
>> + 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'))
>> @@ -4710,7 +4719,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 support': have_audio}
>> +if have_audio
>> summary_info += {'Audio drivers': '
>> '.join(audio_drivers_selected)}
>> endif
>> summary_info += {'Trace backends':
>> ','.join(get_option('trace_backends'))}
>
> Shouldn't this be squashed with patch #1 as a single meson change?
Ah no otherwise we'd get link failures before the other patches.
© 2016 - 2026 Red Hat, Inc.