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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc4/] [libstdc++-v3/] [doc/] [xml/] [manual/] [build_hacking.xml] - Blame information for rev 424

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

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

powered by: WebSVN 2.1.0

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