--- solenv/bin/deliver.pl.ark	2006-04-30 15:41:17.000000000 +0200
+++ solenv/bin/deliver.pl	2006-04-30 15:46:00.000000000 +0200
@@ -771,7 +771,7 @@ sub cachejar {
             return;
         }
         my $to = $todir."lib".$lib.".so";
-        my $JAVALINKER = "$ENV{JAVACOMPILER} -shared -fPIC -Wl,-Bsymbolic -O2 -findirect-dispatch -fjni -o";
+        my $JAVALINKER = "$ENV{JAVABINCOMPILER} -shared -fPIC -Wl,-Bsymbolic -O2 -findirect-dispatch -fjni -o";
         print "CACHEJAR: $file -> $to with $ENV{GCJ_DATABASE}\n";
         print "Caching 1/2: $JAVALINKER $to $file\n";
         system("$JAVALINKER $to $file");
--- solenv/inc/settings.mk.ark	2006-04-30 15:32:26.000000000 +0200
+++ solenv/inc/settings.mk	2006-04-30 15:50:23.000000000 +0200
@@ -189,7 +189,9 @@ JAVADOC=javadoc -J-Xmx120m
 JAVAC=$(JAVACOMPILER)
 JAVAI=$(JAVAINTERPRETER)
 .IF "$(JAVACACHE)" != ""
+.IF "$(JAVACOMPILER)" == "gcj"
 JAVAC+=--encoding=UTF-8 -O2 -fno-assert -Wno-deprecated -C
+.ENDIF
 JAVAI+=-Dgnu.gcj.precompiled.db.path=$(GCJ_DATABASE)
 .ENDIF
 
--- config_office/configure.in.ark	2006-04-30 15:34:43.000000000 +0200
+++ config_office/configure.in	2006-04-30 15:46:00.000000000 +0200
@@ -2170,8 +2170,19 @@ dnl ====================================
 dnl Checks for javac
 dnl ===================================================================
 if test "$SOLAR_JAVA" != ""; then
+    javabincompiler=""
     if test "$JDK" = "gcj"; then 
-        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
+        javabincompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
+        javacompiler="javac"
+        if test -z "$with_jdk_home"; then
+            AC_PATH_PROG(JAVABINCOMPILER, $javabincompiler)
+        else
+            _javac_path="$with_jdk_home/bin/$javabincompiler"
+            dnl Check if there is a java compiler at all.
+            if test -x "$_gcj_path"; then
+                JAVABINCOMPILER=$_gcj_path
+            fi
+        fi
     else
         javacompiler="javac"
     fi
@@ -2278,7 +2289,7 @@ fi
 dnl ===================================================================
 dnl Check for optional gcj-dbtool, use if compiler is gcj
 dnl ===================================================================
-if test `$JAVACOMPILER --version 2>&1 | grep -c "gcj"` -gt 0; then
+if test `$JAVAINTERPRETER --version 2>&1 | grep -c "gcj"` -gt 0; then
    if test `echo $WITH_JAVA | grep -c "gij"` -eq 0; then
       javacache="gcj-dbtool"
    else
@@ -2301,6 +2312,7 @@ fi
 AC_SUBST(JAVA_HOME)
 AC_SUBST(JDK)
 AC_SUBST(JAVAINTERPRETER)
+AC_SUBST(JAVABINCOMPILER)
 AC_SUBST(JAVACOMPILER)
 AC_SUBST(JAVACACHE)
 AC_SUBST(JAVADOC)
@@ -4803,12 +4815,7 @@ cat > conftest.xml << EOF
     </project>
 EOF
   oldJAVA_HOME=$JAVA_HOME
-  if test "$JDK" = "gcj"; then
-    JAVA_HOME=; export JAVA_HOME
-    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
-  else
-    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
-  fi
+  ant_cmd="$ANT -buildfile conftest.xml 1>&2"
   AC_TRY_EVAL(ant_cmd)
   if test $? = 0 && test -f ./conftest.class ; then
     AC_MSG_RESULT([Ant works]) 
--- config_office/set_soenv.in.ark	2006-04-30 15:34:43.000000000 +0200
+++ config_office/set_soenv.in	2006-04-30 15:46:00.000000000 +0200
@@ -1673,6 +1673,7 @@ if ( '@JDK@' ne '' )
    ToFile( "JDK",             "@JDK@",           "e" );
    ToFile( "JAVAINTERPRETER", "@JAVAINTERPRETER@","e" );
    ToFile( "JAVACOMPILER",    "@JAVACOMPILER@",  "e" );
+   ToFile( "JAVABINCOMPILER", "@JAVABINCOMPILER@",  "e" );
    ToFile( "JAVADOC",         "@JAVADOC@",       "e" );
 }
 if ( $platform =~ m/darwin/ )
--- xmlhelp/source/com/sun/star/help/makefile.mk.ark	2006-04-30 15:41:17.000000000 +0200
+++ xmlhelp/source/com/sun/star/help/makefile.mk	2006-04-30 15:46:00.000000000 +0200
@@ -124,7 +124,7 @@ JAVACLASSFILES += \
 .IF "$(JDK)"=="gcj"
 
 $(BIN)$/HelpLinker:
-	$(JAVACOMPILER) --main=com.sun.star.help.HelpLinker -o $(BIN)$/HelpLinker \
+	$(JAVABINCOMPILER) --main=com.sun.star.help.HelpLinker -o $(BIN)$/HelpLinker \
 		-O2 -Wl,-Bsymbolic -findirect-dispatch -fjni -fno-assert -Wno-deprecated \
 		$(JAVACPS) $(CLASSPATH) $(JAVAFILES) $(SOLARLIB) -L$(LB) \
 		-Djavax.xml.datatype.DatatypeFactory=org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl \
@@ -139,14 +139,14 @@ $(BIN)$/HelpLinker:
 $(BIN)$/HelpLinker: $(LB)$/libdb.jar.a
 
 $(LB)$/libdb.jar.a:
-	$(JAVACOMPILER) -c -O2 -findirect-dispatch -fjni $(DB_JAR) -o $(LB)$/libdb.jar.a
+	$(JAVABINCOMPILER) -c -O2 -findirect-dispatch -fjni $(DB_JAR) -o $(LB)$/libdb.jar.a
 .ENDIF
 
 .IF "$(SYSTEM_XT)"=="YES"
 $(BIN)$/HelpLinker: $(LB)$/libxt.jar.a
 
 $(LB)$/libxt.jar.a:
-	$(JAVACOMPILER) -c -O2 -findirect-dispatch -fjni $(XT_JAR) -o $(LB)$/libxt.jar.a
+	$(JAVABINCOMPILER) -c -O2 -findirect-dispatch -fjni $(XT_JAR) -o $(LB)$/libxt.jar.a
 .ENDIF
 
 .ELSE
