We study the following question: given an open set $\Omega$, symmetric about 0, and a continuous, integrable, positive definite function $f$, supported in $\Omega$ and with $f(0)=1$, how large can $\int f$ be? This problem has been studied so far mostly for convex domains $\Omega$ in Euclidean space. In this paper we study the question in arbitrary locally compact abelian groups and for more general domains. Our emphasis is on finite groups as well as Euclidean spaces and ${\mathbb Z}^d$. We exhibit upper bounds for $\int f$ assuming geometric properties of $\Omega$ of two types: (a) packing properties of $\Omega$ and (b) spectral properties of $\Omega$. Several examples and applications of the main theorems are shown. In particular, we recover and extend several known results concerning convex domains in Euclidean space. Also, we investigate the question of estimating $\int_{\Omega}f$ over possibly dispersed sets solely in dependence of the given measure $m:=|\Omega|$ of $\Omega$. In this respect we show that in ${\mathbb R}$ and ${\mathbb Z}$ the integral is maximal for intervals.