Fix compilation on Mac OS X 10.8 and eariler

`__llvm__` is defined for both gcc 4.2 and fresh new clang 5.0, so it doesn't help there.

The problem is that there are two standard libraries: `libstdc++` and `libc++`. Starting from Mavericks, `libc++` is used by default and TR1 is not available anymore. `_LIBCPP_VERSION` is a correct way to check which library is used.