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

Skip to content

Commit c06c22e

Browse files
authored
bpo-29040: Support building Android with Unified Headers (GH-4492)
1 parent 5ad7ef8 commit c06c22e

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

Include/pyport.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,9 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
784784
#endif /* Py_BUILD_CORE */
785785

786786
#ifdef __ANDROID__
787-
#include <android/api-level.h>
787+
/* The Android langinfo.h header is not used. */
788+
#undef HAVE_LANGINFO_H
789+
#undef CODESET
788790
#endif
789791

790792
/* Maximum value of the Windows DWORD type */
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Support building Android with Unified Headers. The first NDK release to
2+
support Unified Headers is android-ndk-r14.

configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5611,7 +5611,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
56115611
$as_echo_n "checking for the Android API level... " >&6; }
56125612
cat >> conftest.c <<EOF
56135613
#ifdef __ANDROID__
5614-
#include <android/api-level.h>
56155614
android_api = __ANDROID_API__
56165615
arm_arch = __ARM_ARCH
56175616
#else
@@ -5624,6 +5623,10 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
56245623
_arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
56255624
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5
56265625
$as_echo "$ANDROID_API_LEVEL" >&6; }
5626+
if test -z "$ANDROID_API_LEVEL"; then
5627+
echo 'Fatal: you must define __ANDROID_API__'
5628+
exit 1
5629+
fi
56275630

56285631
cat >>confdefs.h <<_ACEOF
56295632
#define ANDROID_API_LEVEL $ANDROID_API_LEVEL

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,6 @@ AC_USE_SYSTEM_EXTENSIONS
885885
AC_MSG_CHECKING([for the Android API level])
886886
cat >> conftest.c <<EOF
887887
#ifdef __ANDROID__
888-
#include <android/api-level.h>
889888
android_api = __ANDROID_API__
890889
arm_arch = __ARM_ARCH
891890
#else
@@ -897,6 +896,10 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
897896
ANDROID_API_LEVEL=`sed -n -e '/__ANDROID_API__/d' -e 's/^android_api = //p' conftest.out`
898897
_arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
899898
AC_MSG_RESULT([$ANDROID_API_LEVEL])
899+
if test -z "$ANDROID_API_LEVEL"; then
900+
echo 'Fatal: you must define __ANDROID_API__'
901+
exit 1
902+
fi
900903
AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
901904

902905
AC_MSG_CHECKING([for the Android arm ABI])

0 commit comments

Comments
 (0)