Example #1
0
def check_func(conf, func, libs=None):
    if libs is None:
        libs = []
    # Handle MSVC intrinsics: force MS compiler to make a function
    # call. Useful to test for some functions when built with
    # optimization on, to avoid build error because the intrinsic and
    # our 'fake' test declaration do not match.
    code = r"""
char %(func)s (void);

#ifdef _MSC_VER
#pragma function(%(func)s)
#endif

int main (void)
{
    return %(func)s();
}
""" % {"func": func}

    old_lib = copy.deepcopy(conf.env["LIBS"])
    try:
        for lib in libs[::-1]:
            conf.env["LIBS"].insert(0, lib)
        ret = create_link_conf_taskgen(conf, "check_func", code,
                            None, "Checking for function %s" % func)
    finally:
        conf.env["LIBS"] = old_lib
    conf.conf_results.append({"type": "func", "value": func,
                              "result": ret})
    return ret
Example #2
0
def check_compiler(conf):
    code = """\
int main(void)
{
    return 0;
}
"""

    ret = create_link_conf_taskgen(conf, "check_cc", code,
                        None, "Checking whether C compiler works")
    return ret
Example #3
0
def check_lib(conf, lib):
    code = r"""
int main()
{
    return 0;
}
"""

    old_lib = copy.deepcopy(conf.env["LIBS"])
    try:
        conf.env["LIBS"].insert(0, lib)
        ret = create_link_conf_taskgen(conf, "check_lib", code,
                            None, "Checking for library %s" % lib)
    finally:
        conf.env["LIBS"] = old_lib
    conf.conf_results.append({"type": "lib", "value": lib,
                              "result": ret})
    return ret