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



60
61
62
63
64
# File 'ext/dbm/extconf.rb', line 60

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



107
108
109
110
111
112
# File 'ext/dbm/extconf.rb', line 107

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



82
83
84
85
86
# File 'ext/dbm/extconf.rb', line 82

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



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

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



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

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



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

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