checking for OSX and OpenBSD, check for FEATURE_PTHREAD
and use mutex locking unless there is an _r function
available. Better safe than sorry.
Fixes "./configure --disable-pthread" and should result
in less threading-related problems on pthread-using platforms,
but it still doesn't fix BR#1122404.