Let's have a look a selected pieces of your compiler output.
some bits of the configure output would also be helpful.
I have compiled so many things with few problems that I didn't cause by trying to be "clever".
apache, php, mysql, postgres, perl 5.6.1, Tomcat, cocoon, mod_jk all work...