Add package dependency headers and autoload cookies for MELPA

It has been requested that we add tern.el to
MELPA (https://github.com/milkypostman/melpa/issues/925): this commit
makes some minor changes to accommodate package.el.

We plan to add two separate packages:

1. tern, containing "tern.el" and "tern-ido-complete.el"
2. tern-auto-complete, containing just "tern-auto-complete.el"

This will avoid forcing an installation of "auto-complete" upon tern
users who don't use that completion package.

So this commit adds "Package-Requires" headers as appropriate, and also
adds autoload cookies so that users will generally not need to "require"
the libraries before using them.

NOTE: the code declares "lexical-binding: t", and if this feature is
used, then the packages will not work for any of the many Emacs 23
users. As a result, I have declared dependencies on Emacs 24. If you
don't need "lexical-binding", which would be preferable, then we should
instead remove both that variable setting and the Emacs 24 dependency.