% This file was created automatically from install.msk.
% DO NOT EDIT!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%W  install.msk               GAP documentation              Frank Celler
%W                                                     & Martin Schoenert
%W                                                     & Alexander Hulpke
%W                                                    & Burkhard Hoefling
%%
%H  @(#)$Id: install.msk,v 1.123.2.11 2005/05/09 08:19:58 gap Exp $
%%
%Y  Copyright 1997,  Lehrstuhl D fuer Mathematik,  RWTH Aachen,   Germany
%Y  (C) 1998 School Math and Comp. Sci., University of St  Andrews, Scotland
%Y  Copyright (C) 2002 The GAP Group
%%
%%  This file contains the  description of the installation procedure 
%%  for various operating systems.
%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Chapter{Installing GAP}

\index{installation}\index{options}

{\GAP} runs on a large number of different operating systems. It behaves
slightly different on each of those. This chapter describes the
behaviour of {\GAP}, the installation, and the options on some of those
operating systems.

Currently it contains instructions for *UNIX* (which includes the popular
variant *Linux*), for Apple Macintosh computers
under *OS X* (see "GAP for Macintosh OS X") as well under the ``classic''
*MacOS* (see "GAP for MacOS"), and finally 
for *Windows*.

For other systems the section "Porting GAP" gives hints how to
approach such a port.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Installation Overview}

To permit compatibility over a wide range of operating systems, the
installation of {\GAP} might differ from what you are accustomed to for you
particular operating system. In particular, there is no ``Installer''
program.

Installing the {\GAP} distribution alone takes about 150MB of disk space.
The packages add another 100MB. (These are upper limits. Unix is more
efficient in storing a large number of small files than Windows.)
You also should have at least 64MB of memory to run {\GAP}.

The installation consists of 5 easy steps:
\beginitems
-&
Get the archive(s) suitable for your system

-&
Unpack

-&
Compile (unless a binary has been provided already)

-&
Test the installation

-&
Install packages. (Some packages will only work  under Unix and OS X).
\enditems

Installation will always install the full version of {\GAP}. There is no
``Upgrade'' mode. If you are worried about losing the old version, you can
keep an existing installation of {\GAP} in another directory, it will not be
overwritten.

Section~"The Documentation" contains information about the manual, where to
find and how to print it. Section~"If Things Go Wrong" lists common problems
with the installation.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Get the Archives}

You can get archives for the {\GAP} distribution from
\URL{http://www.gap-system.org}.
As different operating systems use different archive formats, {\GAP} is
available in a variety of archives. These archives slightly differ in the
treatment of text or binary files. If you get the wrong archive you might
get error messages during compilation or not be able to look at text files
in an editor.

If you use
\beginitems
Unix&
you can use the `.tar.gz', `.tar.bz2' or `.zoo' archives.

Macintosh OS X&
you can use the `.tar.gz' or `.zoo' archives (or install the `MacOS'
version, see also~"GAP for Macintosh OS X").

MacOS&
Use the `.zoo' archive. Also make sure you get the `.sit' StuffIt archives
for the `unzoo' uncompressor.

Windows&
Use the `-win.zip' or the `.zoo' archives. 
\enditems

Now get the installation archives of the right kind, according to your
operating system. You want to get the archives:
\beginitems
`gap4r4p5'&
which contains the main {\GAP} installation

`packages4r4p5'&
which contains {\GAP} packages that provide further functionality

`unzoo'&
Only if you use the `.zoo' archives: Unix and OS X users get the source code
`unzoo.c', MacOS users get the `.sit' archive and Windows users
the `.exe' binary.

`htmie4r4p5'&
An alternative version of the HTML manual which uses a nonstandard
``symbol'' font instead of Unicode characters. If you use a webbrowser such
as `Internet Explorer' that has difficulties with rendering Unicode
correctly, you might want to replace the HTML documentation with this
version. (See section~"The Documentation".)

`xtom4r4p5'&
Contains about 80MB of further tables of marks. (You can always install this
later if the need arises.)
\enditems

Note that starting with release 4.4, the distribution archives for {\GAP}
will always contain the most recent bugfix. Thus if you install anew from
scratch, you will not need to get any bugfixes.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Unpacking}

The concrete act of unpacking will vary slightly, depending on the operating
system and the type of archive used.

\beginitems
Unix, OS X&
Under Unix or OS X unpack the archive `gap4r4p5' in whatever
place you want {\GAP} to reside. If you use the `.zoo' archive, you will
have to compile the `unzoo' program first
\begintt
cc -o unzoo -DSYS_IS_UNIX -O unzoo.c
./unzoo -x gap4r4p5.zoo
\endtt

(If you unpack the archive as `root' user under UNIX, make sure that you
issue the command `umask 022' before, to ensure that users will have
permissions to read the files.)

MacOS&
if the `.sit' archive did not extract autmatically, click it to force
extraction. You will end up with an applications,
`unzoo 4.4 PPC'. 
Now move this applications, as well as the `gap4r4p5.zoo'
archive to the Folder in which you want to install {\GAP}. Drag the archive
`gap4r4p5.zoo onto the icon of `unzoo 4.4 PPC'. You will get a
window with many lines of text output.
This process will create a folder `gap4r4' in the current folder.

Windows&
The archive must be extracted to the *main* directory of the `C:' drive. (If
you do not have permissions or sufficient free space to create directories
there, see section~"Expert Windows installation".) If you use the `.zoo'
archives we provide move `unzoo.exe' and  `gap4r4p5.zoo' in the
`C:' directory, open the `MS-DOS' (or `Command Prompt') window. (You can
find this under ``Start/Programs/Accessories''.)
In this window issue the commands
\begintt
cd c:\
unzoo -x gap4r4p5.zoo
\endtt
(It might be necessary to use upper case letters instead)

&
If you prefer to use the `-win.zip' archive use a `ZIP' extractor. Make sure
that you specify extraction to the `c:/' folder (with *no* extra directory
name -- the directory is part of the archive) to avoid extraction in a wrong
place or in a separate directory. After extraction you can start {\GAP} with
the file
\begintt
C:\GAP4R4\bin\gapw95.exe
\endtt

\enditems

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Compilation}

For the MacOS and Windows version the unpacking process will already have
put binaries in place. Under Unix and OS X you will have to compile (OS X
users please see section "GAP for Macintosh OS X" for information about
compilation) such a binary yourself.

Go into the directory `gap4r4' (which you just created by unpacking).
Issue the two commands
\begintt
./configure
make
\endtt
Both will produce a lot of text output. You should end up with a shell
script `bin/gap.sh' which you can use to start {\GAP}. (If you want, you can
copy this script later to a directory that is listed in your search path.)

OS X users please note that this script must be started from within the
`Terminal' Application. It is not possible to start {\GAP} by clicking this
script.

If you get weird error messages from these commands, make sure that
you got the Unix version of GAP (i.e. not the `-win.zip' format archive) and
that you extracted the archive on the machine on which you compile.
Also see section~"Known Problems of the Configure Process" below for further
information.

If you use OS X in the ``Panther'' release (version 10.3), you might want to
change the call to `make' to 
\begintt
make COPTS="-fast -mcpu=7450"
\endtt
on a G4 system or to
\begintt
make COPTS="-O3 -mtune=G5 -mcpu=G5 -mpowerpc64"
\endtt
on a G5 system (please note that the `-fast' compiler option causes problems
on a G5 at the time of this writing -- February 2004). Initial tests
indicate that this will give you substantially improved performance.

Unless you want to use the same installation of {\GAP} also under Windows or
MacOS (not OS X),
issue the command
\begintt
make removewin
\endtt
to delete unnecessary files that are Windows-only and only take up about 2MB
of space.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Test of the installation}

You are now at a point where you can start {\GAP} for the first time. Unix
and OS X users type 
\begintt
./bin/gap.sh
\endtt
MacOS users click the Application `GAP 4 PPC' in the `gap4r4'
directory, Windows users start
\begintt
C:\GAP4R4\bin\gapw95.exe
\endtt
{\GAP} should start up with its banner and after a little while give you a
command prompt `>'.

Try a few commands to see if the compilation succeeded.

\begintt
gap> 2 * 3 + 4;
10
gap> Factorial( 30 );
265252859812191058636308480000000
gap> m11 := Group((1,2,3,4,5,6,7,8,9,10,11),(3,7,11,8)(4,10,5,6));;
gap> Size( m11 );
7920
gap> Length( ConjugacyClasses( m11 ) );
10 
gap> Factors( 10^42 + 1 );
#I  IsPrimeInt: probably prime, but not proven: 4458192223320340849
[ 29, 101, 281, 9901, 226549, 121499449, 4458192223320340849 ]
\endtt

If you get the error message ```hmm, I cannot find lib/init.g''' you are
likely to have installed only the binary (or on Windows have not installed
{\GAP} in the root directory of the `C:' drive).

If {\GAP} starts but you get error messages for the commands you issued, the
files in the `lib' directory are likely to be corrupt or incomplete. Make
sure that you used the proper archive and that extraction proceeded without
errors.

Especially try the command line editing and history facilities, because
they are probably the most machine dependent feature of {\GAP}. Enter a
few commands and then make sure that <ctr>-`P' redisplays the last
command, that <ctr>-`E' moves the cursor to the end of the line, that
<ctr>-`B' moves the cursor back one character, and that <ctr>-`D' deletes
single characters. So, after entering the above commands, typing

<ctr>-`P' <ctr>-`E' <ctr>-`B'
<ctr>-`B' <ctr>-`B' <ctr>-`B' <ctr>-`D' `2' <return>

should give the following lines:

\beginexample
gap> Factors( 10^42 + 2 );
#I  IsPrimeInt: probably prime, but not proven: 3145594690908701990242740067
[ 2, 3, 433, 953, 128400049, 3145594690908701990242740067 ]
\endexample

If you want to run a more thorough test (this is not required), you
can read in a test script that exercises more of {\GAP}s capabilities.

\begintt
gap> Read( Filename( DirectoriesLibrary( "tst" ), "testall.g" ) );
\endtt

The test requires about 60-70MB of memory and runs about 2 minutes on a
Pentium III/1 GHz machine.
You will get a large number of lines with output about the progress
of the tests.



\begintt
test file         GAP4stones     time(msec)
-------------------------------------------
testing: /home/fac/a/hulpke/gap4/tst/zlattice.tst
zlattice.tst               0              0
testing: /home/fac/a/hulpke/gap4/tst/gaussian.tst
gaussian.tst               0             10
[ further lines deleted ]
\endtt

Windows users should note that the MS-DOS/Command Prompt user interface
provided by Microsoft might not offer history scrolling or cut and paste
with the mouse. See section~"Expert Windows Installation" for a way around
this.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Packages}

To extract the packages, extract the `package4r4p5' archive *in*
the ``gap4r4/pkg' directory by the same method used to extracted
the main archive. (If you use `unzoo' or under MacOS move both the `unzoo'
binary and the archive in the `pkg' directory and extract there.)

For packages that consist only of {\GAP} code no further installation is
necessary. Some packages however contain external binaries that will
require separate compilation. (If you use the MacOS version or Windows you
will not be able to use external binaries anyhow any you can skip the rest
of this section.) You can skip this compilation now and do it later --
{\GAP} will work fine, just the capabilities of the affected packages won't
be available.

In general, each package contains a `README' file that contains information
about the package and the necessary installation. Typically the installation
for a package consists of changing in the packages directory and issuing the
commands `./configure; make' in the packages directory. (This has to be done
separately for exery package).

If you have problems with package installations please contact the package
authors as listed in the packages `README' file.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Finish Installation and Cleanup}

Congratulations, your installation is finished. 

Once the installation is complete,
we would like to ask you to send us a short note
to \Mailto{support@gap-system.org}, telling us about the 
installation. (This is just a courtesy; we like to know how many people
are using {\GAP} and get feedback regarding difficulties (hopefully none)
that users may have had with installation.)

We also suggest that you subscribe to our `GAP Forum' mailing  list;  see
the {\GAP} web pages for details. Whenever there is  a  bug  fix  or  new
release of {\GAP} this is where it is  announced.  The  `GAP Forum'  also
deals with user questions of a general  nature;  bug  reports  and  other
problems you have while installing and/or using {\GAP} should be sent  to
\Mailto{support@gap-system.org}.

At this point you can also delete all archive files. (You
might want to keep `unzoo' if you used it in case a bugfix will be
released.)

The directories `trans', `small' and `prim' within `gap4r4'
contain data libraries. If you are short of disk space you can erase some of
them. Similarly, you can erase and any of the {\GAP} package directories in
`pkg' that you have decided you don't need, but then of course you will not
be able to access these data or packages. (You should do this only if you
have diskspace problems as you might find out later that you need certain
packages.)

If you are new to {\GAP}, you might want to read through the following two
sections for information about the documentation.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{The Documentation}

The {\GAP} manual is  distributed  in  various  ``books''.  The  standard
distribution contains four of them (as well as  a  comprehensive  index).
{\GAP}  packages  (see  Chapter~"GAP  Packages"  and,   in   particular,
Section~"Loading a GAP Package") provide  their  own  documentation  in
their own `doc' directories.

All documentation will be available automatically  for  the  online  help
(see Section~"Tut:Help" in the Tutorial and Chapter~"The Help System"  in
this manual for more details).

There also  is (if  installed) an  HTML version  of some  books that  can be
viewed with an  HTML browser, see~"Changing the Help Viewer".  Some of these
use  *unicode  characters*  for  mathematical  formulae.  If your browser
is not able to display these (older versions of `Internet Explorer' do not),
get the `htmie4r4p5' archive which provides math symbols in a
different encoding. (`Mozilla', `Konqueror' and `Safari' all support unicode
characters.)

The manual is also available in `pdf' format.
In the full UNIX
distribution (`gap4r4p5.zoo') these files are included in the
directory
`gap4r4/doc'  in the
subdirectories  `tut' (a  beginner{\pif}s  tutorial),  `ref' (the  reference
manual),  `prg' (programmer{\pif}s  tutorial), `ext'  (programmer{\pif}s
reference) and `new' (new material that might still change in future versions).

If  you want  to  use these manual files  with  the online  help you  may
check (or  make sure)  that  your  system  provides some  additional
software  like

\beginitems

`xpdf'&
see  \URL{http://www.foolabs.com/xpdf/}

`xdvi'&
see any of the CTAN  sites/mirrors; the main site is:
\URL{http://www.ctan.org/}

&
and the mirrors are listed at:
\URL{http://www.ctan.org/tex-archive/CTAN.sites}

&
At any of the mirrors the path of the file containing the `xdvi' archive
(after the main site name) is
`tex-archive/dviware/xdvi/xdvi.tar.gz'.

`acroread'&
see \URL{http://www.adobe.com/products/acrobat/readstep.html}

\enditems

As  a complete  beginner, we  suggest  you read  the tutorial  first for  an
introduction to {\GAP} 4. Then start to use the system with extensive use of
the  online  help  system  (see  Section~"Tut:Help"  in  the  Tutorial   and
Chapter~"The Help System" in this manual).

If you  have experience with  {\GAP} 3, it might  be still worthwhile  to at
least glance  over the first  chapters of  the tutorial. You  however should
read the last  chapter of the tutorial, ``Migrating to  GAP4''. This chapter
gives a summary  of changes between {\GAP}  3 and {\GAP} 4  that will affect
the user. It also explains a ``compatibility  mode'' you may turn on to make
{\GAP} 4 behave a bit more like {\GAP} 3.

As some  of the manuals  are quite large,  you should not  immediately print
them. If  you start using  {\GAP} it can be  helpful to print  the tutorial
(and  probably the  first chapters  of the  reference manual).  There is  no
compelling reason to print the whole of the reference manual, better use the
online help which provides useful search features.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{If Things Go Wrong}

\index{problems}
\atindex{FAQ}{@FAQ}

This section lists a few common problems when installing or running {\GAP}
and their remedies. Also see the FAQ list on the {\GAP} web pages at
\URL{http://www.gap-system.org/Info/Faq/faq.html}

\beginitems
{\GAP} starts with a warning ``{`hmm, I cannot find {'}lib/init.g{'}'}''.&
You either started only the binary or did not edit the shell script/batch
file to give the correct library path. 
You must start the binary with the command line option
`-l '<path> where <path> is the path to the {\GAP} home directory. See
section~"Command Line Options" in the reference manual.

When starting, {\GAP} produces error messages about undefined variables.&
You might have a `.gaprc' file that was intended for \GAP~3 but is not
compatible with \GAP~4. See section~"The .gaprc file" in chapter~"Running
GAP" of the reference manual.

{\GAP} complains: ``{`corrupted completion file'}''.&
Some library files got changed without rebuilding the completion files.
This is often a sign that earlier a bugfix was not installed properly or
that you changed the library yourself. In the latter case,
start {\GAP} with command line option `-N' and see section~"Completion Files".

{\GAP} stops with an error message ``{`exceeded the permitted memory'}''.&
Your job got bigger than what is permitted by default (256MB). (This is a
safety feature to avoid single jobs wrecking a multi-user system.) You can
type `return;' to continue, if the error message happens repeatedly you
better start the job anew and use the command line option `-o' to set a
higher memory limit.

{\GAP} stops with an error message: ``{`cannot extend the workspace any more'}''.&
Your calculation exceeded the available memory. Most likely you asked {\GAP}
to do something which required more memory than you have (as listing all
elements of $S_{15}$ for example). You can use the command line option `-g'
(see section~"Command Line Options" in the reference manual) to display how
much memory {\GAP} uses. If this is below what your machine has available
extending the workspace is impossible.
Start {\GAP} with more memory or use the `-a' option to 
pre-allocate initially a large piece of workspace.

{\GAP} is not able to allocate memory above a certain limit&
Being a 32 bit program, {\GAP} currently is unable to use over 4GB of
memory. Since the address space also has to keep the operating system,
3GB probably are an upper limit for a {\GAP} workspace.

Depending on the operating system, it also might be necessary to compile the
{\GAP} binary statically (i.e. to include all system libraries) to avoid
collisions with system libraries located by default at an address within the
workspace. (Under Linux for example, 1GB is a typical limit.)
You can compile a static binary using `make static'.

Windows users also see below for a built-in limit.

`make' complains about not being able to find files in `cnf' or `src' which exist.&
The dates of the new files were not extracted properly (Alpha-OSF machines
are prone to this). Call
\begintt
touch * cnf/* src/*
\endtt
from the main {\GAP} directory (this ought to reset the date of all relevant
files to ``now'') and try again.

Recompilation does not actually compile changed files.&
The dates of the new files were not extracted properly. Go in the source
directory and `touch' (UNIX command to change date) the new files.

Recompilation fails or the new binary crashes.&
Call `make clean' and restart the `configure' / `make' process completely
from scratch. (It is possible that the operating system and/or compiler got
upgraded in the meantime and so the existing `.o' files cannot be used any
longer.

A calculation runs into an error ``no method found''.&
{\GAP} is not able to execute a certain operation with the given arguments.
Besides the possibility of bugs in the library this means two things: Either
{\GAP} truly is incapable of coping with this task (the objects might be
too complicated for the existing algorithms or there might be no algorithm
that can cope with the input). Another possibility is that {\GAP} does not
*know* that the objects have certain nice properties (like being finite)
which are required for the available algorithms. See
sections~"ApplicableMethod" and "KnownPropertiesOfObject".
\enditems

*Problems specific to Windows*
\beginitems
Command line editing does not work under Windows.&
The default key commands are UNIX-like. {\GAP} also tries to emulate some of
the special keys under Windows, however if the key repeat is set too high,
Windows loses parts of the codes for these keys and thus {\GAP} cannot
recognize them.
Windows98 produces the same scan code for all cursor keys. As {\GAP} does
not interface directly with the Windows machinery, there is no known way around
this problem. Use the Unix-style cursor commands.

The `^'-key or `"'-key cannot be entered.&
This is a problem if you are running a keyboard driver for some non-english
languages. These drivers catch the `^' character to produce the French
circumflex accent and do not pass it properly to {\GAP}.
No fix is known.

{\GAP} does not start or cannot expand memory&
You will have to edit a registry entry to be able to use more than 127MB of
memory. See~"Expert Windows Installation".

Cut and Paste does not work&
You might want to start {\GAP} under `rxvt' -- see~"Expert Windows Installation".
Also \URL{http://www.gap-system.org/Faq/Hardware-OS/hardware-os.html} might give
a remedy.

You get an error message about the `cygwin1.dll'&
{\GAP} comnes with a version of this dynamic library. If you have another
version installed (use ``Find''), delete the older one (and probably copy the newer one in
both places).
\enditems

\indextt{support!email address}
\atindex{bug reports!see If Things Go Wrong}%
{@bug reports!see If Things Go Wrong}
*If all these remedies fail* or you encountered a bug please send a mail to
\Mailto{support@gap-system.org}. Please give:

\beginlist%unordered
\item{$\bullet$} a (short, if possible) self-contained excerpt of a {\GAP}
session containing both input and output that illustrates your problem 
(including comments of why you think it is a bug); and

\item{$\bullet$} state the type of machine, operating system,
(compiler used, if UNIX/Linux) and version of {\GAP} (for example
``gap4r4p5, fix1'') you are using
(the line after the {\GAP}~4 banner starting:
\begintt
GAP4, Version: 4...
\endtt
when your {\GAP}~4 starts up, supplies the information required).
\endlist

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Known Problems of the Configure Process}

If `make' complains ``Do not know how to make <xyz>'' but <xyz> is an
existing file, it is likely that the dates of the files were not
extracted properly (Alpha-OSF machines are prone to this). Call
\begintt
touch * cnf/* src/*
\endtt
from the main {\GAP} directory (this ought to reset the date of all relevant
files to ``now'') and try again.

Sometimes the `configure' process does not properly figure out the 
``inline'' compiler command. If you get error messages
that complain that ``inline'' is unknown, edit the file `config.h' in the
`bin/<target>' subdirectory and replace the line
\begintt
/* #undef inline */
\endtt
by
\begintt
#define inline
\endtt
and then try to compile again.

The `configure' script respects compiler settings given in environment
variables. However such settings may conflict with the automatic
configuration process. If `configure' produces strange error messages about
not being able to run the compiler, check whether environment variables that
might affect the compilation (in particular `CC', `LD', `CFLAGS', `LDFLAGS'
and `C_INCLUDE_PATH') are set and reset them using `unsetenv'.

Some users reported problems with `make', while the GNU version `gmake'
worked. Thus if problems occur you should try `gmake' instead
if it is installed on your machine.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Problems on Particular Systems}

The highest levels of optimization of the OSF/4 C compiler `cc' on the
Compaq alpha chip make assumptions about the use of pointers which are
not valid for {\GAP}, and produce executables that can crash; `-O3'
seems to be safe, but `-O4' and `-fast' are not.

On Sun and IRIX systems which are capable of running in 32 or 64 bit
modes, it is possible to build a 64 bit version of {\GAP}, but special 
procedures are needed (and, on Suns, a compiler bug must be
circumvented). If you wish to compile on such a system, please send an
email to 
\Mailto{support@gap-system.org}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Optimization and Compiler Options}

Because of the large variety of different versions of UNIX and different
compilers it is possible that the `configure' process will not chose
best possible optimization level, but you might need to tell `make' about
it.

If you want to compile {\GAP} with further compiler options (for example
specific processor optimizations) you will have to assign them to the variable
`COPTS' as in the following example when calling `make':
\begintt
make COPTS=-option
\endtt
If there are several compiler options or if they contain spaces you might
have to enclose them by quotes to avoid depending on the shell you are
using.

The `configure' process also introduces some default compiler
options. (See the `Makefile' in the `bin' directory for details.)
You can eliminate these by assigning the variable `CFLAGS' (which contains
the default options and `COPTS') to the desired list of compiler options in
the same way as you would assign `COPTS'.

The *recommended* C compiler for {\GAP} is the GNU C compiler `gcc',
or a related compiler such as `egcs'. There are two reasons for this
recommendation: firstly we use `gcc' in {\GAP} development and so this
combination has been far more heavily tested than any other and
secondly, we have found that it generally produces code which is
faster than that produced by other compilers. 

If you do wish to use another compiler, you should remove
`config.cache' and `config.status' in the {\GAP} root directory, set
the environment variable `CC' to the name of your preferred compiler
and then rerun `configure' and `make'. You may have to experiment to
determine the best values for `CFLAGS' and/or `COPTS' as described
above. Please let us (\Mailto{support@gap-system.org}) know 
the results of your experiments.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Porting GAP}

Porting {\GAP} to a new operating system should not be very difficult.
However, {\GAP} expects some features from the operating system and the
compiler and porting {\GAP} to a system or with a compiler that do not
have those features may prove very difficult.

The design of {\GAP} makes it quite portable. {\GAP} consists of a small
kernel written in the programming language C and a large library written
in the programming language provided by the {\GAP} kernel, which is also
called {\GAP}.

Once the kernel has been ported, the library poses no additional problem,
because all those functions only need the kernel to work, they need no
additional support from the environment.

The kernel itself is separated into a large part that is largely
operating system and compiler independent, and one file that contains all
the operating system and compiler dependent functions. Usually only this
file must be modified to port {\GAP} to a new operating system.

Now let us take a look at the minimal support that {\GAP} needs from the
operating system and the machine:

You need enough main memory in your computer. The size of the
{\GAP} kernel varies between 1.5 and 2.5 MByte (depending on the machine).
The {\GAP} library additionally takes a minimum of 10MByte and the
library of functions that {\GAP} loads takes up another 1.5 MByte. So it
is clear that at least 16 MByte of main memory are required to do any
serious work with {\GAP}.

Additionally, the {\GAP} kernel needs a flat address space, that is all the
memory is available in one contiguous chunk.

Note that this implies that there is no point in trying to port {\GAP} to
plain MS-DOS running on IBM PCs and compatibles. The version of {\GAP}
for IBM PC compatibles that we provide runs on machines with the
Intel 80486, Pentium or beyond processor under 32-bit Windows.
(This is also necessary, because, as just mentioned, {\GAP} wants to view its 
memory as a large flat address space.)

Next let us turn to the requirements for the C compiler and its library.

As was already mentioned, the {\GAP} kernel is written in the C language.
We have tried to use as few features of the C language as possible.
{\GAP} has been compiled without problems with compilers that adhere to
the old definition from Kernighan and Ritchie, and with compilers that
adhere to the new definition from the ANSI-C standard.

Porting {\GAP} to another UNIX should not be hard. You need some
very basic understanding of C and UNIX.
If you plan to port {\GAP} to a non-UNIX system please contact
\Mailto{support@gap-system.org}.

The configuration script runs various tests to determine the configuration
of your system. It produces a file `bin/<architecture>/config.h' which
contains definitions according to the test results.
It might be, however, that the tests used don't produce on
your machine the results they are expected to or that further tests are
necessary. If this is the case the easiest way is to edit the `config.h'
script, remove all object files and call `make' in the `bin/<architecture>'
subdirectory. If you have to resort to changing or amending this file,
please tell us what had to be changed (mail to
\Mailto{support@gap-system.org}). If you had to add further definitions
please also tell what properties of your system these `define's represent.

If {\GAP} compiles but crashes while reading the library or during a garbage
collection with a bus error it is possible that the configuration script did
not guess the permitted pointer alignment correctly. This value is stored
in the line
\begintt
#define C_STACK_ALIGN      2
\endtt
of `config.h'. Increase the value to the next power of 2  ($\le  8$)  and
compile {\GAP} anew.

There is still a `Makefile' in the `src' directory, but it is not used by
the configuration process any longer. As a last resort you might want  to
try this file, but please still report your problems to `support'.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{GAP for Macintosh OS X}

\atindex{OSX}{@OSX}\atindex{Apple}{@Apple}\atindex{Macintosh}{@Macintosh}
OS X, the new version of the Macintosh operating system, is built on top of
a variant of Unix. Thus there are two ways to run {\GAP} under this
operating system.

The first way is simply to follow the instructions in section "GAP for
MacOS" below and to run the binary we provide in the ``Classic''
environment.

The second way is to install the Unix version of {\GAP}. 

We recommend to use this (Unix) version because you will be able to use all
features of GAP as well as all packages. However for installation you might
need a basic knowledge of Unix.
Note also that the Unix version of GAP uses Unix style text files. (These
files differ from older style macintosh text files in that lines do not
contain a trailing `CR' character. Depending on what text editor you use
you might not be able to inspect GAP library files and potentially might
run into problems with program files you create if they contain strings that
go over several lines.)

The following are a couple of notes and remarks about this:

You will need a compiler. The `gcc' C compiler is not installed by default,
but is part of the ``Developer tools'' package. This package might be in an
installer package already on your system (look at the `Installer' folder
under `Applications'), if not you can get it for free from Apple by
registering as a developer. See \URL{http://developer.apple.com} for details.
For the ``Panther'' release (10.3) of OS X, `gcc' is part of the ``XCode''
development tools which you should install.

To compile and run {\GAP} you will have to open the `Terminal' application
and type the Unix command into its window. The `Terminal' application can 
be found in the `Utilities' folder in the `Applications' folder.
{\GAP} also will run in such a window.

The next thing to note is that you should get the Unix type GAP archives,
i.e. usually the tar archive, *not* the zip archive (You won't be able to
compile the program as given in the `.zip' archive).

(If you prefer to use the `.zoo' type archive over `.tar' you can use this
as well.  However then you will need to use the Unix 
version of `unzoo', which you will need to compile first by the command
\begintt
gcc -o unzoo -DSYS_IS_UNIX -O unzoo.c
\endtt
If you use the Macintosh version of the `unzoo' extractor, the text files
will be converted to MacOS format and you will have problems with the
compilation.)

Go (using the `cd' command in the terminal window) into the directory where
you want to install {\GAP}, and copy the archives (and the unzoo program if
you want to use `zoo') in this directory. Then extract the archive by
the command
\begintt
tar zxvf gap4r4p5.tar.gz
\endtt
(respectively -- if you prefer `zoo' -- 
\begintt
gcc -o unzoo -DSYS_IS_UNIX -O unzoo.c
./unzoo -x gap4r4p5.zoo
\endtt
)

Then simply follow the Unix installation instructions to compile {\GAP}. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{GAP for MacOS}

\atindex{MacOS}{@MacOS}\atindex{Apple}{@Apple}\atindex{Macintosh}{@Macintosh}
This section contains information about {\GAP} that is specific to the
port of {\GAP} for Apple Macintosh systems under MacOS (simply called
{\GAP} for MacOS below).

To run {\GAP} for MacOS you need an Apple Macintosh with a Motorola M68020, 
M68030, or M68040 processor, or a Power Macintosh. The computer must have 
at least 16MByte of (physical) memory and a harddisk. For 
serious calculations, much more may be needed. The operating system must 
be System 7 or higher. {\GAP} for MacOS runs under System X, however only
in Classic Mode. 

The section "Copyrights" describes the copyright as it
applies to the executable version that we distribute. The section
"Installation of GAP for MacOS" describes how you install {\GAP} for
MacOS. 

Please refer to the relevant sections of Chapter "Running GAP" in the 
GAP reference manual (included with the {\GAP} distribution
for an overview over the features of {\GAP} for MacOS.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Installation of GAP for MacOS}

Installing {\GAP} under MacOS is fairly easy. First, decide into which 
folder you want to install {\GAP} 4.4.5.
{\GAP} will be installed in a subfolder `gap4r4' of this folder.
You can later move {\GAP} to a different location.

Note that certain parts of the output in the examples
should only be taken as rough outline, especially file sizes and file
dates are *not* to be taken literally.

If you encounter problems please also see section~"If Things Go Wrong" of
this document.

Get the Mac-specific files described  in  "Get the  Archives",  that  is,  the
distribution   `gap4r4p5.zoo' and the    binary    archive
`unzoo4r4-PPC.sit',

How you can get those
files is described in the section "Get the Archives". Remember that the
distribution consists of binary files and that you must transmit them in
binary mode. 

If the `sit' files did not extract automatically click on them to extract
them. If even this fails use one of the standard 
decompression utilities, such as `Stuffit Expander'.

After this process you should end up with two applications,
`GAP 4 PPC' and `unzoo 4.4 PPC'. 

The latter is used to uncompress the `.zoo' archives which contain most of 
{\GAP}. The `zoo' archives we provide for {\GAP} contain comments which indicate
whether files are text or binary files. The `unzoo' we provide uses these
comments. If you use another zoo extractor you might lose this information
and end up with files that contain text but cannot be opened as text files.

The following installation example assumes that you are installing {\GAP}
in the folder `Applications' on a PowerPC Macintosh. (For a 68k Macintosh 
you should replace all references to `PPC' to ones referring to `68K'

Move the file `gap4r4p5.zoo' into the folder `Applications'
and drag it onto the icon of `unzoo 4.4 PPC'. You will get many lines of 
output in this window. 

This should have created a folder `gap4r4' in the current folder.

(You will not need the file `gap4r4p5.zoo' any
longer. If you are short of disk space you can remove it now.)

If you got not the full distribution file but several small files, extract
all of them (*except the {\GAP} packages!*) in this way.

Move  `GAP 4 PPC' and the bugfix file (if there is one) in the folder 
`gap4r4'. Drag the bugfix file onto the icon of `unzoo 4.4 PPC'
to decompress it. 

If you got any {\GAP} packages, move them into the `pkg' folder in the folder 
folder `gap4r4' extract them there, in the same way as the bugfix.

After extraction you may discard all `.zoo' files if you are short of disk 
space.

The folders `trans', `small' and `prim' contain data
libraries. If you are short of disk space you can erase some of them and
any {\GAP} package directories in the `pkg' directory that you don't need,
but then of course you will not be able to access these data and packages.
(Any {\GAP} package that has a C code component is essentially UNIX-dependent
and you may as well delete those; such packages typically describe in their
`README' files that they require `configure' and `make' to complete their
installation or have a `src' directory.)

Before you use {\GAP}, you should set up {\GAP}'s memory allocation, by 
setting appropriate values by selecting the {\GAP} application and 
`Get Info...' in the Finder's `File' menu (in order to be able to 
modify the values there, you have to do this *before* you launch {\GAP}). 

The maximum amount of workspace {\GAP} can use depends on the amount of 
memory the Finder allocates to {\GAP} when it is launched. The maximum 
amount of {\GAP} workspace is this value, minus a certain amount used 
internally by the {\GAP} application (for the PPC 
version, currently around 1.7 Megabytes, plus the size of the {\GAP} 
application if you do not use virtual memory, and 2.9 Megabytes for the 
68K version), minus any additional amount set with the `-a', `-P' or `-W'
command line options (see below).

You can find information about the amount of free {\GAP} workspace, the total
amount of available workspace, and the remaining free memory, 
by choosing `About GAP' in the `Apple' menu.

To ensure efficient operation, you should not allocate more memory to {\GAP}
than the amount of physical memory in your computer. 
If you are not using virtual memory, 
the amount may have to be considerably less (depending on your system and
the number of other applications which you may want to run at the same time).

If you notice heavy disk use during garbage collections, this is a clear 
indication that you have allocated too much memory to {\GAP}.

In order to test your installation now run the `GAP' application
by clicking on `GAP 4 PPC'.
You should get the {\GAP} banner and then the {\GAP} prompt in a window
titled `GAP log'. (The process of starting {\GAP} may take a while.)

Try a few things to see if the installation succeeded.

\begintt
gap> 2 * 3 + 4;
10
gap> Factorial( 30 );
265252859812191058636308480000000
gap> Factors( 10^42 + 1 );
[ 29, 101, 281, 9901, 226549, 121499449, 4458192223320340849 ]
gap> m11 := Group((1,2,3,4,5,6,7,8,9,10,11),(3,7,11,8)(4,10,5,6));;
gap> Size( m11 );
7920
gap> Length( ConjugacyClasses( m11 ) );
10 
\endtt

A set of test files is provided, running them all probably takes some 40
minutes on a 200 MHz PPC machine. 
This is not a necessary part of the
installation; it only serves as a confirmation that everything went
OK. The full test suite takes some time  and uses quite a bit of memory (around 70MB), so you may
wish to skip this step or run only part of the tests. This does no
harm.

Initially we must ensure that the print width of {\GAP} is 80 characters per
line which we achieve with the `SizeScreen' command (otherwise we will be
swamped with error messages).

\begintt
gap> SizeScreen([80,]);;
gap> Filename( DirectoriesLibrary("tst"), "testall.g" );
"./tst/testall.g"
gap> Read(last);
[many output lines omitted]
\endtt

The information about the manual is system independent; you can find it in
section~"The Documentation".

*A few final reminders:*

\beginlist%unordered

\item{$\bullet$}
We would appreciate after installation your sending us a short note at
\Mailto{support@gap-system.org} 
(even if you have installed {\GAP} 3 before).
Generally, we do not reply to such emails; we only use them to gain some idea
of how many people use {\GAP} and of the machines/operating systems on which
{\GAP} has been successfully installed.

\item{$\bullet$}
We also suggest that you subscribe to our `GAP Forum' mailing list; 
see the {\GAP} web pages for details. Whenever there is a bug fix or new
release of {\GAP} this is where it is announced. The `GAP Forum' also
deals with user questions of a general nature; bug reports and other
problems you have while installing and/or using {\GAP} should be sent to
\Mailto{support@gap-system.org}.

\endlist

That's all, your installation should be complete. Please refer to
Chapter "Running GAP" in the GAP reference manual for a description
of some special features and options of {\GAP} for MacOS.

We hope that you will 
enjoy using {\GAP}. Remember, if you have problems, do not hesitate to
contact us at
\Mailto{support@gap-system.org}.
See Section~"If Things Go Wrong" for what to include in a bug report.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Expert Windows installation}

This section decribes how to get a better shell for {\GAP} and how to
install {\GAP} in another directory. These tasks are slightly complicated
due to problems in the design of Windows, if you have not edited a batch
file before you might want to contact your system administrator for help.

Some users report that the `rxvt' shell (see \URL{http://www.rxvt.org})
gives a better windows environment for cut/paste etc. 

You can find a copy of this program in the `bin' subdirectory of the {\GAP}
installation. *Please note that this program is not part of the {\GAP}
distribution and that we cannot offer any support for it*.  You can start
{\GAP} under this program via the `gaprxvt.bat' script in the `bin'
subdirectory. 

(The program has been tested only under a particular version of Windows98.
It might not work under other releases. It also might be necessary to adapt
paths in the batch file.) Under `rxvt' the standard Unix XWindows
cut-and-paste operations (left mouse button cuts, middle mouse button
pastes) work. After you terminate {\GAP} a text window might stay on which
you can safely delete.

If you decide to install {\GAP} in another directory than `C:' you can do so,
but you will have to edit a batch file and use this file to start {\GAP}.

First unpack the {\GAP} distribution in the directory you want. 

Lets suppose you want {\GAP} to reside in the directory
\begintt
C:\MY PROGRAMS\GAP
\endtt
Extract {\GAP} (as described in the previous section for `C:') in this
directory. (alternatively, you can also first unpack it in 
\begintt
C:\GAP4R4
\endtt
test it there first, and afterwards move it in the desired location.)

You now will have to edit the provided batch file, that will be used to start {\GAP}.
This batch file is needed, since {\GAP} otherwise will not find its library
directories. The file sits in the `bin' directory of the {\GAP}
distribution, i.e. in our example
\begintt
C:\MY PROGRAMS\GAP\GAPGAP4R4\bin\gap.bat
\endtt
This file should contain the following *single* line (which might be broken
over in several lines in this manual as the page width is limited):
\begintt
"C:\MY PROGRAMS\GAP\GAPGAP4R4\bin\gapw95.exe" -m 14m 
  -l "C:\MY PROGRAMS\GAP\GAPGAP4R4" %1 %2 %3 %4 %5 %6 %7 %8
\endtt

You now should be able to start {\GAP} by clicking this `gap.bat' file.

If you also want to use `rxvt' you have to edit the `gaprxvt.bat' file to
take care of the changed path in two places for the {\GAP} binary as well as
for the {\GAP} library.

By default, the ``cygwin'' environment we use limits a programs workspace to
128MB of memory. To increase this limit, it is necessary to edit the
Windows registry.

*WARNING:* Editing the registry is the Windows equivalent of open heart
surgery. Do not attempt this change if you have no previous experience in
doing this. The web page
\URL{http://www.cygwin.com/cygwin-ug-net/setup-maxmem.html} gives further
details.

Before changing the entries, you might have to run {\GAP} once first to
create the appropriate registry keys.

The shell script `usemem.bat' in the `bin' directory sets a registry entry
\begintt
/HKEY_LOCAL_MACHINE/Software/Cygnus Solutions/Cygwin/heap_chunk_in_mb
\endtt
to decimal 1024. 

If you prefer to do the change by hand, open `regedit' and
go to the `Cygwin' Key listed above. Then choose `new value' and add
`heap_chunk_in_mb'. `Modify' it to contain decimal 1024.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Copyrights}

In addition to the general copyright for {\GAP} set forth in the Copyright
the following terms apply to the versions of {\GAP} for Windows and MacOS.

The executable of {\GAP} for Windows that we distribute was compiled with
the `gnuwin32' compiler of the `cygwin' package. 
This compiler can be obtained by anonymous `ftp' from a
variety of general public FTP archives. Many thanks to the Free Software
Foundation and RedHat Software for this amazing piece of work.

The GNU C compiler is

*Copyright (C) 2002 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA*

under the terms of the GNU General Public License (GPL).

The Cygwin32 API library is also covered by the GNU GPL. The executable we
provide is linked against this library (and in the process includes
GPL'd Cygwin32 glue code). This means that the executable falls under
the GPL too, which it does anyhow.

The `cygwin1.dll', `libW11.dll', `rxvt.exe' and `regtool.exe' binaries are
taken unmodified from the Cygwin distribution. They are copyright by RedHat Software
and released under the GPL. You can find more information about `cygwin' under
\URL{http://www.cygwin.com}. You also will be able to obtain the sources for `cygwin' from this place.

The system dependent part of {\GAP} for MacOS was written by Burkhard 
H{\accent127 o}fling (his email address is
\Mailto{b.hoefling@tu-bs.de}). He assigns
the copyright to the {\GAP} group. Many thanks to Burkhard for his help!
Burkhard H{\accent127 o}fling{\pif}s port was partly based on an earlier
port of {\GAP} for the Mac, 
which was done by Dave Bayer (\Mailto{dab@math.columbia.edu})
and used the 
Mac Programmers Workshop (MPW) compiler. Many thanks to Dave for his work. 
Moreover, the built-in editor is based upon the freeware text editor 
`PlainText' by Mel Park which, in turn, uses `TE32K', a `TextEdit' 
replacement by Roy Wood. It also uses `Internet Config'.

For technical reasons we do not distribute the Macintosh specific source and
project files as part of the standard archives. If you are interested in
compiling {\GAP} yourself, we are happy to provide you with the appropriate
files (contact us at \Mailto{support@gap-system.org}). The source can
be compiled with CodeWarrior Pro 5 with Apple's Universal Headers 3.3
installed.

Please contact the author
\Mailto{b.hoefling@tu-bs.de}
or \Mailto{support@gap-system.org} if you need further information.

