Clear some of our thread state after a fork()
Have the Makefile be able to defer all of 'make check' to cmake

ie by running 'make check USE_CMAKE=1'

changed:
- defer to cmake for building the unittests
- building extensions doesn't use the rest of the build system so can remove
  that unnecessary dependency (would cause an llvm build otherwise).