Commit | Line | Data |
---|---|---|
c8eb6d1f RB |
1 | #!/bin/sh |
2 | ||
60904831 | 3 | # Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation |
c8eb6d1f RB |
4 | # |
5 | # This file is part of GUILE. | |
6 | # | |
53befeb7 NJ |
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. | |
c8eb6d1f RB |
11 | # |
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. | |
16 | # | |
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 | |
53befeb7 NJ |
19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
20 | # 02110-1301 USA | |
c8eb6d1f | 21 | |
0b6d8fdc | 22 | # NOTE: If you update this file, please update uninstalled.in as |
c8eb6d1f RB |
23 | # well, if appropriate. |
24 | ||
0b6d8fdc | 25 | # Usage: uninstalled-env [ARGS] |
c8eb6d1f RB |
26 | |
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. | |
30 | ||
0b6d8fdc AW |
31 | # Example: uninstalled-env guile -c '(display "hello\n")' |
32 | # Example: ../../uninstalled-env ./guile-test-foo | |
c8eb6d1f RB |
33 | |
34 | # config | |
60904831 | 35 | subdirs_with_ltlibs="guile-readline libguile" # maintain me |
c8eb6d1f RB |
36 | |
37 | # env (set by configure) | |
38 | top_srcdir="@top_srcdir_absolute@" | |
39 | top_builddir="@top_builddir_absolute@" | |
40 | ||
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 | |
46 | exit 1 | |
47 | } | |
48 | ||
4cacadc1 RB |
49 | if [ x"$GUILE_LOAD_PATH" = x ] |
50 | then | |
60904831 | 51 | GUILE_LOAD_PATH="${top_srcdir}/module:${top_srcdir}/guile-readline:${top_srcdir}" |
83495480 | 52 | if test "${top_srcdir}" != "${top_builddir}"; then |
60904831 | 53 | GUILE_LOAD_PATH="$GUILE_LOAD_PATH:${top_builddir}/module:${top_builddir}/guile-readline:${top_builddir}" |
83495480 | 54 | fi |
c8eb6d1f | 55 | else |
60904831 | 56 | for d in "/module" "/guile-readline" "" |
4cacadc1 | 57 | do |
c8eb6d1f RB |
58 | # This hair prevents double inclusion. |
59 | # The ":" prevents prefix aliasing. | |
4cacadc1 | 60 | case x"$GUILE_LOAD_PATH" in |
8c4e90fa | 61 | x*${top_srcdir}${d}:*) ;; |
1c8a6308 | 62 | x*${top_srcdir}${d}) ;; |
8c4e90fa AW |
63 | *) GUILE_LOAD_PATH="${top_srcdir}${d}:$GUILE_LOAD_PATH" ;; |
64 | esac | |
65 | case x"$GUILE_LOAD_PATH" in | |
66 | x*${top_builddir}${d}:*) ;; | |
1c8a6308 | 67 | x*${top_builddir}${d}) ;; |
8c4e90fa | 68 | *) GUILE_LOAD_PATH="${top_builddir}${d}:$GUILE_LOAD_PATH" ;; |
c8eb6d1f | 69 | esac |
4cacadc1 | 70 | done |
c8eb6d1f RB |
71 | fi |
72 | export GUILE_LOAD_PATH | |
73 | ||
d1e47c6e AW |
74 | if [ x"$GUILE_LOAD_COMPILED_PATH" = x ] |
75 | then | |
60904831 | 76 | GUILE_LOAD_COMPILED_PATH="${top_builddir}/module:${top_builddir}/guile-readline:${top_builddir}" |
d1e47c6e | 77 | else |
60904831 | 78 | for d in "/module" "/guile-readline" "" |
d1e47c6e AW |
79 | do |
80 | # This hair prevents double inclusion. | |
81 | # The ":" prevents prefix aliasing. | |
82 | case x"$GUILE_LOAD_COMPILED_PATH" in | |
8c4e90fa | 83 | x*${top_builddir}${d}:*) ;; |
1c8a6308 | 84 | x*${top_builddir}${d}) ;; |
8c4e90fa | 85 | *) GUILE_LOAD_COMPILED_PATH="${top_builddir}${d}:$GUILE_LOAD_COMPILED_PATH" ;; |
d1e47c6e AW |
86 | esac |
87 | done | |
88 | fi | |
89 | export GUILE_LOAD_COMPILED_PATH | |
90 | ||
02b84691 | 91 | # Don't look in installed dirs for guile modules |
875b58d2 AW |
92 | if ( env | grep -v '^GUILE_SYSTEM_PATH=' > /dev/null ); then |
93 | GUILE_SYSTEM_PATH= | |
94 | export GUILE_SYSTEM_PATH | |
95 | fi | |
8c4e90fa | 96 | # Don't look in installed dirs for compiled guile modules |
66e18d1c LC |
97 | if ( env | grep -v '^GUILE_SYSTEM_COMPILED_PATH=' > /dev/null ); then |
98 | GUILE_SYSTEM_COMPILED_PATH= | |
99 | export GUILE_SYSTEM_COMPILED_PATH | |
02b84691 | 100 | fi |
eb350124 | 101 | # Don't look in installed dirs for dlopen-able modules |
66e18d1c LC |
102 | if ( env | grep -v '^GUILE_SYSTEM_EXTENSIONS_PATH=' > /dev/null ); then |
103 | GUILE_SYSTEM_EXTENSIONS_PATH= | |
104 | export GUILE_SYSTEM_EXTENSIONS_PATH | |
eb350124 | 105 | fi |
02b84691 | 106 | |
c8eb6d1f | 107 | # handle LTDL_LIBRARY_PATH (no clobber) |
c8eb6d1f | 108 | for dir in $subdirs_with_ltlibs ; do |
070d8db0 AW |
109 | if test -z "$LTDL_LIBRARY_PATH"; then |
110 | LTDL_LIBRARY_PATH="${top_builddir}/${dir}" | |
111 | else | |
112 | LTDL_LIBRARY_PATH="${top_builddir}/${dir}:${LTDL_LIBRARY_PATH}" | |
113 | fi | |
114 | if test -z "$DYLD_LIBRARY_PATH"; then | |
115 | DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs" | |
116 | else | |
117 | DYLD_LIBRARY_PATH="${top_builddir}/${dir}/.libs:${DYLD_LIBRARY_PATH}" | |
118 | fi | |
c8eb6d1f | 119 | done |
c8eb6d1f | 120 | export LTDL_LIBRARY_PATH |
027e0e2c | 121 | export DYLD_LIBRARY_PATH |
c8eb6d1f | 122 | |
0b6d8fdc AW |
123 | if [ x"$PKG_CONFIG_PATH" = x ] |
124 | then | |
275baf01 | 125 | PKG_CONFIG_PATH="${top_builddir}/meta" |
0b6d8fdc | 126 | else |
275baf01 | 127 | PKG_CONFIG_PATH="${top_builddir}/meta:$PKG_CONFIG_PATH" |
0b6d8fdc AW |
128 | fi |
129 | export PKG_CONFIG_PATH | |
130 | ||
c8eb6d1f | 131 | # handle PATH (no clobber) |
c8eb6d1f | 132 | PATH="${top_builddir}/libguile:${PATH}" |
d4876cb4 | 133 | PATH="${top_srcdir}/meta:${PATH}" |
d8e1bce4 | 134 | if test "x${top_srcdir}" != "x${top_builddir}"; then |
070d8db0 AW |
135 | PATH="${top_builddir}/meta:${PATH}" |
136 | fi | |
c8eb6d1f RB |
137 | export PATH |
138 | ||
f4b7d918 LC |
139 | # Define $GUILE, used by `guild'. |
140 | GUILE="${top_builddir}/meta/guile" | |
141 | export GUILE | |
142 | ||
c8eb6d1f | 143 | exec "$@" |