In general AM_CONDITIONAL should do but afaik our config is a bit weird. Not sure if it would work here.