Skip to content

Commit

Permalink
BENTO: check for inline support.
Browse files Browse the repository at this point in the history
  • Loading branch information
cournape committed Aug 28, 2011
1 parent f5f821a commit 12c538f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions numpy/build_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,44 @@ def check_functions_at_once(self, funcs, **kw):
return ret == 0
return ret

@waflib.Configure.conf
def check_inline(conf, **kw):
validate_arguments(conf, kw)

code = """
#ifndef __cplusplus
static %(inline)s int static_func (void)
{
return 0;
}
%(inline)s int nostatic_func (void)
{
return 0;
}
#endif"""

conf.start_msg("Checking for inline support")
inline = None
for k in ['inline', '__inline__', '__inline']:
try:
kw["code"] = code % {"inline": k}
ret = conf.run_c_code(**kw)
inline = k
break
except conf.errors.ConfigurationError:
pass

if inline is None:
conf.end_msg("failed", 'YELLOW')
if Logs.verbose > 1:
raise
else:
conf.fatal('The configuration failed')
else:
kw['success'] = ret
conf.end_msg(inline)
return inline

@waflib.Configure.conf
def post_check(self, *k, **kw):
"set the variables after a test was run successfully"
Expand Down
1 change: 1 addition & 0 deletions numpy/core/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def configure(context):
type_checks(conf)
signal_smp_checks(conf)
check_math_runtime(conf)
numpy.build_utils.check_inline(conf)

conf.env["CONFIG_HEADER_TEMPLATE"] = """\
%(content)s
Expand Down

0 comments on commit 12c538f

Please sign in to comment.