    fi
    case "$target" in
      i?86-*|x86_64-*)
-@@ -201,6 +210,30 @@ if test "x$enable_owr_java" = xyes; then
+@@ -201,6 +228,30 @@ if test "x$enable_owr_java" = xyes; then
  fi
  AC_SUBST(ANDROID_NDK_PREFIX)
  

 
 dnl generate java bindings or not
 AC_MSG_CHECKING([whether to generate java bindings or not])
@@ -111,6 +117,9 @@ AC_HELP_STRING(
 esac],[enable_owr_java=no])
 AC_MSG_RESULT([$enable_owr_java])
 if test "x$enable_owr_java" = xyes; then

Detect and subst all needed Android and iOS INCLUDES/LIBS in configure.ac, and
do Android-specific quirks
---
 configure.ac    | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 owr/Makefile.am |  3 ++-
 2 files changed, 60 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 992540e..0a5bed3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,9 +84,33 @@ dnl pick dependencies and build flags based on OS
 case "$host_os" in
   darwin*)
     is_apple=yes
-    OWR_DEVICE_LIST_EXT_LIBS="-framework AVFoundation"
+    AC_CHECK_HEADER(AVFoundation/AVFoundation.h, ,
+                    AC_MSG_ERROR(AVFoundation is needed while building for OS X or iOS),
+                    [-])
+    AC_CHECK_HEADER(MobileCoreServices/MobileCoreServices.h, is_ios="yes",
+                    is_ios="no", [-])
+    if test "x$is_ios" == "xno"; then
+      dnl OS X frameworks
+      OWR_DEVICE_LIST_EXT_LIBS="-framework AVFoundation "
+    else
+      dnl iOS frameworks
+      m4_foreach([check_header],
+                 [[AssetsLibrary/AssetsLibrary.h], [CoreMedia/CoreMedia.h],
+                  [CoreVideo/CoreVideo.h], [OpenGLES/ES2/gl.h],
+                  [CoreAudio/CoreAudio.h], [AudioToolbox/AudioToolbox.h]],
+                 AC_CHECK_HEADER($check_header, ,
+                                 AC_MSG_ERROR($check_header is needed while building for iOS),
+                                 [-]))
+      OWR_DEVICE_LIST_EXT_LIBS="-framework AssetsLibrary -framework CoreMedia \
+        -framework CoreVideo -framework AVFoundation -framework Foundation \
+        -framework OpenGLES -framework CoreAudio -framework AudioToolbox \
+        -weak_framework VideoToolbox -lc++ "
+    fi
     ;;
   linux-android*)
+    is_android=yes
