We can assume $f$ has no multiple root (if the gcd of $f$ and $f'$ is not constant, divide by this gcd). Let $n$ be the degree of $f$. Compute
$$\frac{f(X)f'(Y)-f(Y)f'(X)}{X-Y} = \sum_{i,j=i}^{n}a_{i,j}\; X^{i-1}\; Y^{j-1}\;.$$
Then $f$ has all roots real iff the symmetric matrix $(a_{i,j})_{i,j=1,\ldots,n}$ is positive definite. This can be checked for instance by computing the principal minors of this matrix and verifying whether they are all positive.

There are several methods for computing the number of real roots using signature of quadratic form : see for instance this note (in french).

5more comments