scons: Don't set LLVM_VERSION if one of the llvm-config calls fails.
authorVinson Lee <vlee@vmware.com>
Mon, 7 Sep 2009 14:16:25 +0000 (15:16 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 7 Sep 2009 14:16:25 +0000 (15:16 +0100)
Ubuntu 8.10 has llvm-config version 2.2, which doesn't have
nativecodegen. This triggers an exception.

scons/llvm.py
src/gallium/drivers/llvmpipe/SConscript

index 702f1e354f6352fb6892166f33a2b27f24e9ae97..46a8d829ca4c225446e70a4b805a002e507e17c2 100644 (file)
@@ -56,15 +56,17 @@ def generate(env):
         env.PrependENVPath('PATH', llvm_bin_dir)
 
     if env.Detect('llvm-config'):
-        try:
-            env['LLVM_VERSION'] = env.backtick('llvm-config --version')
-        except AttributeError:
-            env['LLVM_VERSION'] = 'X.X'
+        version = env.backtick('llvm-config --version').rstrip()
 
-        env.ParseConfig('llvm-config --cppflags')
-        env.ParseConfig('llvm-config --libs jit interpreter nativecodegen bitwriter')
-        env.ParseConfig('llvm-config --ldflags')
-        env['LINK'] = env['CXX']
+        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' % version
+        else:
+            env['LINK'] = env['CXX']
+            env['LLVM_VERSION'] = version
 
 def exists(env):
     return True
index ac1b5d6d1dbe6b5f727c0b6e5e453de96ebeb123..dea4b703c456e8556f1039913b442b79fa6aec02 100644 (file)
@@ -3,7 +3,7 @@ Import('*')
 env = env.Clone()
 
 env.Tool('llvm')
-if 'LLVM_VERSION' not in env:
+if env.has_key('LLVM_VERSION') is False:
     print 'warning: LLVM not found: not building llvmpipe'
     Return()