This file documents the installation of the GNU Fortran compiler.
Copyright (C) 1995 Free Software Foundation, Inc.  You may copy,
distribute, and modify it freely as long as you preserve this copyright
notice and permission notice.  Contributed by James Craig Burley
(burley@gnu.ai.mit.edu).

950428

Here are the steps that seem important to take before doing any builds:

    1.  The g77 sources are intended to live in a subdirectory "f" of a
        gcc source tree.  For example, the g77 sources for g77-2.6.3-0.5.14
        are intended to have names such as gcc-2.6.3/f/proj.h.  Ensure
        that you have a gcc source tree with an "f" directory containing
        the g77 sources (such as this file, named INSTALL).

    2.  Read the file f/gbe/README, if it exists, and apply the appropriate
        patch file for the version of the GNU CC compiler you have, if
        that exists.  If the directory exists but the appropriate file
        does not exist, it is possible all the necessary patches to the
        GNU compiler's common back end have been integrated into the
        release you are using -- or, perhaps you are using a release that
        is in advance of the release corresponding to the version of g77
        you have.  If the information in f/gbe/README doesn't provide
        adequate information, the latter is more likely, and you should
        contact g77 and/or gcc maintainers for information on necessary
        back-end patches.

        NOTE: As of 0.5.5, g77's configuration file gcc/f/config-lang.in
        tries to detect whether at least one necessary patch "hunk" has been
        applied and, if not, aborts the configuration with an explanation.
        PLEASE do not try to fool this code by applying just the patch
        hunk it looks for, because then g77 might well appear to build
        and install correctly, and even appear to compile correctly,
        but could easily produce broken code.  (If someone does this and
        reports a bug that takes time to track down to this kind of
        incident, g77 developers will have to waste further time
        by adding more code to g77 to ensure all the patches have been
        made, instead of using that time to improve g77!  So behave.)

    3.  Follow the directions in the INSTALL file in the gcc source
        tree (such as running ./configure, doing "make", and so on --
        you MUST run ./configure before you run make, even if you're
        using an already existing gcc development directory, because
        ./configure does the work to recognize that you've added
        g77 to the configuration!!).

        WARNING: If you follow the procedure to build successive "stages"
        and you compare the object files produced by various stages,
        the file f/zzz.o WILL be different.  That is because it
        contains a string with an expansion of the __TIME__ macro,
        which expands to the current time of day.  It is nothing
        to worry about, since f/zzz.c doesn't contain any actual code.

        NOTE:  Configuring with the --srcdir argument is only known
        to work with GNU make.  Irix5.2 and SunOS4.1 makes definitely
        won't work outside the source directory at present.

        ALSO NOTE:  The f2c library gets installed in the gcc $(libsubdir)
        directory (see the top-level Makefile).  If you already have
        one in $(libdir) (typically /usr/local/lib) that gcc will
        find, it must be consistent with the one that gets built.  You
        should probably remove it or install the newly-built one in
        its place.  `make install' will check for this situation and
        stop (unless you define the make variable F2CLIBOK -- be
        careful).  Similarly, if you intend to compile C code that
        uses f2c.h for linking to g77-compiled code, make sure you
        pick up the one from $(libsubdir)/include, not from
        $(includedir).

        ALSO**2 NOTE:  If you have gcc 2.6.2 or greater already installed
        on your system, doing

          make -k CC=gcc LANGUAGES=f77 g77 install install-libf77

        or, if you already have libf2c.a installed and know you're willing
        to overwrite it,

          make -k CC=gcc LANGUAGES=f77 F2CLIBOK=1 g77 install install-libf77

        should suffice to build and install just g77 and gcc, without building
        any of the other GNU compilers.  HOWEVER, if this approach fails
        miserably, you should be able to do the installation by following
        the usual gcc installation method.  (The install-libf77 target
        shouldn't have to be separately specified, but it might need to be
        when using non-GNU versions of make.  We don't know why this is,
        yet.)  Using the "-k" option makes it easy to get around installation
        problems like not having makeinfo installed on your system, and the
        "g77" target ensures that the g77 command driver is built and thus
        installed.

        ALSO**3 NOTE: The "bootstrap" target in gcc's Makefile doesn't
        quite work right for subdirectory-resident languages in all cases.
        The solution is to do the stages by hand, and put absolute, not
        relative, pathnames in the definition for CC.

        ALSO**4 NOTE: It seems that building g77 might require bison and
        makeinfo to be installed.  g77 itself has no need for these, but
        other portions of gcc might, so before you start building gcc or
        g77, make sure bison and makeinfo are installed.

        IF YOU CANNOT INSTALL bison: make sure you start with a _fresh_
        distribution of gcc 2.6.2 or 2.6.3, do _not_ do "make realclean",
        and to be safe, type these commands to convince make not to try
        rebuilding them from the bison input files:

          cd gcc-2.6.2  # or 2.6.3
          touch bi-parser.c bi-parser.h c-parse.c c-parse.h cexp.c
          touch cp/parse.c cp/parse.h objc-parse.c

        IF YOU CANNOT INSTALL makeinfo: either use the -k option when
        invoking make to specify the install or install-libf77 targets,
        or specify "MAKEINFO=echo" on the make command line.  If you fail
        to do one of these, some things like libf2c.a will fail to be
        installed after the attempt to use makeinfo fails.

        ALSO**5 NOTE: The g77 author uses the "-Wall" option when
        compiling the code in gcc/f/*.c, so you should feel free to use
        that option if you work on that code.  There are still a couple
        of warnings emitted, but they have been verified as inconsequential.
        There are some prototype declarations in gcc/f/com.h that get
        around the lack of them in the back-end code in gcc/*.c, but
        turning on strict checking of prototypes and such has not yet
        been tried.

        ALSO**6 NOTE: g77 currently requires GNU C, not just ANSI C, to
        build it.  This is expected to be fixed in 0.6.  If you use a
        non-GNU C compiler, syntax errors are likely to be reported for
        source files like gcc/f/expr.c.

        ALSO**7 NOTE: g77 _does_ require a working ANSI C environment
        to build it.  In particular, some systems are missing strtoul(),
        bsearch(), etc in their libraries.  See gcc/f/proj.h for information
        on how to temporarily work around the bugs on these systems.
        (These are emphatically _not_ g77 bugs.  DO NOT REPORT THEM
        TO THE g77 AUTHOR!!!)

Remember to look through f/BUGS and f/PROJECTS carefully to get an idea
of where g77 is in terms of meeting various needs and having various features,
and what seems important to do right away vs. later.  Feel free to
suggest changes in that list as indicated in the file.

Bug reporting: For now, send email to fortran@gnu.ai.mit.edu.  Include
information on your configuration (output of "sh config.status" in gcc/),
version numbers of gcc and g77, and whatever else you can think of.
IMPORTANT ABOUT BUG REPORTING: We are completely unable to guess at
the kind of response g77 will receive at this time.  In case we are
swamped with bug reports, comments, &c., please don't be too concerned
if we don't respond to bug reports in any way.  We'll certainly save
everything we get, and try to prioritize and address everything, but
actually responding to email, while we think it's generally a great
idea, might conceivably have to be suspended if there is too much other
work to do.

NOTE: g77 sources (the FFE, in particular) require compiling using a Standard
(ANSI) C compiler and libraries.  You might be able to get around the lack
of Standard C libraries (especially system header files that don't conform),
but don't even try to build g77 without a Standard C compiler.  The FFE
uses prototypes and all sorts of other stuff (Standard C preprocessor
features, concatenation of neighboring constant strings, etc), and you won't
be productive if you try to "clean" that stuff out of the FFE.  (The
FFE will be brought more into line with GNU Coding Guidelines, but that
work will _not_ include lowering the code to K&R C.)  (Also note that,
temporarily, g77 in fact requires _GNU_ C, not just ANSI C.)

Your help testing g77 is greatly appreciated...and remember,
you should feel free to help not only with testing, debugging,
fixing, and coding, but with documentation and installation notes
as well!
