Coupling and competition between ferroelectricity, magnetism, strain, and oxygen vacancies in AMnO_3 perovskites