Analytic maps in homotopy classes

Let $\mathcal M$ be a compact connected real-analytic manifold. It is well known that every continuous map $f\colon\mathcal M\to\mathbb S^1$ is homotopic to a smooth map. My question is the following. Are there any sufficient conditions on $\mathcal M$ that would guarantee the existence of an analytic map $\mathcal M\to\mathbb S^1$ in every homotopy class?

-

This is always true. The Morrey-Grauert theorem says that $M$ has a real-analytic embedding in Euclidean space, so real-analytic functions $M\to\mathbb{R}$ separate points, so they are dense in the algebra of all continuous function (by the Stone-Weierstrass theorem). Thus, given a map $f:M\to S^1\subset\mathbb{C}$ we can choose a real-analytic map $g:M\to\mathbb{C}$ with $\|f-g\|<1$. The formula $h(x)=g(x)/|g(x)|$ then gives a real-analytic map $h:M\to S^1$ that is homotopic to $f$.