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