@c Copyright (C) 1988-2002 Free Software Foundation, Inc.
@c For copying conditions, see the file gpc.texi.
@c This file is part of the GPC Manual.
@c
@c Authors: J.J. van der Heijden <j.j.vanderheijden@student.utwente.nl>
@c          Peter Gerwinski <peter@gerwinski.de>
@c          Frank Heckenbach <frank@pascal.gnu.de>
@c
@c Last modification: 2002-05-10 (file mostly up to date -- `make bootstrap' missing etc.)

@include macros.texi

@ifclear INSTALLONLY
@node Installation
@chapter How to download, compile and install GNU Pascal.
@cindex installing GNU Pascal
@end ifclear

@ifset INSTALLONLY
@include version.texi
@c Note: The following line gets inserted into the destination file,
@c       it does not apply to this Texinfo file!
This file was generated automatically from install.texi.@*
@sc{DO NOT CHANGE THIS FILE MANUALLY!}

@settitle GNU Pascal Installation Guide
@node Top
@chapter Installing GNU Pascal
@end ifset

@menu
* Download::              Where and what to download
* Binary Distributions::  How to install a binary distribution
* Compiling GPC::         How to compile GPC
* Compilation Notes::     Compilation notes for specific platforms
* Cross-Compilers::       Building and Installing a cross-compiler
* Crossbuilding::         Crossbuilding a compiler
@end menu

@iftex
This chapter covers:

@itemize @bullet
@item Downloading GPC sources or binaries
@item Installation instructions for a GPC binary distribution
@item Compilation of the source distribution on a Unix system
@item Compilation notes for specific platforms
@item Building and installing a cross-compiler
@item Crossbuilding a compiler
@end itemize
@end iftex

@ifset INSTALLONLY
Contents of this file:

@itemize @bullet
@item Downloading GPC sources or binaries
@item Installation instructions for a GPC binary distribution
@item Compilation of the source distribution on a Unix system
@item Compilation notes for specific platforms
@item Building and installing a cross-compiler
@item Crossbuilding a compiler
@item Getting help
@end itemize
@end ifset


@c -------------------------------------------------------------------------


@node Download
@section Where and what to download
@cindex download
@cindex HTTP
@cindex WWW
@cindex web site

The master server for GNU Pascal is
@example
@uref{http://www.gnu-pascal.de}
@end example
Official and beta releases of the compiler with sources and binaries
for many platforms as well as other GNU Pascal related files can be
found there.

You can find binary distributions for many platforms in the subdirectory
@file{binary}. The archive files are named
@file{gpc-@var{version}.@var{platform}.@var{extension}} -- for example
@samp{gpc-2.1.alpha-unknown-linux-gnu.tar.gz} for GPC version 2.1 on an
Alpha workstation running the Linux kernel with GNU C Library, or
@samp{gpc-20000616.i586-pc-djgppv201.zip} for GPC version 20000616 on an
i586 PC running DOS with DJGPP version 2.01.

After you have downloaded the correct archive file for your
platform, please read the installation notes on how to install such
a binary distribution.

If you are running Dos or MS Windows, you will need additional tools
-- see
@ifset html
@localuref{#WhatElse,``What else to download and where''}
@end ifset
@ifclear html
``What else to download and where''
@end ifclear
below.

@subheading Current snapshots

GNU Pascal is subject to steady development. You can download the
current snapshot (source only, use at your own risk) from:

@example
@c @ifset html
@c @@@@@@ pdftex can't handle this (even though this part is skipped for PDF output!)
@c @uref{http://www.gnu-pascal.de/current/gpc-@value{GPCVersion}.tar.gz}
@c @end ifset
@c @ifclear html
@uref{http://www.gnu-pascal.de/current/}
@c @end ifclear
@end example

@c @cindex CVS
@c @noindent or via anonymous CVS from:
@c
@c @c OK smallexample (for check-doc)
@c @smallexample
@c CVS root:
@c   :pserver:anonymous@@agnes.dida.physik.uni-essen.de:/usr/local/cvsroot
@c Password:
@c   anonymous
@c Command:
@c   checkout gpc
@c @end smallexample
@c
@c If you haven't used CVS yet, here's what to do:
@c
@c Make sure you have the @file{cvs} executable. If not, you can get
@c its source from a GNU mirror or binaries for various platforms
@c (Linux @file{.rpm} or @file{.deb}, CygWin archives, etc.) from the
@c usual places.
@c
@c Execute once the following command:
@c
@c @c OK smallexample (for check-doc)
@c @smallexample
@c @t{cvs -d \}
@c @t{  :pserver:anonymous@@agnes.dida.physik.uni-essen.de:/usr/local/cvsroot login}
@c @end smallexample
@c
@c Create a directory where you want to store the GPC sources.
@c
@c Each time you want to get/update your copy of GPC, change to that
@c directory and execute the following command. The first time, it will
@c take a while to get all the GPC sources. Subsequent invocations will
@c only transmit changes and therefore usually be quite fast.
@c
@c @c OK smallexample (for check-doc)
@c @smallexample
@c @t{cvs -z9 -d \}
@c @t{  :pserver:anonymous@@agnes.dida.physik.uni-essen.de:/usr/local/cvsroot \}
@c @t{  checkout gpc}
@c @end smallexample
@c
@c (You may want to store this last command in a script or as an alias
@c so you can invoke it more easily.)
@c
@c Please read the installation notes on how to compile the source from
@c a distribution or a CVS checkout.

@anch{WhatElse}@c
@subheading What else to download and where

When you are using GNU Pascal on a DOS system, you will need either
the DJGPP or the EMX development environment (see below). On an OS/2
system, you will need EMX. On an MS Windows 95/98/NT system you will
need either the CygWin or the mingw32 environment.

GNU Pascal uses the compiler back-end from the GNU Compiler
Collection, GNU CC or GCC. If you want to compile GPC, you will need
the source of GCC as well as the source of GPC itself. From the same
place as GPC, please download GCC @file{@value{GCCVersion}}. (It is
also available from any GNU mirror; see
@uref{http://www.gnu.org/software/gcc/}.)

@anch{libs}@c
@subheading Libraries

For some of GPC's units, you will need some standard libraries. In
particular:

@c @group
@multitable {xxxxxxxxxxxxxx}     {xxxxxxxxxxxxxxxxxxx}     {xxxxxxxxxxxxxxxxxxxxxxxxxx}
@item     @b{Unit}        @tab @b{Platform}         @tab @b{Library}
@item     @t{CRT}         @tab @t{Unix/terminal}    @tab @t{ncurses >= 5.0} (1), (2)
@item     @t{CRT}         @tab @t{Unix/X11}         @tab @t{PDCurses} (2)
@item     @t{CRT}         @tab @t{Dos, MS-Windows}  @tab @t{PDCurses} (3)
@item     @t{GMP}         @tab @t{any}              @tab @t{gmp}
@item     @t{RegEx}       @tab @t{any}              @tab @t{rx}
@item     (debugging)     @tab @t{Unix, MS-Windows} @tab @t{ElectricFence} (4)
@end multitable
@c @end group

Notes:

(1) ncurses version 5.0 or newer is strongly recommended because
older versions contain a bug that severely affects CRT programs.

(2) You can install both ncurses and PDCurses on a Unix system, and
choose at compile time whether to generate a terminal or X11 version
of your program.

(3) ncurses also runs under MS-Windows with CygWin (not mingw32,
however), but doesn't appear to behave much differently from
PDCurses on that platform.

(4) ElectricFence is not used by any unit, but can be used for
debugging memory allocation bugs by simply linking it (see the
accompanying documentation).

You can find those libraries on many places on the Net. Also, many
GNU/Linux distributions, DJGPP mirrors and other OS distributions
already contain some of the libraries. In any case, you can find the
sources of the libraries (sometimes together with patches that you
should apply before building if you choose to build from the
sources) and binaries for some platforms in

@example
@uref{http://www.gnu-pascal.de/libs/}
@end example

@anch{DJGPP}@c
@subheading DJGPP

@uref{http://www.delorie.com/djgpp/,DJGPP} is available from any
SimTel mirror in the @file{gnu/djgpp} subdirectory; for addresses
look into @uref{http://www.delorie.com/djgpp/v2faq/,the DJGPP FAQ}.
To use GNU Pascal you need at least

@itemize @minus
@item the C library, @samp{v2/djdev201.zip}, and
@item @samp{binutils} (assembler, etc.), @file{v2gnu/bnu270b.zip}.
@end itemize

We also recommend you to get:

@itemize @minus
@item the @samp{make} utility, @file{v2gnu/mak375b.zip}
@item the GNU debugger, @file{v2gnu/gdb416b.zip}
@item the DJGPP FAQ, @file{v2faq/faq211b.zip}
@item the GRX graphics library, @uref{http://www.gnu.de/software/GRX/}
@item PENG, @uref{http://fjf.gnu.de/peng/}, an integrated
development environment, similar to BP's one, written in GNU Pascal,
or
@item RHIDE, @file{v2app/rhide.zip}, another integrated development
environment.
@end itemize

@anch{EMX}@c
@subheading EMX

EMX is an environment for creating 32-bit applications for DOS and OS/2.
It is available from:

@example
@uref{http://www.leo.org/pub/comp/os/os2/leo/gnu/emx+gcc/index.html}
@end example

To develop EMX programs with GNU Pascal you need at least

@itemize @minus
@item the EMX runtime package, @file{emxrt.zip},
@item the EMX development system, @file{emxdev*.zip}, and
@item the GNU development tools, @file{gnudev*.zip}.
@end itemize

If your DOS box has DPMI (it does if you are using MS Windows or OS/2)
you will also need RSX, available from the same sites as EMX in the
subdirectory @file{rsxnt}.

The GNU development tools contain the GNU C compiler which is in fact
not needed to use GNU Pascal. However, the C library @emph{is} needed.

@anch{CygWin}@c
@subheading CygWin
@cindex MS Windows 95/98/NT
@cindex Windows 95/98/NT, MS

CygWin is an environment which implements a POSIX layer under MS
Windows, giving it large parts of the functionality of Unix. CygWin
contains development tools such as an assembler, a linker,
etc.@: GPC needs for operation. More information about CygWin can be
found at
@example
@uref{http://cygwin.com}
@end example

@anch{mingw32}@c
@subheading mingw32
@cindex MS Windows 95/98/NT
@cindex Windows 95/98/NT, MS

The Minimalists' GNU Win32 environment, mingw32, allows a large
number of Unix programs -- including GPC and GCC -- to run under MS
Windows 95/98/NT using native MS libraries. mingw32 ressources can
be found at
@example
@uref{http://www.mingw.org}
@end example


@c -------------------------------------------------------------------------


@node Binary Distributions
@section Installation instructions for a GPC binary distribution
@cindex binary distributions, installing
@cindex installing binary distributions

To install a binary distribution, @code{cd} to the root directory and
unpack the archive while preserving the stored directory structure. Under
a Unix compatible system with GNU @code{tar} installed, the following
(performed as @samp{root}) will do the job:

@example
# cd /
# tar xzf @var{archive}.tar.gz
@end example

If you are using a @samp{tar} utility other than GNU @code{tar}, it
might be necessary to do the above in an explicit pipe:

@example
# cd /
# gzip -c -d @var{archive}.tar.gz | tar xf -
@end example

If you want to install a GPC binary distribution in another directory
than it was prepared for (for example, if you do not have root access
to the computer and want to install GPC somewhere under your home
directory), you can do the following:

@itemize @minus
@item
Unpack the archive file in a directory of your choice (see above).
@item
@samp{cd} to the ``prefix''
directory of the distribution (for instance @file{usr/local}).
@item
Run the script @code{install-gpc-binary}, available from
@uref{http://www.gnu-pascal.de/current/binary/}.
@item
Follow the instructions in the script.
@end itemize

To install a ZIP archive under DOS with @samp{PKunzip}, @samp{cd} the
the appropriate directory (usually @samp{\} for EMX, @samp{\DJGPP} for
DJGPP), then call @samp{PKunzip} with the @samp{-d} option:

@example
C:\> cd djgpp
C:\DJGPP> pkunzip -d @var{archive}.zip
@end example

where @file{@var{archive}.zip} is the name of the distribution file.

For DJGPP you must edit your @file{djgpp.env} in the
@file{DJGPP} directory to complete the installation: Please copy
the entries from @samp{[gcc]} to create a new @samp{[gpc]}
section. The result may look as follows:

@example
[gcc]
COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin
LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib

[gpc]
COMPILER_PATH=%/>;COMPILER_PATH%%DJDIR%/bin
LIBRARY_PATH=%/>;LIBRARY_PATH%%DJDIR%/lib
@end example

If you are using the DJGPP version of GPC but do not have a @file{DJGPP}
directory, please download and install DJGPP
@ifset INSTALLONLY
(see above).
@end ifset
@ifclear INSTALLONLY
(@pxref{Download}).
@end ifclear

Binary distributions include @file{libgcc.a} and @file{specs}, files that
are normally part of GCC. If you have GCC installed, they will be replaced
unless you manually install the archive.


@c -------------------------------------------------------------------------


@node Compiling GPC
@section Compiling GPC
@cindex source distributions, installing
@cindex installing source distributions

The preferred way to distribute GNU software is distribution of
the source code. However, it can be a non-trivial exercise to
build GNU Pascal on some non-Unix systems, so we also provide
ready-to-run binaries for a number of platforms. (See
@ifset INSTALLONLY
above
@end ifset
@ifclear INSTALLONLY
@ref{Binary Distributions}
@end ifclear
for how to install a binary distribution.)

GPC is based on the GNU Compiler Collection, GNU CC or GCC. You will
need the GCC sources to build it. It must be the same version as the
one GPC is implemented with -- @code{@value{GCCVersion}} as of this
writing. Although you need GCC to build the GNU Pascal compiler, you
don't need GCC to compile Pascal programs once GNU Pascal is
installed. (However, using certain libraries will require compiling
C wrappers, so it is a good idea to install the C compiler as well.)

Because GNU Pascal shares its back-end with GCC, it should run on any
system supported by GCC. A full list of platforms supported by GCC can
be found in
@ifset INSTALLONLY
the GCC installation instructions.
@end ifset
@ifclear INSTALLONLY
@ref{Installation, the GCC installation
instructions, Chapter 4, gcc, ``Using and Porting GNU CC''}.
@end ifclear

The GCC source can be obtained from any mirror of the GNU FTP
site, @uref{ftp://ftp.gnu.org/gnu/gcc/}. The ``core''
distribution is sufficient for GPC.

Here is the generic procedure for installing GNU Pascal on a Unix
system. See
@ifset INSTALLONLY
below
@end ifset
@ifclear INSTALLONLY
@ref{Compilation Notes}
@end ifclear
for extra information needed to install GPC on DOS-like platforms.

@enumerate

@item
Checking the prerequisites

Make sure that GNU make is installed. (In the following, we will
simply speak of @samp{make} when invoking GNU make; you might need
to call @samp{gmake} instead.)

For extracting the example programs from the documentation to the
@file{doc/docdemos} directory a non-crippled @samp{sed} is needed.
GNU sed is known to work.

@c @cindex CVS
@c If you have checked out the GPC source from CVS, you will have to
@c rebuild most derived files, so you will need additional tools:
@c @samp{bison}, @samp{flex}, @samp{makeinfo}, @samp{gperf}, and
@c @samp{autoconf}. Make sure that these are installed.

If you want to build the GPC WWW pages you will also need:
@samp{texi2html} version 1.61 (older versions are missing some
needed features; newer versions suffer from a bug), @samp{texi2dvi},
@TeX{}, @samp{gzip}, @samp{dvips}, @samp{dviselect}, and
@samp{dviconcat}.

If you run into trouble during the installation process, please check
whether you are using outdated versions of the required utilities and
upgrade if necessary.

The GNU versions of the packages above are available from
@uref{ftp://ftp.gnu.org,the GNU FTP server} or any of its mirrors.
Package @var{package} is usually located in the directory
@file{gnu/@var{package}}.

@item
Unpacking the source

From a directory of your choice (e.g.@: @file{/home/fred}), unpack the
GCC and GNU Pascal source distributions. This will create separate
subdirectories for GCC and GPC. Let us assume @file{gcc-2.95.1} and
@file{gpc-20000535} in this example.
@example
% cd /home/fred
% gzip -c -d gcc-core-2.95.1.tar.gz | tar xf -
% gzip -c -d gpc-20000535.tar.gz | tar xf -
@end example

@samp{cd} to the GPC directory and move the contents (a subdirectory
@file{p}) to the subdirectory @file{gcc} of the GCC directory:

@example
% cd /home/fred/gpc-20000535
% mv p /home/fred/gcc-2.95.1/gcc/
@end example

It is recommended, though not required, to use a separate directory for
building the compiler, rather than compiling in the source directory. In
this example, let us create @file{/home/fred/gpc-build} for this
purpose:

@example
% mkdir /home/fred/gpc-build
@end example

If you use a separate directory, you do not need to write into the GCC
source directory once you have patched the GCC source (see below), and
can build GPC for more than one platform from the same source tree.

In case you are re-using a directory where you have already built GCC
and/or GPC for a different target machine, do @samp{make distclean} to
delete all files that might be invalid. One of the files this deletes is
@file{Makefile}; if @samp{make distclean} complains that @file{Makefile}
does not exist, it probably means that the directory is already suitably
clean.

@item
Configuring and building GCC

GNU Pascal is automatically configured with GCC. Configuration of GCC is
treated in depth in
@ifset INSTALLONLY
the GCC installation instructions. The
@c                                 ^^^
@c Avoid additional space after the dot in the ASCII representation.
@c
@end ifset
@ifclear INSTALLONLY
@ref{Installation, the GCC installation
instructions, Chapter 4, gcc, ``Using and Porting GNU CC''}. The
@end ifclear
normal procedure is as follows:

@samp{cd} to the GPC build directory. From there, run the
@samp{configure} script in the GCC source directory:

@example
% cd /home/fred/gpc-build
% /home/fred/gcc-2.95.1/configure --enable-languages=pascal
@end example

This creates all the necessary config files, links and Makefile in the
GCC object directory.

Note 1: The configuration will prompt you for patching the GCC source
for GPC support, so you need write access to that directory. All changes
to GCC are surrounded by @samp{#ifdef GPC @dots{} #endif}, so they
should not interfere when you build a C compiler from this source tree.

Note 2: The @samp{--enable-languages=pascal} option means that we only
want to build the Pascal compiler and not, for instance, the C++
compiler.

Note 3: The standard base directory for installing GCC and GPC is
@file{/usr/local}. If you want to install files to an alternate
directory @var{dir}, specify @samp{--prefix=@var{dir}} when you run
@file{configure}.

@item
Putting other GNU tools in place

Some environments require other GNU tools (such as the GNU assembler or
linker) instead of the standard system tools for GCC to work. (See the
GCC installation instructions for details.) If this is the case for your
system, install the required tools in the GPC build directory under the
names @file{as}, @file{ld}, or whatever is appropriate. This will enable
the compiler to find the proper tools for compilation of the program
@file{enquire} (a part of GCC) and to install the GNU tools to a place
where they are found by GCC but do not interfere with the standard
system tools.

Alternatively, you can do subsequent compilation using a value of the
@code{PATH} environment variable such that the necessary GNU tools come
before the standard system tools.

@item
Compiling GPC

Once you are satisfied with the configuration as determined by
@file{configure}, you can build the compiler:

@example
% make
@end example

Notice that this procedure will build the C compiler (and maybe some
other compilers) too, because that is used to compile the GPC runtime
library.

Optionally, you may supply CFLAGS, LDFLAGS or RTSFLAGS. CFLAGS is used for
compiler and RTS, RTSFLAGS are for RTS only, i.e.:@:
@samp{make CFLAGS="-O2" RTSFLAGS=-Wall}

@item
Completing the installation

When everything has been compiled, you can check the installation
process with:

@example
% make -n install
@end example

To complete the installation, run the command @samp{make install}. You
need write access to the target directories (@file{/usr/local/bin},
@file{/usr/local/lib}, @file{/usr/local/info}, @file{/usr/local/doc},
and @file{/usr/local/man} in this example), so this is usually done as
@samp{root}:

@example
% su -c "make install"
@end example

If you want to install @emph{only} the Pascal compiler (for example if
you already have the correct version of GCC installed), @samp{cd} to the
@samp{gcc} subdirectory of the build directory (e.g.@:
@file{/home/fred/gpc-build/gcc}) and run @samp{make pascal.install}. This
installation process does @strong{not} overwrite existing copies of
@file{libgcc.a} or @file{specs}, should they exist.

There is a (partial) translation of the GPC manual into Croatian
available now. It is not installed by default. If you want to
install it, do a @samp{pascal.install-hr} in the @samp{gcc}
directory. This will install the manpage @file{gpc-hr.1} and the
info documentation @file{gpc-hr.info*}. Other formats like PS, PDF
and HTML can be built manually (it's also easy to add appropriate
make targets for them when needed).

Also from the @samp{gcc} subdirectory you can do some more
``exotic'' builds. For instance, you can build the GPC WWW pages by
typing @samp{make pascal.html} or a binary distribution by typing
@samp{make pascal.bindist}. See the @file{Makefile} in that
directory for more examples.
@end enumerate


@c -------------------------------------------------------------------------


@node Compilation Notes
@section Compilation notes for specific platforms
@cindex Compilation notes for specific platforms
@menu
* MS-DOS with DJGPP::        The DJGPP port of GNU compilers to MS-DOS.
* MS-DOS or OS/2 with EMX::  The EMX port of GNU compilers to MS-DOS and OS/2.
* MS Windows 95/98/NT::      Installation on a Windows 95/98/NT system.
@end menu


@c -------------------------------------------------------------------------


@node MS-DOS with DJGPP
@subsection MS-DOS with DJGPP
@cindex djgpp
@cindex DOS, MS-
@cindex MS-DOS

The only compiler that is capable of compiling the GNU Compiler
Collection (GNU CC or GCC) under MS-DOS is GCC itself. In order to
compile GPC or GCC for MS-DOS with DJGPP you will therefore need
either a working copy of DJGPP installed, or you will have to
cross-build from a non-MS-DOS system.

Building GPC under MS-DOS with DJGPP follows the same scheme as building
GPC under a Unix-like system: Place the @file{p} subdirectory in the
@file{gcc} directory and follow the instructions for compiling GCC. This
requires @samp{bash} and many other tools installed, and you must be
very careful at many places to circumvent the limitations of the DOS
platform.

Our preferred way to build GPC for DJGPP is to cross-build it from a
Unix-like platform -- which is much easier. For instructions, see
@ifset INSTALLONLY
``Cross-compilers'' and ``Crossbuilding'' below.
@end ifset
@ifclear INSTALLONLY
@ref{Cross-Compilers} and @ref{Crossbuilding}.
@end ifclear


@c -------------------------------------------------------------------------


@node MS-DOS or OS/2 with EMX
@subsection MS-DOS or OS/2 with EMX
@cindex EMX
@cindex DOS, MS-
@cindex MS-DOS
@cindex OS/2

EMX is a free 32-bit DOS extender which adds some properties of Unix to
MS-compatible DOS and IBM's OS/2 operating systems.

As of this writing, we are not aware of current versions of GCC for EMX,
and EMX support in GPC has not been maintained. Please contact us if you
know about recent development in EMX and are interested in continuing
EMX support in GPC.


@c -------------------------------------------------------------------------


@node MS Windows 95/98/NT
@subsection MS Windows 95/98/NT
@cindex Windows 95/98/NT, MS
@cindex MS Windows 95/98/NT

There are two ports of the GNU development tools to MS Windows
95/98/NT: CygWin and mingw32.

The CygWin environment implements a POSIX layer under MS Windows,
giving it large parts of the functionality of Unix. Thus, compiling
GCC and GPC under the CygWin environment can be done following the
instructions for compiling it under a Unix-like system
@ifset INSTALLONLY
(see above).
@end ifset
@ifclear INSTALLONLY
(see @ref{Compiling GPC}).
@end ifclear

The Minimalists' GNU Win32 environment, mingw32, uses the native
@file{crtdll.dll} library of MS Windows. It is much smaller than
CygWin, but it is not self-hosting and must be crossbuilt from
another system
@ifset INSTALLONLY
(see below).
@end ifset
@ifclear INSTALLONLY
(see @ref{Crossbuilding}).
@end ifclear


@c -------------------------------------------------------------------------


@node Cross-Compilers
@section Building and Installing a cross-compiler
@cindex cross-compilers

GNU Pascal can function as a cross-compiler for many machines. Information
about GNU tools in a cross-configuration can be found at
@samp{ftp://ftp.cygnus.com/pub/embedded/crossgcc/}.

Since GNU Pascal generates assembler code, you need a cross-assembler
that GNU Pascal can run, in order to produce object files. If you want
to link on other than the target machine, you need a cross-linker as
well. It is straightforward to install the GNU binutils to act as
cross-tools -- see the installation instructions of the GNU binutils for
details.

You also need header files and libraries suitable for the target machine
that you can install on the host machine. Please install them under
@file{@var{prefix}/@var{platform}/include/}, for instance
@file{/usr/local/i386-pc-msdosdjgpp/include/} for a cross-compiler from
a typical Unix-like environment to MS-DOS with DJGPP.

Configuration and compilation of the compiler can then be done using the
scripts @file{cfgpc} and @file{mkgpc} which are included in the source
distribution in the subdirectory @file{p/script}. Please call them with
the @samp{-h} option for instructions.


@c -------------------------------------------------------------------------


@node Crossbuilding
@section Crossbuilding a compiler.
@cindex crossbuilding

Using a cross-compiler to build GNU Pascal results in a compiler
binary that runs on the cross-target platform. This is called
``crossbuilding''. A possible reason why anybody would want to do
this, is when the platform on which you want to run the GNU Pascal
compiler is not self-hosting. An example is mingw32.

To crossbuild GNU Pascal, you have to install a cross-compiler for
your target first,
@ifset INSTALLONLY
see above.
@end ifset
@ifclear INSTALLONLY
see @ref{Cross-Compilers}.
@end ifclear

As when building a cross-compiler, configuration and compilation of
the compiler can be done using the scripts @file{cfgpc} and
@file{mkgpc} which are included in the source distribution in the
subdirectory @file{p/script}. Please call them with the @samp{-h}
option for instructions.

@ifset INSTALLONLY
@section Getting help

If you have further questions, please ask them on the GPC mailing
list, @email{gpc@@gnu.de}. To subscribe to the list, write an email
containing ``subscribe gpc'' in the body to
@email{majordomo@@gnu.de}. (The subject will be ignored.)

Have fun with GPC!
@end ifset
