]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
only add -mtune=native if it works
authorRudolf Polzer <divVerent@xonotic.org>
Sun, 31 Jul 2011 19:25:27 +0000 (21:25 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Sun, 31 Jul 2011 19:25:27 +0000 (21:25 +0200)
all
misc/tools/conftest.c [new file with mode: 0644]

diff --git a/all b/all
index ce391b21e617a0d9dfbe16ee4b28f48febd36c95..ad3d1507c22624761c1cef9d4cc353e3c9e1241e 100755 (executable)
--- 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 (file)
index 0000000..d6cfa6b
--- /dev/null
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main()
+{
+       printf("Hello, world!\n");
+       return 0;
+}