You can set and export a number of environment variables for use with the operating system. The following sections deal with the environment variables that have special significance to the XL Fortran compiler, application programs, or both.
You can set the environment variables from shell command lines or from within shell scripts. (For more information about setting environment variables, see the man page help for the shell you are using.) If you are not sure which shell is in use, a quick way to find out is to issue echo $SHELL to show the name of the current shell.
To display the contents of an environment variable, enter the command echo $var_name.
Diagnostic messages and the listings from the compiler appear in the default language that was specified at installation of the operating system. If you want the messages and listings to appear in another language, you can set and export the following environment variables before executing the compiler:
For example, to specify the Japanese locale, set the LANG environment variable to ja_JP.
Substitute any valid national language code for ja_JP, provided the associated message catalogs are installed.
These environment variables are initialized when the operating system is installed and may be different from the ones that you want to use with the compiler.
Each category has an environment variable associated with it. If you want to change the national language for a specific category but not for other categories, you can set and export the corresponding environment variable.
For example:
Notes:
See the Linux-specific documentation and man page help for more information about National Language Support environment variables and locale concepts.
If your executable program is linked with shared libraries, you need to set the run-time library search paths. There are two ways to set run-time library search paths. You can use:
Specifying search paths with the compile/link -R (or -rpath) option has the effect of writing the specified run-time library search paths into the executable program. If you use the -L option, library search paths are searched at link time, but are not written into the executable as run-time library search paths. For example:
# Compile and link xlf95 -L/usr/lib/mydir1 -R/usr/lib/mydir1 -L/usr/lib/mydir2 -R/usr/lib/mydir2 -lmylib1 -lmylib2 test.f # -L directories are searched at link time. # -R directories are searched at run time.
You can also use the LD_LIBRARY_PATH and LD_RUN_PATH environment variables to specify library search paths. Use LD_RUN_PATH to specify the directories that are to be searched for libraries at run time. Use LD_LIBRARY_PATH to specify the directories that are to be searched for libraries at both link and run time.
For more information on linker options and environment variables, see the man pages for the ld command.
When you compile a Fortran 90 program with the -qpdf compiler option, you can specify the directory where profiling information is stored by setting the PDFDIR environment variable to the name of the directory. The compiler creates the files to hold the profile information. XL Fortran updates the files when you run an application that is compiled with the -qpdf1 option.
Because problems can occur if the profiling information is stored in the wrong place or is updated by more than one application, you should follow these guidelines:
The XL Fortran compiler creates a number of temporary files for use during compilation. An XL Fortran application program creates a temporary file at run time for a file opened with STATUS='SCRATCH'. By default, these files are placed in the directory /tmp.
If you want to change the directory where these files are placed, perhaps because /tmp is not large enough to hold all the temporary files, set and export the TMPDIR environment variable before running the compiler or the application program.
If you explicitly name a scratch file by using the XLFSCRATCH_unit method described below, the TMPDIR environment variable has no effect on that file.
To give a specific name to a scratch file, you can set the run-time option scratch_vars=yes; then set one or more environment variables with names of the form XLFSCRATCH_unit to file names to use when those units are opened as scratch files. See Naming Scratch Files for examples.
To give a specific name to an implicitly connected file or a file opened
with no FILE= specifier, you can set the run-time option
unit_vars=yes; then set one or more environment variables with
names of the form XLFUNIT_unit to file names. See Naming Files That Are Connected with No Explicit Name for examples.