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