[3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855) (GH-23295)
* [3.9] bpo-41100: Support macOS 11 and Apple Silicon (GH-22855)
Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com>
* Add support for macOS 11 and Apple Silicon (aka arm64)
As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy
* Support building on recent versions of macOS while deploying to older versions
This allows building installers on macOS 11 while still supporting macOS 10.9..
(cherry picked from commit 41761933c1c30bb6003b65eef1ba23a83db4eae4)
Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
* Back port of changes to _decimal to support arm64
* temp_dir is in test.support in 3.9
diff --git a/configure b/configure
index 040c828..2d379fe 100755
--- a/configure
+++ b/configure
@@ -1510,8 +1510,8 @@
specify the kind of universal binary that should be
created. this option is only valid when
--enable-universalsdk is set; options are:
- ("32-bit", "64-bit", "3-way", "intel", "intel-32",
- "intel-64", or "all") see Mac/README.rst
+ ("universal2", "32-bit", "64-bit", "3-way", "intel",
+ "intel-32", "intel-64", or "all") see Mac/README.rst
--with-framework-name=FRAMEWORK
specify the name for the python framework on macOS
only valid when --enable-framework is set. see
@@ -6954,7 +6954,7 @@
-# The -arch flags for universal builds on OSX
+# The -arch flags for universal builds on macOS
UNIVERSAL_ARCH_FLAGS=
@@ -7481,6 +7481,11 @@
LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386"
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
+ universal2)
+ UNIVERSAL_ARCH_FLAGS="-arch arm64 -arch x86_64"
+ LIPO_32BIT_FLAGS=""
+ ARCH_RUN_32BIT="true"
+ ;;
intel)
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
LIPO_32BIT_FLAGS="-extract i386"
@@ -7502,7 +7507,7 @@
ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
;;
*)
- as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5
+ as_fn_error $? "proper usage is --with-universal-arch=universal2|32-bit|64-bit|all|intel|3-way" "$LINENO" 5
;;
esac
@@ -9359,7 +9364,7 @@
MACOSX_DEFAULT_ARCH="ppc"
;;
*)
- as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
+ as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
;;
esac
else
@@ -9369,9 +9374,12 @@
;;
ppc)
MACOSX_DEFAULT_ARCH="ppc64"
+ ;;
+ arm64)
+ MACOSX_DEFAULT_ARCH="arm64"
;;
*)
- as_fn_error $? "Unexpected output of 'arch' on OSX" "$LINENO" 5
+ as_fn_error $? "Unexpected output of 'arch' on macOS" "$LINENO" 5
;;
esac
@@ -12014,6 +12022,31 @@
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _dyld_shared_cache_contains_path" >&5
+$as_echo_n "checking for _dyld_shared_cache_contains_path... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <mach-o/dyld.h>
+int
+main ()
+{
+void *x=_dyld_shared_cache_contains_path
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for memfd_create" >&5
$as_echo_n "checking for memfd_create... " >&6; }