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