# 6 Configuration And Compilation

Now, you need to decide where you are going to build the system. Let us assume that the Mozart sources are in `~/mozart`. We recommend that you then create a separate build directory; for example, on a Linux system you might call it `~/mozart-linux`. Then, from that directory you should invoke the `configure` file from the Mozart source distribution.

> `% mkdir ~/mozart-linux
> % cd ~/mozart-linux
> % ~/mozart/configure`

The configure script takes a long time to run and prints out a lot of information. If you are lucky, the script completes successfully and you can proceed directly with compilation:

> `% make`

Often, however, the configure script will fail and print out a message explaining what went wrong and possibly how to fix it. Most frequently the problem is either that (1) a library, tool, or include file cannot be found, (2) or the installed version is too old. There are many shell variables and command line options that can be used to parametrize the configuration process. They are described below.

## 6.1 Configuration

The `configure` script can be parametrized by (1) a site configuration file that provides values for certain shell variables, (2) by command line options which may override these values. We recommend that you create a site configuration file for Mozart since this is much easier than to remember what options to supply on the command line. For example create the file `~/mozart.config` and set the environment variable `CONFIG_SITE` prior to invoking the configure script:

> `setenv CONFIG_SITE ~/mozart.config`

Below, we always describe command line options and related configuration variables together. They are always displayed with their default value or implied setting. Other possible values are described in the text. If a default option is `--enable-foo` then you can supply `--disable-foo` to turn it off (and reciprocally). If the default value for a configuration variable `oz_enable_foo` is `yes`, then you can set it to `no` to turn it off.

### 6.1.1 General Parameters

`--prefix=/usr/local/oz` [option]
`prefix=/usr/local/oz` [variable]

  You can change the default installation directory to e. g. `~/mozart-install` using `--prefix=$HOME/mozart-install` or `prefix=$HOME/mozart-install`. The installation directory can also be overriden when invoking `make install` by supplying an overriding setting for the make variable `PREFIX` on the command line:

  > `% make install PREFIX=$HOME/mozart-install`

`--with-inc-dir=`d1`,...,`dn [option]
`oz_with_inc_dir=` [variable]

  When you configure and attempt to build the Mozart system, you may discover that some library or package is missing, or that the installed version is too old, or that it happens to be installed in a very strange place. In this case, it may be convenient to install up to date versions of such libraries and packages in a location of your own choosing. For example, if you configure and build a missing package using `--prefix=$HOME`, it will normally install its include files into `$HOME/include` and its libraries into `$HOME/lib`. In that case, when you configure Mozart, you could supply the argument:

  > `--with-inc-dir=$HOME/include`

  to indicate where to look first find additional include files. There are also specific options for specific packages, and they are documented later, but our experience is that putting everything in one extra location is much more convenient.

`--with-lib-dir=`d1`,...,`dn [option]
`oz_with_lib_dir=` [variable]

  Similar to the above, but for libraries.

### 6.1.2 Contributions

The ``contributions'' are not an intrinsic part of the Mozart distribution. Often they require that you install additional packages: for example the `gdbm` contribution requires that you install the gdbm package. Some have not yet been ported to Windows.

`--enable-contrib` [option]
`oz_enable_contrib=contrib` [variable]

  By default, the contributions are configured and built. You can completely omit them using `--disable-contrib` or `oz_enable_contrib=`

### 6.1.3 Documentation

Processing the documentation requires the contributions (Section 6.1.2). Also you need additional packages such as LaTeX, netpbm, ghostscript, and a very recent version of nsgmls.

`--enable-doc` [option]
`oz_enable_doc=doc` [variable]

  You can omit the documentation using `--disable-doc` or `oz_enable_doc=`

`--with-documents=D1,...,Dn` [option]
`--with-documents=all` [option]
`oz_doc_dirs=` [variable]

  Specify the documents to be automatically processed by recursing into their directories. The special value `all` indicates that all documents should be processed.

`--with-java-bin=DIR` [option]
`oz_java_bin=` [variable]

  directory where java executables and wrappers reside.

`--with-java-threads` [option]
`oz_java_threads=-green` [variable]

  select implementation of java threads.

`--enable-chm` [option]
`oz_enable_chm=no` [variable]

  Construct CHM table of contents files (for windows)

### 6.1.4 Emulator

The emulator has quite a few configuration parameters.

`--with-cxx=`c++-compiler [option]
`oz_with_cxx=`c++-compiler [variable]

  Overrides the default C++ compiler. Noone has ever needed this option (or lived to tell).

`--enable-warnings` [option]
`oz_enable_warnings=no` [variable]

  Enabling this option causes the C++ compiler to become frighteningly anal retentive and to print out all sorts of warnings.

`--enable-errors` [option]
`oz_enable_errors=no` [variable]

  When this option is enabled, every warning from the C++ compiler will cause the build process to fail. This is only really useful for the developers of the system.

`oz_copt_optimize="-O"` [variable]
`oz_copt_profile=-pg` [variable]
`oz_copt_debug="-g"` [variable]

  Compiler options to use when optimizing, profiling, and debugging respectively. Don't use these! See `--enable-opt` instead.

`--with-gmp=`DIR [option]
`oz_gmp_lib_dir=/usr/local/lib` [variable]
`oz_gmp_inc_dir=/usr/local/include` [variable]

  Mozart needs the GNU Multiple Precision Arithmetic Library also known as `gmp`. You can set the variables to point to the directories where the library and the `gmp.h` include file are to be found. The command line option can be used to set both variables to the same directory argument. However, see `--with-inc-dir` and `--with-lib-dir` for the more general method that we now recommend.

`--with-zlib=`DIR [option]
`oz_zlib_lib_dir=` [variable]
`oz_zlib_inc_dir=` [variable]

  Mozart needs `zlib`, the General Purpose Compression Library. The details are as above and we also recommend to use `--with-inc-dir` and `--with-lib-dir` instead.

`--without-ccmalloc` [option]

  Option `--with-ccmalloc` enables the use of the debugging malloc library. Only for developers.

`--enable-opt=no` [option]

  Select the optimization settings: `--enable-opt=yes` for maximum optimization, `--enable-opt=debug` for debugging the emulator, `--enable-opt=profile` for profiling, `--enable-opt=rsp` also for profiling, but only if you happen to be Ralf Scheidhauer.

  With `yes`, the emulator becomes marginally faster at the expense of greater compilation times (you might want to go out for coffee while compiling `emulate.cc`, which contains the bytecode emulation loop). With `debug`, the emulator itself becomes much slower as there are no optimizations, no in-lining, and zillions of assertions are constantly being checked.

`--enable-threaded` [option]
`oz_enable_threaded=yes` [variable]

  By default, the emulator uses threaded byte code if possible, unless `--enable-opt=debug`. Turning this off would be foolish.

`--enable-fastreg` [option]
`oz_enable_fastreg=yes` [variable]

  By default, the emulator uses fast register access.

`--enable-regopt` [option]
`oz_enable_regopt=yes` [variable]

  By default, the emulator uses register optimization.

`--enable-modules-static=no` [option]
`oz_enable_modules_static=no` [variable]

  By default, all boot modules are linked dynamically. Setting this variable to `yes` will link them statically. You should only do this if DLLs cannot be made to work on your platform.

`--with-malloc=`FILE [option]
`oz_malloc_obj=`FILE [variable]

  Use this option to link with the malloc function in object file FILE. This can be useful if your system malloc is broken. This option is overriden by `--with-ccmalloc`.

`--enable-virtualsites` [option]
`oz_enable_virtualsites=`YESORNO [variable]

  Whether to enable support for virtual sites. The default depends on whether virtual sites can be supported on your platform, i. e. it depends on support for shared memory.