Skip to content
Snippets Groups Projects
installing.vsgml 73.3 KiB
Newer Older
<!doctype linuxdoc system>
<article>

<title>Building and Installing the Glasgow Functional Programming Tools Suite
<author>The GHC Team,
Department of Computing Science,
University of Glasgow,
Glasgow, Scotland,
G12 8QQ.

Email: @glasgow-haskell-{users,bugs}@@dcs.gla.ac.uk@
<date>April 1998</date>

<abstract>

This guide is intended for people who want to install or modify
programs from the Glasgow @fptools@ suite (as distinct from those
who merely want to <em/run/ them).

</abstract>

<toc>

<sect>Getting the Glasgow @fptools@ suite
<label id="sec:getting">
<p>

Building the Glasgow tools <em/can/ be complicated, mostly because
there are so many permutations of what/why/how, e.g., ``Build Happy
with HBC, everything else with GHC, leave out profiling, and test it
all on the `real' NoFib programs.''  Yeeps!

Happily, such complications don't apply to most people.  A few common
``strategies'' serve most purposes.  Pick one and proceed
as suggested:

<descrip>

<tag><idx>Binary distribution</idx>.</tag>
 If your only purpose is to install some of the @fptools@ suite
then the easiest thing to do is to get a binary distribution. In the
binary distribution everything is pre-compiled for your particular
machine architecture and operating system, so all you should have to
do is install the binaries and libraries in suitable places.  Section
<ref id="sec:installing-bin-distrib" name="Installing a Binary
Distribution"> describes how to do this.

A binary distribution may not work for you for two reasons.  First, we
may not have built the suite for the particular architecture/OS
platform you want. That may be due to lack of time and energy (in
which case you can get a source distribution and build from it; see
below).  Alternatively, it may be because we haven't yet ported the
suite to your architecture, in which case you are considerably worse
off.

The second reason a binary distribution may not be what you want is
if you want to read or modify the souce code.

<tag><idx>Source distribution</idx>.</tag> You have a supported
platform, but (a)~you like the warm fuzzy feeling of compiling things
yourself; (b)~you want to build something ``extra''---e.g., a set of
libraries with strictness-analysis turned off; or (c)~you want to hack
on GHC yourself.

A source distribution contains complete sources for one or more
projects in the @fptools@ suite.  Not only that, but the more awkward
machine-independent steps are done for you.  For example, if you don't
have @flex@<ncdx/flex/ you'll find it convenient that the source
distribution contains the result of running @flex@ on the lexical
analyser specification.  If you don't want to alter the lexical
analyser then this saves you having to find and install @flex@. You
will still need a working version of GHC on your machine in order to
compile (most of) the sources, however.

We make source distributions more frequently than binary
distributions; a release that comes with pre-compiled binaries
is considered a major release, i.e., a release that we have some
confidence will work well by having tested it (more) thoroughly.

Source-only distributions are either bugfix releases or snapshots of
current state of development. The release has undergone some testing.
Source releases of 4.xx can be compiled up using 2.10 or later.

<tag/Build GHC from intermediate C @.hc@ files<nidx/hc files/:/ You
need a working GHC to use a source distribution. What if you don't
have a working GHC? Then you have no choice but to ``bootstrap'' up
from the intermediate C (@.hc@) files that we provide.  Building GHC
on an unsupported platform falls into this category.  Please see
Section <ref id="sec:booting-from-C" name="Booting From C">.

Once you have built GHC, you can build the other Glasgow tools with
it.

In theory, you can (could?) build GHC with another Haskell compiler
(e.g., HBC). We haven't tried to do this for ages and it almost
certainly doesn't work any more (for tedious reasons).

<tag/The CVS repository./

We make source distributions slightly more often than binary
distributions; but still infrequently.  If you want more up-to-the
minute (but less tested) source code then you need to get access to
our CVS repository.

All the @fptools@ source code is held in a CVS repository. CVS is a
pretty good source-code control system, and best of all it works over
the network.

The repository holds source code only. It holds no mechanically
generated files at all.  So if you check out a source tree from CVS
you will need to install every utility so that you can build all the
derived files from scratch.

More information about our CVS repository is available at <url
name="The Fptools CVS Cheat Sheet"
url="http://www.dcs.gla.ac.uk/fp/software/ghc/cvs-cheat-sheet.html">.
</descrip>

If you are going to do any building from sources (either from a source
distribution or the CVS repository) then you need to read all of this
manual in detail.

<sect>Things to check before you start typing
<p>

Here's a list of things to check before you get started.
<enum>
<item>
<idx>Disk space needed</idx>: About 30MB (five hamburgers' worth) of disk space
for the most basic binary distribution of GHC; more for some
platforms, e.g., Alphas.  An extra ``bundle'' (e.g., concurrent
Haskell libraries) might take you to 8--10 hamburgers.

You'll need over 100MB (say, 20 hamburgers' worth) if you need to
build the basic stuff from scratch.


All of the above are <em/estimates/ of disk-space needs.(I don't yet
know the disk requirements for the non-GHC tools).

<item>
Use an appropriate machine, compilers, and things.

SPARC boxes, DEC Alphas running OSF/1, and PCs running Linux, FreeBSD,
or Solaris are all fully supported.  MIPS, AIX, Win32 and HP boxes are
in pretty good shape.  Section <ref id="sec:port-info" name="Port Info">
gives the full run-down on ports or lack thereof.

NOTE: as of version 4.00, we lost a few ports.  All of the x86 ports
are working, as is the Sparc/Solaris port, but the rest will need a
little work.  Please contact us if you can provide hardware cycles
and/or porting expertise.

<item> Be sure that the ``pre-supposed'' utilities are installed.
Section <ref id="sec:pre-supposed" name="Installing Pre-Supposed
Utilities"> elaborates.

<item> If you have any problem when building or installing the Glasgow
tools, please check the ``known pitfalls'' (Section <ref
id="sec:build-pitfalls" name="Building Pitfalls">).  Also check the
known bugs page: <url
url="http://www.dcs.gla.ac.uk/fp/software/ghc/ghc-bugs.html">.
<nidx/known bugs/
<nidx/bugs, known/

If you feel there is still some shortcoming in our procedure or
instructions, please report it.

For GHC, please see the bug-reporting section of the User's guide
(separate document), to maximise the usefulness of your report.
<nidx/bugs, reporting/

If in doubt, please send a message to @glasgow-haskell-bugs@@dcs.gla.ac.uk@.
<nidx/bugs, mailing list/
</enum>


<sect>What machines the Glasgow tools run on
<label id="sec:port-info">
<p>
<nidx>ports, GHC</nidx>
<nidx>GHC ports</nidx>
<nidx>supported platforms</nidx>
<nidx>platforms, supported</nidx>

The main question is whether or not the Haskell compiler (GHC) runs on
your platform.

A ``platform'' is a architecture/manufacturer/operating-system
combination, such as @sparc-sun-solaris2@.  Other common ones are
@alpha-dec-osf2@, @hppa1.1-hp-hpux9@, @i386-unknown-linux@,
@i386-unknown-solaris2@, @i386-unknown-freebsd@,
@i386-unknown-cygwin32@, @m68k-sun-sunos4@, @mips-sgi-irix5@,
@sparc-sun-sunos4@, @sparc-sun-solaris2@, @powerpc-ibm-aix@.

Bear in mind that certain ``bundles'', e.g. parallel Haskell, may not
work on all machines for which basic Haskell compiling is supported.

Some libraries may only work on a limited number of platforms; for
example, a sockets library is of no use unless the operating system
supports the underlying BSDisms.

<sect1>What platforms the Haskell compiler (GHC) runs on
<p>
<nidx>fully-supported platforms</nidx>
<nidx>native-code generator</nidx>
<nidx>registerised ports</nidx>
<nidx>unregisterised ports</nidx>

The GHC hierarchy of Porting Goodness: (a)~Best is a native-code
generator; (b)~next best is a ``registerised''
port; (c)~the bare minimum is an ``unregisterised'' port.
(``Unregisterised'' is so terrible that we won't say more about it).

We use Sparcs running Solaris 2.5, x86 boxes running FreeBSD and
Linux, and DEC~Alphas running OSF/1~V2.0, so those are the
``fully-supported'' platforms, unsurprisingly.  All have native-code
generators, for quicker compilations.  The native-code generator for
iX86 platforms (e.g., Linux ELF) is <em/nearly/ working; but is not
turned on by default.

Here's everything that's known about GHC ports.  We identify platforms
by their ``canonical'' CPU/Manufacturer/OS triple.

Note that some ports are fussy about which GCC version you use; or
require GAS; or ...

<descrip>
<tag/alpha-dec-osf1:/
<nidx>alpha-dec-osf1: fully supported</nidx>

(We have OSF/1 V3.0.) Fully supported, including native-code
generator.  We recommend GCC 2.6.x or later.

<tag/sparc-sun-sunos4:/
<nidx>sparc-sun-sunos4: fully supported</nidx>

Fully supported, including native-code generator.

<tag/sparc-sun-solaris2:/ 
<nidx>sparc-sun-solaris2: fully supported</nidx>

Fully supported, including native-code generator.  A couple of quirks,
though: (a)~the profiling libraries are bizarrely huge when compiled
with object splitting; (b)~the default @xargs@<ncdx/xargs/ program is
atrociously bad for building GHC libraries (see Section <ref
id="sec:pre-supposed" name="Installing Pre-Supposed Utilities"> for
details).

<tag/HP-PA box running HP/UX 9.x:/
<nidx>hppa1.1-hp-hpux: registerised port</nidx>

Works registerised.  No native-code generator.  For GCC, you're best
off with one of the Utah releases of GCC~2.6.3 (`u3' or later), from
@jaguar.cs.utah.edu@.  We think a straight GCC 2.7.x works,
too.

Concurrent/Parallel Haskell probably don't work (yet).
<nidx>hppa1.1-hp-hpux: concurrent---no</nidx>
<nidx>hppa1.1-hp-hpux: parallel---no</nidx>

<tag/i386-*-linux (PCs running Linux---ELF format):/
<nidx>i386-*-linux: registerised port</nidx>

GHC works registerised.  You <em/must/ have GCC 2.7.x or later.  The
iX86 native-code generator is <em/nearly/ there, but it isn't turned
on by default.

Profiling works, and Concurrent Haskell works.
<nidx>i386-*-linux: profiling---yes</nidx>
<nidx>i386-*-linux: concurrent---yes</nidx>
Parallel Haskell probably works.
<nidx>i386-*-linux: parallel---maybe</nidx>

On old Linux a.out systems: should be the same.
<nidx>i386-*-linuxaout: registerised port</nidx>

<tag>i386-*-freebsd (PCs running FreeBSD 2.2 or higher, and
NetBSD/OpenBSD using FreeBSD emulation):</tag> 
<nidx>i386-*-freebsd:registerised port</nidx> 

GHC works registerised. Supports same set of bundles as the above.

<nidx>i386-*-freebsd: profiling---yes</nidx>
<nidx>i386-*-freebsd: concurrent---yes</nidx>
<nidx>i386-*-freebsd: parallel---maybe</nidx>

<tag/i386-unknown-cygwin32:/
<nidx>i386-unknown-cygwin32: fully supported</nidx>

Fully supported under Win95/NT, including a native code
generator. Requires the @cygwin32@ compatibility library and a
healthy collection of GNU tools (i.e., gcc, GNU ld, bash etc.)
Profiling works, so does Concurrent Haskell.  

<nidx>i386-*-cygwin32: profiling---yes</nidx> 
<nidx>i386-*-cygwin32: concurrent---yes</nidx>

<tag/mips-sgi-irix5:/
<nidx>mips-sgi-irix5: registerised port</nidx>

GHC works registerised (no native-code generator).  I suspect any
GCC~2.6.x (or later) is OK.  The GCC that I used was built with
@--with-gnu-as@; turns out that is important!

Concurrent/Parallel Haskell probably don't work (yet).
Profiling might work, but it is untested.
<nidx>mips-sgi-irix5: concurrent---no</nidx>
<nidx>mips-sgi-irix5: parallel---no</nidx>
<nidx>mips-sgi-irix5: profiling---maybe</nidx>

<tag/mips-sgi-irix6:/
<nidx>mips-sgi-irix6: registerised port</nidx>

Thanks to the fine efforts of Tomasz Cholewo <htmlurl
url="mailto:tjchol01@@mecca.spd.louisville.edu"
name="tjchol01@@mecca.spd.louisville.edu">, GHC works registerised (no
native code generator) under IRIX 6.2 and 6.3. Depends on having
specially tweaked version of gcc-2.7.2 around, which can be downloaded
from <url url="http://mecca.spd.louisville.edu/~tjchol01/software/">.

Profiling works, Concurrent/Parallel Haskell might work (AFAIK, untested).
<nidx>mips-sgi-irix6: concurrent---maybe</nidx>
<nidx>mips-sgi-irix6: parallel---maybe</nidx>
<nidx>mips-sgi-irix6: profiling---yes</nidx>

<tag/powerpc-ibm-aix:/
<nidx>powerpc-ibm-aix: registerised port</nidx>
GHC works registerised (no native-code generator..yet).
I suspect 2.7.x is what you need together with this.

Concurrent/Parallel Haskell probably don't work (yet).
Profiling might work, but it is untested.
<nidx>mips-sgi-irix5: concurrent---no</nidx>
<nidx>mips-sgi-irix5: parallel---no</nidx>
<nidx>mips-sgi-irix5: profiling---maybe</nidx>

<tag/m68k-apple-macos7 (Mac, using MPW):/
<nidx>m68k-apple-macos7: historically ported</nidx>
Once upon a time, David Wright in Tasmania has actually
gotten GHC to run on a Macintosh.  Ditto James Thomson here at Glasgow.
You may be able to get Thomson's from here.  (Not sure that it will
excite you to death, but...)

No particularly recent GHC is known to work on a Mac.

<tag/m68k-next-nextstep3:/
<nidx>m68k-next-nextstep3: historically ported</nidx>
Carsten Schultz succeeded with a ``registerised'' port of GHC~0.29.
There's probably a little bit-rot since then, but otherwise it should
still be fine.

Concurrent/Parallel Haskell probably won't work (yet).
<nidx>m68k-next-nextstep3: concurrent---no</nidx>
<nidx>m68k-next-nextstep3: parallel---no</nidx>

<tag/m68k-sun-sunos4 (Sun3):/ <nidx>m68k-sun-sunos4: registerised
port</nidx> GHC 2.0x and 3.0x haven't been tried on a Sun3.  GHC~0.26
worked registerised.  No native-code generator.

Concurrent/Parallel Haskell probably don't work (yet).
<nidx>m68k-sun-sunos4: concurrent---no</nidx>
<nidx>m68k-sun-sunos4: parallel---no</nidx>
</descrip>

<sect1>What machines the other tools run on
<p>

Unless you hear otherwise, the other tools work if GHC works.

Haggis requires Concurrent Haskell to work.
<nidx>Haggis, Concurrent Haskell</nidx>


<sect>Installing from binary distributions
<p>
<label id="sec:installing-bin-distrib">
<nidx>binary installations</nidx>
<nidx>installation, of binaries</nidx>

Installing from binary distributions is easiest, and recommended!
(Why binaries?  Because GHC is a Haskell compiler written in Haskell,
so you've got to ``bootstrap'' it, somehow.  We provide
machine-generated C-files-from-Haskell for this purpose, but it's
really quite a pain to use them.  If you must build GHC from its
sources, using a binary-distributed GHC to do so is a sensible way to
proceed. For the other @fptools@ programs, many are written in Haskell,
so binary distributions allow you to install them without having a Haskell compiler.)


<sect1>Bundle structure<p>
<nidx>bundles of binary stuff</nidx>

Binary distributions come in ``bundles,'' one bundle per file called
@<bundle>-<platform>.tar.gz@.  (See Section <ref
id="sec:port-info" name="Porting Information"> for what a platform
is.)  Suppose that you untar a binary-distribution bundle, thus:

<tscreen><verb>
  % cd /your/scratch/space
  % gunzip < ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -
</verb></tscreen>

Then you should find a single directory, @fptools@, with the following
structure:

<nidx>binary distribution, layout</nidx>
<nidx>directory layout (binary distributions)</nidx>
<descrip>

<tag>@Makefile.in@</tag> the raw material from which the @Makefile@
will be made (Section <ref id="sec:install" name="Installation">).

<tag>@configure@</tag> the configuration script (Section <ref
id="sec:install" name="Installing">).

<tag>@README@</tag> Contains this file summary.

<tag>@INSTALL@</tag> Contains this description of how to install
the bundle.

<tag>@ANNOUNCE@</tag> The announcement message for the bundle.

<tag>@NEWS@</tag> release notes for the bundle -- a longer version
of @ANNOUNCE@.  For GHC, the release notes are contained in the User
Guide and this file isn't present.

<tag>@bin/<platform>@</tag> contains platform-specific executable
files to be invoked directly by the user.  These are the files that
must end up in your path.

<tag>@lib/<platform>/@</tag> contains platform-specific support
files for the installation.  Typically there is a subdirectory for
each @fptools@ project, whose name is the name of the project with its
version number.  For example, for GHC there would be a sub-directory
@ghc-x.xx@/ where @x.xx@ is the version number of GHC in the bundle.

These sub-directories have the following general structure:

<descrip>
<tag>@libHS.a@ etc:</tag> supporting library archives.
<tag>@ghc-iface.prl@ etc:</tag> support scripts.
<tag>@import/@</tag> <idx>Interface files</idx> (@.hi@) for the prelude.
<tag>@include/@</tag> A few C @#include@ files.
</descrip>

<tag>@share/@</tag> contains platform-independent support files
for the installation.  Again, there is a sub-directory for each
@fptools@ project.

<tag>@info/@</tag> contains Emacs info documentation files (one
sub-directory per project).

<tag>@html/@</tag> contains HTML documentation files (one
sub-directory per project).

<tag>@man/@</tag> contains Unix manual pages.

</descrip>

This structure is designed so that you can unpack multiple bundles
(including ones from different releases or platforms) into a single
@fptools@ directory<footnote>this doesn't work at the
moment</footnote>:

<tscreen><verb>
  % cd /your/scratch/space
  % gunzip < ghc-x.xx-sun-sparc-solaris2.tar.gz | tar xvf -
  % gunzip < happy-x.xx-sun-sparc-sunos4.tar.gz | tar xvf -
</verb></tscreen>

When you do multiple unpacks like this, the top level @Makefile@,
@README@, and @INSTALL@ get overwritten each time.
That's fine -- they should be the same.  Likewise, the
@ANNOUNCE-<bundle>@ and @NEWS-<bundle>@
files will be duplicated across multiple platforms, so they will be
harmlessly overwritten when you do multiple unpacks.  Finally, the
@share/@ stuff will get harmlessly overwritten when you do
multiple unpacks for one bundle on different platforms.

<sect2>Installing<p>
<label id="sec:install">

OK, so let's assume that you have unpacked your chosen bundles into a
scratch directory @fptools@. What next? Well, you will at least need
to run the @configure@<ncdx/configure/ script by changing your
directory to @fptools@ and typing @./configure@.  That should convert
@Makefile.in@ to @Makefile@.

<nidx/installing in-place/
<nidx/in-place installation/

You can now either start using the tools <em/in-situ/ without going
through any installation process, just type @make in-place@ to set the
tools up for this. You'll also want to add the path which @make@ will
now echo to your @PATH@ environment variable. This option is useful if
you simply want to try out the package and/or you don't have the
necessary priviledges (or inclination) to properly install the tools
locally. Note that if you do decide to install the package `properly'
at a later date, you have to go through the installation steps that
follows.

To install an @fptools@ package, you'll have to do the following:

<enum>
<item> Edit the @Makefile@ and check the settings of the following variables:

<nidx/directories, installation/
<nidx/installation directories/

<descrip>
<tag>@platform@</tag> the platform you are going to install for.

<tag>@bindir@</tag> the directory in which to install user-invokable
binaries.

<tag>@libdir@</tag> the directory in which to install
platform-dependent support files.

<tag>@datadir@</tag> the directory in which to install
platform-independent support files.

<tag>@infodir@</tag> the directory in which to install Emacs info
files.

<tag>@htmldir@</tag> the directory in which to install HTML
documentation.

<tag>@dvidir@</tag> the directory in which to install DVI
documentation.
</descrip>

The values for these variables can be set through invocation of the
@configure@<ncdx/configure/ script that comes with the distribution,
but doing an optical diff to see if the values match your expectations
is always a Good Idea.

<em>Instead of running @configure@, it is perfectly OK to copy
@Makefile.in@ to @Makefile@ and set all these variables
directly yourself.  But do it right!</em>

<item>Run @make install@.  This <em/ should/ work with ordinary Unix
@make@ -- no need for fancy stuff like GNU @make@. 

<item>@rehash@ (t?csh or zsh users), so your shell will see the new
stuff in your bin directory.

<item> Once done, test your ``installation'' as suggested in Section
<ref id="sec:GHC-test" name="Testing GHC">.  Be sure to use a @-v@
option, so you can see exactly what pathnames it's using.

If things don't work as expected, check the list of know pitfalls in
Section <ref id="sec:build-pitfalls" name="Building Pitfalls">.
</enum>

<nidx/link, installed as ghc/
When installing the user-invokable binaries, this installation
procedure will install GHC as @ghc-x.xx@ where @x.xx@ is the version
number of GHC.  It will also make a link (in the binary installation
directory) from @ghc@ to @ghc-x.xx@.  If you install multiple versions
of GHC then the last one ``wins'', and ``@ghc@'' will invoke the last
one installed.  You can change this manually if you want.  But
regardless, @ghc-x.xx@ should always invoke GHC version @x.xx@.

<sect1>What bundles there are
<p>

<nidx/bundles, binary/
There are plenty of ``non-basic'' GHC bundles.  The files for them are
called @ghc-x.xx-<bundle>-<platform>.tar.gz@, where
the @<platform>@ is as above, and @<bundle>@ is one
of these:

<descrip>

<tag>@prof@:</tag>  Profiling with cost-centres.  You probably want this.
<nidx/profiling bundles/
<nidx/bundles, profiling/

<tag>@conc@:</tag> Concurrent Haskell features.  You may want this.
<nidx/concurrent bundles/
<nidx/bundles, concurrent/

<tag>@par@:</tag> Parallel Haskell features (sits on top of PVM).
You'll want this if you're into that kind of thing.
<nidx/parallel bundles/
<nidx/bundles, parallel/

<tag>@gran@:</tag> The ``GranSim'' parallel-Haskell simulator
(hmm... mainly for implementors).
<nidx/bundles, gransim/
<nidx/gransim bundles/

<tag>@ticky@:</tag> ``Ticky-ticky'' profiling; very detailed
information about ``what happened when I ran this program''---really
for implementors.
<nidx/bundles, ticky-ticky/
<nidx/ticky-ticky bundles/

<tag>@prof-conc@:</tag> Cost-centre profiling for Concurrent Haskell.
<nidx/bundles, profiled-concurrent/
<nidx/profiled-concurrent bundles/

<tag>@prof-ticky@:</tag>  Ticky-ticky profiling for Concurrent Haskell.
<nidx/bundles, profiled-ticky/
<nidx/ticky-concurrent bundles/
</descrip>

One likely scenario is that you will grab <em/three/ binary
bundles---basic, profiling, and concurrent.  We don't usually make the
rest, although you can build them yourself from a source distribution.

<sect1>Testing that GHC seems to be working
<label id="sec:GHC-test">
<p>
<nidx>testing a new GHC</nidx>

The way to do this is, of course, to compile and run <em/this/ program
(in a file @Main.hs@):

<tscreen><verb>
main = putStr "Hello, world!\n"
</verb></tscreen>

Compile the program, using the @-v@ (verbose) flag to verify that
libraries, etc., are being found properly:
<tscreen><verb>
% ghc -v -o hello Main.hs
</verb></tscreen>

Now run it:
<tscreen><verb>
% ./hello
Hello, world!
</verb></tscreen>

Some simple-but-profitable tests are to compile and run the notorious
@nfib@<ncdx/nfib/ program, using different numeric types.  Start with
@nfib :: Int -> Int@, and then try @Integer@, @Float@, @Double@,
@Rational@ and perhaps the overloaded version.  Code for this is
distributed in @ghc/misc/examples/nfib/@ in a source distribution.

For more information on how to ``drive'' GHC, either do @ghc -help@ or
consult the User's Guide (distributed in several pre-compiled formats
with a binary distribution, or in source form in
@ghc/docs/users_guide@ in a source distribution).

<sect>Installing pre-supposed utilities
<label id="sec:pre-supposed">
<nidx>pre-supposed utilities</nidx>
<nidx>utilities, pre-supposed</nidx>
<p>

Here are the gory details about some utility programs you may need;
@perl@ and @gcc@ are the only important ones. (<idx/PVM/ is important
if you're going for Parallel Haskell.)  The <tt><cdx/configure/</tt>
script will tell you if you are missing something.

<descrip>
<tag>Perl:</tag>
<nidx>pre-supposed: Perl</nidx>
<nidx>Perl, pre-supposed</nidx>
<em/You have to have Perl to proceed!/ Perl is a language quite good
for doing shell-scripty tasks that involve lots of text processing.
It is pretty easy to install.

Perl~5 is required.  For Win32 platforms, we strongly suggest you pick
up a port of Perl~5 for @cygwin32@, as the common Hip/ActiveWare port
of Perl is not Cool Enough for our purposes.

Perl should be put somewhere so that it can be invoked by the @#!@
script-invoking mechanism. (I believe @/usr/bin/perl@ is preferred;
we use @/usr/local/bin/perl@ at Glasgow.)  The full pathname should
be less than 32 characters long.

<tag>GNU C (@gcc@):</tag>
<nidx>pre-supposed: GCC (GNU C compiler)</nidx>
<nidx>GCC (GNU C compiler), pre-supposed</nidx>

Versions 2.7.2.x, 2.8.1 and egcs 1.1.2 are known to work.  Use other
versions at your own risk!

If your GCC dies with ``internal error'' on some GHC source file,
please let us know, so we can report it and get things improved.
(Exception: on @iX86@ boxes---you may need to fiddle with GHC's
@-monly-N-regs@ option; see the User's Guide)

<tag>@xargs@ on Solaris2:</tag>
<nidx>xargs, presupposed (Solaris only)</nidx>
<nidx>Solaris: alternative xargs</nidx>
The GHC libraries are put together with something like:
<tscreen><verb>
find bunch-of-dirs -name '*.o' -print | xargs ar q ...
</verb></tscreen>
Unfortunately the Solaris @xargs@ (the shell-script equivalent
of @map@) only ``bites off'' the @.o@ files a few at a
time---with near-infinite rebuilding of the symbol table in
the @.a@ file.

The best solution is to install a sane @xargs@ from the GNU
findutils distribution.  You can unpack, build, and install the GNU
version in the time the Solaris @xargs@ mangles just one GHC
library.

<tag>Autoconf:</tag>
<nidx>pre-supposed: Autoconf</nidx>
<nidx>Autoconf, pre-supposed</nidx>
GNU Autoconf is needed if you intend to build from the CVS sources, it
is <em/not/ needed if you just intend to build a standard source
distribution.
Autoconf builds the @configure@ script from @configure.in@ and
@aclocal.m4@.  If you modify either of these files, you'll need
Autoconf to rebuild @configure@.

<tag>@sed@</tag>
<nidx>pre-supposed: sed</nidx>
<nidx>sed, pre-supposed</nidx>

You need a working @sed@ if you are going to build from sources.  The
build-configuration stuff needs it.  GNU sed version 2.0.4 is no good!
It has a bug in it that is tickled by the build-configuration.  2.0.5
is ok. Others are probably ok too (assuming we don't create too
elaborate configure scripts..)
One @fptools@ project is worth a quick note at this point, because it
is useful for all the others: @glafp-utils@ contains several utilities
which aren't particularly Glasgow-ish, but Occasionally Indispensable.
Like @lndir@ for creating symbolic link trees.
<sect1> Tools for building parallel GHC (GPH)
<label id="pre-supposed-gph-tools">
<p>

<descrip>
<tag>PVM version 3:</tag>
<nidx>pre-supposed: PVM3 (Parallel Virtual Machine)</nidx>
<nidx>PVM3 (Parallel Virtual Machine), pre-supposed</nidx>

PVM is the Parallel Virtual Machine on which Parallel Haskell programs
run.  (You only need this if you plan to run Parallel Haskell.
Concurent Haskell, which runs concurrent threads on a uniprocessor
doesn't need it.)  Underneath PVM, you can have (for example) a
network of workstations (slow) or a multiprocessor box (faster).

The current version of PVM is 3.3.11; we use 3.3.7.  It is readily
available on the net; I think I got it from @research.att.com@, in
@netlib@.

A PVM installation is slightly quirky, but easy to do.  Just follow
the @Readme@ instructions.

<tag>@bash@:</tag>
<nidx>bash, presupposed (Parallel Haskell only)</nidx>
Sadly, the @gr2ps@ script, used to convert ``parallelism profiles''
to PostScript, is written in Bash (GNU's Bourne Again shell).
This bug will be fixed (someday).
</descrip>

<sect1> Tools for building the Documentation
<label id="pre-supposed-doc-tools">
<p>

The following additional tools are required if you want to format the
documentation that comes with the @fptools@ projects:

<descrip>
<tag>SGML-Tools:</tag>
<nidx>pre-supposed: SGML-Tools</nidx>
<nidx>SGML-Tools, pre-supposed</nidx>
All our documentation is written in SGML, using the LinuxDoc DTD that
comes with the SGML-Tools, which is the most shrink-wrapped SGML suite
that we could find.  Should unpack and build painlessly on most
architectures, and you can use it to generate HTML, Info, LaTeX (and
hence DVI and Postscript), Groff, and plain text output from any
LinuxDoc source file (including this manual).  Sources are available
from <url name="The SGML-Tools Web Page"
url="http://www.sgmltools.org/">

<tag>TeX:</tag>
<nidx>pre-supposed: TeX</nidx>
<nidx>TeX, pre-supposed</nidx>
A decent TeX distribution is required if you want to produce printable
documentation.  We recomment teTeX, which includes just about
everything you need.
</descrip>
<sect1> Other useful tools
<label id="pre-supposed-other-tools">
<p>

<descrip>
<tag>Flex:</tag> 
<nidx>pre-supposed: flex</nidx> 
<nidx>flex, pre-supposed</nidx>

This is a quite-a-bit-better-than-Lex lexer.  Used to build a couple
of utilities in @glafp-utils@.  Depending on your operating system,
the supplied @lex@ may or may not work; you should get the GNU
version.
</descrip>

<sect>Building from source
<label id="sec:building-from-source">
<nidx>Building from source</nidx>
<nidx>Source, building from</nidx>
<p>

You've been rash enough to want to build some of
the Glasgow Functional Programming tools (GHC, Happy,
nofib, etc) from source.  You've slurped the source,
from the CVS repository or from a source distribution, and
now you're sitting looking at a huge mound of bits, wondering
what to do next.

Gingerly, you type @make@.  Wrong already!
This rest of this guide is intended for duffers like me, who aren't
really interested in Makefiles and systems configurations, but who
need a mental model of the interlocking pieces so that they can make
them work, extend them consistently when adding new software, and lay
hands on them gently when they don't work.

<sect1>Your source tree
<label id="sec:source-tree">
<p>

The source code is held in your <em/source tree/.
The root directory of your source tree <em/must/
contain the following directories and files:

<itemize>
<item> @Makefile@: the root Makefile.
<item> @mk/@: the directory that contains the
main Makefile code, shared by all the
@fptools@ software.
<item> @configure.in@, @config.sub@, @config.guess@:
these files support the configuration process.
<item> @install-sh@.
</itemize>

All the other directories are individual <em/projects/ of the
@fptools@ system --- for example, the Glasgow Haskell Compiler
(@ghc@), the Happy parser generator (@happy@), the @nofib@ benchmark
suite, and so on.  You can have zero or more of these.  Needless to
say, some of them are needed to build others.

The important thing to remember is that even if you want only one
project (@happy@, say), you must have a source tree whose root
directory contains @Makefile@, @mk/@, @configure.in@, and the
project(s) you want (@happy/@ in this case).  You cannot get by with
just the @happy/@ directory.

<sect1>Build trees
<nidx/build trees/
<nidx/link trees, for building/
<p>

While you can build a system in the source tree, we don't recommend it.
We often want to build multiple versions of our software
for different architectures, or with different options (e.g. profiling).
It's very desirable to share a single copy of the source code among
all these builds.

So for every source tree we have zero or more <em/build trees/.  Each
build tree is initially an exact copy of the source tree, except that
each file is a symbolic link to the source file, rather than being a
copy of the source file.  There are ``standard'' Unix utilities that
make such copies, so standard that they go by different names:
@lndir@<ncdx/lndir/, @mkshadowdir@<ncdx/mkshadowdir/ are two (If you
don't have either, the source distribution includes sources for the
@X11@ @lndir@ --- check out @fptools/glafp-utils/lndir@ ).

The build tree does not need to be anywhere near the source tree in
the file system.  Indeed, one advantage of separating the build tree
from the source is that the build tree can be placed in a
non-backed-up partition, saving your systems support people from
backing up untold megabytes of easily-regenerated, and
rapidly-changing, gubbins.  The golden rule is that (with a single
exception -- Section~<ref id="sec:build-config" name="Build
Configuration"> <em/absolutely everything in the build tree is either
a symbolic link to the source tree, or else is mechanically
generated/.  It should be perfectly OK for your build tree to vanish
overnight; an hour or two compiling and you're on the road again.

You need to be a bit careful, though, that any new files you create
(if you do any development work) are in the source tree, not a build tree!

Remember, that the source files in the build tree are <em/symbolic
links/ to the files in the source tree.  (The build tree soon
accumulates lots of built files like @Foo.o@, as well.)  You
can <em/delete/ a source file from the build tree without affecting
the source tree (though it's an odd thing to do).  On the other hand,
if you <em/edit/ a source file from the build tree, you'll edit the
source-tree file directly.  (You can set up Emacs so that if you edit
a source file from the build tree, Emacs will silently create an
edited copy of the source file in the build tree, leaving the source
file unchanged; but the danger is that you think you've edited the
source file whereas actually all you've done is edit the build-tree
copy.  More commonly you do want to edit the source file.)

Like the source tree, the top level of your build tree must be (a
linked copy of) the root directory of the @fptools@ suite.  Inside
Makefiles, the root of your build tree is called
@$(FPTOOLS_TOP)@<ncdx/FPTOOLS_TOP/.  In the rest of this document path
names are relative to @$(FPTOOLS_TOP)@ unless otherwise stated.  For
example, the file @ghc/mk/target.mk@ is actually
@$(FPTOOLS_TOP)/ghc/mk/target.mk@.


<sect1>Getting the build you want
<label id="sec:build-config">
<p>

When you build @fptools@ you will be compiling code on a particular
<em/host platform/, to run on a particular <em/target platform/
(usually the same as the host platform)<nidx>platform</nidx>.  The
difficulty is that there are minor differences between different
platforms; minor, but enough that the code needs to be a bit different
for each.  There are some big differences too: for a different
architecture we need to build GHC with a different native-code
generator.

There are also knobs you can turn to control how the @fptools@
software is built.  For example, you might want to build GHC optimised
(so that it runs fast) or unoptimised (so that you can compile it fast
after you've modified it.  Or, you might want to compile it with
debugging on (so that extra consistency-checking code gets included)
or off.  And so on.

All of this stuff is called the <em/configuration/ of your build.
You set the configuration using an exciting three-step process.
<descrip>

<tag>Step 1: get ready for configuration.</tag> Change directory to
@$(FPTOOLS_TOP)@ and issue the command @autoconf@<ncdx/autoconf/ (with
no arguments). This GNU program converts @$(FPTOOLS_TOP)/configure.in@
to a shell script called @$(FPTOOLS_TOP)/configure@.

Both these steps are completely platform-independent; they just mean
that the human-written file (@configure.in@) can be short, although
the resulting shell script, @configure@, and @mk/config.h.in@, are
long.

In case you don't have @autoconf@ we distribute the results,
@configure@, and @mk/config.h.in@, with the source distribution.  They
aren't kept in the repository, though.

<tag>Step 2: system configuration.</tag>
Runs the newly-created @configure@ script, thus:
<tscreen><verb>
  ./configure
</verb></tscreen>
@configure@'s mission is to scurry round your computer working out
what architecture it has, what operating system, whether it has the
@vfork@ system call, where @yacc@ is kept, whether @gcc@ is available,
where various obscure @#include@ files are, whether it's a leap year,
and what the systems manager had for lunch.  It communicates these
snippets of information in two ways:

<itemize>

<item> It translates @mk/config.mk.in@<ncdx/config.mk.in/ to
@mk/config.mk@<ncdx/config.mk/, substituting for things between
``@@@@@@@@}'' brackets.  So, ``@@HaveGcc@@'' will be replaced by
``@YES@'' or ``@NO@'' depending on what @configure@ finds.
@mk/config.mk@ is included by every Makefile (directly or indirectly),
so the configuration information is thereby communicated to all
Makefiles.

<item> It translates @mk/config.h.in@<ncdx/config.h.in/ to
@mk/config.h@<ncdx/config.h/.  The latter is @#include@d by various C
programs, which can thereby make use of configuration information.

</itemize>

@configure@ caches the results of its run in @config.cache@.  Quite
often you don't want that; you're running @configure@ a second time
because something has changed.  In that case, simply delete
@config.cache@.

<tag>Step 3: build configuration.</tag>

 Next, you say how this build of @fptools@ is to differ from the
standard defaults by creating a new file @mk/build.mk@<ncdx/build.mk/
<em/in the build tree/.  This file is the one and only file you edit
in the build tree, precisely because it says how this build differs
from the source.  (Just in case your build tree does die, you might
want to keep a private directory of @build.mk@ files, and use a
symbolic link in each build tree to point to the appropriate one.)  So
@mk/build.mk@ never exists in the source tree --- you create one in
each build tree from the template.  We'll discuss what to put in it
shortly.  

</descrip>