From fae08eb999d62039e0dbbeb65761f0e4c507c471 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Fri, 2 Oct 2020 00:03:12 +0200
Subject: [PATCH 09/22] cross compile darwin

By Isuru Fernando.
---
 Lib/platform.py | 7 ++++++-
 configure       | 6 ++++++
 configure.ac    | 6 ++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/Lib/platform.py b/Lib/platform.py
index c5b6048036..7470545466 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -459,7 +459,12 @@ def win32_ver(release='', version='', csd='', ptype=''):
 def _mac_ver_xml():
     fn = '/System/Library/CoreServices/SystemVersion.plist'
     if not os.path.exists(fn):
-        return None
+        if 'SDKROOT' in os.environ:
+            fn = os.environ['SDKROOT'] + fn
+            if not os.path.exists(fn):
+                return None
+        else:
+            return None
 
     try:
         import plistlib
diff --git a/configure b/configure
index 6dc8a66e48..552597c021 100755
--- a/configure
+++ b/configure
@@ -4267,6 +4267,9 @@ then
 	*-*-linux*)
 		ac_sys_system=Linux
 		;;
+	*-*-darwin*)
+		ac_sys_system=Darwin
+		;;
 	*-*-cygwin*)
 		ac_sys_system=Cygwin
 		;;
@@ -4332,6 +4335,9 @@ if test "$cross_compiling" = yes; then
 			_host_cpu=$host_cpu
 		esac
 		;;
+	*-*-darwin*)
+		_host_cpu=$host_cpu
+		;;
 	*-*-cygwin*)
 		_host_cpu=
 		;;
diff --git a/configure.ac b/configure.ac
index 8a32cb58f4..36b565af1b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -547,6 +547,9 @@ then
 	*-*-linux*)
 		ac_sys_system=Linux
 		;;
+	*-*-darwin*)
+		ac_sys_system=Darwin
+		;;
 	*-*-cygwin*)
 		ac_sys_system=Cygwin
 		;;
@@ -610,6 +613,9 @@ if test "$cross_compiling" = yes; then
 			_host_cpu=$host_cpu
 		esac
 		;;
+	*-*-darwin*)
+		_host_cpu=$host_cpu
+		;;
 	*-*-cygwin*)
 		_host_cpu=
 		;;
