Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
supported Ruby 1.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
shugo committed May 22, 2006
1 parent 97fe9f0 commit bb1569a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 12 deletions.
14 changes: 10 additions & 4 deletions autoconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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")
Expand Down
28 changes: 22 additions & 6 deletions configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions configure.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions request.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit bb1569a

Please sign in to comment.