BF: refactor conditional compiling again

Add ability to use custom code for compiler flag checks, so we can check
for missing headers.