mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 09:57:15 +01:00
C/FC detection and outputs to be written in config.log
This commit is contained in:
parent
274fba398c
commit
bfbcc73eb2
@ -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')
|
||||
|
@ -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)
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user