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

This commit is contained in:
Alexandre Julliard 2009-08-27 13:35:46 +02:00
parent f5896a2be0
commit 1aea4efd79
5 changed files with 17 additions and 5 deletions

5
configure vendored
View File

@ -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"

View File

@ -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*)

View File

@ -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

View File

@ -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;
}

View 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;