diff options
author | David Cournapeau <cournape@gmail.com> | 2011-03-07 20:19:59 +0900 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2011-08-29 00:32:22 +0200 |
commit | f110ad252fb9b3f4fcf569a943a1531ddd03ee56 (patch) | |
tree | c732409c9f5c27c70810a071509d60970cbec6bb | |
parent | 026876020592b9720f029b109cc0d4837710689a (diff) | |
download | numpy-f110ad252fb9b3f4fcf569a943a1531ddd03ee56.tar.gz |
BENTO: check for C99 formats + add check_declaration.
-rw-r--r-- | numpy/build_utils/__init__.py | 29 | ||||
-rw-r--r-- | numpy/core/bscript | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/numpy/build_utils/__init__.py b/numpy/build_utils/__init__.py index 17bf8b009..ba9fa72be 100644 --- a/numpy/build_utils/__init__.py +++ b/numpy/build_utils/__init__.py @@ -77,3 +77,32 @@ int main() return ret == 0 return ret +@waflib.Configure.conf +def check_declaration(self, symbol, **kw): + code = r""" +int main() +{ +#ifndef %s + (void) %s; +#endif + ; + return 0; +} +""" % (symbol, symbol) + + kw["code"] = to_header(kw) + code + kw["msg"] = "Checking for macro %r" % symbol + kw["errmsg"] = "not found" + kw["okmsg"] = "yes" + + validate_arguments(self, kw) + try_compile(self, kw) + ret = kw["success"] + + kw["define_name"] = "HAVE_DECL_%s" % sanitize_string(symbol) + kw["define_comment"] = "/* Set to 1 if %s is defined. */" % symbol + self.post_check(**kw) + if not kw.get('execute', False): + return ret == 0 + return ret + diff --git a/numpy/core/bscript b/numpy/core/bscript index 0f9a1f3aa..22913ac3c 100644 --- a/numpy/core/bscript +++ b/numpy/core/bscript @@ -50,6 +50,12 @@ def configure(context): except waflib.Errors.ConfigurationError: NUMPYCONFIG_SYM.append(('DEFINE_NPY_HAVE_ENDIAN_H', '')) + try: + conf.check_declaration('PRIdPTR', header_name='inttypes.h') + NUMPYCONFIG_SYM.append(('DEFINE_NPY_USE_C99_FORMATS', '#define NPY_USE_C99_FORMATS 1')) + except waflib.Errors.ConfigurationError: + NUMPYCONFIG_SYM.append(('DEFINE_NPY_USE_C99_FORMATS', '')) + conf.env["CONFIG_HEADER_TEMPLATE"] = """\ %(content)s #ifndef _NPY_NPY_CONFIG_H_ |