Add an option to build a shared library

I found that Python's shared library is not built in Linux. This patch will fix the issue. Could you please merge this patch?