[java-atk-wrapper] Revert "Revert "Add method to auto-detect JAVA_HOME""



commit a501731fa4c6c1634bf852793bc7e678b2d7ca78
Author: Ke Wang <ke wang sun com>
Date:   Mon Jul 6 13:12:34 2009 +0800

    Revert "Revert "Add method to auto-detect JAVA_HOME""
    
    This reverts commit 1ee806294ecfa4f053b32c9cd63d12541ad32179.

 INSTALL             |    4 ----
 JavaInfo.java       |   15 +++++++++++++++
 configure.in        |   43 ++++++++++++++++---------------------------
 wrapper/Makefile.am |    4 ++--
 4 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index 595d1df..e363b41 100644
--- a/INSTALL
+++ b/INSTALL
@@ -9,10 +9,6 @@ run ./autogen.sh in the java-atk-wrapper directory (this directory),
 Example:
 	./autogen.sh --prefix=/opt/gnome-2.0
 
-You can also include a --with-java-home argument:
-
-	./autogen.sh --prefix=/opt/gnome-2.0 --with-java-home=/usr/java/j2sdk1.4.0
-
 (2a) If you obtained the java-atk-wrapper via a tarfile,
 run "./configure" in this directory with options as above.
 
diff --git a/JavaInfo.java b/JavaInfo.java
new file mode 100644
index 0000000..e40560e
--- /dev/null
+++ b/JavaInfo.java
@@ -0,0 +1,15 @@
+public class JavaInfo {
+	public JavaInfo() {
+		String strHome = System.getProperty("java.home");
+		String fileSep = System.getProperty ("file.separator");
+		if (strHome.endsWith( fileSep + "jre" )) {
+			strHome = strHome.substring(0, strHome.length()-4);
+		}
+
+		System.out.println(strHome);
+	}
+
+	public static void main(String args[]) {
+		new JavaInfo();
+	}
+}
diff --git a/configure.in b/configure.in
index 400216f..df020b1 100644
--- a/configure.in
+++ b/configure.in
@@ -41,25 +41,25 @@ AC_SUBST(ATK_BRIDGE_LIB_NAME)
 JAVA_REQUIRED=1.5
 JAVA_ERROR_MESSAGE="Java $JAVA_REQUIRED or later is required to build java-access-bridge"
 
-AC_ARG_VAR([JAVA_HOME],[Java Runtime Environment location])
-
-AC_ARG_WITH([java_home],
-	    [AS_HELP_STRING([--with-java-home=PATH],
-			    [Use the jdk at PATH])])
+AC_CHECK_PROG(JAVA, java, java, no)
+if test "x$JAVA" = xno; then
+  AC_MSG_ERROR([$JAVA_ERROR_MESSAGE])
+fi
+AC_SUBST(JAVA)
 
-if test "x$with_java_home" != "x" ; then
-   JAVA_HOME=$with_java_home
-   AC_CHECK_FILE("$JAVA_HOME/bin/java", JAVA="$JAVA_HOME/bin/java",
-		 AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]))
-else
-   AC_CHECK_PROG(JAVA, java, java, no)
-   if test "x$JAVA" = xno; then
-     AC_MSG_ERROR([$JAVA_ERROR_MESSAGE])
-   fi
+AC_CHECK_PROG(JAVAC, javac, javac, no)
+if test "x$JAVAC" = xno; then
+  AC_MSG_ERROR([$JAVA_ERROR_MESSAGE])
 fi
+AC_SUBST(JAVAC)
+
+CUR_DIR=`pwd`
+SRC_DIR=`dirname $0`
+SRC_DIR=`cd $SRC_DIR;pwd;cd $CUR_DIR`
+$JAVAC $SRC_DIR/JavaInfo.java
+JAVA_HOME="`CLASSPATH=$SRC_DIR java JavaInfo`"
 
 AC_SUBST(JAVA_HOME)
-AC_SUBST(JAVA)
 
 CHECK_JNI
 
@@ -84,17 +84,6 @@ elif test $j_major_version = $min_major_version; then
   fi
 fi    
 
-if test "x$JAVA_HOME" != "x" ; then
-  AC_CHECK_FILE("$JAVA_HOME/bin/javac", JAVAC="$JAVA_HOME/bin/javac",
-	AC_MSG_ERROR([$JAVA_ERROR_MESSAGE]))
-else
-  AC_CHECK_PROG(JAVAC, javac, javac, no)
-  if test "x$JAVAC" = xno; then
-    AC_MSG_ERROR([$JAVA_ERROR_MESSAGE])
-  fi
-fi
-AC_SUBST(JAVAC)
-
 dnl AC_MSG_CHECKING([for Java Accessibility Utilities])
 
 if test "x$JAVA_HOME" != "x" ; then
diff --git a/wrapper/Makefile.am b/wrapper/Makefile.am
index 85514c0..666f2eb 100644
--- a/wrapper/Makefile.am
+++ b/wrapper/Makefile.am
@@ -2,12 +2,12 @@ SUBDIRS=org
 JARFILES=java-atk-wrapper.jar
 DEP_CLASSES=$(wildcard org/GNOME/Accessibility/*.class)
 
-java_atk_wrapperdir = $(prefix)/share/jar
+java_atk_wrapperdir = $(JAVA_HOME)/jre/lib/ext
 java_atk_wrapper_DATA = $(JARFILES)
 
 EXTRA_DIST = $(properties_DATA)
 
-propertiesdir = $(prefix)/share/jar
+propertiesdir = $(JAVA_HOME)/jre/lib
 properties_DATA = accessibility.properties
 
 $(JARFILES) : $(DEP_CLASSES)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]