The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


fort77 - FORTRAN compiler (FORTRAN)


fort77 [-c][-g][-L directory]... [-O optlevel][-o outfile][-s][-w]


The fort77 utility is the interface to the FORTRAN compilation system; it will accept the full FORTRAN-77 language defined by the ANSI X3.9-1978 standard. The system conceptually consists of a compiler and link editor. The files referenced by operands are compiled and linked to produce an executable file. It is unspecified whether the linking occurs entirely within the operation of fort77; some systems may produce objects that are not fully resolved until the file is executed.

If the -c option is present, for all pathname operands of the form file.f the files:

$(basename pathname .f).o

will be created or overwritten as the result of successful compilation. If the -c option is not specified, it is unspecified whether such .o files are created or deleted for the file.f operands.

If there are no options that prevent link editing (such as -c) and all operands compile and link without error, the resulting executable file will be written into the file named by the -o option (if present) or to the file a.out. The executable file will be created as specified in the XSH specification, except that the file permissions will be set to:

and that the bits specified by the umask of the process will be cleared.


The fort77 utility supports the XBD specification, Utility Syntax Guidelines  , except that:

The following options are supported:

Suppress the link-edit phase of the compilation, and do not remove any object files that are produced.
Produce symbolic information in the object or executable files; the nature of this information is unspecified, and may be modified by implementation-dependent interactions with other options.
Produce object or executable files, or both, from which symbolic and other information not required for proper execution using the XSH specification exec family has been removed (stripped). If both -g and -s options are present, the action taken is unspecified.
-o outfile
Use the pathname outfile, instead of the default a.out, for the executable file produced. If the -o option is present with -c, the result is unspecified.
-L directory
Change the algorithm of searching for the libraries named in -l operands to look in the directory named by the directory pathname before looking in the usual places. Directories named in -L options will be searched in the specified order. At least ten instances of this option will be supported in a single fort77 command invocation. If a directory specified by a -L option contains a file named libf.a, the results are unspecified.
-O optlevel
Specify the level of code optimisation. If the optlevel option-argument is the digit 0, all special code optimisations will be disabled. If it is the digit 1, the nature of the optimisation is unspecified. If the -O option is omitted, the nature of the system's default optimisation is unspecified. It is unspecified whether code generated in the presence of the -O 0 option is the same as that generated when -O is omitted. Other optlevel values may be supported.
Suppress warnings.

Multiple instances of -L options can be specified.


An operand is either in the form of a pathname or the form -l library. At least one operand of the pathname form will be specified. The following operands are supported:
The pathname of a FORTRAN source file to be compiled and optionally passed to the link editor. The filename operand will be of this form if the -c option is used.
A library of object files typically produced by ar, and passed directly to the link editor. Implementations may recognise implementation-dependent suffixes other than .a as denoting object file libraries.
An object file produced by fort77 -c and passed directly to the link editor. Implementations may recognise implementation-dependent suffixes other than .o as denoting object files.

The processing of other files is implementation-dependent.

-l library
(The letter ell.) Search the library named:


A library is searched when its name is encountered, so the placement of a -l operand is significant. Several standard libraries can be specified in this manner, as described in the EXTENDED DESCRIPTION section. Implementations may recognise implementation-dependent suffixes other than .a as denoting libraries.


Not used.


The input file must be one of the following: a text file containing FORTRAN source code; an object file in the format produced by fort77 -c; or a library of object files, in the format produced by archiving zero or more object files, using ar. Implementations may supply additional utilities that produce files in these formats. Additional input files are implementation-dependent.

A tab character encountered within the first six characters on a line of source code will cause the compiler to interpret the following character as if it were the seventh character on the line (that is, in column 7).


The following environment variables affect the execution of fort77:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
Determine the location of message catalogues for the processing of LC_MESSAGES .
Determine the pathname that should override the default directory for temporary files, if any.




Not used.


Used only for diagnostic messages. If more than one file operand ending in .f (or possibly other unspecified suffixes) is given, for each such file:

"%s:\n", <file> may be written to allow identification of the diagnostic message with the appropriate input file.

This utility may produce warning messages about certain conditions that do not warrant returning an error (non-zero) exit value.


Object files, listing files and executable files are produced in unspecified formats.


 Standard Libraries
The fort77 utility recognises the following -l operand for the standard library:
-l f
This library contains all library functions referenced in the ANSI X3.9-1978 standard. This operand is not required to be present to cause a search of this library.

In the absence of options that inhibit invocation of the link editor, such as -c, the fort77 utility will cause the equivalent of a -l f operand to be passed to the link editor as the last -l operand, causing it to be searched after all other object files and libraries are loaded.

It is unspecified whether the library libf.a exists as a regular file. The implementation may accept as -l operands names of objects that do not exist as regular files.

 External Symbols
The FORTRAN compiler and link editor support the significance of external symbols up to a length of at least 31 bytes; case folding is permitted. The action taken upon encountering symbols exceeding the implementation-dependent maximum symbol length is unspecified.

The compiler and link editor support a minimum of 511 external symbols per source or object file, and a minimum of 4095 external symbols total. A diagnostic message is written to standard output if the implementation-dependent limit is exceeded; other actions are unspecified.


The following exit values are returned:
Successful compilation or link edit.
An error occurred.


When fort77 encounters a compilation error, it will write a diagnostic to standard error and continue to compile other source code operands. It will return a non-zero exit status, but it is implementation-dependent whether an object module is created. If the link edit is unsuccessful, a diagnostic message will be written to standard error, and fort77 will exit with a non-zero status.




The following are examples of usage:
fort77 -o foo xyz.f
Compiles xyz.f and creates the executable file foo.
fort77 -c xyz.f
Compiles xyz.f and creates the object file xyz.o.
fort77 xyz.f
Compiles xyz.f and creates the executable file a.out.
fort77 xyz.f b.o
Compiles xyz.f, links it with b.o and creates the executable a.out.


A compilation system based on FORTRAN-90 (ISO/IEC 1539:1991) will be considered for a future issue; it may have a different utility name from fort77.


ar, asa, c89, umask.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]