From: Rudolf Polzer Date: Sun, 31 Jul 2011 19:25:27 +0000 (+0200) Subject: only add -mtune=native if it works X-Git-Tag: xonotic-v0.5.0~45^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f99f1701c8de7a16a3a87f5c64c6f9a1511d927;p=xonotic%2Fxonotic.git only add -mtune=native if it works --- diff --git a/all b/all index ce391b21..ad3d1507 100755 --- a/all +++ b/all @@ -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 diff --git a/misc/tools/conftest.c b/misc/tools/conftest.c new file mode 100644 index 00000000..d6cfa6b6 --- /dev/null +++ b/misc/tools/conftest.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("Hello, world!\n"); + return 0; +}