  Let $(\Sigma,g)$ be a compact Riemannian surface without boundary and
$\lambda_1(\Sigma)$ be the first eigenvalue of the Laplace-Beltrami operator
$\Delta_g$. Let $h$ be a positive smooth function on $\Sigma$. Define a
functional $$J_{\alpha,\beta}(u)=\frac{1}{2}\int_\Sigma(|\nabla_gu|^2-\alpha
u^2)dv_g-\beta\log\int_\Sigma he^udv_g$$ on a function space
$\mathcal{H}=\left\{u\in W^{1,2}(\Sigma): \int_\Sigma udv_g=0\right\}$. If
$\alpha<\lambda_1(\Sigma)$ and $J_{\alpha,8\pi}$ has no minimizer on
$\mathcal{H}$, then we calculate the infimum of $J_{\alpha,8\pi}$ on
$\mathcal{H}$ by using the method of blow-up analysis. As a consequence, we
give a sufficient condition under which a Kazdan-Warner equation has a
solution. If $\alpha\geq \lambda_1(\Sigma)$, then
$\inf_{u\in\mathcal{H}}J_{\alpha,8\pi}(u)=-\infty$. If $\beta>8\pi$, then for
any $\alpha\in\mathbb{R}$, there holds
$\inf_{u\in\mathcal{H}}J_{\alpha,\beta}(u)=-\infty$. Moreover, we consider the
same problem in the case that $\alpha$ is large, where higher order eigenvalues
are involved.
