Personal checkpoint.
[deliverable/binutils-gdb.git] / README.configure
1
2
3 On Configuring Development Tools
4
5 Last Mod Sat Apr 13 19:45:44 PDT 1991, by rich@sendai
6
7
8 INTRO
9 -----
10
11 This document attempts to describe the general concepts behind
12 configuration of the Cygnus Support release of the GNU Development
13 Tools. It also discusses common usage. For a more in succint
14 description, please refer to the man page on "configure" which you
15 should have received {FIXME: ALONG WITH LOTS OF OTHER VERY PRETTY
16 HARD COPY OR IN A DIFFERENT DISTRIBUTION OR ON THIS TAPE OR SHRINK
17 BOX OR SOMETHING}.
18
19
20 BASICS
21 ------
22
23 Some Basic Terms:
24
25 There are a lot of terms that are frequently used when discussing
26 development tools. Most of the common terms have been used for
27 several different concepts such that their meanings have become
28 ambiguous to the point of being confusing. Typically, we only
29 guess at their meanings from context and we frequently guess
30 wrong.
31
32 This document uses very few terms by comparison. The intent is to
33 make the concepts as clear as possible in order to convey the
34 usage and intent of these tools.
35
36 "Programs" run on "machines". Programs are very nearly always
37 written in "source". Programs are "built" from source.
38 "Compilation" is a process that is frequently, but not always,
39 used when building programs.
40
41
42 Host Environments:
43
44 In this document, the word "host" refers to the environment in
45 which this source will be compiled. "host" and "host name" have
46 nothing to do with the proper name of your host, like "ucbvax",
47 "prep.ai.mit.edu" or "att.com". Instead they refer to things like
48 "sun4" and "dec3100".
49
50 Forget for a moment that this particular directory of source is
51 the source for a development environment. Instead, pretend that
52 it is the source for a simpler, more mundane, application, say, a
53 desk calculator.
54
55 Source that can be compiled in more than one environment,
56 generally needs to be set up for each environment explicitly.
57 Here we refer to that process as configuration. That is, we
58 configure the source for a host.
59
60 For example, if we wanted to configure our mythical desk
61 calculator to compile on a SparcStation, we might configure for
62 host sun4. With our configuration system:
63
64 cd desk-calculator ; configure sun4
65
66 does the trick. "configure" is a shell script that sets up
67 Makefiles, subdirectories, and symbolic links appropriate for
68 compiling the source on a sun4.
69
70 The "host" environment does not necessarily refer to the machine
71 on which the tools are built. It is possible to provide a sun3
72 development environment on a sun4. If we wanted to use a cross
73 compiler on the sun4 to build a program intended to be run on a
74 sun3, we would configure the source for sun3.
75
76 cd desk-calculator ; configure sun3
77
78 The fact that we are actually building the program on a sun4 makes
79 no difference if the sun3 cross compiler presents an environment
80 that looks like a sun3 from the point of view of the desk
81 calculator source code. Specifically, the environment is a sun3
82 environment if the header files, predefined symbols, and libraries
83 appear as they do on a sun3.
84
85 Nor does the host environment refer to the the machine on which
86 the program to be built will run. It is possible to provide a
87 sun3 emulation environment on a sun4 such that programs built in a
88 sun3 development environment actually run on the sun4.
89
90 Host environment simply refers to the environment in which the
91 program will be built from the source.
92
93
94 Configuration Time Options:
95
96 Many programs have compile time options. That is, features of the
97 program that are either compiled into the program or not based on a
98 choice made by the person who builds the program. We refer to these
99 as "configuration options". For example, our desk calculator might be
100 capable of being compiled into a program that either uses infix
101 notation or postfix as a configuration option. For a sun3, chosing
102 infix might be:
103
104 configure sun3 +notation=infix
105
106 while a sun4 with postfix might be:
107
108 configure sun4 +notation=postfix
109
110 If we wanted to build both at the same time, in the same directory
111 structure, the intermediate pieces used in the build process must
112 be kept separate.
113
114 configure sun4 +forcesubdirs +notation=postfix
115 configure sun3 +forcesubdirs +notation=infix
116
117 will create subdirectories for the intermediate pieces of the sun4
118 and sun3 configurations. This is necessary as previous systems
119 were only capable of one configuration at a time. A second
120 configuration overwrote the first. We've chosen to retain this
121 behaviour so the "+forcesubdirs" configuration option is necessary
122 to get the new behaviour. The order of the arguments doesn't
123 matter. There should be exactly one argument without a leading
124 '+' sign and that argument will be assumed to be the host name.
125
126 From here on the examples will assume that you want to build the
127 tools "in place" and won't show the "+forcesubdirs" option, but
128 remember that it is available.
129
130 In order to actually install the program, the configuration system
131 needs to know where you would like the program installed. The
132 default location is /usr/local. We refer to this location as
133 $(destdir). All user visible programs will be installed in
134 $(destdir)/bin. All other programs and files will be installed in
135 a subdirectory of $(destdir)/lib. For the tools in this
136 directory, the files not normally user visible will be installed
137 in $(destdir)/lib/gcc.
138
139 You can elect to change $(destdir) only as a configuration time
140 option.
141
142 configure sun4 +notation=postfix +destdir=/local
143
144 Will configure the source such that:
145
146 make install
147
148 will put it's programs in /local/bin and /local/lib/gcc. If you
149 change $(destdir) after building the source, you will need to:
150
151 make clean
152
153 before the change will be propogated properly. This is because
154 some tools need to know the locations of other tools.
155
156 With these concepts in mind, we can drop the desk calculator and
157 move on to the application that resides in these directories,
158 namely, the source to a development environment.
159
160
161 SPECIFICS
162 ---------
163
164 The GNU Development Tools can be built on a wide variety of hosts.
165 So, of course, they must be configured. Like the last example,
166
167 configure sun4 +destdir=/local
168 configure sun3 +destdir=/local
169
170 will configure the source to be built in subdirectories, in order
171 to keep the intermediate pieces separate, and to be installed in
172 /local.
173
174 When built with suitable development environments, these will be
175 native tools. We'll explain the term "native" later.
176
177
178 BUILDING DEVELOPMENT ENVIRONMENTS
179 ---------------------------------
180
181 The Cygnus Support GNU development tools can not only be built
182 with a number of host development environments, they can also be
183 configured to create a number of different development
184 environments on each of those hosts. We refer to a specific
185 development environment created as a "target". That is, the word
186 "target" refers to the development environment produced by
187 compiling this source and installing the resulting programs.
188
189 For the Cygnus Support GNU development tools, the default target
190 is the same as the host. That is, the development environment
191 produced is intended to be compatible with the environment used to
192 build the tools.
193
194 In the example above, we created two configurations, one for sun4
195 and one for sun3. The first configuration is expecting to be
196 built in a sun4 development environment, to create a sun4
197 development environment. It doesn't necessarily need to be built
198 on a sun4 if a sun4 development environment is available
199 elsewhere. Likewise, if the available sun4 development
200 environment produces executables intended for something other than
201 sun4, then the development environment built from this sun4
202 configuration will run on something other than a sun4. From the
203 point of view of the configuration system and the GNU development
204 tools source, this doesn't matter. What matters is that they will
205 be built in a sun4 environment.
206
207 Similarly, the second configuration given above is expecting to be
208 built in a sun3 development environment, to create a sun3
209 development environment.
210
211 The development environment produced, is a configuration time
212 option, just like $(destdir).
213
214 configure sun4 +destdir=/local +target=sun3
215 configure sun3 +destdir=/local +target=sun4
216
217 In this example, like before, we create two configurations. The
218 first is intended to be built in a sun4 environment, in
219 subdirectories, to be installed in /local. The second is also
220 intended to be build in a sun4 environment, in subdirectories, to
221 be installed in /local.
222
223 Unlike the previous example, the first configuration will produce
224 a sun3 development environment, perhaps even suitable for building
225 the second configuration. Likewise, the second configuration will
226 produce a sun4 development environment, perhaps even suitable for
227 building the first configuration.
228
229 The development environment used to build these configurations
230 will determine the machines on which the resulting development
231 environments can be used.
232
233
234 A WALK THROUGH
235 --------------
236
237 Native Development Environments:
238
239 Let us assume for a moment that you have a sun4 and that with your
240 sun4 you received a development environment. This development
241 environment is intended to be run on your sun4 to build programs
242 that can be run on your sun4. You could, for instance, run this
243 development environment on your sun4 to build our example desk
244 calculator program. You could then run the desk calculator
245 program on your sun4.
246
247 The resulting desk calculator program is referred to as a "native"
248 program. The development environment itself is composed of native
249 programs that, when run, build other native programs. Any other
250 program is referred to as "foreign". Programs intended for other
251 machines are foreign programs.
252
253 This type of development environment, which is by far the most
254 common, is refered to as "native". That is, a native development
255 environment runs on some machine to build programs for that same
256 machine. The process of using a native development environment to
257 build native programs is called a "native" build.
258
259 configure sun4
260
261 Will configure this source such that when built in a sun4
262 development environment, with a development environment that
263 builds programs intended to be run on sun4 machines, the programs
264 built will be native programs and the resulting development
265 environment will be a native development environment.
266
267 The development system that came with your sun4 is one such
268 environment. Using it to build the GNU Development Tools is a
269 very common activity and the resulting development environment is
270 very popular.
271
272 make all
273
274 will build the tools as configured and will assume that you want
275 to use the native development environment that came with your
276 machine.
277
278 Using a development environment to build a development environment
279 is called "bootstrapping". The Cygnus Support release of the GNU
280 Development Tools is capable of bootstrapping itself. This is a
281 very powerful feature that we'll return to later. For now, let's
282 pretend that you used the native development environment that came
283 with your sun4 to bootstrap the Cygnus Support release and let's
284 call the new development environment stage1.
285
286 Why bother? Well, most people find that the Cygnus Support
287 release builds programs that run faster and take up less space
288 than the native development environments that came with their
289 machines. Some people didn't get development environments with
290 their machines and some people just like using the GNU tools
291 better than using other tools.
292
293 While you're at it, if the GNU tools produce better programs, maybe
294 you should use them to build the GNU tools. It's a good idea, so
295 let's pretend that you do. Let's call the new development
296 environment stage2.
297
298 So far you've built a development environment, stage1, and you've
299 used stage1 to build a new, faster and smaller development
300 environment, stage2, but you haven't run any of the programs that
301 the GNU tools have built. You really don't yet know if these
302 tools work. Do you have any programs built with the GNU tools?
303 Yes, you do. stage2. What does that program do? It builds
304 programs. Ok, do you have any source handy to build into a
305 program? Yes, you do. The GNU tools themselves. In fact, if you
306 use stage2 to build the GNU tools again the resulting programs
307 should be identical to stage2. Let's pretend that you do and call
308 the new development environment stage3.
309
310 You've just completed what's called a "three stage boot". You now
311 have a small, fast, somewhat tested, development environment.
312
313 make bootstrap
314
315 will do a three stage boot across all tools and will compare
316 stage2 to stage3 and complain if they are not identical.
317
318 Once built,
319
320 make install
321
322 will install the development environment in the default location
323 or in $(destdir) if you specified an alternate when you
324 configured. In fact, you can skip the "make all" part and just
325 "make install" which will make sure that the development
326 environment is built before attempting to install anything. Even
327 better, for configurations where host is the same as target, like
328 this one, "make install" will make sure that a "make bootstrap" is
329 done before installing anything.
330
331 Any development environment that is not a native development
332 environment is refered to as a "cross" development environment.
333 There are many different types of cross development environments
334 but most fall into one of FIXME basic categories.
335
336
337 Emulation Environments:
338
339 The first category of cross development environment is called
340 "emulation". There are two primary types of emulation, but both
341 types result in programs that run on the native host.
342
343 The first type is "software emulation". This form of cross
344 development environment involves a native program that when run on
345 the native host, is capable of interpreting, and in most aspects
346 running, a program intended for some other machine. This
347 technique is typically used when the other machine is either too
348 expensive, too slow, too fast, or not available, perhaps because
349 it hasn't yet been built. The native, interpreting program is
350 called a "software emulator".
351
352 The GNU Development Tools do not currently include any software
353 emulators. Some do exist and the GNU Development Tools can be
354 configured to create simple cross development environments for
355 with these emulators. More on this later.
356
357 The second type of emulation is when source intended for some
358 other development environment is built into a program intended for
359 the native host. The concept of universes in operating systems
360 and hosted operating systems are two such development
361 environments.
362
363 The Cygnus Support Release of the GNU Development Tools can be
364 configured for one such emulation at this time.
365
366 configure sun4 +ansi
367
368 will configure the source such that when built in a sun4
369 development environment the resulting development environment is
370 capable of building sun4 programs from strictly conforming ANSI
371 X3J11 C source. Remember that the environment used to build the
372 tools determines the machine on which this tools will run, so the
373 resulting programs aren't necessarily intended to run on a sun4,
374 although they usually are. Also note that the source for the GNU
375 tools is not strictly conforming ANSI source so this configuration
376 cannot be used to bootstrap the GNU tools.
377
378
379 Simple Cross Environments:
380
381 configure sun4 +target=a29k
382
383 will configure the tools such that when compiled in a sun4
384 development environment the resulting development environment can
385 be used to create programs intended for a sun3. Again, this does
386 not necessarily mean that the new development environment can be
387 run on a sun4. That would depend on the development environment
388 used to build these tools.
389
390 Earlier you saw how to configure the tools to build a native
391 development environment, that is, a development environment that
392 runs on your sun4 and builds programs for your sun4. Let's
393 pretend that you use stage3 to build this simple cross
394 configuration and let's call the new development environment
395 gcc-a29k. Remember that this is a native build. Gcc-a29k is a
396 collection of native programs intended to run on your sun4.
397 That's what stage3 builds, programs for your sun4. Gcc-a29k
398 presents an a29k development environment that builds programs
399 intended to run on an a29k. But, remember, gcc-a29k runs on your
400 sun4.
401
402 Building gcc-a29k is also a bootstrap but of a slightly different
403 sort. We call gcc-a29k a simple cross environment and using
404 gcc-a29k to build a program intended for a29k is called "crossing
405 to" a29k. Simple cross environments are the second category of
406 cross development environments.
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442 if configured for host sun4 and target sun4, this implies that we
443 will compile on a sun4 to create a sun4 compilation environment.
444 If configured for host sun3 and target a29k, this implies that we
445 will compile on a sun3 to create an a29k compilation environment.
446
447 Host sun3 only implies that the source will be compiled on a sun3.
448 In fact, it need not be actually compiled on a sun3. If the
449 appropriate native development tools, header files, libraries, and
450 operating system support were available on a foobox, then source
451 configured for a sun3 could be compiled on a foobox, resulting in
452 a development environment for, using the previous example
453 host+target pair, "a29k" on the foobox. Similarly, if the
454 appropriate cross development tools, header files, and libraries
455 were available on a dec3100, then source configured for host sun3
456 could be cross compiled to create an a29k development environment
457 intended to be run on a sun3.
458
459
460 Usage:
461
462 Gdb's config has features not yet present in the uniform configuration
463 scheme described here. For this reason, configuration of gdb must
464 currently be done separately from that of the rest of this package.
465 This will be corrected soon. For more information on the
466 configuration of gdb, please refer to the documents in gdb.{your
467 target} if it exists, otherwise gdb.
468
469 By "configures", I mean that links, Makefile, .gdbinit, and
470 config.status are built. Configuration is always done from the source
471 directory.
472
473 * "./configure name" configures this directory, perhaps
474 recursively, for a single host+target pair where the host and target
475 are both "name". If a previous configuration existed, it will be
476 overwritten.
477
478 * "./configure +host=hostname targetname" configures this
479 directory, perhaps recursively, for a single host+target pair where
480 the host is hostname and target is targetname. If a previous
481 configuration existed, it will be overwritten.
482
483 * "./configure +forcesubdirs +host=hostname targetname" creates
484 a subdirectories Host-hostname and
485 Host-hostname/Target-targetname and configures
486 Host-hostname/Target-targetname. For now, makes should be
487 done from Host-hostname/Target-targetname. "./configure +f
488 name" works as expected. That is, it creates Host-name and
489 Host-name/Target-name and configures the latter.
490
491
492 Hacking configurations:
493
494 The configure scripts essentially do three things, create
495 subdirectories if appropriate, build a Makefile, and create links to
496 files, all based on and tailored to, a specific host+target pair. The
497 scripts also create a .gdbinit if appropriate but this is not
498 tailored.
499
500 The Makefile is created by prepending some variable definitions to a
501 Makefile template called Makefile.in and then inserting host and
502 target specific Makefile fragments. The variables are set based on
503 the chosen host+target pair and build style, that is, if you use
504 subdirectories or not. The host and target specific Makefile
505 may or may not exist. If fragments
506
507 * Makefiles can be editted directly, but those changes will eventually
508 be lost. Changes intended to be permanent for a specific host
509 should be made to the host specific Makefile fragment. This should
510 be in ./config/hmake-host if it exists. Changes intended to be
511 permanent for a specific target should be made to the target
512 specific Makefile fragment. This should be in ./config/tmake-target
513 if it exists. Changes intended to be permanent for the directory
514 should be made in Makefile.in. To propogate changes to any of
515 these, either use "make Makefile" or re-configure from the source
516 directory.
517
518 * configure can be editted directly, but those changes will eventually
519 be lost. Changes intended to be permanent for a specific directory
520 should be made to configure.in. Changes intended to be permanent
521 for all configure scripts should be made to configure.template.
522 Propogating changes to configure.in requires the presence of
523 configure.template which normally resides in the uppermost directory
524 you received. To propogate changes to either configure.template or
525 a configure.in, use "configure +template=absolutepathtothetemplate".
526 This will configure the configure scripts themselves, recursively if
527 appropriate.
528
529 * "configure -srcdir=foo" is not supported yet. At the moment, things
530 will probably be configured correctly only for leaf directories, and
531 even they will not have paths to libraries set properly.
This page took 0.044225 seconds and 5 git commands to generate.