The 4.0L in the XJ/MJ had a Peugeot BA-10/5 from 1987 to about mid-1989, the AX-15 from mid-1989 to 2000, and the NV3550 in 2001. I would imagine that the YJ and TJ ran parallel to that. The ZJ had the AW4 in 1993, and then I think the 42RH 1994-up.
The AMC 150ci/2.46L four-cylinder usually had either the Aisin AX-4 (four-speed) or AX-5 (five-speed,) but I wouldn't trust either of those boxes behind the 242ci/4.0L six. The Borg (T5, I think) used in the earlier years - 1984-1986, I think - was also used behind various V8s, and should hold up.
It's also worth noting that the AX-15 had two different versions - the "internal" version (where the slave cylinder and throwout bearing were a common unit called a "concentric bearing" or a "concentric cylinder") and the "external" version (with a separate throwout bearing, a throwout fork, and an easily-removable slave cylinder.) The "external" version is the later of the two, and I think started to become available in 1995 or 1996. The "external" style AX-15 bellhousing is supposed to be a direct swap for the NV3550 as well (all of the NV gearboxes are "external" style.)
If you get your donor gearbox from a "Universal" (YJ or TJ,) expect to have to "massage" the transmission tunnel. The transfer case adapter housing "clocks" the transfer case so that it is rather higher - this may be what you end up wanting, but it would take a bit more work to install. Apart from that, they'll swap readily.