* configure.ac (AC_CHECK_FUNCS): Added access.
authortwisti <none@none>
Tue, 21 Aug 2007 13:00:21 +0000 (13:00 +0000)
committertwisti <none@none>
Tue, 21 Aug 2007 13:00:21 +0000 (13:00 +0000)
* src/vm/properties.c (unistd.h): Added.
(properties_init) [WITH_CLASSPATH_SUN]: Find correct java.home.

configure.ac
src/native/vm/gnu/java_lang_reflect_Constructor.c
src/vm/properties.c

index 034213bf2f051b783fbcbba9166fbe6e4351c334..bcaae0e6fd768c44ae2b3cb2da114be7cd59dd22 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 dnl 02110-1301, USA.
 dnl 
-dnl $Id: configure.ac 8375 2007-08-21 11:04:23Z twisti $
+dnl $Id: configure.ac 8381 2007-08-21 13:00:21Z twisti $
 
 dnl Process this file with autoconf to produce a configure script.
 
@@ -275,6 +275,7 @@ AC_FUNC_MMAP
 
 dnl keep them alpha-sorted!
 AC_CHECK_FUNCS([accept])
+AC_CHECK_FUNCS([access])
 AC_CHECK_FUNCS([atoi])
 AC_CHECK_FUNCS([atol])
 AC_CHECK_FUNCS([calloc])
index b7a2400c903e6b7c6c2665070ff0f333e1a58f53..a513adb010015a178e07a8ba9dfada553ed9f16c 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: java_lang_reflect_Constructor.c 8343 2007-08-17 21:39:32Z michi $
+   $Id: java_lang_reflect_Constructor.c 8326 2007-08-16 17:45:49Z twisti $
 
 */
 
index e793c3594fb25a1fff81e8ece69ed6385d0be1ab..bf3da3199cb2b93e17dba09297f02ee22b3f4de2 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: properties.c 8351 2007-08-19 17:56:23Z twisti $
+   $Id: properties.c 8381 2007-08-21 13:00:21Z twisti $
 
 */
 
@@ -31,8 +31,9 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include <sys/utsname.h>
 #include <time.h>
+#include <unistd.h>
+#include <sys/utsname.h>
 
 #include "vm/types.h"
 
@@ -287,6 +288,39 @@ bool properties_init(void)
 
 # elif defined(WITH_CLASSPATH_SUN)
 
+       /* Find correct java.home.  We check if there is a JRE
+          co-located. */
+
+       /* NOTE: We use the server VM here as it should be available on
+          all architectures. */
+
+       len =
+               strlen(env_java_home) +
+               strlen("/jre/lib/"JAVA_ARCH"/server/libjvm.so") +
+               strlen("0");
+
+       java_home = MNEW(char, len);
+
+       strcpy(java_home, env_java_home);
+       strcat(java_home, "/jre/lib/"JAVA_ARCH"/server/libjvm.so");
+
+       /* Check if that libjvm.so exists. */
+
+       printf("java_home=%s\n", java_home);
+
+       if (access(java_home, F_OK) == 0) {
+               /* Yes, we add /jre to java.home. */
+
+               strcpy(java_home, env_java_home);
+               strcat(java_home, "/jre");
+       }
+       else {
+               /* No, java.home is at it is. */
+
+               strcpy(java_home, env_java_home);
+       }
+
+       properties_add("java.home", java_home);
        properties_add("sun.boot.library.path", classpath_libdir);
 
 # else