Build system & ifdef fixes