[PATCH] cairo-gl: Fix build with -Werror -Wundef

Olivier Blin <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Testing undefined macros is an error with -Werror -Wundef.
This is important to fix in cairo-gl.h since this is a public header.

This reverts commit c7cf0dfd602355e0c4fd1126e63844c304c1ef45 (which
was already a revert), and thus introduces back commits
c8b6c6066a238cf4cb04679e1149e956b1556a0c and
06a2696d5fa0ea50adb1463e2ee923ac92aabbdf.

This also adds new checks for CAIRO_HAS_GL_SURFACE and
CAIRO_HAS_GLESV2_SURFACE.
---
 src/cairo-gl.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/cairo-gl.h b/src/cairo-gl.h
index 9fd7608..7982b63 100644
--- a/src/cairo-gl.h
+++ b/src/cairo-gl.h
@@ -62,7 +62,8 @@
 
 #include "cairo.h"
 
-#if CAIRO_HAS_GL_SURFACE || CAIRO_HAS_GLESV2_SURFACE
+#if defined(CAIRO_HAS_GL_SURFACE) && CAIRO_HAS_GL_SURFACE || \
+    defined(CAIRO_HAS_GLESV2_SURFACE) && CAIRO_HAS_GLESV2_SURFACE
 
 CAIRO_BEGIN_DECLS
 
@@ -92,7 +93,7 @@ cairo_public void
 cairo_gl_device_set_thread_aware (cairo_device_t	*device,
 				  cairo_bool_t		 thread_aware);
 
-#if CAIRO_HAS_GLX_FUNCTIONS
+#if defined(CAIRO_HAS_GLX_FUNCTIONS) && CAIRO_HAS_GLX_FUNCTIONS
 #include <GL/glx.h>
 
 cairo_public cairo_device_t *
@@ -110,7 +111,7 @@ cairo_gl_surface_create_for_window (cairo_device_t *device,
 				    int width, int height);
 #endif
 
-#if CAIRO_HAS_WGL_FUNCTIONS
+#if defined(CAIRO_HAS_WGL_FUNCTIONS) && CAIRO_HAS_WGL_FUNCTIONS
 #include <windows.h>
 
 cairo_public cairo_device_t *
@@ -126,7 +127,7 @@ cairo_gl_surface_create_for_dc (cairo_device_t		*device,
 				int			 height);
 #endif
 
-#if CAIRO_HAS_EGL_FUNCTIONS
+#if defined(CAIRO_HAS_EGL_FUNCTIONS) && CAIRO_HAS_EGL_FUNCTIONS
 #include <EGL/egl.h>
 
 cairo_public cairo_device_t *
-- 
2.6.2

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.