From 0e8227aa717bacf04af32e986ba32b5267ef19e0 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 2 Jan 2019 09:45:51 +0100 Subject: [PATCH] build: fix EGL library detection. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes libEGL.so can be available (provided as a symlink by Debian diversion packages) while EGL/egl.h isn’t. --- build/autotools/m4/lol-conf.m4 | 25 +++++++++++++------------ src/eglapp.cpp | 6 ++++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/build/autotools/m4/lol-conf.m4 b/build/autotools/m4/lol-conf.m4 index 3af5bc48..bf23406e 100644 --- a/build/autotools/m4/lol-conf.m4 +++ b/build/autotools/m4/lol-conf.m4 @@ -119,18 +119,19 @@ if test "${enable_gl}" != "no"; then AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) EGL_LIBS="${EGL_LIBS} -lX11" fi - AC_CHECK_LIB(EGL, main, - [ac_cv_my_have_egl="yes" - AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) - EGL_LIBS="-lEGL"]) - dnl Raspberry Pi is different, check for it with extra libs; also we - dnl look for a different function to bypass autoconf caching - AC_CHECK_LIB(EGL, eglGetDisplay, - [ac_cv_my_have_egl="yes" - AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) - EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"], - [:], - [-lvcos -lvchiq_arm -lbcm_host -lGLESv2]) + AC_CHECK_HEADERS(EGL/egl.h, + [AC_CHECK_LIB(EGL, eglInitialize, + [ac_cv_my_have_egl="yes" + AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) + EGL_LIBS="-lEGL"]) + dnl Raspberry Pi is different, check for it with extra libs; also we + dnl look for a different function to bypass autoconf caching + AC_CHECK_LIB(EGL, eglGetDisplay, + [ac_cv_my_have_egl="yes" + AC_DEFINE(LOL_USE_EGL, 1, Define to 1 to use libegl) + EGL_LIBS="-lEGL -lvcos -lvchiq_arm -lbcm_host -lGLESv2"], + [:], + [-lvcos -lvchiq_arm -lbcm_host -lGLESv2])]) fi AM_CONDITIONAL(LOL_USE_EGL, test "${ac_cv_my_have_egl}" != "no") diff --git a/src/eglapp.cpp b/src/eglapp.cpp index f665ecc0..74c8a587 100644 --- a/src/eglapp.cpp +++ b/src/eglapp.cpp @@ -20,8 +20,10 @@ # include # include # endif -# include -# include +# if defined HAVE_EGL_EGL_H +# include +# include +# endif #endif #if LOL_USE_SDL