Avoid linking with libform(w).so

If libtgent or libcurses is installed, the first one found of them
is linked to.

But if not, a find_package(Curses REQUIRED) is used and CURSES_LIBRARIES
is added to NVIM_LINK_LIBRARIES. This contains libform(w).so on many
systems, causing nvim to be linked to and depend on libform(w).so,
which may not be installed one some space-constrained systems, unnecessarily.
Merge #933 'Avoid linking with libform(w).so'
Default 'encoding'-option from latin to utf-8 #935

Normally the default encoding does not have much effect, since it's
overridden by the environment.

But when it's not (test with "LANG= LC_ALL= C_CTYPE= nvim" and perform
":set encoding?"), utf-8 should be the default encoding for a 21st
century editor :).
Import mingw-w64 cmake toolchain settings
Enable cross compiling of third-party dependencies

- Change third-party CMakeLists.txt to handle building
  with cross compiler
- Build libuv, msgpack and luajit with TARGET compiler
- Build a luarocks and luajit (for the interpreter) with
  the HOST compiler
Add support for the PDCurses curses library

- Public Domain Curses is a curses compatible library that runs
  on windows
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