This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: --without-libffi
- To: java-patches at gcc dot gnu dot org
- Subject: Patch: --without-libffi
- From: Anthony Green <green at redhat dot com>
- Date: Wed, 23 May 2001 10:49:10 -0700
- Reply-to: green at cygnus dot com
Yesterday I built libgcj for a target with no libffi port. This patch
introduces a --without-libffi configure option, and allows you to set
with_libffi_default in configure.host. USE_LIBFFI is defined when
libffi is to be used.
I also tweaked --disable-java-net processing because it didn't seem to
be working properly. I replaced this bit with proper testing in AC_ARG_ENABLE...
-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
For some reason the test was never true, so enable_java_net_default
never gets used.
Ok for branch and trunk?
2001-05-23 Anthony Green <green@redhat.com>
* configure: Rebuild.
* configure.in (LIBFFIINCS, LIBFFI): Introduce. Add
--without-libffi option. Tweak --disable-java-net processing.
* Makefile.in: Rebuild.
* Makefile.am (LIBFFIINCS, LIBFFI): Use.
* include/config.h.in: Rebuild.
* acconfig.h (USE_LIBFFI): Define.
* java/lang/reflect/natMethod.c: Use USE_LIBFFI.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.129.2.10
diff -u -p -p -r1.129.2.10 Makefile.am
--- Makefile.am 2001/05/20 16:24:40 1.129.2.10
+++ Makefile.am 2001/05/23 17:35:34
@@ -105,7 +105,7 @@ endif
JCFLAGS = -g
JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS)
-LIBFFIINCS = -I$(top_srcdir)/../libffi/include -I$(MULTIBUILDTOP)../libffi/include
+LIBFFIINCS = @LIBFFIINCS@
INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \
$(GCINCS) $(THREADINCS) $(INCLTDL) \
@@ -260,7 +260,7 @@ libgcj.la: $(libgcj_la_OBJECTS) $(libgcj
@echo $(libgcj_la_OBJECTS) > libgcj.objectlist;
@echo $(libgcj_la_LIBADD) >> libgcj.objectlist;
$(libgcj_la_LINK) -objectlist libgcj.objectlist \
- ../libffi/libfficonvenience.la \
+ @LIBFFI@ \
-rpath $(toolexeclibdir) $(libgcj_la_LDFLAGS) $(LIBS)
libgcjx.la: $(libgcjx_la_OBJECTS) $(libgcjx_la_DEPENDENCIES)
Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acconfig.h,v
retrieving revision 1.19
diff -u -p -p -r1.19 acconfig.h
--- acconfig.h 2000/04/02 15:34:17 1.19
+++ acconfig.h 2001/05/23 17:35:34
@@ -113,6 +113,9 @@
/* Define if java.net native functions should be stubbed out. */
#undef DISABLE_JAVA_NET
+/* Define if we're to use libffi. */
+#undef USE_LIBFFI
+
/* Define if system properties shouldn't be read from
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.73.2.9
diff -u -p -p -r1.73.2.9 configure.in
--- configure.in 2001/05/23 17:11:05 1.73.2.9
+++ configure.in 2001/05/23 17:35:35
@@ -147,15 +147,27 @@ AC_SUBST(LIBDATASTARTSPEC)
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])
+[ --disable-java-net disable java.net],,enable_java_net=${enable_java_net_default-yes})
-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" = no; then
AC_DEFINE(DISABLE_JAVA_NET)
fi
+
+dnl See if the user wants to configure without libffi. Some
+dnl architectures don't support it, and default values are set in
+dnl configure.host.
+AC_ARG_WITH(libffi,
+[ --without-libffi don't use libffi],,with_libffi=${with_libffi_default-yes})
+
+LIBFFI=
+LIBFFIINCS=
+if test "$with_libffi" != no; then
+ AC_DEFINE(USE_LIBFFI)
+ LIBFFI=../libffi/libfficonvenience.la
+ LIBFFIINCS="-I$(top_srcdir)/../libffi/include -I$(MULTIBUILDTOP)../libffi/include"
+fi
+AC_SUBST(LIBFFI)
+AC_SUBST(LIBFFIINCS)
dnl See if the user wants to disable JVMPI support.
AC_ARG_ENABLE(jvmpi,
Index: include/config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/config.h.in,v
retrieving revision 1.27.4.1
diff -u -p -p -r1.27.4.1 config.h.in
--- config.h.in 2001/04/01 10:32:36 1.27.4.1
+++ config.h.in 2001/05/23 17:35:35
@@ -131,6 +131,9 @@
/* Define if java.net native functions should be stubbed out. */
#undef DISABLE_JAVA_NET
+/* Define if we're to use libffi. */
+#undef USE_LIBFFI
+
/* Define if system properties shouldn't be read from
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
Index: java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.20
diff -u -p -p -r1.20 natMethod.cc
--- natMethod.cc 2001/01/08 23:28:56 1.20
+++ natMethod.cc 2001/05/23 17:35:35
@@ -44,7 +44,11 @@ details. */
#include <stdlib.h>
+#if USE_LIBFFI
#include <ffi.h>
+#else
+#include <java/lang/UnsupportedOperationException.h>
+#endif
// FIXME: remove these.
#define BooleanClass java::lang::Boolean::class$
@@ -107,6 +111,7 @@ can_widen (jclass from, jclass to)
return fromx <= tox;
}
+#ifdef USE_LIBFFI
static inline ffi_type *
get_ffi_type (jclass klass)
{
@@ -148,6 +153,7 @@ get_ffi_type (jclass klass)
return r;
}
+#endif // USE_LIBFFI
jobject
java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
@@ -312,6 +318,7 @@ _Jv_CallAnyMethodA (jobject obj,
jvalue *args,
jvalue *result)
{
+#if USE_LIBFFI
JvAssert (! is_constructor || ! obj);
JvAssert (! is_constructor || return_type);
@@ -428,6 +435,10 @@ _Jv_CallAnyMethodA (jobject obj,
result->l = obj;
return ex;
+#else
+ throw new java::lang::UnsupportedOperationException;
+ return 0;
+#endif // USE_LIBFFI
}
// This is another version of _Jv_CallAnyMethodA, but this one does
AG