Don't link pthreads on win32, even if it is present

Some mingw setups include an -lpthread, even though we don't use pthreads on windows. Therefore, we should only search for the pthreads functions when we are not building for windows.