This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: maybe disable java.net, plus configure bug fixes
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: maybe disable java.net, plus configure bug fixes
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 01 Oct 1999 18:22:21 -0600
- Reply-To: tromey at cygnus dot com
I'm committing the appended patch.
It changes libgcj so that java.net can be disabled on some targets.
It also fixes a couple bugs in configure that somehow avoided notice
(or at least a report) until now.
This fixes another bug in the code that generates the .spec file -- if
you had spec file problems building libgcj from scratch this will
probably fix it.
1999-10-01 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Set classpath when invoking gcj. Use changequote
around sed invocation.
* java/net/natPlainSocketImpl.cc: Stub native functions if
DISABLE_JAVA_NET is defined.
* java/net/natPlainDatagramSocketImpl.cc (setTimeToLive): Fixed
typo in exception string.
(getTimeToLive): Likewise.
Stub native functions if DISABLE_JAVA_NET is defined.
* java/net/natInetAddress.cc: Stub native functions if
DISABLE_JAVA_NET is defined.
* configure.host: Disable java.net for mips-tx39.
* configure, include/config.h.in: Rebuilt.
* acconfig.h (DISABLE_JAVA_NET): Undefine.
* configure.in: Added --disable-java-net and new define
`DISABLE_JAVA_NET'.
Tom
Index: acconfig.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/acconfig.h,v
retrieving revision 1.9
diff -u -r1.9 acconfig.h
--- acconfig.h 1999/09/24 19:12:21 1.9
+++ acconfig.h 1999/10/01 23:48:51
@@ -109,3 +109,6 @@
/* Define if pthread_mutex_t has __m_count member. */
#undef PTHREAD_MUTEX_HAVE___M_COUNT
+
+/* Define if java.net native functions should be stubbed out. */
+#undef DISABLE_JAVA_NET
Index: configure.host
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.host,v
retrieving revision 1.3
diff -u -r1.3 configure.host
--- configure.host 1999/09/28 22:16:57 1.3
+++ configure.host 1999/10/01 23:48:51
@@ -52,6 +52,7 @@
AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
# Use "Ecos" processes since they are a no-op.
PROCESS=Ecos
+ enable_java_net_default=no
;;
i686-*|i586-*)
libgcj_flags="${libgcj_flags} -ffloat-store"
Index: configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.34
diff -u -r1.34 configure.in
--- configure.in 1999/09/28 22:16:57 1.34
+++ configure.in 1999/10/01 23:48:59
@@ -50,6 +50,19 @@
AC_DEFINE(INTERPRETER)
fi)
+dnl See if the user wants to disable java.net. This is the mildly
+dnl ugly way that we admit that target-side configuration sucks.
+AC_ARG_ENABLE(java-net,
+[ --disable-java-net disable java.net])
+
+dnl Whether java.net is built by default can depend on the target.
+if test -n "$enable_java_net"; then
+ enable_java_net=${enable_java_net_default-yes}
+fi
+if test "$enable_java_net" != yes; then
+ AC_DEFINE(DISABLE_JAVA_NET)
+fi
+
dnl If the target is an eCos system, use the appropriate eCos
dnl I/O routines.
dnl FIXME: this should not be a local option but a global target
@@ -516,7 +529,9 @@
if test -z "${with_multisubdir}"; then
builddotdot=.
else
+changequote(<<,>>)
builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`
+changequote([,])
fi
dir="`cd ${builddotdot}/../../gcc && pwd`"
GCJ="$dir/gcj -B$dir/"
@@ -533,7 +548,8 @@
public class conftest { }
END
use_fuse=yes
-$GCJ -fuse-divide-subroutine -fsyntax-only conftest.java > /dev/null 2>&1 \
+$GCJ -classpath $srcdir -fuse-divide-subroutine -fsyntax-only \
+ conftest.java > /dev/null 2>&1 \
|| use_fuse=no
rm -f conftest.java
if test "$use_fuse" = no; then
Index: java/net/natInetAddress.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natInetAddress.cc,v
retrieving revision 1.9
diff -u -r1.9 natInetAddress.cc
--- natInetAddress.cc 1999/09/10 22:03:09 1.9
+++ natInetAddress.cc 1999/10/01 23:49:05
@@ -49,7 +49,29 @@
extern "C" int gethostname (char *name, int namelen);
#endif
+#ifdef DISABLE_JAVA_NET
+
jbyteArray
+java::net::InetAddress::aton (jstring)
+{
+ return NULL;
+}
+
+JArray<java::net::InetAddress*> *
+java::net::InetAddress::lookup (jstring, java::net::InetAddress *, jboolean)
+{
+ return NULL;
+}
+
+jstring
+java::net::InetAddress::getLocalHostname ()
+{
+ return NULL;
+}
+
+#else /* DISABLE_JAVA_NET */
+
+jbyteArray
java::net::InetAddress::aton (jstring host)
{
char *hostname;
@@ -300,3 +322,5 @@
// anyway, thanks to the InetAddress.localhost cache.
return JvNewStringUTF (chars);
}
+
+#endif /* DISABLE_JAVA_NET */
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.12
diff -u -r1.12 natPlainDatagramSocketImpl.cc
--- natPlainDatagramSocketImpl.cc 1999/09/30 22:20:29 1.12
+++ natPlainDatagramSocketImpl.cc 1999/10/01 23:49:05
@@ -47,6 +47,71 @@
#include <java/lang/Boolean.h>
#include <java/lang/Integer.h>
+#ifdef DISABLE_JAVA_NET
+
+void
+java::net::PlainDatagramSocketImpl::create ()
+{
+ JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.create: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::bind (jint, java::net::InetAddress *)
+{
+ JvThrow (new BindException (JvNewStringLatin1 ("DatagramSocketImpl.bind: unimplemented")));
+}
+
+jint
+java::net::PlainDatagramSocketImpl::peek (java::net::InetAddress *)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.peek: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::send (java::net::DatagramPacket *)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.send: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::receive (java::net::DatagramPacket *)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.receive: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::setTimeToLive (jint)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.setTimeToLive: unimplemented")));
+}
+
+jint
+java::net::PlainDatagramSocketImpl::getTimeToLive ()
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.getTimeToLive: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::mcastGrp (java::net::InetAddress *,
+ jboolean)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("DatagramSocketImpl.mcastGrp: unimplemented")));
+}
+
+void
+java::net::PlainDatagramSocketImpl::setOption (jint, java::lang::Object *)
+{
+ JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.setOption: unimplemented")));
+}
+
+java::lang::Object *
+java::net::PlainDatagramSocketImpl::getOption (jint)
+{
+ JvThrow (new SocketException (JvNewStringLatin1 ("DatagramSocketImpl.getOption: unimplemented")));
+}
+
+#else /* DISABLE_JAVA_NET */
+
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
@@ -296,7 +361,7 @@
char msg[100];
char* strerr = strerror (errno);
- sprintf (msg, "DatagramSocketImpl.setTimeToLime: %.*s", 80, strerr);
+ sprintf (msg, "DatagramSocketImpl.setTimeToLive: %.*s", 80, strerr);
JvThrow (new java::io::IOException (JvNewStringUTF (msg)));
}
@@ -311,7 +376,7 @@
char msg[100];
char* strerr = strerror (errno);
- sprintf (msg, "DatagramSocketImpl.setTimeToLime: %.*s", 80, strerr);
+ sprintf (msg, "DatagramSocketImpl.getTimeToLive: %.*s", 80, strerr);
JvThrow (new java::io::IOException (JvNewStringUTF (msg)));
}
@@ -573,3 +638,5 @@
sprintf (msg, "DatagramSocketImpl.getOption: %.*s", 80, strerr);
JvThrow (new java::net::SocketException (JvNewStringUTF (msg)));
}
+
+#endif /* DISABLE_JAVA_NET */
Index: java/net/natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.11
diff -u -r1.11 natPlainSocketImpl.cc
--- natPlainSocketImpl.cc 1999/09/10 22:03:09 1.11
+++ natPlainSocketImpl.cc 1999/10/01 23:49:06
@@ -41,6 +41,52 @@
#include <java/lang/Class.h>
#include <java/lang/Integer.h>
+#ifdef DISABLE_JAVA_NET
+
+void
+java::net::PlainSocketImpl::create (jboolean)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.create: unimplemented")));
+}
+
+void
+java::net::PlainSocketImpl::bind (java::net::InetAddress *, jint)
+{
+ JvThrow (new BindException (JvNewStringLatin1 ("SocketImpl.bind: unimplemented")));
+}
+
+void
+java::net::PlainSocketImpl::connect (java::net::InetAddress *, jint)
+{
+ JvThrow (new ConnectException (JvNewStringLatin1 ("SocketImpl.connect: unimplemented")));
+}
+
+void
+java::net::PlainSocketImpl::listen (jint)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.listen: unimplemented")));
+}
+
+void
+java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *)
+{
+ JvThrow (new java::io::IOException (JvNewStringLatin1 ("SocketImpl.accept: unimplemented")));
+}
+
+void
+java::net::PlainSocketImpl::setOption (jint, java::lang::Object *)
+{
+ JvThrow (new SocketException (JvNewStringLatin1 ("SocketImpl.setOption: unimplemented")));
+}
+
+java::lang::Object *
+java::net::PlainSocketImpl::getOption (jint)
+{
+ JvThrow (new SocketException (JvNewStringLatin1 ("SocketImpl.create: unimplemented")));
+}
+
+#else /* DISABLE_JAVA_NET */
+
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
#endif
@@ -422,3 +468,5 @@
sprintf (msg, "SocketImpl.getOption: %.*s", 80, strerr);
JvThrow (new java::net::SocketException (JvNewStringUTF (msg)));
}
+
+#endif /* DISABLE_JAVA_NET */