Top Level Namespace

Defined Under Namespace

Classes: DBM, DBMError

Instance Method Summary collapse

Instance Method Details

#have_declared_libvar(var, headers = nil, opt = "", &b) ⇒ Object



62
63
64
65
66
# File 'ext/dbm/extconf.rb', line 62

def have_declared_libvar(var, headers = nil, opt = "", &b)
  checking_for checking_message([*var].compact.join(' '), headers, opt) do
    try_declared_libvar(var, headers, opt, &b)
  end
end

#have_empty_macro_dbm_clearerr(headers = nil, opt = "", &b) ⇒ Object



109
110
111
112
113
114
# File 'ext/dbm/extconf.rb', line 109

def have_empty_macro_dbm_clearerr(headers = nil, opt = "", &b)
  checking_for checking_message('empty macro of dbm_clearerr(foobarbaz)',
                                headers, opt) do
    try_toplevel('dbm_clearerr(foobarbaz)', headers, opt, &b)
  end
end

#have_undeclared_libvar(var, headers = nil, opt = "", &b) ⇒ Object



84
85
86
87
88
# File 'ext/dbm/extconf.rb', line 84

def have_undeclared_libvar(var, headers = nil, opt = "", &b)
  checking_for checking_message([*var].compact.join(' '), headers, opt) do
    try_undeclared_libvar(var, headers, opt, &b)
  end
end

#try_declared_libvar(var, headers = nil, opt = "", &b) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'ext/dbm/extconf.rb', line 68

def try_declared_libvar(var, headers = nil, opt = "", &b)
  if try_link(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
int main(int argc, char *argv[]) {
  void *conftest_var = &#{var};
  return 0;
}
SRC
    $defs.push(format("-DHAVE_DECLARED_LIBVAR_%s", var.tr_cpp))
    true
  else
    false
  end
end

#try_toplevel(src, headers = nil, opt = "", &b) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
# File 'ext/dbm/extconf.rb', line 116

def try_toplevel(src, headers = nil, opt = "", &b)
  if try_compile(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
#{src}
SRC
    true
  else
    false
  end
end

#try_undeclared_libvar(var, headers = nil, opt = "", &b) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'ext/dbm/extconf.rb', line 90

def try_undeclared_libvar(var, headers = nil, opt = "", &b)
  var, type = *var
  if try_link(<<"SRC", opt, &b)
#{cpp_include(headers)}
/*top*/
int main(int argc, char *argv[]) {
  typedef #{type || 'int'} conftest_type;
  extern conftest_type #{var};
  conftest_type *conftest_var = &#{var};
  return 0;
}
SRC
    $defs.push(format("-DHAVE_UNDECLARED_LIBVAR_%s", var.tr_cpp))
    true
  else
    false
  end
end