I'm confused by the choice of adapters offered for Leica M cameras. Now obviously Leica M mount lenses can be mounted, but I have also seen the M39 screw mount being mentioned a lot. I guess they are not compatible but can be adapted? Does this work with the rangefinder? Typically an M mount lens must have a lever to communicate the focussing distance to the rangefinder prism, correct? I also saw that the are adapters for M42, but that is definitly a mount used for SLRs. Does that mean that you could only focus that using the distance scale on the lens or live view on newer Leicas?
When it comes to adapting lenses with simple ring adapters so that they'll still focus to infinity, the issue is merely one of image-plane to lens mount depth. Because a ring takes up physical space, you can really only adapt from a thicker mount to a thinner one without requiring a glass element to act as a teleconverter (and possibly diminishing image quality). The only other caveat is that the image circle of the lens needs to cover your sensor/frame of film, so adapting from a smaller format (half-frame, 4/3"-format, 16mm motion picture, etc.) will result in vignetting, so you want to start with a 135-format (35mm film/full frame) lens.
The Leica M mount is roughly the same size as most mirrorless mounts, so is thinner than SLR mounts, and can adapt all SLR and medium format lenses. That's why M42 will work: that's the old Pentax screwmount. M39 will work because it's the old Leica screwmount and they designed the M bayonet mount to still work with the older Leica lenses in the older mount (much as Pentax did with M42 and K mount).
Rangefinder coupling is a different issue. The lens itself must have some form of physical focus mechanism that can be translated via the adapter to how the Leica M mount does rangefinder coupling. So, this will depend not just on the mount, the adapter, but also on the lens. Chances are good though, that most SLR lenses won't rangefinder couple and you will have to use scale focusing instead. And you'll want to stick to film-era SLR lenses, because the newer dSLR lenses typically lack an aperture ring (so you won't have aperture control, either), and as autofocusing lenses will have focus scales that are more or less useless for manual focusing with any accuracy.