Autotools and mac osx fixes