\title{Appendix A : Installation Guide for the UNIX Versions}


This is the installation guide to the {\tt Un$*$x} versions of {\tt Pari/GP}.
Starting with release 1.38, we assume that you have either an {\tt ANSI C}
or a {\tt C++} compiler available.

If your machine does not have one (for example if you still use {\tt /bin/cc}
in {\tt SunOS 4.1.x}), we strongly suggest that you obtain the {\tt 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.
\smallskip
1) To compile the library and the gp calculator.
\smallskip
   a) First, create a {\tt Makefile} which is as close as possible to your
      system by typing {\tt Makemakefile arch}, where {\tt arch} can be the
      following.
\smallskip
{\tt 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).

{\tt hppa} if your machine has the HP-PA architecture.

{\tt sparcv7} if your machine is based on Sparc version 7 (example: 
       Sparcstations 1, 1+, 2, IPC, IPX).

{\tt 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.

{\tt alpha} if your machine is a DEC Alpha.

{\tt 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).

{\tt 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.
\smallskip
	If you do not give any argument to {\tt 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 {\tt -DULONG\_NOT\_DEFINED} which
	is set by default may have to be removed (if the type ulong is 
	defined), and of course the flag {\tt -DLONG\_IS\_32BIT} has to be
	changed to {\tt -DLONG\_IS\_64BIT} in case of 64 bit machines.
\smallskip
	Note: starting with version 1.38, we are supporting
	64-bit machines, for the moment only the DEC Alpha.
\medskip
   b) In the case of 680x0 or sparcv8 systems you must choose which assembly
      file to use:
\smallskip
{\tt 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 {\tt 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$\ge2$) 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.
\smallskip
{\tt 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 {\tt sparcv8super.s} to {\tt sparcv8.s}. If you have a Microsparc
   (e.g. Sparc Classic and LX), make a symbolic link from {\tt sparcv8micro.s}
   to {\tt sparc.s}. By default, the link in the distrinution is from 
   {\tt sparcv8super.s}.
\medskip
   c) Decide whether you want to compile with an {\tt ANSI C} or a {\tt 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 {\tt Makefile}: replace
      {\tt gcc} by {\tt g++} (if this is your C++ compiler), remove the 
      {\tt -ansi} flag, and if you use a non-68k version, replace 

\centerline{\tt \$(CC) \$(CFLAGS) -c mp.c} 

by

\centerline{\tt \$(CC) \$(CFLAGS) -c -o mp.o mpin.c}

      In addition, if you have a version with assembler support listed above,
      comment out the line {\tt \#define \_\_HAS\_NO\_ASM\_\_} in the file
      {\tt src/mpin.h}.
\medskip
   d) The Makefile assumes by default that you are using {\tt X11} as a 
      windowing system. If this is not the case, modify the Makefile 
      accordingly: you are given the choice of {\tt X11} (the default), 
      {\tt sunview} or no plotting. For this, comment/uncomment the lines
      corresponding to {\tt PLOTFILE, PLOTCFLAGS} and {\tt 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.
\medskip
   e) If you have the GNU {\tt readline} library installed (distributed with
     {\tt 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 {\tt GPMAIN} in the Makefile.
      Note: if you are compiling with sunview, you will have an error message
      about a redefined function {\tt 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 {\tt readline.c}
      {\tt rl\_copy} to some weird name, say {\tt 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).
\medskip
   f) Then simply type {\tt make} in the distribution directory. Be sure to 
      {\tt 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 versions. On the contrary
      the Sparcv8 version cannot run on Sparcv7 machines.
\medskip
   g) To test the executable, run gp on the file {\tt testin} as follows:

\centerline{\tt gp $<$ testin $>$\& fileout \&}

      Then do a {\tt diff} with the file {\tt testout} for a 32-bit
      machine and with the file {\tt 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 {\tt 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 {\tt 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 {\tt testin} tests some special
      error messages. 
\medskip
   h) If you want to test the graphic routines, use 
      {\tt 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 {\tt testin} script produces a Postscript file 
      {\tt pari.ps} which you can send to a Postscript printer. The printed
      output should bear some similarity to the screen images (:-).
\medskip
   i) Hints: If you are on Solaris 2.x, add the {\tt -DSOLARIS} flag, remove the
      underscores  from the files {\tt sparc*.s}, remove the 
      {\tt ULONG\_NOT\_DEFINED} flag, and good luck!

      If during the compilation process the compiler or linker complains
      about an undefined function {\tt exp2} or {\tt log2}, you have a 
      defective math library. Either take a better one, or comment out
      the {\tt \#define HAVEEXP2} command in {\tt gencom.h}.
\bigskip
2) To install the PARI library so that it can be easily used from a user
   program, type {\tt make install}. This puts the executable gp in 
   {\tt /usr/local/bin}, the library in the directory {\tt /usr/local/lib}, 
   and the necessary include files in {\tt /usr/local/include/pari}, which is
   created if it does not already exist. If these directories do not suit your 
   installation, change the {\tt LIBDIR} or the {\tt INCLUDEDIR} in the
   Makefile. You can install separately the library and gp by using the targets
   {\tt install-lib} and {\tt install-bin}.
\bigskip
3) Once installed, to link to the PARI library just add {\tt -lpari -lm} in 
   your link command and {\tt -I/usr/local/include/pari} to your compilation
   commands. A sample makefile ({\tt Makesimple}) is given for gp itself.
   All modifications made to the Makefile should of course be made on the
   Makesimple file.
\bigskip
4) If you want to use gp under GNU Emacs (see section 3.11 of the user's
   guide) change the pathnames in the file {\tt pari.el} to suit your 
   installation, and read the file {\tt pari.txt}. If you are familiar with
   Emacs, we strongly suggest that you do so.
\bigskip
5) If you want to get rid of your {\tt .o} files and the created binaries in 
   the working directory, type {\tt make clean}.
\bigskip
6) For the example of section 4.3 of the user's guide, type {\tt make}
   in the directory {\tt 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.
\bigskip
7) To print the user's guide, go in the {\tt doc} directory and type 
   {\tt make}. This will automatically create a file {\tt users.dvi} 
   containing the manual with a table of contents and an index in two passes. 
   You must then send the {\tt users.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 {\tt \bs input tutorial} in the file {\tt users.tex}.
\bigskip
8) Send bugs, comments, etc. to:

\centerline{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.
\bigskip
9) Good luck and enjoy!


\vfill\eject
