Commit 5417826c authored by Alexandre Julliard's avatar Alexandre Julliard

wrc: Also search the include dir relative to the binary path.

Suggested by Kevin Puetz. Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f78975ba
...@@ -15,7 +15,9 @@ C_SRCS = \ ...@@ -15,7 +15,9 @@ C_SRCS = \
LEX_SRCS = parser.l LEX_SRCS = parser.l
BISON_SRCS = parser.y BISON_SRCS = parser.y
wrc_EXTRADEFS = -DINCLUDEDIR="\"${includedir}\"" wrc_EXTRADEFS = \
-DINCLUDEDIR="\"${includedir}\"" \
-DBIN_TO_INCLUDEDIR=\"`$(MAKEDEP) -R ${bindir} ${includedir}`\"
EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp EXTRALIBS = $(GETTEXTPO_LIBS) -lwpp
......
...@@ -154,6 +154,8 @@ static char *output_name; /* The name given by the -o option */ ...@@ -154,6 +154,8 @@ static char *output_name; /* The name given by the -o option */
char *input_name = NULL; /* The name given on the command-line */ char *input_name = NULL; /* The name given on the command-line */
static char *temp_name = NULL; /* Temporary file for preprocess pipe */ static char *temp_name = NULL; /* Temporary file for preprocess pipe */
static const char *includedir;
int line_number = 1; /* The current line */ int line_number = 1; /* The current line */
int char_number = 1; /* The current char pos within the line */ int char_number = 1; /* The current char pos within the line */
...@@ -327,6 +329,27 @@ static void set_target( const char *target ) ...@@ -327,6 +329,27 @@ static void set_target( const char *target )
free( cpu ); free( cpu );
} }
static void init_argv0_dir( const char *argv0 )
{
#ifndef _WIN32
char *p, *dir;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir = realpath( "/proc/self/exe", NULL );
#elif defined (__FreeBSD__) || defined(__DragonFly__)
dir = realpath( "/proc/curproc/file", NULL );
#else
dir = realpath( argv0, NULL );
#endif
if (!dir) return;
if (!(p = strrchr( dir, '/' ))) return;
if (p == dir) p++;
*p = 0;
includedir = strmake( "%s/%s", dir, BIN_TO_INCLUDEDIR );
free( dir );
#endif
}
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
int optc; int optc;
...@@ -347,6 +370,7 @@ int main(int argc,char *argv[]) ...@@ -347,6 +370,7 @@ int main(int argc,char *argv[])
#ifdef SIGHUP #ifdef SIGHUP
signal( SIGHUP, exit_on_signal ); signal( SIGHUP, exit_on_signal );
#endif #endif
init_argv0_dir( argv[0] );
/* Set the default defined stuff */ /* Set the default defined stuff */
set_version_defines(); set_version_defines();
...@@ -508,6 +532,11 @@ int main(int argc,char *argv[]) ...@@ -508,6 +532,11 @@ int main(int argc,char *argv[])
{ {
static const char *incl_dirs[] = { INCLUDEDIR, "/usr/include", "/usr/local/include" }; static const char *incl_dirs[] = { INCLUDEDIR, "/usr/include", "/usr/local/include" };
if (includedir)
{
wpp_add_include_path( strmake( "%s/wine/msvcrt", includedir ));
wpp_add_include_path( strmake( "%s/wine/windows", includedir ));
}
for (i = 0; i < ARRAY_SIZE(incl_dirs); i++) for (i = 0; i < ARRAY_SIZE(incl_dirs); i++)
{ {
if (i && !strcmp( incl_dirs[i], incl_dirs[0] )) continue; if (i && !strcmp( incl_dirs[i], incl_dirs[0] )) continue;
......
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