Fix detected flags from ACX_PTHREAD being reset.

Rather than invoking test three times, you can do the three tests in a single invocation, using -a:
```
if test "x$with_pthreads" != x -a "x$with_pthreads" != "xyes" -a "x$with_pthreads" != "xno"
```