Copyright 2009 Alberto Abad, Roberto Barrio, Fernando Blesa, Marcos Rodriguez
http://gme.unizar.es/software/tides
Contact: <tides@unizar.es>

This file is part of TIDES.

TIDES is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

TIDES is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with TIDES.  If not, see <http://www.gnu.org/licenses/>.

                          INSTALLING TIDES
                          ================

TIDES has two different parts (pieces of software): The Mathematica package
MathTIDES and the C library libTIDES.a

The preprocessor MathTIDES writes, automatically, the files containing the
code with the iterative scheme to obtain the taylor series of the variables.
These files, together with the library libTIDES.a, form the Taylor Series
Method integrator (TSM Integrator). The multiple precision version of the
integrator requires the library libmpfr.a.

                          INSTALLING MathTIDES
                          ====================

The preprocessor MathTIDES is written in Mathematica. To install MathTIDES
you need to copy the folder MathTIDES inside a directory that is in the $Path
of Mathematica. You can do it manually, or by opening the notebook
InstallMathTIDES.nb that make automatic the installation process following
the instructions of the notebook.

Run InstallMathTIDES.nb within Mathematica. It will copy the MathTIDES folder
to $BaseDirectory/Applications.

Once MathTIDES has been installed you can load the package by writing
<<MathTIDES` in a Mathematica Notebook.

                          INSTALLING GMP and MPFR
                          =======================

This is only necessary if you need to work with multiple precision.
By default the LibTIDES library uses GMP and MPFR libraries for multiple
precision computations, so you need to have both installed. Then, you must
install GMP and MPFR, in this order, if your system does not have them. You can
download GMP from http://www.gmplib.org and MPFR from http://www.mpfr.org. Then
you must uncompress them and run

./configure
make
make check
sudo make install

inside each of its directories.

                          INSTALLING libTIDES
                          ===================

The next installation procedure creates and installs LibTIDES in a Unix-like
environment.

To install LibTIDES you must uncompress it and run on the terminal the
following orders inside the installation directory

./configure
make
make check
sudo make install

1. How to compile and install libTIDES.a

First you need to run ./configure. Depending on where you installed GMP
and/or MPFR, you may need to specify its installation directories. For
example, if you put GMP in /usr/local, then you need to do the following:

./configure --with-gmp=/usr/local

If MPFR is also in a non-standard directory, you may have to do the same thing
with it:

./configure --with-gmp=/usr/local --with-mpfr=/usr/local

If you don't have GMP and/or MPFR installed, or you are not interested in
having multiple precision capacities in your program, pass the following option
to configure:

./configure --disable-multiple-precision

This will create the needed Makefiles to compile a reduced version of libTIDES
without the MPFR extensions.

By default, the library is installed in /usr/local. If you prefer another
installation directory, you have to specify it by adding the prefix option to
configure.

./configure --prefix=/user/local

By default the Fortran files of LibTIDES are created. If you do not have a
Fortran compiler or you do not plan to use the minimal Fortran version of TIDES
you may use the following configure option

./configure --disable-fortran

To build the library, type:

        make

This will create the complete library or only the double precision version of
the library depending on the options of configure.

Before to install LibTIDES it is useful to check the build library. To check
the build library (run the test files), type: 

        make check

This will perform some tests for the double and the multiple precision programs
when available.

If everything when OK, you can install it. Just type:

        sudo make install

If you have not administrator privileges take the library libTIDES.a created
on the TIDES directory and copy it on your desired directory. You can do the
same with the libraries GMP and MPFR. In this case you need too the header
files dp_tides.h, mp_tides.h and mpfr.h.

After this installation process, you will end with a library containing the
objects needed for the standard and multiple precision TIDES packages.

If you want to uninstall libTIDES, then you have to run:

        sudo make uninstall

and the library will be removed from the installed directory.

After installation of  LibTIDES it is useful to check the installed library. 
To check it, type: 

        make installcheck

This will perform some tests for the double and the multiple precision programs
when available.




                          TROUBLESHOOTING INSTALLATION
                          ============================

- Working with Mac OS X

Taking into account that Mac OS X is based on a Unix system you can install
LibTIDES on Mac OS X by following all the previous steps from the terminal,
and using the gcc compiler installed on Mac OS X with the Developer tools.

If you prefer to use XCode, instead of working from the terminal, follow the
previous steps except the order sudo make install. Then take the library
libTIDES.a and the header file dp_tides.h, and include it in your XCode
project. If you work with multiple precision do the same with MPFR and GMP
libraries.

- Working with Windows

The installation has been tested with MinGW and Msys. The GMP and
MPFR libraries are not installed, so you have to build and install them.
They will be installed at /usr/local, but Msys does not have it in the path,
so you have to use:

./configure --with-gmp=/usr/local --with-mpfr=/usr/local

to correctly create the Makefiles needed for building the liBTIDES library.

- Working with UNIX

If you use a recent distribution of Linux, you should have the MPFR and GMP
libraries already installed. Otherwise download and install them as indicated
above.