jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.7KB

  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # harald at klimachs.de
  4. import re
  5. from waflib import Utils
  6. from waflib.Tools import fc, fc_config, fc_scan
  7. from waflib.Configure import conf
  8. from waflib.Tools.compiler_fc import fc_compiler
  9. fc_compiler['linux'].append('fc_pgfortran')
  10. @conf
  11. def find_pgfortran(conf):
  12. """Find the PGI fortran compiler (will look in the environment variable 'FC')"""
  13. fc = conf.find_program(['pgfortran', 'pgf95', 'pgf90'], var='FC')
  14. conf.get_pgfortran_version(fc)
  15. conf.env.FC_NAME = 'PGFC'
  16. @conf
  17. def pgfortran_flags(conf):
  18. v = conf.env
  19. v['FCFLAGS_fcshlib'] = ['-shared']
  20. v['FCFLAGS_DEBUG'] = ['-Minform=inform', '-Mstandard'] # why not
  21. v['FCSTLIB_MARKER'] = '-Bstatic'
  22. v['FCSHLIB_MARKER'] = '-Bdynamic'
  23. v['SONAME_ST'] = '-soname %s'
  24. @conf
  25. def get_pgfortran_version(conf,fc):
  26. version_re = re.compile(r"The Portland Group", re.I).search
  27. cmd = fc + ['-V']
  28. out,err = fc_config.getoutput(conf, cmd, stdin=False)
  29. if out: match = version_re(out)
  30. else: match = version_re(err)
  31. if not match:
  32. conf.fatal('Could not verify PGI signature')
  33. cmd = fc + ['-help=variable']
  34. out,err = fc_config.getoutput(conf, cmd, stdin=False)
  35. if out.find('COMPVER')<0:
  36. conf.fatal('Could not determine the compiler type')
  37. k = {}
  38. prevk = ''
  39. out = out.splitlines()
  40. for line in out:
  41. lst = line.partition('=')
  42. if lst[1] == '=':
  43. key = lst[0].rstrip()
  44. if key == '': key = prevk
  45. val = lst[2].rstrip()
  46. k[key] = val
  47. else: prevk = line.partition(' ')[0]
  48. def isD(var):
  49. return var in k
  50. def isT(var):
  51. return var in k and k[var]!='0'
  52. conf.env['FC_VERSION'] = (k['COMPVER'].split('.'))
  53. def configure(conf):
  54. conf.find_pgfortran()
  55. conf.find_ar()
  56. conf.fc_flags()
  57. conf.fc_add_flags()
  58. conf.pgfortran_flags()