source: waflib/Tools/gfortran.py @ ce6186a

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since ce6186a was 0fa325b, checked in by Paul Brossier <piem@piem.org>, 11 years ago

waf: unpack

  • Property mode set to 100644
File size: 1.9 KB
Line 
1#! /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_gfortran(conf):
11        fc=conf.find_program(['gfortran','g77'],var='FC')
12        fc=conf.cmd_to_list(fc)
13        conf.get_gfortran_version(fc)
14        conf.env.FC_NAME='GFORTRAN'
15@conf
16def gfortran_flags(conf):
17        v=conf.env
18        v['FCFLAGS_fcshlib']=['-fPIC']
19        v['FORTRANMODFLAG']=['-J','']
20        v['FCFLAGS_DEBUG']=['-Werror']
21@conf
22def gfortran_modifier_win32(conf):
23        fc_config.fortran_modifier_win32(conf)
24@conf
25def gfortran_modifier_cygwin(conf):
26        fc_config.fortran_modifier_cygwin(conf)
27@conf
28def gfortran_modifier_darwin(conf):
29        fc_config.fortran_modifier_darwin(conf)
30@conf
31def gfortran_modifier_platform(conf):
32        dest_os=conf.env['DEST_OS']or Utils.unversioned_sys_platform()
33        gfortran_modifier_func=getattr(conf,'gfortran_modifier_'+dest_os,None)
34        if gfortran_modifier_func:
35                gfortran_modifier_func()
36@conf
37def get_gfortran_version(conf,fc):
38        version_re=re.compile(r"GNU\s*Fortran",re.I).search
39        cmd=fc+['--version']
40        out,err=fc_config.getoutput(conf,cmd,stdin=False)
41        if out:match=version_re(out)
42        else:match=version_re(err)
43        if not match:
44                conf.fatal('Could not determine the compiler type')
45        cmd=fc+['-dM','-E','-']
46        out,err=fc_config.getoutput(conf,cmd,stdin=True)
47        if out.find('__GNUC__')<0:
48                conf.fatal('Could not determine the compiler type')
49        k={}
50        out=out.split('\n')
51        import shlex
52        for line in out:
53                lst=shlex.split(line)
54                if len(lst)>2:
55                        key=lst[1]
56                        val=lst[2]
57                        k[key]=val
58        def isD(var):
59                return var in k
60        def isT(var):
61                return var in k and k[var]!='0'
62        conf.env['FC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__'])
63def configure(conf):
64        conf.find_gfortran()
65        conf.find_ar()
66        conf.fc_flags()
67        conf.fc_add_flags()
68        conf.gfortran_flags()
69        conf.gfortran_modifier_platform()
Note: See TracBrowser for help on using the repository browser.