Hi,
Chris Hoffmann from the JikesRVM team sent a patch some time ago for
Mac OS X support.
(see: http://mail.gnu.org/archive/html/classpath/2003-10/msg00032.html)
I adapted his work to suit more the target native framework.
Basically, what I did is:
1) Copy the Linux target directory to a Darwin directory. (Darwin is
the name of the Unix system under Mac OS X).
2) Modified configure.ac/Makefile to use it.
Note: The diff between Darwin and Linux are quite small, basically 2
lines but I still added a arch.
Note: I am not a Darwin/OS X expert by the way.
>From the original patch:
+#if (defined( __BIG_ENDIAN__) && defined( __APPLE__ ))
+#define __IEEE_BIG_ENDIAN
+#endif
+
+
I did not use that. I simply set CPPFLAGS as -D__PPC__ -D_BIG_ENDIAN
when compiling and leave that file untouched. It may be tempting to add
a __APPLE__ beside the __AIX__, but __PPC__ is not defined by gcc and
we still need the CPPFLAGS anyway. Unless we do a completely separte #ifdef
__APPLE__... not under the #ifdef __PPC__.
- INIT_FIELD ("in", 0);
- INIT_FIELD ("out", 1);
- INIT_FIELD ("err", 2);
+ INIT_FIELD ("in", ((long long)0));
+ INIT_FIELD ("out", ((long long)1));
+ INIT_FIELD ("err", ((long long)2));
I did not do that part either. Seem to work fine.
+#ifndef O_SYNC
+#undef TARGET_NATIVE_FILE_FILEFLAG_SYNC
+#define TARGET_NATIVE_FILE_FILEFLAG_SYNC O_FSYNC
+#endif
Here the problem is that O_FSYNC is be defined in fcntl.h.
However, fcntl.h is not included for the constant in the generic file.
On Linux works fine,
OS X don't like it. So either the Linux fcntl.h gets included
by some other include etc. Would need investigation.
What I did, is to add a #include in the Darwin specific target file.
Finally, for:
+#ifdef __MACH__
+typedef int socklen_t;
+#endif
I simply added it (without the #ifdef) to the network target specific
file.
David
SableVM developer
---
David B�langer
Graduate Student
School of Computer Science
McGill University
Office: MC226
Web page: http://www.cs.mcgill.ca/~dbelan2/
Public key: http://www.cs.mcgill.ca/~dbelan2/public_key.txt
Index: native/target/Darwin/target_native_math_float.h
===================================================================
--- native/target/Darwin/target_native_math_float.h (revision 1442)
+++ native/target/Darwin/target_native_math_float.h (revision 1477)
@@ -0,0 +1,80 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of float/double constants/
+ macros/functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_MATH_FLOAT__
+#define __TARGET_NATIVE_MATH_FLOAT__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_math_float.h"
+
+#endif /* __TARGET_NATIVE_MATH_FLOAT__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native_math_float.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native_file.h
===================================================================
--- native/target/Darwin/target_native_file.h (revision 1442)
+++ native/target/Darwin/target_native_file.h (revision 1477)
@@ -0,0 +1,82 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of file functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_FILE__
+#define __TARGET_NATIVE_FILE__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/* to have definition of O_FSYNC */
+#include <fcntl.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_file.h"
+
+#endif /* __TARGET_NATIVE_FILE__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native_file.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native.h
===================================================================
--- native/target/Darwin/target_native.h (revision 1442)
+++ native/target/Darwin/target_native.h (revision 1477)
@@ -0,0 +1,79 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Linux target global defintions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE__
+#define __TARGET_NATIVE__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic.h"
+
+#endif /* __TARGET_NATIVE__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native_math_int.h
===================================================================
--- native/target/Darwin/target_native_math_int.h (revision 1442)
+++ native/target/Darwin/target_native_math_int.h (revision 1477)
@@ -0,0 +1,80 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of int/int64 constants/
+ macros/functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_MATH_INT__
+#define __TARGET_NATIVE_MATH_INT__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_math_int.h"
+
+#endif /* __TARGET_NATIVE_MATH_INT__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native_math_int.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/Makefile.am
===================================================================
--- native/target/Darwin/Makefile.am (revision 1442)
+++ native/target/Darwin/Makefile.am (revision 1477)
@@ -0,0 +1,10 @@
+## Input file for automake to generate the Makefile.in used by configure
+
+EXTRA_DIST = \
+target_native_io.h \
+target_native_misc.h \
+target_native.h \
+target_native_math_float.h \
+target_native_network.h \
+target_native_file.h \
+target_native_math_int.h
Property changes on: native/target/Darwin/Makefile.am
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native_io.h
===================================================================
--- native/target/Darwin/target_native_io.h (revision 1442)
+++ native/target/Darwin/target_native_io.h (revision 1477)
@@ -0,0 +1,78 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of miscellaneous functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_IO__
+#define __TARGET_NATIVE_IO__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_io.h"
+
+#endif /* __TARGET_NATIVE_MISC__ */
+
+/* end of file */
Property changes on: native/target/Darwin/target_native_io.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native_network.h
===================================================================
--- native/target/Darwin/target_native_network.h (revision 1442)
+++ native/target/Darwin/target_native_network.h (revision 1477)
@@ -0,0 +1,81 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of network functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_NETWORK__
+#define __TARGET_NATIVE_NETWORK__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+typedef int socklen_t;
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_network.h"
+
+#endif /* __TARGET_NATIVE_NETWORK__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native_network.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/target_native_misc.h
===================================================================
--- native/target/Darwin/target_native_misc.h (revision 1442)
+++ native/target/Darwin/target_native_misc.h (revision 1477)
@@ -0,0 +1,79 @@
+/* ???.h - ???
+ Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+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. */
+
+/*
+Description: Darwin target defintions of miscellaneous functions
+Systems : all
+*/
+
+#ifndef __TARGET_NATIVE_MISC__
+#define __TARGET_NATIVE_MISC__
+
+/****************************** Includes *******************************/
+/* do not move; needed here because of some macro definitions */
+#include <config.h>
+
+#include <stdlib.h>
+
+/****************** Conditional compilation switches *******************/
+
+/***************************** Constants *******************************/
+
+/***************************** Datatypes *******************************/
+
+/***************************** Variables *******************************/
+
+/****************************** Macros *********************************/
+
+/***************************** Functions *******************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* include rest of definitions from generic file (do not move it to
+ another position!) */
+#include "target_generic_misc.h"
+
+#endif /* __TARGET_NATIVE_MISC__ */
+
+/* end of file */
+
Property changes on: native/target/Darwin/target_native_misc.h
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Index: native/target/Darwin/.cvsignore
===================================================================
--- native/target/Darwin/.cvsignore (revision 1442)
+++ native/target/Darwin/.cvsignore (revision 1477)
@@ -0,0 +1,8 @@
+*.o
+*.a
+*.lo
+*.la
+.libs
+.deps
+Makefile
+Makefile.in
Property changes on: native/target/Darwin/.cvsignore
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Property changes on: native/target/Darwin
___________________________________________________________________
Name: svn:ignore
+
Makefile
Makefile.in
Index: native/target/Makefile.am
===================================================================
--- native/target/Makefile.am (revision 1442)
+++ native/target/Makefile.am (revision 1477)
@@ -1,5 +1,5 @@
## Input file for automake to generate the Makefile.in used by configure
-SUBDIRS = Linux generic
+SUBDIRS = Darwin Linux generic
EXTRA_DIST = readme.txt
Index: configure.ac
===================================================================
--- configure.ac (revision 1442)
+++ configure.ac (revision 1477)
@@ -141,8 +141,15 @@
dnl add the include files for the native abstraction layer
dnl -----------------------------------------------------------
-EXTRA_INCLUDES="${EXTRA_INCLUDES} -I\$(top_srcdir)/native/target/Linux
-I\$(top_srcdir)/native/target/generic"
+case $host in
+ powerpc-apple-darwin*) TARGET=Darwin
+ ;;
+ *) TARGET=Linux
+ ;;
+esac
+EXTRA_INCLUDES="${EXTRA_INCLUDES} -I\$(top_srcdir)/native/target/${TARGET}
-I\$(top_srcdir)/native/target/generic"
+
dnl -----------------------------------------------------------
if test "x${COMPILE_JNI}" = xyes; then
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath