configure: Improve OpenGL dependency detections

This has the following visible changes:

- GBM is required only for OpenGL dma-buf.
- X11 is explicitly required by gtk-egl.
- EGL is now mandatory for the OpenGL displays.

The last one needs some detailed description. Before this change,
EGL was tested only for OpenGL dma-buf with the check of
EGL_MESA_image_dma_buf_export. However, all of the OpenGL
displays depend on EGL and EGL_MESA_image_dma_buf_export is always
defined by epoxy's EGL interface.
Therefore, it makes more sense to always check the presence of EGL
and say the OpenGL displays are available along with OpenGL dma-buf
if it is present.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: <20210223060307.87736-1-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Akihiko Odaki 2021-02-23 15:03:07 +09:00 committed by Gerd Hoffmann
parent d9c32b8f7f
commit bc6a3565c8
10 changed files with 56 additions and 35 deletions

37
configure vendored
View file

@ -394,7 +394,6 @@ u2f="auto"
libusb="$default_feature"
usb_redir="$default_feature"
opengl="$default_feature"
opengl_dmabuf="no"
cpuid_h="no"
avx2_opt="$default_feature"
capstone="auto"
@ -3607,14 +3606,24 @@ if $pkg_config gbm; then
fi
if test "$opengl" != "no" ; then
opengl_pkgs="epoxy gbm"
if $pkg_config $opengl_pkgs; then
opengl_cflags="$($pkg_config --cflags $opengl_pkgs)"
opengl_libs="$($pkg_config --libs $opengl_pkgs)"
epoxy=no
if $pkg_config epoxy; then
cat > $TMPC << EOF
#include <epoxy/egl.h>
int main(void) { return 0; }
EOF
if compile_prog "" "" ; then
epoxy=yes
fi
fi
if test "$epoxy" = "yes" ; then
opengl_cflags="$($pkg_config --cflags epoxy)"
opengl_libs="$($pkg_config --libs epoxy)"
opengl=yes
else
if test "$opengl" = "yes" ; then
feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs"
feature_not_found "opengl" "Please install epoxy with EGL"
fi
opengl_cflags=""
opengl_libs=""
@ -3622,19 +3631,6 @@ if test "$opengl" != "no" ; then
fi
fi
if test "$opengl" = "yes"; then
cat > $TMPC << EOF
#include <epoxy/egl.h>
#ifndef EGL_MESA_image_dma_buf_export
# error mesa/epoxy lacks support for dmabufs (mesa 10.6+)
#endif
int main(void) { return 0; }
EOF
if compile_prog "" "" ; then
opengl_dmabuf=yes
fi
fi
##########################################
# libxml2 probe
if test "$libxml2" != "no" ; then
@ -5837,9 +5833,6 @@ if test "$opengl" = "yes" ; then
echo "CONFIG_OPENGL=y" >> $config_host_mak
echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
if test "$opengl_dmabuf" = "yes" ; then
echo "CONFIG_OPENGL_DMABUF=y" >> $config_host_mak
fi
fi
if test "$gbm" = "yes" ; then