Fix issues with multiple libs returned by ldconfig.

The "ldconfig -p" could actually return multiple libraries, like on rhel
when looking up possible references to libplc4.so it returns,
- libplc4.so (libc6,x86-64) => /lib64/libplc4.so
- libplc4.so (libc6,x86-64) => /usr/lib64/libplc4.so

Add -m1 option to egrep to make sure that only the first reference is
used for linkage.