1: Copyright (C) 2003,2007,2008 Free Software Foundation, Inc.
2: This file is free documentation; the Free Software Foundation gives
3: unlimited permission to copy, distribute and modify it.
8: You need gcc version 2.0 or later to compile gforth.
10: For the (documented) libcc.fs C interface you need a C compiler and
11: libtool at run-time.
13: For the (undocumented ) lib.fs C interface you need to install either
14: the ffcall libraries or the libffi library. Libffi comes with recent
15: gccs, ffcall can be found on
17: ftp://ftp.santafe.edu/pub/gnu/ffcall-1.8.tar.gz (USA)
18: ftp://ftp.ilog.fr/pub/Users/haible/gnu/ffcall-1.8.tar.gz (Europe)
20: On many architectures (exceptions: 386, PPC, MIPS, Alpha) you need gdb
21: at run-time in order for the disassembler to work.
24: Building and Installing
26: First, type
30: (see Section Configuration Options below for details).
32: After configuration, type
36: This includes a check whether your shiny new Forth system works. If
37: you like to invoke the check alone, do
39: make check
41: You can run some benchmarks with
43: make bench
45: and compare them with the results in Benchres and in the manual.
47: If everything is all right, you may want to install gforth. Type
49: make install
51: For paper documentation, print gforth.ps (a Postscript file (300dpi
52: fonts, i.e., it works, but does not produce best quality on better
53: printers)), or say
55: make gforth.dvi
57: and print the resulting file gforth.dvi. You can also get the
58: documentation in HTML format by typing
60: make html
62: If you prefer plain ASCII documentation, you can
64: make doc/gforth.txt
66: or just concatenate the files gforth.info-* ('cat gforth.info-*' under
67: Unix); the result of the latter option is a little worse.
69: You can find binary distributions, documentation in HTML and plain
70: text format and information on known installation problems at
74: Configuration Options
76: If you use GNU make, you can build in a directory different from the
77: source directory by changing to the build directory and invoking
78: configure thus:
82: where $srcdir is the source directory. (Note that we tested this only
83: for installation; i.e., if you want to hack the Gforth sources, you
84: should probably build in the source directory).
86: configure has the following useful parameters:
87: --prefix=PREFIX install architecture-independent files in PREFIX
88: [default: /usr/local]
89: --exec-prefix=PREFIX install architecture-dependent files in PREFIX
90: [default: same as prefix]
91: --help: tells you about other parameters.
93: The file Benchres shows the best gforth-fast performance that we
96: If you don't like the defaults for the installation directories, you
97: should override them already during configure. E.g., if you want to
98: install in the /gnu hierarchy instead of in the default /usr/local
99: hierarchy, say
101: ./configure --prefix=/gnu
103: Moreover, if your GCC is not called gcc (but, e.g., gcc-2.7.1), you
104: should say so during configuration. E.g.:
106: ./configure CC=gcc-2.7.1
108: You can also pass additional options to gcc in this way, e.g., if you
109: want to generate an a.out executable under Linux with gcc-2.7.0:
111: ./configure CC="gcc -b i486-linuxaout -V 2.7.0"
113: You can change the sizes of the various areas used in the default
114: image `gforth.fi' by passing the appropriate Gforth command line
115: options in the FORTHSIZES environment variable:
117: ./configure "FORTHSIZES=--dictionary-size=1048576 --data-stack-size=16k --fp-stack-size=16K --return-stack-size=15k --locals-stack-size=14848b"
119: The line above reaffirms the default sizes. Note that the locals
120: stack area is also used as input buffer stack.
122: If C's "long long" do not work properly on your machine (i.e., if the
123: tests involving double-cell numbers fail), you can build Gforth such
124: that it does not use "long long":
126: ./configure ac_cv_sizeof_long_long=0
128: For MacOS X on Core 2 processors, you might want to use the 64-bit
129: version for increased speed (more registers available); you have to
130: ask for that on configuration, as follows:
132: ./configure CC='gcc-4.2 -arch x86_64' --build=x86_64-apple-darwin9.4.0
137: There is currently no simple way to do cross-installation of Gforth
138: (apart from Gforth EC). The current build process interleaves
139: compiling and running heavily, so multiple transfers between build and
140: target machine would be required. We don't have a testing environment
141: for cross-compilation, so we cannot fix this at the moment. If you
142: want to do cross-installation, please contact us.
144: In any case, you might find the following useful:
146: You need a cross-compilation toolchain for your target including gcc
147: (2.0 or later).
149: The first step in cross-installation is the cross-configuration. A
150: few tests made by the configure script do not work in a
151: cross-compilation situation. You have to provide the results of these
152: tests by hand. E.g., if you compile for an ARM:
154: env skipcode=".skip 16" ac_cv_sizeof_char_p=4 ac_cv_sizeof_void_p=4 \
155: ac_cv_sizeof_char=1 ac_cv_sizeof_short=2 ac_cv_sizeof_int=4 \
156: ac_cv_sizeof_long=4 ac_cv_sizeof_long_long=8 ac_cv_sizeof_intptr_t=4 \
157: ac_cv_sizeof_int128_t=0 ac_cv_sizeof_uint128_t=0 \
158: ac_cv_c_bigendian=no ./configure CC=arm-elf-gcc --host=arm-linux
160: The ac_cv_sizeof_... variables give the sizes of various C types;
161: ac_cv_sizeof_char_p is the same as "sizeof(char*)" in C code. The
162: ac_cv_c_bigendian variable gives the byte order. The skipcode
163: specifies how to skip 16 bytes in the code (use "skipcode=no" to
164: disable skipping and dynamic native code generation).
167: Preloading installation-specific code
169: If you want to have some installation-specific files loaded when
170: Gforth starts (e.g., an assembler for your processor), put commands
171: for loading them into /usr/local/share/gforth/site-forth/siteinit.fs
172: (if the commands work for all architectures) or
173: /usr/local/lib/gforth/site-forth/siteinit.fs (for
174: architecture-specific commands);
175: /usr/local/lib/gforth/site-forth/siteinit.fs takes precedence if both
176: files are present (unless you change the search path). The file names
177: given above are the defaults; if you have changed the prefix, you have
178: to replace "/usr/local" in these names with your prefix.
180: By default, the installation procedure creates an empty
181: /usr/local/share/gforth/site-forth/siteinit.fs if there is no such
184: If you change the siteinit.fs file, you should run "make install"
185: again for the changes to take effect (Actually, the part of "make
186: install" starting with "rm gforth.fi" is sufficient).
189: Multiple Versions and Deinstallation
191: Several versions of Gforth can be installed and used at the same
192: time. Version `foo' can be invoked with `gforth-foo'. We recommend to
193: keep the old version for some time after a new one has been installed.
195: You can deinstall this version of Gforth with 'make uninstall' and
196: version foo with 'make uninstall VERSION=foo'. 'make uninstall' also
197: tells you how to uninstall Gforth completely.
200: Installing Info Files
202: Info is the GNU project on-line documentation format. You can read
203: info files either from within Emacs (Ctrl-h i) or using the
204: stand-alone Info reader, 'info'.
206: If you use the default install root of '/usr/local' then the info
207: files will be installed in '/usr/local/info'.
209: Many GNU/Linux distributions are set up to put all of their
210: documentation in '/usr/info', in which case you might have to do a
211: couple of things to get your environment set up to accommodate files
212: in both areas:
214: 1. Add an INFOPATH environment variable. The easiest place to do
215: this is '/etc/profile', right next to PATH and MANPATH:
219: 2. Create a file called 'dir' in 'usr/local/info'. Use the file
220: '/usr/info/dir' as a template. You can add the line for gforth
221: manually, or use '/sbin/install-info' (man install-info for details).