
	These are some basic instructions to compile and install YAP:

1. How to compile Yap:

To compile YAP just do:

	(1) mkdir arch

	(2) cd arch

	(3) ../configure ...options...

	(4) check the Makefile for any extensions or changes you want to make.

	(5) make

	(6) If the compilation succeeds, try ./yap

	(7) Happy? make install

If you want corouting or CLP(QR), please do replace step 3 by

	(3') ../configure --enable-coroutining ...other options...


1.1 Where to install Yap

 Recent versions of Yap try to follow GNU conventions on where to
place software.

  o The main executable is placed at BINDIR. This executable is
actually a script that calls the Prolog engine, stored at LIBDIR.

  o LIBDIR contains the Prolog engine and a Prolog library.

  o INCLUDEDIR is used if you want to use Yap as a library.

1.2 Which Yap

Compiling Yap with the standard options give you a plain vanilla
Prolog. You can tune Yap to include some extra functionality

 o -DCOROUTINING=1 gives you delaying on goals, eg, freeze.

 o -DRATIONAL_TREES=1 includes support for rational trees.

 o -DDEPTH_LIMIT=1 allows depth limited evaluation, say for
implementing iterative deepening.

 o -DYAP_ARRAYS gives you two different styles of arrays.

 o -DANALYST and -DLOW_LEVEL_TRACER give you low level
debugging. ANALYST tells how your program uses the abstract machine
instructions. LOW_LEVEL_TRACER dumps the gory details of what your
program is doing.

The next two options are good fun, but arguably not production
quality:

  o -DTABLING gives tabling in XSB style.

  o -DYAPOR gives or-parallelism in Muse style. If you add -DSBA to it
you will have the Sparse Binding Array instead of copying. If you add
-DYAPOR_COW instead you will have the \alphaCOW model, that is, forking
instead of copying.

1.3 Porting Yap

The system has been mainly tested with GCC, but we have been able to
compile versions of Yap under lcc in Linux, Sun's cc compiler, IBM's
xlc, SGI's cc, Microsoft's Visual C++ 6.0 and HP's cc.

1.3.1 Yap and GCC

Yap has been developed to take advantage of GCC (but not to depend on
it). The major advantage of GCC is threaded code and register
reservation. 

YAP is set by default to compile with the best compilation flags we
know. Even so, a few specific options can be used depending on the
architecture:

1.3.1.1 x86

The flag:

	YAP_EXTRAS= ... -DBP_FREE=1

tells us to use the %bp register (frame-pointer) as the emulator's
program counter. This seems to be stable and should become default
real soon now.

1.3.1.2 Sparc/Solaris2

Use:

	YAP_EXTRAS= ...   -mno-app-regs -DOPTIMISE_ALL_REGS_FOR_SPARC=1

and YAP will get two extra registers! This trick does not work on
SunOS 4 machines.

1.3.1.3 Tuning GCC/Yap for your machine model

Versions of GCC can be tweaked for different processors, eg, 486,
Pentium, PentiumPro, Ultrasparc, Supersparc. Unfortunately, some of
these tweaks do may make Yap run slower or not at all in other machines
with the same instruction set, so they cannot be made default.

The best options also depends on the version of GCC you are using, and
it is a good idea to consult the GCC manual under the menus "Invoking
GCC"/"Submodel Options". We next describe a few:

(a) GCC up to 2.7.*:

	o 486:

		YAP_EXTRAS= ... -m486 -DBP_FREE=1

	to take advantage of 486 specific optimisations in GCC 2.7.*.

	o Pentium:

		YAP_EXTRAS= ... -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2

	o PentiumPros are known not to require alignment.

	o Super and UltraSparcs:
		 YAP_EXTRAS= ... -msupersparc

(b) GCC 2.8.*, EGCS, GCC 2.95.*

	o Check -march=XXX for fun.



