uninstalled-env.in 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/bin/sh
  2. # Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 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="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}/guile-readline:${top_srcdir}"
  43. if test "${top_srcdir}" != "${top_builddir}"; then
  44. GUILE_LOAD_PATH="$GUILE_LOAD_PATH:${top_builddir}/module:${top_builddir}/guile-readline:${top_builddir}"
  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. x*${top_srcdir}${d}) ;;
  54. *) GUILE_LOAD_PATH="${top_srcdir}${d}:$GUILE_LOAD_PATH" ;;
  55. esac
  56. case x"$GUILE_LOAD_PATH" in
  57. x*${top_builddir}${d}:*) ;;
  58. x*${top_builddir}${d}) ;;
  59. *) GUILE_LOAD_PATH="${top_builddir}${d}:$GUILE_LOAD_PATH" ;;
  60. esac
  61. done
  62. fi
  63. export GUILE_LOAD_PATH
  64. if [ x"$GUILE_LOAD_COMPILED_PATH" = x ]
  65. then
  66. GUILE_LOAD_COMPILED_PATH="${top_builddir}/module:${top_builddir}/guile-readline:${top_builddir}"
  67. else
  68. for d in "/module" "/guile-readline" ""
  69. do
  70. # This hair prevents double inclusion.
  71. # The ":" prevents prefix aliasing.
  72. case x"$GUILE_LOAD_COMPILED_PATH" in
  73. x*${top_builddir}${d}:*) ;;
  74. x*${top_builddir}${d}) ;;
  75. *) GUILE_LOAD_COMPILED_PATH="${top_builddir}${d}:$GUILE_LOAD_COMPILED_PATH" ;;
  76. esac
  77. done
  78. fi
  79. export GUILE_LOAD_COMPILED_PATH
  80. # Don't look in installed dirs for guile modules
  81. if ( env | grep -v '^GUILE_SYSTEM_PATH=' > /dev/null ); then
  82. GUILE_SYSTEM_PATH=
  83. export GUILE_SYSTEM_PATH
  84. fi
  85. # Don't look in installed dirs for compiled guile modules
  86. if ( env | grep -v '^GUILE_SYSTEM_COMPILED_PATH=' > /dev/null ); then
  87. GUILE_SYSTEM_COMPILED_PATH=
  88. export GUILE_SYSTEM_COMPILED_PATH
  89. fi
  90. # Don't look in installed dirs for dlopen-able modules
  91. if ( env | grep -v '^GUILE_SYSTEM_EXTENSIONS_PATH=' > /dev/null ); then
  92. GUILE_SYSTEM_EXTENSIONS_PATH=
  93. export GUILE_SYSTEM_EXTENSIONS_PATH
  94. fi
  95. # handle LTDL_LIBRARY_PATH (no clobber)
  96. for dir in $subdirs_with_ltlibs ; do
  97. if test -z "$LTDL_LIBRARY_PATH"; then
  98. LTDL_LIBRARY_PATH="${top_builddir}/${dir}"
  99. else
  100. LTDL_LIBRARY_PATH="${top_builddir}/${dir}:${LTDL_LIBRARY_PATH}"
  101. fi
  102. if test -z "$DYLD_LIBRARY_PATH"; then
  103. DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs"
  104. else
  105. DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs:${DYLD_LIBRARY_PATH}"
  106. fi
  107. done
  108. export LTDL_LIBRARY_PATH
  109. export DYLD_LIBRARY_PATH
  110. if [ x"$PKG_CONFIG_PATH" = x ]
  111. then
  112. PKG_CONFIG_PATH="${top_builddir}/meta"
  113. else
  114. PKG_CONFIG_PATH="${top_builddir}/meta:$PKG_CONFIG_PATH"
  115. fi
  116. export PKG_CONFIG_PATH
  117. # handle PATH (no clobber)
  118. PATH="${top_builddir}/libguile:${PATH}"
  119. PATH="${top_srcdir}/meta:${PATH}"
  120. if test "x${top_srcdir}" != "x${top_builddir}"; then
  121. PATH="${top_builddir}/meta:${PATH}"
  122. fi
  123. export PATH
  124. exec "$@"