Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r1482:56f591248800
Date: 2014-03-19 10:14 +0100
http://bitbucket.org/cffi/cffi/changeset/56f591248800/

Log:    (Lisandro Dalcin, part of issue 141)

        Check for "__thread" by asking distutils specifically for the same
        compiler as the one it will use later.

diff --git a/c/check__thread.c b/c/check__thread.c
deleted file mode 100644
--- a/c/check__thread.c
+++ /dev/null
@@ -1,1 +0,0 @@
-__thread int some_threadlocal_variable_42;
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -42,25 +42,14 @@
             resultlist[:] = res
 
 def ask_supports_thread():
-    if sys.platform == "darwin":
-        sys.stderr.write("Note: will not use '__thread' in the C code\n")
-        sys.stderr.write("This is for OS/X-specific reasons: confusion "
-                         "between 'cc' versus 'gcc' (see issue 123)\n")
-        return
-    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:
+    from distutils.core import Distribution
+    config = Distribution().get_command_obj('config')
+    ok = config.try_compile('__thread int some_threadlocal_variable_42;')
+    if ok:
+        define_macros.append(('USE__THREAD', None))
+    else:
         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")
-    else:
-        define_macros.append(('USE__THREAD', None))
-    try:
-        os.unlink('c/check__thread.o')
-    except OSError:
-        pass
 
 def use_pkg_config():
     _ask_pkg_config(include_dirs,       '--cflags-only-I', '-I', sysroot=True)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to