Add checks for pthreads to the build system

pthreads are now required, so add appropriate checks to the build system
and set the compile flags accordingly.

closes #98