gl: For glesv3 detection, use glesv2.pc + header check

Submitted by Bryce Harrington on June 12, 2018, 7:50 p.m.

Details

Message ID 1528833026-19333-1-git-send-email-bryce@bryceharrington.org
State New
Headers show
Series "gl: For glesv3 detection, use glesv2.pc + header check" ( rev: 1 ) in Cairo

Not browsing as part of any series.

Commit Message

Bryce Harrington June 12, 2018, 7:50 p.m.
From: Bryce Harrington <bryce@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(-)

Patch hide | download patch | download mbox

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"

Comments

On Tue, Jun 12, 2018 at 12:50:26PM -0700, Bryce Harrington wrote:
> From: Bryce Harrington <bryce@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.

I've gone ahead and landed this.

To ssh://git.cairographics.org/git/cairo
   2b6b23f..9c7d5a4  master -> master


> ---
>  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
> 
> -- 
> cairo mailing list
> cairo@cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo