Ideal MHD stability of internal kinks in circular and shaped tokamaks