Macosx fixes

This is a continuation of #29 to fix the problem described in #26. We need to check the Mac OS X deployment target to decide whether to use the `tr1` namespace, not the system installed OS X version.