mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-29 17:35:25 +08:00
Make GCC_EXEC_PREFIX work again
From-SVN: r18856
This commit is contained in:
parent
7fe6899fb7
commit
6ed4bb9a67
@ -1,3 +1,16 @@
|
||||
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>
|
||||
|
||||
* sh.c (find_barrier): Fix calculations for alignment increase.
|
||||
|
15
gcc/gcc.c
15
gcc/gcc.c
@ -51,6 +51,7 @@ extern int pexecute PROTO ((const char *, char * const *, const char *,
|
||||
const char *, char **, char **, int));
|
||||
extern int pwait PROTO ((int, int *, int));
|
||||
extern char *update_path PROTO((char *, char *));
|
||||
extern void set_std_prefix PROTO((char *, int));
|
||||
/* Flag arguments to pexecute. */
|
||||
#define PEXECUTE_FIRST 1
|
||||
#define PEXECUTE_LAST 2
|
||||
@ -2378,6 +2379,20 @@ process_command (argc, argv)
|
||||
|
||||
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 (&startfile_prefixes, gcc_exec_prefix, "GCC", 0, 0, NULL_PTR);
|
||||
}
|
||||
|
27
gcc/prefix.c
27
gcc/prefix.c
@ -1,5 +1,5 @@
|
||||
/* 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.
|
||||
|
||||
@ -76,6 +76,8 @@ Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "gansidecl.h"
|
||||
|
||||
static char *std_prefix = PREFIX;
|
||||
|
||||
static char *get_key_value PROTO((char *));
|
||||
static char *translate_name PROTO((char *));
|
||||
static char *concat PVPROTO((char *, ...));
|
||||
@ -93,16 +95,20 @@ get_key_value (key)
|
||||
char *key;
|
||||
{
|
||||
char *prefix = 0;
|
||||
char *temp = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
prefix = lookup_key (key);
|
||||
#endif
|
||||
|
||||
if (prefix == 0)
|
||||
prefix = getenv (concat (key, "_ROOT", NULL_PTR));
|
||||
prefix = getenv (temp = concat (key, "_ROOT", NULL_PTR));
|
||||
|
||||
if (prefix == 0)
|
||||
prefix = PREFIX;
|
||||
prefix = std_prefix;
|
||||
|
||||
if (temp)
|
||||
free (temp);
|
||||
|
||||
return prefix;
|
||||
}
|
||||
@ -259,7 +265,7 @@ translate_name (name)
|
||||
{
|
||||
prefix = get_key_value (key);
|
||||
if (prefix == 0)
|
||||
prefix = PREFIX;
|
||||
prefix = std_prefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -289,12 +295,12 @@ update_path (path, key)
|
||||
char *path;
|
||||
char *key;
|
||||
{
|
||||
if (! strncmp (path, PREFIX, strlen (PREFIX)) && key != 0)
|
||||
if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
|
||||
{
|
||||
if (key[0] != '$')
|
||||
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] == '$')
|
||||
path = translate_name (path);
|
||||
@ -315,3 +321,12 @@ update_path (path, key)
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/* Reset the standard prefix */
|
||||
void
|
||||
set_std_prefix (prefix, len)
|
||||
char *prefix;
|
||||
int len;
|
||||
{
|
||||
std_prefix = save_string (prefix, len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user