~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to waflib/Tools/gfortran.py

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Felipe Sateler, Jaromír Mikeš
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-9by89mlwhy6cpjxo
Tags: 3.4~dfsg-2
* Team upload.

[ Felipe Sateler ]
* Re-upload to unstable

[ Jaromír Mikeš ]
* Update copyright file.

Show diffs side-by-side

added added

removed removed

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