GCC 7, released in 2017 (more than 6 years ago), dropped the support of gcj
and gij. And gcj and gij never supported Java 6. One can conclude that hardly
anyone has it still installed.

The support of gij and gcj in the modules 'javacomp' and 'javacomp-script'
complicates the support for more modern Java versions. Therefore I'm removing
it now.


2023-06-09  Bruno Haible  <br...@clisp.org>

        javacomp: Remove support for 'gcj'.
        * lib/javacomp.h: Update comment.
        * lib/javacomp.c (compile_using_gcj, is_envjavac_gcj, is_envjavac_gcj43,
        is_envjavac_gcj43_usable, is_envjavac_oldgcj_14_14_usable,
        is_envjavac_oldgcj_14_13_usable, is_gcj_present, is_gcj_43,
        is_gcj43_usable, is_oldgcj_14_14_usable, is_oldgcj_14_13_usable): Remove
        functions.
        (is_envjavac_usable): Renamed from is_envjavac_nongcj_usable.
        (compile_java_class): Remove gcj related code.

        javacomp-script: Remove support for 'gcj'.
        * build-aux/javacomp.sh.in: Don't test HAVE_GCJ_C.
        * m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_GCJ_C. Don't test whether
        $JAVAC is gcj. Don't set CONF_JAVAC to 'gcj -C'. Update comment.
        (gt_JAVACOMP_DISABLED): Don't set HAVE_GCJ_C.

        javaexec: Remove support for 'gij'.
        * lib/javaexec.c (execute_java_class): Don't test for gij.

        javaexec-script: Remove support for 'gij'.
        * build-aux/javaexec.sh.in: Don't test HAVE_GIJ.
        * m4/javaexec.m4 (gt_JAVAEXEC): Don't set HAVE_GIJ. Don't set CONF_JAVA
        to 'gij'.
        * m4/javacomp.m4: Update comment.

>From 5d9d272ae0dabd27e1a90693df94d2a8df29f49e Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 15:14:52 +0200
Subject: [PATCH 1/4] javaexec-script: Remove support for 'gij'.

* build-aux/javaexec.sh.in: Don't test HAVE_GIJ.
* m4/javaexec.m4 (gt_JAVAEXEC): Don't set HAVE_GIJ. Don't set CONF_JAVA
to 'gij'.
* m4/javacomp.m4: Update comment.
---
 ChangeLog                |  8 ++++++++
 build-aux/javaexec.sh.in | 18 ++++++-----------
 m4/javacomp.m4           | 14 +++++--------
 m4/javaexec.m4           | 43 +++++++++++++---------------------------
 4 files changed, 33 insertions(+), 50 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 40ab73d0e2..b67a5dcf1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-06-09  Bruno Haible  <br...@clisp.org>
+
+	javaexec-script: Remove support for 'gij'.
+	* build-aux/javaexec.sh.in: Don't test HAVE_GIJ.
+	* m4/javaexec.m4 (gt_JAVAEXEC): Don't set HAVE_GIJ. Don't set CONF_JAVA
+	to 'gij'.
+	* m4/javacomp.m4: Update comment.
+
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
 	javaexec: Remove support for 'jview'.
diff --git a/build-aux/javaexec.sh.in b/build-aux/javaexec.sh.in
index 370dcad3c0..f570cc7511 100644
--- a/build-aux/javaexec.sh.in
+++ b/build-aux/javaexec.sh.in
@@ -41,24 +41,18 @@ if test -n "@HAVE_JAVA_ENVVAR@"; then
 else
   unset JAVA_HOME
   export CLASSPATH
-  if test -n "@HAVE_GIJ@"; then
-    # In this case, $CONF_JAVA is "gij".
+  if test -n "@HAVE_JAVA@"; then
+    # In this case, $CONF_JAVA is "java".
     test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
     exec $CONF_JAVA "$@"
   else
-    if test -n "@HAVE_JAVA@"; then
-      # In this case, $CONF_JAVA is "java".
+    if test -n "@HAVE_JRE@"; then
+      # In this case, $CONF_JAVA is "jre".
       test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
       exec $CONF_JAVA "$@"
     else
-      if test -n "@HAVE_JRE@"; then
-        # In this case, $CONF_JAVA is "jre".
-        test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@"
-        exec $CONF_JAVA "$@"
-      else
-        echo 'Java virtual machine not found, try installing gij or set $JAVA, then reconfigure' 1>&2
-        exit 1
-      fi
+      echo 'Java virtual machine not found, try setting $JAVA, then reconfigure' 1>&2
+      exit 1
     fi
   fi
 fi
diff --git a/m4/javacomp.m4 b/m4/javacomp.m4
index 6980fd6b35..c799bc67cc 100644
--- a/m4/javacomp.m4
+++ b/m4/javacomp.m4
@@ -1,4 +1,4 @@
-# javacomp.m4 serial 20
+# javacomp.m4 serial 21
 dnl Copyright (C) 2001-2003, 2006-2007, 2009-2023 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -45,20 +45,16 @@
 #      target-version   for JVM
 #           1.1         JDK 1.1
 #           1.2         JDK/JRE 1.2
-#           1.3         JDK/JRE 1.3, gij 3.3, 3.4
-#           1.4         JDK/JRE 1.4, gij 4.0 ... 4.2
-#           1.5         JDK/JRE 5, gij 4.3 ... 6
+#           1.3         JDK/JRE 1.3
+#           1.4         JDK/JRE 1.4
+#           1.5         JDK/JRE 5
 #           1.6         JDK/JRE 6
 #           1.7         JDK/JRE 7
 #           1.8         JDK/JRE 8
 #           9           JDK/JRE 9
 #          10           JDK/JRE 10
 #          11           JDK/JRE 11
-# Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4,
-# and gij >= 4.1 can in some cases partially handle classes compiled with
-# -target 1.5, but I have no idea how complete this support is. Similarly,
-# gcj >= 4.3 supports -ftarget=1.6, and gij >= 4.3 can in some cases handle
-# classes compiled with -target 1.6.
+# Note: gcj >= 4.3 supports -ftarget=1.6.
 #
 # Specifying target-version is useful when building a library (.jar) that is
 # useful outside the given package. Omitting target-version is useful when
diff --git a/m4/javaexec.m4 b/m4/javaexec.m4
index 316b9e6fb1..ede8436941 100644
--- a/m4/javaexec.m4
+++ b/m4/javaexec.m4
@@ -1,4 +1,4 @@
-# javaexec.m4 serial 9
+# javaexec.m4 serial 10
 dnl Copyright (C) 2001-2003, 2006, 2009-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -18,7 +18,6 @@ AC_DEFUN([gt_JAVAEXEC]
 ], CLASSPATH_SEPARATOR=';', CLASSPATH_SEPARATOR=':')
   CONF_JAVA=
   HAVE_JAVA_ENVVAR=
-  HAVE_GIJ=
   HAVE_JAVA=
   HAVE_JRE=
   HAVE_JAVAEXEC=1
@@ -29,7 +28,6 @@ AC_DEFUN([gt_JAVAEXEC]
     pushdef([AC_MSG_CHECKING],[:])dnl
     pushdef([AC_CHECKING],[:])dnl
     pushdef([AC_MSG_RESULT],[:])dnl
-    AC_CHECK_PROG([HAVE_GIJ_IN_PATH], [gij], [yes])
     AC_CHECK_PROG([HAVE_JAVA_IN_PATH], [java], [yes])
     AC_CHECK_PROG([HAVE_JRE_IN_PATH], [jre], [yes])
     popdef([AC_MSG_RESULT])dnl
@@ -40,35 +38,25 @@ AC_DEFUN([gt_JAVAEXEC]
       CLASSPATH="$2"${CLASSPATH+"$CLASSPATH_SEPARATOR$CLASSPATH"}
       ])
     export CLASSPATH
-    if test -n "$HAVE_GIJ_IN_PATH" \
-       && gij --version >/dev/null 2>/dev/null \
+    if test -n "$HAVE_JAVA_IN_PATH" \
+       && java -version >/dev/null 2>/dev/null \
        m4_if([$1], , , [&& {
-         echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
-         gij $1 >&AS_MESSAGE_LOG_FD 2>&1
+         echo "$as_me:__oline__: java $1" >&AS_MESSAGE_LOG_FD
+         java $1 >&AS_MESSAGE_LOG_FD 2>&1
        }]); then
-      HAVE_GIJ=1
-      CONF_JAVA="gij"
+      HAVE_JAVA=1
+      CONF_JAVA="java"
     else
-      if test -n "$HAVE_JAVA_IN_PATH" \
-         && java -version >/dev/null 2>/dev/null \
+      if test -n "$HAVE_JRE_IN_PATH" \
+         && (jre >/dev/null 2>/dev/null || test $? = 1) \
          m4_if([$1], , , [&& {
-           echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
-           java $1 >&AS_MESSAGE_LOG_FD 2>&1
+           echo "$as_me:__oline__: jre $1" >&AS_MESSAGE_LOG_FD
+           jre $1 >&AS_MESSAGE_LOG_FD 2>&1
          }]); then
-        HAVE_JAVA=1
-        CONF_JAVA="java"
+        HAVE_JRE=1
+        CONF_JAVA="jre"
       else
-        if test -n "$HAVE_JRE_IN_PATH" \
-           && (jre >/dev/null 2>/dev/null || test $? = 1) \
-           m4_if([$1], , , [&& {
-             echo "$as_me:__oline__: gij $1" >&AS_MESSAGE_LOG_FD
-             jre $1 >&AS_MESSAGE_LOG_FD 2>&1
-           }]); then
-          HAVE_JRE=1
-          CONF_JAVA="jre"
-        else
-          HAVE_JAVAEXEC=
-        fi
+        HAVE_JAVAEXEC=
       fi
     fi
     m4_if([$1], , , [
@@ -85,7 +73,6 @@ AC_DEFUN([gt_JAVAEXEC]
   AC_SUBST([CLASSPATH])
   AC_SUBST([CLASSPATH_SEPARATOR])
   AC_SUBST([HAVE_JAVA_ENVVAR])
-  AC_SUBST([HAVE_GIJ])
   AC_SUBST([HAVE_JAVA])
   AC_SUBST([HAVE_JRE])
 ])
@@ -95,12 +82,10 @@ AC_DEFUN([gt_JAVAEXEC_DISABLED]
 [
   CONF_JAVA=
   HAVE_JAVA_ENVVAR=
-  HAVE_GIJ=
   HAVE_JAVA=
   HAVE_JRE=
   AC_SUBST([CONF_JAVA])
   AC_SUBST([HAVE_JAVA_ENVVAR])
-  AC_SUBST([HAVE_GIJ])
   AC_SUBST([HAVE_JAVA])
   AC_SUBST([HAVE_JRE])
 ])
-- 
2.34.1

>From 0dee6d9639a4fbad3727aca15da62690c5b533d5 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 15:17:53 +0200
Subject: [PATCH 2/4] javaexec: Remove support for 'gij'.

* lib/javaexec.c (execute_java_class): Don't test for gij.
---
 ChangeLog      |  3 +++
 lib/javaexec.c | 63 +++-----------------------------------------------
 2 files changed, 6 insertions(+), 60 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b67a5dcf1e..5aac7edd1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
+	javaexec: Remove support for 'gij'.
+	* lib/javaexec.c (execute_java_class): Don't test for gij.
+
 	javaexec-script: Remove support for 'gij'.
 	* build-aux/javaexec.sh.in: Don't test HAVE_GIJ.
 	* m4/javaexec.m4 (gt_JAVAEXEC): Don't set HAVE_GIJ. Don't set CONF_JAVA
diff --git a/lib/javaexec.c b/lib/javaexec.c
index fb72fdc675..6f4af37485 100644
--- a/lib/javaexec.c
+++ b/lib/javaexec.c
@@ -48,7 +48,6 @@
    Program    from         A B  C              T
 
    $JAVA      unknown      N Y  n/a            true
-   gij        GCC 3.0      Y Y  n/a            gij --version >/dev/null
    java       JDK 1.1.8    Y Y  -classpath P   java -version 2>/dev/null
    jre        JDK 1.1.8    N Y  -classpath P   jre 2>/dev/null; test $? = 1
    java       JDK 1.3.0    Y Y  -classpath P   java -version 2>/dev/null
@@ -59,9 +58,8 @@
    We try the Java virtual machines in the following order:
      1. getenv ("JAVA"), because the user must be able to override our
         preferences,
-     2. "gij", because it is a completely free JVM,
-     3. "java", because it is a standard JVM,
-     4. "jre", comes last because it requires a CLASSPATH environment variable.
+     2. "java", because it is a standard JVM,
+     3. "jre", comes last because it requires a CLASSPATH environment variable.
 
    We unset the JAVA_HOME environment variable, because a wrong setting of
    this variable can confuse the JDK's javac.
@@ -194,61 +192,6 @@ execute_java_class (const char *class_name,
       unsetenv ("JAVA_HOME");
     }
 
-  {
-    static bool gij_tested;
-    static bool gij_present;
-
-    if (!gij_tested)
-      {
-        /* Test for presence of gij: "gij --version > /dev/null"  */
-        const char *argv[3];
-        int exitstatus;
-
-        argv[0] = "gij";
-        argv[1] = "--version";
-        argv[2] = NULL;
-        exitstatus = execute ("gij", "gij", argv, NULL,
-                              false, false, true, true,
-                              true, false, NULL);
-        gij_present = (exitstatus == 0);
-        gij_tested = true;
-      }
-
-    if (gij_present)
-      {
-        char *old_classpath;
-        const char **argv =
-          (const char **) xmalloca ((2 + nargs + 1) * sizeof (const char *));
-        unsigned int i;
-
-        /* Set CLASSPATH.  */
-        old_classpath =
-          set_classpath (classpaths, classpaths_count, use_minimal_classpath,
-                         verbose);
-
-        argv[0] = "gij";
-        argv[1] = class_name;
-        for (i = 0; i <= nargs; i++)
-          argv[2 + i] = args[i];
-
-        if (verbose)
-          {
-            char *command = shell_quote_argv (argv);
-            printf ("%s\n", command);
-            free (command);
-          }
-
-        err = executer ("gij", "gij", argv, private_data);
-
-        /* Reset CLASSPATH.  */
-        reset_classpath (old_classpath);
-
-        freea (argv);
-
-        goto done2;
-      }
-  }
-
   {
     static bool java_tested;
     static bool java_present;
@@ -363,7 +306,7 @@ execute_java_class (const char *class_name,
   }
 
   if (!quiet)
-    error (0, 0, _("Java virtual machine not found, try installing gij or set $JAVA"));
+    error (0, 0, _("Java virtual machine not found, try setting $JAVA"));
   err = true;
 
  done2:
-- 
2.34.1

>From 6feabdde142c5f2d84766140d4a979c20bb6bee7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 15:29:01 +0200
Subject: [PATCH 3/4] javacomp-script: Remove support for 'gcj'.

* build-aux/javacomp.sh.in: Don't test HAVE_GCJ_C.
* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_GCJ_C. Don't test whether
$JAVAC is gcj. Don't set CONF_JAVAC to 'gcj -C'. Update comment.
(gt_JAVACOMP_DISABLED): Don't set HAVE_GCJ_C.
---
 ChangeLog                |   6 +
 build-aux/javacomp.sh.in |  32 ++--
 m4/javacomp.m4           | 359 +++++++--------------------------------
 3 files changed, 77 insertions(+), 320 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5aac7edd1b..4d733c5018 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
+	javacomp-script: Remove support for 'gcj'.
+	* build-aux/javacomp.sh.in: Don't test HAVE_GCJ_C.
+	* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_GCJ_C. Don't test whether
+	$JAVAC is gcj. Don't set CONF_JAVAC to 'gcj -C'. Update comment.
+	(gt_JAVACOMP_DISABLED): Don't set HAVE_GCJ_C.
+
 	javaexec: Remove support for 'gij'.
 	* lib/javaexec.c (execute_java_class): Don't test for gij.
 
diff --git a/build-aux/javacomp.sh.in b/build-aux/javacomp.sh.in
index 64d250f371..470dfd0e1a 100644
--- a/build-aux/javacomp.sh.in
+++ b/build-aux/javacomp.sh.in
@@ -41,35 +41,27 @@ if test -n "@HAVE_JAVAC_ENVVAR@"; then
   exec $CONF_JAVAC "$@"
 else
   unset JAVA_HOME
-  if test -n "@HAVE_GCJ_C@"; then
-    # In this case, $CONF_JAVAC starts with "gcj -C".
+  if test -n "@HAVE_JAVAC@"; then
+    # In this case, $CONF_JAVAC starts with "javac".
     CLASSPATH="$CLASSPATH"
     export CLASSPATH
     test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
     exec $CONF_JAVAC "$@"
   else
-    if test -n "@HAVE_JAVAC@"; then
-      # In this case, $CONF_JAVAC starts with "javac".
-      CLASSPATH="$CLASSPATH"
+    if test -n "@HAVE_JIKES@"; then
+      # In this case, $CONF_JAVAC starts with "jikes".
+      # Combine given CLASSPATH and configured CLASSPATH.
+      if test -n "$CLASSPATH"; then
+        CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
+      else
+        CLASSPATH="$CONF_CLASSPATH"
+      fi
       export CLASSPATH
       test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
       exec $CONF_JAVAC "$@"
     else
-      if test -n "@HAVE_JIKES@"; then
-        # In this case, $CONF_JAVAC starts with "jikes".
-        # Combine given CLASSPATH and configured CLASSPATH.
-        if test -n "$CLASSPATH"; then
-          CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}"
-        else
-          CLASSPATH="$CONF_CLASSPATH"
-        fi
-        export CLASSPATH
-        test -z "$JAVA_VERBOSE" || echo "$CONF_JAVAC $@"
-        exec $CONF_JAVAC "$@"
-      else
-        echo 'Java compiler not found, try installing gcj or set $JAVAC, then reconfigure' 1>&2
-        exit 1
-      fi
+      echo 'Java compiler not found, try setting $JAVAC, then reconfigure' 1>&2
+      exit 1
     fi
   fi
 fi
diff --git a/m4/javacomp.m4 b/m4/javacomp.m4
index c799bc67cc..32570a016d 100644
--- a/m4/javacomp.m4
+++ b/m4/javacomp.m4
@@ -1,4 +1,4 @@
-# javacomp.m4 serial 21
+# javacomp.m4 serial 22
 dnl Copyright (C) 2001-2003, 2006-2007, 2009-2023 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -54,7 +54,6 @@
 #           9           JDK/JRE 9
 #          10           JDK/JRE 10
 #          11           JDK/JRE 11
-# Note: gcj >= 4.3 supports -ftarget=1.6.
 #
 # Specifying target-version is useful when building a library (.jar) that is
 # useful outside the given package. Omitting target-version is useful when
@@ -73,11 +72,7 @@
 #
 # It is redundant to ask for a target-version > source-version, since the
 # smaller target-version = source-version will also always work and newer JVMs
-# support the older target-versions too. Except for the cases
-#   - target-version = 1.4, source-version = 1.3, which allows gcj versions 3.0
-#     to 3.2 to be used,
-#   - target-version = 1.6, source-version = 1.5, which allows gcj versions
-#     >= 4.3 to be used.
+# support the older target-versions too.
 
 AC_DEFUN([gt_JAVACOMP],
 [
@@ -188,22 +183,6 @@ AC_DEFUN([gt_JAVACOMP]
   fi
   AC_MSG_CHECKING([for Java compiler])
   dnl
-  dnl The support of GNU gcj for target-version and source-version:
-  dnl
-  dnl   gcj 3.0.4 to 4.2 does not have a way to specify the target-version.
-  dnl   It always assumes target-version=1.4 but labels the class files as 1.1.
-  dnl   One consequence of this is that gcj compiles GetURL.java to invalid
-  dnl   bytecode, which crashes with a VerifyError when executed by Sun Java
-  dnl   1.3.1. The bug is registered as java/7066, see
-  dnl   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=7066
-  dnl   gcj 4.3 and newer has an option -ftarget=1.X; the maximum supported
-  dnl   target-version is 1.6.
-  dnl
-  dnl   For gcj < 3.3, the source-version always is 1.3.
-  dnl   For 3.3 <= gcj < 4.3, the source-version defaults to 1.4; option
-  dnl   "-fno-assert" switches to source-version 1.3.
-  dnl   gcj >= 4.3 has an option -fsource=1.X.
-  dnl
   dnl The support of Sun/Oracle javac for target-version and source-version:
   dnl
   dnl   javac 1.3:   -target 1.1 1.2 1.3               default: 1.1
@@ -269,7 +248,6 @@ AC_DEFUN([gt_JAVACOMP]
   dnl
   CONF_JAVAC=
   HAVE_JAVAC_ENVVAR=
-  HAVE_GCJ_C=
   HAVE_JAVAC=
   HAVE_JIKES=
   HAVE_JAVACOMP=
@@ -287,204 +265,90 @@ AC_DEFUN([gt_JAVACOMP]
   dnl satisfies the constraints (possibly after adding -target and -source
   dnl options).
   if test -n "$JAVAC"; then
-    dnl Try the original $JAVAC.
-    if $JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null; then
-      dnl It's a version of gcj.
-changequote(,)dnl
-      if $JAVAC --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then
-changequote([,])dnl
-        dnl It's a version of gcj >= 4.3. Assume the classfile versions are correct.
-        dnl Try $JAVAC.
-        rm -f conftest.class
-        if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
-             $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-           } \
-           && test -f conftest.class \
-           && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-          dnl Try adding -fsource option if it is useful.
-          rm -f conftest.class
-          rm -f conftestfail.class
-          if { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-               $JAVAC -fsource="$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-             } \
-             && test -f conftest.class \
-             && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
-             && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                  $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                } \
-             && test -f conftestfail.class \
-             && ! { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                    $JAVAC -fsource="$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                  }; then
-            CONF_JAVAC="$JAVAC -fsource=$source_version"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          else
-            CONF_JAVAC="$JAVAC"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          fi
-        else
-          dnl Try with -fsource and -ftarget options.
-          rm -f conftest.class
-          rm -f conftestfail.class
-          if { echo "$as_me:__oline__: $JAVAC -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-               $JAVAC -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-             } \
-             && test -f conftest.class \
-             && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-            CONF_JAVAC="$JAVAC -fsource=$source_version -ftarget=$target_version"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          fi
-        fi
+    dnl Try $JAVAC.
+    dnl The javac option '-source 1.5' has the same meaning as '-source 1.6',
+    dnl but since Java 9 supports only the latter, prefer the latter if a
+    dnl target_version >= 1.6 is requested.
+    if test "$source_version" = 1.5; then
+      case "$target_version" in
+        1.1 | 1.2 | 1.3 | 1.4 | 1.5) ;;
+        *) source_version='1.6' ;;
+      esac
+    fi
+    rm -f conftest.class
+    if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
+         $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+       } \
+       && test -f conftest.class \
+       && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
+      dnl Try adding -source option if it is useful.
+      rm -f conftest.class
+      rm -f conftestfail.class
+      if { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
+           $JAVAC -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+         } \
+         && test -f conftest.class \
+         && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
+         && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
+              $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
+            } \
+         && test -f conftestfail.class \
+         && ! { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
+                $JAVAC -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
+              }; then
+        CONF_JAVAC="$JAVAC -source $source_version"
+        HAVE_JAVAC_ENVVAR=1
+        HAVE_JAVACOMP=1
       else
-        dnl It's a version of gcj < 4.3. Ignore the version of conftest.class.
-        if test "$target_version" = 1.4 && test "$source_version" = 1.4; then
-          dnl Try $JAVAC.
-          rm -f conftest.class
-          if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
-               $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-             } \
-             && test -f conftest.class; then
-            CONF_JAVAC="$JAVAC"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          fi
-        else
-          if test "$target_version" = 1.4 && test "$source_version" = 1.3; then
-            dnl Try $JAVAC and "$JAVAC -fno-assert". But add -fno-assert only if
-            dnl it makes a difference. (It could already be part of $JAVAC.)
-            javac_works=
-            rm -f conftest.class
-            if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                 $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-               } \
-               && test -f conftest.class; then
-              javac_works=1
-            fi
-            javac_noassert_works=
-            rm -f conftest.class
-            if { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                 $JAVAC -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-               } \
-               && test -f conftest.class; then
-              javac_noassert_works=1
-            fi
-            if test -n "$javac_works" && test -n "$javac_noassert_works"; then
-              rm -f conftestfail.class
-              if { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                   $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                 } \
-                 && test -f conftestfail.class \
-                 && ! { echo "$as_me:__oline__: $JAVAC -fno-assert -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                        $JAVAC -fno-assert -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                      }; then
-                dnl "$JAVAC -fno-assert" works better than $JAVAC.
-                javac_works=
-              fi
-            fi
-            if test -n "$javac_works"; then
-              CONF_JAVAC="$JAVAC"
-              HAVE_JAVAC_ENVVAR=1
-              HAVE_JAVACOMP=1
-            else
-              if test -n "$javac_noassert_works"; then
-                CONF_JAVAC="$JAVAC -fno-assert"
-                HAVE_JAVAC_ENVVAR=1
-                HAVE_JAVACOMP=1
-              fi
-            fi
-          fi
-        fi
+        CONF_JAVAC="$JAVAC"
+        HAVE_JAVAC_ENVVAR=1
+        HAVE_JAVACOMP=1
       fi
     else
-      dnl It's not gcj. Assume the classfile versions are correct.
-      dnl Try $JAVAC.
-      dnl The javac option '-source 1.5' has the same meaning as '-source 1.6',
-      dnl but since Java 9 supports only the latter, prefer the latter if a
-      dnl target_version >= 1.6 is requested.
-      if test "$source_version" = 1.5; then
-        case "$target_version" in
-          1.1 | 1.2 | 1.3 | 1.4 | 1.5) ;;
-          *) source_version='1.6' ;;
-        esac
-      fi
+      dnl Try with -target option alone. (Sun javac 1.3.1 has the -target
+      dnl option but no -source option.)
       rm -f conftest.class
-      if { echo "$as_me:__oline__: $JAVAC -d . conftest.java" >&AS_MESSAGE_LOG_FD
-           $JAVAC -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+      if { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
+           $JAVAC -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
          } \
          && test -f conftest.class \
          && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
         dnl Try adding -source option if it is useful.
         rm -f conftest.class
         rm -f conftestfail.class
-        if { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-             $JAVAC -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+        if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
+             $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
            } \
            && test -f conftest.class \
            && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
-           && { echo "$as_me:__oline__: $JAVAC -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                $JAVAC -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
+           && { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
+                $JAVAC -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
               } \
            && test -f conftestfail.class \
-           && ! { echo "$as_me:__oline__: $JAVAC -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                  $JAVAC -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
+           && ! { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
+                  $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
                 }; then
-          CONF_JAVAC="$JAVAC -source $source_version"
+          CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
           HAVE_JAVAC_ENVVAR=1
           HAVE_JAVACOMP=1
         else
-          CONF_JAVAC="$JAVAC"
+          CONF_JAVAC="$JAVAC -target $target_version"
           HAVE_JAVAC_ENVVAR=1
           HAVE_JAVACOMP=1
         fi
       else
-        dnl Try with -target option alone. (Sun javac 1.3.1 has the -target
-        dnl option but no -source option.)
+        dnl Maybe this -target option requires a -source option? Try with
+        dnl -target and -source options. (Supported by Sun javac 1.4 and
+        dnl higher.)
         rm -f conftest.class
-        if { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-             $JAVAC -target "$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
+        if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
+             $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
            } \
            && test -f conftest.class \
            && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-          dnl Try adding -source option if it is useful.
-          rm -f conftest.class
-          rm -f conftestfail.class
-          if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-               $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-             } \
-             && test -f conftest.class \
-             && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
-             && { echo "$as_me:__oline__: $JAVAC -target $target_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                  $JAVAC -target "$target_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                } \
-             && test -f conftestfail.class \
-             && ! { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                    $JAVAC -target "$target_version" -source "$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                  }; then
-            CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          else
-            CONF_JAVAC="$JAVAC -target $target_version"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          fi
-        else
-          dnl Maybe this -target option requires a -source option? Try with
-          dnl -target and -source options. (Supported by Sun javac 1.4 and
-          dnl higher.)
-          rm -f conftest.class
-          if { echo "$as_me:__oline__: $JAVAC -target $target_version -source $source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-               $JAVAC -target "$target_version" -source "$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-             } \
-             && test -f conftest.class \
-             && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-            CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
-            HAVE_JAVAC_ENVVAR=1
-            HAVE_JAVACOMP=1
-          fi
+          CONF_JAVAC="$JAVAC -target $target_version -source $source_version"
+          HAVE_JAVAC_ENVVAR=1
+          HAVE_JAVACOMP=1
         fi
       fi
     fi
@@ -493,113 +357,11 @@ AC_DEFUN([gt_JAVACOMP]
     pushdef([AC_MSG_CHECKING],[:])dnl
     pushdef([AC_CHECKING],[:])dnl
     pushdef([AC_MSG_RESULT],[:])dnl
-    AC_CHECK_PROG([HAVE_GCJ_IN_PATH], [gcj], [yes])
     AC_CHECK_PROG([HAVE_JAVAC_IN_PATH], [javac], [yes])
     AC_CHECK_PROG([HAVE_JIKES_IN_PATH], [jikes], [yes])
     popdef([AC_MSG_RESULT])dnl
     popdef([AC_CHECKING])dnl
     popdef([AC_MSG_CHECKING])dnl
-    if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_GCJ_IN_PATH"; then
-      dnl Test for a good gcj version (>= 3.0).
-changequote(,)dnl
-      if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null; then
-changequote([,])dnl
-        dnl See if libgcj.jar is well installed.
-        if { echo "$as_me:__oline__: gcj -C -d . conftestlib.java" >&AS_MESSAGE_LOG_FD
-             gcj -C -d . conftestlib.java >&AS_MESSAGE_LOG_FD 2>&1
-           }; then
-          dnl OK, gcj works.
-changequote(,)dnl
-          if gcj --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null; then
-changequote([,])dnl
-            dnl It's a version of gcj >= 4.3. Assume the classfile versions are correct.
-            dnl Try gcj.
-            rm -f conftest.class
-            if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                 gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-               } \
-               && test -f conftest.class \
-               && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-              dnl Try adding -fsource option if it is useful.
-              rm -f conftest.class
-              rm -f conftestfail.class
-              if { echo "$as_me:__oline__: gcj -C -fsource=$source_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                   gcj -C -fsource="$source_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-                 } \
-                 && test -f conftest.class \
-                 && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD \
-                 && { echo "$as_me:__oline__: gcj -C -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                      gcj -C -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                    } \
-                 && test -f conftestfail.class \
-                 && ! { echo "$as_me:__oline__: gcj -C -fsource=$source_version -d . conftestfail.java" >&AS_MESSAGE_LOG_FD
-                        gcj -C -fsource="$source_version" -d . conftestfail.java >&AS_MESSAGE_LOG_FD 2>&1
-                      }; then
-                CONF_JAVAC="gcj -C -fsource=$source_version"
-                HAVE_JAVAC_ENVVAR=1
-                HAVE_JAVACOMP=1
-              else
-                CONF_JAVAC="gcj -C"
-                HAVE_JAVAC_ENVVAR=1
-                HAVE_JAVACOMP=1
-              fi
-            else
-              dnl Try with -fsource and -ftarget options.
-              rm -f conftest.class
-              rm -f conftestfail.class
-              if { echo "$as_me:__oline__: gcj -C -fsource=$source_version -ftarget=$target_version -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                   gcj -C -fsource="$source_version" -ftarget="$target_version" -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-                 } \
-                 && test -f conftest.class \
-                 && expr `func_classfile_version conftest.class` '<=' $cfversion >/dev/null 2>&AS_MESSAGE_LOG_FD; then
-                CONF_JAVAC="gcj -C -fsource=$source_version -ftarget=$target_version"
-                HAVE_JAVAC_ENVVAR=1
-                HAVE_JAVACOMP=1
-              fi
-            fi
-          else
-            dnl It's a version of gcj < 4.3. Ignore the version of conftest.class.
-            dnl Now test whether it supports the desired target-version and
-            dnl source-version.
-            if test "$target_version" = 1.4 && test "$source_version" = 1.4; then
-              rm -f conftest.class
-              if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                   gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-                 } \
-                 && test -f conftest.class; then
-                CONF_JAVAC="gcj -C"
-                HAVE_GCJ_C=1
-                HAVE_JAVACOMP=1
-              fi
-            else
-              if test "$target_version" = 1.4 && test "$source_version" = 1.3; then
-                dnl Try gcj and "gcj -fno-assert". But add -fno-assert only if
-                dnl it works (not gcj < 3.3).
-                rm -f conftest.class
-                if { echo "$as_me:__oline__: gcj -C -fno-assert -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                     gcj -C -fno-assert -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-                   } \
-                   && test -f conftest.class; then
-                  CONF_JAVAC="gcj -C -fno-assert"
-                  HAVE_GCJ_C=1
-                  HAVE_JAVACOMP=1
-                else
-                  rm -f conftest.class
-                  if { echo "$as_me:__oline__: gcj -C -d . conftest.java" >&AS_MESSAGE_LOG_FD
-                       gcj -C -d . conftest.java >&AS_MESSAGE_LOG_FD 2>&1
-                     } \
-                     && test -f conftest.class; then
-                    CONF_JAVAC="gcj -C"
-                    HAVE_GCJ_C=1
-                    HAVE_JAVACOMP=1
-                  fi
-                fi
-              fi
-            fi
-          fi
-        fi
-      fi
-    fi
     if test -z "$HAVE_JAVACOMP" && test -n "$HAVE_JAVAC_IN_PATH"; then
       dnl Test whether javac is usable.
       if { javac -version >/dev/null 2>/dev/null || test $? -le 2; } \
@@ -728,7 +490,6 @@ AC_DEFUN([gt_JAVACOMP]
   AC_SUBST([CLASSPATH])
   AC_SUBST([CLASSPATH_SEPARATOR])
   AC_SUBST([HAVE_JAVAC_ENVVAR])
-  AC_SUBST([HAVE_GCJ_C])
   AC_SUBST([HAVE_JAVAC])
   AC_SUBST([HAVE_JIKES])
 ])
@@ -738,12 +499,10 @@ AC_DEFUN([gt_JAVACOMP_DISABLED]
 [
   CONF_JAVAC=
   HAVE_JAVAC_ENVVAR=
-  HAVE_GCJ_C=
   HAVE_JAVAC=
   HAVE_JIKES=
   AC_SUBST([CONF_JAVAC])
   AC_SUBST([HAVE_JAVAC_ENVVAR])
-  AC_SUBST([HAVE_GCJ_C])
   AC_SUBST([HAVE_JAVAC])
   AC_SUBST([HAVE_JIKES])
 ])
-- 
2.34.1

>From 3eae71481526bbdb4c0b514c59e252c92081063c Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 9 Jun 2023 15:45:25 +0200
Subject: [PATCH 4/4] javacomp: Remove support for 'gcj'.

* lib/javacomp.h: Update comment.
* lib/javacomp.c (compile_using_gcj, is_envjavac_gcj, is_envjavac_gcj43,
is_envjavac_gcj43_usable, is_envjavac_oldgcj_14_14_usable,
is_envjavac_oldgcj_14_13_usable, is_gcj_present, is_gcj_43,
is_gcj43_usable, is_oldgcj_14_14_usable, is_oldgcj_14_13_usable): Remove
functions.
(is_envjavac_usable): Renamed from is_envjavac_nongcj_usable.
(compile_java_class): Remove gcj related code.
---
 ChangeLog      |   10 +
 lib/javacomp.c | 1498 +++++-------------------------------------------
 lib/javacomp.h |    6 +-
 3 files changed, 163 insertions(+), 1351 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4d733c5018..de1b1eb08d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2023-06-09  Bruno Haible  <br...@clisp.org>
 
+	javacomp: Remove support for 'gcj'.
+	* lib/javacomp.h: Update comment.
+	* lib/javacomp.c (compile_using_gcj, is_envjavac_gcj, is_envjavac_gcj43,
+	is_envjavac_gcj43_usable, is_envjavac_oldgcj_14_14_usable,
+	is_envjavac_oldgcj_14_13_usable, is_gcj_present, is_gcj_43,
+	is_gcj43_usable, is_oldgcj_14_14_usable, is_oldgcj_14_13_usable): Remove
+	functions.
+	(is_envjavac_usable): Renamed from is_envjavac_nongcj_usable.
+	(compile_java_class): Remove gcj related code.
+
 	javacomp-script: Remove support for 'gcj'.
 	* build-aux/javacomp.sh.in: Don't test HAVE_GCJ_C.
 	* m4/javacomp.m4 (gt_JAVACOMP): Don't set HAVE_GCJ_C. Don't test whether
diff --git a/lib/javacomp.c b/lib/javacomp.c
index bb4ef919f4..b3bef36ca1 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -64,7 +64,6 @@
    Program  from        A  C               O  g  T
 
    $JAVAC   unknown     N  n/a            -O -g  true
-   gcj -C   GCC 3.2     Y  --classpath=P  -O -g  gcj --version | sed -e 's,^[^0-9]*,,' -e 1q | sed -e '/^3\.[01]/d' | grep '^[3-9]' >/dev/null
    javac    JDK 1.1.8   Y  -classpath P   -O -g  javac 2>/dev/null; test $? = 1
    javac    JDK 1.3.0   Y  -classpath P   -O -g  javac 2>/dev/null; test $? -le 2
    jikes    Jikes 1.14  N  -classpath P   -O -g  jikes 2>/dev/null; test $? = 1
@@ -78,9 +77,8 @@
    We try the Java compilers in the following order:
      1. getenv ("JAVAC"), because the user must be able to override our
         preferences,
-     2. "gcj -C", because it is a completely free compiler,
-     3. "javac", because it is a standard compiler,
-     4. "jikes", comes last because it has some deviating interpretation
+     2. "javac", because it is a standard compiler,
+     3. "jikes", comes last because it has some deviating interpretation
         of the Java Language Specification and because it requires a
         CLASSPATH environment variable.
 
@@ -354,93 +352,6 @@ compile_using_envjavac (const char *javac,
   return err;
 }
 
-/* Try to compile a set of Java sources with gcj.
-   Return a failure indicator (true upon error).  */
-static bool
-compile_using_gcj (const char * const *java_sources,
-                   unsigned int java_sources_count,
-                   bool no_assert_option,
-                   bool fsource_option, const char *source_version,
-                   bool ftarget_option, const char *target_version,
-                   const char *directory,
-                   bool optimize, bool debug,
-                   bool verbose, bool null_stderr)
-{
-  bool err;
-  unsigned int argc;
-  const char **argv;
-  const char **argp;
-  char *fsource_arg;
-  char *ftarget_arg;
-  int exitstatus;
-  unsigned int i;
-
-  argc =
-    2 + (no_assert_option ? 1 : 0) + (fsource_option ? 1 : 0)
-    + (ftarget_option ? 1 : 0) + (optimize ? 1 : 0) + (debug ? 1 : 0)
-    + (directory != NULL ? 2 : 0) + java_sources_count;
-  argv = (const char **) xmalloca ((argc + 1) * sizeof (const char *));
-
-  argp = argv;
-  *argp++ = "gcj";
-  *argp++ = "-C";
-  if (no_assert_option)
-    *argp++ = "-fno-assert";
-  if (fsource_option)
-    {
-      fsource_arg = (char *) xmalloca (9 + strlen (source_version) + 1);
-      memcpy (fsource_arg, "-fsource=", 9);
-      strcpy (fsource_arg + 9, source_version);
-      *argp++ = fsource_arg;
-    }
-  else
-    fsource_arg = NULL;
-  if (ftarget_option)
-    {
-      ftarget_arg = (char *) xmalloca (9 + strlen (target_version) + 1);
-      memcpy (ftarget_arg, "-ftarget=", 9);
-      strcpy (ftarget_arg + 9, target_version);
-      *argp++ = ftarget_arg;
-    }
-  else
-    ftarget_arg = NULL;
-  if (optimize)
-    *argp++ = "-O";
-  if (debug)
-    *argp++ = "-g";
-  if (directory != NULL)
-    {
-      *argp++ = "-d";
-      *argp++ = directory;
-    }
-  for (i = 0; i < java_sources_count; i++)
-    *argp++ = java_sources[i];
-  *argp = NULL;
-  /* Ensure argv length was correctly calculated.  */
-  if (argp - argv != argc)
-    abort ();
-
-  if (verbose)
-    {
-      char *command = shell_quote_argv (argv);
-      printf ("%s\n", command);
-      free (command);
-    }
-
-  exitstatus = execute ("gcj", "gcj", argv, NULL,
-                        false, false, false, null_stderr,
-                        true, true, NULL);
-  err = (exitstatus != 0);
-
-  if (ftarget_arg != NULL)
-    freea (ftarget_arg);
-  if (fsource_arg != NULL)
-    freea (fsource_arg);
-  freea (argv);
-
-  return err;
-}
-
 /* Try to compile a set of Java sources with javac.
    Return a failure indicator (true upon error).  */
 static bool
@@ -623,986 +534,24 @@ get_classfile_version (const char *compiled_file_name)
   return INT_MAX;
 }
 
-/* Return true if $JAVAC is a version of gcj.  */
-static bool
-is_envjavac_gcj (const char *javac)
-{
-  static bool envjavac_tested;
-  static bool envjavac_gcj;
-
-  if (!envjavac_tested)
-    {
-      /* Test whether $JAVAC is gcj:
-         "$JAVAC --version 2>/dev/null | sed -e 1q | grep gcj > /dev/null"  */
-      unsigned int command_length;
-      char *command;
-      const char *argv[4];
-      pid_t child;
-      int fd[1];
-      FILE *fp;
-      char *line;
-      size_t linesize;
-      size_t linelen;
-      int exitstatus;
-      char *p;
-
-      /* Setup the command "$JAVAC --version".  */
-      command_length = strlen (javac) + 1 + 9 + 1;
-      command = (char *) xmalloca (command_length);
-      p = command;
-      /* Don't shell_quote $JAVAC, because it may consist of a command
-         and options.  */
-      memcpy (p, javac, strlen (javac));
-      p += strlen (javac);
-      memcpy (p, " --version", 1 + 9 + 1);
-      p += 1 + 9 + 1;
-      /* Ensure command_length was correctly calculated.  */
-      if (p - command > command_length)
-        abort ();
-
-      /* Call $JAVAC --version 2>/dev/null.  */
-      argv[0] = BOURNE_SHELL;
-      argv[1] = "-c";
-      argv[2] = command;
-      argv[3] = NULL;
-      child = create_pipe_in (javac, BOURNE_SHELL, argv, NULL,
-                              DEV_NULL, true, true, false, fd);
-      if (child == -1)
-        goto failed;
-
-      /* Retrieve its result.  */
-      fp = fdopen (fd[0], "r");
-      if (fp == NULL)
-        goto failed;
-
-      line = NULL; linesize = 0;
-      linelen = getline (&line, &linesize, fp);
-      if (linelen == (size_t)(-1))
-        {
-          fclose (fp);
-          goto failed;
-        }
-      /* It is safe to call c_strstr() instead of strstr() here; see the
-         comments in c-strstr.h.  */
-      envjavac_gcj = (c_strstr (line, "gcj") != NULL);
-
-      fclose (fp);
-
-      /* Remove zombie process from process list, and retrieve exit status.  */
-      exitstatus =
-        wait_subprocess (child, javac, true, true, true, false, NULL);
-      if (exitstatus != 0)
-        envjavac_gcj = false;
-
-     failed:
-      freea (command);
-
-      envjavac_tested = true;
-    }
-
-  return envjavac_gcj;
-}
-
-/* Return true if $JAVAC, known to be a version of gcj, is a version >= 4.3
-   of gcj.  */
-static bool
-is_envjavac_gcj43 (const char *javac)
-{
-  static bool envjavac_tested;
-  static bool envjavac_gcj43;
-
-  if (!envjavac_tested)
-    {
-      /* Test whether $JAVAC is gcj:
-         "$JAVAC --version 2>/dev/null | sed -e 's,^[^0-9]*,,' -e 1q \
-          | sed -e '/^4\.[012]/d' | grep '^[4-9]' >/dev/null"  */
-      unsigned int command_length;
-      char *command;
-      const char *argv[4];
-      pid_t child;
-      int fd[1];
-      FILE *fp;
-      char *line;
-      size_t linesize;
-      size_t linelen;
-      int exitstatus;
-      char *p;
-
-      /* Setup the command "$JAVAC --version".  */
-      command_length = strlen (javac) + 1 + 9 + 1;
-      command = (char *) xmalloca (command_length);
-      p = command;
-      /* Don't shell_quote $JAVAC, because it may consist of a command
-         and options.  */
-      memcpy (p, javac, strlen (javac));
-      p += strlen (javac);
-      memcpy (p, " --version", 1 + 9 + 1);
-      p += 1 + 9 + 1;
-      /* Ensure command_length was correctly calculated.  */
-      if (p - command > command_length)
-        abort ();
-
-      /* Call $JAVAC --version 2>/dev/null.  */
-      argv[0] = BOURNE_SHELL;
-      argv[1] = "-c";
-      argv[2] = command;
-      argv[3] = NULL;
-      child = create_pipe_in (javac, BOURNE_SHELL, argv, NULL,
-                              DEV_NULL, true, true, false, fd);
-      if (child == -1)
-        goto failed;
-
-      /* Retrieve its result.  */
-      fp = fdopen (fd[0], "r");
-      if (fp == NULL)
-        goto failed;
-
-      line = NULL; linesize = 0;
-      linelen = getline (&line, &linesize, fp);
-      if (linelen == (size_t)(-1))
-        {
-          fclose (fp);
-          goto failed;
-        }
-      p = line;
-      while (*p != '\0' && !(*p >= '0' && *p <= '9'))
-        p++;
-      envjavac_gcj43 =
-        !(*p == '4' && p[1] == '.' && p[2] >= '0' && p[2] <= '2')
-        && (*p >= '4' && *p <= '9');
-
-      fclose (fp);
-
-      /* Remove zombie process from process list, and retrieve exit status.  */
-      exitstatus =
-        wait_subprocess (child, javac, true, true, true, false, NULL);
-      if (exitstatus != 0)
-        envjavac_gcj43 = false;
-
-     failed:
-      freea (command);
-
-      envjavac_tested = true;
-    }
-
-  return envjavac_gcj43;
-}
-
-/* Test whether $JAVAC, known to be a version of gcj >= 4.3, can be used, and
-   whether it needs a -fsource and/or -ftarget option.
-   Return a failure indicator (true upon error).  */
-static bool
-is_envjavac_gcj43_usable (const char *javac,
-                          const char *source_version,
-                          const char *target_version,
-                          bool *usablep,
-                          bool *fsource_option_p, bool *ftarget_option_p)
-{
-  /* The cache depends on the source_version and target_version.  */
-  struct result_t
-  {
-    bool tested;
-    bool usable;
-    bool fsource_option;
-    bool ftarget_option;
-  };
-  static struct result_t result_cache[SOURCE_VERSION_BOUND][TARGET_VERSION_BOUND];
-  struct result_t *resultp;
-
-  resultp = &result_cache[source_version_index (source_version)]
-                         [target_version_index (target_version)];
-  if (!resultp->tested)
-    {
-      /* Try $JAVAC.  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
-
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
-
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet (source_version)))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
-
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
-
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_envjavac (javac,
-                                   java_sources, 1, tmpdir->dir_name,
-                                   false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0
-          && get_classfile_version (compiled_file_name)
-             <= corresponding_classfile_version (target_version))
-        {
-          /* $JAVAC compiled conftest.java successfully.  */
-          /* Try adding -fsource option if it is useful.  */
-          char *javac_source =
-            xasprintf ("%s -fsource=%s", javac, source_version);
-          assume (javac_source != NULL);
-
-          unlink (compiled_file_name);
-
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_envjavac (javac_source,
-                                       java_sources, 1, tmpdir->dir_name,
-                                       false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0
-              && get_classfile_version (compiled_file_name)
-                 <= corresponding_classfile_version (target_version))
-            {
-              const char *failcode = get_failcode_snippet (source_version);
-
-              if (failcode != NULL)
-                {
-                  free (compiled_file_name);
-                  free (conftest_file_name);
-
-                  conftest_file_name =
-                    xconcatenated_filename (tmpdir->dir_name,
-                                            "conftestfail.java",
-                                            NULL);
-                  if (write_temp_file (tmpdir, conftest_file_name, failcode))
-                    {
-                      free (conftest_file_name);
-                      free (javac_source);
-                      cleanup_temp_dir (tmpdir);
-                      return true;
-                    }
-
-                  compiled_file_name =
-                    xconcatenated_filename (tmpdir->dir_name,
-                                            "conftestfail.class",
-                                            NULL);
-                  register_temp_file (tmpdir, compiled_file_name);
-
-                  java_sources[0] = conftest_file_name;
-                  if (!compile_using_envjavac (javac,
-                                               java_sources, 1,
-                                               tmpdir->dir_name,
-                                               false, false, false, true)
-                      && stat (compiled_file_name, &statbuf) >= 0)
-                    {
-                      unlink (compiled_file_name);
-
-                      java_sources[0] = conftest_file_name;
-                      if (compile_using_envjavac (javac_source,
-                                                  java_sources, 1,
-                                                  tmpdir->dir_name,
-                                                  false, false, false, true))
-                        /* $JAVAC compiled conftestfail.java successfully, and
-                           "$JAVAC -fsource=$source_version" rejects it.  So
-                           the -fsource option is useful.  */
-                        resultp->fsource_option = true;
-                    }
-                }
-            }
-
-          free (javac_source);
-
-          resultp->usable = true;
-        }
-      else
-        {
-          /* Try with -fsource and -ftarget options.  */
-          char *javac_target =
-            xasprintf ("%s -fsource=%s -ftarget=%s",
-                       javac, source_version, target_version);
-          assume (javac_target != NULL);
-
-          unlink (compiled_file_name);
-
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_envjavac (javac_target,
-                                       java_sources, 1, tmpdir->dir_name,
-                                       false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0
-              && get_classfile_version (compiled_file_name)
-                 <= corresponding_classfile_version (target_version))
-            {
-              /* "$JAVAC -fsource $source_version -ftarget $target_version"
-                 compiled conftest.java successfully.  */
-              resultp->fsource_option = true;
-              resultp->ftarget_option = true;
-              resultp->usable = true;
-            }
-
-          free (javac_target);
-        }
-
-      free (compiled_file_name);
-      free (conftest_file_name);
-
-      resultp->tested = true;
-    }
-
-  *usablep = resultp->usable;
-  *fsource_option_p = resultp->fsource_option;
-  *ftarget_option_p = resultp->ftarget_option;
-  return false;
-}
-
-/* Test whether $JAVAC, known to be a version of gcj < 4.3, can be used for
-   compiling with target_version = 1.4 and source_version = 1.4.
-   Return a failure indicator (true upon error).  */
-static bool
-is_envjavac_oldgcj_14_14_usable (const char *javac, bool *usablep)
-{
-  static bool envjavac_tested;
-  static bool envjavac_usable;
-
-  if (!envjavac_tested)
-    {
-      /* Try $JAVAC.  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
-
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
-
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet ("1.4")))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
-
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
-
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_envjavac (javac, java_sources, 1, tmpdir->dir_name,
-                                   false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0)
-        /* Compilation succeeded.  */
-        envjavac_usable = true;
-
-      free (compiled_file_name);
-      free (conftest_file_name);
-
-      cleanup_temp_dir (tmpdir);
-
-      envjavac_tested = true;
-    }
-
-  *usablep = envjavac_usable;
-  return false;
-}
-
-/* Test whether $JAVAC, known to be a version of gcj < 4.3, can be used for
-   compiling with target_version = 1.4 and source_version = 1.3.
-   Return a failure indicator (true upon error).  */
-static bool
-is_envjavac_oldgcj_14_13_usable (const char *javac,
-                                 bool *usablep, bool *need_no_assert_option_p)
-{
-  static bool envjavac_tested;
-  static bool envjavac_usable;
-  static bool envjavac_need_no_assert_option;
-
-  if (!envjavac_tested)
-    {
-      /* Try $JAVAC and "$JAVAC -fno-assert".  But add -fno-assert only if
-         it makes a difference.  (It could already be part of $JAVAC.)  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
-      bool javac_works;
-      char *javac_noassert;
-      bool javac_noassert_works;
-
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
-
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet ("1.3")))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
-
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
-
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_envjavac (javac,
-                                   java_sources, 1, tmpdir->dir_name,
-                                   false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0)
-        /* Compilation succeeded.  */
-        javac_works = true;
-      else
-        javac_works = false;
-
-      unlink (compiled_file_name);
-
-      javac_noassert = xasprintf ("%s -fno-assert", javac);
-      assume (javac_noassert != NULL);
-
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_envjavac (javac_noassert,
-                                   java_sources, 1, tmpdir->dir_name,
-                                   false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0)
-        /* Compilation succeeded.  */
-        javac_noassert_works = true;
-      else
-        javac_noassert_works = false;
-
-      free (compiled_file_name);
-      free (conftest_file_name);
-
-      if (javac_works && javac_noassert_works)
-        {
-          conftest_file_name =
-            xconcatenated_filename (tmpdir->dir_name, "conftestfail.java",
-                                    NULL);
-          if (write_temp_file (tmpdir, conftest_file_name,
-                               get_failcode_snippet ("1.3")))
-            {
-              free (conftest_file_name);
-              free (javac_noassert);
-              cleanup_temp_dir (tmpdir);
-              return true;
-            }
-
-          compiled_file_name =
-            xconcatenated_filename (tmpdir->dir_name, "conftestfail.class",
-                                    NULL);
-          register_temp_file (tmpdir, compiled_file_name);
-
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_envjavac (javac,
-                                       java_sources, 1, tmpdir->dir_name,
-                                       false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0)
-            {
-              /* Compilation succeeded.  */
-              unlink (compiled_file_name);
-
-              java_sources[0] = conftest_file_name;
-              if (!(!compile_using_envjavac (javac_noassert,
-                                             java_sources, 1, tmpdir->dir_name,
-                                             false, false, false, true)
-                    && stat (compiled_file_name, &statbuf) >= 0))
-                /* Compilation failed.  */
-                /* "$JAVAC -fno-assert" works better than $JAVAC.  */
-                javac_works = true;
-            }
-
-          free (compiled_file_name);
-          free (conftest_file_name);
-        }
-
-      cleanup_temp_dir (tmpdir);
-
-      if (javac_works)
-        {
-          envjavac_usable = true;
-          envjavac_need_no_assert_option = false;
-        }
-      else if (javac_noassert_works)
-        {
-          envjavac_usable = true;
-          envjavac_need_no_assert_option = true;
-        }
-
-      envjavac_tested = true;
-    }
-
-  *usablep = envjavac_usable;
-  *need_no_assert_option_p = envjavac_need_no_assert_option;
-  return false;
-}
-
-/* Test whether $JAVAC, known to be not a version of gcj, can be used, and
-   whether it needs a -source and/or -target option.
-   Return a failure indicator (true upon error).  */
-static bool
-is_envjavac_nongcj_usable (const char *javac,
-                           const char *source_version,
-                           const char *source_version_for_javac,
-                           const char *target_version,
-                           bool *usablep,
-                           bool *source_option_p, bool *target_option_p)
-{
-  /* The cache depends on the source_version and target_version.  */
-  struct result_t
-  {
-    bool tested;
-    bool usable;
-    bool source_option;
-    bool target_option;
-  };
-  static struct result_t result_cache[SOURCE_VERSION_BOUND][TARGET_VERSION_BOUND];
-  struct result_t *resultp;
-
-  resultp = &result_cache[source_version_index (source_version)]
-                         [target_version_index (target_version)];
-  if (!resultp->tested)
-    {
-      /* Try $JAVAC.  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
-
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
-
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet (source_version)))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
-
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
-
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_envjavac (javac,
-                                   java_sources, 1, tmpdir->dir_name,
-                                   false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0
-          && get_classfile_version (compiled_file_name)
-             <= corresponding_classfile_version (target_version))
-        {
-          /* $JAVAC compiled conftest.java successfully.  */
-          /* Try adding -source option if it is useful.  */
-          char *javac_source =
-            xasprintf ("%s -source %s", javac, source_version_for_javac);
-          assume (javac_source != NULL);
-
-          unlink (compiled_file_name);
-
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_envjavac (javac_source,
-                                       java_sources, 1, tmpdir->dir_name,
-                                       false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0
-              && get_classfile_version (compiled_file_name)
-                 <= corresponding_classfile_version (target_version))
-            {
-              const char *failcode = get_failcode_snippet (source_version);
-
-              if (failcode != NULL)
-                {
-                  free (compiled_file_name);
-                  free (conftest_file_name);
-
-                  conftest_file_name =
-                    xconcatenated_filename (tmpdir->dir_name,
-                                            "conftestfail.java",
-                                            NULL);
-                  if (write_temp_file (tmpdir, conftest_file_name, failcode))
-                    {
-                      free (conftest_file_name);
-                      free (javac_source);
-                      cleanup_temp_dir (tmpdir);
-                      return true;
-                    }
-
-                  compiled_file_name =
-                    xconcatenated_filename (tmpdir->dir_name,
-                                            "conftestfail.class",
-                                            NULL);
-                  register_temp_file (tmpdir, compiled_file_name);
-
-                  java_sources[0] = conftest_file_name;
-                  if (!compile_using_envjavac (javac,
-                                               java_sources, 1,
-                                               tmpdir->dir_name,
-                                               false, false, false, true)
-                      && stat (compiled_file_name, &statbuf) >= 0)
-                    {
-                      unlink (compiled_file_name);
-
-                      java_sources[0] = conftest_file_name;
-                      if (compile_using_envjavac (javac_source,
-                                                  java_sources, 1,
-                                                  tmpdir->dir_name,
-                                                  false, false, false, true))
-                        /* $JAVAC compiled conftestfail.java successfully, and
-                           "$JAVAC -source $source_version_for_javac" rejects it.
-                           So the -source option is useful.  */
-                        resultp->source_option = true;
-                    }
-                }
-            }
-
-          free (javac_source);
-
-          resultp->usable = true;
-        }
-      else
-        {
-          /* Try with -target option alone. (Sun javac 1.3.1 has the -target
-             option but no -source option.)  */
-          char *javac_target =
-            xasprintf ("%s -target %s", javac, target_version);
-          assume (javac_target != NULL);
-
-          unlink (compiled_file_name);
-
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_envjavac (javac_target,
-                                       java_sources, 1, tmpdir->dir_name,
-                                       false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0
-              && get_classfile_version (compiled_file_name)
-                 <= corresponding_classfile_version (target_version))
-            {
-              /* "$JAVAC -target $target_version" compiled conftest.java
-                 successfully.  */
-              /* Try adding -source option if it is useful.  */
-              char *javac_target_source =
-                xasprintf ("%s -source %s", javac_target, source_version_for_javac);
-              assume (javac_target_source != NULL);
-
-              unlink (compiled_file_name);
-
-              java_sources[0] = conftest_file_name;
-              if (!compile_using_envjavac (javac_target_source,
-                                           java_sources, 1, tmpdir->dir_name,
-                                           false, false, false, true)
-                  && stat (compiled_file_name, &statbuf) >= 0
-                  && get_classfile_version (compiled_file_name)
-                     <= corresponding_classfile_version (target_version))
-                {
-                  const char *failcode = get_failcode_snippet (source_version);
-
-                  if (failcode != NULL)
-                    {
-                      free (compiled_file_name);
-                      free (conftest_file_name);
-
-                      conftest_file_name =
-                        xconcatenated_filename (tmpdir->dir_name,
-                                                "conftestfail.java",
-                                                NULL);
-                      if (write_temp_file (tmpdir, conftest_file_name,
-                                           failcode))
-                        {
-                          free (conftest_file_name);
-                          free (javac_target_source);
-                          free (javac_target);
-                          cleanup_temp_dir (tmpdir);
-                          return true;
-                        }
-
-                      compiled_file_name =
-                        xconcatenated_filename (tmpdir->dir_name,
-                                                "conftestfail.class",
-                                                NULL);
-                      register_temp_file (tmpdir, compiled_file_name);
-
-                      java_sources[0] = conftest_file_name;
-                      if (!compile_using_envjavac (javac_target,
-                                                   java_sources, 1,
-                                                   tmpdir->dir_name,
-                                                   false, false, false, true)
-                          && stat (compiled_file_name, &statbuf) >= 0)
-                        {
-                          unlink (compiled_file_name);
-
-                          java_sources[0] = conftest_file_name;
-                          if (compile_using_envjavac (javac_target_source,
-                                                      java_sources, 1,
-                                                      tmpdir->dir_name,
-                                                      false, false, false,
-                                                      true))
-                            /* "$JAVAC -target $target_version" compiled
-                               conftestfail.java successfully, and
-                               "$JAVAC -target $target_version -source $source_version_for_javac"
-                               rejects it.  So the -source option is useful.  */
-                            resultp->source_option = true;
-                        }
-                    }
-                }
-
-              free (javac_target_source);
-
-              resultp->target_option = true;
-              resultp->usable = true;
-            }
-          else
-            {
-              /* Maybe this -target option requires a -source option? Try with
-                 -target and -source options. (Supported by Sun javac 1.4 and
-                 higher.)  */
-              char *javac_target_source =
-                xasprintf ("%s -source %s", javac_target, source_version_for_javac);
-              assume (javac_target_source != NULL);
-
-              unlink (compiled_file_name);
-
-              java_sources[0] = conftest_file_name;
-              if (!compile_using_envjavac (javac_target_source,
-                                           java_sources, 1, tmpdir->dir_name,
-                                           false, false, false, true)
-                  && stat (compiled_file_name, &statbuf) >= 0
-                  && get_classfile_version (compiled_file_name)
-                     <= corresponding_classfile_version (target_version))
-                {
-                  /* "$JAVAC -target $target_version -source $source_version_for_javac"
-                     compiled conftest.java successfully.  */
-                  resultp->source_option = true;
-                  resultp->target_option = true;
-                  resultp->usable = true;
-                }
-
-              free (javac_target_source);
-            }
-
-          free (javac_target);
-        }
-
-      free (compiled_file_name);
-      free (conftest_file_name);
-
-      resultp->tested = true;
-    }
-
-  *usablep = resultp->usable;
-  *source_option_p = resultp->source_option;
-  *target_option_p = resultp->target_option;
-  return false;
-}
-
-static bool
-is_gcj_present (void)
-{
-  static bool gcj_tested;
-  static bool gcj_present;
-
-  if (!gcj_tested)
-    {
-      /* Test for presence of gcj:
-         "gcj --version 2> /dev/null | \
-          sed -e 's,^[^0-9]*,,' -e 1q | \
-          sed -e '/^3\.[01]/d' | grep '^[3-9]' > /dev/null"  */
-      const char *argv[3];
-      pid_t child;
-      int fd[1];
-      int exitstatus;
-
-      argv[0] = "gcj";
-      argv[1] = "--version";
-      argv[2] = NULL;
-      child = create_pipe_in ("gcj", "gcj", argv, NULL,
-                              DEV_NULL, true, true, false, fd);
-      gcj_present = false;
-      if (child != -1)
-        {
-          /* Read the subprocess output, drop all lines except the first,
-             drop all characters before the first digit, and test whether
-             the remaining string starts with a digit >= 3, but not with
-             "3.0" or "3.1".  */
-          char c[3];
-          size_t count = 0;
-
-          while (safe_read (fd[0], &c[count], 1) > 0)
-            {
-              if (c[count] == '\n')
-                break;
-              if (count == 0)
-                {
-                  if (!(c[0] >= '0' && c[0] <= '9'))
-                    continue;
-                  gcj_present = (c[0] >= '3');
-                }
-              count++;
-              if (count == 3)
-                {
-                  if (c[0] == '3' && c[1] == '.'
-                      && (c[2] == '0' || c[2] == '1'))
-                    gcj_present = false;
-                  break;
-                }
-            }
-          while (safe_read (fd[0], &c[0], 1) > 0)
-            ;
-
-          close (fd[0]);
-
-          /* Remove zombie process from process list, and retrieve exit
-             status.  */
-          exitstatus =
-            wait_subprocess (child, "gcj", false, true, true, false, NULL);
-          if (exitstatus != 0)
-            gcj_present = false;
-        }
-
-      if (gcj_present)
-        {
-          /* See if libgcj.jar is well installed.  */
-          struct temp_dir *tmpdir;
-
-          tmpdir = create_temp_dir ("java", NULL, false);
-          if (tmpdir == NULL)
-            gcj_present = false;
-          else
-            {
-              char *conftest_file_name;
-
-              conftest_file_name =
-                xconcatenated_filename (tmpdir->dir_name, "conftestlib.java",
-                                        NULL);
-              if (write_temp_file (tmpdir, conftest_file_name,
-"public class conftestlib {\n"
-"  public static void main (String[] args) {\n"
-"  }\n"
-"}\n"))
-                gcj_present = false;
-              else
-                {
-                  char *compiled_file_name;
-                  const char *java_sources[1];
-
-                  compiled_file_name =
-                    xconcatenated_filename (tmpdir->dir_name,
-                                            "conftestlib.class",
-                                            NULL);
-                  register_temp_file (tmpdir, compiled_file_name);
-
-                  java_sources[0] = conftest_file_name;
-                  if (compile_using_gcj (java_sources, 1, false,
-                                         false, NULL, false, NULL,
-                                         tmpdir->dir_name,
-                                         false, false, false, true))
-                    gcj_present = false;
-
-                  free (compiled_file_name);
-                }
-              free (conftest_file_name);
-            }
-          cleanup_temp_dir (tmpdir);
-        }
-
-      gcj_tested = true;
-    }
-
-  return gcj_present;
-}
-
-static bool
-is_gcj_43 (void)
-{
-  static bool gcj_tested;
-  static bool gcj_43;
-
-  if (!gcj_tested)
-    {
-      /* Test for presence of gcj:
-         "gcj --version 2> /dev/null | \
-          sed -e 's,^[^0-9]*,,' -e 1q | \
-          sed -e '/^4\.[012]/d' | grep '^[4-9]'"  */
-      const char *argv[3];
-      pid_t child;
-      int fd[1];
-      int exitstatus;
-
-      argv[0] = "gcj";
-      argv[1] = "--version";
-      argv[2] = NULL;
-      child = create_pipe_in ("gcj", "gcj", argv, NULL,
-                              DEV_NULL, true, true, false, fd);
-      gcj_43 = false;
-      if (child != -1)
-        {
-          /* Read the subprocess output, drop all lines except the first,
-             drop all characters before the first digit, and test whether
-             the remaining string starts with a digit >= 4, but not with
-             "4.0" or "4.1" or "4.2".  */
-          char c[3];
-          size_t count = 0;
-
-          while (safe_read (fd[0], &c[count], 1) > 0)
-            {
-              if (c[count] == '\n')
-                break;
-              if (count == 0)
-                {
-                  if (!(c[0] >= '0' && c[0] <= '9'))
-                    continue;
-                  gcj_43 = (c[0] >= '4');
-                }
-              count++;
-              if (count == 3)
-                {
-                  if (c[0] == '4' && c[1] == '.' && c[2] >= '0' && c[2] <= '2')
-                    gcj_43 = false;
-                  break;
-                }
-            }
-          while (safe_read (fd[0], &c[0], 1) > 0)
-            ;
-
-          close (fd[0]);
-
-          /* Remove zombie process from process list, and retrieve exit
-             status.  */
-          exitstatus =
-            wait_subprocess (child, "gcj", false, true, true, false, NULL);
-          if (exitstatus != 0)
-            gcj_43 = false;
-        }
-
-      gcj_tested = true;
-    }
-
-  return gcj_43;
-}
-
-/* Test whether gcj >= 4.3 can be used, and whether it needs a -fsource and/or
-   -ftarget option.
+/* Test whether $JAVAC can be used, and whether it needs a -source and/or
+   -target option.
    Return a failure indicator (true upon error).  */
 static bool
-is_gcj43_usable (const char *source_version,
-                 const char *target_version,
-                 bool *usablep,
-                 bool *fsource_option_p, bool *ftarget_option_p)
+is_envjavac_usable (const char *javac,
+                    const char *source_version,
+                    const char *source_version_for_javac,
+                    const char *target_version,
+                    bool *usablep,
+                    bool *source_option_p, bool *target_option_p)
 {
   /* The cache depends on the source_version and target_version.  */
   struct result_t
   {
     bool tested;
     bool usable;
-    bool fsource_option;
-    bool ftarget_option;
+    bool source_option;
+    bool target_option;
   };
   static struct result_t result_cache[SOURCE_VERSION_BOUND][TARGET_VERSION_BOUND];
   struct result_t *resultp;
@@ -1611,7 +560,7 @@ is_gcj43_usable (const char *source_version,
                          [target_version_index (target_version)];
   if (!resultp->tested)
     {
-      /* Try gcj.  */
+      /* Try $JAVAC.  */
       struct temp_dir *tmpdir;
       char *conftest_file_name;
       char *compiled_file_name;
@@ -1637,20 +586,25 @@ is_gcj43_usable (const char *source_version,
       register_temp_file (tmpdir, compiled_file_name);
 
       java_sources[0] = conftest_file_name;
-      if (!compile_using_gcj (java_sources, 1, false, false, NULL, false, NULL,
-                              tmpdir->dir_name, false, false, false, true)
+      if (!compile_using_envjavac (javac,
+                                   java_sources, 1, tmpdir->dir_name,
+                                   false, false, false, true)
           && stat (compiled_file_name, &statbuf) >= 0
           && get_classfile_version (compiled_file_name)
              <= corresponding_classfile_version (target_version))
         {
-          /* gcj compiled conftest.java successfully.  */
-          /* Try adding -fsource option if it is useful.  */
+          /* $JAVAC compiled conftest.java successfully.  */
+          /* Try adding -source option if it is useful.  */
+          char *javac_source =
+            xasprintf ("%s -source %s", javac, source_version_for_javac);
+          assume (javac_source != NULL);
+
           unlink (compiled_file_name);
 
           java_sources[0] = conftest_file_name;
-          if (!compile_using_gcj (java_sources, 1,
-                                  false, true, source_version, false, NULL,
-                                  tmpdir->dir_name, false, false, false, true)
+          if (!compile_using_envjavac (javac_source,
+                                       java_sources, 1, tmpdir->dir_name,
+                                       false, false, false, true)
               && stat (compiled_file_name, &statbuf) >= 0
               && get_classfile_version (compiled_file_name)
                  <= corresponding_classfile_version (target_version))
@@ -1669,6 +623,7 @@ is_gcj43_usable (const char *source_version,
                   if (write_temp_file (tmpdir, conftest_file_name, failcode))
                     {
                       free (conftest_file_name);
+                      free (javac_source);
                       cleanup_temp_dir (tmpdir);
                       return true;
                     }
@@ -1680,193 +635,163 @@ is_gcj43_usable (const char *source_version,
                   register_temp_file (tmpdir, compiled_file_name);
 
                   java_sources[0] = conftest_file_name;
-                  if (!compile_using_gcj (java_sources, 1,
-                                          false, false, NULL, false, NULL,
-                                          tmpdir->dir_name,
-                                          false, false, false, true)
+                  if (!compile_using_envjavac (javac,
+                                               java_sources, 1,
+                                               tmpdir->dir_name,
+                                               false, false, false, true)
                       && stat (compiled_file_name, &statbuf) >= 0)
                     {
                       unlink (compiled_file_name);
 
                       java_sources[0] = conftest_file_name;
-                      if (compile_using_gcj (java_sources, 1,
-                                             false, true, source_version,
-                                             false, NULL,
-                                             tmpdir->dir_name,
-                                             false, false, false, true))
-                        /* gcj compiled conftestfail.java successfully, and
-                           "gcj -fsource=$source_version" rejects it.  So
-                           the -fsource option is useful.  */
-                        resultp->fsource_option = true;
+                      if (compile_using_envjavac (javac_source,
+                                                  java_sources, 1,
+                                                  tmpdir->dir_name,
+                                                  false, false, false, true))
+                        /* $JAVAC compiled conftestfail.java successfully, and
+                           "$JAVAC -source $source_version_for_javac" rejects it.
+                           So the -source option is useful.  */
+                        resultp->source_option = true;
                     }
                 }
             }
 
+          free (javac_source);
+
           resultp->usable = true;
         }
       else
         {
-          /* Try with -fsource and -ftarget options.  */
+          /* Try with -target option alone. (Sun javac 1.3.1 has the -target
+             option but no -source option.)  */
+          char *javac_target =
+            xasprintf ("%s -target %s", javac, target_version);
+          assume (javac_target != NULL);
+
           unlink (compiled_file_name);
 
           java_sources[0] = conftest_file_name;
-          if (!compile_using_gcj (java_sources, 1,
-                                  false, true, source_version,
-                                  true, target_version,
-                                  tmpdir->dir_name,
-                                  false, false, false, true)
+          if (!compile_using_envjavac (javac_target,
+                                       java_sources, 1, tmpdir->dir_name,
+                                       false, false, false, true)
               && stat (compiled_file_name, &statbuf) >= 0
               && get_classfile_version (compiled_file_name)
                  <= corresponding_classfile_version (target_version))
             {
-              /* "gcj -fsource $source_version -ftarget $target_version"
-                 compiled conftest.java successfully.  */
-              resultp->fsource_option = true;
-              resultp->ftarget_option = true;
-              resultp->usable = true;
-            }
-        }
-
-      free (compiled_file_name);
-      free (conftest_file_name);
-
-      resultp->tested = true;
-    }
-
-  *usablep = resultp->usable;
-  *fsource_option_p = resultp->fsource_option;
-  *ftarget_option_p = resultp->ftarget_option;
-  return false;
-}
-
-/* Test whether gcj < 4.3 can be used for compiling with target_version = 1.4
-   and source_version = 1.4.
-   Return a failure indicator (true upon error).  */
-static bool
-is_oldgcj_14_14_usable (bool *usablep)
-{
-  static bool gcj_tested;
-  static bool gcj_usable;
-
-  if (!gcj_tested)
-    {
-      /* Try gcj.  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
-
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
-
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet ("1.4")))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
-
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
+              /* "$JAVAC -target $target_version" compiled conftest.java
+                 successfully.  */
+              /* Try adding -source option if it is useful.  */
+              char *javac_target_source =
+                xasprintf ("%s -source %s", javac_target, source_version_for_javac);
+              assume (javac_target_source != NULL);
 
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_gcj (java_sources, 1, false, false, NULL, false, NULL,
-                              tmpdir->dir_name, false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0)
-        /* Compilation succeeded.  */
-        gcj_usable = true;
+              unlink (compiled_file_name);
 
-      free (compiled_file_name);
-      free (conftest_file_name);
+              java_sources[0] = conftest_file_name;
+              if (!compile_using_envjavac (javac_target_source,
+                                           java_sources, 1, tmpdir->dir_name,
+                                           false, false, false, true)
+                  && stat (compiled_file_name, &statbuf) >= 0
+                  && get_classfile_version (compiled_file_name)
+                     <= corresponding_classfile_version (target_version))
+                {
+                  const char *failcode = get_failcode_snippet (source_version);
 
-      cleanup_temp_dir (tmpdir);
+                  if (failcode != NULL)
+                    {
+                      free (compiled_file_name);
+                      free (conftest_file_name);
 
-      gcj_tested = true;
-    }
+                      conftest_file_name =
+                        xconcatenated_filename (tmpdir->dir_name,
+                                                "conftestfail.java",
+                                                NULL);
+                      if (write_temp_file (tmpdir, conftest_file_name,
+                                           failcode))
+                        {
+                          free (conftest_file_name);
+                          free (javac_target_source);
+                          free (javac_target);
+                          cleanup_temp_dir (tmpdir);
+                          return true;
+                        }
 
-  *usablep = gcj_usable;
-  return false;
-}
+                      compiled_file_name =
+                        xconcatenated_filename (tmpdir->dir_name,
+                                                "conftestfail.class",
+                                                NULL);
+                      register_temp_file (tmpdir, compiled_file_name);
 
-/* Test whether gcj < 4.3 can be used for compiling with target_version = 1.4
-   and source_version = 1.3.
-   Return a failure indicator (true upon error).  */
-static bool
-is_oldgcj_14_13_usable (bool *usablep, bool *need_no_assert_option_p)
-{
-  static bool gcj_tested;
-  static bool gcj_usable;
-  static bool gcj_need_no_assert_option;
+                      java_sources[0] = conftest_file_name;
+                      if (!compile_using_envjavac (javac_target,
+                                                   java_sources, 1,
+                                                   tmpdir->dir_name,
+                                                   false, false, false, true)
+                          && stat (compiled_file_name, &statbuf) >= 0)
+                        {
+                          unlink (compiled_file_name);
 
-  if (!gcj_tested)
-    {
-      /* Try gcj and "gcj -fno-assert".  But add -fno-assert only if
-         it works (not gcj < 3.3).  */
-      struct temp_dir *tmpdir;
-      char *conftest_file_name;
-      char *compiled_file_name;
-      const char *java_sources[1];
-      struct stat statbuf;
+                          java_sources[0] = conftest_file_name;
+                          if (compile_using_envjavac (javac_target_source,
+                                                      java_sources, 1,
+                                                      tmpdir->dir_name,
+                                                      false, false, false,
+                                                      true))
+                            /* "$JAVAC -target $target_version" compiled
+                               conftestfail.java successfully, and
+                               "$JAVAC -target $target_version -source $source_version_for_javac"
+                               rejects it.  So the -source option is useful.  */
+                            resultp->source_option = true;
+                        }
+                    }
+                }
 
-      tmpdir = create_temp_dir ("java", NULL, false);
-      if (tmpdir == NULL)
-        return true;
+              free (javac_target_source);
 
-      conftest_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.java", NULL);
-      if (write_temp_file (tmpdir, conftest_file_name,
-                           get_goodcode_snippet ("1.3")))
-        {
-          free (conftest_file_name);
-          cleanup_temp_dir (tmpdir);
-          return true;
-        }
+              resultp->target_option = true;
+              resultp->usable = true;
+            }
+          else
+            {
+              /* Maybe this -target option requires a -source option? Try with
+                 -target and -source options. (Supported by Sun javac 1.4 and
+                 higher.)  */
+              char *javac_target_source =
+                xasprintf ("%s -source %s", javac_target, source_version_for_javac);
+              assume (javac_target_source != NULL);
 
-      compiled_file_name =
-        xconcatenated_filename (tmpdir->dir_name, "conftest.class", NULL);
-      register_temp_file (tmpdir, compiled_file_name);
+              unlink (compiled_file_name);
 
-      java_sources[0] = conftest_file_name;
-      if (!compile_using_gcj (java_sources, 1, true, false, NULL, false, NULL,
-                              tmpdir->dir_name, false, false, false, true)
-          && stat (compiled_file_name, &statbuf) >= 0)
-        /* Compilation succeeded.  */
-        {
-          gcj_usable = true;
-          gcj_need_no_assert_option = true;
-        }
-      else
-        {
-          unlink (compiled_file_name);
+              java_sources[0] = conftest_file_name;
+              if (!compile_using_envjavac (javac_target_source,
+                                           java_sources, 1, tmpdir->dir_name,
+                                           false, false, false, true)
+                  && stat (compiled_file_name, &statbuf) >= 0
+                  && get_classfile_version (compiled_file_name)
+                     <= corresponding_classfile_version (target_version))
+                {
+                  /* "$JAVAC -target $target_version -source $source_version_for_javac"
+                     compiled conftest.java successfully.  */
+                  resultp->source_option = true;
+                  resultp->target_option = true;
+                  resultp->usable = true;
+                }
 
-          java_sources[0] = conftest_file_name;
-          if (!compile_using_gcj (java_sources, 1, false,
-                                  false, NULL, false, NULL,
-                                  tmpdir->dir_name, false, false, false, true)
-              && stat (compiled_file_name, &statbuf) >= 0)
-            /* Compilation succeeded.  */
-            {
-              gcj_usable = true;
-              gcj_need_no_assert_option = false;
+              free (javac_target_source);
             }
+
+          free (javac_target);
         }
 
       free (compiled_file_name);
       free (conftest_file_name);
 
-      cleanup_temp_dir (tmpdir);
-
-      gcj_tested = true;
+      resultp->tested = true;
     }
 
-  *usablep = gcj_usable;
-  *need_no_assert_option_p = gcj_need_no_assert_option;
+  *usablep = resultp->usable;
+  *source_option_p = resultp->source_option;
+  *target_option_p = resultp->target_option;
   return false;
 }
 
@@ -2196,61 +1121,15 @@ compile_java_class (const char * const *java_sources,
         source_version_for_javac =
           get_source_version_for_javac (source_version, target_version);
 
-        if (is_envjavac_gcj (javac))
-          {
-            /* It's a version of gcj.  */
-            if (is_envjavac_gcj43 (javac))
-              {
-                /* It's a version of gcj >= 4.3.  Assume the classfile versions
-                   are correct.  */
-                if (is_envjavac_gcj43_usable (javac,
-                                              source_version, target_version,
-                                              &usable,
-                                              &fsource_option, &ftarget_option))
-                  {
-                    err = true;
-                    goto done1;
-                  }
-              }
-            else
-              {
-                /* It's a version of gcj < 4.3.  Ignore the version of the
-                   class files that it creates.  */
-                if (strcmp (target_version, "1.4") == 0
-                    && strcmp (source_version, "1.4") == 0)
-                  {
-                    if (is_envjavac_oldgcj_14_14_usable (javac, &usable))
-                      {
-                        err = true;
-                        goto done1;
-                      }
-                  }
-                else if (strcmp (target_version, "1.4") == 0
-                         && strcmp (source_version, "1.3") == 0)
-                  {
-                    if (is_envjavac_oldgcj_14_13_usable (javac,
-                                                         &usable,
-                                                         &no_assert_option))
-                      {
-                        err = true;
-                        goto done1;
-                      }
-                  }
-              }
-          }
-        else
+        if (is_envjavac_usable (javac,
+                                source_version,
+                                source_version_for_javac,
+                                target_version,
+                                &usable,
+                                &source_option, &target_option))
           {
-            /* It's not gcj.  Assume the classfile versions are correct.  */
-            if (is_envjavac_nongcj_usable (javac,
-                                           source_version,
-                                           source_version_for_javac,
-                                           target_version,
-                                           &usable,
-                                           &source_option, &target_option))
-              {
-                err = true;
-                goto done1;
-              }
+            err = true;
+            goto done1;
           }
 
         if (usable)
@@ -2300,79 +1179,6 @@ compile_java_class (const char * const *java_sources,
       unsetenv ("JAVA_HOME");
     }
 
-  if (is_gcj_present ())
-    {
-      /* It's a version of gcj.  */
-      bool usable = false;
-      bool no_assert_option = false;
-      bool fsource_option = false;
-      bool ftarget_option = false;
-
-      if (target_version == NULL)
-        target_version = default_target_version ();
-
-      if (is_gcj_43 ())
-        {
-          /* It's a version of gcj >= 4.3.  Assume the classfile versions
-             are correct.  */
-          if (is_gcj43_usable (source_version, target_version,
-                               &usable, &fsource_option, &ftarget_option))
-            {
-              err = true;
-              goto done1;
-            }
-        }
-      else
-        {
-          /* It's a version of gcj < 4.3.  Ignore the version of the class
-             files that it creates.
-             Test whether it supports the desired target-version and
-             source-version.  */
-          if (strcmp (target_version, "1.4") == 0
-              && strcmp (source_version, "1.4") == 0)
-            {
-              if (is_oldgcj_14_14_usable (&usable))
-                {
-                  err = true;
-                  goto done1;
-                }
-            }
-          else if (strcmp (target_version, "1.4") == 0
-                   && strcmp (source_version, "1.3") == 0)
-            {
-              if (is_oldgcj_14_13_usable (&usable, &no_assert_option))
-                {
-                  err = true;
-                  goto done1;
-                }
-            }
-        }
-
-      if (usable)
-        {
-          char *old_classpath;
-
-          /* Set CLASSPATH.  We could also use the --CLASSPATH=... option
-             of gcj.  Note that --classpath=... option is different: its
-             argument should also contain gcj's libgcj.jar, but we don't
-             know its location.  */
-          old_classpath =
-            set_classpath (classpaths, classpaths_count, use_minimal_classpath,
-                           verbose);
-
-          err = compile_using_gcj (java_sources, java_sources_count,
-                                   no_assert_option,
-                                   fsource_option, source_version,
-                                   ftarget_option, target_version,
-                                   directory, optimize, debug, verbose, false);
-
-          /* Reset CLASSPATH.  */
-          reset_classpath (old_classpath);
-
-          goto done2;
-        }
-    }
-
   if (is_javac_present ())
     {
       bool usable = false;
@@ -2448,7 +1254,7 @@ compile_java_class (const char * const *java_sources,
         }
     }
 
-  error (0, 0, _("Java compiler not found, try installing gcj or set $JAVAC"));
+  error (0, 0, _("Java compiler not found, try setting $JAVAC"));
   err = true;
 
  done2:
diff --git a/lib/javacomp.h b/lib/javacomp.h
index 825efb4667..dcc9c37f7a 100644
--- a/lib/javacomp.h
+++ b/lib/javacomp.h
@@ -61,11 +61,7 @@
    because even Sun's/Oracle's javac doesn't support these combinations.
    It is redundant to ask for a target_version > source_version, since the
    smaller target_version = source_version will also always work and newer JVMs
-   support the older target_versions too. Except for the cases
-     - target_version = 1.4, source_version = 1.3, which allows gcj versions 3.0
-       to 3.2 to be used,
-     - target-version = 1.6, source-version = 1.5, which allows gcj versions
-       >= 4.3 to be used.
+   support the older target_versions too.
 
    directory is the target directory. The .class file for class X.Y.Z is
    written at directory/X/Y/Z.class. If directory is NULL, the .class
-- 
2.34.1

Reply via email to