Remove hardcoded -lresolv, -lnsl and -lsocket

We already check for the functions we need in libnsl
and libsocket, and I assume we don't need libresolv

Should fix #1967