Split the matching engine to a DSO, use cmake to build

The split is by no means finished.  A nascent exported interface can
be seen in libzwerg.h, but dwgrep.cc still uses the rich C++
interface, and all the library symbols are visible.