]> gcc.gnu.org Git - gcc.git/commitdiff
re GNATS gcj/84 (path to classes.zip is compiled in to gcj at build time)
authorTom Tromey <tromey@cygnus.com>
Wed, 10 Nov 1999 01:38:24 +0000 (01:38 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Wed, 10 Nov 1999 01:38:24 +0000 (01:38 +0000)
* jcf-path.c: Include <sys/stat.h>.
(jcf_path_init): Search for libjava.zip.  Fixes PR gcj/84.
(DIR_UP): New macro.

From-SVN: r30465

gcc/java/ChangeLog
gcc/java/jcf-path.c

index d15c7bd9e0856d8708acea86b509956781df8d72..14f65aaf75742f894154adf4429a00c45023553e 100644 (file)
@@ -1,3 +1,9 @@
+1999-11-09  Tom Tromey  <tromey@cygnus.com>
+
+       * jcf-path.c: Include <sys/stat.h>.
+       (jcf_path_init): Search for libjava.zip.  Fixes PR gcj/84.
+       (DIR_UP): New macro.
+
 Tue Nov  9 12:12:38 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
        * parse.y (source_end_java_method): Resume permanent allocation,
index 056be31d12cb930c7a7cfd80a918ce8b66e53188..c0cd3a744ccdbdb5e3b8f033fd7ab31f3322b04c 100644 (file)
@@ -43,6 +43,10 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #define DIR_SEPARATOR '/'
 #endif
 
+#ifndef DIR_UP
+#define DIR_UP ".."
+#endif
+
 \f
 
 /* Possible flag values.  */
@@ -223,9 +227,58 @@ void
 jcf_path_init ()
 {
   char *cp;
+  char *try, sep[2];
+  struct stat stat_b;
+  int found = 0, len;
 
   add_entry (&sys_dirs, ".", 0);
-  add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
+
+  sep[0] = DIR_SEPARATOR;
+  sep[1] = '\0';
+
+  GET_ENV_PATH_LIST (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 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, "libgcj.zip");
+      if (! stat (try, &stat_b))
+       {
+         add_entry (&sys_dirs, try, 1);
+         found = 1;
+       }
+      else
+       {
+         strcpy (try + len, DIR_UP);
+         strcat (try, sep);
+         strcat (try, "share");
+         strcat (try, sep);
+         strcat (try, "libgcj.zip");
+         if (! stat (try, &stat_b))
+           {
+             add_entry (&sys_dirs, try, 1);
+             found = 1;
+           }
+       }
+    }
+  if (! found)
+    {
+      /* Desperation: use the installed one.  */
+      add_entry (&sys_dirs, LIBGCJ_ZIP_FILE, 1);
+    }
 
   GET_ENV_PATH_LIST (cp, "CLASSPATH");
   add_path (&classpath_env, cp, 0);
This page took 0.083731 seconds and 5 git commands to generate.