diff --git a/sourcepawn/compiler/Makefile b/sourcepawn/compiler/Makefile index b3053e5a3..b70074014 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 d31dd37f5..5d52569be 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) */