Top Level Namespace

Defined Under Namespace

Modules: Curl

Instance Method Summary collapse

Instance Method Details

#define(s) ⇒ Object

Check arch flags TODO: detect mismatched arch types when libcurl mac ports is mixed with native mac ruby or vice versa archs = $CFLAGS.scan(/-arch\s(.*?)\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 #archsarchs.first" puts "Selected arch: #archsarchs.first" end



39
40
41
# File 'ext/extconf.rb', line 39

def define(s)
  $defs.push( format("-D HAVE_%s", s.to_s.upcase) )
end

#have_constant(name) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'ext/extconf.rb', line 43

def have_constant(name)
  checking_for name do
    src = %{
      #include <curl/curl.h>
      int main() {
        int test = (int)#{name.upcase};
        return 0;
      }
    }
    if try_compile(src,"#{$CFLAGS} #{$LIBS}")
      define name
      true
    else
      false
    end
  end
end

#test_for(name, const, src) ⇒ Object

do some checking to detect ruby 1.8 hash.c vs ruby 1.9 hash.c



139
140
141
142
143
144
145
146
147
148
# File 'ext/extconf.rb', line 139

def test_for(name, const, src)
  checking_for name do
    if try_compile(src,"#{$CFLAGS} #{$LIBS}")
      define const
      true
    else
      false
    end
  end
end