Log name of connector when pool fails.
[java-idp.git] / ant
1 #! /bin/sh
2
3 # OS specific support.  $var _must_ be set to either true or false.
4 cygwin=false;
5 darwin=false;
6 case "`uname`" in
7   CYGWIN*) cygwin=true ;;
8   Darwin*) darwin=true ;;
9 esac
10
11 #Find the necessary resources
12 if [ -n "$SHIB_HOME" ] ; then
13   ANT_HOME=$SHIB_HOME
14 else
15   ANT_HOME=.
16 fi
17
18 if [ -z "$JAVACMD" ] ; then 
19   if [ -n "$JAVA_HOME"  ] ; then
20     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 
21       # IBM's JDK on AIX uses strange locations for the executables
22       JAVACMD=$JAVA_HOME/jre/sh/java
23     else
24       JAVACMD=$JAVA_HOME/bin/java
25     fi
26   else
27     JAVACMD=java
28   fi
29 fi
30  
31 if [ ! -x "$JAVACMD" ] ; then
32   echo "Error: JAVA_HOME is not defined correctly."
33   echo "  We cannot execute $JAVACMD"
34   exit
35 fi
36
37 if [ -n "$CLASSPATH" ] ; then
38   LOCALCLASSPATH=$CLASSPATH
39 fi
40
41 # add in the dependency .jar files
42 DIRLIBS=${ANT_HOME}/lib/*.jar
43 for i in ${DIRLIBS}
44 do
45     # if the directory is empty, then it will return the input string
46     # this is stupid, so case for it
47     if [ "$i" != "${DIRLIBS}" ] ; then
48       if [ -z "$LOCALCLASSPATH" ] ; then
49         LOCALCLASSPATH=$i
50       else
51         LOCALCLASSPATH="$i":$LOCALCLASSPATH
52       fi
53     fi
54 done
55
56 if [ -n "$JAVA_HOME" ] ; then
57   if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
58     LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar
59   fi
60
61   if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
62     LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
63   fi
64
65   # OSX hack to make Ant work with jikes
66   if $darwin ; then
67     OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
68     if [ -d ${OSXHACK} ] ; then
69       for i in ${OSXHACK}/*.jar
70       do
71         JIKESPATH=$JIKESPATH:$i
72       done
73     fi
74   fi
75
76 else
77   echo "Warning: JAVA_HOME environment variable is not set."
78   echo "  If build fails because sun.* classes could not be found"
79   echo "  you will need to set the JAVA_HOME environment variable"
80   echo "  to the installation directory of java."
81 fi
82
83 # supply JIKESPATH to Ant as jikes.class.path
84 if [ -n "$JIKESPATH" ] ; then
85   if [ -n "$ANT_OPTS" ] ; then
86     ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
87   else
88     ANT_OPTS=-Djikes.class.path=$JIKESPATH
89   fi
90 fi
91
92 # For Cygwin, switch paths to Windows format before running java
93 if $cygwin; then
94   ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
95   JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
96   LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
97 fi
98 $JAVACMD -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS org.apache.tools.ant.Main "$@"