From nobody Tue Feb 10 00:39:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634039692328669.0820524422307; Tue, 12 Oct 2021 04:54:52 -0700 (PDT) Received: from localhost ([::1]:34594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1maGMt-0007D2-6M for importer@patchew.org; Tue, 12 Oct 2021 07:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1maFiY-0000By-Jz for qemu-devel@nongnu.org; Tue, 12 Oct 2021 07:13:11 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:34746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1maFiW-0007TK-1m for qemu-devel@nongnu.org; Tue, 12 Oct 2021 07:13:10 -0400 Received: by mail-ed1-x52a.google.com with SMTP id g10so78904443edj.1 for ; Tue, 12 Oct 2021 04:13:07 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m23sm4742802eja.6.2021.10.12.04.13.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 04:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4o8XZSbKgfkUpkWyhbv9zsUcNaw+8qN2h8QQb1qjkVw=; b=LhGk4irX9nLpAxqkTorveKwTd8YQvrFjH86URaqPZRv2GxJusdlrbCuNpF2FjakxPj gT3pz5yTSQ+fGuV0um+WV/Q7xDdSfZk3GlxSdFaxboIFMKuI/Z9vSBJ+iCt58PEVtyua Q302WINBtuX3wKMp1ZuRdSFc4fszy+qrwIl06eW/Wyx3VwgFnpvMGMSscEfrtXfax25N g9DuoRVZ024Q+g/ES6ui6oyWFzXt4Qc/5L3b5Gs5kT/8ArFR6+qROoQtdZo+tOi51J1i rUkXJI3rgsMw7n2nSgSQTW1/35iMXWZWF63uD6b+ouHu2gWe7AGAWPLmaIoAKE5VZ1PG yOWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4o8XZSbKgfkUpkWyhbv9zsUcNaw+8qN2h8QQb1qjkVw=; b=bTKJwi7wBzLnnTjUPA006cbZQkbthWk1zES6oWs/s8UScgib/zELTB2t38CEdrYjIR ekZ/kfXhD651BBrrykVPwgc1fb7meQmj8FCXRoa2bySKszCRFICvz5QtRJAbWDeMavUD 1xgxGs5TuAwPWHvIUrRl9MzFhytJyUVNXQvej5sD8FPeYsOSlOxdTVwJUCo8EeSZL/07 N5qx+ED503YFl6Of3blfD6Qo4xpgxGxE8oOmClaX1HkzI5YJJf7jKAIhZvDB91t/ubla 7x8XPIFRtwf5ItwUb10TFWkgE7kreqiAuwshYuFP3xz+Tpsr/od+r5cMO154ILP3cvVk ditg== X-Gm-Message-State: AOAM531gswSI4KAyWUETuS6rTAxWYQfMnkiN8pLuyR+8XW0i1ct4Y0Gz QWcR7ixzpiJCrpE75TahUyuANNz76Lc= X-Google-Smtp-Source: ABdhPJz0+UrPXXDZnSG5AgOSn43+lJ4JHDQsJ+EW3psSmT9ImL3mfAewMm4+csGMuAlSzTMuQykqBw== X-Received: by 2002:a05:6402:11ca:: with SMTP id j10mr15107477edw.223.1634037186732; Tue, 12 Oct 2021 04:13:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 03/24] configure, meson: move audio driver detection to Meson Date: Tue, 12 Oct 2021 13:12:41 +0200 Message-Id: <20211012111302.246627-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211012111302.246627-1-pbonzini@redhat.com> References: <20211012111302.246627-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, thuth@redhat.com, =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffman Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634039693559100001 This brings a change that makes audio drivers more similar to all other modules. All drivers are built by default, while --audio-drv-list only governs the default choice of the audio driver. Meson options are added to disable the drivers, and the next patches will fix the help messages and command line options, and especially make the non-default drivers available via -audiodev. Cc: Gerd Hoffman Cc: Volker R=C3=BCmelin Signed-off-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau Message-Id: <20211007130630.632028-4-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- audio/meson.build | 23 +++--- configure | 184 +--------------------------------------------- meson.build | 137 +++++++++++++++++++++++++++++----- meson_options.txt | 18 ++++- 4 files changed, 147 insertions(+), 215 deletions(-) diff --git a/audio/meson.build b/audio/meson.build index 9a95c58f18..462533bb8c 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -7,23 +7,22 @@ softmmu_ss.add(files( 'wavcapture.c', )) =20 -softmmu_ss.add(when: [coreaudio, 'CONFIG_AUDIO_COREAUDIO'], if_true: files= ('coreaudio.c')) -softmmu_ss.add(when: [dsound, 'CONFIG_AUDIO_DSOUND'], - if_true: files('dsoundaudio.c', 'audio_win_int.c')) +softmmu_ss.add(when: coreaudio, if_true: files('coreaudio.c')) +softmmu_ss.add(when: dsound, if_true: files('dsoundaudio.c', 'audio_win_in= t.c')) =20 audio_modules =3D {} foreach m : [ - ['CONFIG_AUDIO_ALSA', 'alsa', alsa, 'alsaaudio.c'], - ['CONFIG_AUDIO_OSS', 'oss', oss, 'ossaudio.c'], - ['CONFIG_AUDIO_PA', 'pa', pulse, 'paaudio.c'], - ['CONFIG_AUDIO_SDL', 'sdl', sdl, 'sdlaudio.c'], - ['CONFIG_AUDIO_JACK', 'jack', jack, 'jackaudio.c'], - ['CONFIG_SPICE', 'spice', spice, 'spiceaudio.c'] + ['alsa', alsa, files('alsaaudio.c')], + ['oss', oss, files('ossaudio.c')], + ['pa', pulse, files('paaudio.c')], + ['sdl', sdl, files('sdlaudio.c')], + ['jack', jack, files('jackaudio.c')], + ['spice', spice, files('spiceaudio.c')] ] - if config_host.has_key(m[0]) + if m[1].found() module_ss =3D ss.source_set() - module_ss.add(when: m[2], if_true: files(m[3])) - audio_modules +=3D {m[1] : module_ss} + module_ss.add(m[1], m[2]) + audio_modules +=3D {m[0] : module_ss} endif endforeach =20 diff --git a/configure b/configure index 6a6273ce7b..fcadcf9577 100755 --- a/configure +++ b/configure @@ -240,7 +240,7 @@ interp_prefix=3D"/usr/gnemul/qemu-%M" static=3D"no" cross_compile=3D"no" cross_prefix=3D"" -audio_drv_list=3D"" +audio_drv_list=3D"default" block_drv_rw_whitelist=3D"" block_drv_ro_whitelist=3D"" block_drv_whitelist_tools=3D"no" @@ -299,7 +299,6 @@ fdt=3D"auto" netmap=3D"no" sdl=3D"auto" sdl_image=3D"auto" -coreaudio=3D"auto" virtiofsd=3D"auto" virtfs=3D"auto" libudev=3D"auto" @@ -356,7 +355,6 @@ module_upgrades=3D"no" prefix=3D"/usr/local" qemu_suffix=3D"qemu" slirp=3D"auto" -oss_lib=3D"" bsd=3D"no" linux=3D"no" solaris=3D"no" @@ -703,54 +701,35 @@ fi case $targetos in MINGW32*) mingw32=3D"yes" - audio_possible_drivers=3D"dsound sdl" - if check_include dsound.h; then - audio_drv_list=3D"dsound" - else - audio_drv_list=3D"" - fi supported_os=3D"yes" plugins=3D"no" pie=3D"no" ;; GNU/kFreeBSD) bsd=3D"yes" - audio_drv_list=3D"oss try-sdl" - audio_possible_drivers=3D"oss sdl pa" ;; FreeBSD) bsd=3D"yes" bsd_user=3D"yes" make=3D"${MAKE-gmake}" - audio_drv_list=3D"oss try-sdl" - audio_possible_drivers=3D"oss sdl pa" # needed for kinfo_getvmmap(3) in libutil.h netmap=3D"" # enable netmap autodetect ;; DragonFly) bsd=3D"yes" make=3D"${MAKE-gmake}" - audio_drv_list=3D"oss try-sdl" - audio_possible_drivers=3D"oss sdl pa" ;; NetBSD) bsd=3D"yes" make=3D"${MAKE-gmake}" - audio_drv_list=3D"oss try-sdl" - audio_possible_drivers=3D"oss sdl" - oss_lib=3D"-lossaudio" ;; OpenBSD) bsd=3D"yes" make=3D"${MAKE-gmake}" - audio_drv_list=3D"try-sdl" - audio_possible_drivers=3D"sdl" ;; Darwin) bsd=3D"yes" darwin=3D"yes" - audio_drv_list=3D"try-coreaudio try-sdl" - audio_possible_drivers=3D"coreaudio sdl" # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS=3D"-DOS_OBJECT_USE_OBJC=3D0 $QEMU_CFLAGS" @@ -759,10 +738,6 @@ SunOS) solaris=3D"yes" make=3D"${MAKE-gmake}" smbd=3D"${SMBD-/usr/sfw/sbin/smbd}" - if test -f /usr/include/sys/soundcard.h ; then - audio_drv_list=3D"oss try-sdl" - fi - audio_possible_drivers=3D"oss sdl" # needed for CMSG_ macros in sys/socket.h QEMU_CFLAGS=3D"-D_XOPEN_SOURCE=3D600 $QEMU_CFLAGS" # needed for TIOCWIN* defines in termios.h @@ -774,8 +749,6 @@ Haiku) QEMU_CFLAGS=3D"-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_C= FLAGS" ;; Linux) - audio_drv_list=3D"try-pa oss" - audio_possible_drivers=3D"oss alsa sdl pa" linux=3D"yes" linux_user=3D"yes" vhost_user=3D${default_feature:-yes} @@ -1795,7 +1768,6 @@ Advanced options (experts only): --disable-werror disable compilation abort on warning --disable-stack-protector disable compiler-provided stack protection --audio-drv-list=3DLIST set audio drivers list: - Available drivers: $audio_possible_drivers --block-drv-whitelist=3DL Same as --block-drv-rw-whitelist=3DL --block-drv-rw-whitelist=3DL set block driver read-write whitelist @@ -2398,12 +2370,6 @@ if test -z "$want_tools"; then fi fi =20 -########################################## -# Disable features only meaningful for system-mode emulation -if test "$softmmu" =3D "no"; then - audio_drv_list=3D"" -fi - ########################################## # L2TPV3 probe =20 @@ -2982,130 +2948,6 @@ EOF fi fi =20 -########################################## -# detect CoreAudio -if test "$coreaudio" !=3D "no" ; then - coreaudio_libs=3D"-framework CoreAudio" - cat > $TMPC << EOF -#include -int main(void) -{ - return (int)AudioGetCurrentHostTime(); -} -EOF - if compile_prog "" "$coreaudio_libs" ; then - coreaudio=3Dyes - else - coreaudio=3Dno - fi -fi - -########################################## -# Sound support libraries probe - -audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/,/ /g') -for drv in $audio_drv_list; do - case $drv in - alsa | try-alsa) - if $pkg_config alsa --exists; then - alsa_libs=3D$($pkg_config alsa --libs) - alsa_cflags=3D$($pkg_config alsa --cflags) - alsa=3Dyes - if test "$drv" =3D "try-alsa"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-alsa= /alsa/') - fi - else - if test "$drv" =3D "try-alsa"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-alsa= //') - else - error_exit "$drv check failed" \ - "Make sure to have the $drv libs and headers installed." - fi - fi - ;; - - pa | try-pa) - if $pkg_config libpulse --exists; then - libpulse=3Dyes - pulse_libs=3D$($pkg_config libpulse --libs) - pulse_cflags=3D$($pkg_config libpulse --cflags) - if test "$drv" =3D "try-pa"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-pa/p= a/') - fi - else - if test "$drv" =3D "try-pa"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-pa//= ') - else - error_exit "$drv check failed" \ - "Make sure to have the $drv libs and headers installed." - fi - fi - ;; - - sdl) - if test "$sdl" =3D "no"; then - error_exit "sdl not found or disabled, can not use sdl audio drive= r" - fi - ;; - - try-sdl) - if test "$sdl" =3D "no"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-sdl//') - else - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-sdl/sdl/= ') - fi - ;; - - coreaudio | try-coreaudio) - if test "$coreaudio" =3D "no"; then - if test "$drv" =3D "try-coreaudio"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi= o//') - else - error_exit "$drv check failed" \ - "Make sure to have the $drv is available." - fi - else - coreaudio_libs=3D"-framework CoreAudio" - if test "$drv" =3D "try-coreaudio"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-coreaudi= o/coreaudio/') - fi - fi - ;; - - dsound) - dsound_libs=3D"-lole32 -ldxguid" - ;; - - oss) - oss_libs=3D"$oss_lib" - ;; - - jack | try-jack) - if $pkg_config jack --exists; then - libjack=3Dyes - jack_libs=3D$($pkg_config jack --libs) - if test "$drv" =3D "try-jack"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-jack= /jack/') - fi - else - if test "$drv" =3D "try-jack"; then - audio_drv_list=3D$(echo "$audio_drv_list" | sed -e 's/try-jack= //') - else - error_exit "$drv check failed" \ - "Make sure to have the $drv libs and headers installed." - fi - fi - ;; - - *) - echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { - error_exit "Unknown driver '$drv' selected" \ - "Possible drivers are: $audio_possible_drivers" - } - ;; - esac -done - ########################################## # plugin linker support probe =20 @@ -4536,28 +4378,6 @@ fi if test "$gprof" =3D "yes" ; then echo "CONFIG_GPROF=3Dy" >> $config_host_mak fi -echo "CONFIG_AUDIO_DRIVERS=3D$audio_drv_list" >> $config_host_mak -for drv in $audio_drv_list; do - def=3DCONFIG_AUDIO_$(echo $drv | LC_ALL=3DC tr '[a-z]' '[A-Z]') - echo "$def=3Dy" >> $config_host_mak -done -if test "$alsa" =3D "yes" ; then - echo "CONFIG_ALSA=3Dy" >> $config_host_mak -fi -echo "ALSA_LIBS=3D$alsa_libs" >> $config_host_mak -echo "ALSA_CFLAGS=3D$alsa_cflags" >> $config_host_mak -if test "$libpulse" =3D "yes" ; then - echo "CONFIG_LIBPULSE=3Dy" >> $config_host_mak -fi -echo "PULSE_LIBS=3D$pulse_libs" >> $config_host_mak -echo "PULSE_CFLAGS=3D$pulse_cflags" >> $config_host_mak -echo "COREAUDIO_LIBS=3D$coreaudio_libs" >> $config_host_mak -echo "DSOUND_LIBS=3D$dsound_libs" >> $config_host_mak -echo "OSS_LIBS=3D$oss_libs" >> $config_host_mak -if test "$libjack" =3D "yes" ; then - echo "CONFIG_LIBJACK=3Dy" >> $config_host_mak -fi -echo "JACK_LIBS=3D$jack_libs" >> $config_host_mak echo "CONFIG_BDRV_RW_WHITELIST=3D$block_drv_rw_whitelist" >> $config_host_= mak echo "CONFIG_BDRV_RO_WHITELIST=3D$block_drv_ro_whitelist" >> $config_host_= mak if test "$block_drv_whitelist_tools" =3D "yes" ; then @@ -5195,7 +5015,7 @@ if test "$skip_meson" =3D no; then -Dvhost_user_blk_server=3D$vhost_user_blk_server -Dmultiprocess=3D= $multiprocess \ -Dfuse=3D$fuse -Dfuse_lseek=3D$fuse_lseek -Dguest_agent_msi=3D$gue= st_agent_msi -Dbpf=3D$bpf\ $(if test "$default_feature" =3D no; then echo "-Dauto_features=3D= disabled"; fi) \ - -Dtcg_interpreter=3D$tcg_interpreter \ + -Daudio_drv_list=3D$audio_drv_list -Dtcg_interpreter=3D$tcg_interp= reter \ $cross_arg \ "$PWD" "$source_path" =20 diff --git a/meson.build b/meson.build index 2d373a61a6..af3cd677f4 100644 --- a/meson.build +++ b/meson.build @@ -428,20 +428,23 @@ vde =3D not_found if config_host.has_key('CONFIG_VDE') vde =3D declare_dependency(link_args: config_host['VDE_LIBS'].split()) endif + pulse =3D not_found -if 'CONFIG_LIBPULSE' in config_host - pulse =3D declare_dependency(compile_args: config_host['PULSE_CFLAGS'].s= plit(), - link_args: config_host['PULSE_LIBS'].split()) +if not get_option('pa').auto() or (targetos =3D=3D 'linux' and have_system) + pulse =3D dependency('libpulse', required: get_option('pa'), + method: 'pkg-config', kwargs: static_kwargs) endif alsa =3D not_found -if 'CONFIG_ALSA' in config_host - alsa =3D declare_dependency(compile_args: config_host['ALSA_CFLAGS'].spl= it(), - link_args: config_host['ALSA_LIBS'].split()) +if not get_option('alsa').auto() or (targetos =3D=3D 'linux' and have_syst= em) + alsa =3D dependency('alsa', required: get_option('alsa'), + method: 'pkg-config', kwargs: static_kwargs) endif jack =3D not_found -if 'CONFIG_LIBJACK' in config_host - jack =3D declare_dependency(link_args: config_host['JACK_LIBS'].split()) +if not get_option('jack').auto() or have_system + jack =3D dependency('jack', required: get_option('jack'), + method: 'pkg-config', kwargs: static_kwargs) endif + spice =3D not_found spice_headers =3D not_found spice_protocol =3D not_found @@ -801,16 +804,59 @@ if liblzfse.found() and not cc.links(''' endif =20 oss =3D not_found -if 'CONFIG_AUDIO_OSS' in config_host - oss =3D declare_dependency(link_args: config_host['OSS_LIBS'].split()) +if not get_option('oss').auto() or have_system + if not cc.has_header('sys/soundcard.h') + # not found + elif targetos =3D=3D 'netbsd' + oss =3D cc.find_library('ossaudio', required: get_option('oss'), + kwargs: static_kwargs) + else + oss =3D declare_dependency() + endif + + if not oss.found() + if get_option('oss').enabled() + error('OSS not found') + else + warning('OSS not found, disabling') + endif + endif endif dsound =3D not_found -if 'CONFIG_AUDIO_DSOUND' in config_host - dsound =3D declare_dependency(link_args: config_host['DSOUND_LIBS'].spli= t()) +if not get_option('dsound').auto() or (targetos =3D=3D 'windows' and have_= system) + if cc.has_header('dsound.h') + dsound =3D declare_dependency(link_args: ['-lole32', '-ldxguid']) + endif + + if not dsound.found() + if get_option('dsound').enabled() + error('DirectSound not found') + else + warning('DirectSound not found, disabling') + endif + endif endif + coreaudio =3D not_found -if 'CONFIG_AUDIO_COREAUDIO' in config_host - coreaudio =3D declare_dependency(link_args: config_host['COREAUDIO_LIBS'= ].split()) +if not get_option('coreaudio').auto() or (targetos =3D=3D 'darwin' and hav= e_system) + coreaudio =3D dependency('appleframeworks', modules: 'CoreAudio', + required: get_option('coreaudio')) + if coreaudio.found() and not cc.links(''' + #include + int main(void) + { + return (int)AudioGetCurrentHostTime(); + }''') + coreaudio =3D not_found + endif + + if not coreaudio.found() + if get_option('coreaudio').enabled() + error('CoreAudio not found') + else + warning('CoreAudio not found, disabling') + endif + endif endif =20 opengl =3D not_found @@ -1156,6 +1202,49 @@ if libbpf.found() and not cc.links(''' endif endif =20 +################# +# config-host.h # +################# + +audio_drivers_selected =3D [] +if have_system + audio_drivers_available =3D { + 'alsa': alsa.found(), + 'coreaudio': coreaudio.found(), + 'dsound': dsound.found(), + 'jack': jack.found(), + 'oss': oss.found(), + 'pa': pulse.found(), + 'sdl': sdl.found(), + } + + # Default to native drivers first, OSS second, SDL third + audio_drivers_priority =3D \ + [ 'pa', 'coreaudio', 'dsound', 'oss' ] + \ + (targetos =3D=3D 'linux' ? [] : [ 'sdl' ]) + audio_drivers_default =3D [] + foreach k: audio_drivers_priority + if audio_drivers_available[k] + audio_drivers_default +=3D k + endif + endforeach + + foreach k: get_option('audio_drv_list') + if k =3D=3D 'default' + audio_drivers_selected +=3D audio_drivers_default + elif not audio_drivers_available[k] + error('Audio driver "@0@" not available.'.format(k)) + else + audio_drivers_selected +=3D k + endif + endforeach +endif +foreach k: audio_drivers_selected + config_host_data.set('CONFIG_AUDIO_' + k.to_upper(), true) +endforeach +config_host_data.set('CONFIG_AUDIO_DRIVERS', + '"' + '", "'.join(audio_drivers_selected) + '", ') + if get_option('cfi') cfi_flags=3D[] # Check for dependency on LTO @@ -1199,10 +1288,6 @@ endif have_host_block_device =3D (targetos !=3D 'darwin' or cc.has_header('IOKit/storage/IOMedia.h')) =20 -################# -# config-host.h # -################# - have_virtfs =3D (targetos =3D=3D 'linux' and have_system and libattr.found() and @@ -1446,7 +1531,7 @@ config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.c= ompiles(''' =20 =20 ignored =3D ['CONFIG_QEMU_INTERP_PREFIX'] # actually per-target -arrays =3D ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BD= RV_RO_WHITELIST'] +arrays =3D ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] strings =3D ['HOST_DSOSUF', 'CONFIG_IASL'] foreach k, v: config_host if ignored.contains(k) @@ -2882,7 +2967,7 @@ if config_host.has_key('CONFIG_MODULES') endif summary_info +=3D {'fuzzing support': config_host.has_key('CONFIG_FUZZ')} if have_system - summary_info +=3D {'Audio drivers': config_host['CONFIG_AUDIO_DRIVER= S']} + summary_info +=3D {'Audio drivers': ' '.join(audio_drivers_selected)} endif summary_info +=3D {'Trace backends': config_host['TRACE_BACKENDS']} if config_host['TRACE_BACKENDS'].split().contains('simple') @@ -3070,6 +3155,18 @@ if vnc.found() summary_info +=3D {'VNC JPEG support': jpeg} summary_info +=3D {'VNC PNG support': png} endif +if targetos not in ['darwin', 'haiku', 'windows'] + summary_info +=3D {'OSS support': oss} +elif targetos =3D=3D 'darwin' + summary_info +=3D {'CoreAudio support': coreaudio} +elif targetos =3D=3D 'windows' + summary_info +=3D {'DirectSound support': dsound} +endif +if targetos =3D=3D 'linux' + summary_info +=3D {'ALSA support': alsa} + summary_info +=3D {'PulseAudio support': pulse} +endif +summary_info +=3D {'JACK support': jack} summary_info +=3D {'brlapi support': brlapi} summary_info +=3D {'vde support': config_host.has_key('CONFIG_VDE')} summary_info +=3D {'netmap support': config_host.has_key('CONFIG_NETMAP= ')} diff --git a/meson_options.txt b/meson_options.txt index 2c89e79e8b..052c4f088e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -6,9 +6,12 @@ option('qemu_firmwarepath', type : 'string', value : '', description: 'search PATH for firmware files') option('sphinx_build', type : 'string', value : '', description: 'Use specified sphinx-build [$sphinx_build] for buildi= ng document (default to be empty)') - option('default_devices', type : 'boolean', value : true, description: 'Include a default selection of devices in emulators') +option('audio_drv_list', type: 'array', value: ['default'], + choices: ['alsa', 'coreaudio', 'default', 'dsound', 'jack', 'oss', = 'pa', 'sdl'], + description: 'Set audio driver list') + option('docs', type : 'feature', value : 'auto', description: 'Documentations build support') option('gettext', type : 'feature', value : 'auto', @@ -139,6 +142,19 @@ option('fuse', type: 'feature', value: 'auto', option('fuse_lseek', type : 'feature', value : 'auto', description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports') =20 +option('alsa', type: 'feature', value: 'auto', + description: 'ALSA sound support') +option('coreaudio', type: 'feature', value: 'auto', + description: 'CoreAudio sound support') +option('dsound', type: 'feature', value: 'auto', + description: 'DirectSound sound support') +option('jack', type: 'feature', value: 'auto', + description: 'JACK sound support') +option('oss', type: 'feature', value: 'auto', + description: 'OSS sound support') +option('pa', type: 'feature', value: 'auto', + description: 'PulseAudio sound support') + option('vhost_user_blk_server', type: 'feature', value: 'auto', description: 'build vhost-user-blk server') option('virtfs', type: 'feature', value: 'auto', --=20 2.31.1