make util/has_lib.sh work properly on Debian

The current version of util/has_lib.sh fails to detect libraries on Debian, for 2 reasons:

1. On Debian, `ldconfig` lies in `/sbin/` and therefore isn't found if run by a non-root user
2. On Debian, `libjpeg` is in  `/usr/lib/x86_64-linux-gnu/libjpeg.so` , which is not included in the set of library paths for searching.

My commit remedies both of those problems.