]> granicus.if.org Git - python/commitdiff
Issue #27442: Expose the Android API level in sysconfig.get_config_vars()
authorXavier de Gaye <xdegaye@users.sourceforge.net>
Sat, 9 Jul 2016 09:05:42 +0000 (11:05 +0200)
committerXavier de Gaye <xdegaye@users.sourceforge.net>
Sat, 9 Jul 2016 09:05:42 +0000 (11:05 +0200)
as 'ANDROID_API_LEVEL'.

Misc/NEWS
configure
configure.ac
pyconfig.h.in

index 34f80fcc7d2baee0ebb76d28055059cc3608c0e6..de68f270ec564d43269d513ba4a225476027a983 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -132,6 +132,9 @@ C API
 Build
 -----
 
+- Issue #27442: Expose the Android API level that python was built against, in
+  sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'.
+
 - Issue #27434: The interpreter that runs the cross-build, found in PATH, must
   now be of the same feature version (e.g. 3.6) as the source being built.
 
index fbde7f6f5564fb730fc602fe8f46e3500c6b4774..ceb042f485df2995813f63fcc8a9258b072aa9ad 100755 (executable)
--- a/configure
+++ b/configure
@@ -5648,6 +5648,32 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 
 
 
+{ $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*)
index 9b65ec16a4eb88f351d41f21358fd25e2bf2ae56..7c83ca685c1c0d8d1e64378a4f0622b8d5489896 100644 (file)
@@ -899,6 +899,25 @@ AC_SUBST(NO_AS_NEEDED)
 # checks for UNIX variants that set C preprocessor variables
 AC_USE_SYSTEM_EXTENSIONS
 
+AC_MSG_CHECKING([for the Android API level])
+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 '^ *$'`
+  AC_MSG_RESULT([$ANDROID_API_LEVEL])
+  AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
+else
+  AC_MSG_RESULT([not Android])
+fi
+rm -f conftest.c conftest.out
+
 # Check for unsupported systems
 case $ac_sys_system/$ac_sys_release in
 atheos*|Linux*/1*)
index a104f3c74548957103ff1db3b4193d2f1fed378f..dce5cfdab370252f7ae751601f826a2dbab05fcb 100644 (file)
@@ -12,6 +12,9 @@
    support for AIX C++ shared extension modules. */
 #undef AIX_GENUINE_CPLUSPLUS
 
+/* The Android API level. */
+#undef ANDROID_API_LEVEL
+
 /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM
    mixed-endian order (byte order 45670123) */
 #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754