[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] Allow Java detection to find gcj -- ok to commit?
From:       Bernhard Rosenkraenzer <bero () redhat ! de>
Date:       2002-09-24 13:00:44
[Download RAW message or body]

The attached patch allows KDE's (admin/acinclude.m4.in) java detection to 
use gcj -- I've successfully built the Java bindings and their test apps 
with gcj (and also run them -- they're slow, but work).

Ok to commit?

LLaP
bero

-- 
This message is provided to you under the terms outlined at
http://www.bero.org/terms.html

["kde-3.1.0-gcjjava.patch" (TEXT/PLAIN)]

--- kdebase.work/admin/acinclude.m4.in.gcj	2002-09-24 13:54:19.000000000 +0200
+++ kdebase.work/admin/acinclude.m4.in	2002-09-24 14:35:52.000000000 +0200
@@ -4574,6 +4574,15 @@
 	  fi
       done
 
+      if test -z "$jredirs"; then
+          dnl gcj does not use a libjvm.so, so this may still be valid
+          IFS=':'
+          for dir in $PATH; do
+              jredirs="$jredirs $dir"
+          done
+          IFS=$kde_save_IFS
+      fi
+
       JAVAC=
       JAVA=
       kde_java_bindir=no
@@ -4605,11 +4614,29 @@
 
 dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
 if test "x$kde_java_bindir" != "xno"; then
-
-  dnl Look for libjvm.so
-  kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed \
                's,libjvm.so,,'|head -n 1`
-  dnl Look for libhpi.so and avoid green threads
-  kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed \
's,libhpi.so,,' | head -n 1` +  dnl Check if java is actually gcj - some of the \
following checks have to be +  dnl different if gcj is in use (e.g. gcj doesn't have \
a separate libjvm) +  AC_MSG_CHECKING([if java is gcj])
+  AC_TRY_COMPILE(
+    [#include "$kde_java_includedir/jni.h"],
+    [#ifndef __GCJ_JNI_H__
+     #error This is not gcj
+     #endif],
+    [AC_MSG_RESULT(yes)
+     AC_DEFINE(GCJJAVA, 1, [Define if your java is gcj])
+     ac_cv_gcjjava="yes" ],
+    [AC_MSG_RESULT(no)])
+
+  if test x$ac_cv_gcjjava != xyes; then
+    dnl Look for libjvm.so
+    kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed \
's,libjvm.so,,'|head -n 1` +    dnl Look for libhpi.so and avoid green threads
+    kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | \
sed 's,libhpi.so,,' | head -n 1` +  else
+    dnl gcj does not need libjvm or libhpi; it has its own internal variants \
thereof. +    kde_java_libjvmdir=""
+    kde_java_libhpidir=""
+  fi
 
   dnl Now check everything's fine under there
   dnl the include dir is our flag for having the JDK
@@ -4627,30 +4654,39 @@
       AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or \
--without-java.])  fi
 
-    jni_includes="-I$kde_java_includedir"
-    dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
-    dnl and under linux here..
-    test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes \
                -I$kde_java_includedir/linux"
-    test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes \
                -I$kde_java_includedir/solaris"
-    test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes \
-I$kde_java_includedir/genunix" +    if test "$kde_java_includedir" != \
"/usr/include"; then +      dnl jdkgcj and quite possibly others put jni.h straight \
in /usr/include. +      dnl gcc 3.x does not like -I/usr/include at all...
+      jni_includes="-I$kde_java_includedir"
+    else
+      jni_includes=" "
+    fi
 
+    if test x$ac_cv_gcjjava != xyes; then
+      dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
+      dnl and under linux here..
+      test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes \
-I$kde_java_includedir/linux" +      test -d "$kde_java_includedir/solaris" && \
jni_includes="$jni_includes -I$kde_java_includedir/solaris" +      test -d \
"$kde_java_includedir/genunix" && jni_includes="$jni_includes \
-I$kde_java_includedir/genunix" +    fi
   else
     JAVAC=
     jni_includes=
   fi
 
-  if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
-     AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use \
                --without-java.])
-  fi 
+  if test x$ac_cv_gcjjava != xyes; then
+     if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
+        AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use \
--without-java.]) +     fi 
+     if test ! -r "$kde_java_libhpidir/libhpi.so"; then
+       AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use \
--without-java.]) +     fi
+  fi
 
   if test ! -x "$kde_java_bindir/java"; then
       AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! \
Use --with-java or --without-java.])  fi
 
-  if test ! -r "$kde_java_libhpidir/libhpi.so"; then
-    AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use \
                --without-java.])
-  fi
-
   if test -n "$jni_includes"; then
     dnl Check for JNI version
     AC_LANG_SAVE
@@ -4687,7 +4723,9 @@
     JAVAH=$kde_java_bindir/javah
     JAR=$kde_java_bindir/jar
     AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java \
                executable is])
-    JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
+    if test x$ac_cv_gcjjava != xyes; then
+       JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
+    fi
     AC_MSG_RESULT([java JDK in $kde_java_bindir])
 
   else



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic