1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Configure</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><meta name="keywords" content="ISO C++, configure, options" /><meta name="keywords" content="ISO C++, library" /><meta name="keywords" content="ISO C++, runtime, library" /><link rel="home" href="../index.html" title="The GNU C++ Library" /><link rel="up" href="setup.html" title="Chapter��2.��Setup" /><link rel="prev" href="setup.html" title="Chapter��2.��Setup" /><link rel="next" href="make.html" title="Make" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Configure</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="setup.html">Prev</a>��</td><th width="60%" align="center">Chapter��2.��Setup</th><td width="20%" align="right">��<a accesskey="n" href="make.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.intro.setup.configure"></a>Configure</h2></div></div></div><p> 3 When configuring libstdc++, you'll have to configure the entire 4 <span class="emphasis"><em>gccsrcdir</em></span> directory. Consider using the 5 toplevel gcc configuration option 6 <code class="literal">--enable-languages=c++</code>, which saves time by only 7 building the C++ toolchain. 8</p><p> 9 Here are all of the configure options specific to libstdc++. Keep 10 in mind that 11 12 <a class="link" href="http://sourceware.org/autobook/autobook/autobook_14.html" target="_top">they 13 all have opposite forms as well</a> (enable/disable and 14 with/without). The defaults are for the <span class="emphasis"><em>current 15 development sources</em></span>, which may be different than those 16 for released versions. 17</p><p>The canonical way to find out the configure options that are 18 available for a given set of libstdc++ sources is to go to the 19 source directory and then type: <span class="command"><strong>./configure --help</strong></span>. 20</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="code">--enable-multilib</code>[default]</span></dt><dd><p>This is part of the generic multilib support for building cross 21 compilers. As such, targets like "powerpc-elf" will have 22 libstdc++ built many different ways: "-msoft-float" 23 and not, etc. A different libstdc++ will be built for each of 24 the different multilib versions. This option is on by default. 25 </p></dd><dt><span class="term"><code class="code">--enable-version-specific-runtime-libs</code></span></dt><dd><p>Specify that run-time libraries should be installed in the 26 compiler-specific subdirectory (i.e., 27 <code class="code">${libdir}/gcc-lib/${target_alias}/${gcc_version}</code>) 28 instead of <code class="code">${libdir}</code>. This option is useful if you 29 intend to use several versions of gcc in parallel. In addition, 30 libstdc++'s include files will be installed in 31 <code class="code">${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++</code>, 32 unless you also specify 33 <code class="literal">--with-gxx-include-dir=</code><code class="filename">dirname</code> during configuration. 34 </p></dd><dt><span class="term"><code class="code">--with-gxx-include-dir=<include-files dir></code></span></dt><dd><p>Adds support for named libstdc++ include directory. For instance, 35 the following puts all the libstdc++ headers into a directory 36 called "4.4-20090404" instead of the usual 37 "c++/(version)". 38 </p><pre class="programlisting"> 39 --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404</pre></dd><dt><span class="term"><code class="code">--enable-cstdio</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-cstdio=stdio'</code> 40 (described next). 41 </p></dd><dt><span class="term"><code class="code">--enable-cstdio=OPTION</code></span></dt><dd><p>Select a target-specific I/O package. The choices are 'stdio' 42 which is a generic abstraction using POSIX file I/O APIs 43 (<code class="function">read</code>, <code class="function">write</code>, 44 <code class="function">lseek</code>, etc.), and 'stdio_pure' which is similar 45 but only uses standard C file I/O APIs (<code class="function">fread</code>, 46 <code class="function">fwrite</code>, <code class="function">fseek</code>, etc.). 47 The 'stdio_posix' choice is a synonym for 'stdio'. 48 The default is 'stdio'. This option can change the library ABI. 49 </p></dd><dt><span class="term"><code class="code">--enable-clocale</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-clocale=generic'</code> 50 (described next). 51 </p></dd><dt><span class="term"><code class="code">--enable-clocale=OPTION</code></span></dt><dd><p>Select a target-specific underlying locale package. The 52 choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix 53 (IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets, 54 'gnu' to specify a model based on functionality from the GNU C 55 library (langinfo/iconv/gettext) (from <a class="link" href="https://www.gnu.org/software/libc/" target="_top">glibc</a>, the GNU C 56 library), 'generic' to use a generic "C" abstraction which consists 57 of "C" locale info, 'newlib' to specify the Newlib C library model 58 which only differs from the 'generic' model in the handling of 59 ctype, or 'darwin' which omits the <span class="type">wchar_t</span> specializations 60 needed by the 'generic' model. 61 </p><p>If not explicitly specified, the configure process tries 62 to guess the most suitable package from the choices above. The 63 default is 'generic'. On glibc-based systems of sufficient 64 vintage (2.3 and newer), 'gnu' is automatically selected. On newlib-based 65 systems (<code class="code">'--with_newlib=yes'</code>) and OpenBSD, 'newlib' is 66 automatically selected. On Mac OS X 'darwin' is automatically selected. 67 This option can change the library ABI. 68 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-allocator</code></span></dt><dd><p>This is an abbreviated form of 69 <code class="code">'--enable-libstdcxx-allocator=auto'</code> (described 70 next). 71 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-allocator=OPTION </code></span></dt><dd><p>Select a target-specific underlying std::allocator. The 72 choices are 'new' to specify a wrapper for new, and 'malloc' to 73 specify a wrapper for malloc. 74 See <a class="xref" href="memory.html#allocator.ext" title="Extension Allocators">the section called ���Extension Allocators���</a> for more information. 75 This option can change the library ABI. 76 </p></dd><dt><span class="term"><code class="code">--enable-cheaders=OPTION</code></span></dt><dd><p>This allows the user to define the approach taken for C header 77 compatibility with C++. Options are c, c_std, and c_global. 78 These correspond to the source directory's include/c, 79 include/c_std, and include/c_global, and may also include 80 include/c_compatibility. The default is 'c_global'. 81 </p></dd><dt><span class="term"><code class="code">--enable-threads</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-threads=yes'</code> 82 (described next). 83 </p></dd><dt><span class="term"><code class="code">--enable-threads=OPTION</code></span></dt><dd><p>Select a threading library. A full description is 84 given in the 85 general <a class="link" href="http://gcc.gnu.org/install/configure.html" target="_top">compiler 86 configuration instructions</a>. This option can change the 87 library ABI. 88 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-threads</code></span></dt><dd><p>Enable C++11 threads support. If not explicitly specified, 89 the configure process enables it if possible. This 90 option can change the library ABI. 91 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-time</code></span></dt><dd><p>This is an abbreviated form of 92 <code class="code">'--enable-libstdcxx-time=yes'</code>(described next). 93 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-time=OPTION</code></span></dt><dd><p>Enables link-type checks for the availability of the 94 <code class="function">clock_gettime</code> clocks, used in the implementation 95 of [time.clock], and of the <code class="function">nanosleep</code> and 96 <code class="function">sched_yield</code> functions, used in the 97 implementation of [thread.thread.this] of the 2011 ISO C++ standard. 98 The choice OPTION=yes checks for the availability of the facilities 99 in libc. OPTION=rt also checks in 100 librt (and, if it's needed, links to it). Note that linking to librt 101 is not always desirable because for glibc it requires linking to 102 libpthread too, which causes all reference counting to use atomic 103 operations, resulting in a potentially large overhead for 104 single-threaded programs. OPTION=no skips the tests completely. 105 The default is OPTION=auto, which skips the checks and enables the 106 features only for targets known to support them. 107 For Linux targets, if <code class="function">clock_gettime</code> is not used 108 then the [time.clock] implementation will use a system call to access 109 the realtime and monotonic clocks, which is significantly slower than 110 the C library's <code class="function">clock_gettime</code> function. 111 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-debug</code></span></dt><dd><p>Build separate debug libraries in addition to what is normally built. 112 By default, the debug libraries are compiled with 113 <code class="code"> CXXFLAGS='-g3 -O0 -fno-inline'</code> 114 , are installed in <code class="code">${libdir}/debug</code>, and have the 115 same names and versioning information as the non-debug 116 libraries. This option is off by default. 117 </p><p>Note this make command, executed in 118 the build directory, will do much the same thing, without the 119 configuration difference and without building everything twice: 120 <code class="code">make CXXFLAGS='-g3 -O0 -fno-inline' all</code> 121 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-debug-flags=FLAGS</code></span></dt><dd><p>This option is only valid when 122 <code class="code">--enable-libstdcxx-debug</code> 123 is also specified, and applies to the debug builds only. With 124 this option, you can pass a specific string of flags to the 125 compiler to use when building the debug versions of libstdc++. 126 FLAGS is a quoted string of options, like 127 </p><pre class="programlisting"> 128 --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'</pre></dd><dt><span class="term"><code class="code">--enable-cxx-flags=FLAGS</code></span></dt><dd><p>With this option, you can pass a string of -f (functionality) 129 flags to the compiler to use when building libstdc++. This 130 option can change the library ABI. FLAGS is a quoted string of 131 options, like 132 </p><pre class="programlisting"> 133 --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'</pre><p> 134 Note that the flags don't necessarily have to all be -f flags, 135 as shown, but usually those are the ones that will make sense 136 for experimentation and configure-time overriding. 137 </p><p>The advantage of --enable-cxx-flags over setting CXXFLAGS in 138 the 'make' environment is that, if files are automatically 139 rebuilt, the same flags will be used when compiling those files 140 as well, so that everything matches. 141 </p><p>Fun flags to try might include combinations of 142 </p><pre class="programlisting"> 143 -fstrict-aliasing 144 -fno-exceptions 145 -ffunction-sections 146 -fvtable-gc</pre><p>and opposite forms (-fno-) of the same. Tell us (the libstdc++ 147 mailing list) if you discover more! 148 </p></dd><dt><span class="term"><code class="code">--enable-c99</code></span></dt><dd><p>The <span class="type">long long</span> type was introduced in C99, along 149 with many other functions for wide characters, and math 150 classification macros, etc. If enabled, all C99 functions not 151 specified by the C++ standard will be put into <code class="code">namespace 152 __gnu_cxx</code>, and then all these names will 153 be injected into namespace std, so that C99 functions can be 154 used "as if" they were in the C++ standard (as they 155 will eventually be in some future revision of the standard, 156 without a doubt). By default, C99 support is on, assuming the 157 configure probes find all the necessary functions and bits 158 necessary. This option can change the library ABI. 159 </p></dd><dt><span class="term"><code class="code">--enable-wchar_t</code>[default]</span></dt><dd><p>Template specializations for the <span class="type">wchar_t</span> type are 160 required for wide character conversion support. Disabling 161 wide character specializations may be expedient for initial 162 porting efforts, but builds only a subset of what is required by 163 ISO, and is not recommended. By default, this option is on. 164 This option can change the library ABI. 165 </p></dd><dt><span class="term"><code class="code">--enable-long-long </code></span></dt><dd><p>The <span class="type">long long</span> type was introduced in C99. It is 166 provided as a GNU extension to C++98 in g++. This flag builds 167 support for "long long" into the library (specialized 168 templates and the like for iostreams). This option is on by default: 169 if enabled, users will have to either use the new-style "C" 170 headers by default (i.e., <cmath> not <math.h>) 171 or add appropriate compile-time flags to all compile lines to 172 allow "C" visibility of this feature (on GNU/Linux, 173 the flag is -D_ISOC99_SOURCE, which is added automatically via 174 CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE). 175 This option can change the library ABI. 176 </p></dd><dt><span class="term"><code class="code">--enable-fully-dynamic-string</code></span></dt><dd><p>This option enables a special version of basic_string avoiding 177 the optimization that allocates empty objects in static memory. 178 Mostly useful together with shared memory allocators, see PR 179 libstdc++/16612 for details. 180 </p></dd><dt><span class="term"><code class="code">--enable-concept-checks</code></span></dt><dd><p>This turns on additional compile-time checks for instantiated 181 library templates, in the form of specialized templates described in 182 the <a class="link" href="concept_checking.html" title="Concept Checking">Concept 183 Checking</a> section. They 184 can help users discover when they break the rules of the STL, before 185 their programs run. These checks are based on C++03 rules and some of 186 them are not compatible with correct C++11 code. 187 </p></dd><dt><span class="term"><code class="code">--enable-symvers[=style]</code></span></dt><dd><p>In 3.1 and later, tries to turn on symbol versioning in the 188 shared library (if a shared library has been 189 requested). Values for 'style' that are currently supported 190 are 'gnu', 'gnu-versioned-namespace', 'darwin', 191 'darwin-export', and 'sun'. Both gnu- options require that a recent 192 version of the GNU linker be in use. Both darwin options are 193 equivalent. With no style given, the configure script will try 194 to guess correct defaults for the host system, probe to see if 195 additional requirements are necessary and present for 196 activation, and if so, will turn symbol versioning on. This 197 option can change the library ABI. 198 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-visibility</code></span></dt><dd><p> In 4.2 and later, enables or disables visibility 199 attributes. If enabled (as by default), and the compiler seems 200 capable of passing the simple sanity checks thrown at it, adjusts 201 items in namespace std, namespace std::tr1, namespace std::tr2, 202 and namespace __gnu_cxx to have <code class="code">visibility ("default")</code> 203 so that -fvisibility options can be used without affecting the 204 normal external-visibility of namespace std entities. 205 Prior to 4.7 this option was spelled <code class="code">--enable-visibility</code>. 206 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-pch</code></span></dt><dd><p>In 3.4 and later, tries to turn on the generation of 207 stdc++.h.gch, a pre-compiled file including all the standard 208 C++ includes. If enabled (as by default), and the compiler 209 seems capable of passing the simple sanity checks thrown at 210 it, try to build stdc++.h.gch as part of the make process. 211 In addition, this generated file is used later on (by appending 212 <code class="code">-include bits/stdc++.h</code> to CXXFLAGS) when running the 213 testsuite. 214 </p></dd><dt><span class="term"><code class="code">--enable-extern-template</code>[default]</span></dt><dd><p>Use extern template to pre-instantiate all required 215 specializations for certain types defined in the standard libraries. 216 These types include <code class="classname">string</code> and dependents like 217 <code class="classname">char_traits</code>, the templatized IO classes, 218 <code class="classname">allocator</code>, and others. 219 Disabling means that implicit 220 template generation will be used when compiling these types. By 221 default, this option is on. This option can change the library ABI. 222 </p></dd><dt><span class="term"><code class="code">--disable-hosted-libstdcxx</code></span></dt><dd><p> 223 By default, a complete <span class="emphasis"><em>hosted</em></span> C++ library is 224 built. The C++ Standard also describes a 225 <span class="emphasis"><em>freestanding</em></span> environment, in which only a 226 minimal set of headers are provided. This option builds such an 227 environment. 228 </p></dd><dt><span class="term"><code class="code">--disable-libstdcxx-verbose</code></span></dt><dd><p> 229 By default, the library is configured to write descriptive messages 230 to standard error for certain events such as calling a pure virtual 231 function or the invocation of the standard terminate handler. Those 232 messages cause the library to depend on the demangler and standard I/O 233 facilities, which might be undesirable in a low-memory environment or 234 when standard error is not available. This option disables those 235 messages. This option does not change the library ABI. 236 </p></dd><dt><span class="term"><code class="code">--disable-libstdcxx-dual-abi</code></span></dt><dd><p> 237 Disable support for the new, C++11-conforming implementations of 238 <code class="code">std::string</code>, <code class="code">std::list</code> etc. so that the 239 library only provides definitions of types using the old ABI 240 (see <a class="xref" href="using_dual_abi.html" title="Dual ABI">Dual ABI</a>). 241 This option changes the library ABI. 242 </p></dd><dt><span class="term"><code class="code">--with-default-libstdcxx-abi=</code><em class="replaceable"><code>OPTION</code></em></span></dt><dd><p> 243 Set the default value for the <span class="symbol">_GLIBCXX_USE_CXX11_ABI</span> 244 macro (see <a class="xref" href="using_macros.html" title="Macros">Macros</a>). 245 The default is <code class="option">OPTION=new</code> which sets the macro to 246 <code class="literal">1</code>, 247 use <code class="option">OPTION=gcc4-compatible</code> to set it to 248 <code class="literal">0</code>. 249 This option does not change the library ABI. 250 </p></dd><dt><span class="term"><code class="code">--with-libstdcxx-lock-policy=OPTION</code></span></dt><dd><p>Sets the lock policy that controls how 251 <code class="classname">shared_ptr</code> reference counting is 252 synchronized. 253 The choice OPTION=atomic enables use of atomics for updates to 254 <code class="classname">shared_ptr</code> reference counts. 255 The choice OPTION=mutex enables use of a mutex to synchronize updates 256 to <code class="classname">shared_ptr</code> reference counts. 257 If the compiler's thread model is "single" then this option has no 258 effect, as no synchronization is used for the reference counts. 259 The default is OPTION=auto, which checks for the availability of 260 compiler built-ins for 2-byte and 4-byte atomic compare-and-swap, 261 and uses OPTION=atomic if they're available, OPTION=mutex otherwise. 262 This option can change the library ABI. 263 If the library is configured to use atomics and user programs are 264 compiled using a target that doesn't natively support the atomic 265 operations (e.g. the library is configured for armv7 and then code 266 is compiled with <code class="option">-march=armv5t</code>) then the program 267 might rely on support in libgcc to provide the atomics. 268 </p></dd><dt><span class="term"><code class="code">--enable-vtable-verify</code>[default]</span></dt><dd><p>Use <code class="code">-fvtable-verify=std</code> to compile the C++ 269 runtime with instrumentation for vtable verification. All virtual 270 functions in the standard library will be verified at runtime. 271 Types impacted include <code class="classname">locale</code> and 272 <code class="classname">iostream</code>, and others. Disabling means that 273 the C++ runtime is compiled without support for vtable 274 verification. By default, this option is off. 275 </p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-filesystem-ts</code>[default]</span></dt><dd><p>Build <code class="filename">libstdc++fs.a</code> as well 276 as the usual libstdc++ and libsupc++ libraries. This is enabled by 277 default on select POSIX targets where it is known to work and disabled 278 otherwise. 279 </p></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="setup.html">Prev</a>��</td><td width="20%" align="center"><a accesskey="u" href="setup.html">Up</a></td><td width="40%" align="right">��<a accesskey="n" href="make.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter��2.��Setup��</td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top">��Make</td></tr></table></div></body></html>