This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: Mingw32 (Win32) support


This is a follow-on to Jon Beniston's Win32 thread/java.net/java.io
patches:

http://sourceware.cygnus.com/ml/java-patches/2000-q1/msg00174.html

I've hacked the autoconf stuff so libgcj will compile (just barely) for
mingw32 targets.  I can now compile and run simple programs, though
libffi and boehm-gc still need more work for mingw32.  (For now I am
cross-compiling from i686-pc-linux-gnu only.)

The configure.in sources are becoming sort of ugly due to the scattering
of host-specific behavior... if someone can tell me how to improve it
I'll gladly work on it and resubmit this patch.

BTW I didn't rebuild any configure scripts... my autoconf version
doesn't appear to match whatever they are using at Cygnus, judging by
the number of conflicts I get.

-- 
Jeff Sturm
jsturm@sigma6.com
2000-03-13  Jeff Sturm  <jsturm@sigma6.com>

	* boehm-gc/configure.in: Activate win32 thread support.
	* boehm-gc/gcconfig.h: Handle mingw32.
	* boehm-gc/mach_dep.h: Use GCC ASM syntax for mingw32.
	* libjava/acconfig.h (USE_WIN32_SIGNALLING, USE_WINSOCK): new macros.
	* libjava/configure.in: Don't test data_start for mingw32.
	Set FILE_DESCRIPTOR, PROCESS for mingw32.
	Activate win32 thread support.
	Set SIGNAL_HANDLER, USE_WIN32_SIGNALLING, USE_WINSOCK for mingw32.
	* libjava/include/config.h.in: Rebuilt.
	* zip/tailor.h: Don't use win32 configuration for mingw32.
	* zip/unix/osdep.h: Use binary I/O for mingw32.

Index: boehm-gc/configure.in
===================================================================
RCS file: /cvs/java/libgcj/boehm-gc/configure.in,v
retrieving revision 1.16
diff -u -r1.16 configure.in
--- configure.in	1999/11/04 17:25:07	1.16
+++ configure.in	2000/03/13 15:40:22
@@ -84,7 +84,9 @@
     esac
     THREADLIB=-lpthread
     ;;
- decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+  win32)
+    ;;
+ decosf1 | irix | mach | os2 | solaris | dce | vxworks)
     AC_MSG_ERROR(thread package $THREADS not yet supported)
     ;;
  *)
Index: boehm-gc/gcconfig.h
===================================================================
RCS file: /cvs/java/libgcj/boehm-gc/gcconfig.h,v
retrieving revision 1.9
diff -u -r1.9 gcconfig.h
--- gcconfig.h	2000/01/29 01:17:03	1.9
+++ gcconfig.h	2000/03/13 15:40:23
@@ -255,6 +255,11 @@
 #   define CYGWIN32
 #   define mach_type_known
 # endif
+# if defined(__MINGW32__)
+#   define I386
+#   define MSWIN32
+#   define mach_type_known
+# endif
 # if defined(__BORLANDC__)
 #   define I386
 #   define MSWIN32
Index: boehm-gc/mach_dep.c
===================================================================
RCS file: /cvs/java/libgcj/boehm-gc/mach_dep.c,v
retrieving revision 1.5
diff -u -r1.5 mach_dep.c
--- mach_dep.c	1999/11/01 23:15:51	1.5
+++ mach_dep.c	2000/03/13 15:40:23
@@ -199,7 +199,8 @@
 #	endif	/* __MWERKS__ */
 #   endif	/* MACOS */
 
-#       if defined(I386) &&!defined(OS2) &&!defined(SVR4) &&!defined(MSWIN32) \
+#       if defined(I386) &&!defined(OS2) &&!defined(SVR4) \
+	&& (defined(__MINGW32__) || !defined(MSWIN32)) \
 	&& !defined(SCO) && !defined(SCO_ELF) \
  	&& !(defined(LINUX)       && defined(__ELF__)) \
 	&& !(defined(__FreeBSD__) && defined(__ELF__)) \
@@ -230,7 +231,8 @@
 	  asm("pushl %ebx");  asm("call GC_push_one"); asm("addl $4,%esp");
 #	endif
 
-#       if defined(I386) && defined(MSWIN32) && !defined(USE_GENERIC)
+#       if defined(I386) && defined(MSWIN32) && !defined(__MINGW32__)
+	&& !defined(USE_GENERIC)
 	/* I386 code, Microsoft variant		*/
 	  __asm  push eax
 	  __asm  call GC_push_one
Index: libjava/acconfig.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/acconfig.h,v
retrieving revision 1.18
diff -u -r1.18 acconfig.h
--- acconfig.h	2000/01/31 04:53:47	1.18
+++ acconfig.h	2000/03/13 15:40:23
@@ -137,3 +137,9 @@
 
 /* Define if you have working iconv() function.  */
 #undef HAVE_ICONV
+
+/* Define if using Win32 signalling. */
+#undef USE_WIN32_SIGNALLING
+
+/* Define if using Win32 winsock library. */
+#undef USE_WINSOCK
Index: libjava/configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.53
diff -u -r1.53 configure.in
--- configure.in	2000/03/04 21:50:19	1.53
+++ configure.in	2000/03/13 15:40:23
@@ -107,12 +107,18 @@
 AC_MSG_CHECKING([for data_start])
 LIBDATASTARTSPEC=
 NEEDS_DATA_START=
-AC_TRY_LINK([extern int data_start;], [return ((int) &data_start);],
-  [AC_MSG_RESULT(found it)],
-  [LIBDATASTARTSPEC="-u data_start -lgcjdata"
-   NEEDS_DATA_START=yes	
-   AC_MSG_RESULT(missing)])
-AC_SUBST(LIBDATASTARTSPEC)
+case "${host}" in
+  i*86-*-mingw*)
+    ;;
+  *)
+    AC_TRY_LINK([extern int data_start;], [return ((int) &data_start);],
+      [AC_MSG_RESULT(found it)],
+      [LIBDATASTARTSPEC="-u data_start -lgcjdata"
+       NEEDS_DATA_START=yes	
+       AC_MSG_RESULT(missing)])
+    AC_SUBST(LIBDATASTARTSPEC)
+    ;;
+esac
 
 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.
@@ -139,8 +145,17 @@
 
 case "$TARGET_ECOS" in
    no)
-      FILE_DESCRIPTOR=natFileDescriptorPosix.cc
-      PROCESS=${PROCESS-Posix}
+      case "${host}" in
+	i*86-*-mingw*)
+	  FILE_DESCRIPTOR=natFileDescriptorWin32.cc
+	  PROCESS=${PROCESS-Win32}
+	  ;;
+
+	*)
+	  FILE_DESCRIPTOR=natFileDescriptorPosix.cc
+	  PROCESS=${PROCESS-Posix}
+	  ;;
+      esac
       ;;
    *)
       FILE_DESCRIPTOR=natFileDescriptorEcos.cc
@@ -287,7 +302,10 @@
 	;;
     esac
     ;;
- decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
+ win32)
+    THREADS=win32
+    ;;
+ decosf1 | irix | mach | os2 | solaris | dce | vxworks)
     AC_MSG_ERROR(thread package $THREADS not yet supported)
     ;;
  *)
@@ -314,6 +332,11 @@
     AC_DEFINE(HAVE_PTHREAD_MUTEXATTR_INIT)
     ;;
 
+ win32)
+    THREADOBJS=win32-threads.lo
+    THREADH=win32-threads.h
+    ;;
+
  none)
     THREADOBJS=no-threads.lo
     THREADH=no-threads.h
@@ -710,6 +733,9 @@
     i?86-*-linux*)
        SIGNAL_HANDLER=include/i386-signal.h
        ;;
+    i?86-*-mingw*)
+       SIGNAL_HANDLER=include/win32-signal.h
+       ;;
     sparc-sun-solaris*)
        SIGNAL_HANDLER=include/sparc-signal.h
        ;;
@@ -718,6 +744,13 @@
        ;;
    esac
 fi
+
+case "${host}" in
+  i?86-*-mingw*)
+    AC_DEFINE(USE_WIN32_SIGNALLING)
+    AC_DEFINE(USE_WINSOCK)
+    ;;
+esac
 
 AC_LINK_FILES($SIGNAL_HANDLER, include/java-signal.h)
 
Index: libjava/include/config.h.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/config.h.in,v
retrieving revision 1.22
diff -u -r1.22 config.h.in
--- config.h.in	2000/01/31 04:53:47	1.22
+++ config.h.in	2000/03/13 15:40:24
@@ -152,6 +152,12 @@
 /* Define if g++ has a bug preventing us from inlining math routines.  */
 #undef __NO_MATH_INLINES
 
+/* Define if using Win32 signalling. */
+#undef USE_WIN32_SIGNALLING
+
+/* Define if using Win32 winsock library. */
+#undef USE_WINSOCK
+
 /* Define if you have the access function.  */
 #undef HAVE_ACCESS
 
Index: zip/tailor.h
===================================================================
RCS file: /cvs/java/libgcj/zip/tailor.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 tailor.h
--- tailor.h	1999/04/07 14:52:44	1.1.1.1
+++ tailor.h	2000/03/13 15:40:24
@@ -40,7 +40,7 @@
 #include "cmsmvs.h"
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(__MINGW32__)
 #include "win32/osdep.h"
 #endif
 
Index: zip/unix/osdep.h
===================================================================
RCS file: /cvs/java/libgcj/zip/unix/osdep.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 osdep.h
--- osdep.h	1999/04/07 14:52:46	1.1.1.1
+++ osdep.h	2000/03/13 15:40:24
@@ -13,7 +13,7 @@
 
 #define USE_EF_UX_TIME          /* Enable use of "UX" extra field time info */
 
-#if defined (__CYGWIN__) || defined (__CYGWIN32__)
+#if defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__)
 #  define FOPW "wb"
 #  define FOPR "rb"
 #  define FOPM "r+b"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]