INSTALLATION 
============

Quick overview
==============
1/ Check that the file /etc/ld.so.conf contains a line 
/usr/local/lib
if not edit the file as root and add this line
2/ Get and install GMP, FLTK 1.2.x,
FLVW and readline, optionnaly GSL if you want to do numerical stuff, 
PARI for advanced arithmetic (see patch below), NTL for fast polynomial (see 
configuration compatible with giac below).
Look at the prerequisites section for download addresses and instructions.
3/ Run ldconfig as root to insure the newly installed library are recognized
on your system
4/ Go in the giac directory 
If you want a quick compilation, type respectively for tcsh or bash
  $ setenv CXXFLAGS -g
  $ export CXXFLAGS=-g
then
  $ ./configure
  $ make
become root
  # make install
  # ldconfig
* Enjoy!

Prerequisites
=============
* If you want to cross-compile for the ARM architecture look also at
the file src/README.ipaq
* You must first check that you have installed GMP (available at any GNU ftp
mirror site, see www.gnu.org, for example in France try ftp.lip6.fr)
* If you want numerical functions you should install the Gnu Scientific 
Library (http://sources.redhat.com/gsl)
* If you want long float support, get MPFR at www.mpfr.org
* If you want to use NTL, get version >= 5.2 at http://www.shoup.net, 
check that you configured with namespace enabled (this is not the
default) and with GMP enabled (not the default, but this is not mandatory)
If you are not sure of your install go in the NTL directory and type
$ make clean
$ ./configure NTL_GMP_LIP=on NTL_STD_CXX=on
$ make
$ make install
* If you want advanced arithmetic functions, get PARI at
http://www.parigp-home.de
Make the following change in src/basemath/polarit2.c
Replace inflate by pari_inflate (2 occurences), and deflate by pari_deflate
Additionnaly, if you plan to use PARI WITHOUT NTL then you MUST MAKE THE
FOLLOWING PATCHES in the PARI source directory
File src/basemath/polarit2.c remove the word static from the declaration
static GEN 
combine_factors(...)
File src/headers/paridecl.h
Add 
GEN     combine_factors(GEN a, GEN famod, GEN p, long klim, long hint);
in the polarit2.c section
Recompile (make all) and reinstall PARI (make install and check that 
libpari.a has been updated or copy it explicitely from the O<os> directory)
Replace in /usr/local/include/pari/pariinl.h labs by (arg>0?arg:-arg) 
otherwise you might get compiler errors or copy this file pariinl.h.
Check in the giac src directory, file pari.cc that the memory allocated
to the PARI stack suit your needs (default is 10M of RAM) or modify
  long pari_mem_size=10000000;
* If you want GUI support, check that you have FLTK 1.1.x installed 
(available at http://www.fltk.org). For the spreadsheet/matrixwriter
you need FLVW available at http://flvw.sourceforge.net/ and you must
make some changes in FLVW source:
  friend -> friend class in declaration in FL/Flv_Style.H
  commented #define fl_inactive inactive in FL/Flv_List.H (should be in 
reversed order?)
  changes in src/Flv_List.cxx, lines 393, 401, 409, add && x>=X && x<=X+W
to the tests, otherwise the scrollbar do not work properly.
  added -lfltk to makeinclude
* TeXmacs may be used as an interface for giac. 
If you have TeXmacs installed (www.texmacs.org), after installing giac, 
run texmacs and use Insert->Session->giac.
If you copy Init.scm in your ~/.TeXmacs/progs directory you will get
a Cas menu for giac.
* If you want garbage collection, get the gc library
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
Then remove all libraries from config.h except gmp (see config.h.gc), 
add #define HAVE_LIBGC 1
replace malloc/realloc in input_parser.cc/input_lexer.cc with
GC_MALLOC_UNCOLLECTABLE and GC_realloc
rm -f *.o and look at Makefile.fast for the cas2 target

INSTALLATION (UNIX)
===================
Like with any autoconfiguring GNU software, you can type this:

 $ ./configure 
[add options as needed: try ./configure -help for option info, see 
section INSTALLATION OPTIONS below]
 $ make
 $ make check
[become root if necessary]
 # make install-strip

Alternatives or tips:
--------------------
** If you are updating giac for bug fixes, you can run 
  $ ./config.status 
instead of ./configure, this will keep the same configuration options

** If you don't want optimizations, set the environment variable CXXFLAGS
to -g before calling configure
(tcsh) setenv CXXFLAGS -g
(bash) CXXFLAGS=-g

** If you just want to build xcas,
 $ ./configure 
 $ cd src
 $ make -f Makefile.fast
Replace -g by -O2 in Makefile.fast if you want full optimizations.

** If you want to build xcas for the iPaq with the Linux familiar distribution
assuming you have the skiff toolchain installed and FLTK installed.
Check that config.h defines HAVE_LIBFLTK and does not define HAVE_LIBGSL
and HAVE_LIBGSLCBLAS unless you have these libraries too, then
 $ make -f Makefile.ipaq
Note that I never succeded to build with optimization for the iPaq.

** If you want the commandline cas only run 
 $ ./configure --disable-gui
 $ make

INSTALLATION (WIN)
==================
There is some support for those who must use Microsoft Windows (R). 
Assuming you have the cygwin tools, gmp, FLTK, FLVW installed (see 
http://sources.redhat.com/cygwin for cygwin, any GNU mirror for gmp e.g. 
ftp://ftp.lip6.fr:/pub/gnu, http://www.fltk.org for FLTK, configure
FLTK with ./configure --enable-cygwin), run cygwin,
go in the giac-0.4.0 directory and run 
$ ./configure
$ make
$ make install
As usual, before these steps do
$ export CXXFLAGS=-g
if you want a faster compilation
Alternatively you can
$ cp config.h.win config.h
or edit config.h and modify to suit your needs, then
go in the src directory and run
$ make -f Makefile.win
After that, you may run xcas.exe standalone, provided /usr/bin/cygwin1.dll
has been copied in the path (e.g. in the same directory as xcas.exe)
You should be able to compile the library version of giac like under Unix using
$ sh configure ; make 

INSTALLATION (MACOSX)
=====================
The first Carbon port for Mac OS X was done by Jean-Yves Avenard.
See the file README.MACOSX for info on compiling the required libraries.
Once the libraries are installed, run
tcsh mkosx

TROUBLESHOOTING
===============
* Cygwin: error when compiling sym2poly.cc
... sys/types.h ... does not define anything 
Remove the #undef off_t lines from config.h.in and #define lines from config.h
* If you get an error about libtool not found when running make, run
  $ ./ltconfig ltmain.sh
* If you have recently installed a library and this lib seems not to be 
recognized, type
  $ rm config.cache
before running configure
* Optimization requires much memory for compilation. If you are low in memory
edit src/Makefile and if necessary replace the line :
CXXFLAGS = -g -O2
by :
CXXFLAGS = -g
* If you get an error like
autoheader: Symbol 'CONSTANT_DEBUG_SUPPORT' is not covered by ...
run
autoheader --localdir=.
* If you get error when compiling modpoly.cc, it's most certainly because
you compiled NTL without namespaces. Recompile it (see Prerequisites section
above)
* If you get a linker error about combine_factors not found in modfactor.o
it's because you did not modify PARI correctly or forgot to re-install the
PARI libraries
* Cygwin compilation of Giac with PARI 2.1.1 requires you to make
some hand work. I could not get the dynamic version of PARI library.
Therefore I had to do the install by hand
cp libpari.a /usr/local/lib
mkdir /usr/local/include/pari
cp src/headers/*.h /usr/local/include/pari 
cp Ocygwin/*.h /usr/local/include/pari 
Then I got an error compiling pari.cc that dispeared by commenting
the offending line in the header /usr/local/include/pari/paricom.h
After that all went OK.
* If your cygwin installation lacks internationalization support (you will
get errors about #include <libintl.h> in plotfltk.h)
you must modify xcas.fl to remove internationalization support, run
fluid xcas.fl
menu Edit->Preferences, deselect gettext and choose None
(The program fluid.exe should be in your fltk-1.0.x source directory, in the 
fluid subdirectory)
Then edit plotfltk.h and comment 
#include <locale.h>
#include <libintl.h>
as well as the object_bidon class definition
Edit plotfltk.cc and comment
   objet_bidon mon_objet_bidon;

DOC
===
 If you want some documentation, go in the doc directory
 $ cd doc
 and type

 $ make dvi

REMARKS
=======
At the end of the compilation, you should have:
* xcas, cas, aide (programs) in /usr/local/bin
* the libgiac libraries in /usr/local/lib 
* the include files in /usr/local/include/giac
* the on-line help file /usr/local/share/aide.cas

INSTALLATION OPTIONS
====================
When you run 
./configure 
the following options are recognized
1/ --enable-debug
  Allow vecteurs printing and add some debugging code
2/ --enable-fltk
  GUI support
3/ --enable-gsl
  Use the Gnu Scientific Library for floating point (e.g. special functions..)
4/ --enable-sscl
  Allow inclusion of code for semi-classical algorithms (Moyal product, ...)
  Not available yet
5/ --enable-ntl
  Allow inclusion of NTL code
6/ --enable-pari
  Allow inclusion of PARI code
These options can be turned off using --disable-option-name instead of 
--enable-option-name. By default configure will use these options if
the libraries are available on your system
For full speed binaries do (bash)
$ export CXXFLAGS="-O3 -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2"
or (tcsh)
$ setenv CXXFLAGS "-O3 -fexpensive-optimizations -malign-loops=2 -malign-jumps=2 -malign-functions=2"
Be sure to configure with no debug support (default) and compile statically.
