| { |
{ |
| local IFS=:$NEWLINE; |
local IFS=:$NEWLINE; |
| |
|
| find $PATH -maxdepth 1 \( -type f -o -type l \) -perm +a=x 2> /dev/null \ |
find $PATH \( -type f -o -type l \) -perm -a=x 2> /dev/null \ |
| | grep -E "$1" | sort | while read name; do |
| egrep "$1" | sort | while read name; do |
| base="$(basename "$name")"; |
base="$(basename "$name")"; |
| |
|
| if [ "$(which "$base")" = "$name" ]; then |
if [ "$(which "$base")" = "$name" ]; then |
| echo "$base"; |
echo "$base"; |
| else |
|
| # no spaces, sorry |
|
| expr index "$name" " " &> /dev/null || echo "$name"; |
|
| fi |
fi |
| done |
done |
| } |
} |
| fi | while read gcc; do |
fi | while read gcc; do |
| IFS=' '; |
IFS=' '; |
| |
|
| specs=$($gcc -v 2>&1 | (md5sum || md5) 2> /dev/null); |
specs=$($gcc -v 2>&1 \ |
| |
| (md5sum || md5 || openssl md5 || cksum) 2> /dev/null); |
| length=$(printf "%0.3d" ${#gcc}); |
length=$(printf "%0.3d" ${#gcc}); |
| |
|
| if $gcc -dumpmachine | grep -q "mingw32"; then |
if $gcc -dumpmachine | grep "mingw32" 2> /dev/null; then |
| echo "specs='$specs'; length='$length'; comp='mingw'; cc='$gcc';"; |
echo "specs='$specs'; length='$length'; comp='mingw'; cc='$gcc';"; |
| else |
else |
| echo "specs='$specs'; length='$length'; comp='gcc'; cc='$gcc';"; |
echo "specs='$specs'; length='$length'; comp='gcc'; cc='$gcc';"; |
| { |
{ |
| icc=$1; |
icc=$1; |
| |
|
| for arch in \ |
for arch in "" "-x"{K,W,N,P,B}; do |
| "" \ |
|
| "-x"{K,W,N,P,B} \ |
|
| ; do |
|
| |
|
| $icc $arch -Werror conftest.c -o conftest &> /dev/null \ |
$icc $arch -Werror conftest.c -o conftest &> /dev/null \ |
| && ./conftest &> /dev/null \ |
&& ./conftest &> /dev/null \ |
| && echo "'$arch'"; |
&& echo "'$arch'"; |
| { |
{ |
| msvc=$1; |
msvc=$1; |
| |
|
| for arch in \ |
for arch in "" "-Gr" "-G"{6,7}{,r}; do |
| "" "-Gr" "-G"{6,7}{,r} \ |
if ! $msvc $arch 2>&1 | grep "unknown option" > /dev/null; then |
| ; do |
$msvc $arch conftest.c -o conftest.exe &> /dev/null \ |
| |
&& runwin ./conftest.exe &> /dev/null \ |
| if ! $msvc $arch conftest.c -o conftest.exe 2>&1; then |
|
| continue; |
|
| fi | grep -q "warning"; |
|
| |
|
| [ $? = 1 ] && runwin ./conftest.exe &> /dev/null \ |
|
| && echo "'$arch'"; |
&& echo "'$arch'"; |
| |
fi |
| done |
done |
| } |
} |
| |
|
| done |
done |
| ;; |
;; |
| SunOS) |
SunOS) |
| for arch in "" "-xarch="v{7,8{,plus}{,a},9{,a}}; do |
for arch in "" "-xarch="v{7,8{,plus}{,a},9{,a,b}}; do |
| |
if ! $cc $arch 2>&1 | grep "illegal option" > /dev/null; then |
| $cc $arch conftest.c -o conftest &> /dev/null \ |
$cc $arch conftest.c -o conftest &> /dev/null \ |
| && ./conftest &> /dev/null \ |
&& ./conftest &> /dev/null \ |
| && echo "'$arch'"; |
&& echo "'$arch'"; |
| |
fi |
| done |
done |
| ;; |
;; |
| esac |
esac |
| info 1 "The following compilers are supported:"; |
info 1 "The following compilers are supported:"; |
| |
|
| i=0; |
i=0; |
| for line in $compilers; do ((i++)); eval "$line"; |
for line in $compilers; do i=$(expr $i + 1); eval "$line"; |
| info 1 " $i. $cc"; |
info 1 " $i. $cc"; |
| done |
done |
| |
|
| info 1 "likely to produce fast code on particular platforms:"; |
info 1 "likely to produce fast code on particular platforms:"; |
| |
|
| i=0; |
i=0; |
| for shortlist in $shortlists; do ((i++)); |
for shortlist in $shortlists; do i=$(expr $i + 1); |
| count=$(wc -l "$root/configs/$shortlist"); |
count=$(wc -l "$root/configs/$shortlist"); |
| info 1 " $i. $shortlist (${count%% *} options)"; |
info 1 " $i. $shortlist (${count%% *} options)"; |
| done |
done |
| |
|
| i=0; |
i=0; |
| shortlist=; |
shortlist=; |
| for line in $shortlists; do ((i++)); |
for line in $shortlists; do i=$(expr $i + 1); |
| [ "$answer" = "$i" ] && shortlist=$line && break; |
[ "$answer" = "$i" ] && shortlist=$line && break; |
| done |
done |
| |
|
| cat /proc/cpuinfo &> cpuinfo; |
cat /proc/cpuinfo &> cpuinfo; |
| cpu_speed=$(awk '/^cpu MHz/ { print $4; exit; }' cpuinfo); |
cpu_speed=$(awk '/^cpu MHz/ { print $4; exit; }' cpuinfo); |
| |
|
| cpufreq="/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; |
max_freq="/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq"; |
| |
cur_freq="/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"; |
| |
|
| if [ -r "$cpufreq" ]; then |
if [ -r "$max_freq" -a -r "$cur_freq" ]; then |
| i=0; |
i=0; |
| while [ $i -lt 10000 ]; do ((i++)); |
while [ $i -lt 1000 ]; do i=$(expr $i + 1); |
| |
if diff "$max_freq" "$cur_freq" > /dev/null; then |
| |
cpu_speed=$(awk '{ print $1 / 1000; exit; }' $cur_freq); |
| cat /proc/cpuinfo &> cpuinfo; |
cat /proc/cpuinfo &> cpuinfo; |
| cpu_speed=$(awk '/^cpu MHz/ { print $4; exit; }' cpuinfo); |
break; |
| |
fi |
| [ $(($(cat "$cpufreq") / 1000 - ${cpu_speed%.*})) -gt 10 ] \ |
|
| || break; |
|
| done |
done |
| fi |
fi |
| |
|
| # Solaris, Tru64 |
# Solaris, Tru64 |
| |
|
| psrinfo -v &> cpuinfo; |
psrinfo -v &> cpuinfo; |
| cpu_speed=$(awk \ |
cpu_speed=$(sed -n 's/.* \([^ ]*\) MHz.*/\1/p' <cpuinfo | head -1); |
| '/ates at/ {print gensub(/.* ([0-9/.]+) MHz.*/,"\\1",1); exit;}' \ |
|
| cpuinfo); |
|
| |
|
| elif [ -x "$(which cscript.exe 2> /dev/null)" ]; then |
elif [ -x "$(which cscript.exe 2> /dev/null)" ]; then |
| |
|