Contents|Index|Previous|Next
Environment
variables affecting GNU CC
The following documentation
describes several environment variables that affect how GNU CC operates.
They work by specifying directories or prefixes to use when searching for
various kinds of files.
-
Note:
You can also specify places
to search using options such as ‘-B’,
‘-I’
and ‘-L’
(see Options for directory
search). These take precedence over places specified using environment
variables, which in turn take precedence over those specified by the configuration
of GNU CC.
-
TMPDIR
If TMPDIR
is set, it specifies the directory to use for temporary files. GNU CC uses
temporary files to hold the output of one stage of compilation which is
to be used as input to the next stage: for example, the output of the preprocessor,
which is the input to the compiler proper.
-
GCC_EXEC_PREFIX
If GCC_EXEC_PREFIX
is set, it specifies a prefix to use in the names of the subprograms executed
by the compiler. No slash is added when this prefix is combined with the
name of a subprogram, although you can specify a prefix that ends with
a slash if you wish.
-
If GNU CC cannot find the subprogram
using the specified prefix, it tries looking in the usual places for the
subprogram. The default value of GCC_EXEC_PREFIX
is prefix/lib/gcc-lib/
where prefix
is the value of prefix
when you ran
the configure
script. 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 /usr/local/lib/gcc-lib
(more precisely, with the value of GCC_INCLUDE_DIR),
GNU CC tries replacing that beginning with the specified prefix to produce
an alternate directory name. So, with -Bfoo/,
GNU CC will search foo/bar
where it would normally search /usr/local/lib/bar.
These alternate directories are searched first; the standard directories
come next.
-
COMPILER_PATH
The value of COMPILER_PATH
is a colon-separated list of directories, much like PATH.
GNU CC tries the directories thus specified when searching for subprograms,
if it can’t find the subprograms using GCC_EXEC_PREFIX.
-
LIBRARY_PATH
The value of LIBRARY_PATH
is a colon-separated list of directories, much like PATH.
-
When configured as a native
compiler, GNU CC tries the directories thus specified when searching for
special linker files, if it can’t find them using GCC_EXEC_
PREFIX.
-
Linking using GNU CC also uses
these directories when searching for ordinary libraries for the -l
option (but directories specified with ‘-L’
come first).
-
C_INCLUDE_PATH
-
CPLUS_INCLUDE_PATH
-
OBJC_INCLUDE_PATH
These environment variables
pertain to particular languages. Each variable’s value is a colon-separated
list of directories, much like PATH.
When GNU CC searches for header files, it tries the directories listed
in the variable for the language you are using, after the directories specified
with ‘-I’
but before the standard header file directories.
-
DEPENDENCIES_OUTPUT
If this variable is set,
its value specifies how to output dependencies for Make based on the header
files processed by the compiler. This output looks much like the output
from the ‘-M’
option (see Options
controlling the preprocessor), but it goes to a separate file, and
is in addition to the usual results of compilation. The value of DEPENDENCIES_OUTPUT
can be just a filename, in which case the Make rules are written to that
file, guessing the target name from the source filename. 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.
-
LANG
This variable is used to
pass locale information to the compiler. One way in which this information
is used is to determine the character set to be used when character literals,
string literals and comments are parsed in C and C++. When the compiler
is configured to allow multibyte characters, the following values for LANG
are recognized:
-
C-JIS
Recognize JIS characters.
-
C-SJIS
Recognize SJIS characters.
-
C-EUCJP
Recognize EUCJP characters.
If LANG is not defined, or if
it has some ther value, then the compiler will use mblen
and mbtowc
as defined by the default locale to recognize and translate multibyte characters.
Top|Contents|Index|Previous|Next