pre-inst-guile-env.in 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. # Copyright (C) 2003, 2006, 2008 Free Software Foundation
  3. #
  4. # This file is part of GUILE.
  5. #
  6. # This script is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Lesser General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2.1 of the License, or (at your option) any later version.
  10. #
  11. # This library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # Lesser General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Lesser General Public
  17. # License along with this library; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. # NOTE: If you update this file, please update pre-inst-guile.in as
  20. # well, if appropriate.
  21. # Usage: pre-inst-guile-env [ARGS]
  22. # This script arranges for the environment to support running Guile
  23. # from the build tree. The following env vars are modified (but not
  24. # clobbered): GUILE_LOAD_PATH, LTDL_LIBRARY_PATH, and PATH.
  25. # Example: pre-inst-guile-env guile -c '(display "hello\n")'
  26. # Example: ../../pre-inst-guile-env ./guile-test-foo
  27. # config
  28. subdirs_with_ltlibs="srfi guile-readline" # maintain me
  29. # env (set by configure)
  30. top_srcdir="@top_srcdir_absolute@"
  31. top_builddir="@top_builddir_absolute@"
  32. [ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
  33. x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
  34. echo $0: bad environment
  35. echo top_srcdir=$top_srcdir
  36. echo top_builddir=$top_builddir
  37. exit 1
  38. }
  39. if [ x"$GUILE_LOAD_PATH" = x ]
  40. then
  41. GUILE_LOAD_PATH="${top_srcdir}/guile-readline:${top_srcdir}"
  42. else
  43. for d in "${top_srcdir}" "${top_srcdir}/guile-readline"
  44. do
  45. # This hair prevents double inclusion.
  46. # The ":" prevents prefix aliasing.
  47. case x"$GUILE_LOAD_PATH" in
  48. x*${d}:*) ;;
  49. *) GUILE_LOAD_PATH="${d}:$GUILE_LOAD_PATH" ;;
  50. esac
  51. done
  52. fi
  53. export GUILE_LOAD_PATH
  54. # handle LTDL_LIBRARY_PATH (no clobber)
  55. ltdl_prefix=""
  56. dyld_prefix=""
  57. for dir in $subdirs_with_ltlibs ; do
  58. ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
  59. dyld_prefix="${top_builddir}/${dir}/.libs:${dyld_prefix}"
  60. done
  61. LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
  62. export LTDL_LIBRARY_PATH
  63. DYLD_LIBRARY_PATH="${dyld_prefix}${top_builddir}/libguile/.libs:$DYLD_LIBRARY_PATH"
  64. export DYLD_LIBRARY_PATH
  65. # handle PATH (no clobber)
  66. PATH="${top_builddir}/guile-config:${PATH}"
  67. PATH="${top_builddir}/libguile:${PATH}"
  68. export PATH
  69. exec "$@"