Wednesday 18 June 2014

Fortran module filenames

The Fortran standard does not define a rule as to the filename format of F90 module files. In fact, some (mostly old) compilers don't even use module files at all, instead embedding the modules within the object files.

The autoconf package provides a macro, AC_FC_MODULE_EXTENSION, which can be used to determine the file suffix of module files for a compiler, although currently it only handles cases when the file basename is the module name either in upper or lower case. However, there appears no macro that actually returns the format of the module file. For example a module named test could result in one of:
  • test.mod
  • TEST.mod
  • test.MOD
  • TEST.MOD
being created.

As a result I wrote a new macro MAY_FC_MODULE_FILENAME_FORMAT available here which returns the filename format of module files in the variable FC_MODFMT. For the cases listed above the values of FC_MODFMT returned are:
  • %m.mod
  • %M.mod
  • %m.MOD
  • %M.MOD

As mentioned there are other less common possibilities, these are not currently implemented but will be if I need them or if there is demand.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.