If you do not have the University of Washington's IMAP c-client installed on your system, you will need to download the c-client source distribution (http://www.washington.edu/imap/) and compile it. Asterisk supports the 2007 version of c-client as there appears to be issues with older versions which cause Asterisk to crash in certain scenarios. It is highly recommended that you utilize a current version of the c-client libraries. Additionally, mail_expunge_full is enabled in the 2006 and later versions.
Note that Asterisk only uses the 'c-client' portion of the UW IMAP toolkit, but building it also builds an IMAP server and various other utilities. Because of this, the build instructions for the IMAP toolkit are somewhat complicated and can lead to confusion about what is needed.
If you are going to be connecting Asterisk to an existing IMAP server, then you don't need to care about the server or utilities in the IMAP toolkit at all. If you want to also install the UW IMAPD server, that is outside the scope of this document.
Building the c-client library is fairly straightforward; for example, on a Debian system there are two possibilities:
$ make slx SSLTYPE=none
$ make slx EXTRACFLAGS="-I/usr/include/openssl"
Additionally, you may wish to build on a 64-bit machine, in which case you need to add -fPIC to EXTRACFLAGS. So, building on a 64-bit machine with SSL support would look something like:
$ make slx EXTRACFLAGS="-fPIC -I/usr/include/openssl"
Or without SSL support:
$ make slx SSLTYPE=none EXTRACFLAGS=-fPIC
Once this completes you can proceed with the Asterisk build; there is no need to run 'make install'.