summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--NEWS2
-rw-r--r--configure.ac30
-rwxr-xr-xtools/Makefile.am40
-rw-r--r--tools/toolwrapper.c (renamed from tools/appletviewer.c)51
5 files changed, 94 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 656a99015..ad1a4b9a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-05-27 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * configure.ac (FOUND_CACAO): New automake conditional.
+ Add --enable-tool-wrappers.
+ * NEWS: Introduce the --enable-tool-wrappers option.
+ * tools/Makefile.am[CREATE_WRAPPERS]: Build wrapper binaries.
+ * tools/appletviewer.c: Remove file. Make tool-indepedent and
+ rename ...
+ * tools/toolwrapper.c: New file.
+
2006-05-27 Dalibor Topic <robilad@kaffe.org>
* java/awt/Graphics2D.java: Use full class name for
diff --git a/NEWS b/NEWS
index aad12db29..0f96daf43 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ New in release 0.92 (UNRELEASED)
* jar
* native2ascii
* serialver
+ A new configure option --enable-tool-wrappers causes wrapper
+ binaries to be built for VMs that support the JNI Invocation API.
New in release 0.91 (May 15, 2006)
diff --git a/configure.ac b/configure.ac
index c4b8412dd..8132713a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,6 +232,7 @@ AC_ARG_WITH([vm],
])
AC_SUBST(VM_BINARY)
+AM_CONDITIONAL(FOUND_CACAO, test "x`basename $VM_BINARY`" = xcacao)
dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default)
@@ -246,6 +247,20 @@ AC_ARG_ENABLE([regen-headers],
[REGENERATE_JNI_HEADERS=no])
AM_CONDITIONAL(CREATE_JNI_HEADERS, test "x${REGENERATE_JNI_HEADERS}" = xyes)
+dnl -----------------------------------------------------------
+dnl Enable tool wrapper binaries (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([tool-wrappers],
+ [AS_HELP_STRING(--enable-tool-wrappers,create tool wrapper binaries [default=no])],
+ [case x"${enableval}" in
+ xyes) COMPILE_WRAPPERS=yes ;;
+ xno) COMPILE_WRAPPERS=no ;;
+ x) COMPILE_WRAPPERS=yes ;;
+ *) COMPILE_WRAPPERS=yes ;;
+ esac],
+ [COMPILE_WRAPPERS=no])
+AM_CONDITIONAL(CREATE_WRAPPERS, test "x${COMPILE_WRAPPERS}" = xyes)
+
AC_PROG_LN_S
AC_PROG_INSTALL
@@ -695,15 +710,20 @@ scripts/classpath.spec
lib/Makefile
lib/gen-classlist.sh
lib/copy-vmresources.sh
-tools/appletviewer
tools/Makefile
-tools/jarsigner
-tools/keytool
examples/Makefile
examples/Makefile.jawt])
-AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
-AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
+
+if test "x${COMPILE_WRAPPERS}" = xno
+then
+AC_CONFIG_FILES([tools/appletviewer
+tools/jarsigner
+tools/keytool])
AC_CONFIG_COMMANDS([appletviewer],[chmod 755 tools/appletviewer])
AC_CONFIG_COMMANDS([jarsigner],[chmod 755 tools/jarsigner])
AC_CONFIG_COMMANDS([keytool],[chmod 755 tools/keytool])
+fi
+
+AC_CONFIG_COMMANDS([gen-classlist],[chmod 755 lib/gen-classlist.sh])
+AC_CONFIG_COMMANDS([copy-vmresources],[chmod 755 lib/copy-vmresources.sh])
AC_OUTPUT
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 11aac4d30..ba5ed755e 100755
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -21,8 +21,46 @@ endif
endif
endif
+if CREATE_WRAPPERS
+bin_SCRIPTS =
+bin_PROGRAMS = appletviewer jarsigner keytool
+
+if FOUND_GCJ
+LIBJVM = -lgcj
+else
+if FOUND_CACAO
+LIBJVM = -lcacaovm
+else
+LIBJVM =
+endif
+endif
+
+appletviewer_SOURCES = toolwrapper.c
+appletviewer_CFLAGS = -Wall \
+ -DDATA_DIR="\"$(datadir)\"" \
+ -DPACKAGE="\"$(PACKAGE)\"" \
+ -DTOOLNAME="\"appletviewer\""
+appletviewer_LDFLAGS = $(LIBJVM)
+
+jarsigner_SOURCES = toolwrapper.c
+jarsigner_CFLAGS = -Wall \
+ -DDATA_DIR="\"$(datadir)\"" \
+ -DPACKAGE="\"$(PACKAGE)\"" \
+ -DTOOLNAME="\"jarsigner\""
+jarsigner_LDFLAGS = $(LIBJVM)
+
+keytool_SOURCES = toolwrapper.c
+keytool_CFLAGS = -Wall \
+ -DDATA_DIR="\"$(datadir)\"" \
+ -DPACKAGE="\"$(PACKAGE)\"" \
+ -DTOOLNAME="\"keytool\""
+keytool_LDFLAGS = $(LIBJVM)
+
+else
bin_SCRIPTS = appletviewer jarsigner keytool
-EXTRA_DIST = appletviewer.in appletviewer.c jarsigner.in keytool.in
+bin_PROGRAMS =
+endif
+EXTRA_DIST = toolwrapper.c appletviewer.in jarsigner.in keytool.in
# All our example java source files
TOOLS_JAVA_FILES = $(srcdir)/gnu/classpath/tools/*.java $(srcdir)/gnu/classpath/tools/*/*.java $(srcdir)/gnu/classpath/tools/*/*/*.java
diff --git a/tools/appletviewer.c b/tools/toolwrapper.c
index 2609ccaf6..de6556c63 100644
--- a/tools/appletviewer.c
+++ b/tools/toolwrapper.c
@@ -1,5 +1,5 @@
-/* appletviewer.c -- a native appletviewer wrapper for VMs that
- support the JNI invocation interface
+/* toolwrapper.c -- a native tool wrapper for VMs that support the JNI
+ invocation interface
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +37,6 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
#include <jni.h>
-#include <glib.h>
#include <string.h>
#include <stdlib.h>
#include "config.h"
@@ -93,41 +92,27 @@ main (int argc, const char** argv)
if (vm_args.options == NULL)
{
- g_printerr ("appletviewer: realloc failed.\n");
+ fprintf (stderr, TOOLNAME ": realloc failed.\n");
goto destroy;
}
if (strlen (argv[i]) == 2)
{
- g_printerr ("appletviewer: the -J option must not be followed by a space.\n");
+ fprintf (stderr, TOOLNAME ": the -J option must not be followed by a space.\n");
goto destroy;
}
else
- vm_args.options[vm_args.nOptions++].optionString = g_strdup (argv[i] + 2);
- }
- else if (!strncmp (argv[i], "--version", 9)
- && argv[i][9] == '\0')
- {
- g_print ("appletviewer (GCJ Applet Viewer) " PACKAGE_VERSION "\n");
- exit (0);
- }
- else if (!strncmp (argv[i], "-debug", 6)
- && argv[i][6] == '\0')
- {
- /* FIXME: Ignore for now. The debug option will be
- unsupported until we have the ability to debug
- bytecode. For now, just strip it out of the argument
- list. */
+ vm_args.options[vm_args.nOptions++].optionString = strdup (argv[i] + 2);
}
else
{
non_vm_argv = (char**) realloc (non_vm_argv, (non_vm_argc + 1) * sizeof (char*));
if (non_vm_argv == NULL)
{
- g_printerr ("appletviewer: realloc failed.\n");
+ fprintf (stderr, TOOLNAME ": realloc failed.\n");
goto destroy;
}
- non_vm_argv[non_vm_argc++] = g_strdup (argv[i]);
+ non_vm_argv[non_vm_argc++] = strdup (argv[i]);
}
}
}
@@ -139,18 +124,18 @@ main (int argc, const char** argv)
if (vm_args.options == NULL)
{
- g_printerr ("appletviewer: realloc failed.\n");
+ fprintf (stderr, TOOLNAME ": realloc failed.\n");
goto destroy;
}
- vm_args.options[vm_args.nOptions++].optionString = "-Djava.class.path=" "@datadir@/@PACKAGE@/tools.zip";
+ vm_args.options[vm_args.nOptions++].optionString = "-Djava.class.path=" DATA_DIR "/" PACKAGE "/tools.zip";
}
/* Terminate vm_args.options with a NULL element. */
vm_args.options = (JavaVMOption*) realloc (vm_args.options, (vm_args.nOptions + 1) * sizeof (JavaVMOption));
if (vm_args.options == NULL)
{
- g_printerr ("appletviewer: realloc failed.\n");
+ fprintf (stderr, TOOLNAME ": realloc failed.\n");
goto destroy;
}
vm_args.options[vm_args.nOptions].optionString = NULL;
@@ -159,7 +144,7 @@ main (int argc, const char** argv)
non_vm_argv = (char**) realloc (non_vm_argv, (non_vm_argc + 1) * sizeof (char*));
if (non_vm_argv == NULL)
{
- g_printerr ("appletviewer: realloc failed.\n");
+ fprintf (stderr, TOOLNAME ": realloc failed.\n");
goto destroy;
}
non_vm_argv[non_vm_argc] = NULL;
@@ -171,7 +156,7 @@ main (int argc, const char** argv)
if (result < 0)
{
- g_printerr ("appletviewer: couldn't create virtual machine\n");
+ fprintf (stderr, TOOLNAME ": couldn't create virtual machine\n");
goto destroy;
}
@@ -180,14 +165,14 @@ main (int argc, const char** argv)
string_class_id = (*env)->FindClass (env, "java/lang/String");
if (string_class_id == NULL)
{
- g_printerr ("appletviewer: FindClass failed.\n");
+ fprintf (stderr, TOOLNAME ": FindClass failed.\n");
goto destroy;
}
args_array = (*env)->NewObjectArray (env, non_vm_argc, string_class_id, NULL);
if (args_array == NULL)
{
- g_printerr ("appletviewer: NewObjectArray failed.\n");
+ fprintf (stderr, TOOLNAME ": NewObjectArray failed.\n");
goto destroy;
}
@@ -196,17 +181,17 @@ main (int argc, const char** argv)
str = (*env)->NewStringUTF (env, non_vm_argv[i]);
if (str == NULL)
{
- g_printerr ("appletviewer: NewStringUTF failed.\n");
+ fprintf (stderr, TOOLNAME ": NewStringUTF failed.\n");
goto destroy;
}
(*env)->SetObjectArrayElement (env, args_array, i, str);
}
- class_id = (*env)->FindClass (env, "gnu/classpath/tools/appletviewer/Main");
+ class_id = (*env)->FindClass (env, "gnu/classpath/tools/" TOOLNAME "/Main");
if (class_id == NULL)
{
- g_printerr ("appletviewer: FindClass failed.\n");
+ fprintf (stderr, TOOLNAME ": FindClass failed.\n");
goto destroy;
}
@@ -214,7 +199,7 @@ main (int argc, const char** argv)
if (method_id == NULL)
{
- g_printerr ("appletviewer: GetStaticMethodID failed.\n");
+ fprintf (stderr, TOOLNAME ": GetStaticMethodID failed.\n");
goto destroy;
}