From: mmitchel Date: Thu, 22 Feb 2007 23:49:15 +0000 (+0000) Subject: * gcc.c (getenv_spec_function): New function. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0305c755745c1d24fb688d9b5bb540c4232417b7;p=thirdparty%2Fgcc.git * gcc.c (getenv_spec_function): New function. (static_spec_functions): Add it. * config/vxworks.h (VXWORKS_TARGET_DIR): Remove. (VXWORKS_ADDITIONAL_CPP_SPEC): Use getenv to find the VxWorks header files. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122240 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c8ccb90f291..f16b00580b87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2007-02-22 Mark Mitchell + + * gcc.c (getenv_spec_function): New function. + (static_spec_functions): Add it. + * config/vxworks.h (VXWORKS_TARGET_DIR): Remove. + (VXWORKS_ADDITIONAL_CPP_SPEC): Use getenv to find the VxWorks + header files. + 2007-02-22 Michael Matz , etc.) come before + the VxWorks system header directories. */ /* Since we provide a default -isystem, expand -isystem on the command line early. */ @@ -35,9 +38,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #define VXWORKS_ADDITIONAL_CPP_SPEC " \ %{!nostdinc:%{isystem*}} \ %{mrtp: -D__RTP__=1 \ - %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/usr/h}} \ + %{!nostdinc:-idirafter %:getenv(WIND_USR /h)}} \ %{!mrtp:-D_WRS_KERNEL=1 \ - %{!nostdinc:-isystem " VXWORKS_TARGET_DIR "/h}}" + %{!nostdinc:-idirafter %:getenv(WIND_BASE /target/h)}}" /* The references to __init and __fini will be satisfied by libc_internal.a. */ diff --git a/gcc/gcc.c b/gcc/gcc.c index 14e4ceea71f4..d2f479b22577 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -350,6 +350,7 @@ static void init_gcc_specs (struct obstack *, const char *, const char *, static const char *convert_filename (const char *, int, int); #endif +static const char *getenv_spec_function (int, const char **); static const char *if_exists_spec_function (int, const char **); static const char *if_exists_else_spec_function (int, const char **); static const char *replace_outfile_spec_function (int, const char **); @@ -1601,6 +1602,7 @@ static struct spec_list *specs = (struct spec_list *) 0; static const struct spec_function static_spec_functions[] = { + { "getenv", getenv_spec_function }, { "if-exists", if_exists_spec_function }, { "if-exists-else", if_exists_else_spec_function }, { "replace-outfile", replace_outfile_spec_function }, @@ -7645,6 +7647,27 @@ print_multilib_info (void) } } +/* getenv built-in spec function. + + Returns the value of the environment variable given by its first + argument, concatenated with the second argument. If the + environment variable is not defined, a fatal error is issued. */ + +static const char * +getenv_spec_function (int argc, const char **argv) +{ + char *value; + + if (argc != 2) + return NULL; + + value = getenv (argv[0]); + if (!value) + fatal ("environment variable \"%s\" not defined", argv[0]); + + return concat (value, argv[1], NULL); +} + /* if-exists built-in spec function. Checks to see if the file specified by the absolute pathname in