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>
dev
Pekka Paalanen 12 years ago committed by Kristian Høgsberg
parent de7fe62a54
commit fb39d8d23c
  1. 13
      clients/window.c
  2. 4
      configure.ac

@ -41,6 +41,7 @@
#include <pixman.h> #include <pixman.h>
#ifdef HAVE_CAIRO_EGL
#include <wayland-egl.h> #include <wayland-egl.h>
#ifdef USE_CAIRO_GLESV2 #ifdef USE_CAIRO_GLESV2
@ -52,9 +53,13 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
#ifdef HAVE_CAIRO_EGL
#include <cairo-gl.h> #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 <xkbcommon/xkbcommon.h>
#include <wayland-cursor.h> #include <wayland-cursor.h>
@ -3795,13 +3800,11 @@ init_egl(struct display *d)
return -1; return -1;
} }
#ifdef HAVE_CAIRO_EGL
d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx); d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx);
if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) { if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) {
fprintf(stderr, "failed to get cairo egl argb device\n"); fprintf(stderr, "failed to get cairo egl argb device\n");
return -1; return -1;
} }
#endif
return 0; return 0;
} }
@ -3809,9 +3812,7 @@ init_egl(struct display *d)
static void static void
fini_egl(struct display *display) fini_egl(struct display *display)
{ {
#ifdef HAVE_CAIRO_EGL
cairo_device_destroy(display->argb_device); cairo_device_destroy(display->argb_device);
#endif
eglMakeCurrent(display->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, eglMakeCurrent(display->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT); EGL_NO_CONTEXT);

@ -164,7 +164,7 @@ AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients = xyes)
if test x$enable_clients = xyes; then if test x$enable_clients = xyes; then
AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients]) AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients])
PKG_CHECK_MODULES(CLIENT, [wayland-client wayland-egl egl >= 7.10 cairo >= 1.10.0 xkbcommon wayland-cursor]) PKG_CHECK_MODULES(CLIENT, [wayland-client cairo >= 1.10.0 xkbcommon wayland-cursor])
PKG_CHECK_MODULES(WESTON_INFO, [wayland-client]) PKG_CHECK_MODULES(WESTON_INFO, [wayland-client])
CLIENT_CFLAGS="$CLIENT_CFLAGS $IMAGE_CFLAGS" CLIENT_CFLAGS="$CLIENT_CFLAGS $IMAGE_CFLAGS"
@ -172,7 +172,7 @@ if test x$enable_clients = xyes; then
PKG_CHECK_MODULES(POPPLER, [poppler-glib glib-2.0 gobject-2.0 gio-2.0 ], PKG_CHECK_MODULES(POPPLER, [poppler-glib glib-2.0 gobject-2.0 gio-2.0 ],
[have_poppler=yes], [have_poppler=no]) [have_poppler=yes], [have_poppler=no])
PKG_CHECK_MODULES(CAIRO_EGL, [cairo-egl >= 1.11.3 $cairo_modules], PKG_CHECK_MODULES(CAIRO_EGL, [wayland-egl egl >= 7.10 cairo-egl >= 1.11.3 $cairo_modules],
[have_cairo_egl=yes], [have_cairo_egl=no]) [have_cairo_egl=yes], [have_cairo_egl=no])
AS_IF([test "x$have_cairo_egl" = "xyes"], AS_IF([test "x$have_cairo_egl" = "xyes"],
[AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])], [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],

Loading…
Cancel
Save