Rel19

Take a look at these changes.  Most of them have been made in the name of building it on FreeBSD, which it now does... and runs perfectly (FreeBSD 10.0).  None of the changes should affect building on other platforms, and I've even fixed a couple of bugs.