3 # Copyright (C) 2003, 2006, 2008, 2009, 2010 Free Software Foundation
5 # This file is part of GUILE.
7 # This script is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 3 of the
10 # License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # NOTE: If you update this file, please update uninstalled.in as
23 # well, if appropriate.
25 # Usage: uninstalled-env [ARGS]
27 # This script arranges for the environment to support running Guile
28 # from the build tree. The following env vars are modified (but not
29 # clobbered): GUILE_LOAD_PATH, LTDL_LIBRARY_PATH, and PATH.
31 # Example: uninstalled-env guile -c '(display "hello\n")'
32 # Example: ../../uninstalled-env ./guile-test-foo
35 subdirs_with_ltlibs
="srfi guile-readline libguile" # maintain me
37 # env (set by configure)
38 top_srcdir
="@top_srcdir_absolute@"
39 top_builddir
="@top_builddir_absolute@"
41 [ x
"$top_srcdir" = x
-o ! -d "$top_srcdir" -o \
42 x
"$top_builddir" = x
-o ! -d "$top_builddir" ] && {
43 echo $0: bad environment
44 echo top_srcdir
=$top_srcdir
45 echo top_builddir
=$top_builddir
49 if [ x
"$GUILE_LOAD_PATH" = x
]
51 GUILE_LOAD_PATH
="${top_srcdir}/module:${top_srcdir}:${top_srcdir}/guile-readline"
52 if test "${top_srcdir}" != "${top_builddir}"; then
53 GUILE_LOAD_PATH
="$GUILE_LOAD_PATH:${top_builddir}/module:${top_builddir}:${top_builddir}/guile-readline"
56 for d
in "/module" "" "/guile-readline"
58 # This hair prevents double inclusion.
59 # The ":" prevents prefix aliasing.
60 case x
"$GUILE_LOAD_PATH" in
61 x
*${top_srcdir}${d}:*) ;;
62 *) GUILE_LOAD_PATH
="${top_srcdir}${d}:$GUILE_LOAD_PATH" ;;
64 case x
"$GUILE_LOAD_PATH" in
65 x
*${top_builddir}${d}:*) ;;
66 *) GUILE_LOAD_PATH
="${top_builddir}${d}:$GUILE_LOAD_PATH" ;;
70 export GUILE_LOAD_PATH
72 if [ x
"$GUILE_LOAD_COMPILED_PATH" = x
]
74 GUILE_LOAD_COMPILED_PATH
="${top_builddir}/module:${top_builddir}:${top_builddir}/guile-readline"
76 for d
in "/module" "" "/guile-readline"
78 # This hair prevents double inclusion.
79 # The ":" prevents prefix aliasing.
80 case x
"$GUILE_LOAD_COMPILED_PATH" in
81 x
*${top_builddir}${d}:*) ;;
82 *) GUILE_LOAD_COMPILED_PATH
="${top_builddir}${d}:$GUILE_LOAD_COMPILED_PATH" ;;
86 export GUILE_LOAD_COMPILED_PATH
88 # Don't look in installed dirs for guile modules
89 if ( env |
grep -v '^GUILE_SYSTEM_PATH=' > /dev
/null
); then
91 export GUILE_SYSTEM_PATH
93 # Don't look in installed dirs for compiled guile modules
94 if ( env |
grep -v '^GUILE_SYSTEM_COMPILED_PATH=' > /dev
/null
); then
95 GUILE_SYSTEM_COMPILED_PATH
=
96 export GUILE_SYSTEM_COMPILED_PATH
98 # Don't look in installed dirs for dlopen-able modules
99 if ( env |
grep -v '^GUILE_SYSTEM_EXTENSIONS_PATH=' > /dev
/null
); then
100 GUILE_SYSTEM_EXTENSIONS_PATH
=
101 export GUILE_SYSTEM_EXTENSIONS_PATH
104 # handle LTDL_LIBRARY_PATH (no clobber)
105 for dir
in $subdirs_with_ltlibs ; do
106 if test -z "$LTDL_LIBRARY_PATH"; then
107 LTDL_LIBRARY_PATH
="${top_builddir}/${dir}"
109 LTDL_LIBRARY_PATH
="${top_builddir}/${dir}:${LTDL_LIBRARY_PATH}"
111 if test -z "$DYLD_LIBRARY_PATH"; then
112 DYLD_LIBRARY_PATH
="${top_builddir}/${dir}/.libs"
114 DYLD_LIBRARY_PATH
="${top_builddir}/${dir}/.libs:${DYLD_LIBRARY_PATH}"
117 export LTDL_LIBRARY_PATH
118 export DYLD_LIBRARY_PATH
120 if [ x
"$PKG_CONFIG_PATH" = x
]
122 PKG_CONFIG_PATH
="${top_builddir}/meta"
124 PKG_CONFIG_PATH
="${top_builddir}/meta:$PKG_CONFIG_PATH"
126 export PKG_CONFIG_PATH
128 # handle PATH (no clobber)
129 PATH
="${top_builddir}/libguile:${PATH}"
130 PATH
="${top_srcdir}/meta:${PATH}"
131 if "x${top_srcdir}" != "x${top_builddir}"; then
132 PATH
="${top_builddir}/meta:${PATH}"