This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libjava/net/natInetAddress.cc uses inet_pton, not declared on irix6.2
- To: bryce at waitaki dot otago dot ac dot nz, tromey at redhat dot com
- Subject: Re: libjava/net/natInetAddress.cc uses inet_pton, not declared on irix6.2
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Tue, 24 Apr 2001 21:44:54 -0400 (EDT)
- Cc: gcc at gcc dot gnu dot org, java at gcc dot gnu dot org
> From: Tom Tromey <tromey@redhat.com>
>
> >>>>> "Bryce" == Bryce McKinlay <bryce@waitaki.otago.ac.nz> writes:
>
> Kaveh> On irix6.2, inet_pton is provided by libc, but is not declared
> Kaveh> anywhere.
>
> Bryce> inet_pton is the IPv6 counterpart/successor to inet_aton. Its
> Bryce> use is already protected with an "#ifdef HAVE_INET_PTON" so I'm
> Bryce> not sure why you get the undefined function error.
>
> The function check in configure finds it because it is a link check.
> However g++ gives an error because the function is not declared
> anywhere.
Right.
> Kaveh, I think the fix depends on your goals. If you think we'll ever
> want to use the IPv6 code on Irix 6.2 (I don't know whether the IPv6
> code in libgcj actually works; I have never tried it or for that
> matter ever seen a machine using IPv6), then the right fix is to look
> for the function decl and have a backup decl ready.
I think the IPv6 implementation in irix6.2 is incomplete because
e.g. sockaddr_in6 isn't available, and of course inet_pton isn't
declared.
> How does the DECL checking infrastructure in gcc compare to what is in
> the next version of autoconf? Eventually I imagine we would want to
> use that.
I think it has a similar result in what cpp macros get defined, (but
uses entirely different internal logic.)
> Meanwhile, I'm not overly concerned about the shape of the
> current fix. Your egrep code is fine by me.
> Tom
Actually, I tried Bryce's suggestion to check HAVE_INET6 (which is
undefined since sockaddr_in6 isn't there) and that was enough to allow
the build to continue so I'm happy with it. It crashed later on in
the libjava build process but that's a separate issue for which I'll
send a separate report. We're making progress.
Anyway, Ok to install the following on the trunk and branch?
Thanks,
--Kaveh
2001-04-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* java/net/natInetAddress.cc (java::net::InetAddress::aton):
Wrap use of inet_pton in HAVE_INET6.
diff -rup ../egcs-CVS20010423/libjava/java/net/natInetAddress.cc egcs-CVS20010423/libjava/java/net/natInetAddress.cc
--- ../egcs-CVS20010423/libjava/java/net/natInetAddress.cc Fri Nov 3 02:43:06 2000
+++ egcs-CVS20010423/libjava/java/net/natInetAddress.cc Mon Apr 23 23:07:51 2001
@@ -118,7 +118,7 @@ java::net::InetAddress::aton (jstring ho
blen = 4;
}
#endif
-#ifdef HAVE_INET_PTON
+#if defined(HAVE_INET_PTON) && defined (HAVE_INET6)
char inet6_addr[16];
if (len == 0 && inet_pton (AF_INET6, hostname, inet6_addr) > 0)
{