Avoid linking against nsl and resolv unless required.