One of the ways I solved this problem was to make about a dozen small wooden wedges. Equally spaced around the door frame and temporarily held in place with masking tape.
Looseley install the door,Tap,loosen & adjust in or out as required. This will give you an almost exact spacing and equal clearance all around. From the opposite side, go inside and snug door hinge bolts. The door should shut and line up ok.
This worked for me, hopefully it can work for anyone having a hard time to get doors to line up and shut properly.