1 <section xmlns="http://docbook.org/ns/docbook" version="5.0"
2 xml:id="manual.intro.setup.configure" xreflabel="Configuring">
3 <?dbhtml filename="configure.html"?>
5 <info><title>Configure</title>
22 When configuring libstdc++, you'll have to configure the entire
23 <emphasis>gccsrcdir</emphasis> directory. Consider using the
24 toplevel gcc configuration option
25 <literal>--enable-languages=c++</literal>, which saves time by only
26 building the C++ toolchain.
30 Here are all of the configure options specific to libstdc++. Keep
32 <!-- This SECnn should be the "Choosing Package Options" section. -->
33 <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://sourceware.org/autobook/autobook/autobook_14.html">they
34 all have opposite forms as well</link> (enable/disable and
35 with/without). The defaults are for the <emphasis>current
36 development sources</emphasis>, which may be different than those
37 for released versions.
39 <para>The canonical way to find out the configure options that are
40 available for a given set of libstdc++ sources is to go to the
41 source directory and then type:<command>./configure --help</command>.
45 <varlistentry><term><code>--enable-multilib</code>[default]</term>
46 <listitem><para>This is part of the generic multilib support for building cross
47 compilers. As such, targets like "powerpc-elf" will have
48 libstdc++ built many different ways: "-msoft-float"
49 and not, etc. A different libstdc++ will be built for each of
50 the different multilib versions. This option is on by default.
52 </listitem></varlistentry>
54 <varlistentry><term><code>--enable-sjlj-exceptions</code></term>
55 <listitem><para>Forces old, set-jump/long-jump exception handling model. If
56 at all possible, the new, frame unwinding exception handling routines
57 should be used instead, as they significantly reduce both
58 runtime memory usage and executable size. This option can
59 change the library ABI.
61 </listitem></varlistentry>
63 <varlistentry><term><code>--enable-version-specific-runtime-libs</code></term>
64 <listitem><para>Specify that run-time libraries should be installed in the
65 compiler-specific subdirectory (i.e.,
66 <code>${libdir}/gcc-lib/${target_alias}/${gcc_version}</code>)
67 instead of <code>${libdir}</code>. This option is useful if you
68 intend to use several versions of gcc in parallel. In addition,
69 libstdc++'s include files will be installed in
70 <code>${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++</code>,
71 unless you also specify
72 <literal>--with-gxx-include-dir=</literal><filename class="directory">dirname</filename> during configuration.
74 </listitem></varlistentry>
76 <varlistentry><term><code>--with-gxx-include-dir=<include-files dir></code></term>
77 <listitem><para>Adds support for named libstdc++ include directory. For instance,
78 the following puts all the libstdc++ headers into a directory
79 called "4.4-20090404" instead of the usual
83 --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404</programlisting> </listitem></varlistentry>
85 <varlistentry><term><code>--enable-cstdio</code></term>
86 <listitem><para>This is an abbreviated form of <code>'--enable-cstdio=stdio'</code>
89 </listitem></varlistentry>
91 <varlistentry><term><code>--enable-cstdio=OPTION</code></term>
92 <listitem><para>Select a target-specific I/O package. At the moment, the only
93 choice is to use 'stdio', a generic "C" abstraction.
94 The default is 'stdio'. This option can change the library ABI.
96 </listitem></varlistentry>
98 <varlistentry><term><code>--enable-clocale</code></term>
99 <listitem><para>This is an abbreviated form of <code>'--enable-clocale=generic'</code>
102 </listitem></varlistentry>
104 <varlistentry><term><code>--enable-clocale=OPTION</code></term>
105 <listitem><para>Select a target-specific underlying locale package. The
106 choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix
107 (IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets,
108 'gnu' to specify a model based on functionality from the GNU C
109 library (langinfo/iconv/gettext) (from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://sources.redhat.com/glibc/">glibc</link>, the GNU C
110 library), or 'generic' to use a generic "C"
111 abstraction which consists of "C" locale info.
114 <para>If not explicitly specified, the configure proccess tries
115 to guess the most suitable package from the choices above. The
116 default is 'generic'. On glibc-based systems of sufficient
117 vintage (2.3 and newer), 'gnu' is automatically selected. This option
118 can change the library ABI.
120 </listitem></varlistentry>
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
127 </listitem></varlistentry>
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 See this page for more information on allocator
135 <link linkend="allocator.ext">extensions</link>. This option
136 can change the library ABI.
138 </listitem></varlistentry>
140 <varlistentry><term><code>--enable-cheaders=OPTION</code></term>
141 <listitem><para>This allows the user to define the approach taken for C header
142 compatibility with C++. Options are c, c_std, and c_global.
143 These correspond to the source directory's include/c,
144 include/c_std, and include/c_global, and may also include
145 include/c_compatibility. The default is 'c_global'.
147 </listitem></varlistentry>
149 <varlistentry><term><code>--enable-threads</code></term>
150 <listitem><para>This is an abbreviated form of <code>'--enable-threads=yes'</code>
153 </listitem></varlistentry>
155 <varlistentry><term><code>--enable-threads=OPTION</code></term>
156 <listitem><para>Select a threading library. A full description is
158 general <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gcc.gnu.org/install/configure.html">compiler
159 configuration instructions</link>. This option can change the
162 </listitem></varlistentry>
165 <varlistentry><term><code>--enable-libstdcxx-time</code></term>
166 <listitem><para>This is an abbreviated form of
167 <code>'--enable-libstdcxx-time=yes'</code>(described next).
169 </listitem></varlistentry>
171 <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
172 <listitem><para>Enables link-type checks for the availability of the
173 clock_gettime clocks, used in the implementation of [time.clock],
174 and of the nanosleep and sched_yield functions, used in the
175 implementation of [thread.thread.this] of the current C++0x draft.
176 The choice OPTION=yes checks for the availability of the facilities
177 in libc and libposix4. In case of need the latter is also linked
178 to libstdc++ as part of the build process. OPTION=rt also searches
179 (and, in case, links) librt. Note that the latter is not always
180 desirable because, in glibc, for example, in turn it triggers the
181 linking of libpthread too, which activates locking, a large overhead
182 for single-thread programs. OPTION=no skips the tests completely.
183 The default is OPTION=no.
185 </listitem></varlistentry>
187 <varlistentry><term><code>--enable-libstdcxx-debug</code></term>
188 <listitem><para>Build separate debug libraries in addition to what is normally built.
189 By default, the debug libraries are compiled with
190 <code> CXXFLAGS='-g3 -O0 -fno-inline'</code>
191 , are installed in <code>${libdir}/debug</code>, and have the
192 same names and versioning information as the non-debug
193 libraries. This option is off by default.
195 <para>Note this make command, executed in
196 the build directory, will do much the same thing, without the
197 configuration difference and without building everything twice:
198 <code>make CXXFLAGS='-g3 -O0 -fno-inline' all</code>
200 </listitem></varlistentry>
202 <varlistentry><term><code>--enable-libstdcxx-debug-flags=FLAGS</code></term>
204 <listitem><para>This option is only valid when <code> --enable-debug </code>
205 is also specified, and applies to the debug builds only. With
206 this option, you can pass a specific string of flags to the
207 compiler to use when building the debug versions of libstdc++.
208 FLAGS is a quoted string of options, like
211 --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'</programlisting>
212 </listitem></varlistentry>
214 <varlistentry><term><code>--enable-cxx-flags=FLAGS</code></term>
215 <listitem><para>With this option, you can pass a string of -f (functionality)
216 flags to the compiler to use when building libstdc++. This
217 option can change the library ABI. FLAGS is a quoted string of
221 --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</programlisting>
223 Note that the flags don't necessarily have to all be -f flags,
224 as shown, but usually those are the ones that will make sense
225 for experimentation and configure-time overriding.
227 <para>The advantage of --enable-cxx-flags over setting CXXFLAGS in
228 the 'make' environment is that, if files are automatically
229 rebuilt, the same flags will be used when compiling those files
230 as well, so that everything matches.
232 <para>Fun flags to try might include combinations of
238 -fvtable-gc</programlisting>
239 <para>and opposite forms (-fno-) of the same. Tell us (the libstdc++
240 mailing list) if you discover more!
242 </listitem></varlistentry>
244 <varlistentry><term><code>--enable-c99</code></term>
245 <listitem><para>The "long long" type was introduced in C99, along
246 with many other functions for wide characters, and math
247 classification macros, etc. If enabled, all C99 functions not
248 specified by the C++ standard will be put into <code>namespace
249 __gnu_cxx</code>, and then all these names will
250 be injected into namespace std, so that C99 functions can be
251 used "as if" they were in the C++ standard (as they
252 will eventually be in some future revision of the standard,
253 without a doubt). By default, C99 support is on, assuming the
254 configure probes find all the necessary functions and bits
255 necessary. This option can change the library ABI.
257 </listitem></varlistentry>
259 <varlistentry><term><code>--enable-wchar_t</code>[default]</term>
260 <listitem><para>Template specializations for the "wchar_t" type are
261 required for wide character conversion support. Disabling
262 wide character specializations may be expedient for initial
263 porting efforts, but builds only a subset of what is required by
264 ISO, and is not recommended. By default, this option is on.
265 This option can change the library ABI.
267 </listitem></varlistentry>
269 <varlistentry><term><code>--enable-long-long </code></term>
270 <listitem><para>The "long long" type was introduced in C99. It is
271 provided as a GNU extension to C++98 in g++. This flag builds
272 support for "long long" into the library (specialized
273 templates and the like for iostreams). This option is on by default:
274 if enabled, users will have to either use the new-style "C"
275 headers by default (i.e., <cmath> not <math.h>)
276 or add appropriate compile-time flags to all compile lines to
277 allow "C" visibility of this feature (on GNU/Linux,
278 the flag is -D_ISOC99_SOURCE, which is added automatically via
279 CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE).
280 This option can change the library ABI.
282 </listitem></varlistentry>
284 <varlistentry><term><code>--enable-fully-dynamic-string</code></term>
285 <listitem><para>This option enables a special version of basic_string avoiding
286 the optimization that allocates empty objects in static memory.
287 Mostly useful together with shared memory allocators, see PR
288 libstdc++/16612 for details.
290 </listitem></varlistentry>
292 <varlistentry><term><code>--enable-concept-checks</code></term>
293 <listitem><para>This turns on additional compile-time checks for instantiated
294 library templates, in the form of specialized templates,
295 <link linkend="std.diagnostics.concept_checking">described here</link>. They
296 can help users discover when they break the rules of the STL, before
299 </listitem></varlistentry>
301 <varlistentry><term><code>--enable-symvers[=style]</code></term>
303 <listitem><para>In 3.1 and later, tries to turn on symbol versioning in the
304 shared library (if a shared library has been
305 requested). Values for 'style' that are currently supported
306 are 'gnu', 'gnu-versioned-namespace', 'darwin',
307 'darwin-export', and 'sun'. Both gnu- options require that a recent
308 version of the GNU linker be in use. Both darwin options are
309 equivalent. With no style given, the configure script will try
310 to guess correct defaults for the host system, probe to see if
311 additional requirements are necessary and present for
312 activation, and if so, will turn symbol versioning on. This
313 option can change the library ABI.
316 </listitem></varlistentry>
318 <varlistentry><term><code>--enable-visibility</code></term>
319 <listitem><para> In 4.2 and later, enables or disables visibility attributes.
320 If enabled (as by default), and the compiler seems capable of
321 passing the simple sanity checks thrown at it, adjusts items
322 in namespace std, namespace std::tr1, and namespace __gnu_cxx
323 so that -fvisibility options work.
325 </listitem></varlistentry>
327 <varlistentry><term><code>--enable-libstdcxx-pch</code></term>
328 <listitem><para>In 3.4 and later, tries to turn on the generation of
329 stdc++.h.gch, a pre-compiled file including all the standard
330 C++ includes. If enabled (as by default), and the compiler
331 seems capable of passing the simple sanity checks thrown at
332 it, try to build stdc++.h.gch as part of the make process.
333 In addition, this generated file is used later on (by appending <code>
334 --include bits/stdc++.h </code> to CXXFLAGS) when running the
337 </listitem></varlistentry>
340 <varlistentry><term><code>--enable-extern-template</code>[default]</term>
341 <listitem><para>Use extern template to pre-instantiate all required
342 specializations for certain types defined in the standard libraries.
343 These types include <classname>string</classname> and dependents like
344 <classname>char_traits</classname>, the templateized io classes,
345 <classname>allocator</classname>, and others.
346 Disabling means that implicit
347 template generation will be used when compiling these types. By
348 default, this option is on. This option can change the library ABI.
350 </listitem></varlistentry>
352 <varlistentry><term><code>--disable-hosted-libstdcxx</code></term>
355 By default, a complete <emphasis>hosted</emphasis> C++ library is
356 built. The C++ Standard also describes a
357 <emphasis>freestanding</emphasis> environment, in which only a
358 minimal set of headers are provided. This option builds such an
361 </listitem></varlistentry>