From 1cfbe664f5c0685d34be8b8bfdc1e45adb2932d2 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <slouken@libsdl.org>
Date: Mon, 12 Mar 2018 18:41:06 -0700
Subject: [PATCH] Added Mac OpenGL ES configure support

---
 configure    | 19 +++++++++++++++++++
 configure.in | 14 ++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/configure b/configure
index 5c99be1a2..e932dce76 100755
--- a/configure
+++ b/configure
@@ -22018,6 +22018,24 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL 1" >>confdefs.h
     fi
 }
 
+CheckMacGLES()
+{
+    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
+        video_opengl_egl=yes
+
+$as_echo "#define SDL_VIDEO_OPENGL_EGL 1" >>confdefs.h
+
+        video_opengles_v2=yes
+
+$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h
+
+
+$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
+
+        SUMMARY_video="${SUMMARY_video} opengl_es2"
+    fi
+}
+
 CheckEmscriptenGLES()
 {
     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
@@ -24461,6 +24479,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
         CheckMETAL
         CheckX11
         CheckMacGL
+        CheckMacGLES
         CheckOpenGLX11
         CheckVulkan
         CheckPTHREAD
diff --git a/configure.in b/configure.in
index 1c7e79338..9d815dbc3 100644
--- a/configure.in
+++ b/configure.in
@@ -2462,6 +2462,19 @@ CheckMacGL()
     fi
 }
 
+dnl Check for MacOS OpenGLES
+CheckMacGLES()
+{
+    if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
+        video_opengl_egl=yes
+        AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
+        video_opengles_v2=yes
+        AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
+        AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
+        SUMMARY_video="${SUMMARY_video} opengl_es2"
+    fi
+}
+
 CheckEmscriptenGLES()
 {
     if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
@@ -3773,6 +3786,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
         CheckMETAL
         CheckX11
         CheckMacGL
+        CheckMacGLES
         CheckOpenGLX11
         CheckVulkan
         CheckPTHREAD