#!/bin/sh
#
#  This simple script helps troubleshoot problems occuring when
#  old gtkmm or libsigc++ library is installed on the system. In this
#  case fwbuilder binary does not start and gives an error which looks
#  like this:
#
#   fwbuilder: error while loading shared libraries:
#   fwbuilder: undefined symbol: connect__Q23Gtk9ProxyNodePQ23Gtk6ObjectPCcPFv_vPQ24SigC8SlotDatab
#
#   Run this script with one parameter - full path and name for fwbuilder
#   binary.  Script prints all dynamic libraries needed for fwbuilder
#   and determines RPM package each library file is part of.
#
#  Vadim Kurland,  vadim@vk.crocodile.org    Oct 2001

PGM=$1

if [ "X$PGM" = "X" ]; then
  echo "Usage:  check_libs.sh program_path"
  exit 1
fi

ldd $PGM | awk '{printf "%s\n",$3;}' | while read f; do

 if [ -L $f ]; then
    g=`file $f | awk '{print $NF;}'`
    h=`dirname $f`/$g
 else
    h=$f
 fi
 
 printf "%-40s" $h
 rpm -qf $h

done

