OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [doc/] [xml/] [manual/] [build_hacking.xml] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
2
         xml:id="appendix.porting.build_hacking" xreflabel="Build Hacking">
3
4
 
5
Configure and Build Hacking
6
  
7
    
8
      C++
9
    
10
    
11
      BUILD_HACKING
12
    
13
    
14
      version
15
    
16
    
17
      dynamic
18
    
19
    
20
      shared
21
    
22
  
23
24
 
25
Prerequisites
26
 
27
  
28
    As noted previously,
29
    certain other tools are necessary for hacking on files that
30
    control configure (configure.ac,
31
    acinclude.m4) and make
32
    (Makefile.am). These additional tools
33
    (automake, and autoconf) are further
34
    described in detail in their respective manuals. All the libraries
35
    in GCC try to stay in sync with each other in terms of versions of
36
    the auto-tools used, so please try to play nicely with the
37
    neighbors.
38
  
39
40
 
41
Overview: What Comes from Where
42
 
43
 
44
  
45
    Configure and Build File Dependencies
46
  
47
    
48
      
49
    
50
    
51
      
52
    
53
    
54
      Dependency Graph for Configure and Build Files
55
    
56
  
57
  
58
 
59
  
60
    Regenerate all generated files by using the command sequence
61
    "autoreconf" at the top level of the libstdc++ source
62
    directory. The following will also work, but is much more complex:
63
    "aclocal-1.11 && autoconf-2.64 &&
64
    autoheader-2.64 && automake-1.11" The version
65
    numbers may be absent entirely or otherwise vary depending on
66
    the
67
    current requirements and your vendor's choice of
68
    installation names.
69
  
70
71
 
72
Storing Information in non-AC files (like configure.host)
73
 
74
 
75
  
76
    Until that glorious day when we can use AC_TRY_LINK with a
77
    cross-compiler, we have to hardcode the results of what the tests
78
    would have shown if they could be run.  So we have an inflexible
79
    mess like crossconfig.m4.
80
  
81
 
82
  
83
    Wouldn't it be nice if we could store that information in files
84
    like configure.host, which can be modified without needing to
85
    regenerate anything, and can even be tweaked without really
86
    knowing how the configury all works?  Perhaps break the pieces of
87
    crossconfig.m4 out and place them in their appropriate
88
    config/{cpu,os} directory.
89
  
90
 
91
  
92
    Alas, writing macros like
93
    "AC_DEFINE(HAVE_A_NICE_DAY)" can only be done inside
94
    files which are passed through autoconf.  Files which are pure
95
    shell script can be source'd at configure time.  Files which
96
    contain autoconf macros must be processed with autoconf.  We could
97
    still try breaking the pieces out into "config/*/cross.m4" bits,
98
    for instance, but then we would need arguments to aclocal/autoconf
99
    to properly find them all when generating configure.  I would
100
    discourage that.
101
102
103
 
104
Coding and Commenting Conventions
105
 
106
 
107
  
108
    Most comments should use {octothorpes, shibboleths, hash marks,
109
    pound signs, whatever} rather than "dnl".  Nearly all comments in
110
    configure.ac should.  Comments inside macros written in ancilliary
111
    .m4 files should.  About the only comments which should
112
    not use #, but use dnl instead, are comments
113
    outside our own macros in the ancilliary
114
    files.  The difference is that # comments show up in
115
    configure (which is most helpful for debugging),
116
    while dnl'd lines just vanish.  Since the macros in ancilliary
117
    files generate code which appears in odd places, their "outside"
118
    comments tend to not be useful while reading
119
    configure.
120
  
121
 
122
  
123
    Do not use any $target* variables, such as
124
    $target_alias.  The single exception is in
125
    configure.ac, for automake+dejagnu's sake.
126
  
127
128
 
129
The acinclude.m4 layout
130
 
131
  
132
    The nice thing about acinclude.m4/aclocal.m4 is that macros aren't
133
    actually performed/called/expanded/whatever here, just loaded.  So
134
    we can arrange the contents however we like.  As of this writing,
135
    acinclude.m4 is arranged as follows:
136
  
137
  
138
    GLIBCXX_CHECK_HOST
139
    GLIBCXX_TOPREL_CONFIGURE
140
    GLIBCXX_CONFIGURE
141
  
142
  
143
    All the major variable "discovery" is done here.  CXX, multilibs,
144
    etc.
145
  
146
  
147
    fragments included from elsewhere
148
  
149
  
150
    Right now, "fragments" == "the math/linkage bits".
151
  
152
153
    GLIBCXX_CHECK_COMPILER_FEATURES
154
    GLIBCXX_CHECK_LINKER_FEATURES
155
    GLIBCXX_CHECK_WCHAR_T_SUPPORT
156
157
158
  Next come extra compiler/linker feature tests.  Wide character
159
  support was placed here because I couldn't think of another place
160
  for it.  It will probably get broken apart like the math tests,
161
  because we're still disabling wchars on systems which could actually
162
  support them.
163
164
165
    GLIBCXX_CHECK_SETRLIMIT_ancilliary
166
    GLIBCXX_CHECK_SETRLIMIT
167
    GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
168
    GLIBCXX_CHECK_POLL
169
    GLIBCXX_CHECK_WRITEV
170
 
171
    GLIBCXX_CONFIGURE_TESTSUITE
172
173
174
  Feature tests which only get used in one place.  Here, things used
175
  only in the testsuite, plus a couple bits used in the guts of I/O.
176
177
178
    GLIBCXX_EXPORT_INCLUDES
179
    GLIBCXX_EXPORT_FLAGS
180
    GLIBCXX_EXPORT_INSTALL_INFO
181
182
183
  Installation variables, multilibs, working with the rest of the
184
  compiler.  Many of the critical variables used in the makefiles are
185
  set here.
186
187
188
    GLIBGCC_ENABLE
189
    GLIBCXX_ENABLE_C99
190
    GLIBCXX_ENABLE_CHEADERS
191
    GLIBCXX_ENABLE_CLOCALE
192
    GLIBCXX_ENABLE_CONCEPT_CHECKS
193
    GLIBCXX_ENABLE_CSTDIO
194
    GLIBCXX_ENABLE_CXX_FLAGS
195
    GLIBCXX_ENABLE_C_MBCHAR
196
    GLIBCXX_ENABLE_DEBUG
197
    GLIBCXX_ENABLE_DEBUG_FLAGS
198
    GLIBCXX_ENABLE_LONG_LONG
199
    GLIBCXX_ENABLE_PCH
200
    GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
201
    GLIBCXX_ENABLE_SYMVERS
202
    GLIBCXX_ENABLE_THREADS
203
204
205
  All the features which can be controlled with enable/disable
206
  configure options.  Note how they're alphabetized now?  Keep them
207
  like that.  :-)
208
209
210
    AC_LC_MESSAGES
211
    libtool bits
212
213
214
  Things which we don't seem to use directly, but just has to be
215
  present otherwise stuff magically goes wonky.
216
217
 
218
219
 
220
<constant>GLIBCXX_ENABLE</constant>, the <literal>--enable</literal> maker
221
 
222
 
223
  
224
    All the GLIBCXX_ENABLE_FOO macros use a common helper,
225
    GLIBCXX_ENABLE.  (You don't have to use it, but it's easy.)  The
226
    helper does two things for us:
227
  
228
 
229
230
 
231
   
232
     Builds the call to the AC_ARG_ENABLE macro, with --help text
233
     properly quoted and aligned.  (Death to changequote!)
234
   
235
 
236
 
237
   
238
     Checks the result against a list of allowed possibilities, and
239
     signals a fatal error if there's no match.  This means that the
240
     rest of the GLIBCXX_ENABLE_FOO macro doesn't need to test for
241
     strange arguments, nor do we need to protect against
242
     empty/whitespace strings with the "x$foo" = "xbar"
243
     idiom.
244
   
245
 
246
247
 
248
Doing these things correctly takes some extra autoconf/autom4te code,
249
   which made our macros nearly illegible.  So all the ugliness is factored
250
   out into this one helper macro.
251
252
 
253
Many of the macros take an argument, passed from when they are expanded
254
   in configure.ac.  The argument controls the default value of the
255
   enable/disable switch.  Previously, the arguments themselves had defaults.
256
   Now they don't, because that's extra complexity with zero gain for us.
257
258
 
259
There are three "overloaded signatures".  When reading the descriptions
260
   below, keep in mind that the brackets are autoconf's quotation characters,
261
   and that they will be stripped.  Examples of just about everything occur
262
   in acinclude.m4, if you want to look.
263
264
 
265
266
    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
267
    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
268
    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
269
270
 
271
272
 
273
   
274
     FEATURE is the string that follows --enable.  The results of the
275
     test (such as it is) will be in the variable $enable_FEATURE,
276
     where FEATURE has been squashed.  Example:
277
     [extra-foo], controlled by the --enable-extra-foo
278
     option and stored in $enable_extra_foo.
279
   
280
 
281
 
282
   
283
     DEFAULT is the value to store in $enable_FEATURE if the user does
284
     not pass --enable/--disable.  It should be one of the permitted
285
     values passed later.  Examples: [yes], or
286
     [bar], or [$1] (which passes the
287
     argument given to the GLIBCXX_ENABLE_FOO macro as the
288
     default).
289
   
290
   
291
     For cases where we need to probe for particular models of things,
292
     it is useful to have an undocumented "auto" value here (see
293
     GLIBCXX_ENABLE_CLOCALE for an example).
294
   
295
 
296
 
297
   
298
     HELP-ARG is any text to append to the option string itself in the
299
     --help output.  Examples: [] (i.e., an empty string,
300
     which appends nothing), [=BAR], which produces
301
     --enable-extra-foo=BAR, and
302
     [@<:@=BAR@:>@], which produces
303
     --enable-extra-foo[=BAR].  See the difference?  See
304
     what it implies to the user?
305
   
306
   
307
     If you're wondering what that line noise in the last example was,
308
     that's how you embed autoconf special characters in output text.
309
     They're called quadrigraphs
310
     and you should use them whenever necessary.
311
 
312
 
313
 
314
   HELP-STRING is what you think it is.  Do not include the
315
   "default" text like we used to do; it will be done for you by
316
   GLIBCXX_ENABLE.  By convention, these are not full English
317
   sentences.  Example: [turn on extra foo]
318
   
319
 
320
321
 
322
323
  With no other arguments, only the standard autoconf patterns are
324
  allowed: "--{enable,disable}-foo[={yes,no}]" The
325
  $enable_FEATURE variable is guaranteed to equal either "yes" or "no"
326
  after the macro.  If the user tries to pass something else, an
327
  explanatory error message will be given, and configure will halt.
328
329
 
330
331
  The second signature takes a fifth argument, "[permit
332
  a | b | c | ...]"
333
  This allows a or b or
334
  ... after the equals sign in the option, and $enable_FEATURE is
335
  guaranteed to equal one of them after the macro.  Note that if you
336
  want to allow plain --enable/--disable with no "=whatever", you must
337
  include "yes" and "no" in the list of permitted values.  Also note
338
  that whatever you passed as DEFAULT must be in the list.  If the
339
  user tries to pass something not on the list, a semi-explanatory
340
  error message will be given, and configure will halt.  Example:
341
  [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]
342
343
 
344
345
  The third signature takes a fifth argument.  It is arbitrary shell
346
  code to execute if the user actually passes the enable/disable
347
  option.  (If the user does not, the default is used.  Duh.)  No
348
  argument checking at all is done in this signature.  See
349
  GLIBCXX_ENABLE_CXX_FLAGS for an example of handling, and an error
350
  message.
351
352
 
353
354
 
355

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.