Correct compilation of shared library and python module

The changes here address the issues mentioned in #231.

I just noticed some errors with the dylib install_name not being correct and there
ledger not running due to:

```
% ledger
dyld: Library not loaded: libledger.dylib
  Referenced from: /opt/local/bin/ledger
  Reason: image not found
```

Please refrain from merging this pull request until it has been fixed.