C/FC detection and outputs to be written in config.log

This commit is contained in:
Thomas Nagy 2015-08-23 17:16:03 +02:00
parent 274fba398c
commit bfbcc73eb2
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 6 additions and 15 deletions

View File

@ -1004,15 +1004,10 @@ def get_cc_version(conf, cc, gcc=False, icc=False, clang=False):
cmd = cc + ['-dM', '-E', '-']
env = conf.env.env or None
try:
p = Utils.subprocess.Popen(cmd, stdin=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
p.stdin.write('\n'.encode())
out = p.communicate()[0]
out, err = conf.cmd_and_log(cmd, output=0, input='\n'.encode(), stdin=Utils.subprocess.PIPE, env=env)
except Exception:
conf.fatal('Could not determine the compiler version %r' % cmd)
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding or 'iso8859-1')
if gcc:
if out.find('__INTEL_COMPILER') >= 0:
conf.fatal('The intel compiler pretends to be gcc')

View File

@ -335,23 +335,19 @@ def check_fortran_clib(self, autoadd=True, *k, **kw):
def getoutput(conf, cmd, stdin=False):
"""
TODO a bit redundant, can be removed anytime
TODO waf 1.9
"""
wargs = {'env': conf.env.env or None, 'output': 0}
if stdin:
wargs['stdin'] = Utils.subprocess.PIPE
wargs['input'] = '\n'.encode()
stdin = Utils.subprocess.PIPE
else:
stdin = None
env = conf.env.env or None
try:
p = Utils.subprocess.Popen(cmd, stdin=stdin, stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE, env=env)
if stdin:
p.stdin.write('\n'.encode())
out, err = p.communicate()
out, err = conf.cmd_and_log(cmd, **wargs)
except Exception:
conf.fatal('could not determine the compiler version %r' % cmd)
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding or 'iso8859-1')
if not isinstance(err, str):
err = err.decode(sys.stdout.encoding or 'iso8859-1')
return (out, err)
# ------------------------------------------------------------------------