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>
164 <varlistentry><term><code>--enable-libstdcxx-threads</code></term>
165 <listitem><para>Enable C++11 threads support. If not explicitly specified,
166 the configure process enables it if possible. It defaults to 'off'
167 on Solaris 8 and 9, where it would break symbol versioning. This
168 option can change the library ABI.
170 </listitem></varlistentry>
172 <varlistentry><term><code>--enable-libstdcxx-time</code></term>
173 <listitem><para>This is an abbreviated form of
174 <code>'--enable-libstdcxx-time=yes'</code>(described next).
176 </listitem></varlistentry>
178 <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
179 <listitem><para>Enables link-type checks for the availability of the
180 clock_gettime clocks, used in the implementation of [time.clock],
181 and of the nanosleep and sched_yield functions, used in the
182 implementation of [thread.thread.this] of the 2011 ISO C++ standard.
183 The choice OPTION=yes checks for the availability of the facilities
184 in libc and libposix4. In case of need the latter is also linked
185 to libstdc++ as part of the build process. OPTION=rt also searches
186 (and, in case, links) librt. Note that the latter is not always
187 desirable because, in glibc, for example, in turn it triggers the
188 linking of libpthread too, which activates locking, a large overhead
189 for single-thread programs. OPTION=no skips the tests completely.
190 The default is OPTION=no.
192 </listitem></varlistentry>
194 <varlistentry><term><code>--enable-libstdcxx-debug</code></term>
195 <listitem><para>Build separate debug libraries in addition to what is normally built.
196 By default, the debug libraries are compiled with
197 <code> CXXFLAGS='-g3 -O0 -fno-inline'</code>
198 , are installed in <code>${libdir}/debug</code>, and have the
199 same names and versioning information as the non-debug
200 libraries. This option is off by default.
202 <para>Note this make command, executed in
203 the build directory, will do much the same thing, without the
204 configuration difference and without building everything twice:
205 <code>make CXXFLAGS='-g3 -O0 -fno-inline' all</code>
207 </listitem></varlistentry>
209 <varlistentry><term><code>--enable-libstdcxx-debug-flags=FLAGS</code></term>
211 <listitem><para>This option is only valid when <code> --enable-debug </code>
212 is also specified, and applies to the debug builds only. With
213 this option, you can pass a specific string of flags to the
214 compiler to use when building the debug versions of libstdc++.
215 FLAGS is a quoted string of options, like
218 --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'</programlisting>
219 </listitem></varlistentry>
221 <varlistentry><term><code>--enable-cxx-flags=FLAGS</code></term>
222 <listitem><para>With this option, you can pass a string of -f (functionality)
223 flags to the compiler to use when building libstdc++. This
224 option can change the library ABI. FLAGS is a quoted string of
228 --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</programlisting>
230 Note that the flags don't necessarily have to all be -f flags,
231 as shown, but usually those are the ones that will make sense
232 for experimentation and configure-time overriding.
234 <para>The advantage of --enable-cxx-flags over setting CXXFLAGS in
235 the 'make' environment is that, if files are automatically
236 rebuilt, the same flags will be used when compiling those files
237 as well, so that everything matches.
239 <para>Fun flags to try might include combinations of
245 -fvtable-gc</programlisting>
246 <para>and opposite forms (-fno-) of the same. Tell us (the libstdc++
247 mailing list) if you discover more!
249 </listitem></varlistentry>
251 <varlistentry><term><code>--enable-c99</code></term>
252 <listitem><para>The "long long" type was introduced in C99, along
253 with many other functions for wide characters, and math
254 classification macros, etc. If enabled, all C99 functions not
255 specified by the C++ standard will be put into <code>namespace
256 __gnu_cxx</code>, and then all these names will
257 be injected into namespace std, so that C99 functions can be
258 used "as if" they were in the C++ standard (as they
259 will eventually be in some future revision of the standard,
260 without a doubt). By default, C99 support is on, assuming the
261 configure probes find all the necessary functions and bits
262 necessary. This option can change the library ABI.
264 </listitem></varlistentry>
266 <varlistentry><term><code>--enable-wchar_t</code>[default]</term>
267 <listitem><para>Template specializations for the "wchar_t" type are
268 required for wide character conversion support. Disabling
269 wide character specializations may be expedient for initial
270 porting efforts, but builds only a subset of what is required by
271 ISO, and is not recommended. By default, this option is on.
272 This option can change the library ABI.
274 </listitem></varlistentry>
276 <varlistentry><term><code>--enable-long-long </code></term>
277 <listitem><para>The "long long" type was introduced in C99. It is
278 provided as a GNU extension to C++98 in g++. This flag builds
279 support for "long long" into the library (specialized
280 templates and the like for iostreams). This option is on by default:
281 if enabled, users will have to either use the new-style "C"
282 headers by default (i.e., <cmath> not <math.h>)
283 or add appropriate compile-time flags to all compile lines to
284 allow "C" visibility of this feature (on GNU/Linux,
285 the flag is -D_ISOC99_SOURCE, which is added automatically via
286 CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE).
287 This option can change the library ABI.
289 </listitem></varlistentry>
291 <varlistentry><term><code>--enable-fully-dynamic-string</code></term>
292 <listitem><para>This option enables a special version of basic_string avoiding
293 the optimization that allocates empty objects in static memory.
294 Mostly useful together with shared memory allocators, see PR
295 libstdc++/16612 for details.
297 </listitem></varlistentry>
299 <varlistentry><term><code>--enable-concept-checks</code></term>
300 <listitem><para>This turns on additional compile-time checks for instantiated
301 library templates, in the form of specialized templates,
302 <link linkend="std.diagnostics.concept_checking">described here</link>. They
303 can help users discover when they break the rules of the STL, before
306 </listitem></varlistentry>
308 <varlistentry><term><code>--enable-symvers[=style]</code></term>
310 <listitem><para>In 3.1 and later, tries to turn on symbol versioning in the
311 shared library (if a shared library has been
312 requested). Values for 'style' that are currently supported
313 are 'gnu', 'gnu-versioned-namespace', 'darwin',
314 'darwin-export', and 'sun'. Both gnu- options require that a recent
315 version of the GNU linker be in use. Both darwin options are
316 equivalent. With no style given, the configure script will try
317 to guess correct defaults for the host system, probe to see if
318 additional requirements are necessary and present for
319 activation, and if so, will turn symbol versioning on. This
320 option can change the library ABI.
323 </listitem></varlistentry>
325 <varlistentry><term><code>--enable-libstdcxx-visibility</code></term>
326 <listitem><para> In 4.2 and later, enables or disables visibility
327 attributes. If enabled (as by default), and the compiler seems
328 capable of passing the simple sanity checks thrown at it, adjusts
329 items in namespace std, namespace std::tr1, namespace std::tr2,
330 and namespace __gnu_cxx to have <code>visibility ("default")</code>
331 so that -fvisibility options can be used without affecting the
332 normal external-visibility of namespace std entities.
333 Prior to 4.7 this option was spelled <code>--enable-visibility</code>.
335 </listitem></varlistentry>
337 <varlistentry><term><code>--enable-libstdcxx-pch</code></term>
338 <listitem><para>In 3.4 and later, tries to turn on the generation of
339 stdc++.h.gch, a pre-compiled file including all the standard
340 C++ includes. If enabled (as by default), and the compiler
341 seems capable of passing the simple sanity checks thrown at
342 it, try to build stdc++.h.gch as part of the make process.
343 In addition, this generated file is used later on (by appending <code>
344 --include bits/stdc++.h </code> to CXXFLAGS) when running the
347 </listitem></varlistentry>
350 <varlistentry><term><code>--enable-extern-template</code>[default]</term>
351 <listitem><para>Use extern template to pre-instantiate all required
352 specializations for certain types defined in the standard libraries.
353 These types include <classname>string</classname> and dependents like
354 <classname>char_traits</classname>, the templateized io classes,
355 <classname>allocator</classname>, and others.
356 Disabling means that implicit
357 template generation will be used when compiling these types. By
358 default, this option is on. This option can change the library ABI.
360 </listitem></varlistentry>
362 <varlistentry><term><code>--disable-hosted-libstdcxx</code></term>
365 By default, a complete <emphasis>hosted</emphasis> C++ library is
366 built. The C++ Standard also describes a
367 <emphasis>freestanding</emphasis> environment, in which only a
368 minimal set of headers are provided. This option builds such an
371 </listitem></varlistentry>