Suppose I have a file tools.m4 with macro definitions:
define([YEAR_2_DIGITS], substr(YEAR, [2], [2]))
I want to use in another file query.sql:
changequote(`[', `]')
include(./tools.m4)
define([YEAR], [2017])
YEAR_2_DIGITS
But obviously it will return:
$ m4 query.sql
AR
instead of 17.
Is there a workaround to make that construct work?
I finally did it. One has to quote the body of the first definition: