Commit 1aea4efd authored by Alexandre Julliard's avatar Alexandre Julliard

tools: Take into account the executable extension when looking for tools in the path.

parent f5896a2b
......@@ -3960,6 +3960,11 @@ else
fi
cat >>confdefs.h <<_ACEOF
#define EXEEXT "$ac_exeext"
_ACEOF
case $host in
*-darwin*)
if test "x$enable_win64" = "xyes"
......
......@@ -105,6 +105,7 @@ AC_PROG_CC
AC_PROG_CXX
dnl We can't use AC_PROG_CPP for winegcc, it uses by default $(CC) -E
AC_CHECK_TOOL(CPPBIN,cpp,cpp)
AC_DEFINE_UNQUOTED(EXEEXT,["$ac_exeext"],[Define to the file extension for executables.])
case $host in
*-darwin*)
......
......@@ -2,6 +2,9 @@
#define __WINE_CONFIG_H
/* Define to the file extension for executables. */
#undef EXEEXT
/* Define to 1 if you have the <alias.h> header file. */
#undef HAVE_ALIAS_H
......
......@@ -198,7 +198,7 @@ int output( const char *format, ... )
}
/* find a build tool in the path, trying the various names */
char *find_tool( const char * const *names )
static char *find_tool( const char * const *names )
{
static char **dirs;
static unsigned int count, maxlen;
......@@ -231,7 +231,7 @@ char *find_tool( const char * const *names )
while (*names)
{
len = strlen(*names) + 1;
len = strlen(*names) + sizeof(EXEEXT) + 1;
file = xmalloc( maxlen + len );
for (i = 0; i < count; i++)
......@@ -241,6 +241,7 @@ char *find_tool( const char * const *names )
if (p == file) *p++ = '.';
if (p[-1] != '/') *p++ = '/';
strcpy( p, *names );
strcat( p, EXEEXT );
if (!stat( file, &st ) && S_ISREG(st.st_mode) && (st.st_mode & 0111)) return file;
}
......
......@@ -308,14 +308,16 @@ void spawn(const strarray* prefix, const strarray* args, int ignore_errors)
if (prefix)
{
const char *p = strrchr(argv[0], '/');
if (!p) p = argv[0];
else p++;
for (i = 0; i < prefix->size; i++)
{
const char* p;
struct stat st;
if (!(p = strrchr(argv[0], '/'))) p = argv[0];
free( prog );
prog = strmake("%s/%s", prefix->base[i], p);
prog = strmake("%s/%s%s", prefix->base[i], p, EXEEXT);
if (stat(prog, &st) == 0 && S_ISREG(st.st_mode) && (st.st_mode & 0111))
{
argv[0] = prog;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment