I used shell access to my dreamhost account (I hope that's ok), so compiled it on the server that's running the CGI, which I guess is the ideal situation.
As far as setting up a link, that's possible I guess. I'll check with the admin's if that's ok, otherwise we could simply put a copy into your home directory.
Use this as a guide, I just went through my history file and grabbed the commands that looked usefull :-S
get and install the imap libraries
tar -zxf imap-2004e.tar.Z
make slx SSLTYPE=none
cp *.h ../include/
cp *.c ../lib/
cp c-client.a ../lib/libc-client.a
get the latest version of PHP and install
tar -xf php-5.0.4.tar
add any extras you want compiled into the CGI.
./configure \ --prefix=/home/yourhome/php \