From ed88587a2f2499426a6fe7cfba956aaf1d83cd2a Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Sun, 12 Aug 2007 05:54:09 +0000 Subject: [PATCH] Fixed a compiler crash on Linux when the include directory didn't exist --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401318 --- sourcepawn/compiler/Makefile | 2 +- sourcepawn/compiler/sc1.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sourcepawn/compiler/Makefile b/sourcepawn/compiler/Makefile index b3053e5a..b7007401 100644 --- a/sourcepawn/compiler/Makefile +++ b/sourcepawn/compiler/Makefile @@ -36,7 +36,7 @@ else CPPFLAGS += $(OPT_CPP_FLAGS) endif -CFLAGS += -DLINUX -DNDEBUG -DHAVE_STDINT_H -DAMX_ANSIONLY +CFLAGS += -DLINUX -DNDEBUG -DHAVE_STDINT_H -DAMX_ANSIONLY -DENABLE_BINRELOC CPPFLAGS += -Wno-deprecated -fno-exceptions -fno-rtti OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index d31dd37f..5d52569b 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -1129,6 +1129,12 @@ static void setconfig(char *root) /* add the default "include" directory */ #if defined __WIN32__ || defined _WIN32 GetModuleFileNameA(NULL,path,_MAX_PATH); + #elif defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ + /* see www.autopackage.org for the BinReloc module */ + br_init_lib(NULL); + ptr=br_find_exe("spcomp"); + strlcpy(path,ptr,sizeof path); + free(ptr); #else if (root!=NULL) strlcpy(path,root,sizeof path); /* path + filename (hopefully) */