Replace the configure templating system with something better.

A large amount of this code can be removed when buildtool is done as we will not need to worry about the differences between BSD and GNU Make.

Side note: I am currently working in a Linux VM due to my lack of an OS X development box. There may be things I have missed while testing this due to not being too familiar with the environment.