All 4.0L Jeep engines will match up to the AW4 bellhousing but there are other issues to consider such as:

1. The blocks from the WJ/ZJ have the engine mount bolt bosses and the bosses for the AC compressor mounting bracket in a different location.

2. Pre-'00 XJ/TJ/YJ heads don't have the mounting bosses for the coil packs but that's only a minor issue that can easily be overcome. Your exhaust manifold will also not match with those same heads.

You still have plenty of engine swap options though, preferably from an '00-'01 XJ or an '00-'06 TJ 'cause those will be a direct swap. Other swaps are possible but they'll also require some other parts to be swapped over to make them work.