This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: SunOS4 is missing memmove
On Jul 20, 1999, Per Bothner <per@bothner.com> wrote:
> Tom Tromey <tromey@cygnus.com> writes:
>> We don't link it in. libstdc++ got in trouble here since parts of
>> libiberty are GPLd; maybe we should just avoid it.
> I believe the "missing functions" (such as memmove) are public
> domain or otherwise non-problematical.
Yup, and it was even implemented by yourself :-)
Anyway, we can't assume memmove.c is in the libjava build tree, nor
should we link with -liberty, because of the licensing problems. So
we should either add a copy of libiberty's memmove.c in libjava, with
the appropriate AC_REPLACE_FUNCS magic, or use this patch, that fixes
the only occurrence of memmove in the libjava sources I could find:
Index: libjava/ChangeLog
from Alexandre Oliva <oliva@dcc.unicamp.br>
* java/lang/natSystem.cc (arraycopy): Use bcopy if memmove is not
available.
* configure.in: Do not abort if memmove is not available.
Index: libjava/configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.11.2.1
diff -u -r1.11.2.1 configure.in
--- libjava/configure.in 1999/06/24 20:14:59 1.11.2.1
+++ libjava/configure.in 1999/07/20 21:00:01
@@ -342,13 +342,6 @@
AC_MSG_ERROR([no function found to get the time])
fi
- # We require memmove.
- memmove_found=no
- AC_CHECK_FUNCS(memmove, memmove_found=yes)
- if test "$memmove_found" = no; then
- AC_MSG_ERROR([memmove is required])
- fi
-
# We require memcpy.
memcpy_found=no
AC_CHECK_FUNCS(memcpy, memcpy_found=yes)
Index: libjava/java/lang/natSystem.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natSystem.cc,v
retrieving revision 1.7
diff -u -r1.7 natSystem.cc
--- libjava/java/lang/natSystem.cc 1999/05/17 13:24:59 1.7
+++ libjava/java/lang/natSystem.cc 1999/07/20 21:00:02
@@ -171,9 +171,13 @@
dst_elts = (char *) elements ((jdoubleArray) dst);
dst_elts += size * dst_offset;
+#if HAVE_MEMMOVE
// We don't bother trying memcpy. It can't be worth the cost of
// the check.
memmove ((void *) dst_elts, (void *) src_elts, count * size);
+#else
+ bcopy ((void *) src_elts, (void *) dst_elts, count * size);
+#endif
}
else
{
I haven't completed the build on StunOS4 yet (it's stunningly slow
:-), but I'll let you know if this patch is not enough.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them