the first attempt to fix #9701
authorAleš Křenek <ljocha@ics.muni.cz>
Wed, 21 Sep 2005 12:13:22 +0000 (12:13 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Wed, 21 Sep 2005 12:13:22 +0000 (12:13 +0000)
org.glite.lb/project/libtool-paths-split.pl [new file with mode: 0644]

diff --git a/org.glite.lb/project/libtool-paths-split.pl b/org.glite.lb/project/libtool-paths-split.pl
new file mode 100644 (file)
index 0000000..5dce72f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl -p -i
+
+next unless /^dependency_libs=/;
+
+s/^dependency_libs=//;
+s/\s*'\s*//g;
+
+$out = '';
+
+undef $libs;
+undef %paths;
+
+for (split) {
+       if (/^-L(.*)/) { $paths{$1} = 'x'; }
+       elsif (/^-l(.*)/) { $libs .= " -l$1"; }
+       elsif (/^(.*)\/lib(.*)\.(la|so).*$/) { $paths{$1} = 'x'; $libs .= " -l$2" ; }
+# XXX  else { $out .= " $_"; }
+       else { print STDERR "$_: unknown\n"; }
+}
+
+# $_ = "dependency_libs='$out'";
+$_ = "dependency_libs='";
+$_ .= '-L' . join ' -L',keys %paths if %paths;
+$_ .= $libs if $libs;
+$_ .= "'";