[m-rev.] For review: Have configure decide whether to install the Java grade

James Goddard goddardjames at yahoo.com
Tue Feb 10 19:07:37 AEDT 2004


Estimated hours taken: 8
Branches: main

Have the configure script decide whether to install the Java grade.

configure.in:
	Add Java to the list of library grades to install by default,
	if the Java SDK is installed.
	Add the option to disable the Java grade.

aclocal.m4:
	Detect whether the Java SDK is installed.  Currently this is done
	by checking for javac, java and jar, then testing whether a program
	can be compiled which confirms the version is recent enough.

scripts/Mmake.vars.in:
	Add JAVAC, JAVAI and JAR to the generated make variables.
	Add JAR_CREATE_FLAGS make variable, set as "cf"

library/Mmakefile:
	Import Mmake.vars
	Use "$(JAR) $(JAR_CREATE_FLAGS)" instead of "jar cf"

This is just the relative diff since my last post:
--------------------------------------------------------------------
diff -u aclocal.m4 aclocal.m4
--- aclocal.m4	10 Feb 2004 05:41:14 -0000
+++ aclocal.m4	10 Feb 2004 08:03:12 -0000
@@ -285,11 +285,15 @@
 #
 AC_DEFUN(MERCURY_CHECK_JAVA,
 [
-AC_PATH_PROG(JAVAC, javac)
+# jikes requires the usual Java SDK to run, so if we checked for javac first,
+# then that's what we'd get. If the user has jikes installed, then that
+# probably means that they want to use it, so we check for jikes before javac.
+AC_PATH_PROGS(JAVAC, jikes javac gcj)
 AC_PATH_PROG(JAVAI, java)
+AC_PATH_PROG(JAR, jar)
 
 AC_CACHE_VAL(mercury_cv_java, [
-if test "$JAVAC" != "" -a "$JAVAI" != ""; then
+if test "$JAVAC" != "" -a "$JAVAI" != "" -a "$JAR" != ""; then
 	AC_MSG_CHECKING(if the above Java SDK works and is sufficiently recent)
 	cat > conftest.java << EOF
 		// This program simply retrieves the constant
@@ -341,6 +345,7 @@
 
 AC_SUBST(JAVAC)
 AC_SUBST(JAVAI)
+AC_SUBST(JAR)
 ])
 
 #-----------------------------------------------------------------------------#
only in patch2:
--- library/Mmakefile	5 Feb 2004 07:35:56 -0000	1.130
+++ library/Mmakefile	10 Feb 2004 07:36:26 -0000
@@ -26,6 +26,7 @@
 MERCURY_DIR=..
 LINK_RUNTIME_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
+include $(MERCURY_DIR)/scripts/Mmake.vars
 -include Mmake.library.params
 
 # Module-specific options should go in Mercury.options so they
@@ -254,8 +255,9 @@
 # any architecture-specific objects.
 .PHONY:	jars
 jars:	classes
-	jar cf $(STD_LIB_NAME).jar mercury/*.class
-	jar cf $(STD_LIB_NAME).runtime.jar mercury/runtime/*.class
+	$(JAR) $(JAR_CREATE_FLAGS) $(STD_LIB_NAME).jar mercury/*.class
+	$(JAR) $(JAR_CREATE_FLAGS) $(STD_LIB_NAME).runtime.jar \
+			mercury/runtime/*.class
 	-+cd mercury/runtime && mmake $(NATIVE_SO)
 	-cp mercury/runtime/$(NATIVE_SO) .
 
only in patch2:
--- scripts/Mmake.vars.in	27 Jan 2004 00:20:35 -0000	1.92
+++ scripts/Mmake.vars.in	10 Feb 2004 07:30:06 -0000
@@ -276,13 +276,22 @@
 
 # JAVAC is the command line java compiler;
 # it should generate .class files from .java files.
-JAVAC		= javac
+JAVAC		= @JAVAC@
 ALL_JAVACFLAGS	= $(JAVACFLAGS) $(EXTRA_JAVACFLAGS) $(TARGET_JAVACFLAGS) \
 		$(LIB_JAVACFLAGS)
 JAVACFLAGS	=
 EXTRA_JAVACFLAGS =
 # XXX Should we set LIB_JAVACFLAGS?
 LIB_JAVACFLAGS	= 
+
+# JAVAI is the command line Java interpreter;
+# it should be able to run Java bytecode files.
+JAVAI		= @JAVAI@
+
+# JAR is the command line Java archive tool;
+# it should generate .jar files.
+JAR		= @JAR@
+JAR_CREATE_FLAGS = cf
 
 #-----------------------------------------------------------------------------#
 #
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list