Replace constants.h with buildsystem defines

@BugFreeSoftware, please test this one too.