Fix spinlock detection with clang
Add the right pthread library flag to the linking flags
Fix location of try_compile of spinlock test