autoconf: Correctly look for resolv.h.

Simply checking if including resolv.h works is error-prone, as it may rely
on type definitions from other headers.

Remove resolv.h from AC_CHECK_HEADERS and instead use the AC_HEADER_RESOLV
macro, whose job is to properly look for resolv.h with all the required
headers.

This also allows us to remove a few other headers from AC_CHECK_HEADERS
which are also looked for by AC_HEADER_RESOLV.
Include syshdr.h in base64.c.

resolv.h may depend on additional headers for some type definitions. Since
most of these headers are already included in syshdr.h, include that here.
autoconf: Use additional headers when looking for netinet/ip.h

On some systems (such as the BSDs), netinet/ip.h does not include other
headers it might need for type definitions on its own.

Make the detection work in this case by adding those headers ourselves in
the macro call that looks for netinet/ip.h.