Add CMake buildfile.
Add prologue code.
Add options for manual selection of APIs.
Remove primitive API selection code.
Add full API selection mechanism.

Mostly copied from configure.ac.
Set some flags depending on compiler and environment.
Build test programs.
Merge pull request #3 from berkus/master

Add CMake buildfile.