add libraries and make configure script more robust
[skip ci]