class Object
Public Instance Methods
define(s, v=1)
click to toggle source
Check arch flags TODO: detect mismatched arch types when libcurl mac ports is mixed with native mac ruby or vice versa
archs = $CFLAGS.scan(/-archs(.*?)s/).first # get the first arch flag if archs and archs.size >= 1
# need to reduce the number of archs... # guess the first one is correct... at least the first one is probably the ruby installed arch... # this could lead to compiled binaries that crash at runtime... $CFLAGS.gsub!(/-arch\s(.*?)\s/,' ') $CFLAGS << " -arch #{archs.first}" puts "Selected arch: #{archs.first}"
end
# File ext/extconf.rb, line 38 def define(s, v=1) $defs.push( format("-D HAVE_%s=%d", s.to_s.upcase, v) ) end
have_constant(name)
click to toggle source
# File ext/extconf.rb, line 42 def have_constant(name) sname = name.is_a?(Symbol) ? name.to_s : name.upcase checking_for name do src = %Q{ #include <curl/curl.h> int main() { int test = (int)#{sname}; return 0; } } if try_compile(src,"#{$CFLAGS} #{$LIBS}") define name true else #define name, 0 false end end end
test_for(name, const, src)
click to toggle source
do some checking to detect ruby 1.8 hash.c vs ruby 1.9 hash.c
# File ext/extconf.rb, line 368 def test_for(name, const, src) checking_for name do if try_compile(src,"#{$CFLAGS} #{$LIBS}") define const true else false end end end