Fix detected flags from ACX_PTHREAD being reset.

Preexisting. I totally like your test-in-one-line alternative better, but I didn't even bother, I just copy pasted the preexisting chunk of code, to some other place. 

Feel free to provide a patch though, you've already done all the work in your comments, as usual.