Use getopt_long().

This requires us to check for it in the configure script and to include
a version of getopt_long() for the benefit of platforms that don't have
it; we pick up the FreeBSD version and tweak it a bit (eliminating some
features specific to the BSD version of getopt_long(), as we want to use
it only in a fashion portable to Linux/*BSD/Solaris/etc.)

We also get rid of the version of getopt() we supply for Windows in
favor of the version of getopt_long() we provide.
Not all platforms we support define AF_INET6.