diff options
author | Armin Rigo <arigo@tunes.org> | 2017-01-13 11:02:44 +0100 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2017-01-13 11:02:44 +0100 |
commit | 57f16e1dc600e4e91d3b260c03f985e0dff41aed (patch) | |
tree | 8c49b401583a5b31d77fa81239afb2934d1bf5ea /setup.py | |
parent | 0112ad819e177a51abdb5378fd933d4c577aa6ae (diff) | |
download | cffi-57f16e1dc600e4e91d3b260c03f985e0dff41aed.tar.gz |
Use __sync_synchronize() only if setup.py detects we have it. Fix for
people using an incredibly old gcc.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -69,7 +69,22 @@ def ask_supports_thread(): if not ok1: no_working_compiler_found() sys.stderr.write("Note: will not use '__thread' in the C code\n") - sys.stderr.write("The above error message can be safely ignored\n") + _safe_to_ignore() + +def ask_supports_sync_synchronize(): + if sys.platform == 'win32': + return + config = get_config() + ok = config.try_link('int main(void) { __sync_synchronize(); return 0; }') + if ok: + define_macros.append(('HAVE_SYNC_SYNCHRONIZE', None)) + else: + sys.stderr.write("Note: will not use '__sync_synchronize()'" + " in the C code\n") + _safe_to_ignore() + +def _safe_to_ignore(): + sys.stderr.write("***** The above error message can be safely ignored.\n\n") def uses_msvc(): config = get_config() @@ -118,6 +133,7 @@ if COMPILE_LIBFFI: else: use_pkg_config() ask_supports_thread() + ask_supports_sync_synchronize() if 'freebsd' in sys.platform: include_dirs.append('/usr/local/include') |