only add -mtune=native if it works

This commit is contained in:
Rudolf Polzer 2011-07-31 21:25:27 +02:00
parent f5d0d12e73
commit 4f99f1701c
2 changed files with 21 additions and 1 deletions

15
all
View File

@ -951,7 +951,9 @@ case "$cmd" in
[5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
# gcc 4.3 or higher
# -march=native is broken < 4.3
export CC="$CC -mtune=native -march=native"
if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
export CC="$CC -mtune=native -march=native"
fi
;;
esac
if [ -n "$WE_HATE_OUR_USERS" ]; then
@ -1031,6 +1033,17 @@ case "$cmd" in
fi
fi
if ! verbose $CC misc/tools/conftest.c -o conftest; then
msg ""
msg "COMPILER"
msg ""
msg "Y U NO COMPILE CODE?"
msg ""
exit 1
fi
rm -f conftest
verbose cd "$d0/d0_blind_id"
if ! $compiled0; then
# compilation of crypto library failed

7
misc/tools/conftest.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}