I recently acquired a 97 jeep cherokee 4.0 4x4 with 66000 original miles. I bought it without it running but it cranked just fine just no spark. Since then I determined the crank sensor, fuel pump, PCM, and alternator were bad. The alternator was locked up, the PCM the previous owner swapped with a junkyard one. I now have proper fuel pressure, good spark, correct timing, and good compression. It cranks and cranks, but will not start.
I would be suspect of the PCM. Make sure it is the correct part number for your vehicle. You can do this by looking up a used parts delaer on the internet and looking up the PCM and its part number then compare it to yours to be sure.
Otherwise there is an electrical issue of some type and that is a diagnostic process of elimination.
I am attaching wiring diagrams for the 4.0L. Use them to check that the wiring and gounds are good for the ignition system.