Asterisk 1.4 make fails when IMAP is selected

If I add IMAP Support to asterisk 1.4 beta4 or subversion I get this error when I run make.

usr/src/imap-2006c1/c-client/env_unix.h:71: warning: function declaration isn?t a prototype
app_voicemail.c: In function ?forward_message?:
app_voicemail.c:3920: warning: unused variable ?duration?
app_voicemail.c: In function ?play_record_review?:
app_voicemail.c:7882: error: ?vms? undeclared (first use in this function)
app_voicemail.c:7882: error: (Each undeclared identifier is reported only once
app_voicemail.c:7882: error: for each function it appears in.)
app_voicemail.c:7882: warning: passing argument 8 of ?imap_store_file? makes integer from pointer without a cast
make[1]: *** [app_voicemail.o] Error 1
make: *** [apps] Error 2