2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-27 04:15:00 +01:00

Issue 1339 detect the sun compiler version number

This commit is contained in:
Thomas Nagy 2013-07-13 19:06:08 +02:00
parent d4d33bba2a
commit f588f95a27
3 changed files with 25 additions and 0 deletions

View File

@ -1136,6 +1136,27 @@ def get_xlc_version(conf, cc):
else:
conf.fatal('Could not determine the XLC version.')
@conf
def get_suncc_version(conf, cc):
"""Get the compiler version"""
cmd = cc + ['-V']
try:
out, err = conf.cmd_and_log(cmd, output=0)
except Errors.WafError:
conf.fatal('Could not find suncc %r' % cmd)
version = (out or err)
version = version.split('\n')[0]
version_re = re.compile(r'cc:\s+sun\s+(c\+\+|c)\s+(?P<major>\d*)\.(?P<minor>\d*)', re.I).search
match = version_re(version)
if match:
k = match.groupdict()
conf.env['CC_VERSION'] = (k['major'], k['minor'])
else:
conf.fatal('Could not determine the suncc version.')
# ============ the --as-needed flag should added during the configuration, not at runtime =========
@conf

View File

@ -28,6 +28,8 @@ def find_scc(conf):
v['CC'] = cc
v['CC_NAME'] = 'sun'
conf.get_suncc_version(cc)
@conf
def scc_common_flags(conf):

View File

@ -29,6 +29,8 @@ def find_sxx(conf):
v['CXX'] = cc
v['CXX_NAME'] = 'sun'
conf.get_suncc_version(cc)
@conf
def sxx_common_flags(conf):