"I don't see right away which substitution changes the left side of (2) to the definition of $K$."
Consider first the indefinite integral
$$\int\frac{\mathrm du}{\sqrt{au^4+bu^2+1}}$$
Letting
$$h=\frac{b\pm\sqrt{b^2-4 a}}{2}$$
we have the factorization
$$\frac1{\sqrt{a}}\int\frac{\mathrm du}{\sqrt{\left(u^2+\frac{h}{a}\right)\left(u^2+\frac1{h}\right)}}$$
We now proceed to make a trigonometric substitution, $u=\frac{\tan\,v}{\sqrt{h}}$, to yield
$$\frac1{\sqrt{h}}\int\frac{\mathrm dv}{\sqrt{1-\left(1-\frac{a}{h^2}\right)\sin^2 v}}$$
At this point, we now pay attention to the limits; since $\arctan(0)=0$ and $\arctan(\infty)=\pi/2$, we then have
$$\frac1{\sqrt{h}}\int_0^{\pi/2}\frac{\mathrm dv}{\sqrt{1-\left(1-\frac{a}{h^2}\right)\sin^2 v}}=\frac1{\sqrt{h}}K\left(1-\frac{a}{h^2}\right)$$
In general, $h$ will be complex, necessitating the evaluation of the complete elliptic integral of the first kind for complex arguments. Thankfully, if you're using the AGM to evaluate the complete elliptic integral, it will still work; all that's needed is complex arithmetic.
As a side note, I tried doing this in mathematica but it timed out. Is maple better for these sorts of things?
– user63235 Feb 21 '13 at 05:57int(...) assuming c>1/4
. Mathematica would probably perform similarly, but I don't have it. – Feb 21 '13 at 11:39