OSDN Git Service

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