From: Nico Weber Date: Mon, 9 Mar 2015 17:24:41 +0000 (-0700) Subject: Make diagnostics colored with new gccs (4.9+) too. X-Git-Tag: v1.6.0^2~29^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00a061cde9acee7ceec69880439f6118a0a27fb2;p=platform%2Fupstream%2Fninja.git 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.) --- 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():