*** empty log message ***
[bpt/guile.git] / pre-inst-guile-env.in
1 #!/bin/sh
2
3 # Copyright (C) 2003 Free Software Foundation
4 #
5 # This file is part of GUILE.
6 #
7 # This script is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
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
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21 # NOTE: If you update this file, please update pre-inst-guile.in as
22 # well, if appropriate.
23
24 # Usage: pre-inst-guile-env [ARGS]
25
26 # This script arranges for the environment to support running Guile
27 # from the build tree. The following env vars are modified (but not
28 # clobbered): GUILE_LOAD_PATH, LTDL_LIBRARY_PATH, and PATH.
29
30 # Example: pre-inst-guile-env guile -c '(display "hello\n")'
31 # Example: ../../pre-inst-guile-env ./guile-test-foo
32
33 # config
34 subdirs_with_ltlibs="srfi guile-readline" # maintain me
35
36 # env (set by configure)
37 top_srcdir="@top_srcdir_absolute@"
38 top_builddir="@top_builddir_absolute@"
39
40 [ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
41 x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
42 echo $0: bad environment
43 echo top_srcdir=$top_srcdir
44 echo top_builddir=$top_builddir
45 exit 1
46 }
47
48 # handle GUILE_LOAD_PATH (no clobber)
49 if [ x"$GUILE_LOAD_PATH" = x ] ; then
50 GUILE_LOAD_PATH="${top_srcdir}"
51 else
52 # This hair prevents double inclusion.
53 # The ":" prevents prefix aliasing.
54 case x"$GUILE_LOAD_PATH" in x*${top_srcdir}:*) ;;
55 *) GUILE_LOAD_PATH="${top_srcdir}:$GUILE_LOAD_PATH" ;;
56 esac
57 fi
58 export GUILE_LOAD_PATH
59
60 # handle LTDL_LIBRARY_PATH (no clobber)
61 ltdl_prefix=""
62 for dir in $subdirs_with_ltlibs ; do
63 ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
64 done
65 LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
66 export LTDL_LIBRARY_PATH
67
68 # handle PATH (no clobber)
69 PATH="${top_builddir}/guile-config:${PATH}"
70 PATH="${top_builddir}/libguile:${PATH}"
71 export PATH
72
73 exec "$@"