Generic check for desktop GL and EGL on Linux systems

This commit is contained in:
Nicolas Caramelli 2021-05-04 14:59:29 +02:00 committed by Sam Lantinga
parent f309d0649d
commit 31637ddeea
3 changed files with 106 additions and 154 deletions

157
configure vendored
View File

@ -21694,7 +21694,8 @@ $as_echo "#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1" >>confdefs.h
SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
fi fi
fi fi
else fi
if test x$have_x != xyes; then
# Prevent Mesa from including X11 headers # Prevent Mesa from including X11 headers
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11" EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11"
fi fi
@ -22316,16 +22317,15 @@ else
fi fi
CheckOpenGLX11() CheckGLX()
{ {
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL (GLX) support" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLX support" >&5
$as_echo_n "checking for OpenGL (GLX) support... " >&6; } $as_echo_n "checking for GLX support... " >&6; }
video_opengl=no video_opengl_glx=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
#include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
int int
@ -22337,59 +22337,18 @@ main ()
} }
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then : if ac_fn_c_try_compile "$LINENO"; then :
video_opengl=yes video_opengl_glx=yes
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_glx" >&5
$as_echo "$video_opengl" >&6; } $as_echo "$video_opengl_glx" >&6; }
if test x$video_opengl = xyes; then if test x$video_opengl_glx = xyes; then
$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h $as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h $as_echo "#define SDL_VIDEO_OPENGL_GLX 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
SUMMARY_video="${SUMMARY_video} opengl(glx)"
fi
fi
}
CheckOpenGLKMSDRM()
{
if test x$enable_video = xyes -a x$enable_video_opengl = xyes -a x$enable_video_kmsdrm = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL (GLVND) support" >&5
$as_echo_n "checking for OpenGL (GLVND) support... " >&6; }
video_opengl=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <GL/gl.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
video_opengl=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5
$as_echo "$video_opengl" >&6; }
if test x$video_opengl = xyes; then
$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
SUMMARY_video="${SUMMARY_video} opengl(glvnd)"
fi fi
fi fi
} }
@ -22416,9 +22375,9 @@ else
fi fi
CheckOpenGLESX11() CheckEGL()
{ {
if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes || test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5
$as_echo_n "checking for EGL support... " >&6; } $as_echo_n "checking for EGL support... " >&6; }
video_opengl_egl=no video_opengl_egl=no
@ -22451,7 +22410,50 @@ $as_echo "$video_opengl_egl" >&6; }
$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h $as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h
fi fi
fi
}
CheckOpenGL()
{
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL headers" >&5
$as_echo_n "checking for OpenGL headers... " >&6; }
video_opengl=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <GL/gl.h>
#include <GL/glext.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
video_opengl=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl" >&5
$as_echo "$video_opengl" >&6; }
if test x$video_opengl = xyes; then
$as_echo "#define SDL_VIDEO_OPENGL 1" >>confdefs.h
$as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
SUMMARY_video="${SUMMARY_video} opengl"
fi
fi
}
CheckOpenGLES()
{
if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
if test x$enable_video_opengles1 = xyes; then if test x$enable_video_opengles1 = xyes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES v1 headers" >&5
$as_echo_n "checking for OpenGL ES v1 headers... " >&6; } $as_echo_n "checking for OpenGL ES v1 headers... " >&6; }
@ -22524,42 +22526,6 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
fi fi
} }
CheckEGLKMSDRM()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL support" >&5
$as_echo_n "checking for EGL support... " >&6; }
video_opengl_egl=no
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define LINUX
#define EGL_API_FB
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <EGL/egl.h>
#include <EGL/eglext.h>
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
video_opengl_egl=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_opengl_egl" >&5
$as_echo "$video_opengl_egl" >&6; }
if test x$video_opengl_egl = xyes; then
$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h
fi
}
CheckWINDOWSGL() CheckWINDOWSGL()
{ {
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
@ -24957,12 +24923,12 @@ $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
CheckRPI CheckRPI
CheckX11 CheckX11
CheckDirectFB CheckDirectFB
# Need to check for EGL first because KMSDRM depends on it. # Need to check for EGL first because KMSDRM and Wayland depends on it.
CheckEGLKMSDRM CheckEGL
CheckKMSDRM CheckKMSDRM
CheckOpenGLKMSDRM CheckGLX
CheckOpenGLX11 CheckOpenGL
CheckOpenGLESX11 CheckOpenGLES
CheckVulkan CheckVulkan
CheckWayland CheckWayland
CheckInputEvents CheckInputEvents
@ -25617,7 +25583,8 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
CheckX11 CheckX11
CheckMacGL CheckMacGL
CheckMacGLES CheckMacGLES
CheckOpenGLX11 CheckGLX
CheckOpenGL
CheckVulkan CheckVulkan
CheckPTHREAD CheckPTHREAD
CheckHIDAPI CheckHIDAPI

View File

@ -2018,7 +2018,8 @@ XITouchClassInfo *t;
SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode" SUMMARY_video_x11="${SUMMARY_video_x11} xvidmode"
fi fi
fi fi
else fi
if test x$have_x != xyes; then
# Prevent Mesa from including X11 headers # Prevent Mesa from including X11 headers
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11" EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11"
fi fi
@ -2286,40 +2287,19 @@ AC_ARG_ENABLE(video-opengl,
[AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])], [AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])],
, enable_video_opengl=yes) , enable_video_opengl=yes)
dnl Find OpenGL dnl Find GLX
CheckOpenGLX11() CheckGLX()
{ {
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
AC_MSG_CHECKING(for OpenGL (GLX) support) AC_MSG_CHECKING(for GLX support)
video_opengl=no video_opengl_glx=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
]],[])], [video_opengl=yes],[]) ]],[])], [video_opengl_glx=yes],[])
AC_MSG_RESULT($video_opengl) AC_MSG_RESULT($video_opengl_glx)
if test x$video_opengl = xyes; then if test x$video_opengl_glx = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
SUMMARY_video="${SUMMARY_video} opengl(glx)"
fi
fi
}
dnl Find KMSDRM OpenGL (GLVND)
CheckOpenGLKMSDRM()
{
if test x$enable_video = xyes -a x$enable_video_opengl = xyes -a x$enable_video_kmsdrm = xyes; then
AC_MSG_CHECKING(for OpenGL (GLVND) support)
video_opengl=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <GL/gl.h>
]],[])], [video_opengl=yes],[])
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
SUMMARY_video="${SUMMARY_video} opengl(glvnd)"
fi fi
fi fi
} }
@ -2335,10 +2315,10 @@ AC_ARG_ENABLE(video-opengles2,
[AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [default=yes]])], [AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [default=yes]])],
, enable_video_opengles2=yes) , enable_video_opengles2=yes)
dnl Find OpenGL ES dnl Find EGL
CheckOpenGLESX11() CheckEGL()
{ {
if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then if test x$enable_video = xyes -a x$enable_video_opengl = xyes || test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
AC_MSG_CHECKING(for EGL support) AC_MSG_CHECKING(for EGL support)
video_opengl_egl=no video_opengl_egl=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@ -2353,7 +2333,32 @@ CheckOpenGLESX11()
if test x$video_opengl_egl = xyes; then if test x$video_opengl_egl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
fi fi
fi
}
dnl Find OpenGL
CheckOpenGL()
{
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
AC_MSG_CHECKING(for OpenGL headers)
video_opengl=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <GL/gl.h>
#include <GL/glext.h>
]],[])], [video_opengl=yes],[])
AC_MSG_RESULT($video_opengl)
if test x$video_opengl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
SUMMARY_video="${SUMMARY_video} opengl"
fi
fi
}
dnl Find OpenGL ES
CheckOpenGLES()
{
if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
if test x$enable_video_opengles1 = xyes; then if test x$enable_video_opengles1 = xyes; then
AC_MSG_CHECKING(for OpenGL ES v1 headers) AC_MSG_CHECKING(for OpenGL ES v1 headers)
video_opengles_v1=no video_opengles_v1=no
@ -2386,25 +2391,6 @@ CheckOpenGLESX11()
fi fi
} }
dnl Find EGL
CheckEGLKMSDRM()
{
AC_MSG_CHECKING(for EGL support)
video_opengl_egl=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define LINUX
#define EGL_API_FB
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <EGL/egl.h>
#include <EGL/eglext.h>
]],[])], [video_opengl_egl=yes],[])
AC_MSG_RESULT($video_opengl_egl)
if test x$video_opengl_egl = xyes; then
AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
fi
}
dnl Check for Windows OpenGL dnl Check for Windows OpenGL
CheckWINDOWSGL() CheckWINDOWSGL()
{ {
@ -3562,12 +3548,12 @@ case "$host" in
CheckRPI CheckRPI
CheckX11 CheckX11
CheckDirectFB CheckDirectFB
# Need to check for EGL first because KMSDRM depends on it. # Need to check for EGL first because KMSDRM and Wayland depends on it.
CheckEGLKMSDRM CheckEGL
CheckKMSDRM CheckKMSDRM
CheckOpenGLKMSDRM CheckGLX
CheckOpenGLX11 CheckOpenGL
CheckOpenGLESX11 CheckOpenGLES
CheckVulkan CheckVulkan
CheckWayland CheckWayland
CheckInputEvents CheckInputEvents
@ -4079,7 +4065,8 @@ case "$host" in
CheckX11 CheckX11
CheckMacGL CheckMacGL
CheckMacGLES CheckMacGLES
CheckOpenGLX11 CheckGLX
CheckOpenGL
CheckVulkan CheckVulkan
CheckPTHREAD CheckPTHREAD
CheckHIDAPI CheckHIDAPI

View File

@ -34,8 +34,6 @@
!!! FIXME: in Ubuntu 18.04 (and other distros). !!! FIXME: in Ubuntu 18.04 (and other distros).
*/ */
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <EGL/egl.h> #include <EGL/egl.h>
#include "wayland-util.h" #include "wayland-util.h"