Check for extra networking libraries before checking for IPv6.

On some platforms, such as SunOS 5.x, building the "do we have IPv6
support?" test program requires the extra networking libraries, so we
need to know what extra networking libraries are required before doing
that test.
Note that we fixed the IPv6 check for Solaris.