[Numpy-svn] r5763 - branches/clean_math_config/numpy/core

numpy-svn@scip... numpy-svn@scip...
Thu Sep 4 10:12:48 CDT 2008


Author: cdavid
Date: 2008-09-04 10:12:45 -0500 (Thu, 04 Sep 2008)
New Revision: 5763

Modified:
   branches/clean_math_config/numpy/core/setup.py
Log:
put the setup code to check for match cap in a separate function.

Modified: branches/clean_math_config/numpy/core/setup.py
===================================================================
--- branches/clean_math_config/numpy/core/setup.py	2008-09-04 14:55:01 UTC (rev 5762)
+++ branches/clean_math_config/numpy/core/setup.py	2008-09-04 15:12:45 UTC (rev 5763)
@@ -49,6 +49,26 @@
             nosmp = 0
     return nosmp == 1
 
+def check_math_capabilities(config, moredefs, mathlibs):
+    def check_func(func_name):
+        return config.check_func(func_name, libraries=mathlibs, decl=True)
+
+    def name_to_defsymb(name):
+        return "HAVE_%s" % name.upper()
+
+    mandatory_funcs = ["sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
+            "floor", "ceil", "sqrt", "log10", "log", "exp", "asin", "acos",
+            "atan"]
+
+    for f in mandatory_funcs:
+        if not check_func(f):
+            raise SystemError("Function %s is mandatory to build numpy." % f)
+        moredefs.append(name_to_defsymb(f))
+
+#    for func_name, defsymbol in FUNCTIONS_TO_CHECK:
+#        if check_func(func_name):
+#            moredefs.append(defsymbol)
+
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration,dot_join
     from numpy.distutils.system_info import get_info, default_lib_dirs
@@ -106,15 +126,8 @@
             ext.libraries.extend(mathlibs)
             moredefs.append(('MATHLIB',','.join(mathlibs)))
 
-            def check_func(func_name):
-                return config_cmd.check_func(func_name,
-                                             libraries=mathlibs, decl=False,
-                                             headers=['math.h'])
+            check_math_capabilities(config_cmd, moredefs, mathlibs)
 
-            for func_name, defsymbol in FUNCTIONS_TO_CHECK:
-                if check_func(func_name):
-                    moredefs.append(defsymbol)
-
             if is_npy_no_signal():
                 moredefs.append('__NPY_PRIVATE_NO_SIGNAL')
 



More information about the Numpy-svn mailing list