]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tools/tinyos/misc/tos-locate-jre
Workaround the erase problems with AT45DB
[tinyos-2.x.git] / tools / tinyos / misc / tos-locate-jre
index b114d2c7898e81bc71e604321db377308788c891..4f93dd7945e3a886b459460fd9ab8d07f06bb694 100755 (executable)
@@ -38,21 +38,30 @@ pathlocate () {
 case `uname` in
     CYGWIN*)
     # Hopefully this will always work on cygwin with Sun's Java
-    jversion=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion'`
+    jversion=`regtool -q get '\\HKLM\\SOFTWARE\\JavaSoft\\Java Development Kit\\CurrentVersion'`
     if [ $? != 0 ]; then
        exit 1
     fi
-    jhome=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\'$jversion'\JavaHome'`
+    jhome=`regtool -q get '\\HKLM\SOFTWARE\\JavaSoft\\Java Development Kit\\'$jversion'\\JavaHome'`
     if [ $? != 0 ]; then
        exit 1
     fi
     jhome=`cygpath -u "$jhome"`
     ;;
 
+    Darwin)
+    #Just statically typed in, uses default location of installation for XTools.  May need to be fixed
+    jhome=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
+    ;;
+
     Linux)
+    # Check gentoo java configuration
+    javapath=`java-config -c 2>/dev/null`
     # We check the path first, on the assumption that that's the preferred
     # version.
-    pathlocate javac || { test -z "$javac" && pathlocate java; }
+    if [ -z "$javapath" ]; then
+        pathlocate javac || { test -z "$javac" && pathlocate java; }
+    fi
     if [ -z "$javapath" ]; then
        # We try a bunch of standard names, before resorting to rpm -qa
        rpmlocate IBMJava2-SDK javac || \
@@ -104,19 +113,31 @@ if [ "$jni" = "yes" ]; then
     # Look for a likely JNI directory
     # Windows, and IBM Java: in jre/bin
     # Sun Java on Linux: in jre/lib/i386
-    if "$jhome/bin/java" -version 2>&1 | grep -q IBM || cygpath -w / >/dev/null 2>/dev/null; then
+    if [ `uname` = "Darwin" ]; then 
+       jnilocate "/Library/java/Extensions"
+    elif "$jhome/bin/java" -version 2>&1 | grep -q IBM || cygpath -w / >/dev/null 2>/dev/null; then
        jnilocate "$jhome/jre/bin" || jnilocate "$jhome/bin"
     else
        arch=`uname -m`
        jnilocate "$jhome/jre/lib/$arch" || \
            jnilocate "$jhome/jre/lib/i386" || \
+           jnilocate "$jhome/jre/lib/amd64" || \
            jnilocate "$jhome/lib/$arch" || \
-           jnilocate "$jhome/lib/i386"
+           jnilocate "$jhome/lib/i386" || \
+           jnilocate "$jhome/lib/amd64"
     fi
 elif [ "$javac" = "yes" ]; then
- dir="$jhome/bin"
+ if [ `uname` = "Darwin" ]; then
+   dir="$jhome/Commands"
+ else 
+   dir="$jhome/bin"
+ fi
 elif [ "$java" = "yes" ]; then
- dir="$jhome/bin"
+ if [ `uname` = "Darwin" ]; then  
+   dir="$jhome/Commands"
+ else 
+   dir="$jhome/bin"
+ fi
 fi
 
 # Check that what we found actually exists