It can be done but it is not that easy.

A friend helped me setting up my 4th axis to run in index as well as spindle in linuxcnc, the latter demonstrated here: