[cairo] [PATCH] gl: For glesv3 detection, use glesv2.pc + header check

Bryce Harrington bryce at bryceharrington.org
Tue Jun 12 19:50:26 UTC 2018


From: Bryce Harrington <bryce at osg.samsung.com>

There is no glesv3.pc provided by mesa, perhaps because
the glesv3 support is provided by the libGLESv2 library.
Don't bother testing for glesv3.pc, just check for glesv2.pc
and then search for the gl3.h header file.

This fixes an issue reported by Theo Veenker, where building
with glesv3 enabled would result in a cairo.pc file that depends
on the non-existant glesv3.pc.
---
 configure.ac | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 59d87eb7f..5ee63a693 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,15 +395,18 @@ CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
 
 dnl ===========================================================================
 CAIRO_ENABLE_SURFACE_BACKEND(glesv3, OpenGLESv3, no, [
-  glesv3_REQUIRES="glesv3"
+  dnl glesv3 is provided via libGLESv2.so, so require glesv2.pc (there is no libGLESv3, nor glesv3.pc)
+  glesv3_REQUIRES="glesv2"
   PKG_CHECK_MODULES(glesv3, $glesv3_REQUIRES,, [
-	 dnl Fallback to searching for headers
-	 AC_CHECK_HEADER(GLES3/gl3.h,, [use_glesv3="no (glesv3.pc nor OpenGL ES 3.0 headers not found)"])
-	 if test "x$use_glesv3" = "xyes"; then
-	     glesv3_NONPKGCONFIG_CFLAGS=
-	     dnl glesv3 is provided by the libGLESv2 library (there is no separate libGLESv3)
-	     glesv3_NONPKGCONFIG_LIBS="-lGLESv2"
-	 fi])
+    use_glesv3="no (glesv2.pc not found, required for glesv3)"
+  ])
+
+  dnl Since there is no glesv3.pc, need to search for header files
+  AC_CHECK_HEADER(GLES3/gl3.h,, [use_glesv3="no (OpenGL ES 3.0 headers not found)"])
+  if test "x$use_glesv3" = "xyes"; then
+    glesv3_NONPKGCONFIG_CFLAGS=
+    glesv3_NONPKGCONFIG_LIBS="-lGLESv2"
+  fi
 
   if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
     glesv3_LIBS="$glesv3_LIBS -ldl"
-- 
2.17.0



More information about the cairo mailing list