I can't give you a comparison between lenses with built-in distortion mitigation versus software, because I don't own such lenses. However regarding software - there are two tools in Photoshop that do a pretty good job of this: Lens Correction Filter, and Transform (Perspective, Skew and Warp are my favorites). Working these carefully can do a quite convincing job of straightening all kinds of such issues. It is useful to know how these filters and adjustments behave, so that when you take the picture and know that such corrections will be needed you can make the necessary allowances for the kinds of stretching that will take place. Your skewed building will need "space" to move around in.