uninstalled-env.in 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #!/bin/sh
  2. # Copyright (C) 2003, 2006, 2008, 2009, 2010 Free Software Foundation
  3. #
  4. # This file is part of GUILE.
  5. #
  6. # This script is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Lesser General Public License as
  8. # published by the Free Software Foundation; either version 3 of the
  9. # 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
  19. # 02110-1301 USA
  20. # NOTE: If you update this file, please update uninstalled.in as
  21. # well, if appropriate.
  22. # Usage: uninstalled-env [ARGS]
  23. # This script arranges for the environment to support running Guile
  24. # from the build tree. The following env vars are modified (but not
  25. # clobbered): GUILE_LOAD_PATH, LTDL_LIBRARY_PATH, and PATH.
  26. # Example: uninstalled-env guile -c '(display "hello\n")'
  27. # Example: ../../uninstalled-env ./guile-test-foo
  28. # config
  29. subdirs_with_ltlibs="srfi guile-readline libguile" # maintain me
  30. # env (set by configure)
  31. top_srcdir="@top_srcdir_absolute@"
  32. top_builddir="@top_builddir_absolute@"
  33. [ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
  34. x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
  35. echo $0: bad environment
  36. echo top_srcdir=$top_srcdir
  37. echo top_builddir=$top_builddir
  38. exit 1
  39. }
  40. if [ x"$GUILE_LOAD_PATH" = x ]
  41. then
  42. GUILE_LOAD_PATH="${top_srcdir}/module:${top_srcdir}:${top_srcdir}/guile-readline"
  43. if test "${top_srcdir}" != "${top_builddir}"; then
  44. GUILE_LOAD_PATH="$GUILE_LOAD_PATH:${top_builddir}/module:${top_builddir}:${top_builddir}/guile-readline"
  45. fi
  46. else
  47. for d in "/module" "" "/guile-readline"
  48. do
  49. # This hair prevents double inclusion.
  50. # The ":" prevents prefix aliasing.
  51. case x"$GUILE_LOAD_PATH" in
  52. x*${top_srcdir}${d}:*) ;;
  53. *) GUILE_LOAD_PATH="${top_srcdir}${d}:$GUILE_LOAD_PATH" ;;
  54. esac
  55. case x"$GUILE_LOAD_PATH" in
  56. x*${top_builddir}${d}:*) ;;
  57. *) GUILE_LOAD_PATH="${top_builddir}${d}:$GUILE_LOAD_PATH" ;;
  58. esac
  59. done
  60. fi
  61. export GUILE_LOAD_PATH
  62. if [ x"$GUILE_LOAD_COMPILED_PATH" = x ]
  63. then
  64. GUILE_LOAD_COMPILED_PATH="${top_builddir}/module:${top_builddir}:${top_builddir}/guile-readline"
  65. else
  66. for d in "/module" "" "/guile-readline"
  67. do
  68. # This hair prevents double inclusion.
  69. # The ":" prevents prefix aliasing.
  70. case x"$GUILE_LOAD_COMPILED_PATH" in
  71. x*${top_builddir}${d}:*) ;;
  72. *) GUILE_LOAD_COMPILED_PATH="${top_builddir}${d}:$GUILE_LOAD_COMPILED_PATH" ;;
  73. esac
  74. done
  75. fi
  76. export GUILE_LOAD_COMPILED_PATH
  77. # Don't look in installed dirs for guile modules
  78. if ( env | grep -v '^GUILE_SYSTEM_PATH=' > /dev/null ); then
  79. GUILE_SYSTEM_PATH=
  80. export GUILE_SYSTEM_PATH
  81. fi
  82. # Don't look in installed dirs for compiled guile modules
  83. if ( env | grep -v '^GUILE_SYSTEM_COMPILED_PATH=' > /dev/null ); then
  84. GUILE_SYSTEM_COMPILED_PATH=
  85. export GUILE_SYSTEM_COMPILED_PATH
  86. fi
  87. # Don't look in installed dirs for dlopen-able modules
  88. if ( env | grep -v '^GUILE_SYSTEM_EXTENSIONS_PATH=' > /dev/null ); then
  89. GUILE_SYSTEM_EXTENSIONS_PATH=
  90. export GUILE_SYSTEM_EXTENSIONS_PATH
  91. fi
  92. # handle LTDL_LIBRARY_PATH (no clobber)
  93. for dir in $subdirs_with_ltlibs ; do
  94. if test -z "$LTDL_LIBRARY_PATH"; then
  95. LTDL_LIBRARY_PATH="${top_builddir}/${dir}"
  96. else
  97. LTDL_LIBRARY_PATH="${top_builddir}/${dir}:${LTDL_LIBRARY_PATH}"
  98. fi
  99. if test -z "$DYLD_LIBRARY_PATH"; then
  100. DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs"
  101. else
  102. DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs:${DYLD_LIBRARY_PATH}"
  103. fi
  104. done
  105. export LTDL_LIBRARY_PATH
  106. export DYLD_LIBRARY_PATH
  107. if [ x"$PKG_CONFIG_PATH" = x ]
  108. then
  109. PKG_CONFIG_PATH="${top_builddir}/meta"
  110. else
  111. PKG_CONFIG_PATH="${top_builddir}/meta:$PKG_CONFIG_PATH"
  112. fi
  113. export PKG_CONFIG_PATH
  114. # handle PATH (no clobber)
  115. PATH="${top_builddir}/libguile:${PATH}"
  116. PATH="${top_srcdir}/meta:${PATH}"
  117. if test "x${top_srcdir}" != "x${top_builddir}"; then
  118. PATH="${top_builddir}/meta:${PATH}"
  119. fi
  120. export PATH
  121. exec "$@"