[Mesa-dev] [PATCH 1/2] configure.ac: Add support for Android builds

Nicolas Boichat drinkcat at chromium.org
Thu Apr 28 10:41:38 UTC 2016


Add support for EGL android platform.

Also, detect when --host finishes with -android. In that case, we
do not set _GNU_SOURCE, and define autoconf symbol HAVE_ANDROID, so
that Android-specific workarounds can be applied.

Signed-off-by: Nicolas Boichat <drinkcat at google.com>
---
 configure.ac        | 10 ++++++++++
 src/egl/Makefile.am |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5f75c60..6ee978c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -248,7 +248,11 @@ _SAVE_CPPFLAGS="$CPPFLAGS"
 dnl Compiler macros
 DEFINES="-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
 AC_SUBST([DEFINES])
+android=no
 case "$host_os" in
+*-android)
+    android=yes
+    ;;
 linux*|*-gnu*|gnu*)
     DEFINES="$DEFINES -D_GNU_SOURCE"
     ;;
@@ -260,6 +264,8 @@ cygwin*)
     ;;
 esac
 
+AM_CONDITIONAL(HAVE_ANDROID, test "x$android" = xyes)
+
 dnl Add flags for gcc and g++
 if test "x$GCC" = xyes; then
     CFLAGS="$CFLAGS -Wall"
@@ -1959,6 +1965,9 @@ for plat in $egl_platforms; do
 			AC_MSG_ERROR([EGL platform surfaceless requires libdrm >= $LIBDRM_REQUIRED])
 		;;
 
+	android)
+		;;
+
 	*)
 		AC_MSG_ERROR([EGL platform '$plat' does not exist])
 		;;
@@ -1983,6 +1992,7 @@ AM_CONDITIONAL(HAVE_EGL_PLATFORM_X11, echo "$egl_platforms" | grep -q 'x11')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo "$egl_platforms" | grep -q 'wayland')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep -q 'drm')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_SURFACELESS, echo "$egl_platforms" | grep -q 'surfaceless')
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_ANDROID, echo "$egl_platforms" | grep -q 'android')
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep -q 'null')
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 6953d44..e9033b0 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -84,6 +84,11 @@ AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM
 dri2_backend_FILES += drivers/dri2/platform_surfaceless.c
 endif
 
+if HAVE_EGL_PLATFORM_ANDROID
+AM_CFLAGS += -DHAVE_ANDROID_PLATFORM
+dri2_backend_FILES += drivers/dri2/platform_android.c
+endif
+
 if HAVE_EGL_DRIVER_DRI2
 AM_CFLAGS += \
 	-I$(top_srcdir)/src/loader \
-- 
2.8.0.rc3.226.g39d4020



More information about the mesa-dev mailing list