summarylogtreecommitdiffstats
path: root/mingw-posix.patch
blob: 4e8adc641c908657302cde4e4f8d406291cd5dd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/scons/llvm.py b/scons/llvm.py
index a84ad51..8ef7a84 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -32,6 +32,7 @@ import os.path
 import re
 import sys
 import distutils.version
+import subprocess
 
 import SCons.Errors
 import SCons.Util
@@ -123,7 +124,8 @@ def generate(env):
             if env['platform'] == 'windows' and env['crosscompile']:
                 # LLVM 5.0 requires MinGW w/ pthreads due to use of std::thread and friends.
                 assert env['gcc']
-                env['CXX'] = env['CXX'] + '-posix'
+                if subprocess.call(env['CXX'] + '-posix -v', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:
+                    env['CXX'] = env['CXX'] + '-posix'
         elif llvm_version >= distutils.version.LooseVersion('4.0'):
             env.Prepend(LIBS = [
                 'LLVMX86Disassembler', 'LLVMX86AsmParser',