#
4 Compilation

VIEWMOL 2.4.1 has been written in C. For compilation of VIEWMOL you need a C compiler. TIFF files are supported by the freely available TIFF library which is also necessary to compile the program. It can be found on many ftp sites, e. g. at `ftp://ftp.remotesensing.org/pub/libtiff/`. PNG files are supported by the freely available PNG library which is also necessary to compile the program. It can be found at `http://libpng.sourceforge.net/`. If you want to link VIEWMOL with Mesa instead of with OpenGL you will need Mesa (`http://www.mesa3d.org/`).

Linux users need Motif to compile and run the program (if the program complains about ```viewmol: can't load library 'libXm.so.1'`" Motif is missing). Motif is available from `http://www.motifzone.org/download/`. The Motif clone Lesstif (`http://www.lesstif.org/`) can be used with Viewmol starting with version 0.81. There are, however, some glitches with Lesstif (e. g. shortcuts don't work).

If you want to recompile the program and you are running one of the supported operating systems you may type `make`. The shell script `getmachine` determines the operating system you are running and sets some options for the compiler. If this does not work you should have a look into the `Makefile`. The options set are explained there. They are the following:

- `OPT`
  The optimization flag for your compiler (on Linux `-O6 -mcpu=X` where `X` may be `pentium` or `pentiumpro`; `-O2` otherwise).
- `CFLAGS`
  Additional flags for C compiler, used to handle special optimizations and some incompatibilities between different Unix versions.
- `LDFLAGS`
  Additional flags needed for linker, currently only used for SGI to distinguish between different library versions.
- `INCLUDE`
  The path to the include files. This is set to point to the include files for libtiff, libpng, and Python (the script asks the user for these paths at the beginning, there is really no need to change anything in the file here).
- `LIBRARY`
  The path to the additional libraries required. These are libtiff, libpng, and the Python library (the script asks the user for these paths at the beginning, there is really no need to change anything in the file here).
- `LIBS`
  The libraries needed to link VIEWMOL. They may differ between different operating systems.

The `getmachine` shell script will ask you for the path names to the TIFF, PNG and Python libraries and to the include files necessary with these libraries. You may specify these path names using environment variables if you put the name of the variable in parentheses (e. g. `$(HOME)`). These path names are assigned to the `LIBTIFF`, `TIFFINCLUDE`, `LIBPNG`, `PNGINCLUDE`, `PYTHONINCLUDE`, and `LIBPYTHON` flags and stored in a file `.config.<OS>` where `<OS>` is the output of the `uname -s` command on your machine. If this file already exists, `getmachine` does not ask for these path names.

Silicon Graphics compilers on 64-bit operating systems (IRIX64 - R8000, R10000, R12000) will produce a lot of warning messages concerning casts of pointers to integers. These can be safely ignored.

The make procedure will build the program in a directory whose name depends on the operating system and type of CPU you are using. You will find all executables in this directory. After compilation follow the steps under Installation to complete the installation. If you have compiled VIEWMOL yourself it is recommended that you use the included test scripts to ensure VIEWMOL is functioning correctly (cf. p. ).