These instructions show how to build ProbABEL.

The ProbABEL manual (in .tex or .pdf format) also contains detailed
(complementary) instructions on how to obtain and install ProbABEL.

* Dependencies
** The Eigen library
   ProbABEL has one external dependency that has to be met before
   compilation will succeed: it depends on the Eigen library
   (http://eigen.tuxfamily.org) for fast matrix manipulation.

   Eigen v3.2.1 is distributed with the ProbABEL source code, so by
   default no extra steps are needed.

   Alternatively, on Debian/Ubuntu systems the Eigen library can be
   installed in the following way: apt-get install libeigen3-dev

   If you install the eigen library by hand (e.g. after downloading
   the files from the aforementioned website) you have to specify the
   location of the header files when running ./configure (see below):
./configure --with-eigen-include-path=/your/path/to/eigen The
   default for this option is /usr/include/eigen3. This is the
   directory in which files like Eigen/Dense and Eigen/Cholesky can be
   found. If ./configure cannot find the Eigen library it will say so.

** LaTeX dependencies
   In order to generate a PDF of the user manual, ProbABEL depends on
   a basic LaTeX installation with pdflatex. In order to build the
   documentation the following LaTeX packages need to be present:
   - inputenc
   - fontenc
   - textcomp
   - xcolor
   - verbatim
   - listings
   - titleref
   - amsmath
   - makeidx
   - hyperref
   - hypcap

   By default the ./configure script tries to find the pdflatex
   program. If it finds it the PDF manual will be built. To disable
   building of the PDF manual from LaTeX source run ./configure as
   follows:
./configure --disable-latex-doc
   This will also bypass the search for pdflatex.


* Compiling for Linux
  If you downloaded the source from SVN (this is not necessary when
  installing from the distributed .tar.gz file), run:
autoreconf -i
  to generate the ./configure script and some other files.

  Now, you are ready to compile and install the package. Run the
  following commands:
./configure
make
make check
make install

  This will install the binaries (palinear etc.) in /usr/local/bin/,
  the documentation in /usr/local/share/doc/probabel/, the
  probabel_config.cfg file in /usr/local/etc/, and the examples in
  /usr/local/share/ProbABEL/examples/.

  NOTE: make install will OVERWRITE any file with the same name if it
  already exists. By default the name of the probabel config file is
  probabel_config.cfg.example. For probabel to work please rename
  this file to probabel_config.cfg.

  To see additional options, run
./configure --help

  The most notable option is
./configure --prefix=/some/subdirectory
  to install ProbABEL in that subdirectory. Instead of using
  /usr/local/ as install root directory, it installs in /some/subdirectory.

  ProbABEL consists of three main programs: palinear, palogist and
  pacoxph. Building of each of these programs can be disabled by
  adding a --disable- option to configure, for example:
./configure --disable-palinear


* Options for developers
  Some default development compiler flags can be enabled by running
  configure like this:
./configure --enable-dev-options
  The actual development values of CXXFLAGS and CPPFLAGS can be seen in
  configure.ac or by adding --disable-silent-rules to ./configure. If
  you want to specify your own flags run configure like this:
CXXFLAGS="-O3 -Wextra" CPPFLAGS="-Wall" ./configure
  or later, during the make process:
make CXXFLAGS="-O3 -Wextra" CPPFLAGS="-Wall"

  To generate a .tar.gz package for distribution run:
./configure
make dist

  To test if all your changes to the source files will be packaged
  into the tar.gz file correctly (as well as several other basic
  checks) run
./configure
make distcheck
  This will try to build the project in a different (temporary)
  directory. Since it also runs ./configure in this build directory
  you may want to specify options to that configure run as well (the
  ones you specified when running ./configure earlier won't be
  "transmitted" to this run). This can be done as in the following
  example:
DISTCHECK_CONFIGURE_FLAGS="--disable-latex-doc" make distcheck

  To clean up all files generated by ./configure and make, run
make distclean

  Running
make uninstall
  will uninstall the files previously installed by 'make install'.


* Making packages for Linux distributions
  Instructions for creating a package for your favourite Linux
  distribution can be found in doc/packaging.txt


* Cross-compiling for Windows on Linux
  The following steps show how to compile 32bit windows binaries on a
  Linux machine.
  First, install the necessary MINGW32 packages. On Debian/Ubuntu this
  can be done in the following way:
apt-get install mingw32{-binutils,-runtime} gcc-mingw32
  For 64 bit windows install these packages:
apt-get install binutils-mingw-w64-i686 gcc-mingw-w64-base gcc-mingw-w64-i686 \
  mingw-w64-dev g++-mingw-w64 binutils-mingw-w64-x86-64 g++-mingw-w64-i686 \
  g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64

  Now the binaries can be compiled (I've added a prefix so that when
  running 'make install' the whole directory structure can be zipped
  easily):
./configure --host=i686-w64-mingw32 --build=i686-linux-gnu \
            --prefix=/tmp/PA --sysconfdir=/tmp/PA/ \
            --datarootdir=/tmp/PA --docdir=/tmp/PA/doc \
            CPPFLAGS="-DNDEBUG" \
            CFLAGS="-O2 -static-libgcc -static-libstdc++" \
            CXXFLAGS="-O2 -static-libgcc -static-libstdc++"

  The --host option sets the type of the host the programs will be run
  on, the --build option sets the type of machine you are building the
  package on (cf. the Autoconf manual:
  http://www.gnu.org/software/hello/manual/autoconf/Specifying-Target-Triplets.html). In
  this example I was using a 32bit Ubuntu install. For a 64 bit linux
  system this will be x86_64-linux-gnu. Note that the values for both
  these options can be derived from the names of the compiler
  executables, e.g. the gcc-mingw-w64 Debian package installs the
  following C++ compilers: /usr/bin/i686-w64-mingw32-c++ and
  /usr/bin/x86_64-w64-mingw32-c++.
  The --[somedir] options are used to make the directory structure as
  flat as possible so that we don't bother Windows users with
  subdirectories like 'share/' and 'etc/'.

  Now you can run
make
make install

  This creates the binaries pacoxph.exe, palinear.exe and
  palogist.exe (as well as the examples and documentation). The
  contents of /tmp/PA can then be zipped and distributed.
