[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)
@Hinidu I added it on purpose, it is still used in the code(vim.h, fileio.c) it is just not on by default - but something like

    cmake -DUSE_ICONV ..

works. Or at least I think it did when I started this PR.