Commit 6ed4bb9a by Michael Meissner Committed by Michael Meissner

Make GCC_EXEC_PREFIX work again

From-SVN: r18856
parent 7fe6899f
Fri Mar 27 16:04:49 1998 Michael Meissner <meissner@cygnus.com>
* gcc.c (set_std_prefix): Add declaration.
(process_command): If GCC_EXEC_PREFIX is set, remove /lib/gcc-lib/
suffix, and update the standard prefix prefix.c uses.
* prefix.c (std_prefix): New global to hold default prefix value.
(get_key_value): Change to use std_prefix instead of PREFIX.
(translate_name): Ditto.
(update_path): Ditto.
(get_key_value): Release allocated scratch storage.
(set_std_prefix): New function to reset the standard prefix.
Fri Mar 27 18:08:21 1998 J"orn Rennecke <amylaar@cygnus.co.uk> Fri Mar 27 18:08:21 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* sh.c (find_barrier): Fix calculations for alignment increase. * sh.c (find_barrier): Fix calculations for alignment increase.
......
...@@ -51,6 +51,7 @@ extern int pexecute PROTO ((const char *, char * const *, const char *, ...@@ -51,6 +51,7 @@ extern int pexecute PROTO ((const char *, char * const *, const char *,
const char *, char **, char **, int)); const char *, char **, char **, int));
extern int pwait PROTO ((int, int *, int)); extern int pwait PROTO ((int, int *, int));
extern char *update_path PROTO((char *, char *)); extern char *update_path PROTO((char *, char *));
extern void set_std_prefix PROTO((char *, int));
/* Flag arguments to pexecute. */ /* Flag arguments to pexecute. */
#define PEXECUTE_FIRST 1 #define PEXECUTE_FIRST 1
#define PEXECUTE_LAST 2 #define PEXECUTE_LAST 2
...@@ -2378,6 +2379,20 @@ process_command (argc, argv) ...@@ -2378,6 +2379,20 @@ process_command (argc, argv)
if (gcc_exec_prefix) if (gcc_exec_prefix)
{ {
int len = strlen (gcc_exec_prefix);
if (len > sizeof ("/lib/gcc-lib/")-1
&& (gcc_exec_prefix[len-1] == '/'
|| gcc_exec_prefix[len-1] == DIR_SEPARATOR))
{
temp = gcc_exec_prefix + len - sizeof ("/lib/gcc-lib/") + 1;
if ((*temp == '/' || *temp == DIR_SEPARATOR)
&& strncmp (temp+1, "lib", 3) == 0
&& (temp[4] == '/' || temp[4] == DIR_SEPARATOR)
&& strncmp (temp+5, "gcc-lib", 7) == 0)
len -= sizeof ("/lib/gcc-lib/") - 1;
}
set_std_prefix (gcc_exec_prefix, len);
add_prefix (&exec_prefixes, gcc_exec_prefix, "GCC", 0, 0, NULL_PTR); add_prefix (&exec_prefixes, gcc_exec_prefix, "GCC", 0, 0, NULL_PTR);
add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC", 0, 0, NULL_PTR); add_prefix (&startfile_prefixes, gcc_exec_prefix, "GCC", 0, 0, NULL_PTR);
} }
......
/* Utility to update paths from internal to external forms. /* Utility to update paths from internal to external forms.
Copyright (C) 1997 Free Software Foundation, Inc. Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -76,6 +76,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -76,6 +76,8 @@ Boston, MA 02111-1307, USA. */
#include "gansidecl.h" #include "gansidecl.h"
static char *std_prefix = PREFIX;
static char *get_key_value PROTO((char *)); static char *get_key_value PROTO((char *));
static char *translate_name PROTO((char *)); static char *translate_name PROTO((char *));
static char *concat PVPROTO((char *, ...)); static char *concat PVPROTO((char *, ...));
...@@ -93,16 +95,20 @@ get_key_value (key) ...@@ -93,16 +95,20 @@ get_key_value (key)
char *key; char *key;
{ {
char *prefix = 0; char *prefix = 0;
char *temp = 0;
#ifdef _WIN32 #ifdef _WIN32
prefix = lookup_key (key); prefix = lookup_key (key);
#endif #endif
if (prefix == 0) if (prefix == 0)
prefix = getenv (concat (key, "_ROOT", NULL_PTR)); prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR));
if (prefix == 0) if (prefix == 0)
prefix = PREFIX; prefix = std_prefix;
if (temp)
free (temp);
return prefix; return prefix;
} }
...@@ -259,7 +265,7 @@ translate_name (name) ...@@ -259,7 +265,7 @@ translate_name (name)
{ {
prefix = get_key_value (key); prefix = get_key_value (key);
if (prefix == 0) if (prefix == 0)
prefix = PREFIX; prefix = std_prefix;
} }
else else
{ {
...@@ -289,12 +295,12 @@ update_path (path, key) ...@@ -289,12 +295,12 @@ update_path (path, key)
char *path; char *path;
char *key; char *key;
{ {
if (! strncmp (path, PREFIX, strlen (PREFIX)) && key != 0) if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
{ {
if (key[0] != '$') if (key[0] != '$')
key = concat ("@", key, NULL_PTR); key = concat ("@", key, NULL_PTR);
path = concat (key, &path[strlen (PREFIX)], NULL_PTR); path = concat (key, &path[strlen (std_prefix)], NULL_PTR);
while (path[0] == '@' || path[0] == '$') while (path[0] == '@' || path[0] == '$')
path = translate_name (path); path = translate_name (path);
...@@ -315,3 +321,12 @@ update_path (path, key) ...@@ -315,3 +321,12 @@ update_path (path, key)
return path; return path;
} }
/* Reset the standard prefix */
void
set_std_prefix (prefix, len)
char *prefix;
int len;
{
std_prefix = save_string (prefix, len);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment