@@ -668,6 +668,11 @@ CFLAGS_NODIST
668668BASECFLAGS
669669OPT
670670LLVM_PROF_FOUND
671+ target_os
672+ target_vendor
673+ target_cpu
674+ target
675+ LLVM_PROFDATA
671676LLVM_PROF_ERR
672677LLVM_PROF_FILE
673678LLVM_PROF_MERGER
@@ -776,6 +781,7 @@ infodir
776781docdir
777782oldincludedir
778783includedir
784+ runstatedir
779785localstatedir
780786sharedstatedir
781787sysconfdir
@@ -887,6 +893,7 @@ datadir='${datarootdir}'
887893sysconfdir=' ${prefix}/etc'
888894sharedstatedir=' ${prefix}/com'
889895localstatedir=' ${prefix}/var'
896+ runstatedir=' ${localstatedir}/run'
890897includedir=' ${prefix}/include'
891898oldincludedir=' /usr/include'
892899docdir=' ${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1139,6 +1146,15 @@ do
11391146 | -silent | --silent | --silen | --sile | --sil)
11401147 silent=yes ;;
11411148
1149+ -runstatedir | --runstatedir | --runstatedi | --runstated \
1150+ | --runstate | --runstat | --runsta | --runst | --runs \
1151+ | --run | --ru | --r)
1152+ ac_prev=runstatedir ;;
1153+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1154+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1155+ | --run=* | --ru=* | --r=* )
1156+ runstatedir=$ac_optarg ;;
1157+
11421158 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
11431159 ac_prev=sbindir ;;
11441160 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
12761292for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
12771293 datadir sysconfdir sharedstatedir localstatedir includedir \
12781294 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1279- libdir localedir mandir
1295+ libdir localedir mandir runstatedir
12801296do
12811297 eval ac_val=\$ $ac_var
12821298 # Remove trailing slashes.
@@ -1429,6 +1445,7 @@ Fine tuning of the installation directories:
14291445 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
14301446 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
14311447 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1448+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
14321449 --libdir=DIR object code libraries [EPREFIX/lib]
14331450 --includedir=DIR C header files [PREFIX/include]
14341451 --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -1449,6 +1466,7 @@ _ACEOF
14491466System types:
14501467 --build=BUILD configure for building on BUILD [guessed]
14511468 --host=HOST cross-compile to build programs to run on HOST [BUILD]
1469+ --target=TARGET configure for building compilers for TARGET [HOST]
14521470_ACEOF
14531471fi
14541472
@@ -6555,9 +6573,11 @@ if test "$Py_OPT" = 'true' ; then
65556573 ;;
65566574 esac
65576575 DEF_MAKE_ALL_RULE=" profile-opt"
6576+ REQUIRE_PGO=" yes"
65586577 DEF_MAKE_RULE=" build_all"
65596578else
65606579 DEF_MAKE_ALL_RULE=" build_all"
6580+ REQUIRE_PGO=" no"
65616581 DEF_MAKE_RULE=" all"
65626582fi
65636583
@@ -6609,68 +6629,206 @@ fi
66096629
66106630
66116631
6632+ # Make this work on systems where llvm tools are not installed with their
6633+ # normal names in the default $PATH (ie: Ubuntu). They exist under the
6634+ # non-suffixed name in their versioned llvm directory.
6635+ llvm_bin_dir=' '
6636+ llvm_path=" ${PATH} "
6637+ if test " ${CC} " = " clang"
6638+ then
6639+ clang_bin=` which clang`
6640+ # Some systems install clang elsewhere as a symlink to the real path
6641+ # which is where the related llvm tools are located.
6642+ if test -L " ${clang_bin} "
6643+ then
6644+ clang_dir=` dirname " ${clang_bin} " `
6645+ clang_bin=` readlink " ${clang_bin} " `
6646+ llvm_bin_dir=" ${clang_dir} /" ` dirname " ${clang_bin} " `
6647+ llvm_path=" ${llvm_path}${PATH_SEPARATOR}${llvm_bin_dir} "
6648+ fi
6649+ fi
66126650
6613- # Extract the first word of "llvm-profdata", so it can be a program name with args.
6614- set dummy llvm-profdata; ac_word=$2
6651+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking target system type" >&5
6652+ $as_echo_n " checking target system type... " >&6 ; }
6653+ if ${ac_cv_target+: } false ; then :
6654+ $as_echo_n " (cached) " >&6
6655+ else
6656+ if test " x$target_alias " = x; then
6657+ ac_cv_target=$ac_cv_host
6658+ else
6659+ ac_cv_target=` $SHELL " $ac_aux_dir /config.sub" $target_alias ` ||
6660+ as_fn_error $? " $SHELL $ac_aux_dir /config.sub $target_alias failed" " $LINENO " 5
6661+ fi
6662+
6663+ fi
6664+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_cv_target " >&5
6665+ $as_echo " $ac_cv_target " >&6 ; }
6666+ case $ac_cv_target in
6667+ * -* -* ) ;;
6668+ * ) as_fn_error $? " invalid value of canonical target" " $LINENO " 5;;
6669+ esac
6670+ target=$ac_cv_target
6671+ ac_save_IFS=$IFS ; IFS=' -'
6672+ set x $ac_cv_target
6673+ shift
6674+ target_cpu=$1
6675+ target_vendor=$2
6676+ shift ; shift
6677+ # Remember, the first character of IFS is used to create $*,
6678+ # except with old shells:
6679+ target_os=$*
6680+ IFS=$ac_save_IFS
6681+ case $target_os in * \ * ) target_os=` echo " $target_os " | sed ' s/ /-/g' ` ;; esac
6682+
6683+
6684+ # The aliases save the names the user supplied, while $host etc.
6685+ # will get canonicalized.
6686+ test -n " $target_alias " &&
6687+ test " $program_prefix$program_suffix$program_transform_name " = \
6688+ NONENONEs,x,x, &&
6689+ program_prefix=${target_alias} -
6690+ # Extract the first word of "$target_alias-llvm-profdata", so it can be a program name with args.
6691+ set dummy $target_alias -llvm-profdata; ac_word=$2
66156692{ $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
66166693$as_echo_n " checking for $ac_word ... " >&6 ; }
6617- if ${ac_cv_prog_LLVM_PROF_FOUND +: } false ; then :
6694+ if ${ac_cv_path_LLVM_PROFDATA +: } false ; then :
66186695 $as_echo_n " (cached) " >&6
66196696else
6620- if test -n " $LLVM_PROF_FOUND " ; then
6621- ac_cv_prog_LLVM_PROF_FOUND=" $LLVM_PROF_FOUND " # Let the user override the test.
6622- else
6623- as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6624- for as_dir in $PATH
6697+ case $LLVM_PROFDATA in
6698+ [\\ /]* | ? :[\\ /]* )
6699+ ac_cv_path_LLVM_PROFDATA=" $LLVM_PROFDATA " # Let the user override the test with a path.
6700+ ;;
6701+ * )
6702+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6703+ for as_dir in ${llvm_path}
66256704do
66266705 IFS=$as_save_IFS
66276706 test -z " $as_dir " && as_dir=.
66286707 for ac_exec_ext in ' ' $ac_executable_extensions ; do
66296708 if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6630- ac_cv_prog_LLVM_PROF_FOUND= " found "
6709+ ac_cv_path_LLVM_PROFDATA= " $as_dir / $ac_word$ac_exec_ext "
66316710 $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
66326711 break 2
66336712 fi
66346713done
66356714 done
66366715IFS=$as_save_IFS
66376716
6638- test -z " $ac_cv_prog_LLVM_PROF_FOUND " && ac_cv_prog_LLVM_PROF_FOUND=" not-found"
6717+ ;;
6718+ esac
66396719fi
6720+ LLVM_PROFDATA=$ac_cv_path_LLVM_PROFDATA
6721+ if test -n " $LLVM_PROFDATA " ; then
6722+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $LLVM_PROFDATA " >&5
6723+ $as_echo " $LLVM_PROFDATA " >&6 ; }
6724+ else
6725+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
6726+ $as_echo " no" >&6 ; }
66406727fi
6641- LLVM_PROF_FOUND=$ac_cv_prog_LLVM_PROF_FOUND
6642- if test -n " $LLVM_PROF_FOUND " ; then
6643- { $as_echo " $as_me :${as_lineno-$LINENO } : result: $LLVM_PROF_FOUND " >&5
6644- $as_echo " $LLVM_PROF_FOUND " >&6 ; }
6728+
6729+
6730+ if test -z " $ac_cv_path_LLVM_PROFDATA " ; then
6731+ if test " $build " = " $target " ; then
6732+ ac_pt_LLVM_PROFDATA=$LLVM_PROFDATA
6733+ # Extract the first word of "llvm-profdata", so it can be a program name with args.
6734+ set dummy llvm-profdata; ac_word=$2
6735+ { $as_echo " $as_me :${as_lineno-$LINENO } : checking for $ac_word " >&5
6736+ $as_echo_n " checking for $ac_word ... " >&6 ; }
6737+ if ${ac_cv_path_ac_pt_LLVM_PROFDATA+: } false ; then :
6738+ $as_echo_n " (cached) " >&6
6739+ else
6740+ case $ac_pt_LLVM_PROFDATA in
6741+ [\\ /]* | ? :[\\ /]* )
6742+ ac_cv_path_ac_pt_LLVM_PROFDATA=" $ac_pt_LLVM_PROFDATA " # Let the user override the test with a path.
6743+ ;;
6744+ * )
6745+ as_save_IFS=$IFS ; IFS=$PATH_SEPARATOR
6746+ for as_dir in ${llvm_path}
6747+ do
6748+ IFS=$as_save_IFS
6749+ test -z " $as_dir " && as_dir=.
6750+ for ac_exec_ext in ' ' $ac_executable_extensions ; do
6751+ if as_fn_executable_p " $as_dir /$ac_word$ac_exec_ext " ; then
6752+ ac_cv_path_ac_pt_LLVM_PROFDATA=" $as_dir /$ac_word$ac_exec_ext "
6753+ $as_echo " $as_me :${as_lineno-$LINENO } : found $as_dir /$ac_word$ac_exec_ext " >&5
6754+ break 2
6755+ fi
6756+ done
6757+ done
6758+ IFS=$as_save_IFS
6759+
6760+ test -z " $ac_cv_path_ac_pt_LLVM_PROFDATA " && ac_cv_path_ac_pt_LLVM_PROFDATA=" ''"
6761+ ;;
6762+ esac
6763+ fi
6764+ ac_pt_LLVM_PROFDATA=$ac_cv_path_ac_pt_LLVM_PROFDATA
6765+ if test -n " $ac_pt_LLVM_PROFDATA " ; then
6766+ { $as_echo " $as_me :${as_lineno-$LINENO } : result: $ac_pt_LLVM_PROFDATA " >&5
6767+ $as_echo " $ac_pt_LLVM_PROFDATA " >&6 ; }
66456768else
66466769 { $as_echo " $as_me :${as_lineno-$LINENO } : result: no" >&5
66476770$as_echo " no" >&6 ; }
66486771fi
66496772
6773+ LLVM_PROFDATA=$ac_pt_LLVM_PROFDATA
6774+ else
6775+ LLVM_PROFDATA=" ''"
6776+ fi
6777+ else
6778+ LLVM_PROFDATA=" $ac_cv_path_LLVM_PROFDATA "
6779+ fi
66506780
6781+
6782+ if test -n " ${LLVM_PROFDATA} " -a -x " ${LLVM_PROFDATA} "
6783+ then
6784+ LLVM_PROF_FOUND=" found"
6785+ else
6786+ LLVM_PROF_FOUND=" not-found"
6787+ fi
6788+ if test " $ac_sys_system " = " Darwin" -a " ${LLVM_PROF_FOUND} " = " not-found"
6789+ then
6790+ found_llvm_profdata=` /usr/bin/xcrun -find llvm-profdata 2> /dev/null`
6791+ if test -n " ${found_llvm_profdata} "
6792+ then
6793+ # llvm-profdata isn't directly in $PATH in some cases.
6794+ # https://apple.stackexchange.com/questions/197053/
6795+ LLVM_PROFDATA=' /usr/bin/xcrun llvm-profdata'
6796+ LLVM_PROF_FOUND=found
6797+ { $as_echo " $as_me :${as_lineno-$LINENO } : llvm-profdata found via xcrun: ${LLVM_PROFDATA} " >&5
6798+ $as_echo " $as_me : llvm-profdata found via xcrun: ${LLVM_PROFDATA} " >&6 ; }
6799+ fi
6800+ fi
66516801LLVM_PROF_ERR=no
66526802case $CC in
66536803 * clang* )
66546804 # Any changes made here should be reflected in the GCC+Darwin case below
66556805 PGO_PROF_GEN_FLAG=" -fprofile-instr-generate"
66566806 PGO_PROF_USE_FLAG=" -fprofile-instr-use=code.profclangd"
6657- LLVM_PROF_MERGER=" llvm-profdata merge -output=code.profclangd *.profclangr"
6807+ LLVM_PROF_MERGER=" ${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
66586808 LLVM_PROF_FILE=" LLVM_PROFILE_FILE=\" code-%p.profclangr\" "
66596809 if test $LLVM_PROF_FOUND = not-found
66606810 then
66616811 LLVM_PROF_ERR=yes
6812+ if test " ${REQUIRE_PGO} " = " yes"
6813+ then
6814+ as_fn_error $? " llvm-profdata is required for a --with-optimizations build but could not be found." " $LINENO " 5
6815+ fi
66626816 fi
66636817 ;;
66646818 * gcc* )
66656819 case $ac_sys_system in
66666820 Darwin* )
66676821 PGO_PROF_GEN_FLAG=" -fprofile-instr-generate"
66686822 PGO_PROF_USE_FLAG=" -fprofile-instr-use=code.profclangd"
6669- LLVM_PROF_MERGER=" llvm-profdata merge -output=code.profclangd *.profclangr"
6823+ LLVM_PROF_MERGER=" ${LLVM_PROFDATA} merge -output=code.profclangd *.profclangr"
66706824 LLVM_PROF_FILE=" LLVM_PROFILE_FILE=\" code-%p.profclangr\" "
6671- if test $ LLVM_PROF_FOUND = not-found
6825+ if test " ${ LLVM_PROF_FOUND} " = " not-found"
66726826 then
66736827 LLVM_PROF_ERR=yes
6828+ if test " ${REQUIRE_PGO} " = " yes"
6829+ then
6830+ as_fn_error $? " llvm-profdata is required for a --with-optimizations build but could not be found." " $LINENO " 5
6831+ fi
66746832 fi
66756833 ;;
66766834 * )
0 commit comments