Bsd and Linux fixes

Includes BSD Fixes from @ashemedai / pull request #161 and adds Makefile auto-detection for Linux.

Maybe there's a better way to detect libstd++? Does it even work outside of mac yet?