From 00a061cde9acee7ceec69880439f6118a0a27fb2 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 9 Mar 2015 10:24:41 -0700 Subject: [PATCH] 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.) --- configure.py | 9 ++++++--- 1 file 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(): -- 2.7.4