module Mkmf::Lite

Defined in:

mkmf-lite.cr

Constant Summary

VERSION = "0.1.0"

Instance Method Summary

Instance Method Detail

def check_sizeof(type, headers : String | Array(String) = [] of String) #

Returns the sizeof type using headers, or common headers if no headers are specified.

If this method fails an error is raised. This could happen if the type can't be found and/or the header files do not include the indicated type.

Example:

class Foo include Mkmf::Lite utsname = check_sizeof('struct utsname', 'sys/utsname.h') end


[View source]
def check_valueof(constant, headers : String | Array(String) = [] of String) #

Returns the value of the given constant (which could also be a macro) using headers, or common headers if no headers are specified.

If this method fails an error is raised. This could happen if the constant can't be found and/or the header files do not include the indicated constant.


[View source]
def common_headers : Array #

[View source]
def cpp_command #

[View source]
def cpp_executable : String #

[View source]
def cpp_libraries : String #

[View source]
def cpp_out_file : String #

[View source]
def cpp_source_file : String #

[View source]
def have_func(function, headers : String | Array(String) = [] of String) #

Check for the presence of the given +function+ in the common header files, or within any +headers+ that you provide.

Returns true if found, or false if not found.


[View source]
def have_header(header : String, directories = [] of String) : Bool #

Check for the presence of the given header file. You may optionally provide a list of directories to search.

Returns true if found, or false if not found.


[View source]
def have_struct_member(struct_type, struct_member, headers : String | Array(String) = [] of String) #

Checks whether or not the struct of type +struct_type+ contains the +struct_member+. If it does not, or the struct type cannot be found, then false is returned.

An optional list of +headers+ may be specified, in addition to the common header files that are already searched.

Example:

class Foo include Mkmf::Lite st_uid = check_struct_member("struct stat", "st_uid", "sys/stat.h") end


[View source]
def try_to_compile(code, command_options = nil) #

Create a temporary bit of C source code in the temp directory, and try to compile it. If it succeeds, return true. Otherwise, return false.


[View source]
def try_to_execute(code) #

Create a temporary bit of C source code in the temp directory, and try to compile it. If it succeeds attempt to run the generated code. The code generated is expected to print a number to STDOUT, which is then grabbed and returned as an integer.

If the attempt to execute fails for any reason, then 0 is returned.


[View source]