Redo and enhance the support for building shared libraries. Currently