[RFC] Add platform checks to replace config.h.in hardcoded values

Basically cmake checks for some of the hardcoded defines in config.h.in

* Commented out a bunch of defines that are not being used (and neither are the functions they refer to)
* Not quite sure what to do about tgetent related checks, these should probably be handled when looking for curses/term
* Some of the more tricky checks are still missing, iconv(), st_blksize, langinfo
* In some cases I fail immediately for functions/headers that are implicitly assumed to be available (setenv(), lstat(), sys/wait.h)
I think ```check_c_source_compiles(...)``` can be replaced with ```CHECK_SYMBOL_EXISTS(_nl_msg_cat_cntr libintl.h HAVE_NL_MSG_CAT_CNTR)```. With ```include(CheckSymbolExists)``` at the top of the file.
ref: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:CheckSymbolExists