fix INFO-DIR-ENTRY, new gen-info-dir
[deliverable/binutils-gdb.git] / configure.texi
1 \input texinfo @c -*-para-*-
2 @c %**start of header
3 @setfilename configure.info
4 @settitle Cygnus Configure
5 @c %**end of header
6 @synindex ky cp
7 @tex
8 \def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
9 \xdef\manvers{\$Revision$} % For use in headers, footers too
10 @end tex
11 @setchapternewpage off
12
13 @ifinfo
14 @format
15 START-INFO-DIR-ENTRY
16 * configure: (configure). Cygnus configure.
17 END-INFO-DIR-ENTRY
18 @end format
19 @end ifinfo
20
21 @ifinfo
22 This document attempts to describe the Cygnus Support version of
23 @code{configure}.
24
25 Copyright (C) 1991, 1992 Cygnus Support
26 Permission is granted to make and distribute verbatim copies of
27 this manual provided the copyright notice and this permission notice
28 are preserved on all copies.
29
30 @ignore
31 Permission is granted to process this file through TeX and print the
32 results, provided the printed document carries copying permission
33 notice identical to this one except for the removal of this paragraph
34 (this paragraph not being relevant to the printed manual).
35
36 @end ignore
37 Permission is granted to copy and distribute modified versions of this
38 manual under the conditions for verbatim copying, provided that the entire
39 resulting derived work is distributed under the terms of a permission
40 notice identical to this one.
41
42 Permission is granted to copy and distribute translations of this manual
43 into another language, under the above conditions for modified versions,
44 except that this permission notice may be stated in a translation approved
45 by Cygnus Support.
46 @end ifinfo
47
48 @titlepage
49 @sp 10
50 @title{Cygnus Configure}
51 @subtitle @manvers, for Cygnus Configure version 1.84
52 @author{K. Richard Pixley, @code{rich@@cygnus.com}}
53 @author{Cygnus Support}
54 @page
55
56 @vskip 0pt plus 1filll
57 Copyright @copyright{} 1991, 1992 Cygnus Support
58
59 Permission is granted to make and distribute verbatim copies of
60 this manual provided the copyright notice and this permission notice
61 are preserved on all copies.
62
63 Permission is granted to copy and distribute modified versions of this
64 manual under the conditions for verbatim copying, provided that the entire
65 resulting derived work is distributed under the terms of a permission
66 notice identical to this one.
67
68 Permission is granted to copy and distribute translations of this manual
69 into another language, under the above conditions for modified versions,
70 except that this permission notice may be stated in a translation approved
71 by Cygnus Support.
72 @end titlepage
73
74 @ifinfo
75
76 @node top, What Configure Does, (dir), (dir)
77 @top top
78
79 This file documents the configuration system used and distributed by
80 Cygnus Support.
81
82 @menu
83 * What Configure Does:: What Configure Does
84 * Invoking:: Invoking
85 * Using Configure:: Using Configure
86 * Porting:: Porting with Configure
87 * Reference:: Gory details described
88 * Known Bugs:: Known Bugs
89 * Variables Index:: Variable Index
90 * Concept Index:: Concept Index
91
92 --- The Detailed Node Listing ---
93
94 Using Configure
95
96 * Install Locations:: Where to install things once they are built
97 * Build Directories:: Where to build object files
98 * Host:: Telling @code{configure} what will source will
99 be built
100 * Target:: Telling @code{configure} what the source will
101 target
102 * Local Conventions:: Adding information about local conventions
103
104 Install Locations
105
106 * prefix:: Changing the default install directory
107 * exec_prefix:: How to separate host independent files
108 from host dependent files when
109 installing for multiple hosts
110 * Install Details:: Full descriptions of all installation
111 subdirectories
112
113 Porting with Configure
114
115 * Programs:: Adding configure to new programs
116 * Hosts and Targets:: Adding hosts and targets
117 * Sites:: Adding site info
118
119 Gory details described
120
121 * Makefile Extensions:: Extensions to the @sc{gnu} coding standards
122 * configure.in:: The format of the configure.in file
123 * config.status:: config.status
124 * Makefile Fragments:: Makefile Fragments
125
126 The format of the @file{configure.in} file
127
128 * Minimal:: A minimal configure.in
129 * Configure Variables:: Variables available to configure.in
130 * Declarations:: For each invocation
131 * Per-host:: For each host
132 * Per-target:: For each target
133 * Post-target:: After each target
134 * Example:: An example configure.in
135 @end menu
136
137 @end ifinfo
138
139 @node What Configure Does, Invoking, top, top
140 @chapter What Configure Does
141
142 @code{configure} prepares source directories for building working
143 programs. A program cannot be built until its source has been
144 configured. When configure runs, it does the following things.
145
146 @table @emph
147 @item Create build directories
148 (see @ref{Build Directories}). When you run @code{configure} with the
149 @code{-srcdir=} option, it uses the current directory as build
150 directory, creating under it a directory tree that parallels the
151 directory structure under the source directory. (See @ref{Invoking}).
152
153 @item Generate makefiles
154 A makefile template from the source directory, usually called
155 @file{Makefile.in}, is copied to an output file in the build directory.
156 The output file is usually named @file{Makefile}. @code{configure}
157 places definitions for a number of standard makefile macros at the
158 beginning of the output file. If @code{-prefix=} or @code{-exec_prefix}
159 were specified on the @code{configure} command line, corresponding
160 makefile variables are set accordingly. If host, target, or site
161 specific makefile fragments exist, these are inserted into the output
162 file. (See @ref{Makefiles, , , make, Makefiles}.)
163
164 @item Generate @file{.gdbinit} If the source directory contains a
165 @file{.gdbinit} file and the build directory is not the same as the
166 source directory, a @file{.gdbinit} file is created in the build
167 directory. This @file{.gdbinit} file contains @code{dir} commands and
168 a @code{source} command, which will cause the @file{.gdbinit} file from
169 the source directory to be read by GDB, and will allow GDB to find
170 source files in either the source directory or the build directory.
171 (see @ref{Command Files, , , gdb, Command Files}.)
172
173 @item Make symbolic links
174 Most directories have some symbolic links with generic names built
175 pointing to specific files in the source directory. If the system where
176 @code{configure} runs cannot support symbolic links, hard links are used
177 instead.
178
179 @item Miscellaneous
180 If the source directory has special needs, they are handled by shell
181 script fragments stored with the source. Usually there are no special
182 needs, but sometimes they involve changes to the output makefile.
183
184 @item Generate @file{config.status}
185 @code{configure} creates a shell script named @file{config.status} in
186 the build directory. This shell script, when run from the build
187 directory, will reconfigure the build directory (but not its
188 subdirectories). This is most often used to have a @code{Makefile} update
189 itself automatically if a new source directory is available.
190
191 @item Recursion
192 If the source directory has subdirectories that should also be
193 configured, @code{configure} is called for each.
194 @end table
195
196 @node Invoking, Using Configure, What Configure Does, top
197 @chapter Invoking
198
199 The usual way to invoke @code{configure} is as follows:
200 @example
201 configure @var{host}
202 @end example
203 This prepares the source to be compiled in a
204 @var{host} environment with programs and files to be installed in
205 @file{/usr/local}.
206
207 @code{configure} prepares the source as you specify by selecting and
208 using script and Makefile fragments prepared in advance, and stored with
209 the source. @code{configure}'s command line options also allow you to
210 specify other aspects of the source configuration:
211
212 @table @code
213 @item -exec_prefix=@var{dir}
214 Configure the source to install host dependent files in @var{dir}.
215
216 This option sets the @code{configure} variable @code{exec_prefix}.
217 Generated Makefiles will have their @code{exec_prefix} variables set to
218 this value. (See @ref{Install Details}.)
219
220 @item -gas
221 Configure to use the @sc{GNU} assembler.
222
223 @item -help
224 Display a quick summary of how to invoke @code{configure}.
225
226 @item -host=@var{host}
227 FIXME-soon: I don't think this option should be documented.
228 @c Then why does it exist? /Pesch 7jan92
229
230 @item -nfp
231 @emph{No floating point} unit available on the target; configure to
232 avoid dependencies on hardware floating point.
233
234 @item -norecursion
235 Configure only this directory; ignore any subdirectories. This is used
236 by the executable shell script @file{config.status} to reconfigure the
237 current directory. (see @ref{config.status}).
238
239 @item -prefix=@var{dir}
240 Configure the source to install programs and files under directory
241 @file{@var{dir}}.
242
243 This option sets the @code{configure} variable @code{prefix}. Generated
244 Makefiles will have their @code{prefix} variables set to this value.
245 (See @ref{Install Details}.)
246
247 @item -recurring
248 @c Wouldn't it make more sense to call this "-quiet"? (FIXME).
249 This option is used internally by @code{configure} when recurring on
250 subdirectories. Its sole purpose is to suppress status output. You can
251 override this effect with the @code{-verbose} option.
252
253 @item -rm
254 @emph{Remove} the configuration specified by @var{host} and the other
255 command-line options, rather than creating it.
256
257 @item -site=@var{site}
258 Generate Makefiles using site specific Makefile fragments for
259 @var{site}. See also @ref{Sites}.
260
261 @item -srcdir=@var{_dir}
262 Build Makefiles to use the sources located in directory @file{@var{dir}}. The
263 build directory is assumed to be @file{.}.
264
265 @item -target=@var{target}
266 Requests that the sources be configured to target the @var{target}
267 machine. If no target is specified explicitly, the target is assumed
268 to be the same as the host.
269
270 @item -tmpdir=@var{tmpdir}
271 Use the directory @var{tmpdir} for @code{configure}'s temporary files.
272 The default is the value of the environment variable TMPDIR, or
273 @file{/tmp} if the environment variable is not set.
274
275 @item -verbose
276 @itemx -v
277 Print status lines for each directory configured. Normally, only the
278 status lines for the initial working directory are printed.
279
280 @item -x
281 Use @sc{MIT} style @sc{X11} header files and libraries on the host, even
282 if they are not normally available.
283 @end table
284
285 @node Using Configure, Porting, Invoking, top
286 @chapter Using Configure
287
288 The choices and options available at configuration time
289 generally have valid defaults, but the defaults do not cover all cases.
290 The choices available include install locations, build directories,
291 host, target, and local conventions.
292
293 @menu
294 * Install Locations:: Where to install things once they are built
295 * Build Directories:: Where to build object files
296 * Host:: Telling @code{configure} what will source will
297 be built
298 * Target:: Telling @code{configure} what the source will
299 target
300 * Local Conventions:: Adding information about local conventions
301 @end menu
302
303 @node Install Locations, Build Directories, Using Configure, Using Configure
304 @section Install Locations
305 @cindex Where to install
306
307 Using the default configuration, @code{make install} creates a
308 single tree of files, some of which are programs. The location of this
309 tree is determined by the value of the variable @code{prefix}. The
310 default value of @code{prefix} is @file{/usr/local}. This is
311 often correct for native tools installed on only one host.
312
313 @menu
314 * prefix:: Changing the default install directory
315 * exec_prefix:: How to separate host independent files
316 from host dependent files when
317 installing for multiple hosts
318 * Install Details:: Full descriptions of all installation
319 subdirectories
320 @end menu
321
322 @node prefix, exec_prefix, Install Locations, Install Locations
323 @subsection Changing the default install directory
324 @cindex Changing the default install directory
325 @cindex Prefix directory
326
327 In the default configuration, all files are installed in subdirectories
328 of @file{/usr/local}. The location is determined by the value of
329 the @code{configure} variable @code{prefix}; in turn, this determines the
330 value of the Makefile variable of the same name (@code{prefix}).
331
332 You can also set the value of the Makefile variable @code{prefix}
333 explicitly each time you invoke @code{make} if you are so inclined; but
334 because many programs have this location compiled in, you must specify
335 the @code{prefix} value consistently on each invocation of @code{make},
336 or you will end up with a broken installation.
337
338 To make this easier, the value of the @code{configure} variable
339 @code{prefix} can be set on the command line to @code{configure}
340 using the option @code{-prefix=}.
341
342
343 @node exec_prefix, Install Details, prefix, Install Locations
344 @subsection Installing for multiple hosts
345 @cindex Configuring for multiple hosts
346 @cindex Sharing host independent files
347 @cindex The @file{exec_prefix} directory
348 @cindex Installing host independent files
349
350 By default, host dependent files are installed in subdirectories of
351 @file{@var{exec_prefix}}. The location is determined by the value of the
352 @code{configure} variable @code{exec_prefix}, which determines the value of
353 the Makefile variable @code{exec_prefix}. This makes it simpler to install
354 for a single host, and simplifies changing the default location for the
355 install tree; but the default doesn't allow for multiple hosts to
356 effectively share host independent files.
357
358 To configure so that multiple hosts can share common files, use
359 something like:
360
361 @example
362 configure @var{host1} -prefix=/usr/gnu -exec_prefix=/usr/gnu/H-host1
363 make all info install install-info clean
364
365 configure @var{host2} -prefix=/usr/gnu -exec_prefix=/usr/gnu/H-host2
366 make all info install install-info
367 @end example
368
369 The first line configures the source for @var{host1} to place host
370 specific programs in subdirectories of @file{/usr/gnu/H-@var{host1}}.
371
372 The second line builds and installs all programs for @var{host1},
373 including both host independent and host specific files.
374
375 The third line reconfigures the source for @var{host2} to place host
376 specific programs in subdirectories of @file{/usr/gnu/H-@var{host2}}.
377
378 The fourth line builds and installs all programs for @var{host2}. Host
379 specific files are installed in new directories, but the host
380 independent files are installed @emph{on top of} the host
381 independent files installed for @var{host1}. This results in a single
382 copy of the host independent files, suitable for use by both hosts.
383
384 @node Install Details, , exec_prefix, Install Locations
385 @subsection Full descriptions of all installation subdirectories
386
387 During any install, a number of standard directories are created. Their
388 names are determined by Makefile variables. Some of the
389 defaults for Makefile variables can be changed at configure time using
390 command line options to @code{configure}. For more information on the
391 standard directories or the Makefile variables, please refer to
392 @cite{standards.text}.
393
394 Note that @code{configure} does not create the directory @code{srcdir}
395 at any time. @code{srcdir} is not an installation directory.
396
397 You can override all makefile variables on the command line to
398 @code{make}. (See @ref{Overriding, Overriding Variables, Overriding
399 Variables, make, Make}.) If you do so, you will need to specify the
400 value precisely the same way for each invocation of @code{make}, or you
401 risk ending up with a broken installation. This is because many
402 programs have the locations of other programs or files compiled into
403 them. If you find yourself overriding any of the variables frequently,
404 you should consider site dependent Makefile fragments. See also
405 @ref{Sites}.
406
407 During @code{make install}, a number of standard directories are
408 created and populated. The following Makefile variables define them.
409 Those whose defaults are set by corresponding @code{configure} variables
410 are marked ``Makefile and configure''.
411
412 @vindex prefix
413 @defvr {Makefile and configure} prefix
414 The root of the installation tree. You can set
415 its Makefile default with the @code{-prefix=} command line option to
416 @code{configure}. (@ref{Invoking}.) The default value for
417 @code{prefix} is @file{/usr/local}.
418 @end defvr
419
420 @vindex bindir
421 @defvr Makefile bindir
422 A directory for binary programs that users can run.
423 The default value for @code{bindir} depends on @code{prefix};
424 @code{bindir} is normally changed only indirectly through @code{prefix}.
425 The default value for @code{bindir} is @file{$(prefix)/bin}.
426 @end defvr
427
428 @vindex exec_prefix
429 @defvr {Makefile and configure} exec_prefix
430 A directory for host dependent files. You can specify the Makefile
431 default value by using the @code{-exec_prefix=} option to @code{configure}.
432 (See also @ref{Invoking}.) The default value for @code{exec_prefix} is
433 @file{$(prefix)}.
434 @end defvr
435
436 @vindex libdir
437 @defvr Makefile libdir
438 A directory for libraries and support programs. The default value for
439 @code{libdir} depends on @code{prefix}; @code{libdir} is normally
440 changed only indirectly through @code{prefix}. The default value for
441 @code{libdir} is @file{$(prefix)/lib}.
442 @end defvr
443
444 @vindex mandir
445 @defvr Makefile mandir
446 A directory for @code{man} format documentation (``man pages''). The
447 default value for @code{mandir} depends on @code{prefix};
448 @code{mandir} is normally changed only indirectly through @code{prefix}.
449 The default value for @code{mandir} is @file{$(prefix)/man}.
450 @end defvr
451
452 @vindex man@var{N}dir
453 @defvr Makefile man@var{N}dir
454 There are eight variables named @code{man1dir}, @code{man2dir}, etc.
455 They name the specific directories for each man page section. For
456 example, @code{man1dir} holds @file{emacs.1} (the man page for the emacs
457 program), while @code{man5dir} holds @file{rcsfile.5} (the man page
458 describing the @code{rcs} data file format). The default value for any
459 of the @code{man@var{N}dir} variables depends indirectly on
460 @code{prefix}, and is normally changed only through @code{prefix}. The
461 default value for @code{man@var{N}dir} is
462 @file{$(mandir)/man@var{N}}.
463 @end defvr
464
465 @vindex manext
466 @defvr Makefile manext
467 @emph{Not supported by @code{configure}}. The @sc{gnu} coding standards
468 do not call for @code{man1ext}, @code{man2ext}, so the intended use for
469 @code{manext} is apparently not parallel to @code{mandir}. Its use is
470 not clear. (See also @ref{Makefile Extensions}.)
471 @end defvr
472
473 @vindex infodir
474 @defvr Makefile infodir
475 A directory for @emph{info} format documentation. The default value for
476 @code{infodir} depends indirectly on @code{prefix}; @code{infodir} is
477 normally changed only through @code{prefix}. The default value for
478 @code{infodir} is @file{$(prefix)/info}.
479 @end defvr
480
481 @vindex docdir
482 @defvr Makefile docdir
483 A directory for any documentation that is in a format other than those
484 used by @code{info} or @code{man}. The default value for @code{docdir}
485 depends indirectly on @code{prefix}; @code{docdir} is normally changed only
486 through @code{prefix}. The default value for @code{docdir}
487 is @file{$(datadir)/doc}. @emph{This variable is an extension to
488 the @sc{gnu} coding standards}. (See also @ref{Makefile Extensions}.)
489 @end defvr
490
491 @vindex includedir
492 @defvr Makefile includedir
493 A directory for the header files accompanying the libraries installed in
494 @code{libdir}. The default value for @code{includedir} depends on
495 @code{prefix}; @code{includedir} is normally changed only indirectly
496 through @code{prefix}. The default value for @code{includedir} is
497 @file{$(prefix)/include}.
498 @end defvr
499
500 @node Build Directories, Host, Install Locations, Using Configure
501 @section Build Directories
502 @cindex Build directories
503 @kindex objdir
504 @cindex Object directories
505 @kindex subdirs
506 @cindex Building for multiple hosts
507 @cindex Building for multiple targets
508
509 Normally, @code{configure} builds a @file{Makefile} and symbolic links
510 in the same directory as the source files. This is the typical
511 @sc{un*x} way to build programs, but it has limitations. For instance,
512 using this approach, you can only build for one host at a time.
513
514 We refer to the directories where @code{configure} builds a
515 Makefile as the @emph{build directories} or sometimes as
516 @emph{objdir} because these are the directories in which @code{make}
517 will build object files, among other things.
518
519 The default build directory is the same as the source directory.
520 You can use a different build directory with a sequence like the following:
521
522 @example
523 mkdir @var{builddir}
524 cd @var{builddir}
525 configure @var{host} -srcdir=@var{sourcedirectory}
526 @end example
527
528 @noindent
529 where @var{builddir} is the directory where you wish to build,
530 @var{host} is the host for which you want to build, and
531 @var{sourcedirectory} is the directory containing the source files.
532
533 If you were to do this twice with different values for @var{builddir}
534 and @var{host}, then you could @code{make} for both at the same time.
535
536 @node Host, Target, Build Directories, Using Configure
537 @section Host
538
539 The arguments to @code{configure} are @emph{hosts}. By @emph{host} we
540 mean the environment in which the source will be compiled. This need
541 not necessarily be the same as the physical machine involved,
542 although it usually is.
543
544 For example, if some obscure machine running an operating system other
545 than @sc{un*x} had the @sc{gnu} @sc{posix} emulation libraries
546 available, it would be possible to configure most @sc{gnu} source for a
547 @sc{posix} system and build it on the obscure host.
548
549 For more on this topic, see @ref{Host Environments, , Host Environments,
550 cfg-paper, On Configuring Development Tools}.
551
552 @node Target, Local Conventions, Host, Using Configure
553 @section Target
554
555 For building native development tools, or most of the other @sc{gnu}
556 tools, you need not worry about the target. The @emph{target} of a
557 configuration defaults to the same as the @emph{host}.
558
559 For building cross development tools, please see @ref{Building
560 Development Environments, , Building Development Environments,
561 cfg-paper, On Configuring Development Tools}.
562
563 @node Local Conventions, , Target, Using Configure
564 @section Local Conventions
565
566 If you find that a tool does not get configured to your liking, or if
567 @code{configure}'s conventions differ from your local conventions, you
568 should probably consider site specific Makefile fragments. See also
569 @ref{Sites}.
570
571 These are probably not the right choice for options that can be set from
572 the @code{configure} command line or for differences that are host or
573 target dependent.
574
575 @node Porting, Reference, Using Configure, top
576 @chapter Porting with Configure
577 @cindex Porting
578
579 This section explains how to add programs, host and target configuration
580 names, and site-specific information to Cygnus configure.
581
582 @menu
583 * Programs:: Adding configure to new programs
584 * Hosts and Targets:: Adding hosts and targets
585 * Sites:: Adding site info
586 @end menu
587
588
589 @node Programs, Hosts and Targets, Porting, Porting
590 @section Adding Configure To New Programs
591
592 If you are writing a new program, you probably shouldn't worry about
593 porting issues or configure until it is running reasonably on some host.
594 Then refer back to this section.
595
596 If the program in question currently has a configure script that meets
597 the criteria set out by @cite{standards.text}, please do not add Cygnus
598 configure. It should be possible to add this program without change to
599 a Cygnus configure style source tree.
600
601 If the program is not target dependent, please consider using
602 @code{autoconf} instead of Cygnus configure. @code{autoconf} will
603 be available soon from the @sc{fsf}.
604
605 To add Cygnus configure to an existing program, do the following:
606
607 @table @asis
608 @item Make sure the Makefile conforms to @sc{gnu} standard
609 The coding standard for @sc{gnu} Makefiles is described in
610 @cite{standards.text}.
611
612 @item Add Cygnus extensions to the Makefile
613 These are described in @ref{Makefile Extensions}.
614
615 @item Move host support from Makefile to fragments
616 This usually involves finding sections of the Makefile that say things
617 like ``uncomment these lines for host foo'' and moving them to a new
618 file called @file{./config/mh-foo}. For more information, see @ref{Hosts
619 and Targets}.
620
621 @item Choose defaults
622 If the program has compile time options that determine the way the
623 program should behave, chose reasonable defaults and make these Makefile
624 variables. Be sure the variables are assigned their default values
625 before the @code{####} line so that site specific Makefile fragments can
626 override them (@pxref{Makefile Extensions,,Extensions to the @sc{gnu}
627 coding standards}).
628
629 @item Locate configuration files
630 If there is configuration information in header files or source files,
631 separate it in such a way that the files have a generic name. Then move
632 the specific instances of those files into the @file{./config}
633 directory.
634
635 @item Separate host and target information
636 Some programs already have this information separated. If yours does
637 not, you will need to separate these two kinds of configuration
638 information. @dfn{Host specific} information is the information needed to
639 compile the program. @dfn{Target specific} information is information on the
640 format of data files that the program will read or write. This
641 information should live in separate files in the @file{./config}
642 directory with names that reflect the configuration for which they are
643 intended.
644
645 At this point you might skip this step and simply move on. If you do,
646 you should end up with a program that can be configured only to build
647 native tools, that is, tools for which the host system is also the
648 target system. Later, you could attempt to build a cross tool and
649 separate out the target specific information by figuring out what went
650 wrong. This is often simpler than combing through all of the source
651 code.
652
653 @item Write @code{configure.in}
654 Usually this involves writing shell script fragments to map from
655 canonical configuration names into the names of the configuration files.
656 These files will then be linked at configure time from the specific
657 instances of those files in @file{./config} to file in the build
658 directory with more generic names. (see also @ref{Build Directories}).
659 The format of configure.in is described in @ref{configure.in}.
660
661 @item Rename @file{Makefile} to @file{Makefile.in}
662 @end table
663
664 At this point you should have a program that can be configured using
665 Cygnus @code{configure}.
666
667 @node Hosts and Targets, Sites, Programs, Porting
668 @section Adding hosts and targets
669
670 To add a host or target to a program that already uses Cygnus
671 configure, do the following.
672
673 @itemize @bullet
674
675 @item
676 Make sure the new configuration name is represented in
677 @file{config.sub}. If not, add it. For more details, see the comments
678 in the shell script @file{config.sub}.
679
680 @item
681 If you are adding a host configuration, look in @file{configure.in}, in
682 the per-host section. Make sure that your configuration name is
683 represented in the mapping from host configuration names to
684 configuration files. If not, add it. Also see @ref{configure.in}.
685
686 @item
687 If you are adding a target configuration, look in @file{configure.in},
688 in the per-target section. Make sure that your configuration name is
689 represented in the mapping from target configuration names to
690 configuration files. If not, add it. Also see @ref{configure.in}.
691
692 @item
693 Look in @file{configure.in} for the variables @samp{files},
694 @samp{links}, @samp{host_makefile_frag}, and
695 @samp{target_makefile_frag}. The values assigned to these variables are
696 the names of the configuration files, relative to @code{srcdir} that the
697 program uses. Make sure that copies of the files exist for your host.
698 If not, create them. See also @ref{Configure Variables}.
699 @end itemize
700
701 This should be enough to configure for a new host or target
702 configuration name. Getting the program to compile and run properly
703 remains the hard work of the port.
704
705 @node Sites, , Hosts and Targets, Porting
706 @section Adding site info
707
708 If some of the Makefile defaults are not right for your site, you can
709 build site specific Makefile fragments. To do this, do the following.
710
711 @itemize @bullet
712
713 @item
714 Choose a name for your site. It must be less than eleven characters for
715 now.
716
717 @item
718 If the program source does not have a @file{./config} directory, create it.
719
720 @item
721 Create a file called @file{./config/ms-@var{site}} where @var{site} is
722 the name of your site. In it, set whatever Makefile variables you need
723 to override to match your site's conventions.
724
725 @item
726 Configure the program with:
727
728 @example
729 configure @dots{} +site=@var{site}
730 @end example
731
732 @end itemize
733
734 @node Reference, Known Bugs, Porting, top
735 @chapter Gory details described
736
737 @cindex Backends
738 Here we describe the backend support.
739
740 @menu
741 * Makefile Extensions:: Extensions to the @sc{gnu} coding standards
742 * configure.in:: The format of the configure.in file
743 * config.status:: config.status
744 * Makefile Fragments:: Makefile Fragments
745 @end menu
746
747 @node Makefile Extensions, configure.in, Reference, Reference
748 @section Extensions to the @sc{gnu} coding standards
749
750 @cindex Makefile extensions
751 @cindex Cygnus extensions
752
753 The following additions to the @sc{gnu} coding standards are required
754 for Cygnus configure to work properly.
755
756 @itemize @bullet
757 @item
758 The Makefile must contain exactly one line starting with @code{####}.
759 This line should follow any default macro definitions but precede any
760 rules. Host, target, and site specific Makefile fragments will be
761 inserted immediately after this line. If the line is missing, the
762 fragments will not be inserted.
763 @end itemize
764
765 Cygnus adds the following targets to our Makefiles. Their existence is
766 not required for Cygnus configure, but they are documented here for
767 completeness.
768
769 @table @code
770 @kindex info
771 @item info
772 Build all info files from texinfo source.
773
774 @kindex install-info
775 @item install-info
776 Install all info files.
777
778 @kindex clean-info
779 @item clean-info
780 Remove all info files and any intermediate files that can be generated
781 from texinfo source.
782
783 @kindex stage1
784 @item stage1
785 @kindex stage2
786 @itemx stage2
787 @kindex stage3
788 @itemx stage3
789 @kindex stage4
790 @itemx stage4
791 @kindex de-stage1
792 @itemx de-stage1
793 @kindex de-stage2
794 @itemx de-stage2
795 @kindex de-stage3
796 @itemx de-stage3
797 @kindex de-stage4
798 @itemx de-stage4
799 @kindex bootstrap
800 @itemx bootstrap
801 @kindex comparison
802 @itemx comparison
803 @kindex Makefile
804 @itemx Makefile
805 These targets are in transition and may be removed shortly.
806 @end table
807
808 In addition, the following Makefile targets have revised semantics:
809
810 @table @code
811 @kindex install
812 @item install
813 Should @emph{not} depend on the target @code{all}. If the program is
814 not already built, @code{make install} should fail. This allows you
815 to install programs even when @code{make} would otherwise determine
816 them to be out of date. This can happen when the result of a @code{make
817 all} is transported via tape to another machine for installation as
818 well as in a number of other cases.
819
820 @kindex clean
821 @item clean
822 Should remove any file that can be regenerated by the Makefile,
823 excepting only the Makefile itself, and any links created by configure.
824 That is, @code{make all clean} should return all directories to their
825 original condition. If this is not done, then:
826
827 @example
828 configure @var{host1} ; make all clean ; configure @var{host2} ; make all
829 @end example
830
831 @noindent
832 will fail because of intermediate files intended for @var{host1}.
833 @end table
834
835 Cygnus adds the following macros to all @file{Makefile.in} files, but
836 you are not required to use them to run Cygnus configure.
837
838 @table @code
839 @kindex docdir
840 @item docdir
841 The directory in which to install any documentation that is not either a
842 man page or an info file. For man pages, see mandir, for info, see
843 infodir.
844
845 @kindex includedir
846 @item includedir
847 The directory in which to install any headers files that should be made
848 available to users. This is distinct from the @code{gcc} include
849 directory which is intended for @code{gcc} only. Files in
850 @code{includedir} may be used by @code{cc} as well.
851 @end table
852
853 In addition, the following macros have revised semantics. Most of them
854 describe installation directories; see also @ref{Install Details,,Full
855 description of all installation subdirectories}.
856
857 @table @code
858
859 @kindex manext
860 @item manext
861 is not used. The intended usage is not clear. For example, if you have a
862 @file{foo.man} and a @file{bar.man}, and @file{foo.man} is destined for
863 @file{/usr/local/lib/man/man1/foo.1} while @file{bar.man} is destined
864 for @file{/usr/local/lib/man/man5/bar.5}, then what is the desired value
865 of @code{manext}?
866
867 @kindex datadir
868 @item datadir
869 is used for host independent data files.
870
871 @kindex mandir
872 @item mandir
873 The default path for @code{mandir} depends on @code{prefix}.
874
875 @kindex infodir
876 @item infodir
877 The default path for @code{infodir} depends on @code{prefix}.
878
879 @kindex BISON
880 @item BISON
881 is assumed to have a @code{yacc} calling convention. To use
882 @code{bison}, use @code{BISON=bison -y}.
883 @end table
884
885 Cygnus Makefiles also conform to one additional restriction:
886
887 @itemize @bullet
888 @item
889 When libraries are installed, the line containing the call to
890 @code{INSTALL_DATA} should always be followed by a line containing a
891 call to @code{RANLIB} on the installed library. This is to accomodate
892 systems that use @code{ranlib}. Systems that do not use @code{ranlib}
893 can set @code{RANLIB} to @code{echo} in a host specific Makefile
894 fragment.
895 @end itemize
896
897 @node configure.in, config.status, Makefile Extensions, Reference
898 @section The format of the @file{configure.in} file
899 @kindex configure.in
900
901 A @file{configure.in} file for Cygnus configure consists of a
902 @dfn{per-invocation} section, followed by a @dfn{per-host} section,
903 followed by a @dfn{per-target} section, optionally followed by a
904 @dfn{post-target} section. Each section is a shell script fragment,
905 which is sourced by the configure shell script at an appropriate time.
906 Values are passed among configure and the shell fragments through a
907 set of shell variables. When each section is being interpreted
908 (sourced) by the shell, the shell's current directory is the build
909 directory, and any files created by the section (or referred to by the
910 section) will be relative to the build directory. To reference files
911 in other places (such as the source directory), prepend a shell
912 variable such as @code{srcdir} to the desired file name.
913
914 @cindex Per-invocation section
915 The beginning of the @file{configure.in} file begins the per-invocation
916 section.
917
918 @cindex Per-host section
919 A line beginning with @code{# Per-host:} begins the per-host section.
920
921 @cindex Per-target section
922 A line beginning with @code{# Per-target:} begins the per-target
923 section.
924
925 @cindex Post-target section
926 If it exists, the post-target section begins with @code{# Per-target:}.
927
928 @menu
929 * Minimal:: A minimal configure.in
930 * Configure Variables:: Variables available to configure.in
931 * Declarations:: For each invocation
932 * Per-host:: For each host
933 * Per-target:: For each target
934 * Post-target:: After each target
935 * Example:: An example configure.in
936 @end menu
937
938 @node Minimal, Configure Variables, configure.in, configure.in
939 @subsection A minimal @file{configure.in}
940
941 @cindex Minimal @file{configure.in} example
942 A minimal @file{configure.in} consists of four lines.
943
944 @example
945 srctrigger=foo.c
946 srcname="source for the foo program"
947 # Per-host:
948 # Per-target:
949 @end example
950
951 The @samp{Per-host} and @samp{Per-target} lines divide the file into the
952 three required sections. The @samp{srctrigger} line names a file.
953 @code{configure} checks to see that this file exists in the source
954 directory before configuring. If the @samp{srctrigger} file does not
955 exist, @code{configure} uses the value of @samp{srcname} to print an
956 error message about not finding the source.
957
958 This particular example uses no links, and only the default host,
959 target, and site specific Makefile fragments if they exist.
960
961 @node Configure Variables, Declarations, Minimal, configure.in
962 @subsection Variables available to configure.in
963
964 @cindex @file{configure.in} interface
965
966 The following variables pass information between the standard parts of
967 @code{configure} and the shell-script fragments in @file{configure.in}:
968
969 @defvar{srctrigger}
970 Contains the name of a source file that is expected to live in the
971 source directory. You must usually set this in the per-invocation
972 section of @file{configure.in}. Configure tests to see that this file
973 exists. If the file does not exist, configure prints an error message.
974 This is used as a sanity check that configure.in matches the source
975 directory.
976 @end defvar
977
978 @defvar{srcname}
979 Contains the name of the source collection contained in the source
980 directory. You must usually set this in the per-invocation section of
981 @file{configure.in}. If the file named in @code{srctrigger} does not
982 exist, configure uses the value of this variable when it prints the
983 error message.
984 @end defvar
985
986 @defvar{configdirs}
987 Contains the names of any subdirectories where @code{configure} should
988 recur. You must usually set this in the per-invocation section of
989 @file{configure.in}.
990 If @file{Makefile.in} contains a line starting with @code{SUBDIRS =},
991 then it will be replaced with an assignment to @code{SUBDIRS} using
992 the value of @code{configdirs} (if @code{subdirs} is empty). This can
993 be used to determine which directories to configure and build depending
994 on the host and target configurations.
995 @c Most other matching makefile/config vars use the same name. Why not
996 @c this? (FIXME).
997 @c Can we get rid of SUBDIRS-substitution? It doesn't work well with subdirs.
998 Use @code{configdirs} (instead of the @code{subdirs} variable
999 described below) if you want to be able to partition the
1000 sub-directories, or use independent Makefile fragments.
1001 Each sub-directory can be independent, and independently re-configured.
1002 @end defvar
1003
1004 @defvar{subdirs}
1005 Contains the names of any subdirectories where @code{configure} should
1006 create a @code{Makefile} (in addition to the current directory),
1007 @emph{without} recursively running @code{configure}.
1008 Use @code{subdirs} (instead of the @code{configdirs} variable
1009 described above) if you want to configure all of the directories
1010 as a unit. Since there is a single invocation of @code{configure}
1011 that configures many directories, all the directories can use the
1012 same Makefile fragments, and the same @code{configure.in}.
1013 @end defvar
1014
1015 @defvar{host}
1016 Contains the name that the user entered for the host. Since many things
1017 that the user could enter would map to the same output from
1018 @code{config.sub}, this variable is innappropriate to use for picking
1019 available configurations. For that, use @code{host_cpu},
1020 @code{host_vendor}, and/or @code{host_os}. This variable is useful,
1021 however, for error messages.
1022 @end defvar
1023
1024 @defvar{host_cpu}
1025 Contains the first element of the canonical triple representing the host
1026 as returned by @file{config.sub}. This is occasionally used to
1027 distinguish between minor variations of a particular vendor's operating
1028 system and sometimes to determine variations in binary format between
1029 the host and the target.
1030 @end defvar
1031
1032 @defvar{host_vendor}
1033 Contains the second element of the canonical triple representing the
1034 host as returned by @file{config.sub}. This is usually used to
1035 distinguish betwen the numerous variations between @emph{common}
1036 operating systems.
1037 @c "@emph{common} OS" doesn't convey much to me. Is this meant to cover
1038 @c cases like Unix, widespread but with many variations?
1039 @end defvar
1040
1041 @defvar{host_os}
1042 Contains the the third element of the canonical triple representing the
1043 host as returned by @file{config.sub}.
1044 @end defvar
1045
1046 @defvar{target}
1047 Contains the name that the user entered for the target. Since
1048 many things that the user could enter would map to the same canonical
1049 triple, this variable is innappropriate to use for picking available
1050 configurations. For that, use @code{target_cpu}, @code{target_vendor},
1051 and/or @code{target_os}. This variable is useful, however, for error
1052 messages.
1053 @end defvar
1054
1055 @defvar{target_cpu}
1056 Contains the first element of the canonical triple representing the
1057 target as returned by @file{config.sub}. This is used heavily by
1058 programs involved in building programs, like the compiler, assembler,
1059 linker, etc. Most programs will not need the @code{target} variables at
1060 all, but this one could conceivably be used to build a program, for
1061 instance, that operated on binary data files whose byte order or
1062 alignment differ from the system where the program is running.
1063 @end defvar
1064
1065 @defvar{target_vendor}
1066 Contains the second element of the canonical triple representing the
1067 target as returned by @file{config.sub}. This is usually used to
1068 distinguish betwen the numerous variations between @emph{common}
1069 operating systems or object file formats. Sometimes it is used to
1070 switch between different flavors of user interfaces.
1071 @c above query re "@emph{common} OS" applies here too
1072 @end defvar
1073
1074 @defvar{target_os}
1075 Contains the the third element of the canonical triple representing the
1076 target as returned by @file{config.sub}. This variable is used by
1077 development tools to distinguish between subtle variations in object
1078 file formats that some vendors use across operating system releases. It
1079 might also be use to decide which libraries to build or what user
1080 interface the tool should provide.
1081 @end defvar
1082
1083 @defvar{floating_point}
1084 Is set to @code{no} if the user invoked configure with the @code{-nfp}
1085 command line option, otherwise it is empty. This is a request to target
1086 machines with @emph{no floating point} unit, even if the targets
1087 ordinarily have floating point units available. This option has no
1088 negation.
1089 @end defvar
1090
1091 @defvar{gas}
1092 Is set to @code{true} if the user invoked configure with the @code{-gas}
1093 command line option, otherwise it is empty. This is a request to assume
1094 that all target machines have @sc{gas} available even if they ordinarily do
1095 not. The converse option @samp{-no-gas} is not available.
1096 @end defvar
1097
1098 @defvar{x}
1099 Is set to @code{true} if the user invoked configure with the @code{-x}
1100 command line option, otherwise it is empty. This is a request to assume
1101 that @sc{mit x11} compatible headers files and libraries are available
1102 on all hosts, regardless of what is normally available on them.
1103 @end defvar
1104
1105 @defvar{srcdir}
1106 Is set to the name of the directory containing the source for this
1107 program. This will be different from @file{.} if the user has specified
1108 the @code{-srcdir=} option. Note that @code{srcdir} is not necessarily
1109 an absolute path.
1110 @end defvar
1111
1112 @defvar{host_makefile_frag}
1113 If set by @file{configure.in}, this variable should be the name a file,
1114 relative to @code{srcdir} to be included in the resulting Makefile. If
1115 the named file does not exist, @code{configure} will print a warning
1116 message. This variable is not set by @code{configure}.
1117 @end defvar
1118
1119 @defvar{target_makefile_frag}
1120 If set by @file{configure.in}, this variable should be the name of a
1121 file, relative to @code{srcdir}, to be included in the resulting
1122 Makefile. If the named file does not exist, @code{configure} will print
1123 a warning message. This variable is not set by @code{configure}.
1124 @end defvar
1125
1126 @defvar{site_makefile_frag}
1127 Is set to a file name representing to the default Makefile fragment for
1128 this host. It may be set in @file{configure.in} to override this
1129 default. Normally @code{site_makefile_frag} is empty, but will have a
1130 value if the user specified @code{-site=} on the command line. It is
1131 probably not a good idea to override this variable from
1132 @file{configure.in}, since that may defeat the @code{configure} user's
1133 intentions.
1134 @end defvar
1135
1136 @defvar{Makefile}
1137 Is set to the name of the generated @file{Makefile}. Normally this
1138 value is precisely @file{Makefile} but some programs may want something
1139 else.
1140 @end defvar
1141
1142 @defvar{removing}
1143 Is normally empty but will be set to some non-empty value if the user
1144 specified @code{-rm} on the command line. That is, if @code{removing}
1145 is non-empty, then configure is @emph{removing} a configuration rather
1146 than creating one.
1147 @end defvar
1148
1149 @defvar{files}
1150 If this variable is non-empty following the @code{per-target:} section,
1151 then each word in its value will be the target of a symbolic link named
1152 in the corresponding word from the @code{links} variable.
1153 @end defvar
1154
1155 @defvar{links}
1156 If the @code{files} variable is non-empty following the
1157 @code{per-target:} section, then @code{configure} creates symbolic links
1158 with the first word of @code{links} pointing to the first word of
1159 @code{files}, the second word of @code{links} pointing to the second
1160 word of @code{files}, and so on.
1161 @end defvar
1162
1163 @node Declarations, Per-host, Configure Variables, configure.in
1164 @subsection For each invocation
1165
1166 @cindex Declarations section
1167
1168 @code{configure} sources the entire shell script fragment from the start
1169 of @file{configure.in} up to a line beginning with @samp{# Per-host:}
1170 immediately after parsing command line arguments. The variables
1171 @code{srctrigger} and @code{srcname} @emph{must} be set here.
1172
1173 You might also want to set the variable @code{configdirs} here.
1174
1175 @node Per-host, Per-target, Declarations, configure.in
1176 @subsection For each host
1177 @cindex per-host section
1178 @cindex host shell-script fragment
1179
1180 The per-host section of @file{configure.in} starts with the line that begins
1181 with @samp{# Per-host:} and ends before a line beginning with
1182 @samp{# Per-target:}. @code{configure} sources the per-host section once for
1183 each host.
1184
1185 This section usually contains a big case statement using the variables
1186 @samp{host_cpu}, @samp{host_vendor}, and @samp{host_os} to determine
1187 appropriate values for @samp{host_makefile_frag} and @samp{files},
1188 although @samp{files} is not usually set here. Usually, it is set
1189 at the end of the per-target section after determining the names of the
1190 target specific configuration files.
1191
1192 @node Per-target, Post-target, Per-host, configure.in
1193 @subsection For each target
1194 @cindex per-target section
1195 @cindex target shell-script fragment
1196
1197 The per-target section of @file{configure.in} starts with the line that
1198 begins with @samp{# Per-target:} and ends before the line that begins
1199 with @samp{# Post-target:}, if there is such a line. Otherwise the
1200 per-target section extends to the end of the file. @code{configure} sources
1201 the per-target section once for each target before building any files,
1202 directories, or links.
1203
1204 This section usually contains a big case statement using the variables called
1205 @samp{target_cpu}, @samp{target_vendor}, and @samp{target_os} to determine
1206 appropriate values for @samp{target_makefile_frag} and @samp{files}.
1207 The last lines in the per-target section normally set the variables
1208 @code{files} and @code{links}.
1209
1210 @node Post-target, Example, Per-target, configure.in
1211 @subsection After each target
1212
1213 The post-target section is optional. If it exists, the post-target
1214 section starts with a line beginning with @code{# Post-target:} and
1215 extends to the end of the file. If it exists, @code{configure} sources this
1216 section once for each target after building all files, directories, or
1217 links.
1218
1219 This section is seldom needed, but you can use it to edit the Makefile
1220 generated by @code{configure}.
1221
1222 @node Example, , Post-target, configure.in
1223 @subsection An example @file{configure.in}
1224 @cindex example @file{configure.in}
1225 @cindex sample @file{configure.in}
1226 @cindex Bison @file{configure.in}
1227
1228 Here is a small example of a @file{configure.in} file.
1229
1230 @example
1231 # This file is a collection of shell script fragments used to tailor
1232 # a template configure script as appropriate for this directory.
1233 # For more information, see configure.texi.
1234
1235 configdirs=
1236 srctrigger=warshall.c
1237 srcname="bison"
1238
1239 # per-host:
1240 case "$@{host_os@}" in
1241 m88kbcs)
1242 host_makefile_frag=config/mh-delta88
1243 ;;
1244 esac
1245
1246 # per-target:
1247
1248 files="bison_in.hairy"
1249 links="bison.hairy"
1250
1251 # post-target:
1252 @end example
1253
1254 @node config.status, Makefile Fragments, configure.in, Reference
1255 @section @code{config.status}
1256
1257 @kindex config.status
1258
1259 The final step in configuring a directory is to create an executable
1260 shell script, @file{config.status}. The main purpose of this file
1261 is to allow the Makefile for the current directory to rebuild itself, if
1262 necessary. For this reason, @file{config.status} uses the
1263 @samp{-norecursion} option to @code{configure}, and is therefore
1264 probably inappropriate for reconfiguring a tree of source code.
1265
1266 @node Makefile Fragments, , config.status, Reference
1267 @section Makefile Fragments
1268
1269 @cindex Makefile fragments
1270
1271 Cygnus @code{configure} uses three types of Makefile fragments. In a
1272 generated Makefile they appear in the order target fragment, host
1273 fragment, and site fragment. This allows host fragments to override
1274 target fragments, and site fragments to override both.
1275
1276 Host specific Makefile fragments conventionally reside in the
1277 @file{./config} directory with names of the form
1278 @file{mh-@var{host}}. They are used for hosts that require
1279 odd options to the standard compiler and for compile time options based
1280 on the host configuration.
1281
1282 Target specific Makefile fragments conventionally reside in the
1283 @file{./config} directory with names of the form @file{mt-@var{target}}.
1284 They are used for target dependent compile time options.
1285
1286 Site specific Makefile fragments conventionally reside in the
1287 @file{./config} directory with names of the form @file{ms-@var{site}}.
1288 They are used to override host and target independent compile time
1289 options. Note that you can also override these options on the
1290 @code{make} invocation line.
1291
1292 @node Known Bugs, Variables Index, Reference, top
1293 @chapter Known Bugs
1294
1295 @cindex bugs
1296
1297 We know of the following bugs:
1298
1299 @itemize @bullet
1300
1301 @item
1302 There is no way to query about known hosts, known targets, or the
1303 porting or testing status of any configuration.
1304
1305 @item
1306 The negations to the options @code{-gas}, @code{-x}, and @code{-nfp} are
1307 not available.
1308
1309 @end itemize
1310
1311 @page
1312 @node Variables Index, Concept Index, Known Bugs, top
1313 @appendix Variable Index
1314
1315 @printindex vr
1316
1317 @page
1318 @node Concept Index, , Variables Index, top
1319 @appendix Concept Index
1320
1321 @printindex cp
1322 @contents
1323 @bye
1324
1325 @c Local Variables:
1326 @c fill-column: 79
1327 @c outline-regexp: "@chap"
1328 @c End:
1329 @c (setq outline-regexp "@chapt\\\|@unnum\\\|@setf\\\|@conte\\\|@sectio\\\|@subsect\\\|@itemize\\\|@defvar{")
This page took 0.057979 seconds and 5 git commands to generate.