An easy way to check the coplanarity of the two rails is by stretching two diagonal strings and check if they touch in the middle. With thin fishing line and eventually compensating the thickness of the line for the one above you could get very good accuracy. When you have the ends coplanar then you can straighten the rails with a straight reference (the hardest part).

For the perpendicularity of the gantry to the x axis, draw with the cnc the corners of a rectangle, and measure the diagonals which should be equal. The larger the rectangle, higher the measured accuracy.