Introduce -m64 flag for making x64 when the default gcc compiler is for X32
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 15:03:54 +0000 (15:03 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Jul 2013 15:03:54 +0000 (15:03 +0000)
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/18211004

Patch from Haitao Feng <haitao.feng@intel.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15451 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

build/common.gypi

index 09abe29..f83a281 100644 (file)
           }],
         ],
       }],
+      ['(OS=="linux") and (v8_target_arch=="x64")', {
+        # Check whether the host compiler and target compiler support the
+        # '-m64' option and set it if so.
+        'target_conditions': [
+          ['_toolset=="host"', {
+            'variables': {
+              'm64flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m64 -E - > /dev/null 2>&1) && echo "-m64" || true)',
+            },
+            'cflags': [ '<(m64flag)' ],
+            'ldflags': [ '<(m64flag)' ],
+          }],
+          ['_toolset=="target"', {
+            'variables': {
+              'm64flag': '<!((echo | $(echo ${CXX_target:-<(CXX)}) -m64 -E - > /dev/null 2>&1) && echo "-m64" || true)',
+            },
+            'cflags': [ '<(m64flag)' ],
+            'ldflags': [ '<(m64flag)' ],
+          }]
+        ],
+      }],
       ['OS=="freebsd" or OS=="openbsd"', {
         'cflags': [ '-I/usr/local/include' ],
       }],