I have tried compiling 4.0.6 with gd and freetype libraries. I use the exact ./configure for 4.0.4 and 4.0.5 and they work fine, anyone know why this might be happening.
./configure --with-mysql=no --with-oci8=no --with-gd=../gd-1.8.4 --with-ttf=../freetype