# Compiling the IMAP Server

Once you have unpacked the files by extracting the tar archive, "`cd`" to the "`cyrus-imapd-NNNN`" directory where NNNN is the version number. The configuration files and various subdirectories are stored there. In the directory that the `configure` file is in, type "`./configure`" to configure the software. Please continue to read this document as there are switches to `./configure` that may apply to you.

## `configure` Overview

The "`configure`" shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a "`Makefile`" in each directory of the package. Finally, it creates a shell script "`config.status`" that you can run in the future to recreate the current configuration, a file "`config.cache`" that saves the results of its tests to speed up reconfiguring, and a file "`config.log`" containing compiler output (useful mainly for debugging "`configure`").

Running "`configure`" takes awhile. While running, it prints some messages telling which features it is checking for.

You can compile the package in a different directory from the one containing the source code. Doing so allows you to compile it on more than one kind of computer at the same time. To do this, you must use a version of "`make`" that supports the "`VPATH`" variable, such as GNU "`make`". "`cd`" to the directory where you want the object files and executables to go and run the "`configure`" script. "`configure`" automatically checks for the source code in the directory that "`configure`" is in and in "`..`".

By default, "`make install`" will install files (other than server-specific programs) in "`/usr/local/bin`", "`/usr/local/man`", etc. You can specify an installation prefix other than "`/usr/local`" by giving "`configure`" the option "`--prefix=PATH`".

You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give "`configure`" the option "`--exec-prefix=PATH`", the package will use `PATH` as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix.

By default, "`make install`" will install the server-specific programs in "`/usr/cyrus/bin`". You can specify a server-specific installation prefix other than "`/usr/cyrus`" by giving "`configure`" the option "`--with-cyrus-prefix=PATH`".

## Options to `configure`

Here are a list of switches that can be used with "`configure`".

`--help`
  Print a summary of the options to "`configure`", and exit.

`--with-krb=PATH`
  Specifies where to find the Kerberos library.

`--with-com_err=PATH`
  Specifies where to find the com_err environment.

`--with-cyrus-group=USER`
  Specifies the group used for installing setguid programs. By default, configure uses "`mail`".

`--with-cyrus-prefix=PATH`
  Change the location of the server software. By default, the `cyrus-prefix` is `/usr/cyrus`.

`--with-cyrus-user=USER`
  Specifies the userid that the Cyrus IMAP server will run as. By default, configure uses "`cyrus`".

`--with-dbdir=PATH`
  Specifies where to find the Berkeley DB library.

`--with-duplicate-db=DB`
  Specifies which database backend to use for the duplicate delivery database. By default, configure uses "`berkeley_nosync`".

`--with-mboxlist-db=DB`
  Specifies which database backend to use for the mailbox list. By default, configure uses "`berkeley`".

`--with-seen-db=DB`
  Specifies which database backend to use for the seen state. By default, configure uses "`flat`".

`--with-subs-db=DB`
  Specifies which database backend to use for the subscriptions list. By default, configure uses "`flat`".

`--with-tls-db=DB`
  Specifies which database backend to use for the TLS cache. By default, configure uses "`berkeley_nosync`".

`--with-idle=METHOD`
  Specifies the IMAP IDLE method to use. Currently implemented IDLE methods are:
  `idled`
    Use the IDLE daemon. The IDLE daemon listens on a UNIX socket for messages from lmtpd/imapd/pop3d that a mailbox has been updated. The daemon then signals those (if any) imapd that are idling on the mailbox to check for the changes.
  `poll`
    Periodically poll the mailbox for changes.
  `no`
    Disable IMAP IDLE.
  By default, configure uses "`poll`".

`--with-lock=METHOD`
  Specifies the locking method to use. Currently implemented locking methods are:
  `flock`
    `flock()` locking
  `fcntl`
    `fcntl()` locking
  By default, configure uses "`fcntl`" if the "`fcntl()`" function exists, "`flock`" otherwise.

`--with-openssl=PATH`
  Specifies where to find the OpenSSL library.

`--with-egd-socket=FILE`
  Specifies which socket to use to connect to the Entropy Gathering Daemon.

`--with-perl=PATH`
  Specifies where to find the Perl binary (full path, including name of binary).

`--with-sasl=PATH`
  Specifies the path to the directories containing the library (`.../lib`) and include (`.../include`) files for libsasl.

`--with-statedir=PATH`
  Specifies the directory used for communicating with various daemons. By default, configure uses "`/var`".

`--with-libwrap=PATH`
  Specifies where to find the TCP wrappers library.

`--with-ucdsnmp=PATH`
  Specifies where to find the SNMP library.

`--with-zephyr=PATH`
  Specifies where to find the Zephyr library (for notifyd).

`--enable-listext`
  Enables support for LISTEXT extension.

`--enable-murder`
  Enables support for IMAP Murder.

`--disable-sieve`
  By default, Sieve support is enabled. Use `--disable-sieve` to disable compiling the Sieve library and to disable all Sieve support.

`--disable-cyradm`
  Do not compile the `cyradm` administrative client.

`--disable-server`
  Do not compile the IMAP server programs.

Run `configure --help` for further configuration options.

Some systems require unusual options for compilation or linking that the "`configure`" script does not know about. You can give "`configure`" initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this:

       CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure

Or on systems that have the "`env`" program, you can do it like this:

       env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

The "`make`" variables that you might want to override with environment variables when running "`configure`" are:

`CC`
  C compiler program.
  Default is "`cc`", or "`gcc`" if "`gcc`" is in your `PATH`.
  (For "`CC`", any value given in the environment overrides the value that "`configure`" would choose.)
`CFLAGS`
  Debugging and optimization options for the C compiler.
`CPPFLAGS`
  Header file search directory ("`-IDIR`") and any other miscellaneous options for the C preprocessor and compiler. If it is not set in the environment when "`configure`" runs, the default value is empty.
`LDFLAGS`
  Stripping ("`-s`") and any other miscellaneous options for the linker. If it is not set in the environment when "`configure`" runs, the default value is empty.
`DEFS`
  Configuration options, in the form "`-Dfoo -Dbar ...`"
`LIBS`
  Libraries to link with, in the form "`-lfoo -lbar ...`"
  (For "`DEFS`" and "`LIBS`", any value given in the environment is added to the value that "`configure`" chooses.)

If you need to do unusual things to compile the package, we encourage you to figure out how "`configure`" could check whether to do them. After doing so, please send us a patch! Instructions for doing so can be found on the feedback page.

The file "`configure.ac`" is used as a template to create "`configure`" by a program called "`autoconf`". You will only need it if you want to regenerate "`configure`" using a newer version of "`autoconf`".

Once you have successfully run "`configure`", execute the following commands:

       make all CFLAGS=-O

If you want, you can override the "`make`" variables `CFLAGS` and `LDFLAGS` by entering the following:

       make all CFLAGS=-O2 LDFLAGS=-s

last modified: $Date: 2006/11/30 17:11:16 $