How to build gforth-0.5.0 in OS X/Darwin
----------------------------------------

First of all, you need to have the OS X Developer Tools
installed.

The procedure we describe here, for OS X 10.2/Darwin 6.0, also
works as far as we know for OS X 10.1.x and corresponding
versions of Darwin.  The configure scripts in Step 3 now add
`-fno-gcse` and `-D_POSIX_SOURCE` to the compiler options.

We learned from Anton Ertl that the first of these, `-fno-gcse`,
has an effect only with gcc versions > 2.92.2.  For gcc 3.1, it
speeds up the gforth benchmarks quite a bit, but still doesn't
quite bring them up to the speed of gcc 2.95.2.

The second, `-D_POSIX_SOURCE`, makes a difference in OS X 10.2,
where it is required with both versions of gcc, but not in OS X
10.1.x.  In 10.2, it prevents a define of SA_SIGINFO in
/usr/include/sys/signal.h, which would lead gforth to think that
various FPE_* are defined.  In 10.1.x, SA_SIGINFO doesn't get
defined anyway.  The FPE_*'s apparently are not present either
in 10.2 or in 10.1.x.  We learned first from Dennis Ruffer that
they have to be avoided explicitly in 10.2.

It's fortunate that you can build with gcc 2.92.2 instead of gcc
3.1 in OS X 10.2, because you nearly recapture the faster gforth
speeds from 10.1.x and earlier.  Just follow the procedure for
switching from the default 3.1 to 2.92.2 described in
/Developer/Documentation/ReleaseNotes/GCC3.html.  Namely,
execute as root:

  /usr/sbin/gcc_select 2

1. Replace config.sub and config.guess in the top directory of
   the gforth distribution by more up-to-date versions such as
   those included here.  (You can't find them in /usr/libexec/
   any more.)

2. Replace arch/power/_sync_cache_range.c with the
   _sync_cache_range.c file provided here.

3. Execute one of the two scripts provided here, gfconfig-osx or
   gfconfigindirect-osx, to run configure.

4. Do "make".

5. Do "make test" and "make bench" to try out the build.

6. If all is well, do "make install" as root.

david.n.williams@umich.edu
8-Sep-02