module Mkmf::Lite

Defined in:

mkmf-lite.cr

Constant Summary

VERSION = "0.2.0"

Instance Method Summary

Instance Method Detail

def check_offsetof(struct_type, field, headers : String | Array(String) = [] of String, directories = [] of String) #

Returns the offset of field within struct_type using headers, or common headers, plus stddef.h, if no headers are specified.

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

You may optionally provide include directories to search.

Example:

class Foo include Mkmf::Lite utsname = check_offsetof("struct utsname", "release", "sys/utsname.h") end


[View source]
def check_sizeof(type, headers : String | Array(String) = [] of String, directories = [] 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.

You may optionally provide include directories to search.

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, directories = [] 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.

You may optionally provide include directories to search.


[View source]
def common_headers : Array(String) #

[View source]
def cpp_command #

[View source]
def cpp_defs : String | Nil #

[View source]
def cpp_executable : String #

[View source]
def cpp_libraries : String | Nil #

[View source]
def cpp_library_paths : String | Nil #

[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) : Bool #

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 include directories to search.

Returns true if found, or false if not found.


[View source]
def have_library(library, function = nil, headers : String | Array(String) = [] of String) : Bool #

Check for the presence of the given library. You may optionally provide a function name to check for within that library, as well as any additional headers.

Returns true if the library can be linked, or false otherwise.

Note: The library name should not include the lib prefix or file extension. For example, use xerces-c not libxerces-c or libxerces-c.dylib. However, if the lib prefix is provided, it will be automatically stripped on non-Windows compilers.


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

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 = have_struct_member("struct stat", "st_uid", "sys/stat.h") end


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

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, command_options = nil) : Int32 #

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 returned as an integer.

If compilation fails, an error is raised.


[View source]