c_tests

Various configuration tests.

Task generator method

The configuration test waflib.Tools.ccroot.run_c_code() declares a unique task generator, so we need to create other task generators from here to check if the linker is able to link libraries.

Feature :link_lib_test
waflib.Tools.c_tests.check_library(self, mode=None, test_exec=True)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check if libraries can be linked with the current linker. Uses waflib.Tools.c_tests.link_lib_test_fun().

Parameters:mode (string) – c or cxx or d
waflib.Tools.c_tests.check_inline(self, **kw)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check for the right value for inline macro. Define INLINE_MACRO to 1 if the define is found. If the inline macro is not ‘inline’, add a define to the config.h (#define inline __inline__)

Parameters:
  • define_name (string) – define INLINE_MACRO by default to 1 if the macro is defined
  • features (list of string) – by default c or cxx depending on the compiler present
waflib.Tools.c_tests.check_large_file(self, **kw)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Check for large file support and define the macro HAVE_LARGEFILE The test is skipped on win32 systems (DEST_BINFMT == pe).

Parameters:
  • define_name (string) – define to set, by default HAVE_LARGEFILE
  • execute (bool) – execute the test (yes by default)
waflib.Tools.c_tests.grep_for_endianness_fun(self)[source]
Feature :grep_for_endianness
waflib.Tools.c_tests.check_endianness(self)[source]

Configuration Method bound to waflib.Configure.ConfigurationContext

Execute a configuration test to determine the endianness

waflib.Tools.c_tests.conf(f)

Decorator: attach new configuration functions to waflib.Build.BuildContext and waflib.Configure.ConfigurationContext. The methods bound will accept a parameter named ‘mandatory’ to disable the configuration errors:

def configure(conf):
        conf.find_program('abc', mandatory=False)
Parameters:f (function) – method to bind
waflib.Tools.c_tests.feature(*k)

Decorator: register a task generator method that will be executed when the object attribute ‘feature’ contains the corresponding key(s):

from waflib.Task import feature
@feature('myfeature')
def myfunction(self):
        print('that is my feature!')
def build(bld):
        bld(features='myfeature')
Parameters:k (list of string) – feature names
waflib.Tools.c_tests.before_method(*k)

Decorator: register a task generator method which will be executed before the functions of given name(s):

from waflib.TaskGen import feature, before
@feature('myfeature')
@before_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters:k (list of string) – method names
waflib.Tools.c_tests.after_method(*k)

Decorator: register a task generator method which will be executed after the functions of given name(s):

from waflib.TaskGen import feature, after
@feature('myfeature')
@after_method('fun2')
def fun1(self):
        print('feature 1!')
@feature('myfeature')
def fun2(self):
        print('feature 2!')
def build(bld):
        bld(features='myfeature')
Parameters:k (list of string) – method names

Features defined in this module:

Previous topic

c_preproc

Next topic

c_aliases

This Page