build: use -D_REENTRANT on Solaris for proper errno.

Without -D_REENTRANT, various errno checks will fail in threaded
scenarios. We probably need to document this for consumers, but that
needs more testing to determine if it is necessary.