curl, mercurial specified only if not already defined

This PR wraps ` ! defined` around the mercerial, curl package this doesn't conflict with previous declarations of these packages.

Let me know what you think, if I need to modify anything to get it up, and/or you have a better way to do this.

Thanks!