HP Fortran Programmer's Guide (March 2010)

Compiling and linking
Using environment variables
Chapter 2 101
$ f90 +list hello.f90
is equivalent to:
$ f90 -v +list hello.f90
The syntax of the HP_F90OPTS variable allows the bar (|) character to be used to specify that
options appearing before | are to be recognized before any options on the command line and
that options appearing after | are to be recognized after any options on the command line.
For example, the commands:
$ export HP_F90OPTS="-O|-lmylib"
$ f90 -v hello.f90
are equivalent to:
$ f90 -O -v hello.f90 -lmylib
If you are programming in the csh, the command line to define HP_F90OPTS would be:
% setenv HP_F90OPTS "-O|-lmylib"
LPATH environment variable
The LPATH environment variable is read by the linker to determine where to look for libraries
to link with a program’s object file. Depending on whether LPATH is set or not, one of the
following actions occurs:
•If LPATH is already set, only the directories listed in LPATH are searched. This happens, for
example, when LPATH is set in a user’s .kshrc or .cshrc file, or after LPATH is defined
from the command line.
•If LPATH is not set, the f90 command sets default LPATH settings that are used when
linking the object files listed on the f90 command line.
Because the f90 command sets LPATH before calling the linker, it should not be necessary to
set this variable for most compilations. However, if you do need to set it (for example, you use
the ld command to link), the following directories should be the first items in LPATH:
/opt/fortran90/lib
/usr/lib
/opt/langtools/lib
The following command lines set LPATH to include these directories, using (respectively) the
ksh and csh syntax:
$ export LPATH:/opt/fortran90/lib:/usr/lib:/opt/langtools/lib
% setenv LPATH "/opt/fortran90/lib:/usr/lib:/opt/langtools/lib"