cmake: Use FindThreads for setting HAVE_PTHREAD_H
cmake: Use FindThreads for setting HAVE_PTHREAD_H

The cmake FindThreads package both checks for pthread.h and also checks
whether it can link to a pthreads library.

This avoids enabling pthreads if only pthreads-w32 is available.
pthreads-w32 provides pthread.h but has a link library with a
different name (libpthreadGC2.a).

Generally, always using win32 threads when on windows would be
sensible.

However, libstdc++ can be configured to use pthreads (winpthreads), and
in these cases, standard C++ headers can pollute the namespace with
pthreads declarations, which break the win32 threads headers that
declare similar symbols - leading us to prefer pthreads on windows
whenever available (see d167a1ae and vpx bug 1132).

Change-Id: I6b418cf644e3b5ff26496e1fa2bddb1aa15e7d21

GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom,GrokImageCompression/aom