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
Merge pull request #99 from jin-eld/issue#98

Add checks for pthreads to the build system