Support both static and shared libraries

This does some magic to auto-detect the library type based on the
library's extension.