This section describes several environment variables that affect how GCC operates. Some of them work by specifying directories or prefixes to use when searching for various kinds of files. Some are used to specify other aspects of the compilation environment.
Note that you can also specify places to search using options such as -B , -I and -L (see Directory Options ). These take precedence over places specified using environment variables, which in turn take precedence over those specified by the configuration of GCC. See Controlling the Compilation Driver gcc .
The LC_CTYPE environment variable specifies character classification. GCC uses it to determine the character boundaries in a string; this is needed for some multibyte encodings that contain quote and escape characters that are otherwise interpreted as a string end or escape.
The LC_MESSAGES environment variable specifies the language to use in diagnostic messages.
environment variable is set, it overrides the value of
default to the value of the
environment variable. If none of these variables are set, GCC defaults to traditional C English behavior.
If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an appropriate prefix to use based on the pathname it is invoked with.
If GCC cannot find the subprogram using the specified prefix, it tries looking in the usual places for the subprogram.
The default value of
is the prefix to the installed compiler. In many cases prefix
is the value of
when you ran the
Other prefixes specified with -B take precedence over this prefix.
This prefix is also used for finding files such as crt0.o that are used for linking.
In addition, the prefix is used in an unusual way in finding the directories to search for header files. For each of the standard directories whose name normally begins with ‘
’ (more precisely, with the value of
), GCC tries replacing that beginning with the specified prefix to produce an alternate directory name. Thus, with
, GCC searches
just before it searches the standard directory
. If a standard directory begins with the configured prefix
then the value of prefix
is replaced by
when looking for header files.
is not defined, or if it has some other value, then the compiler uses
as defined by the default locale to recognize and translate multibyte characters.
Some additional environment variables affect the behavior of the preprocessor.
PATH_SEPARATOR, is target-dependent and determined at GCC build time. For Microsoft Windows-based targets it is a semicolon, and for almost all other targets it is a colon.
CPATH specifies a list of directories to be searched as if specified with -I , but after any paths given with -I options on the command line. This environment variable is used regardless of which language is being preprocessed.
The remaining environment variables apply only when preprocessing the particular language indicated. Each specifies a list of directories to be searched as if specified with -isystem , but after any paths given with -isystem options on the command line.
In all these variables, an empty element instructs the compiler to search its current working directory. Empty elements can appear at the beginning or end of a path. For instance, if the value of
, that has the same effect as ‘
The value of DEPENDENCIES_OUTPUT can be just a file name, in which case the Make rules are written to that file, guessing the target name from the source file name. Or the value can have the form ‘ file target ’, in which case the rules are written to file file using target as the target name.
In other words, this environment variable is equivalent to combining the options
(see Preprocessor Options
), with an optional
__TIME__macros, so that the embedded timestamps become reproducible.
The value of
must be a UNIX timestamp, defined as the number of seconds (excluding leap seconds) since 01 Jan 1970 00:00:00 represented in ASCII; identical to the output of ‘
’ on GNU/Linux and other systems that support the
extension in the
The value should be a known timestamp such as the last modification time of the source or package and it should be set by the build process.