FIXME: Cross compile in Travis with Mingw-w64
Bundle PDCurses when cross compiling

- When cross compiling build a bundled PDCurses library
Picked: Refactor declaration generation

- Call compiler from CMake instead of lua script to generate a
  preprocessor file - allows for better/early error detection if
  the compiler fails
- Preprocessor files are saved along with the headers as .i files
- Accept preprocessor lines with trailing chars after # as is
  the case in Clang/Windows
- The fourth argument to gendeclarations.lua is now the path to
  the proprocessor output file
Picked: Add cmake platform checks

- Defined CMake checks for all headers in config.h.in
- Removed headers checks that are not used anymore:
  sgtty.h sys/statfs.h libintl.h poll.h
- Added UNIX check
- Add some fatal checks
  + Check for setenv() and fail if it does not exist
    since our os layer just assumes it does
  + lstat is required by os_unix.c
  + sys/wait.h is required in UNIX
- Removed entries for functions that are not being used: getcwd,
  getrlimit, getwd, nanosleep, sigaltstack, getwd, sigstack, fseeko
- Replaced nearly all defines in config.h.in for functions with
  compile time checks
- Add check for symbol FD_CLOEXEC
- HAVE_ICONV_H and HAVE_ICONV hold the expected checks but Neovim uses
  USE_ICONV define to actually decide whether to enable it
- Removed checks that are no longer needed
  + USEMEMMOVE
  + Removed checks for select.h and sys/select.h and includes
    in vim.h
  + _FILE_OFFSET_BITS
  + HAVE_ST_BLKSIZE

Conflicts:
	config/config.h.in
Fatal errors for setenv/lstat only for UNIX
Picked: Hinidu mkdtemp branch from #850
Define uid_t for windows
Add platform check for langinfo codeset
Mingw: Use POSIX compatible stdio

- There are some differences between stdio (*printf) functions in POSIX
  and the MS runtime, this commit enables Mingw compatibility for these
  functions
Merge os_unix_defs.h into os/unix_defs.h
Hide away os_unix.c/ into os/deprecated

- In preparation to add support for multiple systems os_unix.c now lives
  in nvim/os/deprecated/
- nvim/os_unix.h still exists but only to keep things working
- Later the following should take place
  + nvim/os/deprecated/os_unix.c should be split among os/*.c files
  + nvim/os_unix.h should be removed
  + No file should include nvim/os_unix.h
Include winsock2.h in win_defs.h

- Mingw warns the include must show up before windows.h
Add stdio.h to win_defs.h
Add time.h to win_defs.h
Add path length defines to win_defs.h
Add Vim defines to win_defs.h
Remove non-UNIX branch from fileio.c
FIXME: Remove cscope until we fix it for windows

Conflicts:
	src/nvim/eval.c
	src/nvim/if_cscope.c
	src/nvim/if_cscope.h
FIXME: rebase platform checks and remove this
Add max memory to win_defs.h