This turns --with-fastjar into --with-jar (as it already
checked for gjar and jar also) and allows it to be turned
off with --without-fastjar.  As a result, --with-jar (autodetect
fastjar, gjar and jar in that order), --without-jar and
--with-jar=<path> all work.

ChangeLog:

2008-06-27  Andrew John Hughes  <[EMAIL PROTECTED]>

        PR classpath/36637:
        * examples/Makefile.am,
        * lib/Makefile.am:
        Use new conditional and $(JAR).
        * m4/acinclude.m4:
        Replace --with-fastjar with a general
        --with-jar check that can be turned off.
        * tools/Makefile.am:
        Use new conditional and $(JAR).

-- 
Andrew :)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: examples/Makefile.am
===================================================================
RCS file: /sources/classpath/classpath/examples/Makefile.am,v
retrieving revision 1.26
diff -u -u -r1.26 Makefile.am
--- examples/Makefile.am        26 Jun 2008 09:58:29 -0000      1.26
+++ examples/Makefile.am        27 Jun 2008 00:12:08 -0000
@@ -84,6 +84,13 @@
 # To generate the example zip just depend on the sources and ignore the
 # class files. Always regenerate all .class files and remove them immediatly.
 # And copy the png icons we use to the classes dir so they get also included.
+
+if WITH_JAR
+CREATE_EXAMPLE_ZIP=$(JAR) cf ../$(EXAMPLE_ZIP) .
+else
+CREATE_EXAMPLE_ZIP=$(ZIP) -r ../$(EXAMPLE_ZIP) .
+endif
+
 $(EXAMPLE_ZIP): $(EXAMPLE_JAVA_FILES)
        @mkdir_p@ classes/gnu/classpath/examples/icons
        cp $(EXAMPLE_ICONS) classes/gnu/classpath/examples/icons
@@ -91,8 +98,7 @@
        cp $(EXAMPLE_HTML) classes/gnu/classpath/examples/swing
        $(JCOMPILER) -d classes $(EXAMPLE_JAVA_FILES) 
        (cd classes; \
-       if test "$(ZIP)" != ""; then $(ZIP) -r ../$(EXAMPLE_ZIP) .; fi; \
-       if test "$(FASTJAR)" != ""; then $(FASTJAR) cf ../$(EXAMPLE_ZIP) .; fi; 
\
+       $(CREATE_EXAMPLE_ZIP); \
        cd ..)
        rm -rf classes
 
Index: lib/Makefile.am
===================================================================
RCS file: /sources/classpath/classpath/lib/Makefile.am,v
retrieving revision 1.147
diff -u -u -r1.147 Makefile.am
--- lib/Makefile.am     26 Jun 2008 09:58:29 -0000      1.147
+++ lib/Makefile.am     27 Jun 2008 00:12:16 -0000
@@ -13,18 +13,16 @@
 if CREATE_COLLECTIONS
 COLLECTIONS = collections.jar
 
+if WITH_JAR
+CREATE_COLLECTIONS_JAR=$(JAR) cf $@ $(COLLECTIONS_PREFIX)
+else
+CREATE_COLLECTIONS_JAR=$(ZIP) -r -D $@ $(COLLECTIONS_PREFIX) > /dev/null
+endif
+
 collections.jar: mkcollections.pl
        ./mkcollections.pl $(top_srcdir)
-#if FOUND_GCJ
-#      $(GCJ) -C `$(FIND) $(COLLECTIONS_PREFIX) -name '*.java' -type f -print`
-#else
        $(JCOMPILER) `$(FIND) $(COLLECTIONS_PREFIX) -name '*.java' -type f 
-print`
-#endif
-       if test "$(FASTJAR)" != ""; then \
-         "$(FASTJAR)" cf $@ $(COLLECTIONS_PREFIX); \
-       else \
-         echo "fastjar not found" > collections.jar; \
-       fi
+       $(CREATE_COLLECTIONS_JAR)
 endif # CREATE_COLLECTIONS
 
 if INSTALL_GLIBJ_ZIP
@@ -68,10 +66,14 @@
 
 else
 
-glibj.zip: classes compile-classes resources
-       if test "$(ZIP)" != ""; then $(ZIP) -r -D glibj.zip gnu java javax org 
sun META-INF > /dev/null; fi
-       if test "$(FASTJAR)" != ""; then "$(FASTJAR)" cf glibj.zip gnu java 
javax org sun META-INF; fi
+if WITH_JAR
+CREATE_GLIBJ_ZIP=$(JAR) cf glibj.zip gnu java javax org sun META-INF
+else
+CREATE_GLIBJ_ZIP=$(ZIP) -r -D glibj.zip gnu java javax org sun META-INF > 
/dev/null
+endif
 
+glibj.zip: classes compile-classes resources
+       $(CREATE_GLIBJ_ZIP)
 endif # USE_PREBUILT_GLIBJ_ZIP
 
 resources: copy-vmresources.sh
Index: m4/acinclude.m4
===================================================================
RCS file: /sources/classpath/classpath/m4/acinclude.m4,v
retrieving revision 1.36
diff -u -u -r1.36 acinclude.m4
--- m4/acinclude.m4     11 Jun 2008 21:34:34 -0000      1.36
+++ m4/acinclude.m4     27 Jun 2008 00:12:16 -0000
@@ -55,18 +55,45 @@
 AC_DEFUN([CLASSPATH_WITH_GLIBJ],
 [
   AC_PATH_PROG(ZIP, zip)
-  AC_ARG_WITH([fastjar],
-             [AS_HELP_STRING([--with-fastjar=PATH], [define to use a fastjar 
style tool])],
+
+  AC_MSG_CHECKING(for a jar-like tool)
+  AC_ARG_WITH([jar],
+             [AS_HELP_STRING([--with-jar=PATH], [define to use a jar style 
tool])],
              [
-               AC_MSG_CHECKING([for user supplied fastjar])
-               FASTJAR=${withval}
-               AC_MSG_RESULT([${FASTJAR}])
-             ],
-             [AC_PATH_PROGS([FASTJAR], [fastjar gjar jar])])
-dnl We disable ZIP by default if we find fastjar.
-  if test x"${FASTJAR}" != x; then
-    ZIP=""
+               case "${withval}" in
+                 yes)
+                   JAR=yes
+                   ;;
+                 no)
+                   JAR=no
+                   AC_MSG_RESULT(${JAR})
+                   ;;
+                 *)
+                   if test -f "${withval}"; then
+                     JAR="${withval}"
+                     AC_MSG_RESULT(${JAR})
+                   else
+                     AC_MSG_RESULT([not found])
+                     AC_MSG_ERROR([The jar tool ${withval} was not found.])
+                   fi
+                   ;;
+               esac
+             ],
+             [
+               JAR=yes
+             ])
+  if test x"${JAR}" = "xyes"; then
+    AC_MSG_RESULT([trying fastjar, gjar and jar])
+    AC_PATH_PROGS([JAR], [fastjar gjar jar])
+    if test x"${RHINO_JAR}" = "xyes"; then
+      AC_MSG_RESULT([not found])
+    fi
+  fi
+  if test x"${JAR}" = "xno" && test x"${ZIP}" = ""; then
+    AC_MSG_ERROR([No zip or jar tool found.])
   fi
+  AM_CONDITIONAL(WITH_JAR, test x"${JAR}" != "xno" && test x"${JAR}" != "xyes")
+  AC_SUBST(JAR)
   
   AC_ARG_WITH([glibj],
               [AS_HELP_STRING([--with-glibj],[define what to install 
(zip|flat|both|none|build) [default=zip]])],
Index: tools/Makefile.am
===================================================================
RCS file: /sources/classpath/classpath/tools/Makefile.am,v
retrieving revision 1.51
diff -u -u -r1.51 Makefile.am
--- tools/Makefile.am   26 Jun 2008 09:58:29 -0000      1.51
+++ tools/Makefile.am   27 Jun 2008 00:12:19 -0000
@@ -343,15 +343,22 @@
          cp $(srcdir)/resource/gnu/classpath/tools/gjdoc/$$res classes/$$res; \
        done 
 endif
+
+if WITH_JAR
+CREATE_TOOLS_ZIP=$(JAR) cf ../$(TOOLS_ZIP) .
+UPDATE_TOOLS_ZIP=$(JAR) uf ../$(TOOLS_ZIP) .
+else
+CREATE_TOOLS_ZIP=$(ZIP) -r ../$(TOOLS_ZIP) .
+UPDATE_TOOLS_ZIP=$(ZIP) -u -r ../$(TOOLS_ZIP) .
+endif
+
 ## First add classpath tools stuff.
        (cd classes; \
-       if test "$(ZIP)" != ""; then $(ZIP) -r ../$(TOOLS_ZIP) .; fi; \
-       if test "$(FASTJAR)" != ""; then "$(FASTJAR)" cf ../$(TOOLS_ZIP) .; fi; 
\
+       $(CREATE_TOOLS_ZIP); \
        cd ..)
 ## Now add ASM classes.
        (cd asm; \
-       if test "$(ZIP)" != ""; then $(ZIP) -u -r ../$(TOOLS_ZIP) .; fi; \
-       if test "$(FASTJAR)" != ""; then "$(FASTJAR)" uf ../$(TOOLS_ZIP) .; fi; 
\
+       $(UPDATE_TOOLS_ZIP); \
        cd ..)
        rm -rf classes
 

Reply via email to