blob: 9bc331aa636dae23336a7667283334e11e169641 [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import re
6from waflib import Utils
7from waflib.Tools import fc,fc_config,fc_scan,ar
8from waflib.Configure import conf
9@conf
10def find_g95(conf):
11 fc=conf.find_program('g95',var='FC')
12 fc=conf.cmd_to_list(fc)
13 conf.get_g95_version(fc)
14 conf.env.FC_NAME='G95'
15@conf
16def g95_flags(conf):
17 v=conf.env
18 v['FCFLAGS_fcshlib']=['-fPIC']
19 v['FORTRANMODFLAG']=['-fmod=','']
20 v['FCFLAGS_DEBUG']=['-Werror']
21@conf
22def g95_modifier_win32(conf):
23 fc_config.fortran_modifier_win32(conf)
24@conf
25def g95_modifier_cygwin(conf):
26 fc_config.fortran_modifier_cygwin(conf)
27@conf
28def g95_modifier_darwin(conf):
29 fc_config.fortran_modifier_darwin(conf)
30@conf
31def g95_modifier_platform(conf):
32 dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform()
33 g95_modifier_func=getattr(conf,'g95_modifier_'+dest_os,None)
34 if g95_modifier_func:
35 g95_modifier_func()
36@conf
37def get_g95_version(conf,fc):
38 version_re=re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
39 cmd=fc+['--version']
40 out,err=fc_config.getoutput(conf,cmd,stdin=False)
41 if out:
42 match=version_re(out)
43 else:
44 match=version_re(err)
45 if not match:
46 conf.fatal('cannot determine g95 version')
47 k=match.groupdict()
48 conf.env['FC_VERSION']=(k['major'],k['minor'])
49def configure(conf):
50 conf.find_g95()
51 conf.find_ar()
52 conf.fc_flags()
53 conf.fc_add_flags()
54 conf.g95_flags()
55 conf.g95_modifier_platform()