> Sadly m4 gives me a headache, so I haven't yet figured out what the
> above code is doing.
>

Have you tried the converted bsd m4? It plays nice with pcc and musl.  http://haddonthethird.net/m4/