Link with pthread and dl on Unix only

Fixes #72.