Support for gcc and clang colour diagnostics

Patch provided by Lubos Lunak
https://groups.google.com/forum/#!topic/ccache/-Zehp1Zs3Lg