@@ -672,16 +672,18 @@ BASECFLAGS
672672CFLAGS_ALIASING
673673OPT
674674LLVM_PROF_FOUND
675- target_os
676- target_vendor
677- target_cpu
678- target
679675LLVM_PROFDATA
680676LLVM_PROF_ERR
681677LLVM_PROF_FILE
682678LLVM_PROF_MERGER
683679PGO_PROF_USE_FLAG
684680PGO_PROF_GEN_FLAG
681+ LLVM_AR_FOUND
682+ target_os
683+ target_vendor
684+ target_cpu
685+ target
686+ LLVM_AR
685687DEF_MAKE_RULE
686688DEF_MAKE_ALL_RULE
687689ABIFLAGS
@@ -6432,6 +6434,26 @@ else
64326434 DEF_MAKE_RULE=" all"
64336435fi
64346436
6437+ # Make llvm-relatec checks work on systems where llvm tools are not installed with their
6438+ # normal names in the default $PATH (ie: Ubuntu). They exist under the
6439+ # non-suffixed name in their versioned llvm directory.
6440+
6441+ llvm_bin_dir=' '
6442+ llvm_path=" ${PATH} "
6443+ if test " ${CC} " = " clang"
6444+ then
6445+ clang_bin=` which clang`
6446+ # Some systems install clang elsewhere as a symlink to the real path
6447+ # which is where the related llvm tools are located.
6448+ if test -L " ${clang_bin} "
6449+ then
6450+ clang_dir=` dirname " ${clang_bin} " `
6451+ clang_bin=` readlink " ${clang_bin} " `
6452+ llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6453+ llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6454+ fi
6455+ fi
6456+
64356457# Enable LTO flags
64366458{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for --with-lto" >&5
64376459$as_echo_n " checking for --with-lto... " >&6 ; }
@@ -6457,65 +6479,8 @@ fi
64576479if test " $Py_LTO " = ' true' ; then
64586480 case $CC in
64596481 * clang* )
6460- case $ac_sys_system in
6461- Darwin* )
6462- # Any changes made here should be reflected in the GCC+Darwin case below
6463- LTOFLAGS=" -flto -Wl,-export_dynamic"
6464- ;;
6465- * )
6466- LTOFLAGS=" -flto"
6467- ;;
6468- esac
6469- ;;
6470- * gcc* )
6471- case $ac_sys_system in
6472- Darwin* )
6473- LTOFLAGS=" -flto -Wl,-export_dynamic"
6474- ;;
6475- * )
6476- LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6477- ;;
6478- esac
6479- ;;
6480- esac
64816482
6482- if test " $ac_cv_prog_cc_g " = " yes"
6483- then
6484- # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6485- # to get debug symbols.
6486- LTOFLAGS=" $LTOFLAGS -g"
6487- fi
6488-
6489- CFLAGS=" $CFLAGS $LTOFLAGS "
6490- LDFLAGS=" $LDFLAGS $LTOFLAGS "
6491- fi
6492-
6493- # Enable PGO flags.
6494-
6495-
6496-
6497-
6498-
6499- # Make this work on systems where llvm tools are not installed with their
6500- # normal names in the default $PATH (ie: Ubuntu). They exist under the
6501- # non-suffixed name in their versioned llvm directory.
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-
6518- { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
6483+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
65196484$as_echo_n " checking target system type... " >&6 ; }
65206485if ${ac_cv_target+: } false ; then :
65216486 $as_echo_n " (cached) " >&6
@@ -6554,6 +6519,163 @@ test -n "$target_alias" &&
65546519 test " $program_prefix$program_suffix$program_transform_name " = \
65556520 NONENONEs,x,x, &&
65566521 program_prefix=${target_alias} -
6522+ # Extract the first word of "$target_alias-llvm-ar", so it can be a program name with args.
6523+ set dummy $target_alias -llvm-ar; ac_word=$2
6524+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6525+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6526+ if ${ac_cv_path_LLVM_AR+: } false ; then :
6527+ $as_echo_n " (cached) " >&6
6528+ else
6529+ case $LLVM_AR in
6530+ [\\ /]* | ? :[\\ /]* )
6531+ ac_cv_path_LLVM_AR=" $LLVM_AR " # Let the user override the test with a path.
6532+ ;;
6533+ * )
6534+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6535+ for as_dir in ${llvm_path}
6536+ do
6537+ IFS=$as_save_IFS
6538+ test -z " $as_dir " && as_dir=.
6539+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6540+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6541+ ac_cv_path_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6542+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6543+ break 2
6544+ fi
6545+ done
6546+ done
6547+ IFS=$as_save_IFS
6548+
6549+ ;;
6550+ esac
6551+ fi
6552+ LLVM_AR=$ac_cv_path_LLVM_AR
6553+ if test -n " $LLVM_AR " ; then
6554+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $LLVM_AR " >&5
6555+ $as_echo " $LLVM_AR " >&6 ; }
6556+ else
6557+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6558+ $as_echo " no" >&6 ; }
6559+ fi
6560+
6561+
6562+ if test -z " $ac_cv_path_LLVM_AR " ; then
6563+ if test " $build " = " $target " ; then
6564+ ac_pt_LLVM_AR=$LLVM_AR
6565+ # Extract the first word of "llvm-ar", so it can be a program name with args.
6566+ set dummy llvm-ar; ac_word=$2
6567+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6568+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6569+ if ${ac_cv_path_ac_pt_LLVM_AR+: } false ; then :
6570+ $as_echo_n " (cached) " >&6
6571+ else
6572+ case $ac_pt_LLVM_AR in
6573+ [\\ /]* | ? :[\\ /]* )
6574+ ac_cv_path_ac_pt_LLVM_AR=" $ac_pt_LLVM_AR " # Let the user override the test with a path.
6575+ ;;
6576+ * )
6577+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6578+ for as_dir in ${llvm_path}
6579+ do
6580+ IFS=$as_save_IFS
6581+ test -z " $as_dir " && as_dir=.
6582+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6583+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6584+ ac_cv_path_ac_pt_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6585+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6586+ break 2
6587+ fi
6588+ done
6589+ done
6590+ IFS=$as_save_IFS
6591+
6592+ test -z " $ac_cv_path_ac_pt_LLVM_AR " && ac_cv_path_ac_pt_LLVM_AR=" ''"
6593+ ;;
6594+ esac
6595+ fi
6596+ ac_pt_LLVM_AR=$ac_cv_path_ac_pt_LLVM_AR
6597+ if test -n " $ac_pt_LLVM_AR " ; then
6598+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_pt_LLVM_AR " >&5
6599+ $as_echo " $ac_pt_LLVM_AR " >&6 ; }
6600+ else
6601+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6602+ $as_echo " no" >&6 ; }
6603+ fi
6604+
6605+ LLVM_AR=$ac_pt_LLVM_AR
6606+ else
6607+ LLVM_AR=" ''"
6608+ fi
6609+ else
6610+ LLVM_AR=" $ac_cv_path_LLVM_AR "
6611+ fi
6612+
6613+
6614+ if test -n " ${LLVM_AR} " -a -x " ${LLVM_AR} "
6615+ then
6616+ LLVM_AR_FOUND=" found"
6617+ else
6618+ LLVM_AR_FOUND=" not-found"
6619+ fi
6620+ if test " $ac_sys_system " = " Darwin" -a " ${LLVM_AR_FOUND} " = " not-found"
6621+ then
6622+ found_llvm_ar=` /usr/bin/xcrun -find llvm-ar 2> /dev/null`
6623+ if test -n " ${found_llvm_ar} "
6624+ then
6625+ LLVM_AR=' /usr/bin/xcrun llvm-ar'
6626+ LLVM_AR_FOUND=found
6627+ { $as_echo " $as_me :${as_lineno-$LINENO } : llvm-ar found via xcrun: ${LLVM_AR} " >&5
6628+ $as_echo " $as_me : llvm-ar found via xcrun: ${LLVM_AR} " >&6 ; }
6629+ fi
6630+ fi
6631+ if test $LLVM_AR_FOUND = not-found
6632+ then
6633+ LLVM_PROFR_ERR=yes
6634+ as_fn_error $? " llvm-ar is required for a --with-lto build with clang but could not be found." " $LINENO " 5
6635+ else
6636+ LLVM_AR_ERR=no
6637+ fi
6638+ AR=" ${LLVM_AR} "
6639+ case $ac_sys_system in
6640+ Darwin* )
6641+ # Any changes made here should be reflected in the GCC+Darwin case below
6642+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6643+ ;;
6644+ * )
6645+ LTOFLAGS=" -flto"
6646+ ;;
6647+ esac
6648+ ;;
6649+ * gcc* )
6650+ case $ac_sys_system in
6651+ Darwin* )
6652+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6653+ ;;
6654+ * )
6655+ LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6656+ ;;
6657+ esac
6658+ ;;
6659+ esac
6660+
6661+ if test " $ac_cv_prog_cc_g " = " yes"
6662+ then
6663+ # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6664+ # to get debug symbols.
6665+ LTOFLAGS=" $LTOFLAGS -g"
6666+ fi
6667+
6668+ BASECFLAGS=" $BASECFLAGS $LTOFLAGS "
6669+ LDFLAGS=" $LDFLAGS $LTOFLAGS "
6670+ fi
6671+
6672+ # Enable PGO flags.
6673+
6674+
6675+
6676+
6677+
6678+
65576679# Extract the first word of "$target_alias-llvm-profdata", so it can be a program name with args.
65586680set dummy $target_alias -llvm-profdata; ac_word=$2
65596681{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
0 commit comments