diff --git a/scripts/test-installation.pl b/scripts/test-installation.pl
index 45c666b0a2..fcb7707889 100755
--- a/scripts/test-installation.pl
+++ b/scripts/test-installation.pl
@@ -171,14 +171,20 @@ if ($?) {
$ok = 1;
%found = ();
+$librgx = qr/lib(\w+)\.so(?:\.([0-9\.]+))?/;
open LDD, "ldd /tmp/test-prg$$ |"
or die ("Couldn't execute ldd");
while (<LDD>) {
- if (/^\s*lib/) {
+ if (m,^\s*${librgx}\s*=>\s*(?:/[^/]+)*/${librgx},) {
($name, $version1, $version2) =
- /^\s*lib(\w*)\.so\.([0-9\.]*)\s*=>.*\.so\.([0-9\.]*)/;
+ ($1, defined($2) ? $2 : '', defined($4) ? $4 : '');
$found{$name} = 1;
+ if (!exists $versions{$name}) {
+ print "Unexpected dependency: lib$name\n";
+ $ok = 0;
+ next;
+ }