FreeDOS still has the problem of not supporting long file names, so even if it runs MAME, it won't compile MAME.
What long filenames is MAME using?
MAME doesn't use long filenames internally, which is why MAME runs in DOS.
The GNU compiler and DJGPP
do use long filenames, which is why MAME won't compile under FreeDOS, even though it may run correctly given the right sound card.
ROM-DOS looks like a winner since it will both compile and run MAME with no sound card issues.