This fixes two little issues that I had when porting the LocalSocketImpl to JamaicaVM:

- It only loads the library dynamically when actually supported by the runtime. - It includes config.h unconditionally. Actually it doesn't seem to make sense to do:

#if HAVE_CONFIG_H
#include config.h
#endif

since HAVE_CONFIG_H is defined in config.h.

2006-08-21  Roman Kennke  <[EMAIL PROTECTED]>

        * gnu/java/net/local/LocalSocketImpl.java
        Only load native lib if this is supported by runtime.
        * native/jni/java-net/local.c
        Include config.h unconditionally.
        * native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c
        Include config.h unconditionally.

Cheers, Roman
Index: gnu/java/net/local/LocalSocketImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/local/LocalSocketImpl.java,v
retrieving revision 1.2
diff -u -1 -2 -r1.2 LocalSocketImpl.java
--- gnu/java/net/local/LocalSocketImpl.java	11 Jul 2006 19:50:20 -0000	1.2
+++ gnu/java/net/local/LocalSocketImpl.java	21 Aug 2006 09:39:27 -0000
@@ -29,24 +29,26 @@
 modules, and to copy and distribute the resulting executable under
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.  */
 
 
 package gnu.java.net.local;
 
+import gnu.classpath.Configuration;
+
 import java.io.FileDescriptor;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
 import java.net.InetAddress;
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.net.SocketImpl;
 
 final class LocalSocketImpl extends SocketImpl
 {
@@ -57,25 +59,28 @@
   private boolean created;
   private InputStream in;
   private OutputStream out;
   // Package private to avoid synthetic accessor method.
   int socket_fd;
   private LocalSocketAddress local;
   private LocalSocketAddress remote;
 
   static
   {
     try
       {
-        System.loadLibrary ("javanet");
+        if (Configuration.INIT_LOAD_LIBRARY)
+          {
+            System.loadLibrary ("javanet");
+          }
       }
     catch (Exception x)
       {
         x.printStackTrace ();
       }
   }
 
   // Constructor.
   // -------------------------------------------------------------------------
 
   LocalSocketImpl ()
   {
Index: native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c,v
retrieving revision 1.3
diff -u -1 -2 -r1.3 gnu_java_net_local_LocalSocketImpl.c
--- native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c	11 Jul 2006 21:49:26 -0000	1.3
+++ native/jni/java-net/gnu_java_net_local_LocalSocketImpl.c	21 Aug 2006 09:39:27 -0000
@@ -29,27 +29,25 @@
 modules, and to copy and distribute the resulting executable under
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.  */
 
 
 #define _GNU_SOURCE
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif /* HAVE_CONFIG_H */
 
 #include <gnu_java_net_local_LocalSocketImpl.h>
 
 #include <stddef.h>
 #include "local.h"
 
 #ifdef DEBUG
 #define TRACE(msg) fprintf (stderr, "%s(%s:%d) -- %s\n", __FUNCTION__, __FILE__, __LINE__, msg)
 #else
 #define TRACE(msg)
 #endif
 
Index: native/jni/java-net/local.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/local.c,v
retrieving revision 1.2
diff -u -1 -2 -r1.2 local.c
--- native/jni/java-net/local.c	19 Apr 2006 18:11:42 -0000	1.2
+++ native/jni/java-net/local.c	21 Aug 2006 09:39:27 -0000
@@ -27,27 +27,25 @@
 permission to link this library with independent modules to produce an
 executable, regardless of the license terms of these independent
 modules, and to copy and distribute the resulting executable under
 terms of your choice, provided that you also meet, for each linked
 independent module, the terms and conditions of the license of that
 module.  An independent module is a module which is not derived from
 or based on this library.  If you modify this library, you may extend
 this exception to your version of the library, but you are not
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version.  */
 
 
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif /* HAVE_CONFIG_H */
 
 #ifdef ENABLE_LOCAL_SOCKETS
 
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>

Reply via email to