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