include cleanups: remove unused headers and add feature test macros
add portable lchown (trivial to support and a few ancient things want it..)