Use logic of LLVM to detect pthread library.

But still need to check if LLVM uses pthreads.