Since both rigify 2.79 & mecanim are two much used solutions, I bet there is a good workflow I could learn.
Right now if I open a rigify-made blender 2.79 on "Legacy" mode with rig set as humanoid on mecanim, The head bone writes error And I could find no direct way to solve without errors or weird results, Thanks!
Unity used to have a write up on the process. Essentially you need to remove a lot of extra objects the Rigify process creates. I found this addon that can make the rig Mecanim friendly on export: Rigify Deform Bones. I haven't tried it, but I have worked with Rigify rigs before in the past and had to manually remove all the extras that the addon would do for you.