Make pthreads an optional dependency.

Should fix .sln generation on Windows with tests enabled (previously it failed because
pthreads is not available on Windows).