xref: /petsc/config/BuildSystem/config/utilities/fortranCommandLine.py (revision e6994092c169409fd2214bddd7e38ced794e3cea)
1from __future__ import generators
2import config.base
3
4class Configure(config.base.Configure):
5  def __init__(self, framework):
6    config.base.Configure.__init__(self, framework)
7    self.headerPrefix = ''
8    self.substPrefix  = ''
9    self.have_command_argument = False
10    return
11
12  def __str__(self):
13    return ''
14
15  def setupHelp(self, help):
16    import nargs
17    return
18
19  def setupDependencies(self, framework):
20    config.base.Configure.setupDependencies(self, framework)
21    self.compilers    = self.framework.require('config.compilers', self)
22    self.setCompilers = self.framework.require('config.setCompilers', self)
23    self.functions    = self.framework.require('config.functions', self)
24    self.libraries    = framework.require('config.libraries',  self)
25    return
26
27  def configureFortranCommandLine(self):
28    '''Check for the mechanism to retrieve command line arguments in Fortran'''
29
30    # These are for when the routines are called from Fortran
31
32    self.libraries.pushLanguage('FC')
33    self.libraries.saveLog()
34    if self.libraries.check('','', call = '      integer i\n      character(len=80) arg\n      i = command_argument_count()\n      call get_command_argument(i,arg)'):
35      self.logWrite(self.libraries.restoreLog())
36      self.libraries.popLanguage()
37      self.have_command_argument = True
38    else:
39      self.logPrint("Missing GET_COMMAND_ARGUMENT() support in Fortran!")
40    return
41
42  def configure(self):
43    if hasattr(self.setCompilers, 'FC'):
44      self.executeTest(self.configureFortranCommandLine)
45    return
46