+ GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX");
+ if (cp)
+ {
+ try = alloca (strlen (cp) + 50);
+ /* The exec prefix can be something like
+ /usr/local/bin/../lib/gcc-lib/. We want to change this
+ into a pointer to the share/java directory. We support two
+ configurations: one where prefix and exec-prefix are the
+ same, and one where exec-prefix is `prefix/SOMETHING'. */
+ strcpy (try, cp);
+ strcat (try, DIR_UP);
+ strcat (try, sep);
+ strcat (try, DIR_UP);
+ strcat (try, sep);
+ len = strlen (try);
+
+ strcpy (try + len, "share");
+ strcat (try, sep);
+ strcat (try, "java");
+ strcat (try, sep);
+ strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
+ if (! stat (try, &stat_b))
+ {
+ add_entry (&sys_dirs, try, 1);
+ found = 1;
+ strcpy (&try[strlen (try)
+ - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
+ sep);
+ strcat (try, "ext");
+ strcat (try, sep);
+ if (! stat (try, &stat_b))
+ jcf_path_extdirs_arg (try);
+ }
+ else
+ {
+ strcpy (try + len, DIR_UP);
+ strcat (try, sep);
+ strcat (try, "share");
+ strcat (try, sep);
+ strcat (try, "java");
+ strcat (try, sep);
+ strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar");
+ if (! stat (try, &stat_b))
+ {
+ add_entry (&sys_dirs, try, 1);
+ found = 1;
+ strcpy (&try[strlen (try)
+ - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
+ sep);
+ strcat (try, "ext");
+ strcat (try, sep);
+ if (! stat (try, &stat_b))
+ jcf_path_extdirs_arg (try);
+ }
+ }
+ }
+ if (! found)
+ {
+ /* Desperation: use the installed one. */
+ char *extdirs;
+ add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
+ extdirs = alloca (strlen (LIBGCJ_ZIP_FILE) + 1);
+ strcpy (extdirs, LIBGCJ_ZIP_FILE);
+ strcpy (&extdirs[strlen (LIBGCJ_ZIP_FILE)
+ - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")],
+ "ext");
+ strcat (extdirs, sep);
+ if (! stat (extdirs, &stat_b))
+ jcf_path_extdirs_arg (extdirs);
+ }
+
+ GET_ENVIRONMENT (cp, "CLASSPATH");