summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 07:21:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-07 07:21:00 +0000
commit76566bfd583af8570b464796459494443989ab47 (patch)
tree455b3a5f76ef19b45e01594e4aecdefecd80c41a
parent48649e46253035a6ed1ce4ba18dd2b151f7cc4d8 (diff)
ruby-runner.c: enable MJIT_SEARCH_BUILD_DIR only if no relative loading
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--common.mk2
-rw-r--r--ruby-runner.c7
2 files changed, 7 insertions, 2 deletions
diff --git a/common.mk b/common.mk
index 8e72362..28979bc 100644
--- a/common.mk
+++ b/common.mk
@@ -834,7 +834,7 @@ $(PLATFORM_D):
$(Q) $(MAKEDIRS) $(PLATFORM_DIR) $(@D)
@exit > $@
-exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT)
+exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH)}config.h
$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c
$(Q) $(PURIFY) $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OUTFLAG)$@ ruby-runner.$(OBJEXT) $(LIBS)
$(Q) $(POSTLINK)
diff --git a/ruby-runner.c b/ruby-runner.c
index 499534e..0ad2561 100644
--- a/ruby-runner.c
+++ b/ruby-runner.c
@@ -7,6 +7,7 @@
#include <sys/stat.h>
#include "ruby-runner.h"
+#include "ruby/config.h"
#define STRINGIZE(expr) STRINGIZE0(expr)
#define STRINGIZE0(expr) #expr
@@ -59,19 +60,23 @@ main(int argc, char **argv)
PATH_SEPARATOR
EXTOUT_DIR"/"ARCH
;
+#ifndef LOAD_RELATIVE
static const char mjit_build_dir[] = BUILDDIR"/mjit_build_dir."SOEXT;
+ struct stat stbuf;
+#endif
const size_t dirsize = sizeof(builddir);
const size_t namesize = sizeof(rubypath) - dirsize;
const char *rubyname = rubypath + dirsize;
char *arg0 = argv[0], *p;
- struct stat stbuf;
insert_env_path(LIBPATHENV, builddir, dirsize, 1);
insert_env_path("RUBYLIB", rubylib, sizeof(rubylib), 0);
+#ifndef LOAD_RELATIVE
if (PRELOADENV[0] && stat(mjit_build_dir, &stbuf) == 0) {
insert_env_path(PRELOADENV, mjit_build_dir, sizeof(mjit_build_dir), 1);
setenv("MJIT_SEARCH_BUILD_DIR", "true", 0);
}
+#endif
if (!(p = strrchr(arg0, '/'))) p = arg0; else p++;
if (strlen(p) < namesize - 1) {