[Numpy-svn] r4628 - branches/cleanconfig_rtm/numpy/core

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Dec 21 22:20:31 EST 2007


Author: cdavid
Date: 2007-12-21 21:20:08 -0600 (Fri, 21 Dec 2007)
New Revision: 4628

Modified:
   branches/cleanconfig_rtm/numpy/core/setup.py
Log:
Add code to test for a declaration in header

Modified: branches/cleanconfig_rtm/numpy/core/setup.py
===================================================================
--- branches/cleanconfig_rtm/numpy/core/setup.py	2007-12-21 09:33:46 UTC (rev 4627)
+++ branches/cleanconfig_rtm/numpy/core/setup.py	2007-12-22 03:20:08 UTC (rev 4628)
@@ -39,6 +39,19 @@
 
     header_dir = 'include/numpy' # this is relative to config.path_in_package
 
+    def generate_declaration_test(symbol, includes):
+        main_src = """
+int main()
+{
+#ifndef %s
+    (void) %s;
+#endif
+    ;
+    return 0;
+}""" % (symbol, symbol)
+    
+        return "\n".join([includes, main_src])
+
     def generate_config_h(ext, build_dir):
         target = join(build_dir,'config.h')
         if newer(__file__,target):
@@ -58,12 +71,18 @@
                 raise SystemError,"Failed to test configuration. "\
                       "See previous error messages for more information."
 
-                # Python 2.3 causes a segfault when
-                #  trying to re-acquire the thread-state
-                #  which is done in error-handling
-                #  ufunc code.  NPY_ALLOW_C_API and friends
-                #  cause the segfault. So, we disable threading
-                #  for now.
+            def test_declaration(symbol, includes = ""):
+                code = generate_declaration_test(symbol, includes)
+                result = config_cmd.try_run(code, include_dirs = [python_include],
+                                            library_dirs = default_lib_dirs)
+                return result
+
+            # Python 2.3 causes a segfault when
+            #  trying to re-acquire the thread-state
+            #  which is done in error-handling
+            #  ufunc code.  NPY_ALLOW_C_API and friends
+            #  cause the segfault. So, we disable threading
+            #  for now.
             if sys.version[:5] < '2.4.2':
                 nosmp = 1
             else:




More information about the Numpy-svn mailing list