Issue #19 - fixed boolean logic

CPPFLAGS was being appended in the wrong AC_COMPILE_IFELSE block
Fixed various compiler warnings shown with -Werror
Issue #21 - added pthread checks and increased compile verbosity

Checks for libpthread are needed on some systems to prevent an
"operation not permitted" error from appearing at runtime, as per
http://stackoverflow.com/questions/7359575.