import os
import distutils
try:
    if os.environ['CC'] == 'clang':
        clang = True
except KeyError:
    clang = False
How to tell which compiler will be invoked for a Python C extension in setuptools?