mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
2f3a87856c
commit
59acfd4a09
|
@ -0,0 +1,2 @@
|
||||||
|
Allow --with-lto configure option to work with Apple-supplied Xcode or
|
||||||
|
Command Line Tools.
|
|
@ -6711,10 +6711,11 @@ fi
|
||||||
fi
|
fi
|
||||||
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
|
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
|
||||||
then
|
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}"
|
if test -n "${found_llvm_ar}"
|
||||||
then
|
then
|
||||||
LLVM_AR='/usr/bin/xcrun llvm-ar'
|
LLVM_AR='/usr/bin/xcrun ar'
|
||||||
LLVM_AR_FOUND=found
|
LLVM_AR_FOUND=found
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: llvm-ar found via xcrun: ${LLVM_AR}" >&5
|
{ $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;}
|
$as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
|
||||||
|
@ -6732,6 +6733,7 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
|
||||||
Darwin*)
|
Darwin*)
|
||||||
# Any changes made here should be reflected in the GCC+Darwin case below
|
# Any changes made here should be reflected in the GCC+Darwin case below
|
||||||
LTOFLAGS="-flto -Wl,-export_dynamic"
|
LTOFLAGS="-flto -Wl,-export_dynamic"
|
||||||
|
LTOCFLAGS="-flto"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LTOFLAGS="-flto"
|
LTOFLAGS="-flto"
|
||||||
|
@ -6742,6 +6744,7 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*)
|
Darwin*)
|
||||||
LTOFLAGS="-flto -Wl,-export_dynamic"
|
LTOFLAGS="-flto -Wl,-export_dynamic"
|
||||||
|
LTOCFLAGS="-flto"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
|
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
|
||||||
|
@ -6757,7 +6760,7 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
|
||||||
LTOFLAGS="$LTOFLAGS -g"
|
LTOFLAGS="$LTOFLAGS -g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
|
CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -1385,10 +1385,11 @@ if test "$Py_LTO" = 'true' ; then
|
||||||
fi
|
fi
|
||||||
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
|
if test "$ac_sys_system" = "Darwin" -a "${LLVM_AR_FOUND}" = "not-found"
|
||||||
then
|
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}"
|
if test -n "${found_llvm_ar}"
|
||||||
then
|
then
|
||||||
LLVM_AR='/usr/bin/xcrun llvm-ar'
|
LLVM_AR='/usr/bin/xcrun ar'
|
||||||
LLVM_AR_FOUND=found
|
LLVM_AR_FOUND=found
|
||||||
AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
|
AC_MSG_NOTICE([llvm-ar found via xcrun: ${LLVM_AR}])
|
||||||
fi
|
fi
|
||||||
|
@ -1405,6 +1406,7 @@ if test "$Py_LTO" = 'true' ; then
|
||||||
Darwin*)
|
Darwin*)
|
||||||
# Any changes made here should be reflected in the GCC+Darwin case below
|
# Any changes made here should be reflected in the GCC+Darwin case below
|
||||||
LTOFLAGS="-flto -Wl,-export_dynamic"
|
LTOFLAGS="-flto -Wl,-export_dynamic"
|
||||||
|
LTOCFLAGS="-flto"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LTOFLAGS="-flto"
|
LTOFLAGS="-flto"
|
||||||
|
@ -1415,6 +1417,7 @@ if test "$Py_LTO" = 'true' ; then
|
||||||
case $ac_sys_system in
|
case $ac_sys_system in
|
||||||
Darwin*)
|
Darwin*)
|
||||||
LTOFLAGS="-flto -Wl,-export_dynamic"
|
LTOFLAGS="-flto -Wl,-export_dynamic"
|
||||||
|
LTOCFLAGS="-flto"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
|
LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
|
||||||
|
@ -1430,7 +1433,7 @@ if test "$Py_LTO" = 'true' ; then
|
||||||
LTOFLAGS="$LTOFLAGS -g"
|
LTOFLAGS="$LTOFLAGS -g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
|
CFLAGS_NODIST="$CFLAGS_NODIST ${LTOCFLAGS-$LTOFLAGS}"
|
||||||
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
|
LDFLAGS_NODIST="$LDFLAGS_NODIST $LTOFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue