On Fri, 2 Nov 2007, Austin Ziegler wrote:

> On 11/2/07, NAKAMURA, Hiroshi <nakahiro / sarion.co.jp> wrote:
> > Austin Ziegler wrote:
> > > It's not saying that a Ruby distribution contains the zlib source, but
> > > that a proper Ruby distribution can expect that the Ruby zlib
> > > extension will be present (e.g., require "zlib" will work).

That was the intent of what I wrote.

> > I can understand it but libz (not ruby-zlib) is an independent product
> > and it may have a different license from Ruby's.  'A proper Ruby
> > distribution can expect that the Ruby zlib extention will be prezent' is
> > too far I think.  Don't you think ext/zlib compilation should fail if
> > there's no zlib.h in the system?

Interesting.  Rubygems pretty much depends on this at the moment, and
whilst I broadly agree with:
> 
> Yes, I think it should fail. The chances of zlib not being present in
> 2007, however, is vanishingly small. There's a lot of software that
> depends on zlib, not just Ruby.

I'm reluctant to force "one more wafer thin mint" before one can have
working http.  What if one wants to use a minimal ruby to get zlib?

So, the fastest test to see if we have zlib already, rather than 
rescue-ing a require 'zlib' (which seems rather expensive for this
compression feature, isn't it?) I can think of is:
rb(main):004:0> puts "zlib" if $".any?{|x| x =~ /^zlib/i}
zlib
=> nil
irb(main):005:0>

Is there a better/cheaper/quicker way to do this?  I looked in
Config::CONFIG but nothing gets set there, so it seems I can't do a
direct lookup to see if I have zlib; I'll have to search this array,
or something else.  I may only need to search it once if I set my
own constant in HTTP, but OTOH, if there's one I can look at
already, or something with O(1) lookup time, I'd rather add that to
http.rb than define another constant (which, being about zlib,
doesn't *really* belong in http.rb anyway).

        Hugh