summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-25 04:18:53 (GMT)
committerGitHub <noreply@github.com>2021-05-25 04:18:53 (GMT)
commit25a9cf197ea0d77abd49992a7751efa0046bb1e6 (patch)
treee6739e8620296518bc37b329b30ba5fb88a01360
parent86779878dfc0bcb74b4721aba7fd9a84e9cbd5c7 (diff)
downloadcpython-25a9cf197ea0d77abd49992a7751efa0046bb1e6.zip
cpython-25a9cf197ea0d77abd49992a7751efa0046bb1e6.tar.gz
cpython-25a9cf197ea0d77abd49992a7751efa0046bb1e6.tar.bz2
bpo-43109: Fix --with-lto configure option on macOS (GH-26341)
Allow --with-lto configure option to work with Apple-supplied Xcode or Command Line Tools which do not provide llvm-ar. (cherry picked from commit 59acfd4a09df1c141dac7845eed008af8970fce7) Co-authored-by: Ned Deily <nad@python.org>
-rw-r--r--Misc/NEWS.d/next/macOS/2021-05-24-21-15-41.bpo-43109.npKJ9c.rst2
-rwxr-xr-xconfigure9
-rw-r--r--configure.ac9
3 files changed, 14 insertions, 6 deletions
diff --git a/Misc/NEWS.d/next/macOS/2021-05-24-21-15-41.bpo-43109.npKJ9c.rst b/Misc/NEWS.d/next/macOS/2021-05-24-21-15-41.bpo-43109.npKJ9c.rst
new file mode 100644
index 0000000..bb4d24f
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2021-05-24-21-15-41.bpo-43109.npKJ9c.rst
@@ -0,0 +1,2 @@
+Allow --with-lto configure option to work with Apple-supplied Xcode or
+Command Line Tools.
diff --git a/configure b/configure
index 5559e6f..6c4da49 100755
--- a/configure
+++ b/configure
@@ -7322,10 +7322,11 @@ fi
fi
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
then
- found_llvm_ar=`/usr/bin/xcrun -find llvm-ar 2>/dev/null`
+ # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
+ found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
if test -n "${found_llvm_ar}"
then
- LLVM_AR='/usr/bin/xcrun llvm-ar'
+ LLVM_AR='/usr/bin/xcrun ar'
LLVM_AR_FOUND=found
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: llvm-ar found via xcrun: ${LLVM_AR}" >&5
printf "%s\n" "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
@@ -7343,6 +7344,7 @@ printf "%s\n" "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
Darwin*)
# Any changes made here should be reflected in the GCC+Darwin case below
LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOCFLAGS="-flto"
;;
*)
LTOFLAGS="-flto"
@@ -7353,6 +7355,7 @@ printf "%s\n" "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
case $ac_sys_system in
Darwin*)
LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOCFLAGS="-flto"
;;
*)
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
@@ -7368,7 +7371,7 @@ printf "%s\n" "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
LTOFLAGS="$LTOFLAGS -g"
fi
- CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
+ CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
fi
diff --git a/configure.ac b/configure.ac
index 366ab2c..3e6c07c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1385,10 +1385,11 @@ if test "$Py_LTO" = 'true' ; then
fi
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
then
- found_llvm_ar=`/usr/bin/xcrun -find llvm-ar 2>/dev/null`
+ # The Apple-supplied ar in Xcode or the Command Line Tools is apparently sufficient
+ found_llvm_ar=`/usr/bin/xcrun -find ar 2>/dev/null`
if test -n "${found_llvm_ar}"
then
- LLVM_AR='/usr/bin/xcrun llvm-ar'
+ LLVM_AR='/usr/bin/xcrun ar'
LLVM_AR_FOUND=found
AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
fi
@@ -1405,6 +1406,7 @@ if test "$Py_LTO" = 'true' ; then
Darwin*)
# Any changes made here should be reflected in the GCC+Darwin case below
LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOCFLAGS="-flto"
;;
*)
LTOFLAGS="-flto"
@@ -1415,6 +1417,7 @@ if test "$Py_LTO" = 'true' ; then
case $ac_sys_system in
Darwin*)
LTOFLAGS="-flto -Wl,-export_dynamic"
+ LTOCFLAGS="-flto"
;;
*)
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
@@ -1430,7 +1433,7 @@ if test "$Py_LTO" = 'true' ; then
LTOFLAGS="$LTOFLAGS -g"
fi
- CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
+ CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
fi