Ah ok, I think I see what you're asking now. Compiling a shader at your program runtime with D3DCompileFromFile is actually no different from compiling the shader offline from the command line using fxc.exe. The same steps are performed and the same shader bytecode is generated. So using #ifndef/#define will work exactly the same in both cases.
Edit: The shader compilation step (either through D3DCompileFromFile or fxc.exe) is what handles processing the defines. So the defines work the same both ways. Your actual application runtime or compilation doesn't affect it.
Edited by megadan, 06 September 2014 - 12:40 PM.