summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2011-03-07 20:56:52 +0900
committerDavid Cournapeau <cournape@gmail.com>2011-08-29 00:32:22 +0200
commit992b4a79e00f48ea85e7fa5d3413bda999b20918 (patch)
tree126633a218adcde8cf83e564cd99fc36143920ad
parent12c538f45c0cf98d411035bf4c8b65950c319986 (diff)
downloadnumpy-992b4a79e00f48ea85e7fa5d3413bda999b20918.tar.gz
BENTO: add complex checks.
-rw-r--r--numpy/build_utils/__init__.py27
-rw-r--r--numpy/core/bscript21
2 files changed, 48 insertions, 0 deletions
diff --git a/numpy/build_utils/__init__.py b/numpy/build_utils/__init__.py
index 9789e09d9..02fa4e2e3 100644
--- a/numpy/build_utils/__init__.py
+++ b/numpy/build_utils/__init__.py
@@ -106,6 +106,33 @@ int main()
return ret == 0
return ret
+@waflib.Configure.conf
+def check_type(self, type_name, **kw):
+ code = r"""
+int main() {
+ if ((%(type_name)s *) 0)
+ return 0;
+ if (sizeof (%(type_name)s))
+ return 0;
+}
+""" % {"type_name": type_name}
+
+ kw["code"] = to_header(kw) + code
+ kw["msg"] = "Checking for type %r" % type_name
+ kw["errmsg"] = "not found"
+ kw["okmsg"] = "yes"
+
+ validate_arguments(self, kw)
+ try_compile(self, kw)
+ ret = kw["success"]
+
+ kw["define_name"] = "HAVE_%s" % sanitize_string(type_name)
+ kw["define_comment"] = "/* Set to 1 if %s is defined. */" % type_name
+ self.post_check(**kw)
+ if not kw.get('execute', False):
+ return ret == 0
+ return ret
+
def do_binary_search(conf, type_name, kw):
code = """\
typedef %(type)s waf_check_sizeof_type;
diff --git a/numpy/core/bscript b/numpy/core/bscript
index b0b45d720..6bd5c9c87 100644
--- a/numpy/core/bscript
+++ b/numpy/core/bscript
@@ -193,6 +193,26 @@ def check_math_runtime(conf):
except waflib.Errors.ConfigurationError:
NUMPYCONFIG_SYM.append(('DEFINE_NPY_HAVE_DECL_%s' % f.upper(), ''))
+def check_complex(conf):
+ if conf.check_header("complex.h"):
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_USE_C99_COMPLEX',
+ '#define NPY_USE_C99_COMPLEX 1'))
+ for t in C99_COMPLEX_TYPES:
+ try:
+ conf.check_type(t, header_name='complex.h')
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_HAVE_%s' % numpy.build_utils.sanitize_string(t),
+ '#define NPY_HAVE_%s' % numpy.build_utils.sanitize_string(t)))
+ except waflib.Errors.ConfigurationError:
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_HAVE_%s' % numpy.build_utils.sanitize_string(t), ''))
+
+ for prec in ["", "f", "l"]:
+ flist = [f + prec for f in C99_COMPLEX_FUNCS]
+ conf.check_functions_at_once(flist, use="M")
+ else:
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_USE_C99_COMPLEX', ''))
+ for t in C99_COMPLEX_TYPES:
+ NUMPYCONFIG_SYM.append(('DEFINE_NPY_HAVE_%s' % numpy.build_utils.sanitize_string(t), ''))
+
@pre_configure()
def configure(context):
conf = context.waf_context
@@ -217,6 +237,7 @@ def configure(context):
signal_smp_checks(conf)
check_math_runtime(conf)
numpy.build_utils.check_inline(conf)
+ check_complex(conf)
conf.env["CONFIG_HEADER_TEMPLATE"] = """\
%(content)s