[PD-dev] Help for macro syntax in m4 config files.

IOhannes m zmölnig zmoelnig at iem.at
Sun Aug 16 21:15:05 CEST 2015


On 08/16/2015 05:27 PM, nicolas.danet at free.fr wrote:
> Hi list,
> 
> I'm not a m4/autotools expert and such i'm a bit stuck with codes below (from "m4/universal.m4")

why do you want to know?

many consider m4 as dark magic, and there's a reason for that.
usually you should just *use* the m4-macros, rather than trying to
understand them.


> 
> https://github.com/pure-data/pure-data/blob/master/m4/universal.m4#L68
> 
> $1[]_CFLAGS="$[]$1[]_CFLAGS $_pd_universal"
> $1[]_LDFLAGS="$[]$1[]_LDFLAGS $_pd_universal"
> 
> What's the meaning of the "$1[]" and "$[]$1[]" syntaxes? 

those are expanded during m4-expansion to proper values, depending on
the arguments to the enclosing m4-macro.

e.g. calling `PD_CHECK_UNIVERSAL(KNORZ)` (in configure.ac), will expand
those variables to KNORZ_CFLAGS resp. KNORZ_LDFLAGS.

iirc, the empty expansion syntax ("$[]") is mainly there for proper
escaping.

gfmsdr
IOhannes



More information about the Pd-dev mailing list