  We develop a general formalism to determine the statistical equilibrium
states of self-gravitating systems in general relativity and complete previous
works on the subject. Our results are valid for an arbitrary form of entropy
but, for illustration, we explicitly consider the Fermi-Dirac entropy for
fermions. The maximization of entropy at fixed mass-energy and particle number
determines the distribution function of the system and its equation of state.
It also implies the Tolman-Oppenheimer-Volkoff equations of hydrostatic
equilibrium and the Tolman-Klein relations. Our paper provides all the
necessary equations that are needed to construct the caloric curves of
self-gravitating fermions in general relativity as done in recent works. We
consider the nonrelativistic limit $c\rightarrow +\infty$ and recover the
equations obtained within the framework of Newtonian gravity. We also discuss
the inequivalence of statistical ensembles as well as the relation between the
dynamical and thermodynamical stability of self-gravitating systems in
Newtonian gravity and general relativity.
