summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c/call_python.c2
-rw-r--r--setup.py18
2 files changed, 18 insertions, 2 deletions
diff --git a/c/call_python.c b/c/call_python.c
index ecff127..0de556b 100644
--- a/c/call_python.c
+++ b/c/call_python.c
@@ -177,7 +177,7 @@ static int _update_cache_to_call_python(struct _cffi_externpy_s *externpy)
#if (defined(WITH_THREAD) && !defined(_MSC_VER) && \
!defined(__amd64__) && !defined(__x86_64__) && \
!defined(__i386__) && !defined(__i386))
-# if defined(__GNUC__)
+# if defined(HAVE_SYNC_SYNCHRONIZE)
# define read_barrier() __sync_synchronize()
# elif defined(_AIX)
# define read_barrier() __lwsync()
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')