gcc.c: Move data on prefixes forward in file and reorganize.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Thu, 5 Oct 2000 20:07:24 +0000 (20:07 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Thu, 5 Oct 2000 20:07:24 +0000 (16:07 -0400)
* gcc.c: Move data on prefixes forward in file and reorganize.
(md_exec_prefix, md_startfile_prefix, md_startfile_prefix_1):
Always define, but make null if no value.
(static_specs): Add "md_exec_prefix", "md_startfile_prefix",
and "md_startfile_prefix_1".
(main): Check whether md_exec_prefix and the others are the
null string rather than whether the macro is defined.

From-SVN: r36730

gcc/ChangeLog
gcc/gcc.c

index 4438b3d1b5e162965433f93ee563c60b18893771..941a6e451fb8440a985dbbd1e1fe977c78a62483 100644 (file)
@@ -1,3 +1,13 @@
+Thu Oct  5 16:16:57 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * gcc.c: Move data on prefixes forward in file and reorganize.
+       (md_exec_prefix, md_startfile_prefix, md_startfile_prefix_1):
+       Always define, but make null if no value.
+       (static_specs): Add "md_exec_prefix", "md_startfile_prefix",
+       and "md_startfile_prefix_1".
+       (main): Check whether md_exec_prefix and the others are the
+       null string rather than whether the macro is defined.
+
 Thu Oct  5 19:04:18 2000  J"orn Rennecke <amylaar@redhat.co.uk>
 
        * (convert_move): Use zero_extendpsisi2 to do an unsigned extension
index 7fe091e0cba58677e8a6378e0b64a0ea8cfc4bfb..f24077bb462ebb2041a23ee9dcc4a22ee18cb00b 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1065,6 +1065,104 @@ skip_whitespace (p)
 
   return p;
 }
+/* Structures to keep track of prefixes to try when looking for files.  */
+
+struct prefix_list
+{
+  char *prefix;               /* String to prepend to the path.  */
+  struct prefix_list *next;   /* Next in linked list.  */
+  int require_machine_suffix; /* Don't use without machine_suffix.  */
+  /* 2 means try both machine_suffix and just_machine_suffix.  */
+  int *used_flag_ptr;        /* 1 if a file was found with this prefix.  */
+  int priority;                      /* Sort key - priority within list */
+};
+
+struct path_prefix
+{
+  struct prefix_list *plist;  /* List of prefixes to try */
+  int max_len;                /* Max length of a prefix in PLIST */
+  const char *name;           /* Name of this list (used in config stuff) */
+};
+
+/* List of prefixes to try when looking for executables.  */
+
+static struct path_prefix exec_prefixes = { 0, 0, "exec" };
+
+/* List of prefixes to try when looking for startup (crt0) files.  */
+
+static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
+
+/* List of prefixes to try when looking for include files.  */
+
+static struct path_prefix include_prefixes = { 0, 0, "include" };
+
+/* Suffix to attach to directories searched for commands.
+   This looks like `MACHINE/VERSION/'.  */
+
+static const char *machine_suffix = 0;
+
+/* Suffix to attach to directories searched for commands.
+   This is just `MACHINE/'.  */
+
+static const char *just_machine_suffix = 0;
+
+/* Adjusted value of GCC_EXEC_PREFIX envvar.  */
+
+static const char *gcc_exec_prefix;
+
+/* Default prefixes to attach to command names.  */
+
+#ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */
+#undef MD_EXEC_PREFIX
+#undef MD_STARTFILE_PREFIX
+#undef MD_STARTFILE_PREFIX_1
+#endif
+
+/* If no prefixes defined, use the null string, which will disable them.  */
+#ifndef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX ""
+#endif
+#ifndef MD_STARTFILE_PREFIX
+#define MD_STARTFILE_PREFIX ""
+#endif
+#ifndef MD_STARTFILE_PREFIX_1
+#define MD_STARTFILE_PREFIX_1 ""
+#endif
+
+/* Supply defaults for the standard prefixes.  */
+
+#ifndef STANDARD_EXEC_PREFIX
+#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX
+#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
+#endif
+#ifndef TOOLDIR_BASE_PREFIX
+#define TOOLDIR_BASE_PREFIX "/usr/local/"
+#endif
+#ifndef STANDARD_BINDIR_PREFIX
+#define STANDARD_BINDIR_PREFIX "/usr/local/bin"
+#endif
+
+static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
+static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
+static const char *md_exec_prefix = MD_EXEC_PREFIX;
+
+static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
+static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+static const char *standard_startfile_prefix_1 = "/lib/";
+static const char *standard_startfile_prefix_2 = "/usr/lib/";
+
+static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
+static const char *tooldir_prefix;
+
+static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+
+/* Subdirectory to use for locating libraries.  Set by
+   set_multilib_dir based on the compilation options.  */
+
+static const char *multilib_dir;
 \f
 /* Structure to keep track of the specs that have been defined so far.
    These are accessed using %(specname) or %[specname] in a compiler
@@ -1118,6 +1216,9 @@ static struct spec_list static_specs[] =
   INIT_STATIC_SPEC ("multilib_exclusions",     &multilib_exclusions),
   INIT_STATIC_SPEC ("linker",                  &linker_name_spec),
   INIT_STATIC_SPEC ("link_libgcc",             &link_libgcc_spec),
+  INIT_STATIC_SPEC ("md_exec_prefix",          &md_exec_prefix),
+  INIT_STATIC_SPEC ("md_startfile_prefix",     &md_startfile_prefix),
+  INIT_STATIC_SPEC ("md_startfile_prefix_1",   &md_startfile_prefix_1),
 };
 
 #ifdef EXTRA_SPECS             /* additional specs needed */
@@ -1279,99 +1380,6 @@ static int signal_count;
 
 static const char *programname;
 \f
-/* Structures to keep track of prefixes to try when looking for files.  */
-
-struct prefix_list
-{
-  char *prefix;               /* String to prepend to the path.  */
-  struct prefix_list *next;   /* Next in linked list.  */
-  int require_machine_suffix; /* Don't use without machine_suffix.  */
-  /* 2 means try both machine_suffix and just_machine_suffix.  */
-  int *used_flag_ptr;        /* 1 if a file was found with this prefix.  */
-  int priority;                      /* Sort key - priority within list */
-};
-
-struct path_prefix
-{
-  struct prefix_list *plist;  /* List of prefixes to try */
-  int max_len;                /* Max length of a prefix in PLIST */
-  const char *name;           /* Name of this list (used in config stuff) */
-};
-
-/* List of prefixes to try when looking for executables.  */
-
-static struct path_prefix exec_prefixes = { 0, 0, "exec" };
-
-/* List of prefixes to try when looking for startup (crt0) files.  */
-
-static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
-
-/* List of prefixes to try when looking for include files.  */
-
-static struct path_prefix include_prefixes = { 0, 0, "include" };
-
-/* Suffix to attach to directories searched for commands.
-   This looks like `MACHINE/VERSION/'.  */
-
-static const char *machine_suffix = 0;
-
-/* Suffix to attach to directories searched for commands.
-   This is just `MACHINE/'.  */
-
-static const char *just_machine_suffix = 0;
-
-/* Adjusted value of GCC_EXEC_PREFIX envvar.  */
-
-static const char *gcc_exec_prefix;
-
-/* Default prefixes to attach to command names.  */
-
-#ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-#undef MD_STARTFILE_PREFIX_1
-#endif
-
-#ifndef STANDARD_EXEC_PREFIX
-#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
-#endif /* !defined STANDARD_EXEC_PREFIX */
-
-static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
-static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
-#ifdef MD_EXEC_PREFIX
-static const char *md_exec_prefix = MD_EXEC_PREFIX;
-#endif
-
-#ifndef STANDARD_STARTFILE_PREFIX
-#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
-#endif /* !defined STANDARD_STARTFILE_PREFIX */
-
-#ifdef MD_STARTFILE_PREFIX
-static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
-#endif
-#ifdef MD_STARTFILE_PREFIX_1
-static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
-#endif
-static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
-static const char *standard_startfile_prefix_1 = "/lib/";
-static const char *standard_startfile_prefix_2 = "/usr/lib/";
-
-#ifndef TOOLDIR_BASE_PREFIX
-#define TOOLDIR_BASE_PREFIX "/usr/local/"
-#endif
-static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
-static const char *tooldir_prefix;
-
-#ifndef STANDARD_BINDIR_PREFIX
-#define STANDARD_BINDIR_PREFIX "/usr/local/bin"
-#endif
-static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
-
-/* Subdirectory to use for locating libraries.  Set by
-   set_multilib_dir based on the compilation options.  */
-
-static const char *multilib_dir;
-
 /* Clear out the vector of arguments (after a command is executed).  */
 
 static void
@@ -5339,22 +5347,21 @@ main (argc, argv)
   /* If not cross-compiling, look for startfiles in the standard places.  */
   if (*cross_compile == '0')
     {
-#ifdef MD_EXEC_PREFIX
-      add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
-      add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
-#endif
+      if (*md_exec_prefix)
+       {
+         add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
+                     PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+         add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
+                     PREFIX_PRIORITY_LAST, 0, NULL_PTR);
+       }
 
-#ifdef MD_STARTFILE_PREFIX
-      add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
-#endif
+      if (*md_startfile_prefix)
+       add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
+                   PREFIX_PRIORITY_LAST, 0, NULL_PTR);
 
-#ifdef MD_STARTFILE_PREFIX_1
-      add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
-                 PREFIX_PRIORITY_LAST, 0, NULL_PTR);
-#endif
+      if (*md_startfile_prefix_1)
+       add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
+                   PREFIX_PRIORITY_LAST, 0, NULL_PTR);
 
       /* If standard_startfile_prefix is relative, base it on
         standard_exec_prefix.  This lets us move the installed tree