Switch to CMake

I've tested on Linux, OSX and Cygwin, but please help with testing your favorite configurations and report any issues found.

This change provides a configure wrapper script to make it almost backwards compatible with the old build system. See `configure --help` for details.

What comes to the build flags, it's not 100% identical with the old ones. Some of the platform specific build flags collected over the last decade were intentionally left behind. The latest ZNC requires a modern toolchain that supports C++11 anyway, so many of those old exotic flags are probably no longer even needed. The idea is to let CMake as a cross-platform to specify the correct flags, mostly.

The proposal also changes the structure a bit. After struggling with the damn object files for a good while, I decided to propose building the core as a library instead, like it was already done on Cygwin. I strongly believe this is the right direction to go in the future (see #210 and [Wiki](http://wiki.znc.in/Ideas)).

/cc @samuelgaist
I couldn't resist quoting one of the comments from http://www.elpauer.org/2011/02/bootstrap-your-cmake-project/

> How can it be hard to require a cmake installation? If people cannot even do that, they should not even dare to install a compiler. Why do all developers think that users of their software are totally dumb? Hint: they are not. And installing cmake is nothing that they will have trouble with.
As you said, autotools require a shell. But you always have to pollute the source tree (ever wondered about the .cvsignore and .gitignore) because they cannot do without. Building from VCS or a “prepared” version also differs. Many autotools projects cannot be correctly compiled out-of-source (sadly, that’s a fact). And I don’t need to say anything about the horrors of libtool and general GNU idiotism. Been there, done that, and please no more. Trying the fight of boot-strapping just means that you cannot let go of the GNUism of your past. Just do it, let go…

:)