@@ -671,16 +671,18 @@ BASECFLAGS
671671CFLAGS_ALIASING
672672OPT
673673LLVM_PROF_FOUND
674- target_os
675- target_vendor
676- target_cpu
677- target
678674LLVM_PROFDATA
679675LLVM_PROF_ERR
680676LLVM_PROF_FILE
681677LLVM_PROF_MERGER
682678PGO_PROF_USE_FLAG
683679PGO_PROF_GEN_FLAG
680+ LLVM_AR_FOUND
681+ target_os
682+ target_vendor
683+ target_cpu
684+ target
685+ LLVM_AR
684686DEF_MAKE_RULE
685687DEF_MAKE_ALL_RULE
686688ABIFLAGS
@@ -6493,6 +6495,26 @@ else
64936495 DEF_MAKE_RULE=" all"
64946496fi
64956497
6498+ # Make llvm-relatec checks work on systems where llvm tools are not installed with their
6499+ # normal names in the default $PATH (ie: Ubuntu). They exist under the
6500+ # non-suffixed name in their versioned llvm directory.
6501+
6502+ llvm_bin_dir=' '
6503+ llvm_path=" ${PATH} "
6504+ if test " ${CC} " = " clang"
6505+ then
6506+ clang_bin=` which clang`
6507+ # Some systems install clang elsewhere as a symlink to the real path
6508+ # which is where the related llvm tools are located.
6509+ if test -L " ${clang_bin} "
6510+ then
6511+ clang_dir=` dirname " ${clang_bin} " `
6512+ clang_bin=` readlink " ${clang_bin} " `
6513+ llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6514+ llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6515+ fi
6516+ fi
6517+
64966518# Enable LTO flags
64976519{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for --with-lto" >&5
64986520$as_echo_n " checking for --with-lto... " >&6 ; }
@@ -6518,65 +6540,8 @@ fi
65186540if test " $Py_LTO " = ' true' ; then
65196541 case $CC in
65206542 * clang* )
6521- case $ac_sys_system in
6522- Darwin* )
6523- # Any changes made here should be reflected in the GCC+Darwin case below
6524- LTOFLAGS=" -flto -Wl,-export_dynamic"
6525- ;;
6526- * )
6527- LTOFLAGS=" -flto"
6528- ;;
6529- esac
6530- ;;
6531- * gcc* )
6532- case $ac_sys_system in
6533- Darwin* )
6534- LTOFLAGS=" -flto -Wl,-export_dynamic"
6535- ;;
6536- * )
6537- LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6538- ;;
6539- esac
6540- ;;
6541- esac
65426543
6543- if test " $ac_cv_prog_cc_g " = " yes"
6544- then
6545- # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6546- # to get debug symbols.
6547- LTOFLAGS=" $LTOFLAGS -g"
6548- fi
6549-
6550- CFLAGS=" $CFLAGS $LTOFLAGS "
6551- LDFLAGS=" $LDFLAGS $LTOFLAGS "
6552- fi
6553-
6554- # Enable PGO flags.
6555-
6556-
6557-
6558-
6559-
6560- # Make this work on systems where llvm tools are not installed with their
6561- # normal names in the default $PATH (ie: Ubuntu). They exist under the
6562- # non-suffixed name in their versioned llvm directory.
6563- llvm_bin_dir=' '
6564- llvm_path=" ${PATH} "
6565- if test " ${CC} " = " clang"
6566- then
6567- clang_bin=` which clang`
6568- # Some systems install clang elsewhere as a symlink to the real path
6569- # which is where the related llvm tools are located.
6570- if test -L " ${clang_bin} "
6571- then
6572- clang_dir=` dirname " ${clang_bin} " `
6573- clang_bin=` readlink " ${clang_bin} " `
6574- llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6575- llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6576- fi
6577- fi
6578-
6579- { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
6544+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
65806545$as_echo_n " checking target system type... " >&6 ; }
65816546if ${ac_cv_target+: } false ; then :
65826547 $as_echo_n " (cached) " >&6
@@ -6615,6 +6580,163 @@ test -n "$target_alias" &&
66156580 test " $program_prefix$program_suffix$program_transform_name " = \
66166581 NONENONEs,x,x, &&
66176582 program_prefix=${target_alias} -
6583+ # Extract the first word of "$target_alias-llvm-ar", so it can be a program name with args.
6584+ set dummy $target_alias -llvm-ar; ac_word=$2
6585+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6586+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6587+ if ${ac_cv_path_LLVM_AR+: } false ; then :
6588+ $as_echo_n " (cached) " >&6
6589+ else
6590+ case $LLVM_AR in
6591+ [\\ /]* | ? :[\\ /]* )
6592+ ac_cv_path_LLVM_AR=" $LLVM_AR " # Let the user override the test with a path.
6593+ ;;
6594+ * )
6595+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6596+ for as_dir in ${llvm_path}
6597+ do
6598+ IFS=$as_save_IFS
6599+ test -z " $as_dir " && as_dir=.
6600+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6601+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6602+ ac_cv_path_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6603+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6604+ break 2
6605+ fi
6606+ done
6607+ done
6608+ IFS=$as_save_IFS
6609+
6610+ ;;
6611+ esac
6612+ fi
6613+ LLVM_AR=$ac_cv_path_LLVM_AR
6614+ if test -n " $LLVM_AR " ; then
6615+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $LLVM_AR " >&5
6616+ $as_echo " $LLVM_AR " >&6 ; }
6617+ else
6618+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6619+ $as_echo " no" >&6 ; }
6620+ fi
6621+
6622+
6623+ if test -z " $ac_cv_path_LLVM_AR " ; then
6624+ if test " $build " = " $target " ; then
6625+ ac_pt_LLVM_AR=$LLVM_AR
6626+ # Extract the first word of "llvm-ar", so it can be a program name with args.
6627+ set dummy llvm-ar; ac_word=$2
6628+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6629+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6630+ if ${ac_cv_path_ac_pt_LLVM_AR+: } false ; then :
6631+ $as_echo_n " (cached) " >&6
6632+ else
6633+ case $ac_pt_LLVM_AR in
6634+ [\\ /]* | ? :[\\ /]* )
6635+ ac_cv_path_ac_pt_LLVM_AR=" $ac_pt_LLVM_AR " # Let the user override the test with a path.
6636+ ;;
6637+ * )
6638+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6639+ for as_dir in ${llvm_path}
6640+ do
6641+ IFS=$as_save_IFS
6642+ test -z " $as_dir " && as_dir=.
6643+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6644+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6645+ ac_cv_path_ac_pt_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6646+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6647+ break 2
6648+ fi
6649+ done
6650+ done
6651+ IFS=$as_save_IFS
6652+
6653+ test -z " $ac_cv_path_ac_pt_LLVM_AR " && ac_cv_path_ac_pt_LLVM_AR=" ''"
6654+ ;;
6655+ esac
6656+ fi
6657+ ac_pt_LLVM_AR=$ac_cv_path_ac_pt_LLVM_AR
6658+ if test -n " $ac_pt_LLVM_AR " ; then
6659+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_pt_LLVM_AR " >&5
6660+ $as_echo " $ac_pt_LLVM_AR " >&6 ; }
6661+ else
6662+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6663+ $as_echo " no" >&6 ; }
6664+ fi
6665+
6666+ LLVM_AR=$ac_pt_LLVM_AR
6667+ else
6668+ LLVM_AR=" ''"
6669+ fi
6670+ else
6671+ LLVM_AR=" $ac_cv_path_LLVM_AR "
6672+ fi
6673+
6674+
6675+ if test -n " ${LLVM_AR} " -a -x " ${LLVM_AR} "
6676+ then
6677+ LLVM_AR_FOUND=" found"
6678+ else
6679+ LLVM_AR_FOUND=" not-found"
6680+ fi
6681+ if test " $ac_sys_system " = " Darwin" -a " ${LLVM_AR_FOUND} " = " not-found"
6682+ then
6683+ found_llvm_ar=` /usr/bin/xcrun -find llvm-ar 2> /dev/null`
6684+ if test -n " ${found_llvm_ar} "
6685+ then
6686+ LLVM_AR=' /usr/bin/xcrun llvm-ar'
6687+ LLVM_AR_FOUND=found
6688+ { $as_echo " $as_me :${as_lineno-$LINENO } : llvm-ar found via xcrun: ${LLVM_AR} " >&5
6689+ $as_echo " $as_me : llvm-ar found via xcrun: ${LLVM_AR} " >&6 ; }
6690+ fi
6691+ fi
6692+ if test $LLVM_AR_FOUND = not-found
6693+ then
6694+ LLVM_PROFR_ERR=yes
6695+ as_fn_error $? " llvm-ar is required for a --with-lto build with clang but could not be found." " $LINENO " 5
6696+ else
6697+ LLVM_AR_ERR=no
6698+ fi
6699+ AR=" ${LLVM_AR} "
6700+ case $ac_sys_system in
6701+ Darwin* )
6702+ # Any changes made here should be reflected in the GCC+Darwin case below
6703+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6704+ ;;
6705+ * )
6706+ LTOFLAGS=" -flto"
6707+ ;;
6708+ esac
6709+ ;;
6710+ * gcc* )
6711+ case $ac_sys_system in
6712+ Darwin* )
6713+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6714+ ;;
6715+ * )
6716+ LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6717+ ;;
6718+ esac
6719+ ;;
6720+ esac
6721+
6722+ if test " $ac_cv_prog_cc_g " = " yes"
6723+ then
6724+ # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6725+ # to get debug symbols.
6726+ LTOFLAGS=" $LTOFLAGS -g"
6727+ fi
6728+
6729+ BASECFLAGS=" $BASECFLAGS $LTOFLAGS "
6730+ LDFLAGS=" $LDFLAGS $LTOFLAGS "
6731+ fi
6732+
6733+ # Enable PGO flags.
6734+
6735+
6736+
6737+
6738+
6739+
66186740# Extract the first word of "$target_alias-llvm-profdata", so it can be a program name with args.
66196741set dummy $target_alias -llvm-profdata; ac_word=$2
66206742{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
0 commit comments