Add move the motor mounts on the frame, and you'll also have to pull the whole 98 underdash harness, use the older gauge panel and probably mix/match a few AC and other underdash type stuff... AND the ABS and antilocks will probably be a huge problem too.
Sell the 4.0 you have and buy one of the correct years with underhood harness and PCM, and hassles get far less. ALL of this info was available here on this forum BEFORE you bought the wrong year 4.0.
97 TJ Sport - 4.0/HP D30 w ARB/8.8 w LS/4.88s; 35s and flat fenders on 2.5 lift
84 CJ7; frame off restoration in progress.
The technical advice you get from me here is worth exactly what you paid me for it. Warranty issues will be reimbursed at double what you paid me for the advice.