3 # harald at klimachs.de
6 from waflib
import Utils
,Errors
7 from waflib
.Tools
import fc
,fc_config
,fc_scan
8 from waflib
.Configure
import conf
10 from waflib
.Tools
.compiler_fc
import fc_compiler
11 fc_compiler
['aix'].insert(0, 'fc_xlf')
15 """Find the xlf program (will look in the environment variable 'FC')"""
17 fc
= conf
.find_program(['xlf2003_r', 'xlf2003', 'xlf95_r', 'xlf95', 'xlf90_r', 'xlf90', 'xlf_r', 'xlf'], var
='FC')
18 conf
.get_xlf_version(fc
)
19 conf
.env
.FC_NAME
='XLF'
24 v
['FCDEFINES_ST'] = '-WF,-D%s'
25 v
['FCFLAGS_fcshlib'] = ['-qpic=small']
26 v
['FCFLAGS_DEBUG'] = ['-qhalt=w']
27 v
['LINKFLAGS_fcshlib'] = ['-Wl,-shared']
30 def xlf_modifier_platform(conf
):
31 dest_os
= conf
.env
['DEST_OS'] or Utils
.unversioned_sys_platform()
32 xlf_modifier_func
= getattr(conf
, 'xlf_modifier_' + dest_os
, None)
37 def get_xlf_version(conf
, fc
):
38 """Get the compiler version"""
40 cmd
= fc
+ ['-qversion']
42 out
, err
= conf
.cmd_and_log(cmd
, output
=0)
43 except Errors
.WafError
:
44 conf
.fatal('Could not find xlf %r' % cmd
)
46 for v
in (r
"IBM XL Fortran.* V(?P<major>\d*)\.(?P<minor>\d*)",):
47 version_re
= re
.compile(v
, re
.I
).search
48 match
= version_re(out
or err
)
51 conf
.env
['FC_VERSION'] = (k
['major'], k
['minor'])
54 conf
.fatal('Could not determine the XLF version.')
62 conf
.xlf_modifier_platform()