Move check for libpthread up