aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-06-14 17:34:01 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-06-14 17:34:01 -0400
commit460dcab481fb441d1b9d12a006519dbb75bc25f7 (patch)
treef395d7fbb93aac78a88c62d9762e97c26627960a /gcc
parentd008e26c417d2a4d950185001cfb89edc18c4923 (diff)
downloadgcc-460dcab481fb441d1b9d12a006519dbb75bc25f7.zip
gcc-460dcab481fb441d1b9d12a006519dbb75bc25f7.tar.gz
gcc-460dcab481fb441d1b9d12a006519dbb75bc25f7.tar.bz2
(find_a_file): Try EXECUTABLE_SUFFIX first, then file without the
suffix. From-SVN: r7459
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 519118f..57e9bde 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1626,19 +1626,13 @@ find_a_file (pprefix, name, mode)
{
if (machine_suffix)
{
- strcpy (temp, pl->prefix);
- strcat (temp, machine_suffix);
- strcat (temp, name);
- if (access (temp, mode) == 0)
- {
- if (pl->used_flag_ptr != 0)
- *pl->used_flag_ptr = 1;
- return temp;
- }
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, machine_suffix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
@@ -1647,13 +1641,10 @@ find_a_file (pprefix, name, mode)
return temp;
}
}
- }
- /* Certain prefixes are tried with just the machine type,
- not the version. This is used for finding as, ld, etc. */
- if (just_machine_suffix && pl->require_machine_suffix == 2)
- {
+
+ /* Now try just the name. */
strcpy (temp, pl->prefix);
- strcat (temp, just_machine_suffix);
+ strcat (temp, machine_suffix);
strcat (temp, name);
if (access (temp, mode) == 0)
{
@@ -1661,10 +1652,19 @@ find_a_file (pprefix, name, mode)
*pl->used_flag_ptr = 1;
return temp;
}
+ }
+
+ /* Certain prefixes are tried with just the machine type,
+ not the version. This is used for finding as, ld, etc. */
+ if (just_machine_suffix && pl->require_machine_suffix == 2)
+ {
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, just_machine_suffix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
@@ -1673,12 +1673,9 @@ find_a_file (pprefix, name, mode)
return temp;
}
}
- }
- /* Certain prefixes can't be used without the machine suffix
- when the machine or version is explicitly specified. */
- if (!pl->require_machine_suffix)
- {
+
strcpy (temp, pl->prefix);
+ strcat (temp, just_machine_suffix);
strcat (temp, name);
if (access (temp, mode) == 0)
{
@@ -1686,10 +1683,18 @@ find_a_file (pprefix, name, mode)
*pl->used_flag_ptr = 1;
return temp;
}
+ }
+
+ /* Certain prefixes can't be used without the machine suffix
+ when the machine or version is explicitly specified. */
+ if (!pl->require_machine_suffix)
+ {
/* Some systems have a suffix for executable files.
- So try appending that. */
+ So try appending that first. */
if (file_suffix[0] != 0)
{
+ strcpy (temp, pl->prefix);
+ strcat (temp, name);
strcat (temp, file_suffix);
if (access (temp, mode) == 0)
{
@@ -1698,6 +1703,15 @@ find_a_file (pprefix, name, mode)
return temp;
}
}
+
+ strcpy (temp, pl->prefix);
+ strcat (temp, name);
+ if (access (temp, mode) == 0)
+ {
+ if (pl->used_flag_ptr != 0)
+ *pl->used_flag_ptr = 1;
+ return temp;
+ }
}
}