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
There's built-in support for a test target via enable_testing() and add_test(), but I'm not fond of the way it eats the nice GoogleTest output and offers its own useless summary:

<pre>
$ make test
Running tests...
Test project /Users/jpnurmi/Projects/znc
    Start 1: unittest
1/1 Test #1: unittest .........................   Passed    0.02 sec

100% tests passed, 0 tests failed out of 1

Total Test time (real) =   0.02 sec
</pre>

That's why I chose a custom target which is no more than a one-liner + setting the policy to allow hijacking 'make test' target.