# Building and Installation

## Compile-time Options

Alpine's UNIX build environment is based on Autotools (the GNU Build System). Once you've unpacked the source distribution find the file `configure` in the top-level directory. You may look at the many options available by typing

`./configure --help`

or you could just try building with the command

`./configure`

followed by

`make`

Note, while the UW IMAP Toolkit (whose c-client library Alpine uses for mailbox access) build is not based on Autotools, Alpine's configure script should set an appropriate make target and compilation options for most systems.

Some of the following can only be set when you build. Others, however, can be overridden by command-line flags to Alpine or settings in Alpine's user or system configuration files. Some of the options which can be set when building:

### Including LDAP Functionality

By default, the configure script will attempt to find the LDAP library support for you. If you are having trouble with LDAP take a look at the configure options

--with-ldap-dir=DIR
  Specify the root of the LDAP lib/include path.
--with-ldap-include-dir=DIR
  Specify the LDAP include path.
--with-ldap-lib-dir=DIR
  Specify the LDAP library path.
--without-ldap
  Disable LDAP support.

Alpine uses LDAPv3 protocol. When using the LDAPv3 protocol, the results are assumed to be in the UTF-8 character set, which Alpine handles well. If the LDAP server returns non-ascii data which is not encoded as UTF-8 you will probably run into problems.

### Including Kerberos 5 Functionality

This works analogously to the LDAP build. By default, the configure script will attempt to find the Kerberos library support for you. If you are having trouble with Kerberos take a look at the configure options

--with-krb5-dir=DIR
  Specify the root of the Kerberos lib/include path.
--with-krb5-include-dir=DIR
  Specify the Kerberos include path.
--with-krb5-lib-dir=DIR
  Specify the Kerberos library path.
--without-krb5
  Disable Kerberos support.

### Other Alpine Compile-time Options

--disable-nls
  Do not use Native Language Support. NLS refers to the use of GNU gettext utilities to localize a program, in the sense that English is translated to some other language. At the time this was written the low-level support for NSL is included in Alpine but no translations have been done. If there is no translation available, that means that disabling NLS will make no difference. If you have trouble building which is due to gettext or libintl you could try this option, or one of the following.
--with-libintl-prefix[=DIR]
--without-libintl-prefix
--with-ssl-dir=DIR
  Specify the root of the SSL lib/include path (OpenSSL).
--with-ssl-include-dir=DIR
  Specify the SSL include path.
--with-ssl-lib-dir=DIR
  Specify the SSL library path.
--with-ssl-certs-dir=DIR
  Specify the path to the SSL certificates directory.
--without-ssl
  Disable SSL support.
--without-pthread
  Do not test for nor build with POSIX thread support, which is used only for the Busy-Cue in the status line at this time.
--without-smime
  Disable S/MIME support.
--disable-debug
  Never create debug files.
--with-smtp-msa=PATH
  Local Mail Submission Agent (sendmail, by default).
--with-smtp-msa-flags=FLAGS
  MSA flags for SMTP on stdin/stdout (-bs -odb -oem).

There are many more options which you can see using the

`./configure --help`

command.

### IMAPd Compile-time Options

There are no options or settings required for the version of IMAPd distributed with Alpine. If you need to be doing more complex modifications to IMAP, then you should pick up the IMAP development package and work with that code. The developer's version of IMAP is available for anonymous ftp from `ftp.cac.washington.edu` in the directory `mail`. The file is called `imap.tar.Z`. Unless it has changed since Alpine was released, the directory `imap` in the Alpine distribution is the IMAP development package.

The c-client library has not been converted to use the GNU Build System's autotools. The Alpine configure script will try to correctly guess the arguments needed for the c-client make command and will build the library, but if you need to change anything you should take a look at `imap/docs/BUILD` for more detailed instructions.

## Building the Alpine Programs

You may have already compiled Alpine and tried it out. If so, great! If not, you should be able to do it without too much trouble by following these step-by-step instructions:

1. Make sure you're in the root of the Alpine source. When you type `ls` you should see the following files and directories (or something close to it):

       aclocal.m4    config.sub    imap        Makefile.am    packages  web
       alpine        configure     include     Makefile.in    pico
       build.bat     configure.ac  install-sh  mapi           pith
       build.cmd     contrib       LICENSE     missing        po
       config.guess  depcomp       ltmain.sh   mkinstalldirs  README
       config.rpath  doc           m4          NOTICE         VERSION

2. Give the command `./configure` Configure should grind away for a few minutes.

3. When configure is complete, give the command `make`. If make stops and asks

   `Do you want to build with IPv6 anyway? Type y or n please:`

   you should answer with a 'y'. The compiler should grind away for a few minutes. The Alpine binary will end up in `.../alpine/alpine` and the Pico and Pilot binaries in `.../pico/pico` and `.../pico/pilot`. Other binaries you may be interested in are `.../alpine/rpdump` and `.../alpine/rpload` and c-client binaries in the directories `.../imap/imapd`, `.../imap/ipopd`, `.../imap/mailutil`, and so on.

4. If you need to try again, make sure you're getting a clean start by giving the command `make clean`.

## Installing Alpine and Pico on UNIX Platforms

Installing Alpine and Pico is simple. You take the program files which you have just transferred or built and you move them to the correct directory on your system. Most often the binaries go in `/usr/local/bin` though sometimes they are placed in `/usr/bin`. All the help text is compiled into Alpine so there are no required auxiliary files. Instead of copying the binaries manually, you may use `make install` to install them.

There are three optional auxiliary files: `/usr/local/etc/pine.info`, `/usr/local/etc/alpine.conf`, and `/usr/local/etc/alpine.conf.fixed`. The file `pine.info` contains text on how to get further help on the local system. It is part of the help text for the main menu and should probably refer to the local help desk or the system administrator. If this file doesn't exist a generic version which suggests ``talking to the computer support staff at your site'' is shown. The file `alpine.conf` is used to set system-wide default configurations for Alpine. The file `alpine.conf.fixed` is also used to set system-wide default configurations for Alpine. The difference between these two files is that configuration variables set in the `alpine.conf.fixed` file may not normally be over-ridden by a user. See the section on Alpine Configuration later in this document for details about the `alpine.conf` and `alpine.conf.fixed` files.

## Installing PC-Alpine

The PC-Alpine distribution comes as a .zip file. To install, unzip the files to a directory where you would like the program to reside. Modern Windows versions come with the capability of unzipping .zip files. Failing that, you can use one of the many .zip file extractors out there. Following current Windows conventions, a common directory into which the files could be extracted would be `C:\Program Files\PC-Alpine\`.

Having extracted PC-Alpine's .zip file to the directory of choice, you can now run that directory's alpine.exe, which is the actual PC-Alpine program. For convenience, you could place shortcuts to it on the task bar, start menu, etc.

Upon first running PC-Alpine, you may be asked where you would like to access your Configuration file (called the pinerc). This is useful in accessing already existing configuration files, and it does not matter where this file gets created. If you are connecting to an IMAP server to access your email, it is also possible to store this Configuration data on that server, which facilitates accessing the same configuration from multiple machines (in fact, your configuration may have already been set up this way for use with other Alpine programs).

After having established the location of the configuration file, it may be necessary to specify a few configuration settings before reading or sending mail. You may be prompted for the following (which may also be edited from the (S)etup (C)onfig screen from the Main Menu):

- `Folder to open as inbox` (or inbox-path) - This can be an inbox residing on an IMAP or POP3 server, or one residing locally. An example of an INBOX for an IMAP server is: `{server.example.com}INBOX`.
- `User-id`, `Personal name`, and `host/domain`, which are to be used as your email address.
- `SMTP server to forward message` - You must enter your SMTP server before you can send any messages.

  At this point, you will be able to read and send email messages. There are, however, many more preferences that you can set in the Configuration screen.

  ## Installing IMAPd

  When the Alpine distribution is built on a UNIX system, the IMAP server binary, `imapd`, is compiled. Installing `imapd` requires placing the binary in the appropriate directory, usually `/usr/etc`, and adding entries to `/etc/services` and `/etc/inetd.conf` or their counterparts.

  Instead of including installation instructions here we'll just include a pointer to detailed instructions in the c-client distribution. Please take a look at the file `imap/docs/BUILD` in the source tree.

  ## Support Files and Environment Variables: UNIX Alpine

  This section lists the various files which Alpine uses which are not email folders. All of these are the default names of files, they may vary based on Alpine's configuration.
  /usr/local/etc/alpine.conf
    Pine's global configuration file.
  /usr/local/etc/alpine.conf.fixed
    Non-overridable global configuration file.
  /usr/local/etc/pine.info
    Local pointer to system administrator.
  ~/.pinerc
    Personal configuration file for each user.
  ~/.pinercex
    Personal exceptions configuration file for each user.
  ~/.addressbook
    Personal addressbook
  ~/.newsrc
    Personal USENET subscription list. This is shared with other newsreading programs.
  ~/.pine-debugX
    The files created for debugging Alpine problems. By default, there are 4 .pine-debug files kept at any time.
  ~/.signature
    A signature file which will be included in all outgoing email messages.
  ~/.pine-interrupted-mail
    The text of a message which was interrupted by some unexpected error which Alpine detected.
  ~/mail/postponed-msgs
    A folder of messages which the user chose to postpone.
  /etc/mailcap
    System-wide mail capabilities file. Only used if `$MAILCAPS` not set.
  ~/.mailcap
    Personal mail capabilities file. Combines with system-wide mailcap. Only used if `$MAILCAPS` not set.

  The location of the following support files may be controlled by variables in the personal or global Alpine configuration file: signature, addressbook and its index file, postponed messages, and newsrc.

  Unix Alpine uses the following environment variables:

  TERM
    Tells Alpine what kind of terminal is being used.
  DISPLAY
    Determines if Alpine will try to display IMAGE attachments.
  TMPDIR, TMP, or TEMP
    Specifies location of temporary storage area, first one set wins
  SHELL
    If not set, default is /bin/sh
  MAILCAPS
    A semicolon delimited list of path names to mailcap files.

  ## Support Files, Environment Variables, and Registry Settings: PC-Alpine

  This section lists the various files which PC-Alpine uses which are not normal mail folders. All of these are the default names of files, they may vary based on Alpine's configuration.

  $PINERC or <PineRC registry value> or $HOME\PINE\PINERC or <PINE.EXE dir>\PINERC
    Path to (required) personal configuration file.
  $PINERCEX or $HOME\PINE\PINERCEX or <PINE.EXE dir>\PINERCEX
    Path to personal exceptions configuration file.
  $PINECONF
    Path of optional global configuration file.
  <PINERC directory>\ADDRBOOK
    Personal addressbook
  <PINERC directory>\PINEDEBG.TXT
    Location of Alpine debug file.
  <PINERC directory>\MAILCAP and/or <PINE.EXE dir>\MAILCAP
    These paths are only used if $MAILCAPS not set.
  $HOME\NEWSRC or <PINERC directory>\NEWSRC
    Personal USENET subscription list. This may be shared with other newsreading programs.
  $HOME\MAIL\INTRUPTD
    The text of a message which was interrupted by some unexpected error which Alpine detected.
  $HOME\MAIL\POSTPOND
    A folder of messages which the user chose to postpone.

  Registry Values:

  HKEY_LOCAL_MACHINE\Software\University of Washington\Alpine\1.0
    Pinedir: The directory that contains the Alpine executable.
    PineEXE: The name of the Alpine executable (most commonly "alpine.exe").
  HKEY_CURRENT_USER\Software\University of Washington\Alpine\1.0
    PineRC: The path that points to the default pinerc to use.
  HKEY_LOCAL_MACHINE\Software\Clients\Mail\Alpine
    DLLPath: The path that points to Alpine's pmapi32.dll.
  HKLM\Software\Clients\Mail\Alpine\shell\open\command
    (Default): When set as the default mailer, this is the command that is run by external programs.
  HKLM\Software\Clients\Mail\Alpine\Protocols\Mailto\DefaultIcon
    (Default): This points to the icon to display in relation to Alpine's mailto URL rendering.
  HKLM\Software\Clients\Mail\Alpine\Protocols\Mailto\shell\open\command
    (Default): This value is the command that gets run by external programs when a mailto URL is run with PC-Alpine set as the default mailer.
  HKLM\Software\Clients\News\Alpine\shell\open\command
    (Default): When set as the default newsreader, this is the command that is run by external programs.
  HKLM\Software\Clients\News\Alpine\Protocols\news\DefaultIcon
    (Default): This points to the icon to display in relation to Alpine's news URL rendering.
  HKLM\Software\Clients\News\Alpine\Protocols\news\shell\open\command
    (Default): This value is the command that gets run by external programs when a news URL is run with Alpine set as the default newsreader.
  HKLM\Software\Clients\News\Alpine\Protocols\nntp\DefaultIcon
    (Default): This points to the icon to display in relation to Alpine's nntp URL rendering.
  HKLM\Software\Clients\News\Alpine\Protocols\nntp\shell\open\command
    (Default): This value is the command that gets run by external programs when a nntp URL is run with Alpine set as the default newsreader.

  Alpine's personal configuration file may be in the same directory as the executable, or if that is inconvenient because the executable is on a shared or read-only drive, then it can be in a file named by the `$PINERC` environment variable, or in `$HOME\ALPINE\PINERC`, where if not set, `$HOME` defaults to the root of the current working drive.

  Most of the other support files key off of the location of the `PINERC` file. However, in the case of the NEWSRC file, the path `$HOME\NEWSRC` is checked first. Also, the postponed messages and interrupted message folders are placed in the default folder collection, normally in the directory `$HOME\MAIL`.

  The location of the following support files may be controlled by variables in the personal or global Alpine configuration file: signature, addressbook (and its index file), postponed messages, and newsrc.

  PC-Alpine uses the following environment variables:

  PINERC
    Overrides default path to pinerc file.
  PINERCEX
    Overrides default path to personal exceptions configuration file.
  PINECONF
    Optional path to global Alpine config file.
  HOME
    If not set, Alpine uses the root of the current drive, e.g. C:
  TMPDIR, TMP, or TEMP
    Specifies location of temporary storage area, first one set wins
  COMSPEC
    Specifies shell for external commands.
  MAILCAPS
    A semicolon delimited list of path names to mailcap files.