Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index 3016d0c5573e1a4d1c92dadeab8dfda1435d2f7b..bc32e18ff31d254e63fe89fc9af88c19ea1d4f00 100644 |
--- a/build/common.gypi |
+++ b/build/common.gypi |
@@ -280,9 +280,16 @@ |
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ |
or OS=="netbsd"', { |
'conditions': [ |
- [ 'target_arch=="ia32"', { |
- 'cflags': [ '-m32' ], |
- 'ldflags': [ '-m32' ], |
+ [ 'v8_target_arch!="x64"', { |
+ # Pass -m32 to the compiler iff it understands the flag. |
+ 'variables': { |
+ 'm32flag': '<!(' + |
+ '(echo | $(echo ${CXX:-$(which g++)}) -m32 -E - ' + |
+ ' > /dev/null 2>&1) ' + |
+ '&& echo -n "-m32" || true)', |
+ }, |
+ 'cflags': [ '<(m32flag)' ], |
+ 'ldflags': [ '<(m32flag)' ], |
}], |
[ 'v8_no_strict_aliasing==1', { |
'cflags': [ '-fno-strict-aliasing' ], |