jcwxj.....
Search brutha........ search!
There are tons of threads on the subject of swapping in 3.4L and 4.3L engines.
The 4.0 is gonna be the biggest challenge to swap into a pre '87 XJ and not worth the headache. The front part of the engine compartment - the radiator support area is much different on the early XJ's. The radiators are different for the 2.8 to the 4.0, the 4.0 mounts farther forward and closer to the grille. The hood latch systems are also different for this reason as the earlier XJ's had a center latch and pin ahead of the radiator, and the '87 and newer had two latches, one at each front corner, because the radiator is now where the center pin/latch would be on earlier XJ's - to accomodate the longer inline 6 engine. Ya dig?
Be sure to get educated on your area's emissions laws regarding engine swaps to make sure you don't piss your swap investment away, but the easiest swap and likely the cheapest is to get the 3.4L from a mid '90's Camaro or Firebird - pretty much a bolt-in.