#!/bin/sh
# gjc -- invoke the generic version of the Java compiler
#
# Based on software (that didn't work under cygwin) ...
# Copyright © 2001 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
J2SE14=/usr/local/jdk1.4
JSR14DISTR=/usr/local/jsr1_4

if [ ! -x ${J2SE14}/bin/javac.exe -o ! -r ${J2SE14}/jre/lib/rt.jar ]; then
   echo '${J2SE14} does not point to a working J2SE 1.4 installation.'
   exit 1
fi

if [ ! -r ${JSR14DISTR}/javac.jar -o ! -r ${JSR14DISTR}/collect.jar ]; then
    echo '${JSR14DISTR} does not point to a JSR14 distribution.'
    exit 1
fi

WJSR14DISTR=`cygpath -wa $JSR14DISTR`
WJ2SE14=`cygpath -wa $J2SE14`

if [ "$#" -eq 0 ]; then
    # if no arguments, print usage
    exec ${J2SE14}/bin/javac -J-Xbootclasspath/p:"$WJSR14DISTR"'\javac.jar'
fi

exec ${J2SE14}/bin/javac -J-Xbootclasspath/p:"$WJSR14DISTR"'\javac.jar' -bootclasspath "${WJSR14DISTR}"'\collect.jar;'"${WJ2SE14}"'\jre\lib\rt.jar' -gj "$@"
