<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE htmlPUBLIC "-//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" xml:lang="en" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><meta name="AUTHOR" content="pme@gcc.gnu.org (Phil Edwards)" /><meta name="DESCRIPTION" content="configury for libstdc++" /><meta name="GENERATOR" content="vi and eight fingers" /><title>libstdc++-v3 configury</title><link rel="StyleSheet" href="../lib3styles.css" type='text/css' /><link rel="Start" href="../documentation.html" type="text/html"title="GNU C++ Standard Library" /></head><body><h1><code>> open configury door</code></h1><h1><code>> look</code></h1><p class="larger"><code>You are in a maze of twisty passages, alldifferent.</code></p><p class="larger"><code>It is dark. You are likely to be eaten by aCanadian cross build.</code></p><hr /><h2>Notes on libstdc++-v3 configury</h2><blockquote>No problem is insoluble in all conceivable circumstances.<br />-- The Cosmic AC,<a href="http://mit.edu/tylerc/www/twt/LQ1.htm">TheLast Question</a>, by Isaac Asimov</blockquote><ul><li><a href="#deps">what comes from where</a></li><li><a href="#breakout">storing information in non-AC files, likeconfigure.host</a></li><li><a href="#general">general config notes</a></li><li><a href="#aclayout">acinclude.m4 layout</a></li><li><a href="#enable"><code>--enable</code> howto</a></li></ul><hr /><h3><a name="deps">what comes from where</a></h3><p class="centered"><img src="confdeps.png"alt="Dependency graph in PNG graphics format. (Get a better browser!)" /></p><p>Regenerate using a command sequence like<code>"aclocal-1.7 && autoconf-2.59 && autoheader-2.59&& automake-1.7"</code> as needed. And/or configure with--enable-maintainer-mode. The version numbers will vary depending on<a href="http://gcc.gnu.org/install/prerequisites.html">the currentrequirements</a> and your vendor's choice of installation names.</p><hr /><h3><a name="breakout">storing information in non-AC files, likeconfigure.host</a></h3><p>Until that glorious day when we can use AC_TRY_LINK with a cross-compiler,we have to hardcode the results of what the tests would have shown ifthey could be run. So we have an inflexible mess like crossconfig.m4.</p><p>Wouldn't it be nice if we could store that information in files likeconfigure.host, which can be modified without needing to regenerateanything, and can even be tweaked without really knowing how the configuryall works? Perhaps break the pieces of crossconfig.m4 out and place them intheir appropriate config/{cpu,os} directory.</p><p>Alas, writing macros like "<code>AC_DEFINE(HAVE_A_NICE_DAY)</code>" canonly be done inside files which are passed through autoconf. Files whichare pure shell script can be source'd at configure time. Files whichcontain autoconf macros must be processed with autoconf. We could stilltry breaking the pieces out into "config/*/cross.m4" bits, for instance,but then we would need arguments to aclocal/autoconf to properly findthem all when generating configure. I would discourage that.</p><hr /><h3><a name="general">general config notes</a></h3><p>Lots of stuff got thrown out because the new autotools kindly generatethe same (or better) shell code for us.</p><p>Most comments should use {octothorpes, shibboleths, hash marks, poundsigns, whatevers} rather than "dnl". Nearly all comments in configure.acshould. Comments inside macros written in ancilliary .m4 files should.About the only comments which should <em>not</em> use #, but use dnlinstead, are comments <em>outside</em> our own macros in the ancilliaryfiles. The difference is that # comments show up in <code>configure</code>(which is most helpful for debugging), while dnl'd lines just vanish.Since the macros in ancilliary files generate code which appears in oddplaces, their "outside" comments tend to not be useful while reading<code>configure</code>.</p><p>Do not use any <code>$target*</code> variables, such as<code>$target_alias</code>. The single exception is in configure.ac,for automake+dejagnu's sake.</p><p></p><hr /><h3><a name="aclayout">acinclude.m4 layout</a></h3><p>The nice thing about acinclude.m4/aclocal.m4 is that macros aren't actuallyperformed/called/expanded/whatever here, just loaded. So we can arrangethe contents however we like. As of this writing, acinclude.m4 is arrangedas follows:</p><pre>GLIBCXX_CHECK_HOSTGLIBCXX_TOPREL_CONFIGUREGLIBCXX_CONFIGURE</pre><p>All the major variable "discovery" is done here. CXX, multilibs, etc.</p><pre>fragments included from elsewhere</pre><p>Right now, "fragments" == "the math/linkage bits".</p><pre>GLIBCXX_CHECK_COMPILER_FEATURESGLIBCXX_CHECK_LINKER_FEATURESGLIBCXX_CHECK_WCHAR_T_SUPPORT</pre><p>Next come extra compiler/linker feature tests. Wide character supportwas placed here because I couldn't think of another place for it. It willprobably get broken apart like the math tests, because we're still disablingwchars on systems which could actually support them.</p><pre>GLIBCXX_CHECK_SETRLIMIT_ancilliaryGLIBCXX_CHECK_SETRLIMITGLIBCXX_CHECK_S_ISREG_OR_S_IFREGGLIBCXX_CHECK_POLLGLIBCXX_CHECK_WRITEVGLIBCXX_CONFIGURE_TESTSUITE</pre><p>Feature tests which only get used in one place. Here, things used only inthe testsuite, plus a couple bits used in the guts of I/O.</p><pre>GLIBCXX_EXPORT_INCLUDESGLIBCXX_EXPORT_FLAGSGLIBCXX_EXPORT_INSTALL_INFO</pre><p>Installation variables, multilibs, working with the rest of the compiler.Many of the critical variables used in the makefiles are set here.</p><pre>GLIBGCC_ENABLEGLIBCXX_ENABLE_C99GLIBCXX_ENABLE_CHEADERSGLIBCXX_ENABLE_CLOCALEGLIBCXX_ENABLE_CONCEPT_CHECKSGLIBCXX_ENABLE_CSTDIOGLIBCXX_ENABLE_CXX_FLAGSGLIBCXX_ENABLE_C_MBCHARGLIBCXX_ENABLE_DEBUGGLIBCXX_ENABLE_DEBUG_FLAGSGLIBCXX_ENABLE_LONG_LONGGLIBCXX_ENABLE_PCHGLIBCXX_ENABLE_SJLJ_EXCEPTIONSGLIBCXX_ENABLE_SYMVERSGLIBCXX_ENABLE_THREADS</pre><p>All the features which can be controlled with enable/disable configureoptions. Note how they're alphabetized now? Keep them like that. :-)</p><pre>AC_LC_MESSAGESlibtool bits</pre><p>Things which we don't seem to use directly, but just has to be presentotherwise stuff magically goes wonky.</p><hr /><h3><a name="enable"><code>--enable</code> howto</a></h3><p>All the GLIBCXX_ENABLE_FOO macros use a common helper, GLIBCXX_ENABLE.(You don't have to use it, but it's easy.) The helper does two thingsfor us:</p><ol><li>Builds the call to the AC_ARG_ENABLE macro, with --help text properlyquoted and aligned. (Death to changequote!)</li><li>Checks the result against a list of allowed possibilities, and signalsa fatal error if there's no match. This means that the rest of theGLIBCXX_ENABLE_FOO macro doesn't need to test for strange arguments,nor do we need to protect against empty/whitespace strings with the<code>"x$foo" = "xbar"</code> idiom.</li></ol><p>Doing these things correctly takes some extra autoconf/autom4te code,which made our macros nearly illegible. So all the ugliness is factoredout into this one helper macro.</p><p>Many of the macros take an argument, passed from when they are expandedin configure.ac. The argument controls the default value of theenable/disable switch. Previously, the arguments themselves had defaults.Now they don't, because that's extra complexity with zero gain for us.</p><p>There are three "overloaded signatures". When reading the descriptionsbelow, keep in mind that the brackets are autoconf's quotation characters,and that they will be stripped. Examples of just about everything occurin acinclude.m4, if you want to look.</p><pre>GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)</pre><ul><li><p>FEATURE is the string that follows --enable. The results of the test(such as it is) will be in the variable $enable_FEATURE, where FEATUREhas been squashed. Example: <code>[extra-foo]</code>, controlled by the--enable-extra-foo option and stored in $enable_extra_foo.</p></li><li><p>DEFAULT is the value to store in $enable_FEATURE if the user does notpass --enable/--disable. It should be one of the permitted valuespassed later. Examples: <code>[yes]</code>, or <code>[bar]</code>, or<code>[$1]</code> (which passes the argument given to theGLIBCXX_ENABLE_FOO macro as the default).</p><p>For cases where we need to probe for particular modelsof things, it is useful to have an undocumented "auto" value here (seeGLIBCXX_ENABLE_CLOCALE for an example).</p></li><li><p>HELP-ARG is any text to append to the option string itself in the--help output. Examples: <code>[]</code> (i.e., an empty string,which appends nothing),<code>[=BAR]</code>, which produces<code>--enable-extra-foo=BAR</code>, and<code>[@<:@=BAR@:>@]</code>, which produces<code>--enable-extra-foo[=BAR]</code>. See the difference? See whatit implies to the user?</p><p>If you're wondering what that line noise in the last example was,that's how you embed autoconf special characters in output text.They're called<ahref="http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_95.html#SEC95"><em>quadrigraphs</em></a>and you should use them whenever necessary.</p></li><li><p>HELP-STRING is what you think it is. Do not include the "default"text like we used to do; it will be done for you by GLIBCXX_ENABLE.By convention, these are not full English sentences.Example: [turn on extra foo]</p></li></ul><p>With no other arguments, only the standard autoconf patterns areallowed: "<code>--{enable,disable}-foo[={yes,no}]</code>" The$enable_FEATURE variable is guaranteed to equal either "yes" or "no"after the macro. If the user tries to pass something else, anexplanatory error message will be given, and configure will halt.</p><p>The second signature takes a fifth argument,"<code>[permit <em>a</em>|<em>b</em>|<em>c</em>|<em>...</em>]</code>"This allows <em>a</em> or <em>b</em> or ... after the equals sign in theoption, and $enable_FEATURE is guaranteed to equal one of them after themacro. Note that if you want to allow plain --enable/--disable with no"=whatever", you must include "yes" and "no" in the list of permittedvalues. Also note that whatever you passed as DEFAULT must be in the list.If the user tries to pass something not on the list, a semi-explanatoryerror message will be given, and configure will halt.Example: <code>[permit generic|gnu|ieee_1003.1-2001|yes|no|auto]</code></p><p>The third signature takes a fifth argument. It is arbitrary shell codeto execute if the user actually passes the enable/disable option. (Ifthe user does not, the default is used. Duh.) No argument checking atall is done in this signature. See GLIBCXX_ENABLE_CXX_FLAGS for anexample of handling, and an error message.</p><hr /></body></html>