pre-inst-guile.in 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. # Copyright (C) 2002 Free Software Foundation
  3. #
  4. # This file is part of GUILE.
  5. #
  6. # GUILE is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2, or
  9. # (at your option) any later version.
  10. #
  11. # GUILE is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public
  17. # License along with GUILE; see the file COPYING. If not, write
  18. # to the Free Software Foundation, Inc., 59 Temple Place, Suite
  19. # 330, Boston, MA 02111-1307 USA
  20. # Commentary:
  21. # Usage: pre-inst-guile [ARGS]
  22. #
  23. # This script arranges for the environment to support, and eventaully execs,
  24. # the uninstalled binary guile executable located somewhere under libguile/,
  25. # passing ARGS to it. In the process, env var GUILE is clobbered, and the
  26. # following env vars are modified (but not clobbered):
  27. # GUILE_LOAD_PATH
  28. # LTDL_LIBRARY_PATH
  29. #
  30. # This script can be used as a drop-in replacement for $bindir/guile;
  31. # if there is a discrepency in behavior, that's a bug.
  32. # Code:
  33. # config
  34. subdirs_with_ltlibs="srfi guile-readline" # maintain me
  35. # env (set by configure)
  36. top_srcdir="@top_srcdir_absolute@"
  37. top_builddir="@top_builddir_absolute@"
  38. [ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
  39. x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
  40. echo $0: bad environment
  41. echo top_srcdir=$top_srcdir
  42. echo top_builddir=$top_builddir
  43. exit 1
  44. }
  45. # handle GUILE_LOAD_PATH (no clobber)
  46. if [ x"$GUILE_LOAD_PATH" = x ] ; then
  47. GUILE_LOAD_PATH="${top_srcdir}"
  48. else
  49. # This hair prevents double inclusion.
  50. # The ":" prevents prefix aliasing.
  51. case x"$GUILE_LOAD_PATH" in x*${top_srcdir}:*) ;;
  52. *) GUILE_LOAD_PATH="${top_srcdir}:$GUILE_LOAD_PATH" ;;
  53. esac
  54. fi
  55. export GUILE_LOAD_PATH
  56. # handle LTDL_LIBRARY_PATH (no clobber)
  57. ltdl_prefix=""
  58. for dir in $subdirs_with_ltlibs ; do
  59. ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
  60. done
  61. LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
  62. export LTDL_LIBRARY_PATH
  63. # set GUILE (clobber)
  64. GUILE=${top_builddir}/libguile/guile
  65. export GUILE
  66. # do it
  67. exec $GUILE "$@"
  68. # never reached
  69. exit 1
  70. # pre-inst-guile ends here