home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / ncurses-1.9.9e-src.tgz / tar.out / fsf / ncurses / shlib < prev    next >
Text File  |  1996-09-28  |  2KB  |  41 lines

  1. #!/bin/sh
  2. # Use this script as a wrapper when running executables linked to shared
  3. # libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed
  4. # the soname's path within the linked executable (such as IRIX), e.g,
  5. #
  6. #    shlib knight
  7. #
  8. # Setting LD_LIBRARY_PATH, overrides/supplements the loader's normal search
  9. # path, and works on most systems.  The drawback is that then the environment
  10. # variable has to be set to run the programs within this directory tree.
  11. #
  12. # For Linux (and other systems using the GNU loader), we can use the rpath
  13. # directive, which embeds the pathname of the library within the executable.
  14. # Using the Linux loader's rpath directive introduces a constraint, since
  15. # it's embedded into the binary, and means that the binary cannot be moved
  16. # around (though it'll work if the $exec_prefix convention that puts the bin
  17. # and lib directories under the same parent is followed).
  18. #
  19. # Using the actual soname (e.g., ../lib/libncurses.so) alone, is a more
  20. # flexible solution; you can link without having to set the environment
  21. # variable, and on some systems (IRIX) you can even run the resulting binaries
  22. # without setting LD_LIBRARY_PATH.
  23. #
  24. # Using a conventional link, with -L and -l options on Linux results in a
  25. # statically linked executable, which we don't want at all.
  26. #
  27. q=
  28. for p in lib ../lib
  29. do
  30.     if test -d $p; then
  31.         q="$p"
  32.     fi
  33. done
  34. if test -n "$LD_LIBRARY_PATH"; then
  35.     LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH"
  36. else
  37.     LD_LIBRARY_PATH="$q"
  38. fi
  39. export LD_LIBRARY_PATH
  40. eval "$*"
  41.