OSDN Git Service

7fa5a1e14a71bfb2500d4f7460a0763ed40e2a5e
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / doc / xml / manual / configure.xml
1 <sect1 id="manual.intro.setup.configure" xreflabel="Configuring">
2 <?dbhtml filename="configure.html"?>
3  
4 <sect1info>
5   <keywordset>
6     <keyword>
7       ISO C++
8     </keyword>
9     <keyword>
10       configure
11     </keyword>
12     <keyword>
13       options
14     </keyword>
15   </keywordset>
16 </sect1info>
17
18 <title>Configure</title>
19
20 <para>
21   When configuring libstdc++, you'll have to configure the entire
22   <emphasis>gccsrcdir</emphasis> directory. Consider using the
23   toplevel gcc configuration option
24   <literal>--enable-languages=c++</literal>, which saves time by only
25   building the C++ toolchain.
26 </para>
27
28 <para>
29   Here are all of the configure options specific to libstdc++.  Keep
30   in mind that
31    <!-- This SECnn should be the "Choosing Package Options" section. -->
32    <ulink url="http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_131.html#SEC131">they
33    all have opposite forms as well</ulink> (enable/disable and
34    with/without).  The defaults are for the <emphasis>current
35    development sources</emphasis>, which may be different than those
36    for released versions.
37 </para>
38 <para>The canonical way to find out the configure options that are
39    available for a given set of libstdc++ sources is to go to the
40    source directory and then type:<command>./configure --help</command>.
41 </para>
42
43 <variablelist>
44  <varlistentry><term><code>--enable-multilib</code>[default]</term>
45  <listitem><para>This is part of the generic multilib support for building cross
46         compilers.  As such, targets like &quot;powerpc-elf&quot; will have
47         libstdc++ built many different ways:  &quot;-msoft-float&quot;
48         and not, etc.  A different libstdc++ will be built for each of
49         the different multilib versions.  This option is on by default.
50      </para>
51  </listitem></varlistentry>
52
53  <varlistentry><term><code>--enable-sjlj-exceptions</code></term>
54  <listitem><para>Forces old, set-jump/long-jump exception handling model.  If
55         at all possible, the new, frame unwinding exception handling routines
56         should be used instead, as they significantly reduce both
57         runtime memory usage and executable size. This option can
58         change the library ABI.
59      </para>
60  </listitem></varlistentry>
61
62  <varlistentry><term><code>--enable-version-specific-runtime-libs</code></term>
63  <listitem><para>Specify that run-time libraries should be installed in the
64         compiler-specific subdirectory (i.e.,
65         <code>${libdir}/gcc-lib/${target_alias}/${gcc_version}</code>)
66         instead of <code>${libdir}</code>.  This option is useful if you
67         intend to use several versions of gcc in parallel.  In addition,
68         libstdc++'s include files will be installed in
69         <code>${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++</code>,
70         unless you also specify
71        <literal>--with-gxx-include-dir=<filename class="directory">dirname</filename></literal> during configuration.
72      </para>
73  </listitem></varlistentry>
74
75  <varlistentry><term><code>--with-gxx-include-dir=&lt;include-files dir&gt;</code></term>
76  <listitem><para>Adds support for named libstdc++ include directory.  For instance,
77         the following puts all the libstdc++ headers into a directory
78         called &quot;2.97-20001008&quot; instead of the usual
79         &quot;c++/(version)&quot;.
80      </para>
81         <programlisting>
82    --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008</programlisting> </listitem></varlistentry>
83
84  <varlistentry><term><code>--enable-cstdio</code></term>
85  <listitem><para>This is an abbreviated form of <code>'--enable-cstdio=stdio'</code>
86         (described next). This option can change the library ABI.
87      </para>
88  </listitem></varlistentry>
89
90  <varlistentry><term><code>--enable-cstdio=OPTION</code></term>
91  <listitem><para>Select a target-specific I/O package. At the moment, the only
92         choice is to use 'stdio', a generic &quot;C&quot; abstraction.
93         The default is 'stdio'. 
94      </para>
95  </listitem></varlistentry>
96
97  <varlistentry><term><code>--enable-clocale</code></term>
98  <listitem><para>This is an abbreviated form of <code>'--enable-clocale=generic'</code>
99         (described next). This option can change the library ABI.
100      </para>
101  </listitem></varlistentry>
102
103  <varlistentry><term><code>--enable-clocale=OPTION</code></term>
104  <listitem><para>Select a target-specific underlying locale package.  The
105         choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix
106         (IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets,
107         'gnu' to specify a model based on functionality from the GNU C
108         library (langinfo/iconv/gettext) (from <ulink url="http://sources.redhat.com/glibc/">glibc</ulink>, the GNU C
109         library), or 'generic' to use a generic &quot;C&quot;
110         abstraction which consists of &quot;C&quot; locale info.
111      </para>
112
113      <para>As part of the configuration process, the "C" library is
114       probed both for sufficient vintage, and installed locale
115       data. If either of these elements are not present, the C++
116       locale model default to 'generic.' On glibc-based systems of
117       version 2.2.5 and above with installed locale files, 'gnu' is
118       automatically selected.
119      </para>
120  </listitem></varlistentry>
121
122  <varlistentry><term><code>--enable-libstdcxx-allocator</code></term>
123  <listitem><para>This is an abbreviated form of
124         <code>'--enable-libstdcxx-allocator=auto'</code> (described
125         next). This option can change the library ABI.
126      </para>
127  </listitem></varlistentry>
128
129  <varlistentry><term><code>--enable-libstdcxx-allocator=OPTION  </code></term>
130  <listitem><para>Select a target-specific underlying std::allocator.  The
131         choices are 'new' to specify a wrapper for new, 'malloc' to
132         specify a wrapper for malloc, 'mt' for a fixed power of two allocator,
133         'pool' for the SGI pooled allocator or 'bitmap' for a bitmap allocator.
134         This option can change the library ABI. See this page for more information on allocator 
135         <link linkend="allocator.ext">extensions</link>
136      </para>
137  </listitem></varlistentry>
138
139  <varlistentry><term><code>--enable-cheaders=OPTION</code></term>
140  <listitem><para>This allows the user to define the approach taken for C header
141         compatibility with C++. Options are c, c_std, and c_global.
142         These correspond to the source directory's include/c,
143         include/c_std, and include/c_global, and may also include
144         include/c_compatibility.  The default is c_global.
145      </para>
146  </listitem></varlistentry>
147
148  <varlistentry><term><code>--enable-threads</code></term>
149  <listitem><para>This is an abbreviated form of <code>'--enable-threads=yes'</code>
150         (described next). This option can change the library ABI.
151      </para>
152  </listitem></varlistentry>
153
154  <varlistentry><term><code>--enable-threads=OPTION</code></term>
155  <listitem><para>Select a threading library.  A full description is given in the
156         general <ulink url="http://gcc.gnu.org/install/configure.html">compiler
157         configuration instructions</ulink>.
158      </para>
159  </listitem></varlistentry>
160
161  <varlistentry><term><code>--enable-libstdcxx-debug</code></term>
162  <listitem><para>Build separate debug libraries in addition to what is normally built.
163         By default, the debug libraries are compiled with 
164         <code> CXXFLAGS='-g3 -O0 -fno-inline'</code>
165         , are installed in <code>${libdir}/debug</code>, and have the
166         same names and versioning information as the non-debug
167         libraries. This option is off by default.
168      </para>
169      <para>Note this make command, executed in
170         the build directory, will do much the same thing, without the
171         configuration difference and without building everything twice: 
172         <code>make CXXFLAGS='-g3 -O0 -fno-inline' all</code>
173      </para>
174  </listitem></varlistentry>
175
176  <varlistentry><term><code>--enable-libstdcxx-debug-flags=FLAGS</code></term>
177
178  <listitem><para>This option is only valid when <code> --enable-debug </code>
179         is also specified, and applies to the debug builds only. With
180         this option, you can pass a specific string of flags to the
181         compiler to use when building the debug versions of libstdc++.
182         FLAGS is a quoted string of options, like
183      </para>
184         <programlisting>
185   --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'</programlisting>
186  </listitem></varlistentry>
187
188  <varlistentry><term><code>--enable-cxx-flags=FLAGS</code></term>
189  <listitem><para>With this option, you can pass a string of -f (functionality)
190         flags to the compiler to use when building libstdc++. This
191         option can change the library ABI. FLAGS is a quoted string of
192         options, like
193      </para>
194         <programlisting>
195   --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</programlisting>
196      <para>
197         Note that the flags don't necessarily have to all be -f flags,
198         as shown, but usually those are the ones that will make sense
199         for experimentation and configure-time overriding.
200      </para>
201      <para>The advantage of --enable-cxx-flags over setting CXXFLAGS in
202         the 'make' environment is that, if files are automatically
203         rebuilt, the same flags will be used when compiling those files
204         as well, so that everything matches.
205      </para>
206      <para>Fun flags to try might include combinations of
207      </para>
208         <programlisting>
209   -fstrict-aliasing
210   -fno-exceptions
211   -ffunction-sections
212   -fvtable-gc</programlisting>
213      <para>and opposite forms (-fno-) of the same.  Tell us (the libstdc++
214         mailing list) if you discover more!
215      </para>
216  </listitem></varlistentry>
217
218  <varlistentry><term><code>--enable-c99</code></term>
219  <listitem><para>The &quot;long long&quot; type was introduced in C99, along
220         with many other functions for wide characters, and math
221         classification macros, etc.  If enabled, all C99 functions not
222         specified by the C++ standard will be put into <code>namespace
223         __gnu_cxx</code>, and then all these names will
224         be injected into namespace std, so that C99 functions can be
225         used &quot;as if&quot; they were in the C++ standard (as they
226         will eventually be in some future revision of the standard,
227         without a doubt).  By default, C99 support is on, assuming the
228         configure probes find all the necessary functions and bits
229         necessary. This option can change the library ABI.
230     </para>
231  </listitem></varlistentry>
232
233  <varlistentry><term><code>--enable-wchar_t</code>[default]</term>
234  <listitem><para>Template specializations for the &quot;wchar_t&quot; type are
235         required for wide character conversion support.  Disabling
236         wide character specializations may be expedient for initial
237         porting efforts, but builds only a subset of what is required by
238         ISO, and is not recommended.  By default, this option is on.
239         This option can change the library ABI.
240      </para>
241  </listitem></varlistentry>
242
243  <varlistentry><term><code>--enable-long-long  </code></term>
244  <listitem><para>The &quot;long long&quot; type was introduced in C99.  It is
245         provided as a GNU extension to C++98 in g++.  This flag builds
246         support for &quot;long long&quot; into the library (specialized
247         templates and the like for iostreams).  This option is on by default:
248         if enabled, users will have to either use the new-style &quot;C&quot;
249         headers by default (i.e., &lt;cmath&gt; not &lt;math.h&gt;)
250         or add appropriate compile-time flags to all compile lines to
251         allow &quot;C&quot; visibility of this feature (on GNU/Linux,
252         the flag is -D_ISOC99_SOURCE, which is added automatically via
253         CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE).
254         This option can change the library ABI. 
255      </para>
256  </listitem></varlistentry>
257
258  <varlistentry><term><code>--enable-fully-dynamic-string</code></term>
259  <listitem><para>This option enables a special version of basic_string avoiding
260         the optimization that allocates empty objects in static memory.
261         Mostly useful together with shared memory allocators, see PR
262         libstdc++/16612 for details.
263      </para>
264  </listitem></varlistentry>
265
266  <varlistentry><term><code>--enable-concept-checks</code></term>
267  <listitem><para>This turns on additional compile-time checks for instantiated
268         library templates, in the form of specialized templates,
269         <link linkend="manual.diagnostics.concept_checking">described here</link>.  They
270         can help users discover when they break the rules of the STL, before
271         their programs run.
272      </para>
273  </listitem></varlistentry>
274
275  <varlistentry><term><code>--enable-symvers[=style]</code></term>
276
277  <listitem><para>In 3.1 and later, tries to turn on symbol versioning in the
278         shared library (if a shared library has been
279         requested). Values for 'style' that are currently supported
280         are 'gnu', 'gnu-versioned-namespace', 'darwin', and
281         'darwin-export'. Both gnu- options require that a recent
282         version of the GNU linker be in use. Both darwin options are
283         equivalent. With no style given, the configure script will try
284         to guess correct defaults for the host system, probe to see if
285         additional requirements are necessary and present for
286         activation, and if so, will turn symbol versioning on. This
287         option can change the library ABI.
288      </para>
289
290  </listitem></varlistentry>
291
292  <varlistentry><term><code>--enable-visibility</code></term>
293  <listitem><para> In 4.2 and later, enables or disables visibility attributes.
294         If enabled (as by default), and the compiler seems capable of
295         passing the simple sanity checks thrown at it, adjusts items
296         in namespace std, namespace std::tr1, and namespace __gnu_cxx
297         so that -fvisibility options work.
298     </para>
299  </listitem></varlistentry>
300
301  <varlistentry><term><code>--enable-libstdcxx-pch</code></term>
302  <listitem><para>In 3.4 and later, tries to turn on the generation of
303         stdc++.h.gch, a pre-compiled file including all the standard
304         C++ includes. If enabled (as by default), and the compiler
305         seems capable of passing the simple sanity checks thrown at
306         it, try to build stdc++.h.gch as part of the make process. 
307         In addition, this generated file is used later on (by appending <code>
308         --include bits/stdc++.h </code> to CXXFLAGS) when running the
309         testsuite.
310      </para>
311  </listitem></varlistentry>
312
313  <varlistentry><term><code>--disable-hosted-libstdcxx</code></term>
314  <listitem>
315    <para>
316      By default, a complete <emphasis>hosted</emphasis> C++ library is
317      built.  The C++ Standard also describes a
318      <emphasis>freestanding</emphasis> environment, in which only a
319      minimal set of headers are provided.  This option builds such an
320      environment.
321      </para>
322  </listitem></varlistentry>
323
324  <varlistentry><term><code>--enable-clock-gettime</code></term>
325  <listitem><para>This is an abbreviated form of
326         <code>'--enable-clock-gettime=yes'</code>(described next).
327      </para>
328  </listitem></varlistentry>
329
330  <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
331  <listitem><para>Enables link-type checks for the availability of the
332         clock_gettime clocks, used in the implementation of [time.clock],
333         and of the nanosleep and sched_yield functions, used in the
334         implementation of [thread.thread.this] of the current C++0x draft.
335         The choice OPTION=yes checks for the availability of the facilities
336         in libc and libposix4.  In case of need the latter is also linked
337         to libstdc++ as part of the build process.  OPTION=rt also searches
338         (and, in case, links) librt.   Note that the latter is not always
339         desirable because, in glibc, for example, in turn it triggers the
340         linking of libpthread too, which activates locking, a large overhead
341         for single-thread programs.  OPTION=no skips the tests completely.
342         The default is OPTION=no.
343     </para>
344  </listitem></varlistentry>
345
346 </variablelist>
347
348 </sect1>