| #!/bin/sh |
#!/bin/sh |
| |
|
| [ -z "$BASH_VERSION" ] && (which bash > /dev/null 2>&1) && exec bash $0; |
[ -z "$BASH_VERSION" ] && (which bash > /dev/null 2>&1) && exec bash $0 $*; |
| |
|
| # ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
| |
|
| |
|
| # ----------------------------------------------------------------------------- |
# ----------------------------------------------------------------------------- |
| |
|
| config="$root/config"; |
reports="$root/reports-$HOSTNAME"; |
| |
|
| mkdir -p "$config"; |
mkdir -p "$reports"; |
| cd "$config"; |
cd "$reports"; |
| |
|
| pid=$$; |
pid=$$; |
| |
|
| echo "comp='msvc'; cc='$msvc';"; |
echo "comp='msvc'; cc='$msvc';"; |
| done |
done |
| |
|
| |
# Unix compilers |
| |
case $(uname) in |
| |
HP-UX|OSF*|SunOS) |
| |
if [ -x $(which cc 2> /dev/null) ]; then |
| |
echo "comp='cc'; cc='cc';"; |
| |
fi |
| |
;; |
| |
esac |
| |
|
| status 1; |
status 1; |
| } |
} |
| |
|
| fi | while read gcc; do |
fi | while read gcc; do |
| IFS=' '; |
IFS=' '; |
| |
|
| specs=$($gcc -v 2>&1 | awk '/^Reading specs/ { print $4; exit; }'); |
specs=$($gcc -v 2>&1 | md5sum); |
| |
length=$(printf "%0.3d" ${#gcc}); |
| |
|
| if $gcc -dumpmachine | grep -q "mingw32"; then |
if $gcc -dumpmachine | grep -q "mingw32"; then |
| echo "specs='$specs'; comp='mingw'; cc='$gcc';"; |
echo "specs='$specs'; length='$length'; comp='mingw'; cc='$gcc';"; |
| else |
else |
| echo "specs='$specs'; comp='gcc'; cc='$gcc';"; |
echo "specs='$specs'; length='$length'; comp='gcc'; cc='$gcc';"; |
| fi |
fi |
| done |
done |
| } |
} |
| icc=$1; |
icc=$1; |
| |
|
| version=$($icc -v 2>&1 | awk '/^Version/ { print $2; exit; }'); |
version=$($icc -v 2>&1 | awk '/^Version/ { print $2; exit; }'); |
| |
length=$(printf "%0.3d" ${#icc}); |
| |
|
| $icc -E - < /dev/null &> /dev/null && \ |
$icc -E - < /dev/null &> /dev/null && \ |
| echo "specs='$version'; comp='icc'; cc='$icc';"; |
echo "specs='$version'; length='$length'; comp='icc'; cc='$icc';"; |
| } |
} |
| |
|
| check_icc_archs () |
check_icc_archs () |
| msvc=$1; |
msvc=$1; |
| |
|
| version=$($msvc 2>&1 | awk '/Version/ { print $6 ":" $8; exit; }'); |
version=$($msvc 2>&1 | awk '/Version/ { print $6 ":" $8; exit; }'); |
| |
length=$(printf "%0.3d" ${#msvc}); |
| |
|
| [ "${version%:*}" = "Compiler" ] && \ |
[ "${version%:*}" = "Compiler" ] && \ |
| echo "specs='$version'; comp='msvc'; cc='$msvc';"; |
echo "specs='$version'; length='$length'; comp='msvc'; cc='$msvc';"; |
| } |
} |
| |
|
| check_msvc_archs () |
check_msvc_archs () |
| done |
done |
| } |
} |
| |
|
| |
check_msvc () |
| |
{ |
| |
msvc=$1; |
| |
|
| |
version=$($msvc 2>&1 | awk '/Version/ { print $6 ":" $8; exit; }'); |
| |
length=$(printf "%0.3d" ${#msvc}); |
| |
|
| |
[ "${version%:*}" = "Compiler" ] && \ |
| |
echo "specs='$version'; length='$length'; comp='msvc'; cc='$msvc';"; |
| |
} |
| |
|
| |
check_cc () |
| |
{ |
| |
cc=$1; |
| |
|
| |
$cc -E - < /dev/null &> /dev/null && \ |
| |
echo "specs='unix cc'; length='$length'; comp='cc'; cc='$cc';"; |
| |
} |
| |
|
| |
check_cc_archs () |
| |
{ |
| |
cc=$1; |
| |
|
| |
case $(uname) in |
| |
HP-UX) |
| |
for arch in "" "+DD"{32,64}; do |
| |
$cc $arch conftest.c -o conftest &> /dev/null \ |
| |
&& ./conftest &> /dev/null \ |
| |
&& echo "'$arch'"; |
| |
done |
| |
;; |
| |
OSF*) |
| |
for arch in "" "-arch "{ev{4,5,56,6,67},pca56}; do |
| |
(IFS=' '; $cc $arch conftest.c -o conftest) &> /dev/null \ |
| |
&& ./conftest &> /dev/null \ |
| |
&& echo "'$arch'"; |
| |
done |
| |
;; |
| |
SunOS) |
| |
for arch in "" "-xarch="v{7,8{,plus}{,a},9{,a}}; do |
| |
$cc $arch conftest.c -o conftest &> /dev/null \ |
| |
&& ./conftest &> /dev/null \ |
| |
&& echo "'$arch'"; |
| |
done |
| |
;; |
| |
esac |
| |
} |
| |
|
| |
check_cc_opts () |
| |
{ |
| |
for opt in "" "-fast"; do |
| |
echo "'$opt'"; |
| |
done |
| |
} |
| |
|
| check_compilers () |
check_compilers () |
| { |
{ |
| status 1 "checking compilers and discarding duplicates"; |
status 1 "checking compilers and discarding duplicates"; |
| status 1 "checking compiler options"; |
status 1 "checking compiler options"; |
| |
|
| cat > conftest.c <<EOF |
cat > conftest.c <<EOF |
| |
#include <stdio.h> |
| #include "../include/ecrypt-portable.h" |
#include "../include/ecrypt-portable.h" |
| |
|
| int main() |
int main() |
| |
|
| [ -n "$arch" ] || arch=default; |
[ -n "$arch" ] || arch=default; |
| |
|
| |
arch=${arch//arch /}; |
| arch=${arch// /}; |
arch=${arch// /}; |
| arch=${arch#-}; |
arch=${arch#-}; |
| |
arch=${arch#+}; |
| arch=${arch#m*=}; |
arch=${arch#m*=}; |
| |
arch=${arch#xarch=}; |
| |
|
| echo "$arch"; |
echo "$arch"; |
| } |
} |
| done |
done |
| |
|
| status 1; |
status 1; |
| |
|
| |
cp "$root/configs/shortlist" .; |
| } |
} |
| |
|
| config_compilers () |
config_compilers () |
| IFS=; |
IFS=; |
| echo "$candidates" > candidates; |
echo "$candidates" > candidates; |
| |
|
| info 0 "Please edit $config/candidates and start again."; |
info 0 "Please edit $reports/candidates and start again."; |
| exit 1; |
exit 1; |
| fi |
fi |
| fi |
fi |