mesa: remove unneeded DD_POINT_SIZE and DD_LINE_WIDTH tricaps
[mesa.git] / scons / llvm.py
index c8e50c5916d1e0fd54d06a363e411cb1a7158228..1b033acb1b3f50d848de1fc694da9e2cdb903719 100644 (file)
@@ -38,6 +38,8 @@ import SCons.Util
 
 
 def generate(env):
+    env['llvm'] = False
+
     try:
         llvm_dir = os.environ['LLVM']
     except KeyError:
@@ -63,6 +65,7 @@ def generate(env):
     if env['platform'] == 'windows':
         # XXX: There is no llvm-config on Windows, so assume a standard layout
         if llvm_dir is None:
+            print 'scons: LLVM environment variable must be specified when building for windows'
             return
 
         # Try to determine the LLVM version from llvm/Config/config.h
@@ -82,11 +85,6 @@ def generate(env):
             print 'scons: could not determine the LLVM version from %s' % llvm_config
             return
 
-        if llvm_version >= distutils.version.LooseVersion('2.7'):
-            print 'scons: Ignoring unsupported LLVM version %s' % llvm_version
-            print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429'
-            return
-
         env.Prepend(CPPPATH = [os.path.join(llvm_dir, 'include')])
         env.AppendUnique(CPPDEFINES = [
             '__STDC_LIMIT_MACROS', 
@@ -128,33 +126,32 @@ def generate(env):
             # Some of the LLVM C headers use the inline keyword without
             # defining it.
             env.Append(CPPDEFINES = [('inline', '__inline')])
-            if env['debug']:
+            if env['build'] in ('debug', 'checked'):
                 # LLVM libraries are static, build with /MT, and they
                 # automatically link agains LIBCMT. When we're doing a
                 # debug build we'll be linking against LIBCMTD, so disable
                 # that.
                 env.Append(LINKFLAGS = ['/nodefaultlib:LIBCMT'])
-    elif env.Detect('llvm-config'):
+    else:
+        if not env.Detect('llvm-config'):
+            print 'scons: llvm-config script not found' % llvm_version
+            return
+
         llvm_version = env.backtick('llvm-config --version').rstrip()
         llvm_version = distutils.version.LooseVersion(llvm_version)
 
-        if llvm_version >= distutils.version.LooseVersion('2.7'):
-            print 'scons: Ignoring unsupported LLVM version %s' % llvm_version
-            print 'scons: See http://www.llvm.org/bugs/show_bug.cgi?id=6429'
-            return
-
         try:
             env.ParseConfig('llvm-config --cppflags')
             env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
             env.ParseConfig('llvm-config --ldflags')
         except OSError:
-            print 'llvm-config version %s failed' % llvm_version
+            print 'scons: llvm-config version %s failed' % llvm_version
+            return
         else:
             env['LINK'] = env['CXX']
-    else:
-        return
 
     assert llvm_version is not None
+    env['llvm'] = True
 
     print 'scons: Found LLVM version %s' % llvm_version
     env['LLVM_VERSION'] = llvm_version