@@ -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
@@ -6388,6 +6390,26 @@ else
63886390 DEF_MAKE_RULE=" all"
63896391fi
63906392
6393+ # Make llvm-relatec checks work on systems where llvm tools are not installed with their
6394+ # normal names in the default $PATH (ie: Ubuntu). They exist under the
6395+ # non-suffixed name in their versioned llvm directory.
6396+
6397+ llvm_bin_dir=' '
6398+ llvm_path=" ${PATH} "
6399+ if test " ${CC} " = " clang"
6400+ then
6401+ clang_bin=` which clang`
6402+ # Some systems install clang elsewhere as a symlink to the real path
6403+ # which is where the related llvm tools are located.
6404+ if test -L " ${clang_bin} "
6405+ then
6406+ clang_dir=` dirname " ${clang_bin} " `
6407+ clang_bin=` readlink " ${clang_bin} " `
6408+ llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6409+ llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6410+ fi
6411+ fi
6412+
63916413# Enable LTO flags
63926414{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for --with-lto" >&5
63936415$as_echo_n " checking for --with-lto... " >&6 ; }
@@ -6413,65 +6435,8 @@ fi
64136435if test " $Py_LTO " = ' true' ; then
64146436 case $CC in
64156437 * clang* )
6416- case $ac_sys_system in
6417- Darwin* )
6418- # Any changes made here should be reflected in the GCC+Darwin case below
6419- LTOFLAGS=" -flto -Wl,-export_dynamic"
6420- ;;
6421- * )
6422- LTOFLAGS=" -flto"
6423- ;;
6424- esac
6425- ;;
6426- * gcc* )
6427- case $ac_sys_system in
6428- Darwin* )
6429- LTOFLAGS=" -flto -Wl,-export_dynamic"
6430- ;;
6431- * )
6432- LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6433- ;;
6434- esac
6435- ;;
6436- esac
64376438
6438- if test " $ac_cv_prog_cc_g " = " yes"
6439- then
6440- # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6441- # to get debug symbols.
6442- LTOFLAGS=" $LTOFLAGS -g"
6443- fi
6444-
6445- CFLAGS=" $CFLAGS $LTOFLAGS "
6446- LDFLAGS=" $LDFLAGS $LTOFLAGS "
6447- fi
6448-
6449- # Enable PGO flags.
6450-
6451-
6452-
6453-
6454-
6455- # Make this work on systems where llvm tools are not installed with their
6456- # normal names in the default $PATH (ie: Ubuntu). They exist under the
6457- # non-suffixed name in their versioned llvm directory.
6458- llvm_bin_dir=' '
6459- llvm_path=" ${PATH} "
6460- if test " ${CC} " = " clang"
6461- then
6462- clang_bin=` which clang`
6463- # Some systems install clang elsewhere as a symlink to the real path
6464- # which is where the related llvm tools are located.
6465- if test -L " ${clang_bin} "
6466- then
6467- clang_dir=` dirname " ${clang_bin} " `
6468- clang_bin=` readlink " ${clang_bin} " `
6469- llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6470- llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6471- fi
6472- fi
6473-
6474- { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
6439+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
64756440$as_echo_n " checking target system type... " >&6 ; }
64766441if ${ac_cv_target+: } false ; then :
64776442 $as_echo_n " (cached) " >&6
@@ -6510,6 +6475,163 @@ test -n "$target_alias" &&
65106475 test " $program_prefix$program_suffix$program_transform_name " = \
65116476 NONENONEs,x,x, &&
65126477 program_prefix=${target_alias} -
6478+ # Extract the first word of "$target_alias-llvm-ar", so it can be a program name with args.
6479+ set dummy $target_alias -llvm-ar; ac_word=$2
6480+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6481+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6482+ if ${ac_cv_path_LLVM_AR+: } false ; then :
6483+ $as_echo_n " (cached) " >&6
6484+ else
6485+ case $LLVM_AR in
6486+ [\\ /]* | ? :[\\ /]* )
6487+ ac_cv_path_LLVM_AR=" $LLVM_AR " # Let the user override the test with a path.
6488+ ;;
6489+ * )
6490+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6491+ for as_dir in ${llvm_path}
6492+ do
6493+ IFS=$as_save_IFS
6494+ test -z " $as_dir " && as_dir=.
6495+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6496+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6497+ ac_cv_path_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6498+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6499+ break 2
6500+ fi
6501+ done
6502+ done
6503+ IFS=$as_save_IFS
6504+
6505+ ;;
6506+ esac
6507+ fi
6508+ LLVM_AR=$ac_cv_path_LLVM_AR
6509+ if test -n " $LLVM_AR " ; then
6510+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $LLVM_AR " >&5
6511+ $as_echo " $LLVM_AR " >&6 ; }
6512+ else
6513+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6514+ $as_echo " no" >&6 ; }
6515+ fi
6516+
6517+
6518+ if test -z " $ac_cv_path_LLVM_AR " ; then
6519+ if test " $build " = " $target " ; then
6520+ ac_pt_LLVM_AR=$LLVM_AR
6521+ # Extract the first word of "llvm-ar", so it can be a program name with args.
6522+ set dummy llvm-ar; ac_word=$2
6523+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6524+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6525+ if ${ac_cv_path_ac_pt_LLVM_AR+: } false ; then :
6526+ $as_echo_n " (cached) " >&6
6527+ else
6528+ case $ac_pt_LLVM_AR in
6529+ [\\ /]* | ? :[\\ /]* )
6530+ ac_cv_path_ac_pt_LLVM_AR=" $ac_pt_LLVM_AR " # Let the user override the test with a path.
6531+ ;;
6532+ * )
6533+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6534+ for as_dir in ${llvm_path}
6535+ do
6536+ IFS=$as_save_IFS
6537+ test -z " $as_dir " && as_dir=.
6538+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6539+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6540+ ac_cv_path_ac_pt_LLVM_AR=" $as_dir /$ac_word$ac_exec_ext "
6541+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6542+ break 2
6543+ fi
6544+ done
6545+ done
6546+ IFS=$as_save_IFS
6547+
6548+ test -z " $ac_cv_path_ac_pt_LLVM_AR " && ac_cv_path_ac_pt_LLVM_AR=" ''"
6549+ ;;
6550+ esac
6551+ fi
6552+ ac_pt_LLVM_AR=$ac_cv_path_ac_pt_LLVM_AR
6553+ if test -n " $ac_pt_LLVM_AR " ; then
6554+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_pt_LLVM_AR " >&5
6555+ $as_echo " $ac_pt_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+ LLVM_AR=$ac_pt_LLVM_AR
6562+ else
6563+ LLVM_AR=" ''"
6564+ fi
6565+ else
6566+ LLVM_AR=" $ac_cv_path_LLVM_AR "
6567+ fi
6568+
6569+
6570+ if test -n " ${LLVM_AR} " -a -x " ${LLVM_AR} "
6571+ then
6572+ LLVM_AR_FOUND=" found"
6573+ else
6574+ LLVM_AR_FOUND=" not-found"
6575+ fi
6576+ if test " $ac_sys_system " = " Darwin" -a " ${LLVM_AR_FOUND} " = " not-found"
6577+ then
6578+ found_llvm_ar=` /usr/bin/xcrun -find llvm-ar 2> /dev/null`
6579+ if test -n " ${found_llvm_ar} "
6580+ then
6581+ LLVM_AR=' /usr/bin/xcrun llvm-ar'
6582+ LLVM_AR_FOUND=found
6583+ { $as_echo " $as_me :${as_lineno-$LINENO } : llvm-ar found via xcrun: ${LLVM_AR} " >&5
6584+ $as_echo " $as_me : llvm-ar found via xcrun: ${LLVM_AR} " >&6 ; }
6585+ fi
6586+ fi
6587+ if test $LLVM_AR_FOUND = not-found
6588+ then
6589+ LLVM_PROFR_ERR=yes
6590+ as_fn_error $? " llvm-ar is required for a --with-lto build with clang but could not be found." " $LINENO " 5
6591+ else
6592+ LLVM_AR_ERR=no
6593+ fi
6594+ AR=" ${LLVM_AR} "
6595+ case $ac_sys_system in
6596+ Darwin* )
6597+ # Any changes made here should be reflected in the GCC+Darwin case below
6598+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6599+ ;;
6600+ * )
6601+ LTOFLAGS=" -flto"
6602+ ;;
6603+ esac
6604+ ;;
6605+ * gcc* )
6606+ case $ac_sys_system in
6607+ Darwin* )
6608+ LTOFLAGS=" -flto -Wl,-export_dynamic"
6609+ ;;
6610+ * )
6611+ LTOFLAGS=" -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none"
6612+ ;;
6613+ esac
6614+ ;;
6615+ esac
6616+
6617+ if test " $ac_cv_prog_cc_g " = " yes"
6618+ then
6619+ # bpo-30345: Add -g to LDFLAGS when compiling with LTO
6620+ # to get debug symbols.
6621+ LTOFLAGS=" $LTOFLAGS -g"
6622+ fi
6623+
6624+ BASECFLAGS=" $BASECFLAGS $LTOFLAGS "
6625+ LDFLAGS=" $LDFLAGS $LTOFLAGS "
6626+ fi
6627+
6628+ # Enable PGO flags.
6629+
6630+
6631+
6632+
6633+
6634+
65136635# Extract the first word of "$target_alias-llvm-profdata", so it can be a program name with args.
65146636set dummy $target_alias -llvm-profdata; ac_word=$2
65156637{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
0 commit comments