This is a reference-request about a very simple statement.

The Riemann hypothesis is well-known to be equivalent to $$(1)\ \ \ \pi(x) = \mathrm{Li}(x)+O(x^{1/2} \log x)$$ and to $$(2)\ \ \theta(x)=x+O(x^{1/2} \log^2 x).$$ Here as usual, $\pi(x) = \sum_{p < x} 1$ and $\theta(x) = \sum_{p< x} \log p$.

I am looking for a reference giving the proof of the equivalence between (1) and (2).

All the analytic number theory textbooks I have looked at gives at best a proof that $\theta(x) \sim \pi(x) \log x$, which is clearly not enough.