Alexandre Julliard : tools: Take into account the executable extension when looking for tools in the path .
Alexandre Julliard
julliard at winehq.org
Thu Aug 27 10:31:37 CDT 2009
Module: wine
Branch: master
Commit: 1aea4efd7999a19265c44c8be85cee7064bec97b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1aea4efd7999a19265c44c8be85cee7064bec97b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Aug 27 13:35:46 2009 +0200
tools: Take into account the executable extension when looking for tools in the path.
---
configure | 5 +++++
configure.ac | 1 +
include/config.h.in | 3 +++
tools/winebuild/utils.c | 5 +++--
tools/winegcc/utils.c | 8 +++++---
5 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 1c42c9e..bcf67cf 100755
--- a/configure
+++ b/configure
@@ -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"
diff --git a/configure.ac b/configure.ac
index 39eea85..c880ad3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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*)
diff --git a/include/config.h.in b/include/config.h.in
index 5eb84c3..6956963 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -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
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index d11bd32..e0cd8bc 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -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;
}
diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index 611ec42..66c7e41 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -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;
More information about the wine-cvs
mailing list