summaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-03-09 17:24:41 (GMT)
committerNico Weber <thakis@chromium.org>2015-03-09 17:24:41 (GMT)
commit00a061cde9acee7ceec69880439f6118a0a27fb2 (patch)
tree362e17dfadd02ae9f4331ef0e4c1f20bef55b7ea /configure.py
parentb0c9eab3f67547eb0f6c24721fe002f414505e73 (diff)
downloadNinja-00a061cde9acee7ceec69880439f6118a0a27fb2.zip
Ninja-00a061cde9acee7ceec69880439f6118a0a27fb2.tar.gz
Ninja-00a061cde9acee7ceec69880439f6118a0a27fb2.tar.bz2
Make diagnostics colored with new gccs (4.9+) too.
Both clang and gcc understand -fdiagnostics-color, so use that flag name. (This will disable colored diagnostics for clangs older than LLVM 3.3, but that is several years old by now.)
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/configure.py b/configure.py
index cb08c17..661662f 100755
--- a/configure.py
+++ b/configure.py
@@ -318,9 +318,12 @@ else:
else:
cflags += ['-O2', '-DNDEBUG']
try:
- proc = subprocess.Popen([CXX, '--version'], stdout=subprocess.PIPE)
- if 'clang' in proc.communicate()[0].decode('utf-8'):
- cflags += ['-fcolor-diagnostics']
+ proc = subprocess.Popen(
+ [CXX, '-fdiagnostics-color', '-c', '-x', 'c++', '/dev/null'],
+ stdout=open(os.devnull, 'wb'), stderr=subprocess.STDOUT)
+ proc.wait()
+ if proc.returncode == 0:
+ cflags += ['-fdiagnostics-color']
except:
pass
if platform.is_mingw():