scons: Filter-out NDEBUG define from llvm-config.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 11 Jul 2011 14:36:40 +0000 (15:36 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 11 Jul 2011 14:38:06 +0000 (15:38 +0100)
Based on a similar autoconf change from Marek.

scons/llvm.py

index b89899bbf87e7755a8470266ce544085263859c3..66f972df5fbfcc396fcdd1c92e22f7c2ea583f1d 100644 (file)
@@ -141,7 +141,15 @@ def generate(env):
         llvm_version = distutils.version.LooseVersion(llvm_version)
 
         try:
-            env.ParseConfig('llvm-config --cppflags')
+            # Treat --cppflags specially to prevent NDEBUG from disabling
+            # assertion failures in debug builds.
+            cppflags = env.ParseFlags('!llvm-config --cppflags')
+            try:
+                cppflags['CPPDEFINES'].remove('NDEBUG')
+            except ValueError:
+                pass
+            env.MergeFlags(cppflags)
+
             env.ParseConfig('llvm-config --libs')
             env.ParseConfig('llvm-config --ldflags')
         except OSError: