Converting to GCC 4

Builds all the way to EMProject, which has seen changes since its
previously working (but unpublished) revision.