diff options
author | Armin Rigo <arigo@tunes.org> | 2013-09-25 10:47:22 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2013-09-25 10:47:22 +0200 |
commit | 892bfe552fb0f0c22faa716091c938eb10789a62 (patch) | |
tree | 4252cbad126e66ed2d1c89eb50717f1fbdbe882e /setup.py | |
parent | 7850c4ce5f73ec6284e4652b6746c2763ff0f2c6 (diff) | |
download | cffi-892bfe552fb0f0c22faa716091c938eb10789a62.tar.gz |
A redo of pull request 19: dynamically determine if the C compiler
supports "__thread" or not on this platform. Done slightly more
simply in setup.py.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -41,6 +41,17 @@ def _ask_pkg_config(resultlist, option, result_prefix='', sysroot=False): # resultlist[:] = res +def ask_supports_thread(): + import distutils.errors + from distutils.ccompiler import new_compiler + compiler = new_compiler(force=1) + try: + compiler.compile(['c/check__thread.c']) + except distutils.errors.CompileError: + print >> sys.stderr, "will not use '__thread' in the C code" + else: + define_macros.append(('USE__THREAD', None)) + def use_pkg_config(): _ask_pkg_config(include_dirs, '--cflags-only-I', '-I', sysroot=True) _ask_pkg_config(extra_compile_args, '--cflags-only-other') @@ -71,6 +82,7 @@ if COMPILE_LIBFFI: for filename in _filenames) else: use_pkg_config() + ask_supports_thread() if __name__ == '__main__': |