@verbatim
Utility to update paths from internal to external forms. Copyright (C) 1997-2013 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
This file contains routines to update a path, both to canonicalize
the directory format and to handle any prefix translation.
This file must be compiled with -DPREFIX= to specify the "prefix"
value used by configure. If a filename does not begin with this
prefix, it will not be affected other than by directory canonicalization.
Each caller of 'update_path' may specify both a filename and
a translation prefix and consist of the name of the package that contains
the file ("@GCC", "@BINUTIL", "@GNU", etc).
If the prefix is not specified, the filename will only undergo
directory canonicalization.
If it is specified, the string given by PREFIX will be replaced
by the specified prefix (with a '@' in front unless the prefix begins
with a '$') and further translation will be done as follows
until none of the two conditions below are met:
1) If the filename begins with '@', the string between the '@' and
the end of the name or the first '/' or directory separator will
be considered a "key" and looked up as follows:
-- If this is a Win32 OS, then the Registry will be examined for
an entry of "key" in
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>
if found, that value will be used. <KEY> defaults to GCC version
string, but can be overridden at configuration time.
-- If not found (or not a Win32 OS), the environment variable
key_ROOT (the value of "key" concatenated with the constant "_ROOT")
is tried. If that fails, then PREFIX (see above) is used.
2) If the filename begins with a '$', the rest of the string up
to the end or the first '/' or directory separator will be used
as an environment variable, whose value will be returned.
Once all this is done, any '/' will be converted to DIR_SEPARATOR,
if they are different.
NOTE: using resolve_keyed_path under Win32 requires linking with
advapi32.dll.
Referenced by translate_name().