From a3ee3b99e6889fd68da75c6ea7a14d101f71da56 Mon Sep 17 00:00:00 2001
From: Moritz Angermann <moritz.angermann@gmail.com>
Date: Sun, 26 Nov 2023 08:41:31 +0800
Subject: [PATCH] Drop hard Xcode dependency

XCODE_VERSION calls out to `xcodebuild`, which is only available
when having `Xcode` installed. The CommandLineTools are not
sufficient. To install Xcode, you must have an apple id to download
the Xcode.xip from apple.

We do not use xcodebuild anywhere in our build explicilty. At best
it appears to be a proxy for checking the linker or the compiler.
These should rather be done with
```
xcrun ld -version
```
or similar, and not by proxy through Xcode. The CLR should be
sufficient for building software on macOS.
---
 configure.ac            |  3 ---
 distrib/configure.ac.in |  2 --
 m4/xcode_version.m4     | 25 -------------------------
 3 files changed, 30 deletions(-)
 delete mode 100644 m4/xcode_version.m4

diff --git a/configure.ac b/configure.ac
index 36a754d75eea..495ddd0202ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -342,9 +342,6 @@ then
   GMP_FORCE_INTREE="YES"
 fi
 
-XCODE_VERSION()
-
-
 dnl ** Building a cross compiler?
 dnl --------------------------------------------------------------
 CrossCompiling=NO
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index ee096ce08568..d3868aa591f1 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -94,8 +94,6 @@ then
     AC_MSG_ERROR([find is required.])
 fi
 
-XCODE_VERSION()
-
 AC_ARG_ENABLE(distro-toolchain,
 [AS_HELP_STRING([--enable-distro-toolchain],
                 [Do not use bundled Windows toolchain binaries.])],
diff --git a/m4/xcode_version.m4 b/m4/xcode_version.m4
deleted file mode 100644
index af2916eb1df1..000000000000
--- a/m4/xcode_version.m4
+++ /dev/null
@@ -1,25 +0,0 @@
-# XCODE_VERSION()
-# --------------------------------
-# Gets the version number of Xcode, if on a Mac
-AC_DEFUN([XCODE_VERSION],[
-    if test "$TargetVendor_CPP" = "apple"
-    then
-        AC_MSG_CHECKING(Xcode version)
-        XcodeVersion=`(xcode-select -p > /dev/null 2>&1 && xcodebuild -version) | grep Xcode | sed "s/Xcode //"`
-        # Old Xcode versions don't actually give the Xcode version
-        if test "$XcodeVersion" = ""
-        then
-            AC_MSG_RESULT(not found (too old?))
-            XcodeVersion1=0
-            XcodeVersion2=0
-        else
-            AC_MSG_RESULT($XcodeVersion)
-            XcodeVersion1=`echo "$XcodeVersion" | sed 's/\..*//'`
-            changequote(, )dnl
-            XcodeVersion2=`echo "$XcodeVersion" | sed 's/[^.]*\.\([^.]*\).*/\1/'`
-            changequote([, ])dnl
-            AC_MSG_NOTICE(Xcode version component 1: $XcodeVersion1)
-            AC_MSG_NOTICE(Xcode version component 2: $XcodeVersion2)
-        fi
-    fi
-])
-- 
GitLab