#! perl

#
# Do a perl check for version >= 5.005.  See 'gpt-translate-interpreter' should you
# need to alter the invocation path to a valid perl interpreter in the GPT front-end
# programs.
#

if ( ! ( defined eval "require 5.005" ) )
{
    die "GPT requires at least Perl version 5.005";
}

 open(FILE, "< $ARGV[0]")   or die "Can't open $ARGV[0] for reading: $!\n";
 
         my @filecontents= <FILE>; 
	 my ($libnames, @rest) = grep /^library_names/, @filecontents; 
	 $libnames =~ s/'//g;
	 $libnames =~ s/\n//g;
	 my ($ident, $libs)= split /=/, $libnames; 
	 my @sonames = split / /, $libs;
	 my %seen = ();
	 my @uniq;
	 foreach $item (@sonames) {
	     push(@uniq, $item) unless $seen{$item}++;
	     }
	 foreach $soname (@uniq){
	 	chomp $soname;
	 	print "$ARGV[1]/$soname\n";
		}
	 ($staticnames, @rest) = grep /^old_library/, @filecontents;
	 $staticnames =~ s/'//g;
	 ($ident, $staticname)= split /=/, $staticnames;
	 chomp $staticname;
	 print "$ARGV[1]/$staticname\n";
	 print "$ARGV[1]/$ARGV[0]\n";

