IT++ Installation
*****************

IT++ Requirements
=================

IT++ should compile without errors or warnings on most GNU/Linux systems, on
UNIX systems like Solaris SunOS, and on POSIX based environments for
Microsoft Windows like Cygwin or MinGW with MSYS. It can be also built on
Microsoft Windows NT/2000/XP using Microsoft's Visual C++ .NET, but our
support for this compiler is limited. For GNU/Linux, SunOS, Cygwin and MinGW
we assume that you have at least the following GNU software installed on your
computer:

  o GNU make, version 3.72.1 or later (check version with `make --version')
  o GCC - GNU Compilers Collection (gcc, g++ and g77 or gfortran), version
    3.3.x or later (check version with `gcc --version')

To perform tests, two command line programs: sed and diff are required.
Optionally, you might need a few additional programs, i.e. Doxygen, LaTeX,
Dvips and Ghostscript, to generate the HTML documentation.

We strongly recommend that you use recent stable releases of the GCC, if
possible. We do not actively work on supporting older versions of the GCC,
and they may therefore (without prior notice) become unsupported in future
releases of IT++.

In order to use all functionality provided by the IT++ library, it is
recommended that you have some external libraries compiled and installed in
your computer. The basic set of them is: BLAS, LAPACK and FFTW (version 3.0.0
or later). To improve some vector based operations a C interface of BLAS,
namely CBLAS, is also recommended.

Instead of NetLib's reference BLAS, CBLAS and LAPACK implementations, some
optimized platform-specific libraries can be used as well, i.e.:

  o ATLAS (Automatically Tuned Linear Algebra Software) - includes optimised
    BLAS, CBLAS and a limited set of LAPACK routines (version 3.6.0 or later)
  o MKL (Intel Math Kernel Library) - includes all required BLAS, CBLAS,
    LAPACK and FFT routines (version 8.0.0 or later; FFTW not required)
  o ACML (AMD Core Math Library) - includes BLAS, CBLAS, LAPACK and FFT
    routines (version 2.5.3 or later; FFTW not required)

It is possible to compile and use IT++ without these libraries, but the
functionality will be reduced. We therefore recommend that you take some time
and effort to provide these external libraries in your system. Please note,
that some of them (FFTW, BLAS and LAPACK) are usually included in the most
modern Linux distributions.


Obtaining the IT++ Source Codes
===============================

IT++ is released under the GNU General Public License (GPL) and hence the
source code of the IT++ library is available for free download. To obtain the
IT++ source code, visit the IT++ project page on SourceForge:

  o http://itpp.sourceforge.net/

and download the file named itpp-<VERSION>.tar.gz or itpp-<VERSION>.tar.bz2,
where <VERSION> is the latest release number, e.g. 3.9.0.


IT++ Configuration, Compilation and Installation
================================================

Assuming that you have already downloaded the latest IT++ sources, untar and
unpack the sources, and enter the unpacked directory. Depending on the
package type you have downloaded, use the following commands:

  % gzip -cd itpp-<VERSION>.tar.gz | tar xf -
  % cd itpp-<VERSION>

  % bzip2 -cd itpp-<VERSION>.tar.bz2 | tar xf -
  % cd itpp-<VERSION>

Since version 3.9.0, the IT++ library uses Autoconf/Automake tools for
configuration and Makefiles creation, so the compilation procedure resembles
a standard, well-known GNU method, i.e.

  % ./configure
  % make

The `configure' command can be invoked with additional switches and options
(run `./configure --help' to get a list of them). The most important are:

  o `--prefix=PREFIX' - set top installation directory to a certain PREFIX
    value. By default it is set to `/usr/local', so `make install' will
    install appropriate files into `/usr/local/include', `/usr/local/lib`,
    etc.
  o `--enable-debug' - build an extra library named `libitpp_debug.*' using
    special debugging flags for compiler and linker (disabled by default)
  o `--enable-exceptions' - enable exceptions handling of run-time errors
    instead of aborting the program (disabled by default)
  o `--disable-html-doc' - do not generate and install the HTML documentation
    (enabled by default)
  o `--disable-shared' - do not build the shared version of the library
    (enabled by default for non Windows based platforms)
  o `--disable-static' - do not build the static version of the library
    (enabled by default for Windows based platforms)

Plese note that each `--enable-<OPTION>' switch can be replaced with its
opposite switch `--disable-<OPTION>'.

By default, the `configure' script checks for a few external libraries, which
might be used by the IT++ library (cf. IT++ Requirements). BLAS and LAPACK
libraries require a fortran compiler for linking. Therefore, if no fortran
compiler can be found, only some FFT library is searched. Otherwise, the
detection procedure is as follows:

 1. First, the presence of a BLAS library among the MKL, ACML, ATLAS and
    NetLib's reference BLAS is checked. If one of the above mentioned can be
    used, HAVE_BLAS is defined.
 2. If the BLAS library can be found, the C interface of BLAS, namely CBLAS,
    is detected. The CBLAS is provided by default by the MKL, ATLAS and
    NetLib's reference CBLAS libraries. The ACML has also a C interface of
    BLAS, which can be used, but it is not compatible with the standard
    CBLAS. On success, HAVE_CBLAS is defined.
 3. Next, some LAPACK library is searched, but only if a BLAS library is
    available. Full set of LAPACK routines can be found in the MKL, ACML and
    NetLib's reference LAPACK libraries. Besides, the ATLAS contains a subset
    of optimised LAPACK routines, which can be used with NetLib's LAPACK
    library (this is described in the ATLAS documentation). If a LAPACK
    library can be found, HAVE_LAPACK is defined.
 4. Finally, a set of separate checks for some FFT library is executed.
    Currently three different libraries providing FFT/IFFT routines can be
    used: MKL, ACML and FFTW. If at least one of them is found, HAVE_FFT id
    defined. Besides, one of the following: HAVE_FFT_MKL8, HAVE_FFT_ACML or
    HAVE_FFTW3 is defined.

If some external libraries are installed in a non-standard location in your
system, e.g. MKL in `/opt/intel/mkl/8.0.1', the `configure' script will not
detect them automatically. In such a case, you should use LDFLAGS and
CPPFLAGS environment variables to define additional directories to be
searched for libraries (LDFLAGS) and include files (CPPFLAGS). For instance,
to configure IT++ to link to the MKL 8.0.1 external library, which is
installed in `/opt/intel/mkl/8.0.1' directory, you should use the following
commands:

  % export LDFLAGS="-L/opt/intel/mkl/8.0.1/lib/32"
  % export CPPFLAGS="-I/opt/intel/mkl/8.0.1/include"
  % ./configure

In the case that external libraries have non-standard names, e.g.
`libcblas-3.a' for CBLAS, you might specify them to the configure using
`--with-<LIBNAME>' switches, where <LIBNAME> is one of the following: `blas',
`cblas', `lapack' or `fft'. You might use more then one library names by
quoting them with doublequotes, e.g.

  % ./configure --with-blas="-latlas -lblas"

If there is only one library specified, you can use a simplified notation
without the preceding `-l', e.g. `--with-fft=fftw3' instead of `--with-fftw=
-lfftw3'.

Although it is not recommended, you can intentionally prevent detection of
some external libraries. To do this you should use `--without-<LIBNAME>' or
`--with-<LIBNAME>=no', e.g.:

  % ./configure --without-cblas --without-lapack

It is recommended to set CXXFLAGS environment variable with some compiler-
and platform-specific optimisation flags before invoking the `configure'
command. For example, in the case of using the Intel Pentium 4 processor one
might employ the following flags:

  % CXXFLAGS="-O3 -pipe -march=pentium4" ./configure

In the case of Sun's UltraSPARC 64-bit platform and GCC compiler, the flags
might be set as follows:

  % export CXXFLAGS="-O3 -pipe -mcpu=v9 -m64"
  % ./confiugre

If CXXFLAGS is not set in the environment, it will be initialised with the
default flags, i.e. "-O3 -pipe".

When the configuration process is finished, a status message is displayed.
For instance, after having invoked the following configuration command on a
recent Gentoo Linux system:

  % ./configure --with-blas="-lblas"

one can observe something like this:

------------------------------------------------------------------------------
itpp-3.10.7 library configuration:
------------------------------------------------------------------------------

Directories:
  - prefix ......... : /usr/local
  - exec_prefix .... : ${prefix}
  - includedir ..... : ${prefix}/include
  - libdir ......... : ${exec_prefix}/lib
  - docdir ......... : ${prefix}/share/doc/itpp-3.10.7

Switches:
  - debug .......... : no
  - exceptions ..... : no
  - html-doc ....... : yes
  - shared ......... : yes
  - static ......... : no

Documentation tools:
  - doxygen ........ : yes
  - latex .......... : yes
  - dvips .......... : yes
  - ghostscript .... : yes

Testing tools:
  - diff ........... : yes
  - sed ............ : yes

External libs:
  - BLAS ........... : yes
    * MKL .......... : no
    * ACML ......... : no
    * ATLAS ........ : no
  - CBLAS .......... : yes
  - LAPACK ......... : yes
  - FFT ............ : yes
    * MKL .......... : no
    * ACML ......... : no
    * FFTW ......... : yes

Compiler/linker flags/libs/defs:
  - CXX ............ : g++
  - F77 ............ : gfortran
  - CXXFLAGS ....... : -DASSERT_LEVEL=1 -O3 -pipe
  - CXXFLAGS_DEBUG . :
  - CPPFLAGS ....... :
  - LDFLAGS ........ :
  - LIBS ........... : -lfftw3 -llapack -lcblas -lblas -lgfortran

------------------------------------------------------------------------------
Now type 'make && make install' to build and install itpp-3.10.7 library
------------------------------------------------------------------------------


Now, it is time for compiling and linking the IT++ library. To do so, please
simply run the following command:

  % make

IT++ should compile without any errors or warnings. If this is not the case,
please submit a bug-report on the IT++ project page at SourceForge. Please
include information about your OS, compiler version, external libraries and
their versions, etc.

It is recommended that you check if your library has been compiled and linked
properly and works as expected. To do so, you should execute the testing
process:

  % make check

As a result, you should obtain a similar report:

------------------------------------------------------------------------------
Test `array_test' PASSED.
------------------------------------------------------------------------------
Test `bessel_test' PASSED.
------------------------------------------------------------------------------

[...]

------------------------------------------------------------------------------
Test `reedsolomon_test' PASSED.
------------------------------------------------------------------------------
Test `turbo_test' PASSED.
------------------------------------------------------------------------------
Test `fix_test' PASSED.
------------------------------------------------------------------------------

Check if all the executed tests PASSED. If not, please contact us by filling
a bug-report.

Finally, you should install the compiled and linked library, include files
and (optionally) HTML documentation by typing:

  % make install

Depending on the PREFIX settings during configuration, you might need the
root (administrator) access to perform this step.

Eventually, you might invoke the following command

  % make clean

to remove all files created during compilation process, or even

  % make distclean

to remove all files generated by the `configure' script.
