scons: Recognize 'AMD64' processor as well.
[mesa.git] / scons / llvm.py
index 88a63854bc6d1fffa470bb55049bb1b6f1e6f7e1..3fef9e0900d59b2cd57a719cbd5d69aa0571683c 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
@@ -76,6 +79,7 @@ def generate(env):
             mo = llvm_version_re.match(line)
             if mo:
                 llvm_version = mo.group(1)
+                llvm_version = distutils.version.LooseVersion(llvm_version)
                 break
         if llvm_version is None:
             print 'scons: could not determine the LLVM version from %s' % llvm_config
@@ -122,30 +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)
 
         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
-        else:
-            env['LINK'] = env['CXX']
-    else:
-        return
+            print 'scons: llvm-config version %s failed' % llvm_version
+            return
 
     assert llvm_version is not None
+    env['llvm'] = True
 
     print 'scons: Found LLVM version %s' % llvm_version
-    llvm_version = distutils.version.LooseVersion(llvm_version)
     env['LLVM_VERSION'] = llvm_version
 
     # Define HAVE_LLVM macro with the major/minor version number (e.g., 0x0206 for 2.6)