Add autoconf checks for getpwnam_r and getgrnam_r.

Right now, only the checks are included.  The functions aren't
used at all.
Use getpwnam_r() and getgrnam_r() if available.  Closes #775.

If the user is building threaded on a system without those functions,
too bad.  It's 2014, and every sane system has those functions