+2001-09-08 Bruno Haible <haible@clisp.cons.org>
+
+ * configure.in: Call gt_JAVACOMP and check for 'jar'. Define BUILDJAVA.
+ Call gt_JAVAEXEC. Define TESTJAVA.
+ (AC_OUTPUT): Also create lib/javacomp.sh and lib/javaexec.sh.
+
2001-09-06 Bruno Haible <haible@clisp.cons.org>
* configure.in: Add AC_REPLACE_FUNCS of strpbrk.
AC_PROG_YACC
gt_PROG_LEX
+gt_JAVACOMP
+AC_CHECK_PROG(JAR, jar, jar)
+if test -n "$HAVE_JAVACOMP" && test -n "$JAR"; then
+ BUILDJAVA=yes
+else
+ BUILDJAVA=no
+fi
+AC_SUBST(BUILDJAVA)
+
+gt_JAVAEXEC
+if test -n "$HAVE_JAVAEXEC" && test $BUILDJAVA = yes; then
+ TESTJAVA=yes
+else
+ TESTJAVA=no
+fi
+AC_SUBST(TESTJAVA)
+
dnl Check for host type.
AC_CANONICAL_HOST
EOF
-AC_OUTPUT([Makefile lib/Makefile intl/Makefile src/Makefile po/Makefile.in \
- doc/Makefile man/Makefile man/x-to-1 tests/Makefile m4/Makefile \
+AC_OUTPUT([Makefile \
+ lib/Makefile lib/javacomp.sh lib/javaexec.sh \
+ intl/Makefile \
+ src/Makefile \
+ po/Makefile.in \
+ doc/Makefile man/Makefile man/x-to-1 \
+ tests/Makefile \
+ m4/Makefile \
misc/Makefile misc/gettextize])
+2001-09-08 Bruno Haible <haible@clisp.cons.org>
+
+ * javacomp.sh.in: New file.
+ * javaexec.sh.in: New file.
+
2001-09-06 Bruno Haible <haible@clisp.cons.org>
* javacomp.h: New file.
--- /dev/null
+#!/bin/sh
+# Compile a Java program.
+
+# Copyright (C) 2001 Free Software Foundation, Inc.
+# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# This uses the same choices as javacomp.c, but instead of relying on the
+# environment settings at run time, it uses the environment variables
+# present at configuration time.
+#
+# This is a separate shell script, because it must be able to unset JAVA_HOME
+# in some cases, which a simple shell command cannot do.
+#
+# The extra CLASSPATH must have been set prior to calling this script.
+# Options that can be passed are -O, -g and "-d DIRECTORY".
+
+CONF_JAVAC='@JAVAC@'
+CONF_CLASSPATH='@CLASSPATH@'
+if test -n "$CONF_JAVAC"; then
+ # Combine given CLASSPATH and configured CLASSPATH.
+ if test -n "$CLASSPATH"; then
+ CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
+ else
+ CLASSPATH="$CONF_CLASSPATH"
+ fi
+ export CLASSPATH
+ test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
+ exec $CONF_JAVAC "$@"
+else
+ unset JAVA_HOME
+ if test -n "@HAVE_GCJ@"; then
+ CLASSPATH="$CLASSPATH"
+ export CLASSPATH
+ test -z "$JAVA_VERBOSE" || echo gcj -C "$@"
+ exec gcj -C "$@"
+ else
+ if test -n "@HAVE_JAVAC@"; then
+ CLASSPATH="$CLASSPATH"
+ export CLASSPATH
+ test -z "$JAVA_VERBOSE" || echo javac "$@"
+ exec javac "$@"
+ else
+ if test -n "@HAVE_JIKES@"; then
+ # Combine given CLASSPATH and configured CLASSPATH.
+ if test -n "$CLASSPATH"; then
+ CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
+ else
+ CLASSPATH="$CONF_CLASSPATH"
+ fi
+ export CLASSPATH
+ test -z "$JAVA_VERBOSE" || echo jikes "$@"
+ exec jikes "$@"
+ else
+ echo 'Java compiler not found, try installing gcj or set $JAVAC, then reconfigure' 1>&2
+ exit 1
+ fi
+ fi
+ fi
+fi
--- /dev/null
+#!/bin/sh
+# Execute a Java program.
+
+# Copyright (C) 2001 Free Software Foundation, Inc.
+# Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# This uses the same choices as javaexec.c, but instead of relying on the
+# environment settings at run time, it uses the environment variables
+# present at configuration time.
+#
+# This is a separate shell script, because it must be able to unset JAVA_HOME
+# in some cases, which a simple shell command cannot do.
+#
+# The extra CLASSPATH must have been set prior to calling this script.
+
+CONF_JAVA='@JAVA@'
+CONF_CLASSPATH='@CLASSPATH@'
+if test -n "$CONF_JAVA"; then
+ # Combine given CLASSPATH and configured CLASSPATH.
+ if test -n "$CLASSPATH"; then
+ CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
+ else
+ CLASSPATH="$CONF_CLASSPATH"
+ fi
+ export CLASSPATH
+ test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
+ exec $CONF_JAVA "$@"
+else
+ unset JAVA_HOME
+ export CLASSPATH
+ if test -n "@HAVE_GIJ@"; then
+ test -z "$JAVA_VERBOSE" || echo gij "$@"
+ exec gij "$@"
+ else
+ # We call this variable HAVE_JAVA_JVM, not HAVE_JAVA, because otherwise
+ # automake creates a dependency to "classHAVE.stamp" in every Makefile!!
+ if test -n "@HAVE_JAVA_JVM@"; then
+ test -z "$JAVA_VERBOSE" || echo java "$@"
+ exec java "$@"
+ else
+ if test -n "@HAVE_JRE@"; then
+ test -z "$JAVA_VERBOSE" || echo jre "$@"
+ exec jre "$@"
+ else
+ if test -n "@HAVE_JVIEW@"; then
+ test -z "$JAVA_VERBOSE" || echo jview "$@"
+ exec jview "$@"
+ else
+ echo 'Java virtual machine not found, try installing gij or set $JAVA, then reconfigure' 1>&2
+ exit 1
+ fi
+ fi
+ fi
+ fi
+fi
+2001-09-08 Bruno Haible <haible@clisp.cons.org>
+
+ * javacomp.m4: New file.
+ * javaexec.m4: New file.
+ * Makefile.am (EXTRA_DIST): Add them.
+
2001-09-06 Bruno Haible <haible@clisp.cons.org>
* setenv.m4: New file.
# |sed 's/@$/%/;s/@/ \\@/g' |tr @% '\012\012'
EXTRA_DIST = README \
c-bs-a.m4 codeset.m4 flex.m4 getline.m4 gettext.m4 glibc21.m4 iconv.m4 \
-inttypes_h.m4 isc-posix.m4 lcmessage.m4 libtool.m4 mbrtowc.m4 mbstate_t.m4 \
-mbswidth.m4 mkdtemp.m4 progtest.m4 setenv.m4 setlocale.m4 signed.m4 \
-ssize_t.m4 stdbool.m4 tmpdir.m4 uintmax_t.m4 ulonglong.m4 unionwait.m4
+inttypes_h.m4 isc-posix.m4 javacomp.m4 javaexec.m4 lcmessage.m4 libtool.m4 \
+mbrtowc.m4 mbstate_t.m4 mbswidth.m4 mkdtemp.m4 progtest.m4 setenv.m4 \
+setlocale.m4 signed.m4 ssize_t.m4 stdbool.m4 tmpdir.m4 uintmax_t.m4 \
+ulonglong.m4 unionwait.m4
--- /dev/null
+#serial 1
+
+# Prerequisites of javacomp.sh.
+# Sets HAVE_JAVACOMP to nonempty if javacomp.sh will work.
+
+AC_DEFUN([gt_JAVACOMP],
+[
+ AC_MSG_CHECKING([for Java compiler])
+ AC_EGREP_CPP(yes, [
+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
+ yes
+#endif
+], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
+ HAVE_JAVACOMP=1
+ if test -n "$JAVAC"; then
+ ac_result="$JAVAC"
+ else
+ if gcj --version >/dev/null 2>/dev/null; then
+ HAVE_GCJ=1
+ ac_result="gcj -C"
+ else
+ if (javac -version >/dev/null 2>/dev/null || test $? = 1); then
+ HAVE_JAVAC=1
+ ac_result="javac"
+ else
+ if (jikes >/dev/null 2>/dev/null || test $? = 1) && (
+ # See if the existing CLASSPATH is sufficient to make jikes work.
+ cat > conftest.java <<EOF
+public class conftest {
+ public static void main (String[] args) {
+ }
+}
+EOF
+ unset JAVA_HOME
+ jikes conftest.java
+ error=$?
+ rm -f conftest.java conftest.class
+ exit $?
+ ); then
+ HAVE_JIKES=1
+ ac_result="jikes"
+ else
+ HAVE_JAVACOMP=
+ ac_result="no"
+ fi
+ fi
+ fi
+ fi
+ AC_MSG_RESULT([$ac_result])
+ AC_SUBST(JAVAC)
+ AC_SUBST(CLASSPATH)
+ AC_SUBST(CLASSPATH_SEPARATOR)
+ AC_SUBST(HAVE_GCJ)
+ AC_SUBST(HAVE_JAVAC)
+ AC_SUBST(HAVE_JIKES)
+])
--- /dev/null
+#serial 1
+
+# Prerequisites of javaexec.sh.
+# Sets HAVE_JAVAEXEC to nonempty if javaexec.sh will work.
+
+AC_DEFUN([gt_JAVAEXEC],
+[
+ AC_MSG_CHECKING([for Java virtual machine])
+ AC_EGREP_CPP(yes, [
+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
+ yes
+#endif
+], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
+ HAVE_JAVAEXEC=1
+ if test -n "$JAVA"; then
+ ac_result="$JAVA"
+ else
+ if gij --version >/dev/null 2>/dev/null; then
+ HAVE_GIJ=1
+ ac_result="gij"
+ else
+ if java -version >/dev/null 2>/dev/null; then
+ HAVE_JAVA_JVM=1
+ ac_result="java"
+ else
+ if (jre >/dev/null 2>/dev/null || test $? = 1); then
+ HAVE_JRE=1
+ ac_result="jre"
+ else
+ if (jview -? >/dev/null 2>/dev/null || test $? = 1); then
+ HAVE_JVIEW=1
+ ac_result="jview"
+ else
+ HAVE_JAVAEXEC=
+ ac_result="no"
+ fi
+ fi
+ fi
+ fi
+ fi
+ AC_MSG_RESULT([$ac_result])
+ AC_SUBST(JAVA)
+ AC_SUBST(CLASSPATH)
+ AC_SUBST(CLASSPATH_SEPARATOR)
+ AC_SUBST(HAVE_GIJ)
+ AC_SUBST(HAVE_JAVA_JVM)
+ AC_SUBST(HAVE_JRE)
+ AC_SUBST(HAVE_JVIEW)
+])