From 8a3edba7aa5d5d96531bac23172e924e8619c71d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Tue, 7 Jan 2014 21:19:15 +0000
Subject: Haiku: defines cpu options only for x86


diff --git a/Source/cmake/OptionsHaiku.cmake b/Source/cmake/OptionsHaiku.cmake
index fe1ffa8..1135b4c 100644
--- a/Source/cmake/OptionsHaiku.cmake
+++ b/Source/cmake/OptionsHaiku.cmake
@@ -176,10 +176,13 @@ if (CMAKE_BUILD_TYPE STREQUAL release AND CMAKE_COMPILER_IS_GNUCC AND UNIX AND N
     set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--gc-sections ${CMAKE_SHARED_LINKER_FLAGS}")
 endif ()
 
-# i686 is the official requirement for Haiku, let's try to keep this working for everyone
-# Moreover, our stack isn't 16-byte aligned so this avoid crashes where gcc would otherwise use SSE2 instructions.
-set(CMAKE_C_FLAGS "-march=i686 ${CMAKE_C_FLAGS}")
-set(CMAKE_CXX_FLAGS "-march=i686 ${CMAKE_CXX_FLAGS}")
+string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "x86")
+	# i686 is the official requirement for Haiku, let's try to keep this working for everyone
+	# Moreover, our stack isn't 16-byte aligned so this avoid crashes where gcc would otherwise use SSE2 instructions.
+	set(CMAKE_C_FLAGS "-march=i686 ${CMAKE_C_FLAGS}")
+	set(CMAKE_CXX_FLAGS "-march=i686 ${CMAKE_CXX_FLAGS}")
+endif ()
 
 if (WTF_USE_TILED_BACKING_STORE)
     add_definitions(-DWTF_USE_ACCELERATED_COMPOSITING=1)
-- 
1.8.3.4

