← Back to context

Comment by xiaoyu2006

2 months ago

Autotools use M4 to meta-program a bash script that meta-programs a bunch of C(++) sources and generates C(++) sources that utilizes meta-programming for different configurations; after which the meta-programmed script, again, meta-programs monolithic makefiles.

This is peak engineering.

Yes, that sound ridiculous, but it is that way, so that the user can modify each intermediate step, which is the main selling point. As a user I really prefer that experience, which is why I as a developer put up with the non-sense of M4. (Which I think is more due to M4 being a macro language, then inherent language flaws.)

Sounds like a headache. Is there a nice Python lib to generate all this M4-mumbo-jumbo?

  • "Sounds complicated. I want it to throw exceptions and have significant whitespace on top of all that complexity!"

    • Oh it has significant white space. Make generally doesn't handle paths with spaces, so if you put the build or source directory somewhere where the absolute path has a space, all bets are off.