Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 95750b1

Browse files
author
Xavier de Gaye
committed
Issue #27442: Expose the Android API level in sysconfig.get_config_vars()
as 'ANDROID_API_LEVEL'.
1 parent 2247e5c commit 95750b1

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ C API
132132
Build
133133
-----
134134

135+
- Issue #27442: Expose the Android API level that python was built against, in
136+
sysconfig.get_config_vars() as 'ANDROID_API_LEVEL'.
137+
135138
- Issue #27434: The interpreter that runs the cross-build, found in PATH, must
136139
now be of the same feature version (e.g. 3.6) as the source being built.
137140

configure

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5648,6 +5648,32 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
56485648

56495649

56505650

5651+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Android API level" >&5
5652+
$as_echo_n "checking for the Android API level... " >&6; }
5653+
cat >> conftest.c <<EOF
5654+
#ifdef __ANDROID__
5655+
#include <android/api-level.h>
5656+
__ANDROID_API__
5657+
#else
5658+
#error not Android
5659+
#endif
5660+
EOF
5661+
5662+
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
5663+
ANDROID_API_LEVEL=`grep -v '^#' conftest.out | grep -v '^ *$'`
5664+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5
5665+
$as_echo "$ANDROID_API_LEVEL" >&6; }
5666+
5667+
cat >>confdefs.h <<_ACEOF
5668+
#define ANDROID_API_LEVEL $ANDROID_API_LEVEL
5669+
_ACEOF
5670+
5671+
else
5672+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5
5673+
$as_echo "not Android" >&6; }
5674+
fi
5675+
rm -f conftest.c conftest.out
5676+
56515677
# Check for unsupported systems
56525678
case $ac_sys_system/$ac_sys_release in
56535679
atheos*|Linux*/1*)

configure.ac

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,25 @@ AC_SUBST(NO_AS_NEEDED)
899899
# checks for UNIX variants that set C preprocessor variables
900900
AC_USE_SYSTEM_EXTENSIONS
901901

902+
AC_MSG_CHECKING([for the Android API level])
903+
cat >> conftest.c <<EOF
904+
#ifdef __ANDROID__
905+
#include <android/api-level.h>
906+
__ANDROID_API__
907+
#else
908+
#error not Android
909+
#endif
910+
EOF
911+
912+
if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
913+
ANDROID_API_LEVEL=`grep -v '^#' conftest.out | grep -v '^ *$'`
914+
AC_MSG_RESULT([$ANDROID_API_LEVEL])
915+
AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
916+
else
917+
AC_MSG_RESULT([not Android])
918+
fi
919+
rm -f conftest.c conftest.out
920+
902921
# Check for unsupported systems
903922
case $ac_sys_system/$ac_sys_release in
904923
atheos*|Linux*/1*)

pyconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
support for AIX C++ shared extension modules. */
1313
#undef AIX_GENUINE_CPLUSPLUS
1414

15+
/* The Android API level. */
16+
#undef ANDROID_API_LEVEL
17+
1518
/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM
1619
mixed-endian order (byte order 45670123) */
1720
#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754

0 commit comments

Comments
 (0)