[Python-checkins] cpython (merge 3.6 -> default): Issue #26851: Merge 3.6.

xavier.degaye python-checkins at python.org
Wed Jan 4 15:54:32 EST 2017


https://hg.python.org/cpython/rev/af363b5200ff
changeset:   106000:af363b5200ff
parent:      105998:29d28f1bdc7c
parent:      105999:fa2bc63e64c6
user:        Xavier de Gaye <xdegaye at users.sourceforge.net>
date:        Wed Jan 04 21:53:53 2017 +0100
summary:
  Issue #26851: Merge 3.6.

files:
  Misc/NEWS    |   2 ++
  configure    |  20 ++++++++++++++++++--
  configure.ac |  18 ++++++++++++++++--
  3 files changed, 36 insertions(+), 4 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -608,6 +608,8 @@
 Build
 -----
 
+- Issue #26851: Set Android compilation and link flags.
+
 - Issue #28768: Fix implicit declaration of function _setmode. Patch by
   Masayuki Yamamoto
 
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -3247,6 +3247,9 @@
        # a lot of different things including 'define_xopen_source'
        # in the case statement below.
 	case "$host" in
+	*-*-linux-android*)
+		ac_sys_system=Linux-android
+		;;
 	*-*-linux*)
 		ac_sys_system=Linux
 		;;
@@ -5640,14 +5643,16 @@
 cat >> conftest.c <<EOF
 #ifdef __ANDROID__
 #include <android/api-level.h>
-__ANDROID_API__
+android_api = __ANDROID_API__
+arm_arch = __ARM_ARCH
 #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 '^ *$'`
+  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`
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ANDROID_API_LEVEL" >&5
 $as_echo "$ANDROID_API_LEVEL" >&6; }
 
@@ -5655,6 +5660,15 @@
 #define ANDROID_API_LEVEL $ANDROID_API_LEVEL
 _ACEOF
 
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the Android arm ABI" >&5
+$as_echo_n "checking for the Android arm ABI... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_arm_arch" >&5
+$as_echo "$_arm_arch" >&6; }
+  if test "$_arm_arch" = 7; then
+    BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
+    LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
+  fi
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: not Android" >&5
 $as_echo "not Android" >&6; }
@@ -9281,6 +9295,7 @@
 		 then CCSHARED="-fPIC";
 		 else CCSHARED="+z";
 		 fi;;
+	Linux-android*) ;;
 	Linux*|GNU*) CCSHARED="-fPIC";;
 	BSD/OS*/4*) CCSHARED="-fpic";;
 	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
@@ -9314,6 +9329,7 @@
 	    LINKFORSHARED="-Wl,-E -Wl,+s";;
 #	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
 	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
+	Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
 	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
 	# -u libsys_s pulls in all symbols in libsys
 	Darwin/*)
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -379,6 +379,9 @@
        # a lot of different things including 'define_xopen_source'
        # in the case statement below.
 	case "$host" in
+	*-*-linux-android*)
+		ac_sys_system=Linux-android
+		;;
 	*-*-linux*)
 		ac_sys_system=Linux
 		;;
@@ -913,16 +916,25 @@
 cat >> conftest.c <<EOF
 #ifdef __ANDROID__
 #include <android/api-level.h>
-__ANDROID_API__
+android_api = __ANDROID_API__
+arm_arch = __ARM_ARCH
 #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 '^ *$'`
+  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])
   AC_DEFINE_UNQUOTED(ANDROID_API_LEVEL, $ANDROID_API_LEVEL, [The Android API level.])
+
+  AC_MSG_CHECKING([for the Android arm ABI])
+  AC_MSG_RESULT([$_arm_arch])
+  if test "$_arm_arch" = 7; then
+    BASECFLAGS="${BASECFLAGS} -mfloat-abi=softfp -mfpu=vfpv3-d16"
+    LDFLAGS="${LDFLAGS} -march=armv7-a -Wl,--fix-cortex-a8"
+  fi
 else
   AC_MSG_RESULT([not Android])
 fi
@@ -2535,6 +2547,7 @@
 		 then CCSHARED="-fPIC";
 		 else CCSHARED="+z";
 		 fi;;
+	Linux-android*) ;;
 	Linux*|GNU*) CCSHARED="-fPIC";;
 	BSD/OS*/4*) CCSHARED="-fpic";;
 	FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
@@ -2566,6 +2579,7 @@
 	    LINKFORSHARED="-Wl,-E -Wl,+s";;
 #	    LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
 	BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
+	Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
 	Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
 	# -u libsys_s pulls in all symbols in libsys
 	Darwin/*)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list