Hi,
MegaMek bundles Sun's non-free collections.jar to support older VMs. It
should really be replaced by a free collections.jar. To this end I
wrote the attached patch. It updates the mkcollections Perl script and
adds a --enable-collections configure option. The collections package
name defaults to gnu.java.util.collections but can be overridden by
passing --enable-collections an argument. For example:
/path/to/classpath/configure --enable-collections=com/sun/java/util/collections
&& make
produces /build/path/lib/collections.jar, which provides a drop-in
replacement for the collections.jar that MegaMek currently bundles. I
bundle the source code so that our collections.jar is easily
distinguishable from Sun's.
Tested with "make distcheck". OK to commit?
Tom
2006-03-02 Thomas Fitzsimmons <[EMAIL PROTECTED]>
* configure.ac: Add --enable-collections option.
* lib/Makefile.am (collections.jar): New target.
(glibj_DATA): Add $(COLLECTIONS).
* lib/mkcollections.pl.in (destpath): Set from COLLECTION_PREFIX
configure substitution.
(classpath): Read from command line.
(javautilclasses): Remove BasicMapEntry. Add RandomAccess.
Index: configure.ac
===================================================================
RCS file: /sources/classpath/classpath/configure.ac,v
retrieving revision 1.134
diff -u -r1.134 configure.ac
--- configure.ac 13 Feb 2006 19:13:15 -0000 1.134
+++ configure.ac 3 Mar 2006 02:53:03 -0000
@@ -39,6 +39,20 @@
AC_PREFIX_DEFAULT(/usr/local/classpath)
dnl -----------------------------------------------------------
+dnl Enable collections.jar (disabled by default)
+dnl -----------------------------------------------------------
+AC_ARG_ENABLE([collections],
+ [AS_HELP_STRING(--enable-collections,create collections.jar [default=no])],
+ [case x"${enableval}" in
+ xyes) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
+ xno) COMPILE_COLLECTIONS=no ;;
+ x) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"gnu/java/util/collections\"" ;;
+ *) COMPILE_COLLECTIONS=yes; COLLECTIONS_PREFIX="\"${enableval}\"" ;;
+ esac],
+ [COMPILE_COLLECTIONS=no])
+AM_CONDITIONAL(CREATE_COLLECTIONS, test "x${COMPILE_COLLECTIONS}" = xyes)
+
+dnl -----------------------------------------------------------
dnl Enable JNI libraries (enabled by default)
dnl -----------------------------------------------------------
AC_ARG_ENABLE([jni],
@@ -234,6 +248,14 @@
AC_PROG_CC
AC_PROG_CPP
+if test "x${COMPILE_COLLECTIONS}" = xyes; then
+ AC_PATH_PROG(PERL, [perl])
+ AC_SUBST(PERL)
+ AC_SUBST(COLLECTIONS_PREFIX)
+ AC_CONFIG_FILES([lib/mkcollections.pl])
+ AC_CONFIG_COMMANDS([mkcollections.pl],[chmod 755 lib/mkcollections.pl])
+fi
+
if test "x${COMPILE_JNI}" = xyes; then
AC_HEADER_STDC
Index: lib/Makefile.am
===================================================================
RCS file: /sources/classpath/classpath/lib/Makefile.am,v
retrieving revision 1.111
diff -u -r1.111 Makefile.am
--- lib/Makefile.am 13 Feb 2006 19:13:16 -0000 1.111
+++ lib/Makefile.am 3 Mar 2006 02:53:06 -0000
@@ -38,9 +38,26 @@
JAVAH = $(USER_JAVAH) -jni -classpath .:$(USER_CLASSLIB)
+if CREATE_COLLECTIONS
+COLLECTIONS = collections.jar
+
+collections.jar: mkcollections.pl
+ ./mkcollections.pl $(top_srcdir)
+if FOUND_GCJ
+ $(GCJ) -C `$(FIND) $(COLLECTIONS_PREFIX) -name '*' -type f -print`
+else
+ $(JAVAC) `$(FIND) $(COLLECTIONS_PREFIX) -name '*' -type f -print`
+endif
+ if test "$(FASTJAR)" != ""; then \
+ $(FASTJAR) cf $@ $(COLLECTIONS_PREFIX); \
+ else \
+ echo "fastjar not found" > collections.jar; \
+ fi
+endif # CREATE_COLLECTIONS
+
if INSTALL_GLIBJ_ZIP
-glibj_DATA = glibj.zip
+glibj_DATA = glibj.zip $(COLLECTIONS)
endif # INSTALL_GLIBJ_ZIP
Index: lib/mkcollections.pl.in
===================================================================
RCS file: /sources/classpath/classpath/lib/mkcollections.pl.in,v
retrieving revision 1.3
diff -u -r1.3 mkcollections.pl.in
--- lib/mkcollections.pl.in 2 Jul 2005 20:32:52 -0000 1.3
+++ lib/mkcollections.pl.in 3 Mar 2006 02:53:06 -0000
@@ -22,8 +22,8 @@
# the Free Software Foundation, 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
-my $destpath=pop || "gnu/java/util/collections";
-my $classpath="..";
+my [EMAIL PROTECTED]@;
+my $classpath=pop;
my @javalangclasses=qw(UnsupportedOperationException
Comparable);
my @javautilclasses=qw(AbstractCollection
@@ -33,7 +33,6 @@
AbstractSet
ArrayList
Arrays
- BasicMapEntry
List
Collection
Collections
@@ -48,6 +47,7 @@
Map
NoSuchElementException
Random
+ RandomAccess
Set
SortedMap
SortedSet