Integrate various fixes so Novacoin builds on OSX

My changes fix various build issues on OSX.