--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hello,
I'm trying to bring OpenSSL < 0.9.6 to OSSL2 module and while doing this
I needed to test whether some constats and functions are defined in
some.h.
I didn't find the way to do this in current mkmf.rb, so I defined
function have_defined() to solve this.
The second thing I was facing was testing whether some struct has
member. The current function have_struct_member() defined
-DHAVE_ST_MEMBER, but for 2 struct and same member you cannot
distinguish which one is defined and which isn't. So I changed it to
-DHAVE_ST_STRUCT_MEMBER.
Please concider whether is it OK to merge this.
Michal
--
- - - - - - - - - - - - - - - - - - Michal Rokos Czech Technical University, Prague
e-mail: m.rokos / sh.cvut.cz icq: 36118339 jabber: majkl / jabber.cz
- - - - - - - - - - - - - - - - - -
--EVF5PPMfhYS0aIcm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="MKMF.diff"
Index: lib/mkmf.rb
RCS file: /src/ruby/lib/mkmf.rb,v
retrieving revision 1.137
diff -u -p -r1.137 mkmf.rb
--- lib/mkmf.rb 18 Jul 2003 09:44:28 -0000 1.137
+++ lib/mkmf.rb 21 Jul 2003 06:25:34 -0000
@@ -434,7 +434,26 @@ def have_struct_member(type, member, hea
int main() { return 0; }
int s char *)&((#{type}*)0)->#{member} - (char *)0;
SRC
- $defs.push(format("-DHAVE_ST_%s", member.upcase))
+ $defs.push(format("-DHAVE_ST_%s", member.upcase)) # compatibility - deprecated
+ $defs.push(format("-DHAVE_ST_%s_%s", type.upcase, member.upcase))
+ true
+ else
+ false
+ end
+ end
+end
+
+def have_defined(macro, header l)
+ checking_for "#{macro}" do
+ if try_compile(<<"SRC")
+#{COMMON_HEADERS}
+#{cpp_include(header)}
+#if !defined(#{macro})
+# error #{macro} not defined
+#endif
+int main() { return 0; }
+SRC
+ $defs.push(format("-DHAVE_%s", macro.upcase))
true
else
false
--EVF5PPMfhYS0aIcm--