Remove HAVE_CVCONFIG_H - it's always defined.
Deleted a bunch of unused configuration macros.
Removed a few more unused configuration macros.

I've left HAVE_LIBPTHREAD as a CMake variable, since TBB's build depends on it.

Some macros in internal.hpp depended on HAVE_ALLOCA_H, but they were, in turn,
unused, so I've just deleted them all.
Refactored detecting several Apple-related technologies.

Now the HAVE_* macros are set using cvconfig.h. Previously most
of them already were there, but were always undefined. One,
HAVE_COCOA, I had to add.

This also makes the CMake code more consistent; now, WITH_* variables
are always checked in cmake/*, while HAVE_* variables are checked in
modules/highgui/CMakeLists.txt.
Refactored image format library finding logic.

Now the HAVE_* macros are set in cvconfig.h. Most of them already were there,
but were nonfunctional.
Removed unused NEW_FFMPEG macro.
Removed the HAVE_LRINT macro, which is never set.
Removed unused PACKAGE_* macros.
Removed useless VERSION macro (and CMake variable)
Sorted cvconfig.h.cmake in alphabetical order.
Merge pull request #1110 from SpecLad:config-cleanup