libgcj ,OFS1 on alpha

David Pettersson dapet@mai.liu.se
Fri Apr 16 02:54:00 GMT 1999


On 15 Apr 1999, Tom Tromey wrote:

> >>>>> "David" == David Pettersson <dapet@mai.liu.se> writes:
> 
> David> ../../../libgcj/libjava/java/net/natInetAddress.cc:125: implicit
> David> declaration of function `int gethostbyname_r(...)'
> 
> David> I tried to to run with -E -dM again which shows that
> David> HAVE_NETDB_H is defined. According to the man page for
> David> gethostbyname_r should <netdb.h> contain this
> David> function. GETHOSTBYNAME_R_RETURNS_INT is not defined but the
> David> manpage states that gethostbyname_r returns int. The same for
> David> GETHOSTBYADDR_R_RETURNS_INT and gethostbyaddr_r.
> 
> 
> Apparently on OSF we have to define _OSF_SOURCE and _REENTRANT in
> order to pick up these decls.
> 
> Also, OSF apparently has a gethostbyname_r which isn't like either of
> the two other gethostbyname_r's that I've seen.  Finally, the OSF
> gethostbyname_r man page says that we should just use gethostbyname
> here anyway.
> 
> So I recommend somehow arranging so that the gethostbyname_r check
> (and possibly other checks as well: look at the OSF man pages, etc) be
> avoided in configure.in -- for OSF only.
> 
> This isn't pretty, but then these reentrant functions seem to be
> especially divergent across platforms.
> 
> Tom
> 

This sounds like to much configure / makefile work for me to be able to
do. Below is a temporary (ugly) fix patch to get on to the next problem.
There is also patches to two more of the TRUE/FALSE defined problem.
libgcj still does not compile, but I'll be back later with the next
problem (or a patch for it).

Index: natInetAddress.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natInetAddress.cc,v
retrieving revision 1.2
diff -u -r1.2 natInetAddress.cc
--- natInetAddress.cc   1999/04/08 13:22:58     1.2
+++ natInetAddress.cc   1999/04/16 09:17:40
@@ -45,6 +45,12 @@
 extern "C" int gethostname (char *name, int namelen);
 #endif
 
+  /* Temporary fix for osf1 */
+#ifdef __osf__
+#undef HAVE_GETHOSTBYNAME_R
+#undef HAVE_GETHOSTBYADDR_R
+#endif /* __osf__ */
+
 jbyteArray
 java::net::InetAddress::aton (jstring host)
 {


Index: natArray.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natArray.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 natArray.cc
--- natArray.cc 1999/04/07 14:52:39     1.1.1.1
+++ natArray.cc 1999/04/16 09:27:42
@@ -22,6 +22,12 @@
 #include <java/lang/Long.h>
 #include <java/lang/Float.h>
 #include <java/lang/Double.h>
+
+// System headers included above may have defined TRUE and FALSE.  We
+// must undefine them for the sake of java.lang.Boolean.
+#undef TRUE
+#undef FALSE
+
 #include <java/lang/Boolean.h>
 #include <java/lang/Character.h>


Index: natMethod.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 natMethod.cc
--- natMethod.cc        1999/04/07 14:52:39     1.1.1.1
+++ natMethod.cc        1999/04/16 09:26:16
@@ -22,6 +22,12 @@
 
 #include <java/lang/Void.h>
 #include <java/lang/Byte.h>
+
+// System headers included above may have defined TRUE and FALSE.  We
+// must undefine them for the sake of java.lang.Boolean.
+#undef TRUE
+#undef FALSE
+
 #include <java/lang/Boolean.h>
 #include <java/lang/Character.h>
 #include <java/lang/Short.h>





More information about the Java mailing list