summaryrefslogtreecommitdiff
path: root/ruby.c
diff options
context:
space:
mode:
authoreban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-28 16:07:34 +0000
committereban <eban@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-05-28 16:07:34 +0000
commit032825472be96143de44bc0ee9795735d03dfbf4 (patch)
tree8ca6c1e3f6d094a06934c12532267cc0ec66edd8 /ruby.c
parente83171c4c4f71093a64abc2c4bb9bdb6a1445e02 (diff)
* configure.in: remove unnecessary AC_CANONICAL_BUILD
* defins.h: #define HAVE_SETITIMER on Cygwin(bug fixed). * ruby.c: use relative path from LIBRUBY_SO. * ruby.c: don't use -mwin32 option on Cygwin. * cygwin/GNUmakefile.in: ditto. * ext/sdbm/_sdbm: ditto. * ext/tcltklib/extconf.rb: ditto. * ext/tcltklib/stubs.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r--ruby.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/ruby.c b/ruby.c
index 5fa1954cad..2c3102ed59 100644
--- a/ruby.c
+++ b/ruby.c
@@ -12,7 +12,7 @@
**********************************************************************/
-#ifdef _WIN32
+#if defined _WIN32 || defined __CYGWIN__
#include <windows.h>
#endif
#include "ruby.h"
@@ -106,7 +106,7 @@ extern VALUE rb_load_path;
#define STATIC_FILE_LENGTH 255
-#if defined(_WIN32) || defined(DJGPP)
+#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__
static char *
rubylib_mangle(s, l)
char *s;
@@ -173,7 +173,7 @@ ruby_incpush(path)
const char sep = PATH_SEP_CHAR;
if (path == 0) return;
-#if defined(__CYGWIN32__)
+#if defined(__CYGWIN__)
{
char rubylib[FILENAME_MAX];
conv_to_posix_path(path, rubylib, FILENAME_MAX);
@@ -203,15 +203,24 @@ ruby_incpush(path)
}
}
+#if defined _WIN32 || defined __CYGWIN__ || defined __DJGPP__ || defined __EMX__
+#define LOAD_RELATIVE 1
+#endif
+
void
ruby_init_loadpath()
{
-#if defined(_WIN32) || defined(DJGPP) || defined(__EMX__)
+#if defined LOAD_RELATIVE
char libpath[FILENAME_MAX+1];
char *p;
int rest;
-#if defined(_WIN32)
- GetModuleFileName(NULL, libpath, sizeof libpath);
+#if defined _WIN32 || defined __CYGWIN__
+# if defined LIBRUBY_SO
+ HMODULE libruby = GetModuleHandle(LIBRUBY_SO);
+# else
+ HMODULE libruby = NULL;
+# endif
+ GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(DJGPP)
extern char *__dos_argv0;
strncpy(libpath, __dos_argv0, FILENAME_MAX);