Study of magnetohydrodynamic modes in tokamak configurations with noncircular cross sections