			Installing SWI-Prolog
			=====================

			   Jan Wielemaker
			(jan@swi.psy.uva.nl)


Configuration, compilation and installation is based on the GNU autoconf
package.

In normal cases, the following should do:

	% cd src
	% ./configure
	% make
	% make test
	% make install

By default, the system  is  installed   as  /usr/local/bin/pl,  with the
libraries in /usr/local/lib/pl-<version>.

	% ./configure --prefix=PREFIX

Building for multiple architectures
===================================

To build for a second architecture, you  should either clean the sources
using `make distclean' or make  a  new   directory  next  to  the source
directory and run configure in  this   directory.  The  latter procedure
requires GNU-MAKE.  For example:

	% mkdir rs6000
	% cd rs6000
	% ../src/configure
	% make
	% make test
	% make install

Building a runtime version
==========================

The runtime version has  no  tracer,   doesn't  handle  interrupts (just
exits), has no profiler and no readline   included.  To build it using a
separate directory:

	% mkdir rt
	% cd rt
	% ../src/configure --enable-runtime
	% make
	% make install

Some things may need attention:
===============================

# GNU readline library

When present, SWI-Prolog will  automatically   include  the GNU readline
library. It is *strongly*  adviced  to   install  this  library  on your
system. It provides editing of previously  entered commands (history) as
well as completion on Prolog  atoms   and  filenames (for consult, etc.)
much like the bash and tcsh shells do.

SWI-Prolog has been linked with versions 1.1,   1.2,  2.0 and 4.0 of the
readline library.

# Memory mapped stacks.  Segmentation faults during the installation.

Configure will see if mmap() may be used to allocate the stacks.  If you
think this should be possible, but Configure   says `no', please work on
test/mmap.c

At the end  of  the  compilation,  the   Prolog  files  from  the  boot/
subdirectory are compiled using ./pl. On  some systems this installation
aborts with a segmentation fault (signal 11   on  most machines). If you
are knowledgeable with low-level  memory   management  using mmap(), you
might want to look as test/mmap.c  and pl-setup.c, where exception-based
handling of the stacks is defined. Otherwise,  remove all .o files, redo
the configuration using --disable-segv-handling and   recompile. If that
still doesn't solve the problem,   use  --disable-mapped-stacks. If that
doesn't fix the problem  you  found   something  new.  Please  report to
prolog-bugs@swi.psy.uva.nl.

Sofar, automatic configuration is known to   generate  a working version
using mmap() based stacks on SunOS   4.1.x, Solaris 2.x, Linux (anything
not truly antique) and SCO OpenServer.

# Assembler warnings

If you get assembler warnings compiling pl-wam.c, try #define NO_ASM_NOP
1 in config.h. Should be  determined   automatically  by test/nop.c, but
sometimes appears to fail.


Platform specific notes
=======================

SCO OpenServer
--------------

According to Tamas Laufer, best  results   are  obtained  if you install
gcc-2.8.1 (latest version at time of   writing) from the original source
at prep.ai.mit.edu/pub/gnu or  one  of   its  mirrors.  Using  GNU-make.
installation is reported to work flawlessly.

Compilation using SCO `cc' is  possible   too,  though  requires special
attention to get alloca() and dlopen() working.  The result is about 20%
slower then the gcc-compiled executable.
