[kaffe] libraries/clib/net/InetAddressImpl.c cannot be compiled on old Linux

Ito Kazumitsu ito.kazumitsu@hitachi-cable.co.jp
Fri May 30 03:43:02 2003


In message "Re: [kaffe] libraries/clib/net/InetAddressImpl.c cannot be compiled on old Linux"

> >I am afraid Linux 2.0 should be deleted from the list of supported systems.
> 
> Sigh... Then I have to find some other JVM :-<

Supporting Linux 2.0 may be nothing but a burden for developers,
but for some users it is badly desired.

The following is what I did to make the current kaffe run on my
old Linux machine.  I would NOT insist that this should be
officially supported.  This is only for reference.

1. Patch libraries/clib/native/Double.c

   Strtod() of my Linux is buggy.  So I got a reliable source of
   strtod.c from somewhere and put it to libraries/clib/native
   and make Double.c include it.

--- libraries/clib/native/Double.c.orig	Fri Apr 12 21:56:11 2002
+++ libraries/clib/native/Double.c	Fri May 16 12:33:55 2003
@@ -23,6 +23,7 @@
 #include "files.h"
 #include "java_lang_Double.h"
 #include <native.h>
+#include "strtod.c"
 
 /*
  * Convert a "normal" double to a string with the supplied precision.

2. Patch replace/getifaddrs.c

   Old Linux does not have linux/netlink.h and linux/rtnetlink.h.
   So I do not expect kaffe to use replace/getifaddrs.c.

--- replace/getifaddrs.c.orig	Fri Feb 21 18:50:49 2003
+++ replace/getifaddrs.c	Fri Mar  7 08:31:45 2003
@@ -17,6 +17,7 @@
 
 #if defined(HAVE_GETIFADDRS)
 
+/*
 #elif defined(linux)
 
 #if !defined(__set_errno)
@@ -28,6 +29,7 @@
 #endif
 
 #include "ifaddrs_linux.c"
+*/
 
 #else
 

3. Install getaddrinfo.

   Get getaddrinfo-1.5.1.tar.gz from
     http://www.sra.co.jp/people/m-kasahr/getaddrinfo/
   and compile getaddrinfo.c.  This program provides
   getaddrinfo() and getnameinfo().

   Put getaddrinfo.h to libraries/clib/net/
   Then insert the following lines to 
       libraries/clib/net/InetAddressImpl.c
       libraries/clib/net/NetworkInterfaceImpl.c
       libraries/clib/net/PlainSocketImpl.c

=====================================================================
#undef AF_INET6
#undef PF_INET6

#if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO)
#include "getaddrinfo.h"
#endif
=====================================================================

   And put getaddrinfo.o to replace/
   and patch libraries/clib/net/Makefile.in

--- libraries/clib/net/Makefile.in.orig	Thu May 29 01:05:18 2003
+++ libraries/clib/net/Makefile.in	Fri May 30 17:30:19 2003
@@ -240,7 +240,8 @@
 AM_CPPFLAGS = -I$(top_srcdir)/kaffe
 
 libnet_la_LDFLAGS = $(KLIBFLAGS) -module -release $(KVER) -export-symbols-regex "^([Jj]ava|kaffe)_"
-libnet_la_LIBADD = $(NET_LIBS)  $(top_builddir)/replace/libreplace.la
+libnet_la_LIBADD = $(NET_LIBS)  $(top_builddir)/replace/libreplace.la \
+	$(top_builddir)/replace/getaddrinfo.o
 libnet_la_SOURCES = \
 	InetAddressImpl.c \
 	NetworkInterfaceImpl.c \

That is all.  Kaffe can be built on my old Linux machine and runs on it.

(I am not sure that $(top_builddir)/replace/ is the best place to
put getaddrinfo.o.)