Skip to content

Commit

Permalink
FEAT: add check_ldouble for bento build.
Browse files Browse the repository at this point in the history
  • Loading branch information
cournape committed Aug 28, 2011
1 parent 1220e44 commit 94fab36
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions numpy/build_utils/waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import waflib.Tools.c_config
from waflib import Logs, Utils

from common \
import \
LONG_DOUBLE_REPRESENTATION_SRC, pyod, \
long_double_representation

DEFKEYS = waflib.Tools.c_config.DEFKEYS
DEFINE_COMMENTS = "define_commentz"

Expand Down Expand Up @@ -364,6 +369,45 @@ def check_inline(conf, **kw):
conf.end_msg(inline)
return inline

@waflib.Configure.conf
def check_ldouble_representation(conf, **kw):
msg = {
'INTEL_EXTENDED_12_BYTES_LE': "Intel extended, little endian",
'INTEL_EXTENDED_16_BYTES_LE': "Intel extended, little endian",
'IEEE_QUAD_BE': "IEEE Quad precision, big endian",
'IEEE_QUAD_LE': "IEEE Quad precision, little endian",
'IEEE_DOUBLE_LE': "IEEE Double precision, little endian",
'IEEE_DOUBLE_BE': "IEEE Double precision, big endian"
}

code = LONG_DOUBLE_REPRESENTATION_SRC % {'type': 'long double'}
validate_arguments(conf, kw)

conf.start_msg("Checking for long double representation... ")
try:
kw["code"] = code
ret = conf.run_c_code(**kw)
except conf.errors.ConfigurationError as e:
conf.end_msg(kw['errmsg'], 'YELLOW')
if Logs.verbose > 1:
raise
else:
conf.fatal('The configuration failed')
else:
task_gen = conf.test_bld.groups[0][0]
obj_filename = task_gen.tasks[0].outputs[0].abspath()
tp = long_double_representation(pyod(obj_filename))
kw['success'] = ret
conf.end_msg(msg[tp])
kw["define_name"] = "HAVE_LDOUBLE_%s" % tp
kw["define_comment"] = "/* Define for arch-specific long double representation */"
ret = kw["success"]

conf.post_check(**kw)
if not kw.get('execute', False):
return ret == 0
return ret

@waflib.Configure.conf
def post_check(self, *k, **kw):
"set the variables after a test was run successfully"
Expand Down

0 comments on commit 94fab36

Please sign in to comment.