                  INSTALLATION GUIDE FOR THE UNIX VERSIONS


This is the installation guide to the Un*x versions of Pari/GP. Starting
with release 1.38, we assume that you have either an ANSI C or a C++ compiler
available.
If your machine does not have one (for example if you still use /bin/cc
in SunOS 4.1), we strongly suggest that you obtain the gcc/g++ compiler
from the Free Software Foundation or by anonymous ftp. A non-ANSI version
of version 1.37.3 is available, but no more changes or corrections will be
made to this version in the future.

1) To compile the library and the calculator (gp). 
   a) First, create a Makefile which is as close as possible to your system
      by typing "Makemakefile arch", where "arch" can be the following.

sun3    if your machine is 68020/68030/68040/68060 based. In that case, you 
        will also have to choose which assembly file to use (see b) below).
hppa    if your machine has the HP-PA architecture.
sparcv7 if your machine is based on Sparc version 7 (example: Sparcstations 1,
        1+, 2, IPC, IPX).
sparcv8 if your machine is based on Sparc version 8 (example: Sparcstations 10,
        Classic, LX). In this case you will have to choose which assembly
        file to use (see b) below). Note that the modifications to be made
	for Solaris 2.x are more complicated, so for the moment we provide
	only compiled binaries.
alpha   if your machine is a DEC Alpha.
i386    if your machine is based on a 386+387, 486 or Pentium and you use a 
        Un*x OS (it has been successfully tested with linux).
dos     if your machine is based on a 386+387, 486 or Pentium and you are
        still in the DOS world. This requires the emx/gcc compiler. Note also
        that it is incompatible with the Windows environment.
	
	If you do not give any argument to Makemakefile, the Makefile which
	is generated is for other Un*x machines, for example DECstations.
	A few modifications to the Makefile may be necessary in this case.
	In particular, the flag -DULONG_NOT_DEFINED which is set by default
	may have to be removed (if the type ulong is defined), and of course
	the flag -DLONG_IS_32BIT has to be changed to -DLONG_IS_64BIT in case
	of 64 bit machines.

	Note: starting with version 1.38, we are supporting
	64-bit machines, for the moment only the DEC Alpha.

   b) In the case of 680x0 or sparcv8 systems you must choose which assembly
      file to use:

680x0 systems:
      The syntax used by the SUN 3 assembler is not standard. On the MacII 
      distribution, the correct Mac assembler syntax is given. In the present
      distribution, in addition to mp.s which has the SUN 3 syntax, two files
      called mp.news and mp.ami are included so as to help people having 
      machines with a 680x0 processor (x>=2) but a more standard syntax.

      This may not correspond to the actual syntax used, but may be closer than
      mp.s. In principle, apart from whitespace and the different syntax, the
      semantics of the two files should be identical. In case of conflict, 
      correct mp.news or mp.ami (i.e. NEVER touch mp.s).

      The file mp.news has been successfully tested on a Sony NEWS, and the
      file mp.ami on a Commodore Amiga 2500 running Lattice C 5.10.

sparcv8 systems:
      The different implementations of the Sparc Version 8 architecture (at 
      present mainly Microsparc and Supersparc) need slightly different
      assembly language modules for optimum speed, although they are 
      compatible. If you have a Supersparc (e.g. SparcStation 10), then make a
      symbolic link from sparcv8super.s to sparcv8.s. If you have a Microsparc
      (e.g. Sparc Classic and LX), make a symbolic link from sparcv8micro.s to
      sparc.s. By default, the link in the distrinution is from sparcv8super.s.

   c) Decide whether you want to compile with an ANSI C or a C++ compiler.
      The  C++ version of Pari is always a little faster because of 
      inlining, but can be used in library mode only with C++ programs. 
      Hence you may want, for example, to install GP compiled in C++, but
      the ANSI C library if you want to link it with ANSI C programs.
      The Makefile is generated by default for ANSI C. If you want it for C++,
      you must perform the following changes in the Makefile: replace gcc by
      g++ (if this is your C++ compiler), remove the -ansi flag, and if you
      use a non-68k version, replace 
      $(CC) $(CFLAGS) -c mp.c by $(CC) $(CFLAGS) -c -o mp.o mpin.c
      In addition, if you have a version with assembler support listed above,
      comment out the line #define __HAS_NO_ASM__ in the file src/mpin.h.

   d) The Makefile assumes by default that you are using X11 as a windowing
      system. If this is not the case, modify the Makefile accordingly:
      you are given the choice of X11 (the default), sunview or no plotting.
      For this, comment/uncomment the lines corresponding to PLOTFILE,
      PLOTCFLAGS and PLOTLIBS.
      Some slight modifications may also have to be made so that the compiler 
      knows where to access the X11 libraries if they are in some non-standard
      place.
   e) If you have the GNU readline library installed (distributed with gdb),
      and want to use its facilities (this is not so useful if, as we advise,
      you work in an Emacs buffer, see below), comment/uncomment the
      appropriate lines involving GPMAIN in the Makefile.
      Note: if you are compiling with sunview, you will have an error message
      about a redefined function rl_copy.
      Since the sun source code is not available, the way out is to recompile
      the GNU readline library by changing in the file readline.c rl_copy to
      some weird name, say rl_copy_kludge.
      The use of the readline and history library (suggested to us by E. Roeder)
      is not documented but is similar to emacs commands. However note that
      it is incompatible with SUN commandtools (but not with shelltools).

   f) Then simply type "make" in the distribution directory. Be sure to 
      "make clean" before changing to another architecture using the same
      file system. Note that the 68020 version is especially fast compared
      to the processor speed because a large part of the kernel is written in
      assembly language.  Note also that the Sparcv7 version runs on Sparcv8
      machines, but slower than the specific Sparcv8 version. On the contrary
      the Sparcv8 version cannot run on Sparcv7 machines.

   g) To test the executable, run gp on the file testin as follows:
      gp < testin >& fileout &. Then do a diff with the file testout for
      a 32 bit machine, and with the file testout64 for a 64 bit machine.
      Apart from the header (version number and type) and the very last 
      line which gives the user elapsed time in milliseconds, any
      difference probably means that something is wrong. (Note however
      that testout64 has been made on a DEC Alpha and that other 64 bit
      processors/compilers may give different outputs). Most probably
      with your installation procedure, but it may be a bug in the Pari
      system, in which case we would appreciate a report. 
      Note that testin is not a severe test and is
      quite fast (a few minutes), but does check at least one instance of
      every function. Do NOT forget the & after >, since testin tests some
      special error messages. 
   h) If you want to test the graphic routines, use 
      gp<testplotin. You will have to click 6 times on the mouse
      button after seeing each image (under X11; under suntools you must kill
      the images). The testin script produces a Postscript file pari.ps which 
      you can send to a Postscript printer. The printed output should be
      similar (although not identical) to the screen images.

   i) Hints: If you are on Solaris 2.x, add the -DSOLARIS flag, remove the
      underscores ('_') from the files sparc*.s, remove the ULONG_NOT_DEFINED
      flag, and good luck!

      If during the compilation process the compiler or linker complains
      about an undefined function exp2 or log2, you have a defective math
      library. Either take a better one, or comment out the 
      #define HAVEEXP2 command in gencom.h.

2) To install the PARI library so that it can be easily used from a user
   program, type "make install". This puts the executable gp in /usr/local/bin,
   the library in the directory /usr/local/lib, and the necessary include 
   files in /usr/local/include/pari, which is created if it does not
   already exist. If these directories do not suit your 
   installation, change the LIBDIR or the INCLUDEDIR in the Makefile.
   You can install separately the library and gp by using the targets
   "install-lib" and "install-bin".
3) Once installed, to link to the PARI library just add -lpari in your
   link command and -I/usr/local/include/pari to your compilation commands.
   A sample makefile (Makesimple) is given for gp itself.
   All modifications made to the Makefile should of course be made on the
   Makesimple file.
4) If you want to use gp under GNUEmacs (see section 3.11 of the user's guide)
   change the pathnames in the file pari.el to suit your installation, and read
   the file pari.txt. If you are familiar with Emacs, we strongly suggest
   that you do so.
5) If you want to get rid of your .o files and the created binaries in the
   working directory, type "make clean".
6) For the example of section 4.3 of the user's guide, type make
   in the directory examples. Several complete sample gp programs are also 
   given in that directory for example Shanks's SQUFOF factoring method,
   the Pollard rho factoring method, the Lucas-Lehmer primality test for
   Mersenne numbers, a simple general class group and fundamental unit
   algorithm, much worse than buchgen, and others. See the 
   file EXPLAIN for some explanations.
7) To print the user's guide, go in the doc directory and type "make"
   This will automatically create a file users.dvi containing the manual with
   a table of contents and an index in two passes. You must then send the 
   .dvi file to your favorite printer in the usual way.
   A tutorial for GP is being written. If you want the available part of the
   tutorial to be included in the manual, uncomment the line \input tutorial
   in the file users.tex.

8) Send bugs, comments, etc. to:
   pari@math.u-bordeaux.fr
   In any case, we would like to start a Pari mailing list, so if you get
   this software, even if you are an old-timer of Pari, we would appreciate
   if you could send us an e-mail message giving us some information about
   yourself. Put as header of your message "mailing list", so we can recognize
   it easily. In exchange, we will try to keep you informed on the progress of
   the system.
9) Good luck and enjoy!
