Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
dca16329
Commit
dca16329
authored
Feb 04, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Search for the as/ld/nm tools in the PATH under various names.
parent
0e954b14
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
3 deletions
+59
-3
utils.c
tools/winebuild/utils.c
+59
-3
No files found.
tools/winebuild/utils.c
View file @
dca16329
...
@@ -193,6 +193,59 @@ int output( const char *format, ... )
...
@@ -193,6 +193,59 @@ int output( const char *format, ... )
return
ret
;
return
ret
;
}
}
/* find a build tool in the path, trying the various names */
char
*
find_tool
(
const
char
*
const
*
names
)
{
static
char
**
dirs
;
static
unsigned
int
count
,
maxlen
;
char
*
p
,
*
file
;
unsigned
int
i
,
len
;
struct
stat
st
;
if
(
!
dirs
)
{
char
*
path
;
/* split the path in directories */
if
(
!
getenv
(
"PATH"
))
return
NULL
;
path
=
xstrdup
(
getenv
(
"PATH"
));
for
(
p
=
path
,
count
=
2
;
*
p
;
p
++
)
if
(
*
p
==
':'
)
count
++
;
dirs
=
xmalloc
(
count
*
sizeof
(
*
dirs
)
);
count
=
0
;
dirs
[
count
++
]
=
p
=
path
;
while
(
*
p
)
{
while
(
*
p
&&
*
p
!=
':'
)
p
++
;
if
(
!*
p
)
break
;
*
p
++
=
0
;
dirs
[
count
++
]
=
p
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
maxlen
=
max
(
maxlen
,
strlen
(
dirs
[
i
])
+
2
);
}
while
(
*
names
)
{
len
=
strlen
(
*
names
)
+
1
;
file
=
xmalloc
(
maxlen
+
len
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
strcpy
(
file
,
dirs
[
i
]
);
p
=
file
+
strlen
(
file
);
if
(
p
==
file
)
*
p
++
=
'.'
;
if
(
p
[
-
1
]
!=
'/'
)
*
p
++
=
'/'
;
strcpy
(
p
,
*
names
);
if
(
!
stat
(
file
,
&
st
)
&&
S_ISREG
(
st
.
st_mode
)
&&
(
st
.
st_mode
&
0111
))
return
file
;
}
free
(
file
);
names
++
;
}
return
NULL
;
}
const
char
*
get_as_command
(
void
)
const
char
*
get_as_command
(
void
)
{
{
if
(
!
as_command
)
if
(
!
as_command
)
...
@@ -205,7 +258,8 @@ const char *get_as_command(void)
...
@@ -205,7 +258,8 @@ const char *get_as_command(void)
}
}
else
else
{
{
as_command
=
xstrdup
(
"as"
);
static
const
char
*
const
commands
[]
=
{
"gas"
,
"as"
,
NULL
};
if
(
!
(
as_command
=
find_tool
(
commands
)))
as_command
=
xstrdup
(
"as"
);
}
}
if
(
force_pointer_size
)
if
(
force_pointer_size
)
...
@@ -230,7 +284,8 @@ const char *get_ld_command(void)
...
@@ -230,7 +284,8 @@ const char *get_ld_command(void)
}
}
else
else
{
{
ld_command
=
xstrdup
(
"ld"
);
static
const
char
*
const
commands
[]
=
{
"ld"
,
"gld"
,
NULL
};
if
(
!
(
ld_command
=
find_tool
(
commands
)))
ld_command
=
xstrdup
(
"ld"
);
}
}
if
(
force_pointer_size
)
if
(
force_pointer_size
)
...
@@ -255,7 +310,8 @@ const char *get_nm_command(void)
...
@@ -255,7 +310,8 @@ const char *get_nm_command(void)
}
}
else
else
{
{
nm_command
=
xstrdup
(
"nm"
);
static
const
char
*
const
commands
[]
=
{
"nm"
,
"gnm"
,
NULL
};
if
(
!
(
nm_command
=
find_tool
(
commands
)))
nm_command
=
xstrdup
(
"nm"
);
}
}
}
}
return
nm_command
;
return
nm_command
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment