-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The mkmf-lite gem is a lightweight version of the mkmf library that ships as part of the Ruby standard library. Unlike the mkmf library, this library is meant to be used as a module. It is NOT meant as a build tool, nor is it a replacement for mkmf.
The mkmf-lite module currently includes three methods:
- have_func
- have_header
- have_struct_member
require 'mkmf/lite'
class System
extend Mkmf::Lite
HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
def some_method
if HAVE_PW_NAME
# Do something
end
end
end
You may see a difference between the results of the methods provided here and the ones from Ruby's mkmf library. How is that possible?
The difference is in the header files that are automatically included when a check is made. Ruby's mkmf library will always use "ruby.h"
as an included header file. That header, in turn, includes several other header files whereas this library defaults to common header files, or just <stdio.h>
and <stdlib.h>
by default. This can lead to different results.