  We consider the theory of the glass transition and jamming of hard spheres in
the large space dimension limit. Previous investigations were based on the
assumption that the probability distribution within a "cage" is Gaussian, which
is not fully consistent with numerical results. Here we perform a replica
calculation without making any assumption on the cage shape. We show that
thermodynamic functions turn out to be exact within the Gaussian ansatz --
provided one allows for arbitrary replica symmetry breaking --- and indeed
agree well with numerical results. The actual structure function (the so-called
non-ergodic parameter) is not Gaussian, an apparent paradox which we discuss.
In this paper we focus on the free energy, future papers will present the
results for the structure functions and a detailed comparison with numerical
results.
