Fix the pthread link error when -Werror is specified.

The ACX_PTHREAD() macro can't detect pthread properly when
-Werror is specified.  This commit fixes this issue by
removing the -Werror from $CFLAGS and $CPPFLAGS before
ACX_PTHREAD().

This commit also reverts 0ea7862e.