from bento.commands import hooks

@hooks.pre_build
def pre_build(context):
    context.waf_context.env.INCLUDES.append(".")

    context.tweak_extension("orthogonal_eval", use="NPYMATH")
    context.tweak_extension("lambertw", use="NPYMATH")
    context.tweak_extension("_logit", use="NPYMATH")

    context.tweak_extension("specfun", features="c fc pyext cshlib bento f2py",
                             use="sc_specfun NPYMATH CLIB")

    context.tweak_extension("_cephes",
                          use="sc_amos sc_toms sc_c_misc sc_cephes sc_mach " \
                              "sc_cdf sc_specfun NPYMATH CLIB")

    context.tweak_extension("_ufuncs_cxx", features="cxx cxxshlib pyext bento",
                            use="NPYMATH")

    context.tweak_extension("_ufuncs",
                            use="sc_amos sc_c_misc sc_cephes sc_mach sc_cdf "\
                                "sc_specfun NPYMATH CLIB LAPACK",
                            includes=["c_misc"])

    context.tweak_extension("cython_special",
                            use="sc_amos sc_c_misc sc_cephes sc_mach sc_cdf "\
                                "sc_specfun NPYMATH CLIB LAPACK",
                            includes=["c_misc", "."],
                            defines=['CYTHON_SPECIAL=1'])

    context.tweak_extension("_ellip_harm_2",
                            use="sc_amos sc_c_misc sc_cephes sc_mach sc_cdf "\
                                "sc_specfun NPYMATH CLIB LAPACK")

    context.tweak_extension("_test_round",
                            use="NPYMATH",
                            includes=["_round.h", "c_misc/double2.h"])
