I use m4 in my fortran code to generate specific code based on flags defined in my parameters file.
I know very little pre-processing and hence don't know M4 very well. I am trying to write code where I need to define things based on three cases: isothermal, barotropic, neither. I wrote the following code:
#ifdef isothermal
do something (1)
#elif barotropic
do something (2)
#else
do something (3)
#endif
Now when I compile the code, it compiles fine with isothermal [do something (1)] and (without isothermal and barotropic defined) [do something (3)]. But when I define barotropic, it falls back to [do something (3)] instead of [do something (2)].
Any pointers on how to deal with such a situation in m4?
Thanks!