Using platform.h instead of system headers

This way all the logic for deciding which headers need to be called is
kept inside platform.h.
(cherry picked from commit 6ef867994d15dcdd2bbaba9142ed97772416c0ef)
Moar changes
(cherry picked from commit 1e4ed49ed8e01e275e7e4df9af84085bc0bf1d58)
More ChangeLog entries.
(cherry picked from commit 823ca5e648fb9c2db8cedc960085aee8a408ce30)
fixing a mem leak. Never free what you insert in a StringMap
(cherry picked from commit a38f6c683dc61c7cb07c32e3dee56630427d58e9)
Change configure test for getaddrinfo

The problem is that with the default AC_REPLACE_FUNCS, autoconf declares it as
"char getaddrinfo(void)". However on Windows, because of stdcall calling
convention, the symbol emitted differs because of the missing calling
convention directive and the different the number of arguments.

See http://lists.gnu.org/archive/html/autoconf/2013-05/msg00085.html for more
info.
(cherry picked from commit ca36b7634f432b45cc7bb22550a96606a2ac45a0)
Make the getaddrinfo check even simpler.

Amending the previous commit, this one removes completely the linking test for
getaddrinfo. So to replace the function, it is enough now for the platform to
be missing getaddrinfo declaration.
(cherry picked from commit 000f73915d9928981339e6b163173a5b26524e26)