[Python-checkins] bpo-43109: Fix --with-lto configure option on macOS (GH-26341) (GH-26343)
ned-deily
webhook-mailer at python.org
Tue May 25 00:21:36 EDT 2021
https://github.com/python/cpython/commit/3af61a7176a68bfeb349eeed314b9c3d7ebc3ad5
commit: 3af61a7176a68bfeb349eeed314b9c3d7ebc3ad5
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ned-deily <nad at python.org>
date: 2021-05-25T00:21:28-04:00
summary:
bpo-43109: Fix --with-lto configure option on macOS (GH-26341) (GH-26343)
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 at python.org>
files:
A Misc/NEWS.d/next/macOS/2021-05-24-21-15-41.bpo-43109.npKJ9c.rst
M configure
M configure.ac
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 00000000000000..bb4d24fa95513f
--- /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 c584866581df38..ffa61c1dc51269 100755
--- a/configure
+++ b/configure
@@ -6650,10 +6650,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
{ $as_echo "$as_me:${as_lineno-$LINENO}: llvm-ar found via xcrun: ${LLVM_AR}" >&5
$as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
@@ -6671,6 +6672,7 @@ $as_echo "$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"
@@ -6681,6 +6683,7 @@ $as_echo "$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"
@@ -6696,7 +6699,7 @@ $as_echo "$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 a0750777c15135..8fe5fa5742e8be 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1388,10 +1388,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
@@ -1408,6 +1409,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"
@@ -1418,6 +1420,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"
@@ -1433,7 +1436,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
More information about the Python-checkins
mailing list