• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gcc/
1<html lang="en">
2<head>
3<title>Environment Variables - Using the GNU Compiler Collection (GCC)</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Using the GNU Compiler Collection (GCC)">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC">
9<link rel="prev" href="Code-Gen-Options.html#Code-Gen-Options" title="Code Gen Options">
10<link rel="next" href="Precompiled-Headers.html#Precompiled-Headers" title="Precompiled Headers">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Funding Free Software'', the Front-Cover
19Texts being (a) (see below), and with the Back-Cover Texts being (b)
20(see below).  A copy of the license is included in the section entitled
21``GNU Free Documentation License''.
22
23(a) The FSF's Front-Cover Text is:
24
25     A GNU Manual
26
27(b) The FSF's Back-Cover Text is:
28
29     You have freedom to copy and modify this GNU Manual, like GNU
30     software.  Copies published by the Free Software Foundation raise
31     funds for GNU development.-->
32<meta http-equiv="Content-Style-Type" content="text/css">
33<style type="text/css"><!--
34  pre.display { font-family:inherit }
35  pre.format  { font-family:inherit }
36  pre.smalldisplay { font-family:inherit; font-size:smaller }
37  pre.smallformat  { font-family:inherit; font-size:smaller }
38  pre.smallexample { font-size:smaller }
39  pre.smalllisp    { font-size:smaller }
40  span.sc    { font-variant:small-caps }
41  span.roman { font-family:serif; font-weight:normal; } 
42  span.sansserif { font-family:sans-serif; font-weight:normal; } 
43--></style>
44<link rel="stylesheet" type="text/css" href="../cs.css">
45</head>
46<body>
47<div class="node">
48<a name="Environment-Variables"></a>
49<p>
50Next:&nbsp;<a rel="next" accesskey="n" href="Precompiled-Headers.html#Precompiled-Headers">Precompiled Headers</a>,
51Previous:&nbsp;<a rel="previous" accesskey="p" href="Code-Gen-Options.html#Code-Gen-Options">Code Gen Options</a>,
52Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a>
53<hr>
54</div>
55
56<h3 class="section">3.19 Environment Variables Affecting GCC</h3>
57
58<p><a name="index-environment-variables-2385"></a>
59<!-- man begin ENVIRONMENT -->
60This section describes several environment variables that affect how GCC
61operates.  Some of them work by specifying directories or prefixes to use
62when searching for various kinds of files.  Some are used to specify other
63aspects of the compilation environment.
64
65 <p>Note that you can also specify places to search using options such as
66<samp><span class="option">-B</span></samp>, <samp><span class="option">-I</span></samp> and <samp><span class="option">-L</span></samp> (see <a href="Directory-Options.html#Directory-Options">Directory Options</a>).  These
67take precedence over places specified using environment variables, which
68in turn take precedence over those specified by the configuration of GCC. 
69See <a href="../gccint/Driver.html#Driver">Controlling the Compilation Driver <samp><span class="file">gcc</span></samp></a>.
70
71     <dl>
72<dt><samp><span class="env">LANG</span></samp><dt><samp><span class="env">LC_CTYPE</span></samp><dd><!-- @itemx LC_COLLATE -->
73<dt><samp><span class="env">LC_MESSAGES</span></samp><dd><!-- @itemx LC_MONETARY -->
74<!-- @itemx LC_NUMERIC -->
75<!-- @itemx LC_TIME -->
76<dt><samp><span class="env">LC_ALL</span></samp><dd><a name="index-LANG-2386"></a><a name="index-LC_005fCTYPE-2387"></a><!-- @findex LC_COLLATE -->
77<a name="index-LC_005fMESSAGES-2388"></a><!-- @findex LC_MONETARY -->
78<!-- @findex LC_NUMERIC -->
79<!-- @findex LC_TIME -->
80<a name="index-LC_005fALL-2389"></a><a name="index-locale-2390"></a>These environment variables control the way that GCC uses
81localization information which allows GCC to work with different
82national conventions.  GCC inspects the locale categories
83<samp><span class="env">LC_CTYPE</span></samp> and <samp><span class="env">LC_MESSAGES</span></samp> if it has been configured to do
84so.  These locale categories can be set to any value supported by your
85installation.  A typical value is &lsquo;<samp><span class="samp">en_GB.UTF-8</span></samp>&rsquo; for English in the United
86Kingdom encoded in UTF-8.
87
88     <p>The <samp><span class="env">LC_CTYPE</span></samp> environment variable specifies character
89classification.  GCC uses it to determine the character boundaries in
90a string; this is needed for some multibyte encodings that contain quote
91and escape characters that are otherwise interpreted as a string
92end or escape.
93
94     <p>The <samp><span class="env">LC_MESSAGES</span></samp> environment variable specifies the language to
95use in diagnostic messages.
96
97     <p>If the <samp><span class="env">LC_ALL</span></samp> environment variable is set, it overrides the value
98of <samp><span class="env">LC_CTYPE</span></samp> and <samp><span class="env">LC_MESSAGES</span></samp>; otherwise, <samp><span class="env">LC_CTYPE</span></samp>
99and <samp><span class="env">LC_MESSAGES</span></samp> default to the value of the <samp><span class="env">LANG</span></samp>
100environment variable.  If none of these variables are set, GCC
101defaults to traditional C English behavior.
102
103     <br><dt><samp><span class="env">TMPDIR</span></samp><dd><a name="index-TMPDIR-2391"></a>If <samp><span class="env">TMPDIR</span></samp> is set, it specifies the directory to use for temporary
104files.  GCC uses temporary files to hold the output of one stage of
105compilation which is to be used as input to the next stage: for example,
106the output of the preprocessor, which is the input to the compiler
107proper.
108
109     <br><dt><samp><span class="env">GCC_COMPARE_DEBUG</span></samp><dd><a name="index-GCC_005fCOMPARE_005fDEBUG-2392"></a>Setting <samp><span class="env">GCC_COMPARE_DEBUG</span></samp> is nearly equivalent to passing
110<samp><span class="option">-fcompare-debug</span></samp> to the compiler driver.  See the documentation
111of this option for more details.
112
113     <br><dt><samp><span class="env">GCC_EXEC_PREFIX</span></samp><dd><a name="index-GCC_005fEXEC_005fPREFIX-2393"></a>If <samp><span class="env">GCC_EXEC_PREFIX</span></samp> is set, it specifies a prefix to use in the
114names of the subprograms executed by the compiler.  No slash is added
115when this prefix is combined with the name of a subprogram, but you can
116specify a prefix that ends with a slash if you wish.
117
118     <p>If <samp><span class="env">GCC_EXEC_PREFIX</span></samp> is not set, GCC attempts to figure out
119an appropriate prefix to use based on the pathname it is invoked with.
120
121     <p>If GCC cannot find the subprogram using the specified prefix, it
122tries looking in the usual places for the subprogram.
123
124     <p>The default value of <samp><span class="env">GCC_EXEC_PREFIX</span></samp> is
125<samp><var>prefix</var><span class="file">/lib/gcc/</span></samp> where <var>prefix</var> is the prefix to
126the installed compiler. In many cases <var>prefix</var> is the value
127of <code>prefix</code> when you ran the <samp><span class="file">configure</span></samp> script.
128
129     <p>Other prefixes specified with <samp><span class="option">-B</span></samp> take precedence over this prefix.
130
131     <p>This prefix is also used for finding files such as <samp><span class="file">crt0.o</span></samp> that are
132used for linking.
133
134     <p>In addition, the prefix is used in an unusual way in finding the
135directories to search for header files.  For each of the standard
136directories whose name normally begins with &lsquo;<samp><span class="samp">/usr/local/lib/gcc</span></samp>&rsquo;
137(more precisely, with the value of <samp><span class="env">GCC_INCLUDE_DIR</span></samp>), GCC tries
138replacing that beginning with the specified prefix to produce an
139alternate directory name.  Thus, with <samp><span class="option">-Bfoo/</span></samp>, GCC searches
140<samp><span class="file">foo/bar</span></samp> just before it searches the standard directory
141<samp><span class="file">/usr/local/lib/bar</span></samp>. 
142If a standard directory begins with the configured
143<var>prefix</var> then the value of <var>prefix</var> is replaced by
144<samp><span class="env">GCC_EXEC_PREFIX</span></samp> when looking for header files.
145
146     <br><dt><samp><span class="env">COMPILER_PATH</span></samp><dd><a name="index-COMPILER_005fPATH-2394"></a>The value of <samp><span class="env">COMPILER_PATH</span></samp> is a colon-separated list of
147directories, much like <samp><span class="env">PATH</span></samp>.  GCC tries the directories thus
148specified when searching for subprograms, if it can't find the
149subprograms using <samp><span class="env">GCC_EXEC_PREFIX</span></samp>.
150
151     <br><dt><samp><span class="env">LIBRARY_PATH</span></samp><dd><a name="index-LIBRARY_005fPATH-2395"></a>The value of <samp><span class="env">LIBRARY_PATH</span></samp> is a colon-separated list of
152directories, much like <samp><span class="env">PATH</span></samp>.  When configured as a native compiler,
153GCC tries the directories thus specified when searching for special
154linker files, if it can't find them using <samp><span class="env">GCC_EXEC_PREFIX</span></samp>.  Linking
155using GCC also uses these directories when searching for ordinary
156libraries for the <samp><span class="option">-l</span></samp> option (but directories specified with
157<samp><span class="option">-L</span></samp> come first).
158
159     <br><dt><samp><span class="env">LANG</span></samp><dd><a name="index-LANG-2396"></a><a name="index-locale-definition-2397"></a>This variable is used to pass locale information to the compiler.  One way in
160which this information is used is to determine the character set to be used
161when character literals, string literals and comments are parsed in C and C++. 
162When the compiler is configured to allow multibyte characters,
163the following values for <samp><span class="env">LANG</span></samp> are recognized:
164
165          <dl>
166<dt>&lsquo;<samp><span class="samp">C-JIS</span></samp>&rsquo;<dd>Recognize JIS characters. 
167<br><dt>&lsquo;<samp><span class="samp">C-SJIS</span></samp>&rsquo;<dd>Recognize SJIS characters. 
168<br><dt>&lsquo;<samp><span class="samp">C-EUCJP</span></samp>&rsquo;<dd>Recognize EUCJP characters. 
169</dl>
170
171     <p>If <samp><span class="env">LANG</span></samp> is not defined, or if it has some other value, then the
172compiler uses <code>mblen</code> and <code>mbtowc</code> as defined by the default locale to
173recognize and translate multibyte characters. 
174</dl>
175
176<p class="noindent">Some additional environment variables affect the behavior of the
177preprocessor.
178
179<!-- Copyright (C) 1999-2013 Free Software Foundation, Inc. -->
180<!-- This is part of the CPP and GCC manuals. -->
181<!-- For copying conditions, see the file gcc.texi. -->
182<!--  -->
183<!-- Environment variables affecting the preprocessor -->
184<!--  -->
185<!-- If this file is included with the flag ``cppmanual'' set, it is -->
186<!-- formatted for inclusion in the CPP manual; otherwise the main GCC manual. -->
187     <dl>
188<dt><samp><span class="env">CPATH</span></samp><a name="index-CPATH-2398"></a><dt><samp><span class="env">C_INCLUDE_PATH</span></samp><a name="index-C_005fINCLUDE_005fPATH-2399"></a><dt><samp><span class="env">CPLUS_INCLUDE_PATH</span></samp><a name="index-CPLUS_005fINCLUDE_005fPATH-2400"></a><dt><samp><span class="env">OBJC_INCLUDE_PATH</span></samp><a name="index-OBJC_005fINCLUDE_005fPATH-2401"></a><dd><!-- Commented out until ObjC++ is part of GCC: -->
189<!-- @itemx OBJCPLUS_INCLUDE_PATH -->
190Each variable's value is a list of directories separated by a special
191character, much like <samp><span class="env">PATH</span></samp>, in which to look for header files. 
192The special character, <code>PATH_SEPARATOR</code>, is target-dependent and
193determined at GCC build time.  For Microsoft Windows-based targets it is a
194semicolon, and for almost all other targets it is a colon.
195
196     <p><samp><span class="env">CPATH</span></samp> specifies a list of directories to be searched as if
197specified with <samp><span class="option">-I</span></samp>, but after any paths given with <samp><span class="option">-I</span></samp>
198options on the command line.  This environment variable is used
199regardless of which language is being preprocessed.
200
201     <p>The remaining environment variables apply only when preprocessing the
202particular language indicated.  Each specifies a list of directories
203to be searched as if specified with <samp><span class="option">-isystem</span></samp>, but after any
204paths given with <samp><span class="option">-isystem</span></samp> options on the command line.
205
206     <p>In all these variables, an empty element instructs the compiler to
207search its current working directory.  Empty elements can appear at the
208beginning or end of a path.  For instance, if the value of
209<samp><span class="env">CPATH</span></samp> is <code>:/special/include</code>, that has the same
210effect as &lsquo;<samp><span class="samp">-I.&nbsp;-I/special/include<!-- /@w --></span></samp>&rsquo;.
211
212     <!-- man end -->
213     <!-- man begin ENVIRONMENT -->
214     <br><dt><samp><span class="env">DEPENDENCIES_OUTPUT</span></samp><a name="index-DEPENDENCIES_005fOUTPUT-2402"></a><dd><a name="index-dependencies-for-make-as-output-2403"></a>If this variable is set, its value specifies how to output
215dependencies for Make based on the non-system header files processed
216by the compiler.  System header files are ignored in the dependency
217output.
218
219     <p>The value of <samp><span class="env">DEPENDENCIES_OUTPUT</span></samp> can be just a file name, in
220which case the Make rules are written to that file, guessing the target
221name from the source file name.  Or the value can have the form
222&lsquo;<samp><var>file</var> <var>target</var></samp>&rsquo;, in which case the rules are written to
223file <var>file</var> using <var>target</var> as the target name.
224
225     <p>In other words, this environment variable is equivalent to combining
226the options <samp><span class="option">-MM</span></samp> and <samp><span class="option">-MF</span></samp>
227(see <a href="Preprocessor-Options.html#Preprocessor-Options">Preprocessor Options</a>),
228with an optional <samp><span class="option">-MT</span></samp> switch too.
229
230     <br><dt><samp><span class="env">SUNPRO_DEPENDENCIES</span></samp><a name="index-SUNPRO_005fDEPENDENCIES-2404"></a><dd><a name="index-dependencies-for-make-as-output-2405"></a>This variable is the same as <samp><span class="env">DEPENDENCIES_OUTPUT</span></samp> (see above),
231except that system header files are not ignored, so it implies
232<samp><span class="option">-M</span></samp> rather than <samp><span class="option">-MM</span></samp>.  However, the dependence on the
233main input file is omitted. 
234See <a href="Preprocessor-Options.html#Preprocessor-Options">Preprocessor Options</a>. 
235</dl>
236
237<!-- man end -->
238 </body></html>
239
240