Add NEWS and concept index entries for traps infrastructure and Emacs support.
[bpt/guile.git] / pre-inst-guile.in
CommitLineData
99d8f2d5
TTN
1#!/bin/sh
2
b226295a 3# Copyright (C) 2002, 2006, 2008 Free Software Foundation
99d8f2d5
TTN
4#
5# This file is part of GUILE.
6#
7# GUILE is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as
9# published by the Free Software Foundation; either version 2, or
10# (at your option) any later version.
11#
12# GUILE is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public
18# License along with GUILE; see the file COPYING. If not, write
92205699
MV
19# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
20# Floor, Boston, MA 02110-1301 USA
99d8f2d5 21
07921c76
RB
22# NOTE: at some point we might consider invoking this under
23# pre-inst-guile-env. If this will work, then most of the code below
24# can be removed.
25
26# NOTE: If you update this file, please update pre-inst-guile-env.in
27# as well, if appropriate.
28
99d8f2d5
TTN
29# Commentary:
30
31# Usage: pre-inst-guile [ARGS]
32#
33# This script arranges for the environment to support, and eventaully execs,
34# the uninstalled binary guile executable located somewhere under libguile/,
35# passing ARGS to it. In the process, env var GUILE is clobbered, and the
36# following env vars are modified (but not clobbered):
37# GUILE_LOAD_PATH
ec99391a 38# LTDL_LIBRARY_PATH
99d8f2d5
TTN
39#
40# This script can be used as a drop-in replacement for $bindir/guile;
41# if there is a discrepency in behavior, that's a bug.
42
43# Code:
44
45# config
6f0579c2 46subdirs_with_ltlibs="srfi guile-readline libguile" # maintain me
99d8f2d5
TTN
47
48# env (set by configure)
ce8b584c 49top_srcdir="@top_srcdir_absolute@"
99d8f2d5
TTN
50top_builddir="@top_builddir_absolute@"
51
52[ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
53 x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
54 echo $0: bad environment
55 echo top_srcdir=$top_srcdir
56 echo top_builddir=$top_builddir
57 exit 1
58}
59
60# handle GUILE_LOAD_PATH (no clobber)
4cacadc1
RB
61if [ x"$GUILE_LOAD_PATH" = x ]
62then
63 GUILE_LOAD_PATH="${top_srcdir}/guile-readline:${top_srcdir}"
99d8f2d5 64else
4cacadc1
RB
65 for d in "${top_srcdir}" "${top_srcdir}/guile-readline"
66 do
99d8f2d5
TTN
67 # This hair prevents double inclusion.
68 # The ":" prevents prefix aliasing.
4cacadc1
RB
69 case x"$GUILE_LOAD_PATH" in
70 x*${d}:*) ;;
71 *) GUILE_LOAD_PATH="${d}:$GUILE_LOAD_PATH" ;;
99d8f2d5 72 esac
4cacadc1 73 done
99d8f2d5
TTN
74fi
75export GUILE_LOAD_PATH
76
77# handle LTDL_LIBRARY_PATH (no clobber)
78ltdl_prefix=""
027e0e2c 79dyld_prefix=""
99d8f2d5
TTN
80for dir in $subdirs_with_ltlibs ; do
81 ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
027e0e2c 82 dyld_prefix="${top_builddir}/${dir}/.libs:${dyld_prefix}"
99d8f2d5
TTN
83done
84LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
85export LTDL_LIBRARY_PATH
027e0e2c
NJ
86DYLD_LIBRARY_PATH="${dyld_prefix}${top_builddir}/libguile/.libs:$DYLD_LIBRARY_PATH"
87export DYLD_LIBRARY_PATH
99d8f2d5
TTN
88
89# set GUILE (clobber)
90GUILE=${top_builddir}/libguile/guile
91export GUILE
92
93# do it
94exec $GUILE "$@"
95
96# never reached
97exit 1
98
99# pre-inst-guile ends here