*** empty log message ***
[bpt/guile.git] / pre-inst-guile.in
CommitLineData
99d8f2d5
TTN
1#!/bin/sh
2
3# Copyright (C) 2002 Free Software Foundation
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
19# to the Free Software Foundation, Inc., 59 Temple Place, Suite
20# 330, Boston, MA 02111-1307 USA
21
22# Commentary:
23
24# Usage: pre-inst-guile [ARGS]
25#
26# This script arranges for the environment to support, and eventaully execs,
27# the uninstalled binary guile executable located somewhere under libguile/,
28# passing ARGS to it. In the process, env var GUILE is clobbered, and the
29# following env vars are modified (but not clobbered):
30# GUILE_LOAD_PATH
ec99391a 31# LTDL_LIBRARY_PATH
99d8f2d5
TTN
32#
33# This script can be used as a drop-in replacement for $bindir/guile;
34# if there is a discrepency in behavior, that's a bug.
35
36# Code:
37
38# config
39subdirs_with_ltlibs="srfi guile-readline" # maintain me
40
41# env (set by configure)
ce8b584c 42top_srcdir="@top_srcdir_absolute@"
99d8f2d5
TTN
43top_builddir="@top_builddir_absolute@"
44
45[ x"$top_srcdir" = x -o ! -d "$top_srcdir" -o \
46 x"$top_builddir" = x -o ! -d "$top_builddir" ] && {
47 echo $0: bad environment
48 echo top_srcdir=$top_srcdir
49 echo top_builddir=$top_builddir
50 exit 1
51}
52
53# handle GUILE_LOAD_PATH (no clobber)
54if [ x"$GUILE_LOAD_PATH" = x ] ; then
55 GUILE_LOAD_PATH="${top_srcdir}"
56else
57 # This hair prevents double inclusion.
58 # The ":" prevents prefix aliasing.
59 case x"$GUILE_LOAD_PATH" in x*${top_srcdir}:*) ;;
60 *) GUILE_LOAD_PATH="${top_srcdir}:$GUILE_LOAD_PATH" ;;
61 esac
62fi
63export GUILE_LOAD_PATH
64
65# handle LTDL_LIBRARY_PATH (no clobber)
66ltdl_prefix=""
67for dir in $subdirs_with_ltlibs ; do
68 ltdl_prefix="${top_builddir}/${dir}:${ltdl_prefix}"
69done
70LTDL_LIBRARY_PATH="${ltdl_prefix}$LTDL_LIBRARY_PATH"
71export LTDL_LIBRARY_PATH
72
73# set GUILE (clobber)
74GUILE=${top_builddir}/libguile/guile
75export GUILE
76
77# do it
78exec $GUILE "$@"
79
80# never reached
81exit 1
82
83# pre-inst-guile ends here