Trying to add --with-imap to your configure.php5 ?
and getting this error?
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing
Solution (worked for me, this was a dovecot machine):
# yum install libc-client
# yum install libc-client-devel
Then add following lines in
# cd /usr/local/directadmin/custombuild/configure/ap2
# ./build php y