Consider a compact surface $\mathcal{S} \subset \mathbb{R}^3$ without boundary and assume we are given the Gaussian curvature $K(x), x\in \mathcal{S}$. It is know that Gaussian curvature does not fully determine the Riemannian metric, as for example discussed in 


[Does the curvature determine the metric?](https://mathoverflow.net/questions/100281/does-the-curvature-determine-the-metric)


But for a given Gaussian curvature, does one have the freedom to choose a Riemannian metric such that the Gauss-Bonnet theorem holds?:


$$\int\_{\mathcal{S}} K(x) d\mu\_g(x) = 2\pi\; \chi(\mathcal{S}),$$


where $\mu\_g$ is the Riemmanian volume measure induced by the metric $g$ and $\chi(\mathcal{S})$ is the Euler characteristic.


Is there even a constructive method for a Riemmanian metric $g$ under the conditions that the resulting Gaussian curvature is $K(x),x\in \mathcal{S}$ and the Gauss-Bonnet theorem is fulfilled?


(maybe this question is too general as stated above, but then might become more meaningful with assumptions on $K$.) 



Given Gaussian curvature, can one construct a metric to fulfill the Gauss-Bonnet theorem?
If $K$ is to be the Gauss curvature of some metric on a compact two-dimensional manifold $M$ with Euler characteristic $χ(M)$, then from the Gauss-Bonnet theorem one has the following conditions: (a) $K$ is positive somewhere if $χ(M)>0$, (b) $K$ changes sign or $K≡0$ if $χ(M)=0$, (c) $K$ is negative somewhere if $χ(M)<0$. Theorem: $K∈C^∞(M)$ is the Gauss curvature of some Riemannian metric on the two-dimensional, compact, connected manifold $M$ if and only if $K$ satisfies the above sign condition. MR0375153 (51 #11349)
Kazdan, Jerry L.; Warner, F. W.
Existence and conformal deformation of metrics with prescribed Gaussian and scalar curvatures. 
Ann. of Math. (2) 101 (1975), 317–331. 
53C20 (58G99) 


