Added curl support when downloading dependancies

Check for the existence of curl after failing to find wget.

Note that I ended up removing the quotes around $url
when referencing it in the call to wget, since urls can't have spaces
anyways, and the correct quoting was messy.  Also I added a few
more `local` declarations to the variables.

To test, I did

    rm -r .deps
    make clean
    make cmake
    make

And it worked.