def check_lib(conf, libs, func):
    # XXX: refactor with check_func

    # 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}

    conf.start_message("Checking for function %s in %s" % \
                       (func, " ".join([conf.env["LIB_FMT"] % lib for lib in libs])))

    old_lib = copy.deepcopy(conf.env["LIBS"])
    try:
        for i in range(len(libs)):
            conf.env["LIBS"].insert(i, libs[i])
        ret = conf.builders["ctasks"].try_program("check_lib", code, None)
        if ret:
            conf.end_message("yes")
        else:
            conf.end_message("no !")
    finally:
        conf.env["LIBS"] = old_lib
    for lib in libs:
        conf.conf_results.append({"type": "lib", "value": lib,
                                  "result": ret, "func": func})
    return ret
dataset/ETHPy150Open cournape/Bento/bento/private/_yaku/yaku/conftests/conftests.py/check_lib/original