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