

1- PREREQUISITES
================

DjVuLibre-3.5 relies on various components available from the web.  
Most recent Linux distribution already come with these.  
You can also download and compile them if you wish.

Be sure to read the system specific notes 
at the end of this file.


1.1 - C++ COMPILER
------------------

We strongly suggest to use the well known g++ compiler on all platforms.  You
need at least version gcc-2.91.66 (also known as egcs-1.1.2).  Development was
achieved using gcc-2.95.3, gcc-2.96-85, gcc-3.02, and gcc-3.2.2.

RedHat 7.x users should make sure they have the latest redhat updates of the
compiler.  Early versions of gcc-2.96 have serious bugs.  See
<http://www.redhat.com/support/errata/RHBA-2001-082.html>.


1.2 - LIBJPEG/LIBTIFF
---------------------

A small number of DjVu files internally use JPEG encoding instead 
of IW44 wavelet encoding.  These files are processed using either 
version 6a or 6b of the IJG libjpeg library <http://www.ijg.org>.  

Some utility programs are able to read TIFF files. These programs
rely on the LIBTIFF library <http://libtiff.org>.

You can also compile DjVuLibre with neither JPEG nor TIFF support.  
You might never notice the difference.


1.3 - THREADS
-------------

The DjVu viewer makes heavy use of multiple threads of execution.  Modern 
Unix operating systems come with the standardized Posix threads.  
DjVuLibre-3.5 fully supports detecting and using Posix threads.

For the sake of older operating systems, DjVuLibre-3.5 offers a custom
threading model called CoThreads.  This should be considered obsolete.


1.4 - MAKE
----------

There are various kind of "make" programs around with various capabilities.  
If you run into problems, get gnu-make !





2- COMPILE
==========

Chances are that everything will work by simply running 
commands "configure", "make" and "make install". 


2.1- CONFIGURE
-------------

Various options and environment variables affect the execution of the
configuration script.  A complete list can be obtained by typing 
"configure --help".  Here are the most important ones.

* Option "--prefix=PREFIXDIR"

  This option specifies where the DjVuLibre software will be installed.
  The default prefix is /usr/local.  

* Option "--enable-desktopfiles[=(yes|no)]"

  Installs the scripts 
   /usr/share/djvu/osi/desktop/register-djvu-mime 
  to setup the xdg mime type database and menu entries.

* Options "--with-extra-includes=DIR" 
      and "--with-extra-libraries=DIR"

  This option defines additional directories for 
  searching include files or libraries.

* Option "--with-jpeg=JPEGDIR"

  This option specifies a directory where the JPEG library has been
  compiled. This directory contains both the include files and the 
  library.  Without this option, the configuration script will search 
  the JPEG library in standard places.
  When everything else fails, you can simply define the environment
  variables JPEG_CFLAGS and JPEG_LIBS.

* Option "--with-tiff=TIFFDIR"

  This option specifies a directory where the LIBTIFF library has been
  compiled. This directory contains both the include files and the 
  library.  Without this option, the configuration script will search 
  the LIBTIFF library in standard places.
  When everything else fails, you can simply define the environment
  variables TIFF_CFLAGS and TIFF_LIBS.

* Option "--enable-threads=(posix|cothread)"

  This option specifies which threading model should be used.
  Without this option, the configuration script will first 
  try to detect how to use posix threads and fall back to cothreads.
  You can help the search process by defining environment
  variables PTHREAD_CFLAGS and PTHREAD_LIBS.

IMPORTANT: 

Always check the output of the configuration script for warnings and errors.
In particular, the configuration script might disable the compilation of
djview if it cannot locate the required libraries and utilities.  The warning
messages are the only way to know.



2.2- MAKE
---------

You can then perform the compilation by typing 

        $ make

The compilation can last a few minutes.  Again check the output for warnings
and errors.  Finally a brief message lets you know that the compilation was
successful.  You can then proceed with the installation.


2.2- INSTALL
------------

The installation procedure will:

- install the executable programs into "${prefix}/bin".
- possibly install the shared library "${prefix}/lib/libdjvulibre-3.5.so".
- install the man pages under "${prefix}/man or ${prefix}/share/man".
- install various ancillary files under "${prefix}/share/djvu".
- optionally install information files for desktop environments.

The where ${prefix} refers to the directory specified by the prefix option of
the configuration script.  The default prefix is /usr/local.

To perform the installation, simply type :

        $ make install

Of course you must have the appropriate permissions to 
perform the installation.  Chances are that you need to
be root to install something into /usr or /usr/local.

