Issue #27442: Expose the Android API level in sysconfig.get_config_vars()
as 'ANDROID_API_LEVEL'.
diff --git a/configure b/configure
index fbde7f6..ceb042f 100755
--- a/configure
+++ b/configure
@@ -5648,6 +5648,32 @@
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Android API level" >&5
+$as_echo_n "checking for the Android API level... " >&6; }
+cat >> conftest.c <<EOF
+#ifdef __ANDROID__
+#include <android/api-level.h>
+__ANDROID_API__
+#else
+#error not Android
+#endif
+EOF
+
+if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
+  ANDROID_API_LEVEL=`grep -v '^#' conftest.out | grep -v '^ *$'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5
+$as_echo "$ANDROID_API_LEVEL" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define ANDROID_API_LEVEL $ANDROID_API_LEVEL
+_ACEOF
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5
+$as_echo "not Android" >&6; }
+fi
+rm -f conftest.c conftest.out
+
 # Check for unsupported systems
 case $ac_sys_system/$ac_sys_release in
 atheos*|Linux*/1*)