handle Emacs 24.4 package.el

Packages now have a list of package descriptors
package-desc-doc has been renamed to package-desc-summary
check all available package descs for new version

The available packages in package-archive-contents are not guaranteed to
be sorted by version.
fix more compilation warnings, missing functions

some functions were changed or introduced in 24.3
defun missing functions at runtime too

eval-when-compile -> eval-and-compile
Merge pull request #1660 from npostavs/package-24.4

handle Emacs 24.4 package.el