fix some missed references when calling C functions
[bpt/guile.git] / pre-inst-guile-env.in
CommitLineData
c8eb6d1f
RB
1#!/bin/sh
2
b226295a 3# Copyright (C) 2003, 2006, 2008 Free Software Foundation
c8eb6d1f
RB
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
92205699 19# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c8eb6d1f
RB
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
be52b55a 34subdirs_with_ltlibs="srfi guile-readline libguile" # maintain me
c8eb6d1f
RB
35
36# env (set by configure)
37top_srcdir="@top_srcdir_absolute@"
38top_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
4cacadc1
RB
48if [ x"$GUILE_LOAD_PATH" = x ]
49then
83495480
AW
50 if test "${top_srcdir}" != "${top_builddir}"; then
51 GUILE_LOAD_PATH="${top_builddir}/guile-readline:${top_srcdir}/guile-readline:${top_builddir}:${top_srcdir}:${top_builddir}/module:${top_srcdir}/module"
52 else
53 GUILE_LOAD_PATH="${top_srcdir}/guile-readline:${top_srcdir}:${top_builddir}/module:${top_srcdir}/module"
54 fi
c8eb6d1f 55else
83495480
AW
56 for d in "${top_srcdir}" "${top_srcdir}/guile-readline" \
57 "${top_srcdir}/module" "${top_builddir}/module"
4cacadc1 58 do
c8eb6d1f
RB
59 # This hair prevents double inclusion.
60 # The ":" prevents prefix aliasing.
4cacadc1
RB
61 case x"$GUILE_LOAD_PATH" in
62 x*${d}:*) ;;
63 *) GUILE_LOAD_PATH="${d}:$GUILE_LOAD_PATH" ;;
c8eb6d1f 64 esac
4cacadc1 65 done
c8eb6d1f
RB
66fi
67export GUILE_LOAD_PATH
68
02b84691
AW
69# Don't look in installed dirs for guile modules
70if ( env | grep -v -q -E '^GUILE_SYSTEM_PATH=' ); then
71 export GUILE_SYSTEM_PATH=
72fi
73
c8eb6d1f
RB
74# handle LTDL_LIBRARY_PATH (no clobber)
75ltdl_prefix=""
027e0e2c 76dyld_prefix=""
c8eb6d1f
RB
77for dir in $subdirs_with_ltlibs ; do
78 ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
027e0e2c 79 dyld_prefix="${top_builddir}/${dir}/.libs:${dyld_prefix}"
c8eb6d1f
RB
80done
81LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
82export LTDL_LIBRARY_PATH
027e0e2c
NJ
83DYLD_LIBRARY_PATH="${dyld_prefix}${top_builddir}/libguile/.libs:$DYLD_LIBRARY_PATH"
84export DYLD_LIBRARY_PATH
c8eb6d1f
RB
85
86# handle PATH (no clobber)
87PATH="${top_builddir}/guile-config:${PATH}"
88PATH="${top_builddir}/libguile:${PATH}"
89export PATH
90
91exec "$@"