WIP: changes regarding out of tree builds

This has been tested against HEAD a while ago; but at the moment I do not have a system ready on which i can test current compatibility. patches MAY be broken