Use numeric sort to find which lib to link with

Fixes issue #1