[Python-checkins] bpo-29040: Support building Android with Unified Headers (GH-4492)

xdegaye webhook-mailer at python.org
Thu Nov 23 05:44:41 EST 2017


https://github.com/python/cpython/commit/c06c22e9a9fb9326e79fcf1551601eacc1fd457d
commit: c06c22e9a9fb9326e79fcf1551601eacc1fd457d
branch: master
author: xdegaye <xdegaye at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-11-23T11:44:38+01:00
summary:

bpo-29040: Support building Android with Unified Headers (GH-4492)

files:
A Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst
M Include/pyport.h
M configure
M configure.ac

diff --git a/Include/pyport.h b/Include/pyport.h
index 0e82543ac78..f2e247a374e 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -784,7 +784,9 @@ extern _invalid_parameter_handler _Py_silent_invalid_parameter_handler;
 #endif /* Py_BUILD_CORE */
 
 #ifdef __ANDROID__
-#include <android/api-level.h>
+/* The Android langinfo.h header is not used. */
+#undef HAVE_LANGINFO_H
+#undef CODESET
 #endif
 
 /* Maximum value of the Windows DWORD type */
diff --git a/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst b/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst
new file mode 100644
index 00000000000..60f05db8d4f
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2017-11-21-16-56-24.bpo-29040.14lCSr.rst
@@ -0,0 +1,2 @@
+Support building Android with Unified Headers. The first NDK release to
+support Unified Headers is android-ndk-r14.
diff --git a/configure b/configure
index ab33115d563..969e1d51c6e 100755
--- a/configure
+++ b/configure
@@ -5611,7 +5611,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
 $as_echo_n "checking for the Android API level... " >&6; }
 cat >> conftest.c <<EOF
 #ifdef __ANDROID__
-#include <android/api-level.h>
 android_api = __ANDROID_API__
 arm_arch = __ARM_ARCH
 #else
@@ -5624,6 +5623,10 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
   _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5
 $as_echo "$ANDROID_API_LEVEL" >&6; }
+  if test -z "$ANDROID_API_LEVEL"; then
+    echo 'Fatal: you must define __ANDROID_API__'
+    exit 1
+  fi
 
 cat >>confdefs.h <<_ACEOF
 #define ANDROID_API_LEVEL $ANDROID_API_LEVEL
diff --git a/configure.ac b/configure.ac
index 501f07892f8..6a69f789fe1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -885,7 +885,6 @@ 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 = __ANDROID_API__
 arm_arch = __ARM_ARCH
 #else
@@ -897,6 +896,10 @@ if $CPP $CPPFLAGS conftest.c >conftest.out 2>/dev/null; then
   ANDROID_API_LEVEL=`sed -n -e '/__ANDROID_API__/d' -e 's/^android_api = //p' conftest.out`
   _arm_arch=`sed -n -e '/__ARM_ARCH/d' -e 's/^arm_arch = //p' conftest.out`
   AC_MSG_RESULT([$ANDROID_API_LEVEL])
+  if test -z "$ANDROID_API_LEVEL"; then
+    echo 'Fatal: you must define __ANDROID_API__'
+    exit 1
+  fi
   AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
 
   AC_MSG_CHECKING([for the Android arm ABI])



More information about the Python-checkins mailing list