Compiling PHP with Freetype and GD is about the most frustrating aspect of installing PHP. GD with Freetype depends on so many other things being just right, such as X-windows, zlib, libjpeg, libpng, etc...
After many tries, I found a combination that works on FreeBSD. I haven't tested it with Linux, but it shouldn't be too different. There is one part where I do a small edit of the GD source, which you might not need in Linux:
If you go to this page (http://www.php.net/manual/ref.image.php) at the PHP site and look for rick@e-possibility.com at the notes at the bottom, you will see my complete method. It may seem crazy what I had to do, but it works. (I have done it on 4 systems)