Add support for building on/cross-compiling the shared library for Windows and OS X

Also ensure that the shared library is versioned, and an implib is created on
Windows.
Merge pull request #86 from nirbheek/master

Add support for cross-compiling the shared library for Windows and OS X.  Thanks for the contribution.
Sync latest changes from master.