"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
'getaddrinfo' isn't available under Cygwin. This patch
adds a general
feature detection for getaddrinfo and getnameinfo and if they are not
present replaces them with equivalents which we ship.
The replacements come from this BSD-licensed implementation by
Motoyuki Kasahara:
http://www.sra.co.jp/people/m-kasahr/getaddrinfo/
Hi Rich,
Do you happen to know how that implementation compares to what's in gnulib?
http://www.gnu.org/software/gnulib/MODULES.html#module=getaddrinfo
One thing I noticed is that it lacks IPv6 support. Obviously, we don't
care too much if a system needing the replacement can't do IPv6, but if
we get it for free, it makes the rest of the code cleaner to be able to
assume IPv6-related definitions are always available.
Since coreutils, gnutls, and a few other well-known projects use the
one in gnulib, if there's anything wrong with it, I'll make sure it gets
fixed right away.
One advantage of the above version is that it doesn't depend on the following
modules from gnulib:
extensions
gettext-h
inet_ntop
snprintf
socklen
stdbool
strdup
sys_socket
An argument in favor of the gnulib-based implementation is that with
gnulib-tool, it encapsulates all of the autoconf and Makefile.am changes
required to add everything automatically.
Also, if you care about portability, you might as well do it "right" and
ensure that the required functions like socklen, snprintf, and inet_ntop,
are available and working. And if not, provide working replacements.
Being able to depend on the fundamentals can make debugging a lot less
frustrating.
By the way, all of those gnulib modules are covered by LGPLv2+, so no
problem with copyright.
Eventually, I plan to do something like this anyhow, for
portable memory-related info (i.e., gnulib's physmem module),
so I've added this one to the list.