toytoolkit: make all EGL code dependant on cairo-egl
configure.ac: The toytoolkit clients used to get libEGL linked to them
even if there was no cairo-egl. This is useless, and actually harmful on
platforms, where libEGL absolutely requires one of the GL ES libraries
to be linked in, too.
Look for EGL-related packages only for cairo-egl with toytoolkit.
window.c: protect all GL header includes with HAVE_CAIRO_EGL, since that
is the only case we can support EGL, GL, or GLESv2 at all. In the case
we do not have cairo-egl, add enough definitions to let us build the
stubs for EGL-related functions.
Remove some #ifdefs that were inside of the same #ifdef already.
These changes allow to build sorfware rendering toytoolkit clients
without any bits of EGL libs or headers.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
diff --git a/clients/window.c b/clients/window.c
index 30fc67c..3f6a7c7 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -41,6 +41,7 @@
#include <pixman.h>
+#ifdef HAVE_CAIRO_EGL
#include <wayland-egl.h>
#ifdef USE_CAIRO_GLESV2
@@ -52,9 +53,13 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
-#ifdef HAVE_CAIRO_EGL
#include <cairo-gl.h>
-#endif
+#else /* HAVE_CAIRO_EGL */
+typedef void *EGLDisplay;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#endif /* no HAVE_CAIRO_EGL */
#include <xkbcommon/xkbcommon.h>
#include <wayland-cursor.h>
@@ -3795,13 +3800,11 @@
return -1;
}
-#ifdef HAVE_CAIRO_EGL
d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx);
if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) {
fprintf(stderr, "failed to get cairo egl argb device\n");
return -1;
}
-#endif
return 0;
}
@@ -3809,9 +3812,7 @@
static void
fini_egl(struct display *display)
{
-#ifdef HAVE_CAIRO_EGL
cairo_device_destroy(display->argb_device);
-#endif
eglMakeCurrent(display->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);