If you try to compile PHP 5.2.x with IMAP support, but get an error message like this:
checking for utf8_mime2text signature... new
checking for U8T_CANONICAL... no
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.This should not happen.
Check config.log for additional information.
Then chances are high that you have not installed the libc-client (aka imap library) package for your System. To re-install it under CentOS, one can use the following command:
yum install libc-client-devel
Other distributions / systems should provide this package under a similar name. If unsure simply search the repositories for libc-client. Please note that CentOS' yum utility automatically installs the libc-client package as depend package; yum always tries to solve package dependencies on it's own.
After installation of the libc-client package your configure script should work as expected.
If you get a hint that your libc-client was compiled with Kerberos support, you have to add "--with-kerberos" to your configure line. My configure parameter for imap support in PHP 5.2.14 looks like this:
--with-imap --with-imap-ssl --with-kerberos
A hint for 64-Bit CentOS 5.5 systems:
I had to install in addition to the 64-Bit packages of libc-client also the 32-Bit packages, for whatever reason. Without the 32-Bit packages the configure script doesn't work. The same issue happened also for the jpeg/tiff/png libraries, only if both 32 AND 64 Bit packages are installed the configure script runs without errors. However the resulting library/executables are 64-Bit.
Update: An user gave the following additional informations regarding 64-Bit and CentOS 5.5:
The CentOS distribution team does not link the 64-Bit libraries against the 32-Bit libraries, as other distributions will do. So you do not have to install the 32-Bit libraries, a manual link would solve that problem, too.
The PHP configure script does not honor the Libpath setting (i.e. --with-libjpeg[=libpath]) during a bug (if it would honor them, the problem won't appear in the first place at all), so you have to use the hints above to get a successful compile on 64-Bit systems. Thanks to devnull for that hint!
That's it, good luck for your own compile of PHP!