From: Thomas Huth <thuth@redhat.com>
The GBM library detection does not need to be in the configure script,
since it does not have any user-facing options (there are no
--enable-gbm or --disable-gbm switches). Let's move it to meson.build
instead, so we don't have to clutter config-host.mak with the related
switches.
Additionally, only check for GBM if it is really required, i.e. if we
either compile with OpenGL or with virglrenderer support.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210713111516.734834-1-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 14 --------------
contrib/vhost-user-gpu/meson.build | 5 ++---
meson.build | 14 ++++++++------
3 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/configure b/configure
index bd823307a6..8adf2127c3 100755
--- a/configure
+++ b/configure
@@ -3451,13 +3451,6 @@ esac
##########################################
# opengl probe (for sdl2, gtk)
-gbm="no"
-if $pkg_config gbm; then
- gbm_cflags="$($pkg_config --cflags gbm)"
- gbm_libs="$($pkg_config --libs gbm)"
- gbm="yes"
-fi
-
if test "$opengl" != "no" ; then
epoxy=no
if $pkg_config epoxy; then
@@ -4688,13 +4681,6 @@ if test "$opengl" = "yes" ; then
echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
fi
-if test "$gbm" = "yes" ; then
- echo "CONFIG_GBM=y" >> $config_host_mak
- echo "GBM_LIBS=$gbm_libs" >> $config_host_mak
- echo "GBM_CFLAGS=$gbm_cflags" >> $config_host_mak
-fi
-
-
if test "$avx2_opt" = "yes" ; then
echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
fi
diff --git a/contrib/vhost-user-gpu/meson.build
b/contrib/vhost-user-gpu/meson.build
index 4cb52a91d7..92c8f3a86a 100644
--- a/contrib/vhost-user-gpu/meson.build
+++ b/contrib/vhost-user-gpu/meson.build
@@ -1,6 +1,5 @@
-if 'CONFIG_TOOLS' in config_host and virgl.found() \
- and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \
- and pixman.found()
+if 'CONFIG_TOOLS' in config_host and virgl.found() and gbm.found() \
+ and 'CONFIG_LINUX' in config_host and pixman.found()
executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c',
'vugbm.c'),
dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl],
install: true,
diff --git a/meson.build b/meson.build
index bf63784812..13df8c37c7 100644
--- a/meson.build
+++ b/meson.build
@@ -472,11 +472,6 @@ if not get_option('zstd').auto() or have_block
required: get_option('zstd'),
method: 'pkg-config', kwargs: static_kwargs)
endif
-gbm = not_found
-if 'CONFIG_GBM' in config_host
- gbm = declare_dependency(compile_args: config_host['GBM_CFLAGS'].split(),
- link_args: config_host['GBM_LIBS'].split())
-endif
virgl = not_found
if not get_option('virglrenderer').auto() or have_system
virgl = dependency('virglrenderer',
@@ -816,11 +811,17 @@ coreaudio = not_found
if 'CONFIG_AUDIO_COREAUDIO' in config_host
coreaudio = declare_dependency(link_args:
config_host['COREAUDIO_LIBS'].split())
endif
+
opengl = not_found
if 'CONFIG_OPENGL' in config_host
opengl = declare_dependency(compile_args:
config_host['OPENGL_CFLAGS'].split(),
link_args: config_host['OPENGL_LIBS'].split())
endif
+gbm = not_found
+if virgl.found() or 'CONFIG_OPENGL' in config_host
+ gbm = dependency('gbm', method: 'pkg-config',
+ required: false, kwargs: static_kwargs)
+endif