1 1.1 christos #!/bin/sh 2 1.1 christos # Compile a Java program. 3 1.1 christos 4 1.1 christos # Copyright (C) 2001-2002, 2006 Free Software Foundation, Inc. 5 1.1 christos # Written by Bruno Haible <haible (at] clisp.cons.org>, 2001. 6 1.1 christos # 7 1.1 christos # This program is free software; you can redistribute it and/or modify 8 1.1 christos # it under the terms of the GNU General Public License as published by 9 1.1 christos # the Free Software Foundation; either version 2, or (at your option) 10 1.1 christos # any later version. 11 1.1 christos # 12 1.1 christos # This program is distributed in the hope that it will be useful, 13 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 christos # GNU General Public License for more details. 16 1.1 christos # 17 1.1 christos # You should have received a copy of the GNU General Public License 18 1.1 christos # along with this program; if not, write to the Free Software Foundation, 19 1.1 christos # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 1.1 christos 21 1.1 christos # This uses the same choices as javacomp.c, but instead of relying on the 22 1.1 christos # environment settings at run time, it uses the environment variables 23 1.1 christos # present at configuration time. 24 1.1 christos # 25 1.1 christos # This is a separate shell script, because it must be able to unset JAVA_HOME 26 1.1 christos # in some cases, which a simple shell command cannot do. 27 1.1 christos # 28 1.1 christos # The extra CLASSPATH must have been set prior to calling this script. 29 1.1 christos # Options that can be passed are -O, -g and "-d DIRECTORY". 30 1.1 christos 31 1.1 christos CONF_JAVAC='@CONF_JAVAC@' 32 1.1 christos CONF_CLASSPATH='@CLASSPATH@' 33 1.1 christos if test -n "@HAVE_JAVAC_ENVVAR@"; then 34 1.1 christos # Combine given CLASSPATH and configured CLASSPATH. 35 1.1 christos if test -n "$CLASSPATH"; then 36 1.1 christos CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" 37 1.1 christos else 38 1.1 christos CLASSPATH="$CONF_CLASSPATH" 39 1.1 christos fi 40 1.1 christos export CLASSPATH 41 1.1 christos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 42 1.1 christos exec $CONF_JAVAC "$@" 43 1.1 christos else 44 1.1 christos unset JAVA_HOME 45 1.1 christos if test -n "@HAVE_GCJ_C@"; then 46 1.1 christos # In this case, $CONF_JAVAC starts with "gcj -C". 47 1.1 christos CLASSPATH="$CLASSPATH" 48 1.1 christos export CLASSPATH 49 1.1 christos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 50 1.1 christos exec $CONF_JAVAC "$@" 51 1.1 christos else 52 1.1 christos if test -n "@HAVE_JAVAC@"; then 53 1.1 christos # In this case, $CONF_JAVAC starts with "javac". 54 1.1 christos CLASSPATH="$CLASSPATH" 55 1.1 christos export CLASSPATH 56 1.1 christos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 57 1.1 christos exec $CONF_JAVAC "$@" 58 1.1 christos else 59 1.1 christos if test -n "@HAVE_JIKES@"; then 60 1.1 christos # In this case, $CONF_JAVAC starts with "jikes". 61 1.1 christos # Combine given CLASSPATH and configured CLASSPATH. 62 1.1 christos if test -n "$CLASSPATH"; then 63 1.1 christos CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" 64 1.1 christos else 65 1.1 christos CLASSPATH="$CONF_CLASSPATH" 66 1.1 christos fi 67 1.1 christos export CLASSPATH 68 1.1 christos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@" 69 1.1 christos exec $CONF_JAVAC "$@" 70 1.1 christos else 71 1.1 christos echo 'Java compiler not found, try installing gcj or set $JAVAC, then reconfigure' 1>&2 72 1.1 christos exit 1 73 1.1 christos fi 74 1.1 christos fi 75 1.1 christos fi 76 1.1 christos fi 77