summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2017-01-13 11:02:44 +0100
committerArmin Rigo <arigo@tunes.org>2017-01-13 11:02:44 +0100
commit57f16e1dc600e4e91d3b260c03f985e0dff41aed (patch)
tree8c49b401583a5b31d77fa81239afb2934d1bf5ea /setup.py
parent0112ad819e177a51abdb5378fd933d4c577aa6ae (diff)
downloadcffi-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.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/setup.py b/setup.py
index cab4484..6df3f3c 100644
--- a/setup.py
+++ b/setup.py
@@ -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')