-rwxr-xr-x 755 librandombytes-20230126/scripts-build/compilealternatives raw
#!/bin/sh
dir="$1"; shift
base="$1"; shift
alternatives="$1"; shift
try=1
(
echo 'int main()'
echo '{'
echo ' return 0;'
echo '}'
) > "$dir/alternatives-$base.c"
scripts/cdcompile "$dir" -c "alternatives-$base.c"
while [ "$try" -le "$alternatives" ]
do
basetry=${base}_$try
echo "trying $basetry ..."
echo ' ' scripts/cdcompile "$dir" -I ../include -D "$basetry" -c "$base.c" \
&& scripts/cdcompile "$dir" -I ../include -D "$basetry" -c "$base.c" \
&& echo ' ' scripts/cdcompile "$dir" -o "alternatives-$base" "alternatives-$base.o" "$base.o" "$@" \
&& scripts/cdcompile "$dir" -o "alternatives-$base" "alternatives-$base.o" "$base.o" "$@" \
&& echo 'success' \
&& break
rm -f "$dir/$base.o"
try=`expr "$try" + 1`
done