The XJ was designed by AMC, and the 2.46 and 4.0 are both AMC-designed engines.
AMC = "All Makes Compatible"
There are kits available to swap SBChevvy into the XJ, and I think there are a couple here who have actually wedged BBChevvy into XJ as well. Since you have an 89, you have the longer front clip - this will make any swap easier (the front clip was lengthened on the XJ and MJ in 1987 to accommodate the longer 4.0 I6 engine.)
Swapping to RWD 3.1/3.4 isn't a bad idea - DO NOT get the 2.8! Best use for that engine is a repository for chain and Sakrete, then donate to the neighbourhood boat owner.
If you change over to the inline six, you will at least need a new bellhousing for your transmission, and likely a new crossmember and new driveshafts as well. If you have the auto, scrap the TF for the AW4 - it's a better box.
Clear as mud, right? Remember, if you go the V6 route, there are two variants - FWD and RWD. DO NOT USE the FWD version - the starter boss is on the wrong side and it won't work with RWD transmissions!
5-90