3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
7 # Antoine Dechaume 2011
10 Detect the PGI C compiler
14 from waflib import Errors
15 from waflib.Configure import conf
16 from waflib.Tools.compiler_c import c_compiler
17 c_compiler['linux'].append('pgicc')
20 def find_pgi_compiler(conf, var, name):
22 Find the program name, and execute it to ensure it really is itself.
24 if sys.platform == 'cygwin':
25 conf.fatal('The PGI compiler does not work on Cygwin')
31 elif var in conf.environ:
32 cc = conf.environ[var]
34 cc = conf.find_program(name, var=var)
36 conf.fatal('PGI Compiler (%s) was not found' % name)
38 v[var + '_VERSION'] = conf.get_pgi_version(cc)
40 v[var + '_NAME'] = 'pgi'
43 def get_pgi_version(conf, cc):
44 """Find the version of a pgi compiler."""
45 version_re = re.compile(r"The Portland Group", re.I).search
46 cmd = cc + ['-V', '-E'] # Issue 1078, prevent wrappers from linking
49 out, err = conf.cmd_and_log(cmd, output=0)
50 except Errors.WafError:
51 conf.fatal('Could not find pgi compiler %r' % cmd)
54 match = version_re(out)
56 match = version_re(err)
59 conf.fatal('Could not verify PGI signature')
61 cmd = cc + ['-help=variable']
63 out, err = conf.cmd_and_log(cmd, output=0)
64 except Errors.WafError:
65 conf.fatal('Could not find pgi compiler %r' % cmd)
67 version = re.findall('^COMPVER\s*=(.*)', out, re.M)
69 conf.fatal('Could not determine the compiler version')
73 conf.find_pgi_compiler('CC', 'pgcc')
75 conf.gcc_common_flags()