OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / gcc / f / install.texi
1 @c Copyright (C) 1995-1997 Free Software Foundation, Inc.
2 @c This is part of the G77 manual.
3 @c For copying conditions, see the file g77.texi.
4
5 @c The text of this file appears in the file INSTALL
6 @c in the G77 distribution, as well as in the G77 manual.
7
8 @c 1997-08-11
9
10 @ifclear INSTALLONLY
11 @node Installation
12 @chapter Installing GNU Fortran
13 @end ifclear
14 @cindex installing GNU Fortran
15
16 The following information describes how to install @code{g77}.
17
18 The information in this file generally pertains to dealing
19 with @emph{source} distributions of @code{g77} and @code{gcc}.
20 It is possible that some of this information will be applicable
21 to some @emph{binary} distributions of these products---however,
22 since these distributions are not made by the maintainers of
23 @code{g77}, responsibility for binary distributions rests with
24 whoever built and first distributed them.
25
26 Nevertheless, efforts to make @code{g77} easier to both build
27 and install from source and package up as a binary distribution
28 are ongoing.
29
30 @menu
31 * Prerequisites::          Make sure your system is ready for @code{g77}.
32 * Problems Installing::    Known trouble areas.
33 * Settings::               Changing @code{g77} internals before building.
34 * Quick Start::            The easier procedure for non-experts.
35 * Complete Installation::  For experts, or those who want to be: the details.
36 * Distributing Binaries::  If you plan on distributing your @code{g77}.
37 @end menu
38
39 @node Prerequisites
40 @section Prerequisites
41 @cindex prerequisites
42
43 The procedures described to unpack, configure, build, and
44 install @code{g77} assume your system has certain programs
45 already installed.
46
47 The following prerequisites should be met by your
48 system before you follow the @code{g77} installation instructions:
49
50 @table @asis
51 @item @code{gzip}
52 To unpack the @code{gcc} and @code{g77} distributions,
53 you'll need the @code{gunzip} utility in the @code{gzip}
54 distribution.
55 Most UNIX systems already have @code{gzip} installed.
56 If yours doesn't, you can get it from the FSF.
57
58 Note that you'll need @code{tar} and other utilities
59 as well, but all UNIX systems have these.
60 There are GNU versions of all these available---in fact,
61 a complete GNU UNIX system can be put together on
62 most systems, if desired.
63
64 @item @file{gcc-2.7.2.2.tar.gz}
65 You need to have this, or some other applicable, version
66 of @code{gcc} on your system.
67 The version should be an exact copy of a distribution
68 from the FSF.
69 It is approximately 7MB large.
70
71 If you've already unpacked @file{gcc-2.7.2.2.tar.gz} into a
72 directory (named @file{gcc-2.7.2.2}) called the @dfn{source tree}
73 for @code{gcc}, you can delete the distribution
74 itself, but you'll need to remember to skip any instructions to unpack
75 this distribution.
76
77 Without an applicable @code{gcc} source tree, you cannot
78 build @code{g77}.
79 You can obtain an FSF distribution of @code{gcc} from the FSF.
80
81 @item @file{g77-0.5.21.tar.gz}
82 You probably have already unpacked this distribution,
83 or you are reading an advanced copy of this manual,
84 which is contained in this distribution.
85 This distribution approximately 1MB large.
86
87 You can obtain an FSF distribution of @code{g77} from the FSF,
88 the same way you obtained @code{gcc}.
89
90 @item 100MB disk space
91 For a complete @dfn{bootstrap} build, about 100MB
92 of disk space is required for @code{g77} by the author's
93 current GNU/Linux system.
94
95 Some juggling can reduce the amount of space needed;
96 during the bootstrap process, once Stage 3 starts,
97 during which the version of @code{gcc} that has been copied
98 into the @file{stage2/} directory is used to rebuild the
99 system, you can delete the @file{stage1/} directory
100 to free up some space.
101
102 It is likely that many systems don't require the complete
103 bootstrap build, as they already have a recent version of
104 @code{gcc} installed.
105 Such systems might be able to build @code{g77} with only
106 about 75MB of free space.
107
108 @item @code{patch}
109 Although you can do everything @code{patch} does yourself,
110 by hand, without much trouble, having @code{patch} installed
111 makes installation of new versions of GNU utilities such as
112 @code{g77} so much easier that it is worth getting.
113 You can obtain @code{patch} the same way you obtained
114 @code{gcc} and @code{g77}.
115
116 In any case, you can apply patches by hand---patch files
117 are designed for humans to read them.
118
119 @item @code{make}
120 Your system must have @code{make}, and you will probably save
121 yourself a lot of trouble if it is GNU @code{make} (sometimes
122 referred to as @code{gmake}).
123
124 @item @code{cc}
125 Your system must have a working C compiler.
126
127 @xref{Installation,,Installing GNU CC,gcc,Using and Porting GNU CC},
128 for more information on prerequisites for installing @code{gcc}.
129
130 @item @code{bison}
131 If you do not have @code{bison} installed, you can usually
132 work around any need for it, since @code{g77} itself does
133 not use it, and @code{gcc} normally includes all files
134 generated by running it in its distribution.
135 You can obtain @code{bison} the same way you obtained
136 @code{gcc} and @code{g77}.
137
138 @xref{Missing bison?},
139 for information on how to work around not having @code{bison}.
140
141 @item @code{makeinfo}
142 If you are missing @code{makeinfo}, you can usually work
143 around any need for it.
144 You can obtain @code{makeinfo} the same way you obtained
145 @code{gcc} and @code{g77}.
146
147 @xref{Missing makeinfo?},
148 for information on getting around the lack of @code{makeinfo}.
149
150 @item @code{root} access
151 To perform the complete installation procedures on a system,
152 you need to have @code{root} access to that system, or
153 equivalent access.
154
155 Portions of the procedure (such as configuring and building
156 @code{g77}) can be performed by any user with enough disk
157 space and virtual memory.
158
159 However, these instructions are oriented towards less-experienced
160 users who want to install @code{g77} on their own personal
161 systems.
162
163 System administrators with more experience will want to
164 determine for themselves how they want to modify the
165 procedures described below to suit the needs of their
166 installation.
167 @end table
168
169 @node Problems Installing
170 @section Problems Installing
171 @cindex problems installing
172 @cindex installation problems
173
174 This is a list of problems (and some apparent problems which don't
175 really mean anything is wrong) that show up when configuring,
176 building, installing, or porting GNU Fortran.
177
178 @xref{Installation Problems,,,gcc,Using and Porting GNU CC},
179 for more information on installation problems that can afflict
180 either @code{gcc} or @code{g77}.
181
182 @menu
183 * General Problems::         Problems afflicting most or all systems.
184 * Cross-compiler Problems::  Problems afflicting cross-compilation setups.
185 @end menu
186
187 @node General Problems
188 @subsection General Problems
189
190 These problems can occur on most or all systems.
191
192 @menu
193 * GNU C Required::             Why even ANSI C is not enough.
194 * Patching GNU CC Necessary::  Why @code{gcc} must be patched first.
195 * Building GNU CC Necessary::  Why you can't build @emph{just} Fortran.
196 * Missing strtoul::            If linking @code{f771} fails due to an
197                                 unresolved reference to @code{strtoul}.
198 * Object File Differences::    It's okay that @samp{make compare} will
199                                 flag @file{f/zzz.o}.
200 * Cleanup Kills Stage Directories::  A minor nit for @code{g77} developers.
201 * Missing gperf?::             When building requires @code{gperf}.
202 @end menu
203
204 @node GNU C Required
205 @subsubsection GNU C Required
206 @cindex GNU C required
207 @cindex requirements, GNU C
208
209 Compiling @code{g77} requires GNU C, not just ANSI C.
210 Fixing this wouldn't
211 be very hard (just tedious), but the code using GNU extensions to
212 the C language is expected to be rewritten for 0.6 anyway,
213 so there are no plans for an interim fix.
214
215 This requirement does not mean you must already have @code{gcc}
216 installed to build @code{g77}.
217 As long as you have a working C compiler, you can use a
218 bootstrap build to automate the process of first building
219 @code{gcc} using the working C compiler you have, then building
220 @code{g77} and rebuilding @code{gcc} using that just-built @code{gcc},
221 and so on.
222
223 @node Patching GNU CC Necessary
224 @subsubsection Patching GNU CC Necessary
225 @cindex patch files
226 @cindex GBE
227
228 @code{g77} currently requires application of a patch file to the gcc compiler
229 tree.
230 The necessary patches should be folded in to the mainline gcc distribution.
231
232 Some combinations
233 of versions of @code{g77} and @code{gcc} might actually @emph{require} no
234 patches, but the patch files will be provided anyway as long as
235 there are more changes expected in subsequent releases.
236 These patch files might contain
237 unnecessary, but possibly helpful, patches.
238 As a result, it is possible this issue might never be
239 resolved, except by eliminating the need for the person
240 configuring @code{g77} to apply a patch by hand, by going
241 to a more automated approach (such as configure-time patching).
242
243 @node Building GNU CC Necessary
244 @subsubsection Building GNU CC Necessary
245 @cindex gcc, building
246 @cindex building gcc
247
248 It should be possible to build the runtime without building @code{cc1}
249 and other non-Fortran items, but, for now, an easy way to do that
250 is not yet established.
251
252 @node Missing strtoul
253 @subsubsection Missing strtoul
254 @cindex strtoul
255 @cindex _strtoul
256 @cindex undefined reference (_strtoul)
257 @cindex f771, linking error for
258 @cindex linking error for f771
259 @cindex ld error for f771
260 @cindex ld can't find _strtoul
261 @cindex SunOS4
262
263 On SunOS4 systems, linking the @code{f771} program produces
264 an error message concerning an undefined symbol named
265 @samp{_strtoul}.
266
267 This is not a @code{g77} bug.
268 @xref{Patching GNU Fortran}, for information on
269 a workaround provided by @code{g77}.
270
271 The proper fix is either to upgrade your system to one that
272 provides a complete ANSI C environment, or improve @code{gcc} so
273 that it provides one for all the languages and configurations it supports.
274
275 @emph{Note:} In earlier versions of @code{g77}, an automated
276 workaround for this problem was attempted.
277 It worked for systems without @samp{_strtoul}, substituting
278 the incomplete-yet-sufficient version supplied with @code{g77}
279 for those systems.
280 However, the automated workaround failed mysteriously for systems
281 that appeared to have conforming ANSI C environments, and it
282 was decided that, lacking resources to more fully investigate
283 the problem, it was better to not punish users of those systems
284 either by requiring them to work around the problem by hand or
285 by always substituting an incomplete @code{strtoul()} implementation
286 when their systems had a complete, working one.
287 Unfortunately, this meant inconveniencing users of systems not
288 having @code{strtoul()}, but they're using obsolete (and generally
289 unsupported) systems anyway.
290
291 @node Object File Differences
292 @subsubsection Object File Differences
293 @cindex zzz.o
294 @cindex zzz.c
295 @cindex object file, differences
296 @cindex differences between object files
297 @cindex make compare
298
299 A comparison of object files after building Stage 3 during a
300 bootstrap build will result in @file{gcc/f/zzz.o} being flagged
301 as different from the Stage 2 version.
302 That is because it
303 contains a string with an expansion of the @code{__TIME__} macro,
304 which expands to the current time of day.
305 It is nothing to worry about, since
306 @file{gcc/f/zzz.c} doesn't contain any actual code.
307 It does allow you to override its use of @code{__DATE__} and
308 @code{__TIME__} by defining macros for the compilation---see the
309 source code for details.
310
311 @node Cleanup Kills Stage Directories
312 @subsubsection Cleanup Kills Stage Directories
313 @cindex stage directories
314 @cindex make clean
315
316 It'd be helpful if @code{g77}'s @file{Makefile.in} or @file{Make-lang.in}
317 would create the various @file{stage@var{n}} directories and their
318 subdirectories, so developers and expert installers wouldn't have to
319 reconfigure after cleaning up.
320
321 @node Missing gperf?
322 @subsubsection Missing @code{gperf}?
323 @cindex @code{gperf}
324 @cindex missing @code{gperf}
325
326 If a build aborts trying to invoke @code{gperf}, that
327 strongly suggests an improper method was used to
328 create the @code{gcc} source directory,
329 such as the UNIX @samp{cp -r} command instead
330 of @samp{cp -pr}, since this problem very likely
331 indicates that the date-time-modified information on
332 the @code{gcc} source files is incorrect.
333
334 The proper solution is to recreate the @code{gcc} source
335 directory from a @code{gcc} distribution known to be
336 provided by the FSF.
337
338 It is possible you might be able to temporarily
339 work around the problem, however, by trying these
340 commands:
341
342 @example
343 sh# @kbd{cd gcc}
344 sh# @kbd{touch c-gperf.h}
345 sh#
346 @end example
347
348 These commands update the date-time-modified information for
349 the file produced by the invocation of @code{gperf}
350 in the current versions of @code{gcc}, so that @code{make} no
351 longer believes it needs to update it.
352 This file should already exist in a @code{gcc}
353 distribution, but mistakes made when copying the @code{gcc}
354 directory can leave the modification information
355 set such that the @code{gperf} input files look more ``recent''
356 than the corresponding output files.
357
358 If the above does not work, definitely start from scratch
359 and avoid copying the @code{gcc} using any method that does
360 not reliably preserve date-time-modified information, such
361 as the UNIX @samp{cp -r} command.
362
363 @node Cross-compiler Problems
364 @subsection Cross-compiler Problems
365 @cindex cross-compiler, problems
366
367 @code{g77} has been in alpha testing since September of
368 1992, and in public beta testing since February of 1995.
369 Alpha testing was done by a small number of people worldwide on a fairly
370 wide variety of machines, involving self-compilation in most or
371 all cases.
372 Beta testing has been done primarily via self-compilation,
373 but in more and more cases, cross-compilation (and ``criss-cross
374 compilation'', where a version of a compiler is built on one machine
375 to run on a second and generate code that runs on a third) has
376 been tried and has succeeded, to varying extents.
377
378 Generally, @code{g77} can be ported to any configuration to which
379 @code{gcc}, @code{f2c}, and @code{libf2c} can be ported and made
380 to work together, aside from the known problems described in this
381 manual.
382 If you want to port @code{g77} to a particular configuration,
383 you should first make sure @code{gcc} and @code{libf2c} can be
384 ported to that configuration before focusing on @code{g77}, because
385 @code{g77} is so dependent on them.
386
387 Even for cases where @code{gcc} and @code{libf2c} work,
388 you might run into problems with cross-compilation on certain machines,
389 for several reasons.
390
391 @itemize @bullet
392 @item
393 There is one known bug
394 (a design bug to be fixed in 0.6) that prevents configuration of
395 @code{g77} as a cross-compiler in some cases,
396 though there are assumptions made during
397 configuration that probably make doing non-self-hosting builds
398 a hassle, requiring manual intervention.
399
400 @item
401 @code{gcc} might still have some trouble being configured
402 for certain combinations of machines.
403 For example, it might not know how to handle floating-point
404 constants.
405
406 @item
407 Improvements to the way @code{libf2c} is built could make
408 building @code{g77} as a cross-compiler easier---for example,
409 passing and using @samp{LD} and @samp{AR} in the appropriate
410 ways.
411
412 @item
413 There are still some challenges putting together the right
414 run-time libraries (needed by @code{libf2c}) for a target
415 system, depending on the systems involved in the configuration.
416 (This is a general problem with cross-compilation, and with
417 @code{gcc} in particular.)
418 @end itemize
419
420 @node Settings
421 @section Changing Settings Before Building
422
423 Here are some internal @code{g77} settings that can be changed
424 by editing source files in @file{gcc/f/} before building.
425
426 This information, and perhaps even these settings, represent
427 stop-gap solutions to problems people doing various ports
428 of @code{g77} have encountered.
429 As such, none of the following information is expected to
430 be pertinent in future versions of @code{g77}.
431
432 @menu
433 * Larger File Unit Numbers::     Raising @samp{MXUNIT}.
434 * Always Flush Output::          Synchronizing write errors.
435 * Maximum Stackable Size::       Large arrays are forced off the stack frame.
436 * Floating-point Bit Patterns::  Possible programs building cross-compiler.
437 * Large Initialization::         Large arrays with @code{DATA} initialization.
438 * Alpha Problems Fixed::         Problems 64-bit systems like Alphas now fixed?
439 @end menu
440
441 @node Larger File Unit Numbers
442 @subsection Larger File Unit Numbers
443 @cindex MXUNIT
444 @cindex unit numbers
445 @cindex maximum unit number
446 @cindex illegal unit number
447 @cindex increasing maximum unit number
448
449 As distributed, whether as part of @code{f2c} or @code{g77},
450 @code{libf2c} accepts file unit numbers only in the range
451 0 through 99.
452 For example, a statement such as @samp{WRITE (UNIT=100)} causes
453 a run-time crash in @code{libf2c}, because the unit number,
454 100, is out of range.
455
456 If you know that Fortran programs at your installation require
457 the use of unit numbers higher than 99, you can change the
458 value of the @samp{MXUNIT} macro, which represents the maximum unit
459 number, to an appropriately higher value.
460
461 To do this, edit the file @file{f/runtime/libI77/fio.h} in your
462 @code{g77} source tree, changing the following line:
463
464 @example
465 #define MXUNIT 100
466 @end example
467
468 Change the line so that the value of @samp{MXUNIT} is defined to be
469 at least one @emph{greater} than the maximum unit number used by
470 the Fortran programs on your system.
471
472 (For example, a program that does @samp{WRITE (UNIT=255)} would require
473 @samp{MXUNIT} set to at least 256 to avoid crashing.)
474
475 Then build or rebuild @code{g77} as appropriate.
476
477 @emph{Note:} Changing this macro has @emph{no} effect on other limits
478 your system might place on the number of files open at the same time.
479 That is, the macro might allow a program to do @samp{WRITE (UNIT=100)},
480 but the library and operating system underlying @code{libf2c} might
481 disallow it if many other files have already been opened (via @code{OPEN} or
482 implicitly via @code{READ}, @code{WRITE}, and so on).
483 Information on how to increase these other limits should be found
484 in your system's documentation.
485
486 @node Always Flush Output
487 @subsection Always Flush Output
488 @cindex ALWAYS_FLUSH
489 @cindex synchronous write errors
490 @cindex disk full
491 @cindex flushing output
492 @cindex fflush()
493 @cindex I/O, flushing
494 @cindex output, flushing
495 @cindex writes, flushing
496 @cindex NFS
497 @cindex network file system
498
499 Some Fortran programs require output
500 (writes) to be flushed to the operating system (under UNIX,
501 via the @code{fflush()} library call) so that errors,
502 such as disk full, are immediately flagged via the relevant
503 @code{ERR=} and @code{IOSTAT=} mechanism, instead of such
504 errors being flagged later as subsequent writes occur, forcing
505 the previously written data to disk, or when the file is
506 closed.
507
508 Essentially, the difference can be viewed as synchronous error
509 reporting (immediate flagging of errors during writes) versus
510 asynchronous, or, more precisely, buffered error reporting
511 (detection of errors might be delayed).
512
513 @code{libf2c} supports flagging write errors immediately when
514 it is built with the @samp{ALWAYS_FLUSH} macro defined.
515 This results in a @code{libf2c} that runs slower, sometimes
516 quite a bit slower, under certain circumstances---for example,
517 accessing files via the networked file system NFS---but the
518 effect can be more reliable, robust file I/O.
519
520 If you know that Fortran programs requiring this level of precision
521 of error reporting are to be compiled using the
522 version of @code{g77} you are building, you might wish to
523 modify the @code{g77} source tree so that the version of
524 @code{libf2c} is built with the @samp{ALWAYS_FLUSH} macro
525 defined, enabling this behavior.
526
527 To do this, find this line in @file{f/runtime/configure.in} in
528 your @code{g77} source tree:
529
530 @example
531 dnl AC_DEFINE(ALWAYS_FLUSH)
532 @end example
533
534 Remove the leading @samp{dnl@w{ }}, so the line begins with
535 @samp{AC_DEFINE(}, and run @code{autoconf} in that file's directory.
536 (Or, if you don't have @code{autoconf}, you can modify @file{f2c.h.in}
537 in the same directory to include the line @samp{#define ALWAYS_FLUSH}
538 after @samp{#define F2C_INCLUDE}.)
539
540 Then build or rebuild @code{g77} as appropriate.
541
542 @node Maximum Stackable Size
543 @subsection Maximum Stackable Size
544 @vindex FFECOM_sizeMAXSTACKITEM
545 @cindex code, stack variables
546 @cindex maximum stackable size
547 @cindex stack allocation
548 @cindex segmentation violation
549 @code{g77}, on most machines, puts many variables and arrays on the stack
550 where possible, and can be configured (by changing
551 @samp{FFECOM_sizeMAXSTACKITEM} in @file{gcc/f/com.c}) to force
552 smaller-sized entities into static storage (saving
553 on stack space) or permit larger-sized entities to be put on the
554 stack (which can improve run-time performance, as it presents
555 more opportunities for the GBE to optimize the generated code).
556
557 @emph{Note:} Putting more variables and arrays on the stack
558 might cause problems due to system-dependent limits on stack size.
559 Also, the value of @samp{FFECOM_sizeMAXSTACKITEM} has no
560 effect on automatic variables and arrays.
561 @xref{But-bugs}, for more information.
562
563 @node Floating-point Bit Patterns
564 @subsection Floating-point Bit Patterns
565
566 @cindex cross-compiler, building
567 @cindex floating-point bit patterns
568 @cindex bit patterns
569 The @code{g77} build will crash if an attempt is made to build
570 it as a cross-compiler
571 for a target when @code{g77} cannot reliably determine the bit pattern of
572 floating-point constants for the target.
573 Planned improvements for g77-0.6
574 will give it the capabilities it needs to not have to crash the build
575 but rather generate correct code for the target.
576 (Currently, @code{g77}
577 would generate bad code under such circumstances if it didn't crash
578 during the build, e.g. when compiling a source file that does
579 something like @samp{EQUIVALENCE (I,R)} and @samp{DATA R/9.43578/}.)
580
581 @node Large Initialization
582 @subsection Initialization of Large Aggregate Areas
583
584 @cindex speed, compiler
585 @cindex slow compiler
586 @cindex memory utilization
587 @cindex large initialization
588 @cindex aggregate initialization
589 A warning message is issued when @code{g77} sees code that provides
590 initial values (e.g. via @code{DATA}) to an aggregate area (@code{COMMON}
591 or @code{EQUIVALENCE}, or even a large enough array or @code{CHARACTER}
592 variable)
593 that is large enough to increase @code{g77}'s compile time by roughly
594 a factor of 10.
595
596 This size currently is quite small, since @code{g77}
597 currently has a known bug requiring too much memory
598 and time to handle such cases.
599 In @file{gcc/f/data.c}, the macro
600 @samp{FFEDATA_sizeTOO_BIG_INIT_} is defined
601 to the minimum size for the warning to appear.
602 The size is specified in storage units,
603 which can be bytes, words, or whatever, on a case-by-case basis.
604
605 After changing this macro definition, you must
606 (of course) rebuild and reinstall @code{g77} for
607 the change to take effect.
608
609 Note that, as of version 0.5.18, improvements have
610 reduced the scope of the problem for @emph{sparse}
611 initialization of large arrays, especially those
612 with large, contiguous uninitialized areas.
613 However, the warning is issued at a point prior to
614 when @code{g77} knows whether the initialization is sparse,
615 and delaying the warning could mean it is produced
616 too late to be helpful.
617
618 Therefore, the macro definition should not be adjusted to
619 reflect sparse cases.
620 Instead, adjust it to generate the warning when densely
621 initialized arrays begin to cause responses noticeably slower
622 than linear performance would suggest.
623
624 @node Alpha Problems Fixed
625 @subsection Alpha Problems Fixed
626
627 @cindex Alpha, support
628 @cindex 64-bit systems
629 @code{g77} used to warn when it was used to compile Fortran code
630 for a target configuration that is not basically a 32-bit
631 machine (such as an Alpha, which is a 64-bit machine, especially
632 if it has a 64-bit operating system running on it).
633 That was because @code{g77} was known to not work
634 properly on such configurations.
635
636 As of version 0.5.20, @code{g77} is believed to work well
637 enough on such systems.
638 So, the warning is no longer needed or provided.
639
640 However, support for 64-bit systems, especially in
641 areas such as cross-compilation and handling of
642 intrinsics, is still incomplete.
643 The symptoms
644 are believed to be compile-time diagnostics rather
645 than the generation of bad code.
646 It is hoped that version 0.6 will completely support 64-bit
647 systems.
648
649 @node Quick Start
650 @section Quick Start
651 @cindex quick start
652
653 This procedure configures, builds, and installs @code{g77}
654 ``out of the box'' and works on most UNIX systems.
655 Each command is identified by a unique number,
656 used in the explanatory text that follows.
657 For the most part, the output of each command is not shown,
658 though indications of the types of responses are given in a
659 few cases.
660
661 To perform this procedure, the installer must be logged
662 in as user @code{root}.
663 Much of it can be done while not logged in as @code{root},
664 and users experienced with UNIX administration should be
665 able to modify the procedure properly to do so.
666
667 Following traditional UNIX conventions, it is assumed that
668 the source trees for @code{g77} and @code{gcc} will be
669 placed in @file{/usr/src}.
670 It also is assumed that the source distributions themselves
671 already reside in @file{/usr/FSF}, a naming convention
672 used by the author of @code{g77} on his own system:
673
674 @example
675 /usr/FSF/gcc-2.7.2.2.tar.gz
676 /usr/FSF/g77-0.5.21.tar.gz
677 @end example
678
679 @c (You can use @file{gcc-2.7.2.1.tar.gz} instead, or
680 @c the equivalent of it obtained by applying the
681 @c patch distributed as @file{gcc-2.7.2-2.7.2.1.diff.gz}
682 @c to version 2.7.2 of @code{gcc},
683 @c if you remember to make the appropriate adjustments in the
684 @c instructions below.)
685
686 @cindex SunOS4
687 Users of the following systems should not blindly follow
688 these quick-start instructions, because of problems their
689 systems have coping with straightforward installation of
690 @code{g77}:
691
692 @itemize @bullet
693 @item
694 SunOS4
695 @end itemize
696
697 Instead, see @ref{Complete Installation}, for detailed information
698 on how to configure, build, and install @code{g77} for your
699 particular system.
700 Also, see @ref{Trouble,,Known Causes of Trouble with GNU Fortran},
701 for information on bugs and other problems known to afflict the
702 installation process, and how to report newly discovered ones.
703
704 If your system is @emph{not} on the above list, and @emph{is}
705 a UNIX system or one of its variants, you should be able to
706 follow the instructions below.
707 If you vary @emph{any} of the steps below, you might run into
708 trouble, including possibly breaking existing programs for
709 other users of your system.
710 Before doing so, it is wise to review the explanations of some
711 of the steps.
712 These explanations follow this list of steps.
713
714 @example
715 sh[ 1]# @kbd{cd /usr/src}
716 @set source-dir 1
717 sh[ 2]# @kbd{gunzip -c < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -}
718 [Might say "Broken pipe"...that is normal on some systems.]
719 @set unpack-gcc 2
720 sh[ 3]# @kbd{gunzip -c < /usr/FSF/g77-0.5.21.tar.gz | tar xf -}
721 ["Broken pipe" again possible.]
722 @set unpack-g77 3
723 sh[ 4]# @kbd{ln -s gcc-2.7.2.2 gcc}
724 @set link-gcc 4
725 sh[ 5]# @kbd{ln -s g77-0.5.21 g77}
726 @set link-g77 5
727 sh[ 6]# @kbd{mv -i g77/* gcc}
728 [No questions should be asked by mv here; or, you made a mistake.]
729 @set merge-g77 6
730 sh[ 7]# @kbd{patch -p1 -V t -d gcc < gcc/f/gbe/2.7.2.2.diff}
731 [Unless patch complains about rejected patches, this step worked.]
732 @set apply-patch 7
733 sh[ 8]# @kbd{cd gcc}
734 sh[ 9]# @kbd{touch f77-install-ok}
735 [Do not do the above if your system already has an f77
736 command, unless you've checked that overwriting it
737 is okay.]
738 @set f77-install-ok 9
739 sh[10]# @kbd{touch f2c-install-ok}
740 [Do not do the above if your system already has an f2c
741 command, unless you've checked that overwriting it
742 is okay.  Else, @kbd{touch f2c-exists-ok}.]
743 @set f2c-install-ok 10
744 sh[11]# @kbd{./configure --prefix=/usr}
745 [Do not do the above if gcc is not installed in /usr/bin.
746 You might need a different @kbd{--prefix=@dots{}}, as
747 described below.]
748 @set configure-gcc 11
749 sh[12]# @kbd{make bootstrap}
750 [This takes a long time, and is where most problems occur.]
751 @set build-gcc 12
752 sh[13]# @kbd{make compare}
753 [This verifies that the compiler is `sane'.  Only
754 the file `f/zzz.o' (aka `tmp-foo1' and `tmp-foo2')
755 should be in the list of object files this command
756 prints as having different contents.  If other files
757 are printed, you have likely found a g77 bug.]
758 @set compare-gcc 13
759 sh[14]# @kbd{rm -fr stage1}
760 @set rm-stage1 14
761 sh[15]# @kbd{make -k install}
762 [The actual installation.]
763 @set install-g77 15
764 sh[16]# @kbd{g77 -v}
765 [Verify that g77 is installed, obtain version info.]
766 @set show-version 16
767 sh[17]#
768 @set end-procedure 17
769 @end example
770
771 @xref{Updating Documentation,,Updating Your Info Directory}, for
772 information on how to update your system's top-level @code{info}
773 directory to contain a reference to this manual, so that
774 users of @code{g77} can easily find documentation instead
775 of having to ask you for it.
776
777 Elaborations of many of the above steps follows:
778
779 @table @asis
780 @item Step @value{source-dir}: @kbd{cd /usr/src}
781 You can build @code{g77} pretty much anyplace.
782 By convention, this manual assumes @file{/usr/src}.
783 It might be helpful if other users on your system
784 knew where to look for the source code for the
785 installed version of @code{g77} and @code{gcc} in any case.
786
787 @c @item Step @value{unpack-gcc}: @kbd{gunzip -d @dots{}}
788 @c Here, you might wish to use @file{gcc-2.7.2.1.tar.gz}
789 @c instead, or apply @file{gcc-2.7.2-2.7.2.1.diff.gz} to achieve
790 @c similar results.
791
792 @item Step @value{unpack-g77}: @kbd{gunzip -d < /usr/FSF/g77-0.5.21.tar.gz | tar xf -}
793 It is not always necessary to obtain the latest version of
794 @code{g77} as a complete @file{.tar.gz} file if you have
795 a complete, earlier distribution of @code{g77}.
796 If appropriate, you can unpack that earlier
797 version of @code{g77}, and then apply the appropriate patches
798 to achieve the same result---a source tree containing version
799 0.5.21 of @code{g77}.
800
801 @item Step @value{link-gcc}: @kbd{ln -s gcc-2.7.2.2 gcc}
802 @item Step @value{link-g77}: @kbd{ln -s g77-0.5.21 g77}
803 These commands mainly help reduce typing,
804 and help reduce visual clutter in examples
805 in this manual showing what to type to install @code{g77}.
806
807 @c Of course, if appropriate, @kbd{ln -s gcc-2.7.2.1 gcc} or
808 @c similar.
809
810 @xref{Unpacking}, for information on
811 using distributions of @code{g77} made by organizations
812 other than the FSF.
813
814 @item Step @value{merge-g77}: @kbd{mv -i g77/* gcc}
815 After doing this, you can, if you like, type
816 @samp{rm g77} and @samp{rmdir g77-0.5.21} to remove
817 the empty directory and the symbol link to it.
818 But, it might be helpful to leave them around as
819 quick reminders of which version(s) of @code{g77} are
820 installed on your system.
821
822 @xref{Unpacking}, for information
823 on the contents of the @file{g77} directory (as merged
824 into the @file{gcc} directory).
825
826 @item Step @value{apply-patch}: @kbd{patch -p1 @dots{}}
827 @c (Or `@kbd{@dots{} < gcc/f/gbe/2.7.2.1.diff}', if appropriate.)
828 @c
829 This can produce a wide variety of printed output,
830 from @samp{Hmm, I can't seem to find a patch in there anywhere...}
831 to long lists of messages indicated that patches are
832 being found, applied successfully, and so on.
833
834 If messages about ``fuzz'', ``offset'', or
835 especially ``reject files'' are printed, it might
836 mean you applied the wrong patch file.
837 If you believe this is the case, it is best to restart
838 the sequence after deleting (or at least renaming to unused
839 names) the top-level directories for @code{g77} and @code{gcc}
840 and their symbolic links.
841
842 After this command finishes, the @code{gcc} directory might
843 have old versions of several files as saved by @code{patch}.
844 To remove these, after @kbd{cd gcc}, type @kbd{rm -i *.~*~}.
845
846 @xref{Merging Distributions}, for more information.
847
848 @item Step @value{f77-install-ok}: @kbd{touch f77-install-ok}
849 Don't do this if you don't want to overwrite an existing
850 version of @code{f77} (such as a native compiler, or a
851 script that invokes @code{f2c}).
852 Otherwise, installation will overwrite the @code{f77} command
853 and the @code{f77} man pages with copies of the corresponding
854 @code{g77} material.
855
856 @xref{Installing f77,,Installing @code{f77}}, for more
857 information.
858
859 @item Step @value{f2c-install-ok}: @kbd{touch f2c-install-ok}
860 Don't do this if you don't want to overwrite an existing
861 installation of @code{libf2c} (though, chances are, you do).
862 Instead, @kbd{touch f2c-exists-ok} to allow the installation
863 to continue without any error messages about @file{/usr/lib/libf2c.a}
864 already existing.
865
866 @xref{Installing f2c,,Installing @code{f2c}}, for more
867 information.
868
869 @item Step @value{configure-gcc}: @kbd{./configure --prefix=/usr}
870 This is where you specify that the @file{g77} executable is to be
871 installed in @file{/usr/bin/}, the @file{libf2c.a} library is
872 to be installed in @file{/usr/lib/}, and so on.
873
874 You should ensure that any existing installation of the @file{gcc}
875 executable is in @file{/usr/bin/}.
876 Otherwise, installing @code{g77} so that it does not fully
877 replace the existing installation of @code{gcc} is likely
878 to result in the inability to compile Fortran programs.
879
880 @xref{Where to Install,,Where in the World Does Fortran (and GNU CC) Go?},
881 for more information on determining where to install @code{g77}.
882 @xref{Configuring gcc}, for more information on the
883 configuration process triggered by invoking the @file{./configure}
884 script.
885
886 @item Step @value{build-gcc}: @kbd{make bootstrap}
887 @xref{Installation,,Installing GNU CC,
888 gcc,Using and Porting GNU CC}, for information
889 on the kinds of diagnostics you should expect during
890 this procedure.
891
892 @xref{Building gcc}, for complete @code{g77}-specific
893 information on this step.
894
895 @item Step @value{compare-gcc}: @kbd{make compare}
896 @xref{Bug Lists,,Where to Port Bugs}, for information
897 on where to report that you observed more than
898 @file{f/zzz.o} having different contents during this
899 phase.
900
901 @xref{Bug Reporting,,How to Report Bugs}, for
902 information on @emph{how} to report bugs like this.
903
904 @item Step @value{rm-stage1}: @kbd{rm -fr stage1}
905 You don't need to do this, but it frees up disk space.
906
907 @item Step @value{install-g77}: @kbd{make -k install}
908 If this doesn't seem to work, try:
909
910 @example
911 make -k install install-libf77 install-f2c-all
912 @end example
913
914 @xref{Installation of Binaries}, for more information.
915
916 @xref{Updating Documentation,,Updating Your Info Directory},
917 for information on entering this manual into your
918 system's list of texinfo manuals.
919
920 @item Step @value{show-version}: @kbd{g77 -v}
921 If this command prints approximately 25 lines of output,
922 including the GNU Fortran Front End version number (which
923 should be the same as the version number for the version
924 of @code{g77} you just built and installed) and the
925 version numbers for the three parts of the @code{libf2c}
926 library (@code{libF77}, @code{libI77}, @code{libU77}), and
927 those version numbers are all in agreement, then there is
928 a high likelihood that the installation has been successfully
929 completed.
930
931 You might consider doing further testing.
932 For example, log in as a non-privileged user, then create
933 a small Fortran program, such as:
934
935 @example
936       PROGRAM SMTEST
937       DO 10 I=1, 10
938          PRINT *, 'Hello World #', I
939 10    CONTINUE
940       END
941 @end example
942
943 Compile, link, and run the above program, and, assuming you named
944 the source file @file{smtest.f}, the session should look like this:
945
946 @example
947 sh# @kbd{g77 -o smtest smtest.f}
948 sh# @kbd{./smtest}
949  Hello World # 1
950  Hello World # 2
951  Hello World # 3
952  Hello World # 4
953  Hello World # 5
954  Hello World # 6
955  Hello World # 7
956  Hello World # 8
957  Hello World # 9
958  Hello World # 10
959 sh#
960 @end example
961
962 After proper installation, you don't
963 need to keep your gcc and g77 source and build directories
964 around anymore.
965 Removing them can free up a lot of disk space.
966 @end table
967
968 @node Complete Installation
969 @section Complete Installation
970
971 Here is the complete @code{g77}-specific information on how
972 to configure, build, and install @code{g77}.
973
974 @menu
975 * Unpacking::
976 * Merging Distributions::
977 * f77: Installing f77.
978 * f2c: Installing f2c.
979 * Patching GNU Fortran::
980 * Where to Install::
981 * Configuring gcc::
982 * Building gcc::
983 * Pre-installation Checks::
984 * Installation of Binaries::
985 * Updating Documentation::
986 * bison: Missing bison?.
987 * makeinfo: Missing makeinfo?.
988 @end menu
989
990 @node Unpacking
991 @subsection Unpacking
992 @cindex unpacking distributions
993 @cindex distributions, unpacking
994 @cindex code, source
995 @cindex source code
996 @cindex source tree
997 @cindex packages
998
999 The @code{gcc} source distribution is a stand-alone distribution.
1000 It is designed to be unpacked (producing the @code{gcc}
1001 source tree) and built as is, assuming certain
1002 prerequisites are met (including the availability of compatible
1003 UNIX programs such as @code{make}, @code{cc}, and so on).
1004
1005 However, before building @code{gcc}, you will want to unpack
1006 and merge the @code{g77} distribution in with it, so that you
1007 build a Fortran-capable version of @code{gcc}, which includes
1008 the @code{g77} command, the necessary run-time libraries,
1009 and this manual.
1010
1011 Unlike @code{gcc}, the @code{g77} source distribution
1012 is @emph{not} a stand-alone distribution.
1013 It is designed to be unpacked and, afterwards, immediately merged
1014 into an applicable @code{gcc} source tree.
1015 That is, the @code{g77} distribution @emph{augments} a
1016 @code{gcc} distribution---without @code{gcc}, generally
1017 only the documentation is immediately usable.
1018
1019 A sequence of commands typically used to unpack @code{gcc}
1020 and @code{g77} is:
1021
1022 @example
1023 sh# @kbd{cd /usr/src}
1024 sh# @kbd{gunzip -d < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -}
1025 sh# @kbd{gunzip -d < /usr/FSF/g77-0.5.21.tar.gz | tar xf -}
1026 sh# @kbd{ln -s gcc-2.7.2.2 gcc}
1027 sh# @kbd{ln -s g77-0.5.21 g77}
1028 sh# @kbd{mv -i g77/* gcc}
1029 @end example
1030
1031 @emph{Notes:} The commands beginning with @samp{gunzip@dots{}} might
1032 print @samp{Broken pipe@dots{}} as they complete.
1033 That is nothing to worry about, unless you actually
1034 @emph{hear} a pipe breaking.
1035 The @code{ln} commands are helpful in reducing typing
1036 and clutter in installation examples in this manual.
1037 Hereafter, the top level of @code{gcc} source tree is referred to
1038 as @file{gcc}, and the top level of just the @code{g77}
1039 source tree (prior to issuing the @code{mv} command, above)
1040 is referred to as @file{g77}.
1041
1042 There are three top-level names in a @code{g77} distribution:
1043
1044 @example
1045 g77/COPYING.g77
1046 g77/README.g77
1047 g77/f
1048 @end example
1049
1050 All three entries should be moved (or copied) into a @code{gcc}
1051 source tree (typically named after its version number and
1052 as it appears in the FSF distributions---e.g. @file{gcc-2.7.2.2}).
1053
1054 @file{g77/f} is the subdirectory containing all of the
1055 code, documentation, and other information that is specific
1056 to @code{g77}.
1057 The other two files exist to provide information on @code{g77}
1058 to someone encountering a @code{gcc} source tree with @code{g77}
1059 already present, who has not yet read these installation
1060 instructions and thus needs help understanding that the
1061 source tree they are looking at does not come from a single
1062 FSF distribution.
1063 They also help people encountering an unmerged @code{g77} source
1064 tree for the first time.
1065
1066 @cindex modifying @code{g77}
1067 @cindex code, modifying
1068 @cindex Pentium optimizations
1069 @cindex optimizations, Pentium
1070 @emph{Note:} Please use @strong{only} @code{gcc} and @code{g77}
1071 source trees as distributed by the FSF.
1072 Use of modified versions, such as the Pentium-specific-optimization
1073 port of @code{gcc}, is likely to result in problems that appear to be
1074 in the @code{g77} code but, in fact, are not.
1075 Do not use such modified versions
1076 unless you understand all the differences between them and the versions
1077 the FSF distributes---in which case you should be able to modify the
1078 @code{g77} (or @code{gcc}) source trees appropriately so @code{g77}
1079 and @code{gcc} can coexist as they do in the stock FSF distributions.
1080
1081 @node Merging Distributions
1082 @subsection Merging Distributions
1083 @cindex merging distributions
1084 @cindex @code{gcc} versions supported by @code{g77}
1085 @cindex versions of @code{gcc}
1086 @cindex support for @code{gcc} versions
1087
1088 After merging the @code{g77} source tree into the @code{gcc}
1089 source tree, the final merge step is done by applying the
1090 pertinent patches the @code{g77} distribution provides for
1091 the @code{gcc} source tree.
1092
1093 Read the file @file{gcc/f/gbe/README}, and apply the appropriate
1094 patch file for the version of the GNU CC compiler you have, if
1095 that exists.
1096 If the directory exists but the appropriate file
1097 does not exist, you are using either an old, unsupported version,
1098 or a release one that is newer than the newest @code{gcc} version
1099 supported by the version of @code{g77} you have.
1100
1101 @cindex gcc version numbering
1102 @cindex version numbering
1103 @cindex g77 version number
1104 @cindex GNU version numbering
1105 As of version 0.5.18, @code{g77} modifies the version number
1106 of @code{gcc} via the pertinent patches.
1107 This is done because the resulting version of @code{gcc} is
1108 deemed sufficiently different from the vanilla distribution
1109 to make it worthwhile to present, to the user, information
1110 signaling the fact that there are some differences.
1111
1112 GNU version numbers make it easy to figure out whether a
1113 particular version of a distribution is newer or older than
1114 some other version of that distribution.
1115 The format is,
1116 generally, @var{major}.@var{minor}.@var{patch}, with
1117 each field being a decimal number.
1118 (You can safely ignore
1119 leading zeros; for example, 1.5.3 is the same as 1.5.03.)@ 
1120 The @var{major} field only increases with time.
1121 The other two fields are reset to 0 when the field to
1122 their left is incremented; otherwise, they, too, only
1123 increase with time.
1124 So, version 2.6.2 is newer than version 2.5.8, and
1125 version 3.0 is newer than both.
1126 (Trailing @samp{.0} fields often are omitted in
1127 announcements and in names for distributions and
1128 the directories they create.)
1129
1130 If your version of @code{gcc} is older than the oldest version
1131 supported by @code{g77} (as casually determined by listing
1132 the contents of @file{gcc/f/gbe/}), you should obtain a newer,
1133 supported version of @code{gcc}.
1134 (You could instead obtain an older version of @code{g77},
1135 or try and get your @code{g77} to work with the old
1136 @code{gcc}, but neither approach is recommended, and
1137 you shouldn't bother reporting any bugs you find if you
1138 take either approach, because they're probably already
1139 fixed in the newer versions you're not using.)
1140
1141 If your version of @code{gcc} is newer than the newest version
1142 supported by @code{g77}, it is possible that your @code{g77}
1143 will work with it anyway.
1144 If the version number for @code{gcc} differs only in the
1145 @var{patch} field, you might as well try applying the @code{g77} patch
1146 that is for the newest version of @code{gcc} having the same
1147 @var{major} and @var{minor} fields, as this is likely to work.
1148
1149 So, for example, if a particular version of @code{g77} has support for
1150 @code{gcc} versions 2.7.0 and 2.7.1,
1151 it is likely that @file{gcc-2.7.2} would work well with @code{g77}
1152 by using the @file{2.7.1.diff} patch file provided
1153 with @code{g77} (aside from some offsets reported by @code{patch},
1154 which usually are harmless).
1155
1156 However, @file{gcc-2.8.0} would almost certainly
1157 not work with that version of @code{g77} no matter which patch file was
1158 used, so a new version of @code{g77} would be needed (and you should
1159 wait for it rather than bothering the maintainers---@pxref{Changes,,
1160 User-Visible Changes}).
1161
1162 @cindex distributions, why separate
1163 @cindex separate distributions
1164 @cindex why separate distributions
1165 This complexity is the result of @code{gcc} and @code{g77} being
1166 separate distributions.
1167 By keeping them separate, each product is able to be independently
1168 improved and distributed to its user base more frequently.
1169
1170 However, @code{g77} often requires changes to contemporary
1171 versions of @code{gcc}.
1172 Also, the GBE interface defined by @code{gcc} typically
1173 undergoes some incompatible changes at least every time the
1174 @var{minor} field of the version number is incremented,
1175 and such changes require corresponding changes to
1176 the @code{g77} front end (FFE).
1177
1178 It is hoped that the GBE interface, and the @code{gcc} and
1179 @code{g77} products in general, will stabilize sufficiently
1180 for the need for hand-patching to disappear.
1181
1182 Invoking @code{patch} as described in @file{gcc/f/gbe/README}
1183 can produce a wide variety of printed output,
1184 from @samp{Hmm, I can't seem to find a patch in there anywhere...}
1185 to long lists of messages indicated that patches are
1186 being found, applied successfully, and so on.
1187
1188 If messages about ``fuzz'', ``offset'', or
1189 especially ``reject files'' are printed, it might
1190 mean you applied the wrong patch file.
1191 If you believe this is the case, it is best to restart
1192 the sequence after deleting (or at least renaming to unused
1193 names) the top-level directories for @code{g77} and @code{gcc}
1194 and their symbolic links.
1195 That is because @code{patch} might have partially patched
1196 some @code{gcc} source files, so reapplying the correct
1197 patch file might result in the correct patches being
1198 applied incorrectly (due to the way @code{patch} necessarily
1199 works).
1200
1201 After @code{patch} finishes, the @code{gcc} directory might
1202 have old versions of several files as saved by @code{patch}.
1203 To remove these, after @kbd{cd gcc}, type @kbd{rm -i *.~*~}.
1204
1205 @pindex config-lang.in
1206 @emph{Note:} @code{g77}'s configuration file @file{gcc/f/config-lang.in}
1207 ensures that the source code for the version of @code{gcc}
1208 being configured has at least one indication of being patched
1209 as required specifically by @code{g77}.
1210 This configuration-time
1211 checking should catch failure to apply the correct patch and,
1212 if so caught, should abort the configuration with an explanation.
1213 @emph{Please} do not try to disable the check,
1214 otherwise @code{g77} might well appear to build
1215 and install correctly, and even appear to compile correctly,
1216 but could easily produce broken code.
1217
1218 @cindex creating patch files
1219 @cindex patch files, creating
1220 @pindex gcc/f/gbe/
1221 @samp{diff -rcp2N} is used to create the patch files
1222 in @file{gcc/f/gbe/}.
1223
1224 @node Installing f77
1225 @subsection Installing @code{f77}
1226 @cindex f77 command
1227 @cindex commands, f77
1228 @cindex native compiler
1229
1230 You should decide whether you want installation of @code{g77}
1231 to also install an @code{f77} command.
1232 On systems with a native @code{f77}, this is not
1233 normally desired, so @code{g77} does not do this by
1234 default.
1235
1236 @pindex f77-install-ok
1237 @vindex F77_INSTALL_FLAG
1238 If you want @code{f77} installed, create the file @file{f77-install-ok}
1239 (e.g. via the UNIX command @samp{touch f77-install-ok}) in the
1240 source or build top-level directory (the same directory in
1241 which the @code{g77} @file{f} directory resides, not the @file{f} directory
1242 itself), or edit @file{gcc/f/Make-lang.in} and change the definition
1243 of the @samp{F77_INSTALL_FLAG} macro appropriately.
1244
1245 Usually, this means that, after typing @samp{cd gcc}, you
1246 would type @samp{touch f77-install-ok}.
1247
1248 When you enable installation of @code{f77}, either a link to or a
1249 direct copy of the @code{g77} command is made.
1250 Similarly, @file{f77.1} is installed as a man page.
1251
1252 (The @code{uninstall} target in the @file{gcc/Makefile} also tests
1253 this macro and file, when invoked, to determine whether to delete the
1254 installed copies of @code{f77} and @file{f77.1}.)
1255
1256 @emph{Note:} No attempt is yet made
1257 to install a program (like a shell script) that provides
1258 compatibility with any other @code{f77} programs.
1259 Only the most rudimentary invocations of @code{f77} will
1260 work the same way with @code{g77}.
1261
1262 @node Installing f2c
1263 @subsection Installing @code{f2c}
1264
1265 Currently, @code{g77} does not include @code{f2c} itself in its
1266 distribution.
1267 However, it does include a modified version of the @code{libf2c}.
1268 This version is normally compatible with @code{f2c}, but has been
1269 modified to meet the needs of @code{g77} in ways that might possibly
1270 be incompatible with some versions or configurations of @code{f2c}.
1271
1272 Decide how installation of @code{g77} should affect any existing installation
1273 of @code{f2c} on your system.
1274
1275 @pindex f2c
1276 @pindex f2c.h
1277 @pindex libf2c.a
1278 @pindex libF77.a
1279 @pindex libI77.a
1280 If you do not have @code{f2c} on your system (e.g. no @file{/usr/bin/f2c},
1281 no @file{/usr/include/f2c.h}, and no @file{/usr/lib/libf2c.a},
1282 @file{/usr/lib/libF77.a}, or @file{/usr/lib/libI77.a}), you don't need to
1283 be concerned with this item.
1284
1285 If you do have @code{f2c} on your system, you need to decide how users
1286 of @code{f2c} will be affected by your installing @code{g77}.
1287 Since @code{g77} is
1288 currently designed to be object-code-compatible with @code{f2c} (with
1289 very few, clear exceptions), users of @code{f2c} might want to combine
1290 @code{f2c}-compiled object files with @code{g77}-compiled object files in a
1291 single executable.
1292
1293 To do this, users of @code{f2c} should use the same copies of @file{f2c.h} and
1294 @file{libf2c.a} that @code{g77} uses (and that get built as part of
1295 @code{g77}).
1296
1297 If you do nothing here, the @code{g77} installation process will not
1298 overwrite the @file{include/f2c.h} and @file{lib/libf2c.a} files with its
1299 own versions, and in fact will not even install @file{libf2c.a} for use
1300 with the newly installed versions of @code{gcc} and @code{g77} if it sees
1301 that @file{lib/libf2c.a} exists---instead, it will print an explanatory
1302 message and skip this part of the installation.
1303
1304 @pindex f2c-install-ok
1305 @vindex F2C_INSTALL_FLAG
1306 To install @code{g77}'s versions of @file{f2c.h} and @file{libf2c.a}
1307 in the appropriate
1308 places, create the file @file{f2c-install-ok} (e.g. via the UNIX
1309 command @samp{touch f2c-install-ok}) in the source or build top-level
1310 directory (the same directory in which the @code{g77} @file{f} directory
1311 resides, not the @file{f} directory itself), or edit @file{gcc/f/Make-lang.in}
1312 and change the definition of the @samp{F2C_INSTALL_FLAG} macro appropriately.
1313
1314 Usually, this means that, after typing @samp{cd gcc}, you
1315 would type @samp{touch f2c-install-ok}.
1316
1317 Make sure that when you enable the overwriting of @file{f2c.h}
1318 and @file{libf2c.a}
1319 as used by @code{f2c}, you have a recent and properly configured version of
1320 @file{bin/f2c} so that it generates code that is compatible with @code{g77}.
1321
1322 @pindex f2c-exists-ok
1323 @vindex F2CLIBOK
1324 If you don't want installation of @code{g77} to overwrite @code{f2c}'s existing
1325 installation, but you do want @code{g77} installation to proceed with
1326 installation of its own versions of @file{f2c.h} and @file{libf2c.a} in places
1327 where @code{g77} will pick them up (even when linking @code{f2c}-compiled
1328 object files---which might lead to incompatibilities), create
1329 the file @file{f2c-exists-ok} (e.g. via the UNIX command
1330 @samp{touch f2c-exists-ok}) in the source or build top-level directory,
1331 or edit @file{gcc/f/Make-lang.in} and change the definition of the
1332 @samp{F2CLIBOK} macro appropriately.
1333
1334 @node Patching GNU Fortran
1335 @subsection Patching GNU Fortran
1336
1337 If you're using a SunOS4 system, you'll need to make the following
1338 change to @file{gcc/f/proj.h}: edit the line reading
1339
1340 @example
1341 #define FFEPROJ_STRTOUL 1  @dots{}
1342 @end example
1343
1344 @noindent
1345 by replacing the @samp{1} with @samp{0}.
1346 Or, you can avoid editing the source by adding
1347 @example
1348 CFLAGS='-DFFEPROJ_STRTOUL=0 -g -O'
1349 @end example
1350 to the command line for @code{make} when you invoke it.
1351 (@samp{-g} is the default for @samp{CFLAGS}.)
1352
1353 This causes a minimal version of @code{strtoul()} provided
1354 as part of the @code{g77} distribution to be compiled and
1355 linked into whatever @code{g77} programs need it, since
1356 some systems (like SunOS4 with only the bundled compiler and its
1357 runtime) do not provide this function in their system libraries.
1358
1359 Similarly, a minimal version of @code{bsearch()} is available
1360 and can be enabled by editing a line similar to the one
1361 for @code{strtoul()} above in @file{gcc/f/proj.h}, if
1362 your system libraries lack @code{bsearch()}.
1363 The method of overriding @samp{X_CFLAGS} may also be used.
1364
1365 These are not problems with @code{g77}, which requires an
1366 ANSI C environment.
1367 You should upgrade your system to one that provides
1368 a full ANSI C environment, or encourage the maintainers
1369 of @code{gcc} to provide one to all @code{gcc}-based
1370 compilers in future @code{gcc} distributions.
1371
1372 @xref{Problems Installing}, for more information on
1373 why @code{strtoul()} comes up missing and on approaches
1374 to dealing with this problem that have already been tried.
1375
1376 @node Where to Install
1377 @subsection Where in the World Does Fortran (and GNU CC) Go?
1378 @cindex language f77 not recognized
1379 @cindex gcc will not compile Fortran programs
1380
1381 Before configuring, you should make sure you know
1382 where you want the @code{g77} and @code{gcc}
1383 binaries to be installed after they're built,
1384 because this information is given to the configuration
1385 tool and used during the build itself.
1386
1387 A @code{g77} installation necessarily requires installation of
1388 a @code{g77}-aware version of @code{gcc}, so that the @code{gcc}
1389 command recognizes Fortran source files and knows how to compile
1390 them.
1391
1392 For this to work, the version of @code{gcc} that you will be building
1393 as part of @code{g77} @strong{must} be installed as the ``active''
1394 version of @code{gcc} on the system.
1395
1396 Sometimes people make the mistake of installing @code{gcc} as
1397 @file{/usr/local/bin/gcc},
1398 leaving an older, non-Fortran-aware version in @file{/usr/bin/gcc}.
1399 (Or, the opposite happens.)@ 
1400 This can result in @code{g77} being unable to compile Fortran
1401 source files, because when it calls on @code{gcc} to do the
1402 actual compilation, @code{gcc} complains that it does not
1403 recognize the language, or the file name suffix.
1404
1405 So, determine whether @code{gcc} already is installed on your system,
1406 and, if so, @emph{where} it is installed, and prepare to configure the
1407 new version of @code{gcc} you'll be building so that it installs
1408 over the existing version of @code{gcc}.
1409
1410 You might want to back up your existing copy of @file{bin/gcc}, and
1411 the entire @file{lib/} directory, before
1412 you perform the actual installation (as described in this manual).
1413
1414 Existing @code{gcc} installations typically are
1415 found in @file{/usr} or @file{/usr/local}.
1416 If you aren't certain where the currently
1417 installed version of @code{gcc} and its
1418 related programs reside, look at the output
1419 of this command:
1420
1421 @example
1422 gcc -v -o /tmp/delete-me -xc /dev/null -xnone
1423 @end example
1424
1425 All sorts of interesting information on the locations of various
1426 @code{gcc}-related programs and data files should be visible
1427 in the output of the above command.
1428 (The output also is likely to include a diagnostic from
1429 the linker, since there's no @samp{main_()} function.)
1430 However, you do have to sift through it yourself; @code{gcc}
1431 currently provides no easy way to ask it where it is installed
1432 and where it looks for the various programs and data files it
1433 calls on to do its work.
1434
1435 Just @emph{building} @code{g77} should not overwrite any installed
1436 programs---but, usually, after you build @code{g77}, you will want
1437 to install it, so backing up anything it might overwrite is
1438 a good idea.
1439 (This is true for any package, not just @code{g77},
1440 though in this case it is intentional that @code{g77} overwrites
1441 @code{gcc} if it is already installed---it is unusual that
1442 the installation process for one distribution intentionally
1443 overwrites a program or file installed by another distribution.)
1444
1445 Another reason to back up the existing version first,
1446 or make sure you can restore it easily, is that it might be
1447 an older version on which other users have come to depend
1448 for certain behaviors.
1449 However, even the new version of @code{gcc} you install
1450 will offer users the ability to specify an older version of
1451 the actual compilation programs if desired, and these
1452 older versions need not include any @code{g77} components.
1453 @xref{Target Options,,Specifying Target Machine and Compiler Version,
1454 gcc,Using and Porting GNU CC}, for information on the @samp{-V}
1455 option of @code{gcc}.
1456
1457 @node Configuring gcc
1458 @subsection Configuring GNU CC
1459
1460 @code{g77} is configured automatically when you configure
1461 @code{gcc}.
1462 There are two parts of @code{g77} that are configured in two
1463 different ways---@code{g77}, which ``camps on'' to the
1464 @code{gcc} configuration mechanism, and @code{libf2c}, which
1465 uses a variation of the GNU @code{autoconf} configuration
1466 system.
1467
1468 Generally, you shouldn't have to be concerned with
1469 either @code{g77} or @code{libf2c} configuration, unless
1470 you're configuring @code{g77} as a cross-compiler.
1471 In this case, the @code{libf2c} configuration, and possibly the
1472 @code{g77} and @code{gcc} configurations as well,
1473 might need special attention.
1474 (This also might be the case if you're porting @code{gcc} to
1475 a whole new system---even if it is just a new operating system
1476 on an existing, supported CPU.)
1477
1478 To configure the system, see
1479 @ref{Installation,,Installing GNU CC,gcc,Using and Porting GNU CC},
1480 following the instructions for running @file{./configure}.
1481 Pay special attention to the @samp{--prefix=} option, which
1482 you almost certainly will need to specify.
1483
1484 (Note that @code{gcc} installation information is provided
1485 as a straight text file in @file{gcc/INSTALL}.)
1486
1487 The information printed by the invocation of @file{./configure}
1488 should show that the @file{f} directory (the Fortran language)
1489 has been configured.
1490 If it does not, there is a problem.
1491
1492 @emph{Note:} Configuring with the @samp{--srcdir} argument is known
1493 to work with GNU @code{make}, but it is not known to work with
1494 other variants of @code{make}.
1495 Irix5.2 and SunOS4.1 versions of @code{make} definitely
1496 won't work outside the source directory at present.
1497 @code{g77}'s
1498 portion of the @file{configure} script issues a warning message
1499 about this when you configure for building binaries outside
1500 the source directory.
1501
1502 @node Building gcc
1503 @subsection Building GNU CC
1504 @cindex building @code{gcc}
1505 @cindex building @code{g77}
1506
1507 @vindex LANGUAGES
1508 Building @code{g77} requires building enough of @code{gcc} that
1509 these instructions assume you're going to build all of
1510 @code{gcc}, including @code{g++}, @code{protoize}, and so on.
1511 You can save a little time and disk space by changes the
1512 @samp{LANGUAGES} macro definition in @code{gcc/Makefile.in}
1513 or @code{gcc/Makefile}, but if you do that, you're on your own.
1514 One change is almost @emph{certainly} going to cause failures:
1515 removing @samp{c} or @samp{f77} from the definition of the
1516 @samp{LANGUAGES} macro.
1517
1518 After configuring @code{gcc}, which configures @code{g77} and
1519 @code{libf2c} automatically, you're ready to start the actual
1520 build by invoking @code{make}.
1521
1522 @pindex configure
1523 @emph{Note:} You @strong{must} have run @file{./configure}
1524 before you run @code{make}, even if you're
1525 using an already existing @code{gcc} development directory, because
1526 @file{./configure} does the work to recognize that you've added
1527 @code{g77} to the configuration.
1528
1529 There are two general approaches to building GNU CC from
1530 scratch:
1531
1532 @table @dfn
1533 @item bootstrap
1534 This method uses minimal native system facilities to
1535 build a barebones, unoptimized @code{gcc}, that is then
1536 used to compile (``bootstrap'') the entire system.
1537
1538 @item straight
1539 This method assumes a more complete native system
1540 exists, and uses that just once to build the entire
1541 system.
1542 @end table
1543
1544 On all systems without a recent version of @code{gcc}
1545 already installed, the @i{bootstrap} method must be
1546 used.
1547 In particular, @code{g77} uses extensions to the C
1548 language offered, apparently, only by @code{gcc}.
1549
1550 On most systems with a recent version of @code{gcc}
1551 already installed, the @i{straight} method can be
1552 used.
1553 This is an advantage, because it takes less CPU time
1554 and disk space for the build.
1555 However, it does require that the system have fairly
1556 recent versions of many GNU programs and other
1557 programs, which are not enumerated here.
1558
1559 @menu
1560 * Bootstrap Build::  For all systems.
1561 * Straight Build::   For systems with a recent version of @code{gcc}.
1562 @end menu
1563
1564 @node Bootstrap Build
1565 @subsubsection Bootstrap Build
1566 @cindex bootstrap build
1567 @cindex build, bootstrap
1568
1569 A complete bootstrap build is done by issuing a command
1570 beginning with @samp{make bootstrap @dots{}}, as
1571 described in @ref{Installation,,Installing GNU CC,
1572 gcc,Using and Porting GNU CC}.
1573 This is the most reliable form of build, but it does require
1574 the most disk space and CPU time, since the complete system
1575 is built twice (in Stages 2 and 3), after an initial build
1576 (during Stage 1) of a minimal @code{gcc} compiler using
1577 the native compiler and libraries.
1578
1579 You might have to, or want to, control the way a bootstrap
1580 build is done by entering the @code{make} commands to build
1581 each stage one at a time, as described in the @code{gcc}
1582 manual.
1583 For example, to save time or disk space, you might want
1584 to not bother doing the Stage 3 build, in which case you
1585 are assuming that the @code{gcc} compiler you have built
1586 is basically sound (because you are giving up the opportunity
1587 to compare a large number of object files to ensure they're
1588 identical).
1589
1590 To save some disk space during installation, after Stage 2
1591 is built, you can type @samp{rm -fr stage1} to remove the
1592 binaries built during Stage 1.
1593
1594 @emph{Note:} @xref{Object File Differences}, for information on
1595 expected differences in object files produced during Stage 2 and
1596 Stage 3 of a bootstrap build.
1597 These differences will be encountered as a result of using
1598 the @samp{make compare} or similar command sequence recommended
1599 by the GNU CC installation documentation.
1600
1601 Also, @xref{Installation,,Installing GNU CC,gcc,Using and Porting GNU CC},
1602 for important information on building @code{gcc} that is
1603 not described in this @code{g77} manual.
1604 For example, explanations of diagnostic messages
1605 and whether they're expected, or indicate trouble,
1606 are found there.
1607
1608 @node Straight Build
1609 @subsubsection Straight Build
1610 @cindex straight build
1611 @cindex build, straight
1612
1613 If you have a recent version of @code{gcc}
1614 already installed on your system, and if you're
1615 reasonably certain it produces code that is
1616 object-compatible with the version of @code{gcc}
1617 you want to build as part of building @code{g77},
1618 you can save time and disk space by doing a straight
1619 build.
1620
1621 To build just the C and Fortran compilers and the
1622 necessary run-time libraries, issue the following
1623 command:
1624
1625 @example
1626 make -k CC=gcc LANGUAGES=f77 all g77
1627 @end example
1628
1629 (The @samp{g77} target is necessary because the @code{gcc}
1630 build procedures apparently do not automatically build
1631 command drivers for languages in subdirectories.
1632 It's the @samp{all} target that triggers building
1633 everything except, apparently, the @code{g77} command
1634 itself.)
1635
1636 If you run into problems using this method, you have
1637 two options:
1638
1639 @itemize @bullet
1640 @item
1641 Abandon this approach and do a bootstrap build.
1642
1643 @item
1644 Try to make this approach work by diagnosing the
1645 problems you're running into and retrying.
1646 @end itemize
1647
1648 Especially if you do the latter, you might consider
1649 submitting any solutions as bug/fix reports.
1650 @xref{Trouble,,Known Causes of Trouble with GNU Fortran}.
1651
1652 However, understand that many problems preventing a
1653 straight build from working are not @code{g77} problems,
1654 and, in such cases, are not likely to be addressed in
1655 future versions of @code{g77}.
1656
1657 @node Pre-installation Checks
1658 @subsection Pre-installation Checks
1659 @cindex pre-installation checks
1660 @cindex installing, checking before
1661
1662 Before installing the system, which includes installing
1663 @code{gcc}, you might want to do some minimum checking
1664 to ensure that some basic things work.
1665
1666 Here are some commands you can try, and output typically
1667 printed by them when they work:
1668
1669 @example
1670 sh# @kbd{cd /usr/src/gcc}
1671 sh# @kbd{./g77 --driver=./xgcc -B./ -v}
1672 g77 version 0.5.21
1673  ./xgcc -B./ -v -fnull-version -o /tmp/gfa18047 @dots{}
1674 Reading specs from ./specs
1675 gcc version 2.7.2.2.f.3
1676  ./cpp -lang-c -v -isystem ./include -undef @dots{}
1677 GNU CPP version 2.7.2.2.f.3 (Linux/Alpha)
1678 #include "..." search starts here:
1679 #include <...> search starts here:
1680  ./include
1681  /usr/local/include
1682  /usr/alpha-unknown-linux/include
1683  /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.3/include
1684  /usr/include
1685 End of search list.
1686  ./f771 /tmp/cca18048.i -fset-g77-defaults -quiet -dumpbase @dots{}
1687 GNU F77 version 2.7.2.2.f.3 (Linux/Alpha) compiled @dots{}
1688 GNU Fortran Front End version 0.5.21 compiled: @dots{}
1689  as -nocpp -o /tmp/cca180481.o /tmp/cca18048.s
1690  ld -G 8 -O1 -o /tmp/gfa18047 /usr/lib/crt0.o -L. @dots{}
1691 __G77_LIBF77_VERSION__: 0.5.21
1692 @@(#)LIBF77 VERSION 19970404
1693 __G77_LIBI77_VERSION__: 0.5.21
1694 @@(#) LIBI77 VERSION pjw,dmg-mods 19970527
1695 __G77_LIBU77_VERSION__: 0.5.21
1696 @@(#) LIBU77 VERSION 19970609
1697 sh# @kbd{./xgcc -B./ -v -o /tmp/delete-me -xc /dev/null -xnone}
1698 Reading specs from ./specs
1699 gcc version 2.7.2.2.f.3
1700  ./cpp -lang-c -v -isystem ./include -undef @dots{}
1701 GNU CPP version 2.7.2.2.f.3 (Linux/Alpha)
1702 #include "..." search starts here:
1703 #include <...> search starts here:
1704  ./include
1705  /usr/local/include
1706  /usr/alpha-unknown-linux/include
1707  /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.3/include
1708  /usr/include
1709 End of search list.
1710  ./cc1 /tmp/cca18063.i -quiet -dumpbase null.c -version @dots{}
1711 GNU C version 2.7.2.2.f.3 (Linux/Alpha) compiled @dots{}
1712  as -nocpp -o /tmp/cca180631.o /tmp/cca18063.s
1713  ld -G 8 -O1 -o /tmp/delete-me /usr/lib/crt0.o -L. @dots{}
1714 /usr/lib/crt0.o: In function `__start':
1715 crt0.S:110: undefined reference to `main'
1716 /usr/lib/crt0.o(.lita+0x28): undefined reference to `main'
1717 sh#
1718 @end example
1719
1720 (Note that long lines have been truncated, and @samp{@dots{}}
1721 used to indicate such truncations.)
1722
1723 The above two commands test whether @code{g77} and @code{gcc},
1724 respectively, are able to compile empty (null) source files,
1725 whether invocation of the C preprocessor works, whether libraries
1726 can be linked, and so on.
1727
1728 If the output you get from either of the above two commands
1729 is noticeably different, especially if it is shorter or longer
1730 in ways that do not look consistent with the above sample
1731 output, you probably should not install @code{gcc} and @code{g77}
1732 until you have investigated further.
1733
1734 For example, you could try compiling actual applications and
1735 seeing how that works.
1736 (You might want to do that anyway, even if the above tests
1737 work.)
1738
1739 To compile using the not-yet-installed versions of @code{gcc}
1740 and @code{g77}, use the following commands to invoke them.
1741
1742 To invoke @code{g77}, type:
1743
1744 @example
1745 /usr/src/gcc/g77 --driver=/usr/src/gcc/xgcc -B/usr/src/gcc/ @dots{}
1746 @end example
1747
1748 To invoke @code{gcc}, type:
1749
1750 @example
1751 /usr/src/gcc/xgcc -B/usr/src/gcc/ @dots{}
1752 @end example
1753
1754 @node Installation of Binaries
1755 @subsection Installation of Binaries
1756 @cindex installation of binaries
1757 @cindex @code{g77}, installation of
1758 @cindex @code{gcc}, installation of
1759
1760 After configuring, building, and testing @code{g77} and @code{gcc},
1761 when you are ready to install them on your system, type:
1762
1763 @example
1764 make -k CC=gcc LANGUAGES=f77 install
1765 @end example
1766
1767 As described in @ref{Installation,,Installing GNU CC,
1768 gcc,Using and Porting GNU CC}, the values for
1769 the @samp{CC} and @samp{LANGUAGES} macros should
1770 be the same as those you supplied for the build
1771 itself.
1772
1773 So, the details of the above command might vary
1774 if you used a bootstrap build (where you might be
1775 able to omit both definitions, or might have to
1776 supply the same definitions you used when building
1777 the final stage) or if you deviated from the
1778 instructions for a straight build.
1779
1780 If the above command does not install @file{libf2c.a}
1781 as expected, try this:
1782
1783 @example
1784 make -k @dots{} install install-libf77 install-f2c-all
1785 @end example
1786
1787 We don't know why some non-GNU versions of @code{make} sometimes
1788 require this alternate command, but they do.
1789 (Remember to supply the appropriate definitions for @samp{CC} and
1790 @samp{LANGUAGES} where you see @samp{@dots{}} in the above command.)
1791
1792 Note that using the @samp{-k} option tells @code{make} to
1793 continue after some installation problems, like not having
1794 @code{makeinfo} installed on your system.
1795 It might not be necessary for your system.
1796
1797 @node Updating Documentation
1798 @subsection Updating Your Info Directory
1799 @cindex updating info directory
1800 @cindex info, updating directory
1801 @cindex directory, updating info
1802 @pindex /usr/info/dir
1803 @pindex g77.info
1804 @cindex texinfo
1805 @cindex documentation
1806
1807 As part of installing @code{g77}, you should make sure users
1808 of @code{info} can easily access this manual on-line.
1809 Do this by making sure a line such as the following exists
1810 in @file{/usr/info/dir}, or in whatever file is the top-level
1811 file in the @code{info} directory on your system (perhaps
1812 @file{/usr/local/info/dir}:
1813
1814 @example
1815 * g77: (g77).           The GNU Fortran programming language.
1816 @end example
1817
1818 If the menu in @file{dir} is organized into sections, @code{g77}
1819 probably belongs in a section with a name such as one of
1820 the following:
1821
1822 @itemize @bullet
1823 @item
1824 Fortran Programming
1825
1826 @item
1827 Writing Programs
1828
1829 @item
1830 Programming Languages
1831
1832 @item
1833 Languages Other Than C
1834
1835 @item
1836 Scientific/Engineering Tools
1837
1838 @item
1839 GNU Compilers
1840 @end itemize
1841
1842 @node Missing bison?
1843 @subsection Missing @code{bison}?
1844 @cindex @code{bison}
1845 @cindex missing @code{bison}
1846
1847 If you cannot install @code{bison}, make sure you have started
1848 with a @emph{fresh} distribution of @code{gcc}, do @emph{not}
1849 do @samp{make maintainer-clean} (in other versions of @code{gcc},
1850 this was called @samp{make realclean}), and, to ensure that
1851 @code{bison} is not invoked by @code{make} during the build,
1852 type these commands:
1853
1854 @example
1855 sh# @kbd{cd gcc}
1856 sh# @kbd{touch bi-parser.c bi-parser.h c-parse.c c-parse.h cexp.c}
1857 sh# @kbd{touch cp/parse.c cp/parse.h objc-parse.c}
1858 sh#
1859 @end example
1860
1861 These commands update the date-time-modified information for
1862 all the files produced by the various invocations of @code{bison}
1863 in the current versions of @code{gcc}, so that @code{make} no
1864 longer believes it needs to update them.
1865 All of these files should already exist in a @code{gcc}
1866 distribution, but the application of patches to upgrade
1867 to a newer version can leave the modification information
1868 set such that the @code{bison} input files look more ``recent''
1869 than the corresponding output files.
1870
1871 @emph{Note:} New versions of @code{gcc} might change the set of
1872 files it generates by invoking @code{bison}---if you cannot figure
1873 out for yourself how to handle such a situation, try an
1874 older version of @code{gcc} until you find someone who can
1875 (or until you obtain and install @code{bison}).
1876
1877 @node Missing makeinfo?
1878 @subsection Missing @code{makeinfo}?
1879 @cindex @code{makeinfo}
1880 @cindex missing @code{makeinfo}
1881
1882 If you cannot install @code{makeinfo}, either use the @code{-k} option when
1883 invoking make to specify any of the @samp{install} or related targets,
1884 or specify @samp{MAKEINFO=echo} on the @code{make} command line.
1885
1886 If you fail to do one of these things, some files, like @file{libf2c.a},
1887 might not be installed, because the failed attempt by @code{make} to
1888 invoke @code{makeinfo} causes it to cancel any further processing.
1889
1890 @node Distributing Binaries
1891 @section Distributing Binaries
1892 @cindex binaries, distributing
1893 @cindex code, distributing
1894
1895 If you are building @code{g77} for distribution to others in binary form,
1896 first make sure you are aware of your legal responsibilities (read
1897 the file @file{gcc/COPYING} thoroughly).
1898
1899 Then, consider your target audience and decide where @code{g77} should
1900 be installed.
1901
1902 For systems like GNU/Linux that have no native Fortran compiler (or
1903 where @code{g77} could be considered the native compiler for Fortran and
1904 @code{gcc} for C, etc.), you should definitely configure
1905 @code{g77} for installation
1906 in @file{/usr/bin} instead of @file{/usr/local/bin}.
1907 Specify the
1908 @samp{--prefix=/usr} option when running @file{./configure}.
1909 You might
1910 also want to set up the distribution so the @code{f77} command is a
1911 link to @code{g77}---just make an empty file named @file{f77-install-ok} in
1912 the source or build directory (the one in which the @file{f} directory
1913 resides, not the @file{f} directory itself) when you specify one of the
1914 @file{install} or @file{uninstall} targets in a @code{make} command.
1915
1916 For a system that might already have @code{f2c} installed, you definitely
1917 will want to make another empty file (in the same directory) named
1918 either @file{f2c-exists-ok} or @file{f2c-install-ok}.
1919 Use the former if you
1920 don't want your distribution to overwrite @code{f2c}-related files in existing
1921 systems; use the latter if you want to improve the likelihood that
1922 users will be able to use both @code{f2c} and @code{g77} to compile code for a
1923 single program without encountering link-time or run-time
1924 incompatibilities.
1925
1926 (Make sure you clearly document, in the ``advertising'' for
1927 your distribution, how installation of your distribution will
1928 affect existing installations of @code{gcc}, @code{f2c},
1929 @code{f77}, @file{libf2c.a}, and so on.
1930 Similarly, you should clearly document any requirements
1931 you assume are met by users of your distribution.)
1932
1933 For other systems with native @code{f77} (and @code{cc}) compilers,
1934 configure @code{g77} as you (or most of your audience) would
1935 configure @code{gcc} for their installations.
1936 Typically this is for installation in
1937 @file{/usr/local}, and would not include a copy of
1938 @code{g77} named @code{f77}, so
1939 users could still use the native @code{f77}.
1940
1941 In any case, for @code{g77} to work properly, you @strong{must} ensure
1942 that the binaries you distribute include:
1943
1944 @table @file
1945 @item bin/g77
1946 This is the command most users use to compile Fortran.
1947
1948 @item bin/gcc
1949 This is the command all users use to compile Fortran, either
1950 directly or indirectly via the @code{g77} command.
1951 The @file{bin/gcc} executable file must have been built
1952 from a @code{gcc} source tree into which a @code{g77} source
1953 tree was merged and configured, or it will not know how
1954 to compile Fortran programs.
1955
1956 @item bin/f77
1957 In installations with no non-GNU native Fortran
1958 compiler, this is the same as @file{bin/g77}.
1959 Otherwise, it should be omitted from the distribution,
1960 so the one on already on a particular system does
1961 not get overwritten.
1962
1963 @item info/g77.info*
1964 This is the documentation for @code{g77}.
1965 If it is not included, users will have trouble understanding
1966 diagnostics messages and other such things, and will send
1967 you a lot of email asking questions.
1968
1969 Please edit this documentation (by editing @file{gcc/f/*.texi}
1970 and doing @samp{make doc} from the @file{/usr/src/gcc} directory)
1971 to reflect any changes you've made to @code{g77}, or at
1972 least to encourage users of your binary distribution to
1973 report bugs to you first.
1974
1975 Also, whether you distribute binaries or install @code{g77}
1976 on your own system, it might be helpful for everyone to
1977 add a line listing this manual by name and topic to the
1978 top-level @code{info} node in @file{/usr/info/dir}.
1979 That way, users can find @code{g77} documentation more
1980 easily.
1981 @xref{Updating Documentation,,Updating Your Info Directory}.
1982
1983 @item man/man1/g77.1
1984 This is the short man page for @code{g77}.
1985 It is out of date, but you might as well include it
1986 for people who really like man pages.
1987
1988 @item man/man1/f77.1
1989 In installations where @code{f77} is the same as @code{g77},
1990 this is the same as @file{man/man1/g77.1}.
1991 Otherwise, it should be omitted from the distribution,
1992 so the one already on a particular system does not
1993 get overwritten.
1994
1995 @item lib/gcc-lib/@dots{}/f771
1996 This is the actual Fortran compiler.
1997
1998 @item lib/gcc-lib/@dots{}/libf2c.a
1999 This is the run-time library for @code{g77}-compiled programs.
2000 @end table
2001
2002 Whether you want to include the slightly updated (and possibly
2003 improved) versions of @code{cc1}, @code{cc1plus}, and whatever other
2004 binaries get rebuilt with the changes the GNU Fortran distribution
2005 makes to the GNU back end, is up to you.
2006 These changes are
2007 highly unlikely to break any compilers, and it is possible
2008 they'll fix back-end bugs that can be demonstrated using front
2009 ends other than GNU Fortran's.
2010
2011 Please assure users that unless
2012 they have a specific need for their existing,
2013 older versions of @code{gcc} command,
2014 they are unlikely to experience any problems by overwriting
2015 it with your version---though they could certainly protect
2016 themselves by making backup copies first!
2017 Otherwise, users might try and install your binaries
2018 in a ``safe'' place, find they cannot compile Fortran
2019 programs with your distribution (because, perhaps, they're
2020 picking up their old version of the @code{gcc} command,
2021 which does not recognize Fortran programs), and assume
2022 that your binaries (or, more generally, GNU Fortran
2023 distributions in general) are broken, at least for their
2024 system.
2025
2026 Finally, @strong{please} ask for bug reports to go to you first, at least
2027 until you're sure your distribution is widely used and has been
2028 well tested.
2029 This especially goes for those of you making any
2030 changes to the @code{g77} sources to port @code{g77}, e.g. to OS/2.
2031 @email{fortran@@gnu.ai.mit.edu} has received a fair number of bug
2032 reports that turned out to be problems with other peoples' ports
2033 and distributions, about which nothing could be done for the
2034 user.
2035 Once you are quite certain a bug report does not involve
2036 your efforts, you can forward it to us.