This could be done, but on the other hand since we are comparing doubles we should introduce a tolerance in the comparison.
There are some functions but they are protected in TH1, TH1::CheckAxisLimits and TH1::CheckBinLimits.
You could copy the code if you need.
You cannot use now h1.GetXaxis() == h2.GetXaxis(), because it does a pointer comparison.