pretty close to flat isn't good enough when you consider the stiffness of the system and how much force will actually be exerted on the rails during operation; profile rails are of several varieties, some resist moment (torque) more than others. Most of them are of equal stiffness in any direction, because of that it doesn't matter how you mount them (horizontal or vertical) (for the most part). if mounting them horizontal or vertical changes their spacing, then that is often a big deal. (for example if the bottom rail is horizontal, then mounting the top rail on top of the gantry increases the distance between the two rails as much as 10%. This increased distance would make the gantry bearing blocks at least 20% stiffer) (if the bottom rail is mounted on the bottom of the gantry, then you lose the rail height for gantry clearance obviously, so this isn't usually done)
Some people shim the rails, others use rails large enough such that the gantry conforms to the bearing, not the other way round. Either way usually you try to get one as straight as possible and then bolt the 4 bearing blocks to your Z axis assembly, and as you slide the assembly across the gantry you measure the deflection of the other rail (hopefully you can't measure it) and tighten the bolts it as you move it.
btw i recently witnessed a diy router that used 60mm wide profile rail for x and Y. the Y axis gantry was a bar of steel, about 6 inches thick by 24 inches wide, spanning about 8 feet of y axis travel with a rail bolted to each side of it. why they did it that way I have no idea, I would have used a bunch of I beams welded into box sections. they probably had a 40 hp spindle on it.
in this particular example, its relatively easy to calculate.. what is the added bearing load, if the distance between the rails changes .001"? and the answer is probably measured in tons...