Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

supported Ruby 1.6.

  • Loading branch information...
commit bb1569a48c3785c19183d6f75317ab4ef8a899ec 1 parent 97fe9f0
shugo authored
Showing with 53 additions and 12 deletions.
  1. +10 −4 autoconf.rb
  2. +22 −6 configure.rb
  3. +12 −2 configure.rb.in
  4. +9 −0 request.c
View
14 autoconf.rb
@@ -322,7 +322,11 @@ def AC_PROG_INSTALL
$RANLIB = CONFIG["RANLIB"]
$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
$RUBY = ($nmake && !$configure_args.has_key?('--ruby')) ? $ruby.gsub(%r'/', '\\') : $ruby
-$RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
+if RUBY_VERSION < "1.8.0"
+ $RM = 'rm -f'
+else
+ $RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
+end
if not defined? CFLAGS
CFLAGS = CONFIG["CFLAGS"]
@@ -382,9 +386,11 @@ def AC_PROG_INSTALL
end
$COMPILE_RULES = ''
-COMPILE_RULES.each do |rule|
- $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
- $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
+if defined?(COMPILE_RULES)
+ COMPILE_RULES.each do |rule|
+ $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
+ $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
+ end
end
AC_SUBST("srcdir")
View
28 configure.rb
@@ -300,7 +300,11 @@ def AC_PROG_INSTALL
$RANLIB = CONFIG["RANLIB"]
$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
$RUBY = ($nmake && !$configure_args.has_key?('--ruby')) ? $ruby.gsub(%r'/', '\\') : $ruby
-$RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
+if RUBY_VERSION < "1.8.0"
+ $RM = 'rm -f'
+else
+ $RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
+end
if not defined? CFLAGS
CFLAGS = CONFIG["CFLAGS"]
@@ -360,9 +364,11 @@ def AC_PROG_INSTALL
end
$COMPILE_RULES = ''
-COMPILE_RULES.each do |rule|
- $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
- $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
+if defined?(COMPILE_RULES)
+ COMPILE_RULES.each do |rule|
+ $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
+ $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
+ end
end
AC_SUBST("srcdir")
@@ -579,10 +585,20 @@ def AC_PROG_INSTALL
$MODULE_LIBS = "#{librubyarg} #{$LIBS}"
AC_SUBST("MODULE_LIBS")
-$LINK_SO = LINK_SO.gsub(/\$\(DLLIB\)/, '$(TARGET)').gsub(/\$\(DLDFLAGS\)/, '$(DLDFLAGS) $(XLDFLAGS)')
+if defined?(LINK_SO)
+ $LINK_SO = LINK_SO.gsub(/\$\(DLLIB\)/, '$(TARGET)').gsub(/\$\(DLDFLAGS\)/, '$(DLDFLAGS) $(XLDFLAGS)')
+else
+ $LINK_SO = '$(LDSHARED) $(DLDFLAGS) $(XLDFLAGS) -o $(TARGET) $(OBJS) $(LIBRUBYARG) $(LIBS)'
+end
AC_SUBST("LINK_SO")
-$libpath = libpathflag("$(APACHE_LIBDIR)") unless $APACHE_LIBDIR.empty?
+unless $APACHE_LIBDIR.empty?
+ begin
+ $libpath = libpathflag("$(APACHE_LIBDIR)")
+ rescue NameError
+ $libpath = "-L$(APACHE_LIBDIR)"
+ end
+end
AC_SUBST("libpath")
$DEFFILE = "mod_ruby-#{$arch}.def" if /(ms|bcc)win32|mingw32/ =~ RUBY_PLATFORM
View
14 configure.rb.in
@@ -166,10 +166,20 @@ Config.expand(librubyarg)
$MODULE_LIBS = "#{librubyarg} #{$LIBS}"
AC_SUBST("MODULE_LIBS")
-$LINK_SO = LINK_SO.gsub(/\$\(DLLIB\)/, '$(TARGET)').gsub(/\$\(DLDFLAGS\)/, '$(DLDFLAGS) $(XLDFLAGS)')
+if defined?(LINK_SO)
+ $LINK_SO = LINK_SO.gsub(/\$\(DLLIB\)/, '$(TARGET)').gsub(/\$\(DLDFLAGS\)/, '$(DLDFLAGS) $(XLDFLAGS)')
+else
+ $LINK_SO = '$(LDSHARED) $(DLDFLAGS) $(XLDFLAGS) -o $(TARGET) $(OBJS) $(LIBRUBYARG) $(LIBS)'
+end
AC_SUBST("LINK_SO")
-$libpath = libpathflag("$(APACHE_LIBDIR)") unless $APACHE_LIBDIR.empty?
+unless $APACHE_LIBDIR.empty?
+ begin
+ $libpath = libpathflag("$(APACHE_LIBDIR)")
+ rescue NameError
+ $libpath = "-L$(APACHE_LIBDIR)"
+ end
+end
AC_SUBST("libpath")
$DEFFILE = "mod_ruby-#{$arch}.def" if /(ms|bcc)win32|mingw32/ =~ RUBY_PLATFORM
View
9 request.c
@@ -913,6 +913,14 @@ static VALUE request_get_client_block(VALUE self, VALUE length)
data = get_request_data(self);
len = NUM2INT(length);
+#if RUBY_VERSION_CODE < 180
+ {
+ char *buf = (char *) ap_palloc(data->request->pool, len);
+ len = ap_get_client_block(data->request, buf, len);
+ result = rb_tainted_str_new(buf, len);
+ return result;
+ }
+#else
result = rb_str_buf_new(len);
len = ap_get_client_block(data->request, RSTRING(result)->ptr, len);
switch (len) {
@@ -927,6 +935,7 @@ static VALUE request_get_client_block(VALUE self, VALUE length)
OBJ_TAINT(result);
return result;
}
+#endif
}
static VALUE read_client_block(request_rec *r, int len)
Please sign in to comment.
Something went wrong with that request. Please try again.