def check_for_openmp():
    tmpdir = tempfile.mkdtemp()
curdir = os.getcwd()
os.chdir(tmpdir)
filename = 'test.c'
with open(filename, 'w', 0) as file:
    file.write(omp_test)
with open(os.devnull, 'w') as fnull:
    result = subprocess.call(['cc', '-fopenmp', filename], stdout=fnull,
        stderr=fnull)
os.chdir(curdir)
shutil.rmtree(tmpdir)
return result
Programatically testing for openmp support from a python setup script