This is Info file ./gpc.info, produced by Makeinfo version 1.67 from
the input file ./gpc.texi.

   This file documents the use and the internals of the GNU Pascal
compiler.

   Copyright (C) 1988, 1996 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License," "Funding for
Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
included exactly as in the original, and provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License," "Funding for Free Software," and "Protect Your Freedom--Fight
`Look And Feel'", and this permission notice, may be included in
translations approved by the Free Software Foundation instead of in the
original English.


File: gpc.info,  Node: Manifesto,  Next: Purpose,  Prev: Look and Feel,  Up: Top

The GNU Manifesto
*****************

     The GNU Manifesto which appears below was written by Richard
     Stallman at the beginning of the GNU project, to ask for
     participation and support.  For the first few years, it was
     updated in minor ways to account for developments, but now it
     seems best to leave it unchanged as most people have seen it.

     Since that time, we have learned about certain common
     misunderstandings that different wording could help avoid.
     Footnotes added in 1993 help clarify these points.

     For up-to-date information about the available GNU software,
     please see the latest issue of the GNU's Bulletin.  The list is
     much too long to include here.

What's GNU?  Gnu's Not Unix!
============================

   GNU, which stands for Gnu's Not Unix, is the name for the complete
Unix-compatible software system which I am writing so that I can give it
away free to everyone who can use it.(1) Several other volunteers are
helping me.  Contributions of time, money, programs and equipment are
greatly needed.

   So far we have an Emacs text editor with Lisp for writing editor
commands, a source level debugger, a yacc-compatible parser generator,
a linker, and around 35 utilities.  A shell (command interpreter) is
nearly completed.  A new portable optimizing C compiler has compiled
itself and may be released this year.  An initial kernel exists but
many more features are needed to emulate Unix.  When the kernel and
compiler are finished, it will be possible to distribute a GNU system
suitable for program development.  We will use TeX as our text
formatter, but an nroff is being worked on.  We will use the free,
portable X window system as well.  After this we will add a portable
Common Lisp, an Empire game, a spreadsheet, and hundreds of other
things, plus on-line documentation.  We hope to supply, eventually,
everything useful that normally comes with a Unix system, and more.

   GNU will be able to run Unix programs, but will not be identical to
Unix.  We will make all improvements that are convenient, based on our
experience with other operating systems.  In particular, we plan to
have longer file names, file version numbers, a crashproof file system,
file name completion perhaps, terminal-independent display support, and
perhaps eventually a Lisp-based window system through which several
Lisp programs and ordinary Unix programs can share a screen.  Both C
and Lisp will be available as system programming languages.  We will
try to support UUCP, MIT Chaosnet, and Internet protocols for
communication.

   GNU is aimed initially at machines in the 68000/16000 class with
virtual memory, because they are the easiest machines to make it run
on.  The extra effort to make it run on smaller machines will be left
to someone who wants to use it on them.

   To avoid horrible confusion, please pronounce the `G' in the word
`GNU' when it is the name of this project.

Why I Must Write GNU
====================

   I consider that the golden rule requires that if I like a program I
must share it with other people who like it.  Software sellers want to
divide the users and conquer them, making each user agree not to share
with others.  I refuse to break solidarity with other users in this
way.  I cannot in good conscience sign a nondisclosure agreement or a
software license agreement.  For years I worked within the Artificial
Intelligence Lab to resist such tendencies and other inhospitalities,
but eventually they had gone too far: I could not remain in an
institution where such things are done for me against my will.

   So that I can continue to use computers without dishonor, I have
decided to put together a sufficient body of free software so that I
will be able to get along without any software that is not free.  I
have resigned from the AI lab to deny MIT any legal excuse to prevent
me from giving GNU away.

Why GNU Will Be Compatible with Unix
====================================

   Unix is not my ideal system, but it is not too bad.  The essential
features of Unix seem to be good ones, and I think I can fill in what
Unix lacks without spoiling them.  And a system compatible with Unix
would be convenient for many other people to adopt.

How GNU Will Be Available
=========================

   GNU is not in the public domain.  Everyone will be permitted to
modify and redistribute GNU, but no distributor will be allowed to
restrict its further redistribution.  That is to say, proprietary
modifications will not be allowed.  I want to make sure that all
versions of GNU remain free.

Why Many Other Programmers Want to Help
=======================================

   I have found many other programmers who are excited about GNU and
want to help.

   Many programmers are unhappy about the commercialization of system
software.  It may enable them to make more money, but it requires them
to feel in conflict with other programmers in general rather than feel
as comrades.  The fundamental act of friendship among programmers is the
sharing of programs; marketing arrangements now typically used
essentially forbid programmers to treat others as friends.  The
purchaser of software must choose between friendship and obeying the
law.  Naturally, many decide that friendship is more important.  But
those who believe in law often do not feel at ease with either choice.
They become cynical and think that programming is just a way of making
money.

   By working on and using GNU rather than proprietary programs, we can
be hospitable to everyone and obey the law.  In addition, GNU serves as
an example to inspire and a banner to rally others to join us in
sharing.  This can give us a feeling of harmony which is impossible if
we use software that is not free.  For about half the programmers I
talk to, this is an important happiness that money cannot replace.

How You Can Contribute
======================

   I am asking computer manufacturers for donations of machines and
money.  I'm asking individuals for donations of programs and work.

   One consequence you can expect if you donate machines is that GNU
will run on them at an early date.  The machines should be complete,
ready to use systems, approved for use in a residential area, and not
in need of sophisticated cooling or power.

   I have found very many programmers eager to contribute part-time
work for GNU.  For most projects, such part-time distributed work would
be very hard to coordinate; the independently-written parts would not
work together.  But for the particular task of replacing Unix, this
problem is absent.  A complete Unix system contains hundreds of utility
programs, each of which is documented separately.  Most interface
specifications are fixed by Unix compatibility.  If each contributor
can write a compatible replacement for a single Unix utility, and make
it work properly in place of the original on a Unix system, then these
utilities will work right when put together.  Even allowing for Murphy
to create a few unexpected problems, assembling these components will
be a feasible task.  (The kernel will require closer communication and
will be worked on by a small, tight group.)

   If I get donations of money, I may be able to hire a few people full
or part time.  The salary won't be high by programmers' standards, but
I'm looking for people for whom building community spirit is as
important as making money.  I view this as a way of enabling dedicated
people to devote their full energies to working on GNU by sparing them
the need to make a living in another way.

Why All Computer Users Will Benefit
===================================

   Once GNU is written, everyone will be able to obtain good system
software free, just like air.(2)

   This means much more than just saving everyone the price of a Unix
license.  It means that much wasteful duplication of system programming
effort will be avoided.  This effort can go instead into advancing the
state of the art.

   Complete system sources will be available to everyone.  As a result,
a user who needs changes in the system will always be free to make them
himself, or hire any available programmer or company to make them for
him.  Users will no longer be at the mercy of one programmer or company
which owns the sources and is in sole position to make changes.

   Schools will be able to provide a much more educational environment
by encouraging all students to study and improve the system code.
Harvard's computer lab used to have the policy that no program could be
installed on the system if its sources were not on public display, and
upheld it by actually refusing to install certain programs.  I was very
much inspired by this.

   Finally, the overhead of considering who owns the system software
and what one is or is not entitled to do with it will be lifted.

   Arrangements to make people pay for using a program, including
licensing of copies, always incur a tremendous cost to society through
the cumbersome mechanisms necessary to figure out how much (that is,
which programs) a person must pay for.  And only a police state can
force everyone to obey them.  Consider a space station where air must
be manufactured at great cost: charging each breather per liter of air
may be fair, but wearing the metered gas mask all day and all night is
intolerable even if everyone can afford to pay the air bill.  And the
TV cameras everywhere to see if you ever take the mask off are
outrageous.  It's better to support the air plant with a head tax and
chuck the masks.

   Copying all or parts of a program is as natural to a programmer as
breathing, and as productive.  It ought to be as free.

Some Easily Rebutted Objections to GNU's Goals
==============================================

     "Nobody will use it if it is free, because that means they can't
     rely on any support."

     "You have to charge for the program to pay for providing the
     support."

   If people would rather pay for GNU plus service than get GNU free
without service, a company to provide just service to people who have
obtained GNU free ought to be profitable.(3)

   We must distinguish between support in the form of real programming
work and mere handholding.  The former is something one cannot rely on
from a software vendor.  If your problem is not shared by enough
people, the vendor will tell you to get lost.

   If your business needs to be able to rely on support, the only way
is to have all the necessary sources and tools.  Then you can hire any
available person to fix your problem; you are not at the mercy of any
individual.  With Unix, the price of sources puts this out of
consideration for most businesses.  With GNU this will be easy.  It is
still possible for there to be no available competent person, but this
problem cannot be blamed on distribution arrangements.  GNU does not
eliminate all the world's problems, only some of them.

   Meanwhile, the users who know nothing about computers need
handholding: doing things for them which they could easily do
themselves but don't know how.

   Such services could be provided by companies that sell just
hand-holding and repair service.  If it is true that users would rather
spend money and get a product with service, they will also be willing
to buy the service having got the product free.  The service companies
will compete in quality and price; users will not be tied to any
particular one.  Meanwhile, those of us who don't need the service
should be able to use the program without paying for the service.

     "You cannot reach many people without advertising, and you must
     charge for the program to support that."

     "It's no use advertising a program people can get free."

   There are various forms of free or very cheap publicity that can be
used to inform numbers of computer users about something like GNU.  But
it may be true that one can reach more microcomputer users with
advertising.  If this is really so, a business which advertises the
service of copying and mailing GNU for a fee ought to be successful
enough to pay for its advertising and more.  This way, only the users
who benefit from the advertising pay for it.

   On the other hand, if many people get GNU from their friends, and
such companies don't succeed, this will show that advertising was not
really necessary to spread GNU.  Why is it that free market advocates
don't want to let the free market decide this?(4)

     "My company needs a proprietary operating system to get a
     competitive edge."

   GNU will remove operating system software from the realm of
competition.  You will not be able to get an edge in this area, but
neither will your competitors be able to get an edge over you.  You and
they will compete in other areas, while benefiting mutually in this
one.  If your business is selling an operating system, you will not
like GNU, but that's tough on you.  If your business is something else,
GNU can save you from being pushed into the expensive business of
selling operating systems.

   I would like to see GNU development supported by gifts from many
manufacturers and users, reducing the cost to each.(5)

     "Don't programmers deserve a reward for their creativity?"

   If anything deserves a reward, it is social contribution.
Creativity can be a social contribution, but only in so far as society
is free to use the results.  If programmers deserve to be rewarded for
creating innovative programs, by the same token they deserve to be
punished if they restrict the use of these programs.

     "Shouldn't a programmer be able to ask for a reward for his
     creativity?"

   There is nothing wrong with wanting pay for work, or seeking to
maximize one's income, as long as one does not use means that are
destructive.  But the means customary in the field of software today
are based on destruction.

   Extracting money from users of a program by restricting their use of
it is destructive because the restrictions reduce the amount and the
ways that the program can be used.  This reduces the amount of wealth
that humanity derives from the program.  When there is a deliberate
choice to restrict, the harmful consequences are deliberate destruction.

   The reason a good citizen does not use such destructive means to
become wealthier is that, if everyone did so, we would all become
poorer from the mutual destructiveness.  This is Kantian ethics; or,
the Golden Rule.  Since I do not like the consequences that result if
everyone hoards information, I am required to consider it wrong for one
to do so.  Specifically, the desire to be rewarded for one's creativity
does not justify depriving the world in general of all or part of that
creativity.

     "Won't programmers starve?"

   I could answer that nobody is forced to be a programmer.  Most of us
cannot manage to get any money for standing on the street and making
faces.  But we are not, as a result, condemned to spend our lives
standing on the street making faces, and starving.  We do something
else.

   But that is the wrong answer because it accepts the questioner's
implicit assumption: that without ownership of software, programmers
cannot possibly be paid a cent.  Supposedly it is all or nothing.

   The real reason programmers will not starve is that it will still be
possible for them to get paid for programming; just not paid as much as
now.

   Restricting copying is not the only basis for business in software.
It is the most common basis because it brings in the most money.  If it
were prohibited, or rejected by the customer, software business would
move to other bases of organization which are now used less often.
There are always numerous ways to organize any kind of business.

   Probably programming will not be as lucrative on the new basis as it
is now.  But that is not an argument against the change.  It is not
considered an injustice that sales clerks make the salaries that they
now do.  If programmers made the same, that would not be an injustice
either.  (In practice they would still make considerably more than
that.)

     "Don't people have a right to control how their creativity is
     used?"

   "Control over the use of one's ideas" really constitutes control over
other people's lives; and it is usually used to make their lives more
difficult.

   People who have studied the issue of intellectual property rights
carefully (such as lawyers) say that there is no intrinsic right to
intellectual property.  The kinds of supposed intellectual property
rights that the government recognizes were created by specific acts of
legislation for specific purposes.

   For example, the patent system was established to encourage
inventors to disclose the details of their inventions.  Its purpose was
to help society rather than to help inventors.  At the time, the life
span of 17 years for a patent was short compared with the rate of
advance of the state of the art.  Since patents are an issue only among
manufacturers, for whom the cost and effort of a license agreement are
small compared with setting up production, the patents often do not do
much harm.  They do not obstruct most individuals who use patented
products.

   The idea of copyright did not exist in ancient times, when authors
frequently copied other authors at length in works of non-fiction.  This
practice was useful, and is the only way many authors' works have
survived even in part.  The copyright system was created expressly for
the purpose of encouraging authorship.  In the domain for which it was
invented--books, which could be copied economically only on a printing
press--it did little harm, and did not obstruct most of the individuals
who read the books.

   All intellectual property rights are just licenses granted by society
because it was thought, rightly or wrongly, that society as a whole
would benefit by granting them.  But in any particular situation, we
have to ask: are we really better off granting such license?  What kind
of act are we licensing a person to do?

   The case of programs today is very different from that of books a
hundred years ago.  The fact that the easiest way to copy a program is
from one neighbor to another, the fact that a program has both source
code and object code which are distinct, and the fact that a program is
used rather than read and enjoyed, combine to create a situation in
which a person who enforces a copyright is harming society as a whole
both materially and spiritually; in which a person should not do so
regardless of whether the law enables him to.

     "Competition makes things get done better."

   The paradigm of competition is a race: by rewarding the winner, we
encourage everyone to run faster.  When capitalism really works this
way, it does a good job; but its defenders are wrong in assuming it
always works this way.  If the runners forget why the reward is offered
and become intent on winning, no matter how, they may find other
strategies--such as, attacking other runners.  If the runners get into
a fist fight, they will all finish late.

   Proprietary and secret software is the moral equivalent of runners
in a fist fight.  Sad to say, the only referee we've got does not seem
to object to fights; he just regulates them ("For every ten yards you
run, you can fire one shot").  He really ought to break them up, and
penalize runners for even trying to fight.

     "Won't everyone stop programming without a monetary incentive?"

   Actually, many people will program with absolutely no monetary
incentive.  Programming has an irresistible fascination for some
people, usually the people who are best at it.  There is no shortage of
professional musicians who keep at it even though they have no hope of
making a living that way.

   But really this question, though commonly asked, is not appropriate
to the situation.  Pay for programmers will not disappear, only become
less.  So the right question is, will anyone program with a reduced
monetary incentive?  My experience shows that they will.

   For more than ten years, many of the world's best programmers worked
at the Artificial Intelligence Lab for far less money than they could
have had anywhere else.  They got many kinds of non-monetary rewards:
fame and appreciation, for example.  And creativity is also fun, a
reward in itself.

   Then most of them left when offered a chance to do the same
interesting work for a lot of money.

   What the facts show is that people will program for reasons other
than riches; but if given a chance to make a lot of money as well, they
will come to expect and demand it.  Low-paying organizations do poorly
in competition with high-paying ones, but they do not have to do badly
if the high-paying ones are banned.

     "We need the programmers desperately.  If they demand that we stop
     helping our neighbors, we have to obey."

   You're never so desperate that you have to obey this sort of demand.
Remember: millions for defense, but not a cent for tribute!

     "Programmers need to make a living somehow."

   In the short run, this is true.  However, there are plenty of ways
that programmers could make a living without selling the right to use a
program.  This way is customary now because it brings programmers and
businessmen the most money, not because it is the only way to make a
living.  It is easy to find other ways if you want to find them.  Here
are a number of examples.

   A manufacturer introducing a new computer will pay for the porting of
operating systems onto the new hardware.

   The sale of teaching, hand-holding and maintenance services could
also employ programmers.

   People with new ideas could distribute programs as freeware, asking
for donations from satisfied users, or selling hand-holding services.
I have met people who are already working this way successfully.

   Users with related needs can form users' groups, and pay dues.  A
group would contract with programming companies to write programs that
the group's members would like to use.

   All sorts of development can be funded with a Software Tax:

     Suppose everyone who buys a computer has to pay x percent of the
     price as a software tax.  The government gives this to an agency
     like the NSF to spend on software development.

     But if the computer buyer makes a donation to software development
     himself, he can take a credit against the tax.  He can donate to
     the project of his own choosing--often, chosen because he hopes to
     use the results when it is done.  He can take a credit for any
     amount of donation up to the total tax he had to pay.

     The total tax rate could be decided by a vote of the payers of the
     tax, weighted according to the amount they will be taxed on.

     The consequences:

        * The computer-using community supports software development.

        * This community decides what level of support is needed.

        * Users who care which projects their share is spent on can
          choose this for themselves.

   In the long run, making programs free is a step toward the
post-scarcity world, where nobody will have to work very hard just to
make a living.  People will be free to devote themselves to activities
that are fun, such as programming, after spending the necessary ten
hours a week on required tasks such as legislation, family counseling,
robot repair and asteroid prospecting.  There will be no need to be
able to make a living from programming.

   We have already greatly reduced the amount of work that the whole
society must do for its actual productivity, but only a little of this
has translated itself into leisure for workers because much
nonproductive activity is required to accompany productive activity.
The main causes of this are bureaucracy and isometric struggles against
competition.  Free software will greatly reduce these drains in the
area of software production.  We must do this, in order for technical
gains in productivity to translate into less work for us.

   ---------- Footnotes ----------

   (1)  The wording here was careless.  The intention was that nobody
would have to pay for *permission* to use the GNU system.  But the
words don't make this clear, and people often interpret them as saying
that copies of GNU should always be distributed at little or no charge.
That was never the intent; later on, the manifesto mentions the
possibility of companies providing the service of distribution for a
profit.  Subsequently I have learned to distinguish carefully between
"free" in the sense of freedom and "free" in the sense of price.  Free
software is software that users have the freedom to distribute and
change.  Some users may obtain copies at no charge, while others pay to
obtain copies--and if the funds help support improving the software, so
much the better.  The important thing is that everyone who has a copy
has the freedom to cooperate with others in using it.

   (2)  This is another place I failed to distinguish carefully between
the two different meanings of "free".  The statement as it stands is
not false--you can get copies of GNU software at no charge, from your
friends or over the net.  But it does suggest the wrong idea.

   (3)  Several such companies now exist.

   (4)  The Free Software Foundation raises most of its funds from a
distribution service, although it is a charity rather than a company.
If *no one* chooses to obtain copies by ordering from the FSF, it will
be unable to do its work.  But this does not mean that proprietary
restrictions are justified to force every user to pay.  If a small
fraction of all the users order copies from the FSF, that is sufficient
to keep the FSF afloat.  So we ask users to choose to support us in
this way.  Have you done your part?

   (5)  A group of computer companies recently pooled funds to support
maintenance of the GNU C Compiler.


File: gpc.info,  Node: Purpose,  Next: Installation,  Prev: Manifesto,  Up: Top

The Purpose of GNU Pascal
*************************

   The purpose of the GNU Pascal project is to produce a Pascal compiler
(called GNU Pascal or GPC) which

   * combines the clarity of Pascal with powerful tools suitable for
     real-life programming,

   * supports both the Pascal standard and the Extended Pascal standard
     as defined by ISO, ANSI and IEEE. (ISO 7185:1990, ISO/IEC
     10206:1991, ANSI/IEEE 770X3.160-1989)

   * supports other Pascal standards (UCSD Pascal, Borland Pascal,
     Pascal-SC) in so far as this serves the goal of clarity and
     usability,

   * may be distributed under normal GNU license conditions

   * can generate code and run on any computer for which the GNU C
     compiler can generate code and run.

   Pascal was originally designed for teaching.  GNU Pascal provides a
smooth way to proceed to challenging programming tasks without learning
a completely different language.

   GNU Pascal compiler is part of the GNU Compiler family combining a
language independent part of the GNU Compiler with a Pascal specific
front end.

   Other compilers of the family currently include compilers for the C,
C++ and Objective C languages.


File: gpc.info,  Node: Installation,  Next: Invoking GPC,  Prev: Purpose,  Up: Top

Installing GNU Pascal
*********************

* Menu:

* compilation notes::	Configuration dependent compilation notes
* crosscompilers::	Building and Installing a crosscompiler
* binary distributions::	Installation instructions for a GPC binary distribution

   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. *Note binary distributions:: how to
install a binary distribution.

   GPC is based on GNU CC; you will need the GCC sources to build it.
It must be the same version as the one GPC is implemented with.
Although you need GCC to build the GNU Pascal compiler, you don't need
GCC to compile Pascal programs once GNU Pascal is installed. Because
GNU Pascal shares its backend with GNU CC, it should run on any system
supported by GNU CC. A full list of platforms supported by GNU CC can
be found in chapter 4 of the GCC manual, "Using and Porting GNU CC"

   Here is the generic procedure for installing GNU Pascal on a Unix
system.  *Note compilation notes:: for extra information needed to
install GPC on certain platforms.

  1. Unpack the source distributions.

     Sources for GNU CC and GNU Pascal must be unpacked in separate
     directories.  Do not move GNU Pascal files into the GNU C source
     directory.  It is possible, though not required, to build the
     compiler(s) in a directory other than the one containing the
     sources. In either case, you need a `make' that understands the
     VPATH variable. GNU make does, although at least GNU make version
     3.71 has a bug in the way it treats VPATH.  GNU make version 3.74
     is known to work.

     If you have built GNU Pascal previously in the same directory for a
     different target machine, do `make distclean' to delete all files
     that might be invalid.  One of the files this deletes is
     `Makefile'; if `make distclean' complains that `Makefile' does not
     exist, it probably means that the directory is already suitably
     clean.

  2. Configuring and building GNU CC GNU Pascal shares its
     configuration with GNU CC. The configuration options you select
     for GCC, apply for GNU Pascal too. Configuration of GNU CC is
     treated in depth in Chapter 4 of "Using and Porting GNU CC"

     Chdir to the GCC object directory. Usually,

          % ../gcc-2.7.2.1/configure --prefix=/usr

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

  3. The standard directory for installing GNU CC and GNU Pascal is
     `/usr/local/lib'. If you want to install its files somewhere else,
     specify `--prefix=DIR' when you run `configure'.  Here DIR is a
     directory name to use instead of `/usr/local' for all purposes
     with one exception: the directory `/usr/local/include' is searched
     for header files no matter where you install the compiler.  To
     override this name, use the `--local-prefix' option below.

  4. Specify `--local-prefix=DIR' if you want the compiler to search
     directory `DIR/include' for locally installed header files
     *instead* of `/usr/local/include'.

     You should specify `--local-prefix' *only* if your site has a
     different convention (not `/usr/local') for where to put
     site-specific files.

     *Do not* specify `/usr' as the `--local-prefix'!  The directory
     you use for `--local-prefix' *must not* contain any of the
     system's standard header files.  If it did contain them, certain
     programs would be miscompiled (including GNU Emacs, on certain
     targets), because this would override and nullify the header file
     corrections made by the `fixincludes' script.

  5. Make sure the Bison parser generator is installed.  (This is
     unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
     more recent than `c-parse.y' and `cexp.y' and you do not plan to
     change the `.y' files.)

     Bison versions older than Sept 8, 1988 will produce incorrect
     output for `c-parse.c'.

  6. If you have chosen a configuration for GNU Pascal which requires
     other GNU tools (such as GAS or the GNU linker) instead of the
     standard system tools, install the required tools in the build
     directory under the names `as', `ld' or whatever is appropriate.
     This will enable the compiler to find the proper tools for
     compilation of the program `enquire'.

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

  7. Build the C compiler:

          % make LANGUAGES=c

     (Just `make' would also build the C++ and Objective C compilers).
     You do not need to install the compiler you just built, but leave
     the objects in place, since GPC will directly load most of the GCC
     object files.

  8. Configuring and building GNU Pascal for your system.  Normally,
     you just `cd' to the directory containing the source code and type
     `./configure'.  If you're using `csh' on an old version of System
     V, you might need to type `sh configure' instead to prevent `csh'
     from trying to execute `configure' itself (under AIX, you may need
     to use ksh instead of sh).

     To compile the GNU Pascal in a different directory from the one
     containing the source code, `cd' to the directory where you want
     the object files and executables to go and run the `configure'
     script.  `configure' automatically checks for the source code in
     the directory that `configure' is in. If for some reason
     `configure' is not able to find the source directory, rerun
     `configure' with the option `--srcdir=DIR', where DIR is the
     directory that contains the source code.

     Note that the gpc `configure' script does not accept most of the
     switches usually given to a `configure' script because it extracts
     this information from the GCC configuration files.  Run `configure
     --help' to see the options supported by `configure'.

     Running `configure' takes a while.  While it is running, it prints
     some messages that tell what it is doing.  If you don't want to
     see any messages, run `configure' with its standard output
     redirected to /dev/null; for example, `./configure >/dev/null'.

     If `configure' is unable to locate GNU CC sources or object code,
     it will print an error message and exit. In that case, run
     `configure' again with `--with-gccsrc=DIR' and / or
     `--with-gccbin=DIR' arguments.

     When it is finished, `configure' prints a short summary of the
     information it has collected.

          --------------------------------------------------------------------------
          Configuration summary:
            Building a native i486-linux compiler
          
            GPC sources in:         .
            GCC sources in:         ../gcc-2.7.2.1
            GCC object code in:     ../gcc-2.7.2.1
            GCC version:            2.7.2.1
          
            Compiler for GPC:       gcc
            Compiler for libgpc.a:  gcc
            Compiler flags:         -g -O
          
            Installation path:      /usr/bin, /usr/lib/gcc-lib/i486-linux/2.7.2.1
          --------------------------------------------------------------------------
          
          Now, type `make' to build the compiler and runtime system.

  9. Building the compiler.  Once you are satisfied with the
     configuration as determined by `configure', you can build the
     compiler:

          % make

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

 10. When everything compiles, you can verify what the  `make -n
     install' command does, and if you are satisfied run it without the
     `-n' option to install the compiler (gpc1), front end (gpc), run
     time system (libgpc.a) to the same place where gcc was installed.

     It is sort of stupid to have a separate incarnation of `gcc.c'; the
     difference now is that `gpc' also searches from library `libgpc.a'
     and `-lm'. In addition `gcc.c' specifies the interface to the
     Pascal compiler (gpc1). This command will vanish when `gcc' knows
     how to compile Pascal programs.



File: gpc.info,  Node: compilation notes,  Next: crosscompilers,  Up: Installation

Configuration dependent compilation notes
=========================================

* Menu:

* Alpha OSF/1::     Installation on an Alpha OSF/1 system
* DOS: DJGPP.       The DJGPP port of GNU compilers to MS-DOS
* DOS, OS/2: EMX.   The EMX port of GNU compilers to MS-DOS and OS/2
* Win32::           Installation on a Windows 95/NT system


File: gpc.info,  Node: Alpha OSF/1,  Next: DJGPP,  Up: compilation notes

Alpha OSF/1
-----------

   For alpha OSF/1 v3.2 (GCC 2.6.3): If your linker starts to output
error messages like:

     Warning: Linking some objects which contain exception information sections
         and some which do not. This may cause fatal runtime exception handling
         problems (last obj encountered without exceptions was <OBJ/LIB>)

   I do not know why these started to appear, but you can get rid of
these if you do as follows in the GPC object directory.

   You need to trigger the Makefile dependencies, e.g. by doing the
touch command below. What happens is that it re-generates the version.c
and rts/version.c files, which need to be recompiled with `ALPHA_BUG'
defined.

   Example:
     % touch Makefile
     % make MY_CFLAGS=-DALPHA_BUG other-make-flags-you-want-to-use


File: gpc.info,  Node: DJGPP,  Next: EMX,  Prev: Alpha OSF/1,  Up: compilation notes

MS-DOS with DJGPP
-----------------

   You cannot build GNU CC (or GNU Pascal) by itself on MS-DOS; it will
not compile under any MS-DOS compiler except itself. The official
MS-DOS port of GCC is called djgpp, and it is available from
`simtel.coast.net' and it has mirrors all over the world. The
`configure' script is replaced by an MS-DOS batch file called
`configure.bat' wich does essentially the same. Detailed instructions
are in the file `config/msdos/README.dj' of the GNU Pascal source
distribution.


File: gpc.info,  Node: EMX,  Next: Win32,  Prev: DJGPP,  Up: compilation notes

MS-DOS or OS/2 with EMX
-----------------------

   EMX is a FreeWare 32-bit DOS extender which adds some properties of
UNIX to the DOS and OS/2 operating systems written by Eberhard Mattes.
You can find it, for example, via anonymous `ftp' on the server
`ftp.uni-stuttgart.de' in the directory `pub/systems/os2/emx*'.

   The EMX extender for DOS and OS/2 makes it relatively easy to port
GNU tools--such as the GNU Pascal Compiler--to these platforms.
However, it is not straightforward to compile it.

  0. I assume you have the EMX package installed with GNU development
     tools and the `dmake' make utility.  You have compiled GNU C such
     that the object files are still in place.  It is important that
     GNU C is the version matching ot GNU Pascal which is currently
     2.7.2.1.

     If you have problems compiling GNU C:  The directory `config/emx'
     contains drive-independent versions of `dostage1.cmd' and
     `makeexe.cmd'.

     If you are running DOS, you are in trouble now because the DOS
     command line is limited to 128 characters.  If you succeed to
     compile GPC for EMX on a DOS system, please let us know.  (However
     you can compile GPC for DJGPP on a DOS system.)

  1. Unzip the source for GPC from the emx directory, so it will go
     into the gnu subdirectory.  Unlike other EMX sources, the GPC
     source must *not* be extracted from the root directory.
            cd \emx
            pkunzip -d c:\gpc-2721

  2. Configure and make your GNU Pascal compiler and runtime system.
     You need not call `dmake' directly; call `make.cmd', instead.
            configur
            make

  3. To install, type
            make install



File: gpc.info,  Node: Win32,  Prev: EMX,  Up: compilation notes

Windows NT and Windows 95 with cygwin32
---------------------------------------

   cygwin32 is a project to make it easy to port Unix applications to
machines which run an OS which supports the Win32 API - ie Windows 95
and Windows NT. Currently, cygwin32 is in beta stage; it is available
from `ftp://ftp.cygnus.com/pub/gnu-win32/' Don't use gcc sources from
the cygwin32 distribution. These are not just modified from FSF
gcc-2.7.2 to support the win32 target, they are the "current
development release", and too different from FSF gcc to be compatible
with GNU Pascal, which is based on FSF sources.

   Instead, apply `config/cygwin32/gcc-2.7.2.cygwin32-beta16.diff' to
FSF gcc-2.7.2 to add cygwin32 platform support to gcc.  The GNU pascal
sources already have the cygwin32 support, so no further patching of
gpc is needed

   Currently, cygwin32 is not self-hosting: the preferred way to build
the cygwin32-gpc binary is to use a unix system with a cygwin32
targeting crosscompiler. *Note Crossbuilding::

   GNU Pascal does not yet fully support the stack calling convention
of the Win32 API, thus making it impossible to access system DLL's.


File: gpc.info,  Node: crosscompilers,  Next: binary distributions,  Prev: compilation notes,  Up: Installation

Building and Installing a crosscompiler
=======================================

   GNU Pascal can function as a cross-compiler for many machines, but
not all.  Also, only a few combinations have been tested. If you need
information about GNU tools in a cross-configuration,
`ftp://ftp.cygnus.com/pub/embedded/crossgcc/' is the place to be.

   * Cross-compilers for the Mips as target using the Mips assembler
     currently do not work, because the auxiliary programs
     `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
     but a Mips.  It does work to cross compile for a Mips if you use
     the GNU assembler and linker.

   * Cross-compilers between machines with different floating point
     formats have not all been made to work.  GNU C now has a floating
     point emulator with which these can work, but each target machine
     description needs to be updated to take advantage of it.

   * Cross-compilation between machines of different word sizes is
     somewhat problematic and sometimes does not work.

   Since GNU Pascal generates assembler code, you probably 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.  You also need header files and libraries suitable
for the target machine that you can install on the host machine.

* Menu:

* Steps of Cross::      Using a cross-compiler involves several steps
                        that may be carried out on different machines.
* Configure Cross::     Configuring a cross-compiler.
* Build Cross::         Actually building a Pascal cross-compiler.
* Crossbuilding::	Crossbuilding a Pascal compiler.


File: gpc.info,  Node: Steps of Cross,  Next: Configure Cross,  Up: crosscompilers

Steps of Cross-Compilation
--------------------------

   To compile and run a program using a cross-compiler involves several
steps:

   * Run the cross-compiler on the host machine to produce assembler
     files for the target machine.  This requires header files for the
     target machine.

   * Assemble the files produced by the cross-compiler.  You can do this
     either with an assembler on the target machine, or with a
     cross-assembler on the host machine.

   * Link those files to make an executable.  You can do this either
     with a linker on the target machine, or with a cross-linker on the
     host machine.  Whichever machine you use, you need libraries and
     certain startup files (typically `crt....o') for the target
     machine.

   It is most convenient to do all of these steps on the same host
machine, since then you can do it all with a single invocation of GNU
Pascal.  This requires a suitable cross-assembler and cross-linker.
For some targets, the GNU assembler and linker are available.


File: gpc.info,  Node: Configure Cross,  Next: Build Cross,  Prev: Steps of Cross,  Up: crosscompilers

Configuring GNU CC as a crosscompiler
-------------------------------------

   No special actions have to be taken to configure GNU Pascal as a
crosscompiler. Cross-compiler specific configuration is done only for
GCC.  Section 4.2 of "Using and Porting GNU CC" deals with
cross-configurations in great detail. Once cross-binutils and a C
library for the target machine are in place, GCC can be configured
(from the GCC object directory).  Suppose we are on a Linux system and
want a cross-compiler that produces code that runs on MS-DOS:

     % ../gcc-2.7.2.1/configure --prefix=/usr --target=i386-go32

   This creates all the necessary config files, links and Makefile in
the GCC object directory. Now, proceed with the compilation and
installation process like in the case of the native configuration
described before. Do not remove files from the GCC object directory;
the cross-compiler is used to compile the GNU Pascal runtime system
(RTS) for the target system.


File: gpc.info,  Node: Build Cross,  Next: Crossbuilding,  Prev: Configure Cross,  Up: crosscompilers

Building the Pascal crosscompiler
---------------------------------

   Once you have verified the C crosscompiler, the Pascal
cross-compiler can be configured and built. Note that the `configure'
script does not require any cross-compiler related switches because GPC
inherits all of this from GNU CC.

   Sample output for a linux->msdos cross configuration:

     --------------------------------------------------------------------------
     Configuration summary:
       Building a i386-go32 crosscompiler hosted by i486-unknown-linux
     
       GPC sources in:         ../gpc-2.0
       GCC sources in:         ../gcc-2.7.2.1
       GCC object code in:     ../gcc
       GCC version:            2.7.2.1
     
       Compiler for GPC:       gcc
       Compiler for libgpc.a:  i386-go32-gcc
       Compiler flags:         -g -O
     
       Cross-ar utility:       i386-go32-ar
       Cross-ranlib utility:   i386-go32-ranlib
     
       Installation path:      /usr/bin, /usr/lib/gcc-lib/i386-go32/2.7.2.1
     --------------------------------------------------------------------------
     
     Now, type `make' to build the compiler and runtime system.

   Building a cross-compiler requires cross-binutils for your target,
i386-go32 in this examples. If `configure' is not able to find
`i386-go32-ar' and/or `i386-go32-ranlib', you may have to run it again
with again with `--with-ar=YOUR-CROSS-AR' or
`--with-ranlib=YOUR-CROSS-RANLIB' switches.

   Then, `make' and `make install' the cross-compiler like you would
for a native configuration.


File: gpc.info,  Node: Crossbuilding,  Prev: Build Cross,  Up: crosscompilers

Crossbuilding a compiler.
-------------------------

   Yet another possibility is CROSSBUILDING : Using a crosscompiler to
build GNU Pascal results in a compiler binary that runs on the
cross-target platform. 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 cygwin32.

   To crossbuild GNU Pascal, you have to install a crosscompiler for
your target first. This is covered in chapter 4 of "Using and Porting
GNU CC".  Assuming you want to build a native cygwin32 Pascal compiler
on a Linux system, configure GCC:

     % ../gcc-2.7.2.1/configure --prefix=/usr --build=i486-linux \
     	--host=i386-cygwin32 --target=i386-cygwin32

   Build it:

     % make CFLAGS=-O2 LANGUAGES=c

   Now, configure and build GPC. The output of `configure' should look
like:

     --------------------------------------------------------------------------
     Configuration summary:
       Building a i386-cygwin32 crosscompiler hosted by i386-cygwin32
     
       GPC sources in:         ../gpc-2.0
       GCC sources in:         ../gcc-2.7.2.1
       GCC object code in:     ../gcc
       GCC version:            2.7.2.1
     
       Compiler for GPC:       i386-cygwin32-gcc
       Compiler for libgpc.a:  i386-cygwin32-gcc
       Compiler flags:         -g -O
     
       Cross-ar utility:       i386-cygwin32-ar
       Cross-ranlib utility:   i386-cygwin32-ranlib
     
       Installation path:      /usr/bin, /usr/lib/gcc-lib/i386-cygwin32/2.7.2.1
     --------------------------------------------------------------------------
     
     Now, type `make' to build the compiler and runtime system.

   Again, `configure' should be able to detect and configure this setup
without additional flags. If not, specify `--with-ar', `--with-ranlib',
`--with-gcc' and/or `--with-rtsgcc' as appropriate.

   A cross-built compiler must be installed by hand.


File: gpc.info,  Node: binary distributions,  Prev: crosscompilers,  Up: Installation

Installation instructions for a GPC binary distribution
=======================================================

   To install a binary distribution, cd to the main directory and
unpack the archive while preserving the stored directory structure.  In
concrete, to install a ZIP archive under DOS with PKunzip, type

       C:\> pkunzip -d ARCHIVE

   where ARCHIVE is the name of the distribution file.  To install a
TGZ archive under Linux, become root, then extract the archive from the
root of the filesystem:

       # tar xzf ARCHIVE.tar.gz

   Binary distributions include `libgcc.' and `specs', files that are
normally part of gcc. If you have gcc installed, they will be replaced
unless you manually install the archive.

