Change the system name from 'FreeBSD' to 'DragonFly'. We are now officially
[dragonfly.git] / contrib / gcc / README.g77
1 1998-08-11
2
3 This directory contains the egcs variant of version 0.5.24 of the
4 GNU Fortran compiler (g77).  The GNU Fortran compiler is free software.
5 See the file COPYING.g77 for copying permission.
6
7 Currently, two variants of g77 exist.  One is the Free Software Foundation
8 (FSF) variant.  The other is the egcs variant.  As of egcs version 1.1,
9 these variants are kept fairly similar in most respects.  Pertinent
10 differences, such as the layout of the source code, are specified below.
11
12 Below, `[FSF]' denotes information applicable to only the FSF variant of
13 g77, while `[egcs]' denotes egcs-only information.
14
15
16 * IMPORTANT: Things you *must* do (or avoid) are marked with a * at the
17   beginning of the line in this file!!!
18
19
20 The email address to which bugs are to be reported is either
21 [FSF] <fortran@gnu.org> or [egcs] <egcs-bugs@cygnus.com>.
22
23 * *DO NOT* send any email (reporting bugs, asking questions, etc.) to
24   either of these addresses without *first* reading the g77 documentation.
25   Use `info', Info mode in GNU Emacs, or a text viewer such as `more' to
26   do this.
27
28   The g77 documentation is in the source files named `g77.info',
29   `g77.info-1', `g77.info-2', and so on in the `f' subdirectory.  If these
30   files are not present or you can't find them, contact the person or
31   organization that put together the g77 distribution you are using (probably
32   not the FSF or egcs), or ask your system administrator for help.
33
34
35 This README applies to only the g77-specific portions of the source-code
36 tree that contains it.  These portions include:
37
38   -  The README.g77 and [FSF] COPYING.g77 files, in this directory, "this
39      directory" being [FSF] the top-level directory containing a g77
40      distribution or [egcs] the gcc/ subdirectory of an egcs distribution.
41
42   -  The g77 front end, in the f/ subdirectory of this directory.
43
44   -  The libg2c library, in [FSF] the f/runtime/ subdirectory of this
45      directory or [egcs] the libf2c/ directory under the top-level
46      directory of the egcs distribution.
47
48
49 * To build g77, you must have a source distribution of [FSF] gcc
50   version 2.8 or [egcs] egcs version 1.1.  Do not attempt to use
51   any other version of gcc or egcs, because this version of g77 is
52   designed to work with only those versions.
53
54   Note that you must have *source* copies of the gcc or egcs distribution!
55   You cannot build g77 just using binaries of gcc or egcs.  Also, unless
56   you are an expert, avoid using any distribution of gcc or egcs not
57   identical to the ones distributed by the FSF and Cygnus Support,
58   respectively.  The primary FSF distribution site is:
59
60     <ftp://ftp.gnu.org/pub/gnu/>
61
62   The primary egcs distribution site is:
63
64     <ftp://ftp.cygnus.com/pub/egcs/>
65
66   Both of these sites have approved mirror sites from which valid
67   distributions also may be obtained.
68
69 * Do not attempt to combine the egcs version of g77 with the FSF
70   gcc distribution, or the FSF version of g77 with the egcs gcc
71   distribution.  Although the differences are minor, they might
72   be sufficient to prevent g77 from building properly, or from
73   working properly if the build appears to succeed.
74
75 [FSF] g77 is distributed as g77-<version>/f/ so that unpacking the g77
76 distribution is done in the normal GNU way, resulting in a directory having
77 the version number in the name.  However, to build g77, the g77 distribution
78 must be merged with an appropriate gcc distribution, normally in a gcc
79 source directory, before configuring, building, and installing g77.
80
81 [FSF] If you have just unpacked the g77 distribution, before proceeding,
82 you must merge the contents of the g77 distribution with the appropriate
83 gcc distribution on your system.
84
85 * [FSF] Read and follow the instructions in f/INSTALL that
86   explain how to merge a g77 source directory into a gcc source
87   directory.  You can use Info to read the same installation
88   instructions via:
89
90     info -f f/g77.info -n Unpacking
91
92 [FSF] The resulting directory layout includes the following, where gcc/
93 might be a link to, for example, gcc-2.8.1/:
94
95     gcc/                    Non-g77 files in gcc
96     gcc/COPYING.g77         A copy of the GPL, under which g77 is licensed
97     gcc/README.g77          This file
98     gcc/f/                  GNU Fortran front end
99     gcc/f/runtime/          libg2c configuration and g2c.h file generation
100     gcc/f/runtime/libF77/   Non-I/O portion of libg2c
101     gcc/f/runtime/libI77/   I/O portion of libg2c
102     gcc/f/runtime/libU77/   Additional interfaces to libc for libg2c
103
104 [FSF] Applying g77 patches in the form of .diff files is done by typing
105 `patch -p1 -d gcc' (where gcc/ contains the f/ subdirectory).  That is,
106 g77 patches are distributed in the same form, and at the same directory
107 level, as patches to the gcc distribution.  (Note: make sure you're
108 using GNU patch, version 2.5 or later!  Other versions of patch
109 have trouble with g77-related patches.)
110
111 [egcs] The egcs version of g77 is distributed already merged with
112 the rest of egcs (such as the gcc back end).
113
114 [egcs] The resulting directory layout includes the following, where egcs/
115 might be a link to, for example, egcs-1.1/:
116
117     egcs/gcc/               Non-g77 files in gcc
118     egcs/gcc/README.g77     This file
119     egcs/gcc/f/             GNU Fortran front end
120     egcs/libf2c/            libg2c configuration and g2c.h file generation
121     egcs/libf2c/libF77/     Non-I/O portion of libg2c
122     egcs/libf2c/libI77/     I/O portion of libg2c
123     egcs/libf2c/libU77/     Additional interfaces to libc for libg2c
124
125 [egcs] Applying g77-specific patches to egcs is done the same way as
126 applying other egcs patches.
127
128
129 Below, `libf2c/' shall denote [FSF] gcc/f/runtime/ or [egcs] egcs/libf2c/,
130 while `f/' shall denote [FSF] the rest of gcc/f/ or [egcs] egcs/gcc/f/.
131
132
133 Components of note in g77 are described below.
134
135 f/ as a whole contains the program GNU Fortran (g77), while libf2c/
136 contains a portion of the separate program f2c.  Note: The libf2c
137 code is not part of the program g77, just distributed with it.
138
139 f/ contains text files that document the Fortran compiler, source
140 files for the GNU Fortran Front End (FFE), and some other stuff.
141 The g77 compiler code is placed in f/ because it, along with its contents,
142 is designed to be a subdirectory of a GNU CC (gcc) source directory, gcc/,
143 which is structured so that language-specific front ends can be "dropped
144 in" as subdirectories.  The C++ front end (g++), is an example of this --
145 it resides in the cp/ subdirectory.  Note that the C front end (also
146 referred to as gcc) is an exception to this, as its source files reside
147 in the gcc/ directory itself.
148
149 libf2c/ contains the run-time libraries for the f2c program, also used
150 by g77.  These libraries normally referred to collectively as libf2c.
151 When built as part of g77, libf2c is installed under the name libg2c to avoid
152 conflict with any existing version of libf2c, and thus is often referred
153 to as libg2c when the g77 version is specifically being referred to.
154
155 The netlib version of libf2c/ contains two distinct libraries, libF77 and
156 libI77, each in their own subdirectories.  In g77, this distinction is not
157 made, beyond maintaining the subdirectory structure in the source-code tree.
158
159 libf2c/ is not part of the program g77, just distributed with it.  It
160 contains files not present in the official (netlib) version of libf2c,
161 and also contains some minor changes made from libf2c, to fix some bugs,
162 and to facilitate automatic configuration, building, and installation of
163 libf2c (as libg2c) for use by g77 users.
164
165 * See libf2c/README for more information, including licensing conditions
166   governing distribution of programs containing code from libg2c.
167
168 libg2c, g77's version of libf2c, adds Dave Love's implementation of
169 libU77, in the libf2c/libU77/ directory.  This library is distributed
170 under the GNU Library General Public License (LGPL) -- see the
171 file libf2c/libU77/COPYING.LIB for more information, as this license
172 governs distribution conditions for programs containing code from
173 this portion of the library.
174
175
176 Files of note in g77 are described below.
177
178 f/BUGS lists some important bugs known to be in g77.  Or:
179
180   info -f f/g77.info -n "Actual Bugs"
181
182 f/ChangeLog lists recent changes to g77 internals.
183
184 libf2c/ChangeLog lists recent changes to libg2c internals.
185
186 [FSF] f/INSTALL describes how to build and install GNU Fortran.  Or:
187
188   info -f f/g77.info -n Installation
189
190 f/NEWS contains the per-release changes.  These include the user-visible
191 changes described under "Changes" in the g77 documentation, plus internal
192 changes of import.  Or:
193
194   info -f f/g77.info -n News
195
196 * All users of g77 (not just installers) should read f/g77.info*
197   as well, using the `more' command if neither the `info' command,
198   nor GNU Emacs (with its Info mode), are available, or if they
199   aren't yet accustomed to using these tools.  Read f/BUGS and f/NEWS
200   plus, if you are planning on building or installing the FSF version
201   of g77, f/INSTALL, at the very least!  All of these files are
202   readable as "plain text" files.
203
204 * Also see <ftp://alpha.gnu.org/g77.plan> for up-to-date information
205   regarding g77 bug reports, known bugs, bug-fixes, and new versions.
206
207
208 The rest of this file is of note to only those who wish to
209 debug, modify, or test the FFE (in conjunction with the gcc back end).
210
211 If you want to explore the FFE code, which lives entirely in f/, here
212 are a few clues.  The file g77spec.c contains the g77-specific source code
213 for the `g77' command only -- this just forms a variant of the `gcc'
214 command, so, just as the `gcc' command itself does not contain
215 the C front end, the `g77' command does not contain the Fortran front
216 end (FFE).  The FFE code ends up in an executable named `f771', which
217 does the actual compiling, so it contains the FFE plus the gcc back end
218 (the latter to do most of the optimization, and the code generation).
219
220 The file parse.c is the source file for main() for a stand-alone FFE and
221 yyparse() for f771.  (Stand-alone building of the FFE doesn't work these days.)
222 The file top.c contains the top-level FFE function ffe_file and it (along
223 with top.h) define all ffe_[a-z].*, ffe[A-Z].*, and FFE_[A-Za-z].* symbols.
224 The file fini.c is a main() program that is used when building the FFE to
225 generate C header and source files for recognizing keywords.  The files
226 malloc.c and malloc.h comprise a memory manager that defines all
227 malloc_[a-z].*, malloc[A-Z].*, and MALLOC_[A-Za-z].* symbols.  All other
228 modules named <xyz> are comprised of all files named <xyz>*.<ext> and
229 define all ffe<xyz>_[a-z].*, ffe<xyz>[A-Z].*, and FFE<XYZ>_[A-Za-z].* symbols.
230 If you understand all this, congratulations -- it's easier for me to remember
231 how it works than to type in these grep patterns (such as they are).  But it
232 does make it easy to find where a symbol is defined -- for example,
233 the symbol "ffexyz_set_something" would be defined in xyz.h and implemented
234 there (if it's a macro) or in xyz.c.
235
236 The "porting" files of note currently are: proj.h, which defines the
237 "language" used by all the other source files (the language being
238 Standard C plus some useful things like ARRAY_SIZE and such) -- change
239 this file when you find your system doesn't properly define a Standard C
240 macro or function, for example; target.h and target.c, which describe
241 the target machine in terms of what data types are supported, how they are
242 denoted (what C type does an INTEGER*8 map to, for example), how to convert
243 between them, and so on (though as of 0.5.3, more and more of this information
244 is being dynamically configured by ffecom_init_0); com.h and com.c, which
245 interface to the target back end (currently only FFE stand-alone and the GBE);
246 ste.c, which contains code for implementing recognized executable statements
247 in the target back end (again currently either FFE or GBE); src.h and src.c,
248 which describe information on the format(s) of source files (such as whether
249 they are never to be processed as case-insensitive with regard to Fortran
250 keywords); and proj.c, which contains whatever code is needed to support
251 the language defined by proj.h.
252
253 If you want to debug the f771 executable, for example if it crashes,
254 note that the global variables "lineno" and "input_filename" are set
255 to reflect the current line being read by the lexer during the first-pass
256 analysis of a program unit and to reflect the current line being
257 processed during the second-pass compilation of a program unit.  If
258 an invocation of the function ffestd_exec_end() is on the stack,
259 the compiler is in the second pass, otherwise it is in the first.
260 (This information might help you reduce a test case and/or work around
261 a bug in g77 until a fix is available.)
262
263 Any questions or comments on these topics?  Read the g77 documentation!