From nobody Mon Feb 9 18:17:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1596745102; cv=none; d=zohomail.com; s=zohoarc; b=l7X7YONsQobU1nXHerQzG01CbE7PSz4hm2AmqqDbU+52QK0XybcBNDcPu9gkGv6AobeFQhGVvM4are4RC/31DJwU3hDTO9OCaG6n5SMa4SkkRpf5XO3bryX0yUZ/f1f8EjhlGoHkIgWdpnLgD8xvme+9gvrHo2xcWQZTvAij0sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596745102; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=faNFfKXV4b8sg+ezVolPT9FPVgg+xhrG9FLJdDCewVs=; b=fHexoSdgXGpjvR0cvonTOaJRg+YErRuBe4adkZZItnTwxdIZy5POJZDvBuX4OeVX+ixmX6Ja5u7QMVToz3zJq2GRO4rd38CJfxNYqXV6cZfbdMNCGVxxzs7SsJ3uS68IGx2L2lZYmRKryXtLiesLWvfu2qdVkRX/hyrWx/+tyE0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596745102890374.70891269591357; Thu, 6 Aug 2020 13:18:22 -0700 (PDT) Received: from localhost ([::1]:45508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3mLF-0000rQ-BX for importer@patchew.org; Thu, 06 Aug 2020 16:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44710) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3lRP-0003Oy-Q8 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 15:20:39 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:33623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3lRN-00071u-29 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 15:20:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-19-YQ-SBg6nNm-Q58JnT9bU9w-1; Thu, 06 Aug 2020 15:20:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 90DB8107BEF7 for ; Thu, 6 Aug 2020 19:20:33 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id D97341D3 for ; Thu, 6 Aug 2020 19:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596741636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=faNFfKXV4b8sg+ezVolPT9FPVgg+xhrG9FLJdDCewVs=; b=Hid0Un/a16st/FB5UjJhoJu7m0+26lb9Rto3heMbJtTKna+5McozBvhDb+Mjcbhe0Vkr7r fxwlimAEXf7Ht8LbWYWg0OS0eb5sfIsOTLyYE2Tmz4668X6zQ0JjVJIB2PT1q+pSstDUk0 eV30h6zwcnjTIqCtPJkpRrlc3sRalkc= X-MC-Unique: YQ-SBg6nNm-Q58JnT9bU9w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 140/143] meson: move SDL and SDL-image detection to meson Date: Thu, 6 Aug 2020 21:16:16 +0200 Message-Id: <1596741379-12902-141-git-send-email-pbonzini@redhat.com> In-Reply-To: <1596741379-12902-1-git-send-email-pbonzini@redhat.com> References: <1596741379-12902-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=207.211.31.81; envelope-from=pbonzini@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 05:03:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- chardev/meson.build | 2 +- configure | 142 +++---------------------------------------------= ---- meson.build | 24 ++++++--- meson_options.txt | 2 + ui/meson.build | 4 +- 5 files changed, 30 insertions(+), 144 deletions(-) create mode 100644 meson_options.txt diff --git a/chardev/meson.build b/chardev/meson.build index 2122505..a0aaafa 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -36,7 +36,7 @@ softmmu_ss.add(when: ['CONFIG_SPICE', spice], if_true: fi= les('spice.c')) =20 chardev_modules =3D [] =20 -if config_host.has_key('CONFIG_BRLAPI') and config_host.has_key('CONFIG_SD= L') +if config_host.has_key('CONFIG_BRLAPI') and sdl.found() chardev_modules +=3D [['baum', files('baum.c'), [sdl, brlapi]]] endif =20 diff --git a/configure b/configure index a0b51d0..288a75f 100755 --- a/configure +++ b/configure @@ -377,8 +377,8 @@ curses=3D"" docs=3D"" fdt=3D"" netmap=3D"no" -sdl=3D"" -sdl_image=3D"" +sdl=3D"auto" +sdl_image=3D"auto" virtfs=3D"" mpath=3D"" vnc=3D"yes" @@ -1092,13 +1092,13 @@ for opt do # configure to be used by RPM and similar macros that set # lots of directory switches by default. ;; - --disable-sdl) sdl=3D"no" + --disable-sdl) sdl=3D"disabled" ;; - --enable-sdl) sdl=3D"yes" + --enable-sdl) sdl=3D"enabled" ;; - --disable-sdl-image) sdl_image=3D"no" + --disable-sdl-image) sdl_image=3D"disabled" ;; - --enable-sdl-image) sdl_image=3D"yes" + --enable-sdl-image) sdl_image=3D"enabled" ;; --disable-qom-cast-debug) qom_cast_debug=3D"no" ;; @@ -2368,7 +2368,7 @@ if test "$cocoa" =3D "yes"; then error_exit "Cocoa and GTK UIs cannot both be enabled at once" fi gtk=3Dno - sdl=3Dno + sdl=3Ddisabled fi =20 # Some versions of Mac OS X incorrectly define SIZE_MAX @@ -3274,125 +3274,6 @@ if test "$vte" !=3D "no"; then fi =20 ########################################## -# SDL probe - -# Look for sdl configuration program (pkg-config or sdl2-config). Try -# sdl2-config even without cross prefix, and favour pkg-config over sdl2-c= onfig. - -sdl_probe () -{ - if $pkg_config sdl2 --exists; then - sdlconfig=3D"$pkg_config sdl2" - sdlversion=3D$($sdlconfig --modversion 2>/dev/null) - elif has "$sdl2_config"; then - sdlconfig=3D"$sdl2_config" - sdlversion=3D$($sdlconfig --version) - else - if test "$sdl" =3D "yes" ; then - feature_not_found "sdl" "Install SDL2-devel" - fi - sdl=3Dno - # no need to do the rest - return - fi - if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" =3D sdl2-c= onfig; then - echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 - fi - - cat > $TMPC << EOF -#include -#undef main /* We don't want SDL to override our main() */ -int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } -EOF - sdl_cflags=3D$($sdlconfig --cflags 2>/dev/null) - sdl_cflags=3D"$sdl_cflags -Wno-undef" # workaround 2.0.8 bug - if test "$static" =3D "yes" ; then - if $pkg_config sdl2 --exists; then - sdl_libs=3D$($pkg_config sdl2 --static --libs 2>/dev/null) - else - sdl_libs=3D$($sdlconfig --static-libs 2>/dev/null) - fi - else - sdl_libs=3D$($sdlconfig --libs 2>/dev/null) - fi - if compile_prog "$sdl_cflags" "$sdl_libs" ; then - sdl=3Dyes - - # static link with sdl ? (note: sdl.pc's --static --libs is broken) - if test "$sdl" =3D "yes" && test "$static" =3D "yes" ; then - if test $? =3D 0 && echo $sdl_libs | grep -- -laa > /dev/null; then - sdl_libs=3D"$sdl_libs $(aalib-config --static-libs 2>/dev/null)" - sdl_cflags=3D"$sdl_cflags $(aalib-config --cflags 2>/dev/null)" - fi - if compile_prog "$sdl_cflags" "$sdl_libs" ; then - : - else - sdl=3Dno - fi - fi # static link - else # sdl not found - if test "$sdl" =3D "yes" ; then - feature_not_found "sdl" "Install SDL2 devel" - fi - sdl=3Dno - fi # sdl compile test -} - -sdl_image_probe () -{ - if test "$sdl_image" !=3D "no" ; then - if $pkg_config SDL2_image --exists; then - if test "$static" =3D "yes"; then - sdl_image_libs=3D$($pkg_config SDL2_image --libs --static = 2>/dev/null) - else - sdl_image_libs=3D$($pkg_config SDL2_image --libs 2>/dev/nu= ll) - fi - sdl_image_cflags=3D$($pkg_config SDL2_image --cflags 2>/dev/nu= ll) - sdl_image=3Dyes - - sdl_cflags=3D"$sdl_cflags $sdl_image_cflags" - sdl_libs=3D"$sdl_libs $sdl_image_libs" - else - if test "$sdl_image" =3D "yes" ; then - feature_not_found "sdl_image" "Install SDL Image devel" - else - sdl_image=3Dno - fi - fi - fi -} - -if test "$sdl" !=3D "no" ; then - sdl_probe -fi - -if test "$sdl" =3D "yes" ; then - sdl_image_probe -else - if test "$sdl_image" =3D "yes"; then - echo "warning: SDL Image requested, but SDL is not available, disablin= g" - fi - sdl_image=3Dno -fi - -if test "$sdl" =3D "yes" ; then - cat > $TMPC < -#if defined(SDL_VIDEO_DRIVER_X11) -#include -#else -#error No x11 support -#endif -int main(void) { return 0; } -EOF - if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then - need_x11=3Dyes - sdl_cflags=3D"$sdl_cflags $x11_cflags" - sdl_libs=3D"$sdl_libs $x11_libs" - fi -fi - -########################################## # RDMA needs OpenFabrics libraries if test "$rdma" !=3D "no" ; then cat > $TMPC <> $config_host_mak echo "X11_LIBS=3D$x11_libs" >> $config_host_mak fi -if test "$sdl" =3D "yes" ; then - echo "CONFIG_SDL=3Dm" >> $config_host_mak - echo "SDL_CFLAGS=3D$sdl_cflags" >> $config_host_mak - echo "SDL_LIBS=3D$sdl_libs" >> $config_host_mak - if test "$sdl_image" =3D "yes" ; then - echo "CONFIG_SDL_IMAGE=3Dy" >> $config_host_mak - fi -fi if test "$cocoa" =3D "yes" ; then echo "CONFIG_COCOA=3Dy" >> $config_host_mak fi @@ -8424,6 +8297,7 @@ NINJA=3D$PWD/ninjatool $python $meson setup \ -Dstrip=3D$(if test "$strip_opt" =3D yes; then echo true; else ech= o false; fi) \ -Db_pie=3D$(if test "$pie" =3D yes; then echo true; else echo fals= e; fi) \ -Db_coverage=3D$(if test "$gcov" =3D yes; then echo true; else ech= o false; fi) \ + -Dsdl=3D$sdl -Dsdl_image=3D$sdl_image \ $cross_arg \ "$PWD" "$source_path" =20 diff --git a/meson.build b/meson.build index cb2ffd6..8bb0c69 100644 --- a/meson.build +++ b/meson.build @@ -201,13 +201,21 @@ brlapi =3D not_found if 'CONFIG_BRLAPI' in config_host brlapi =3D declare_dependency(link_args: config_host['BRLAPI_LIBS'].spli= t()) endif + +sdl =3D dependency('sdl2', method: 'config-tool', required: get_option('sd= l')) +sdl_image =3D not_found sdlwindows =3D false -sdl =3D not_found -if 'CONFIG_SDL' in config_host - sdl =3D declare_dependency(compile_args: config_host['SDL_CFLAGS'].split= (), - link_args: config_host['SDL_LIBS'].split()) - sdlwindows =3D config_host['SDL_LIBS'].contains('-mwindows') +if sdl.found() + sdlwindows =3D sdl.get_configtool_variable('libs').split().contains('-mw= indows') + sdl_image =3D dependency('sdl-image', required: get_option('sdl_image')) +else + if get_option('sdl_image').enabled() + error('sdl-image required, but SDL was @0@', + get_option('sdl').disabled() ? 'disabled' : 'not found') + endif + sdl_image =3D not_found endif + rbd =3D not_found if 'CONFIG_RBD' in config_host rbd =3D declare_dependency(link_args: config_host['RBD_LIBS'].split()) @@ -346,6 +354,8 @@ endif =20 # Create config-host.h =20 +config_host_data.set('CONFIG_SDL', sdl.found()) +config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version(= ))) config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('= .')[0]) config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('= .')[1]) @@ -1219,8 +1229,8 @@ if targetos =3D=3D 'darwin' summary_info +=3D {'Cocoa support': config_host.has_key('CONFIG_COCOA')} endif # TODO: add back version -summary_info +=3D {'SDL support': config_host.has_key('CONFIG_SDL')} -summary_info +=3D {'SDL image support': config_host.has_key('CONFIG_SDL_IM= AGE')} +summary_info +=3D {'SDL support': sdl.found()} +summary_info +=3D {'SDL image support': sdl_image.found()} # TODO: add back version summary_info +=3D {'GTK support': config_host.has_key('CONFIG_GTK')} summary_info +=3D {'GTK GL support': config_host.has_key('CONFIG_GTK_GL= ')} diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..e548211 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,2 @@ +option('sdl', type : 'feature', value : 'auto') +option('sdl_image', type : 'feature', value : 'auto') diff --git a/ui/meson.build b/ui/meson.build index 36a70c3..2822ad9 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -54,11 +54,11 @@ if config_host.has_key('CONFIG_GTK') and config_host.ha= s_key('CONFIG_VTE') ui_modules +=3D [['gtk', gtk_ss.sources(), gtk_ss.dependencies()]] endif =20 -if config_host.has_key('CONFIG_SDL') +if sdl.found() softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c')) =20 sdl_ss =3D ss.source_set() - sdl_ss.add(pixman, glib, files( + sdl_ss.add(sdl, sdl_image, pixman, glib, files( 'sdl2-2d.c', 'sdl2-input.c', 'sdl2.c', --=20 1.8.3.1