Specify Compiler Options in a Configuration File

The default configuration file (/etc/opt/ibmcmp/vac/7.0/vac.cfg) defines values and compiler options for the compiler. The compiler refers to this file when compiling C or C++ programs. The configuration file is a plain text file, and you can make entries to this file to support specific compilation requirements or to support other C or C++ compilation environments.

Most options specified in the configuration file override the default settings of the option. Similarly, most options specified in the configuration file are in turn overridden by options set in the source file and on the command line. Options that do not follow this scheme are listed in Resolving Conflicting Compiler Options.

Tailor a Configuration File

The template for the default configuration file template is installed to /opt/ibmcmp/vac/7.0/etc/vac.base.cfg.

Before using the compiler for the first time, you must use the vac_configure utility to create your own configuration file based on the template file. By default, the vac_configure utility creates the new configuration file at /opt/ibmcmp/vac/7.0/etc/vac.base.cfg. You can later modify the newly created configuration file to support your specific compilation requirements or to support other C or C++ compilation environments. See the Installation Guide for more information on creating configuration files.

You can modify existing stanzas or add new stanzas to a configuration file. For example, to make -qnoro the default for the xlC compiler invocation command, add -qnoro to the xlC stanza in your copied version of the configuration file.

You can link the compiler invocation command to several different names. The name you specify when you invoke the compiler determines which stanza of the configuration file the compiler uses. You can add other stanzas to your copy of the configuration file to customize your own compilation environment. You can use the -F option with the compiler invocation command to make links to select additional stanzas or to specify a specific stanza in another configuration file. For example:

xlc myfile.c -Fmyconfig:SPECIAL

would compile myfile.c using the SPECIAL stanza in a myconfig.cfg configuration file that you had created.

Configuration File Attributes

A configuration file includes several stanzas. The following are just some of the items defined by stanzas in the configuration file:

as Path name to be used for the assembler. The default is /usr/bin/as.
ccomp C Front end. The default is /opt/ibmcmp/vac/7.0/exe/xlcentry.
code Path name to be used for the code generation phase of the compiler. The default is /opt/ibmcmp/vac/7.0/bin/xlCcode.
codeopt List of options for the code-generation phase of the compiler.
crt Path name of the object file passed as the first parameter to the linkage editor. If you do not specify either the -p or the -pg option, the crt value is used. The default is /usr/lib/crt1.o.
csuffix Suffix for source programs. The default is c (lowercase c).
dis Path name of the disassembler. The default is /opt/ibmcmp/vac/7.0/exe/dis.
gcrt Path name of the object file passed as the first parameter to the linkage editor. If you specify the -pg option, the gcrt value is used. The default is /usr/lib/gcrt1.o.
ld Path name to be used to link C or C++ programs. The default is /usr/bin/ld.
ldopt List of options that are directed to the linkage editor part of the compiler. These override all normal processing by the compiler and are directed to the linkage editor. If the corresponding flag takes a parameter, the string is formatted for the getopt() subroutine as a concatenation of flag letters, with a letter followed by a colon (:).
libraries2 Library options, separated by commas, that the compiler passes as the last parameters to the linkage editor. libraries2 specifies the libraries that the linkage editor is to use at link-edit time for both profiling and nonprofiling. The default is empty.
mcrt Path name of the object file passed as the first parameter to the linkage editor if you have specified the -p option. The default is /usr/lib/gcrt1.o.
options A string of option flags, separated by commas, to be processed by the compiler as if they had been entered on the command line.
osuffix The suffix for object files. The default is .o.
use Values for attributes are taken from the named stanza and from the local stanza. For single-valued attributes, values in the use stanza apply if no value is provided in the local, or default, stanza. For comma-separated lists, the values from the use stanza are added to the values from the local stanza.
xlc The path name of the xlc compiler component. The default is /opt/ibmcmp/vac/7.0/bin/xlc.
xlC The path name of the xlC compiler component. The default is /opt/ibmcmp/vacpp/7.0/bin/xlC.

Related Concepts

Compiler Options

Related Tasks

Invoke the Compiler
Specify Compiler Options on the Command Line
Specify Compiler Options in Your Program Source Files
Specify Compiler Options for Architecture-Specific, 32- or 64-bit Compilation
Resolving Conflicting Compiler Options

Related References

Compiler Command Line Options IBM Copyright 2003