raspi-config should be able to do this for you via the top level option:
Choose whether to boot into a desktop environment or the command line
There are then choices including:
Desktop GUI, automatically logged in as 'pi' user
Raspi-config is a shell script in
/usr/bin, you can look at
do_boot_behaviour_new() for the details of how to do this "manually" (it depends on whether you are using systemd or the older init system), but there is no normally no need to do so.
If you're not using
lightdm but you are using Raspbian 8 (jessie), I think
raspi-config will still work, depending on what's been done with regard to your choosen DM and systemd. Systemd appears to have it's own mechanism for autologin with
graphical.target, and presumably this is adapted depending on the DM (but I cannot say for sure).
If you're using Raspbian 7, however,
raspi-config will re-enable
lightdm here, which you don't want. In this case it is also using a hardcoded mechanism specific to lightdm. You will need to instead configure whatever DM it is you are using, since that's what controls this.