To correctly compile, make and install PHP4 with the lastest mcrypt version you must do the following things (they worked for me anyway).
1. First make sure you install mcrypt and libmcrypt with --disable-posix-threads.
2. Then as root edit your /etc/ld.so.conf file and add the path of where libmcrypt was installed (default:/usr/local/lib/libmcrypt).
3. Then run ldconfig.
4. Then compile PHP with "--with-mcrypt" option. Hopefully everything should work fine.
Install system: AMD K6-2 350 128MB RAM
LINUX KERNEL: 2.2.16 OS: SLACKWARE 7.1