I don't think that the official mame has support for autofire.
Yup. To clarify, official mame does not and will not support autofire.
The two "exceptions" are if the original game supported it, or if your hardware supports it. Exception is quoted because mame is not adding autofire in either case.
So, ...
I have MameUIFX and it supports it. I can set autofire on the buttons I want in the options (tab).
... you'll have to use a mame derivative that adds aurofire, like ptinolv says. (There may be others, but I don't use deriv anymore, so I don't know; mameUIFX is a popular one though.)