* convert.c: include <string.h> for convert_i.c.
[bpt/guile.git] / guile-tools.in
CommitLineData
7e1cd073
TTN
1#!/bin/sh
2
3# Copyright (C) 2001 Free Software Foundation, Inc.
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License as
7# published by the Free Software Foundation; either version 2, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this software; see the file COPYING. If not, write to
17# the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18# Boston, MA 02111-1307 USA
19
de057fdc 20# Usage: See `help' func below.
7e1cd073
TTN
21#
22# TODO
23# - handle pre-install invocation
24# - "full" option processing (but see comment below)
25#
26# Author: Thien-Thi Nguyen
27
de057fdc
TTN
28help ()
29{
30 cat <<EOF
31Usage: guile-tools --version
32 guile-tools --help
33 guile-tools [OPTION] PROGRAM [ARGS]
34
35If PROGRAM is "list" or omitted, display contents of scripts dir, otherwise
36PROGRAM is run w/ ARGS. Options (only one of which may be used at a time):
37 --scriptsdir DIR -- Look in DIR for scripts
38 --guileversion VERS -- Look in $pkgdatadir/VERS/scripts for scripts
39
40Default scripts dir: $default_scriptsdir
41EOF
42}
43
7e1cd073
TTN
44prefix="@prefix@"
45pkgdatadir="@datadir@/@PACKAGE@"
46guileversion="@GUILE_VERSION@"
47default_scriptsdir=$pkgdatadir/$guileversion/scripts
48
49# pre-install invocation frob
50mydir=`dirname $0`
51if [ -d "$mydir/scripts" -a -f "$mydir/scripts/Makefile.am" ] ; then
52 default_scriptsdir=`(cd $mydir/scripts ; pwd)`
53fi
54
7e1cd073
TTN
55# option processing -- basically, you can override either the script dir
56# completely, or just the guile version. we choose implementation simplicity
57# over orthogonality.
58
de057fdc
TTN
59case x"$1" in
60x--version)
7e1cd073
TTN
61 echo $0 $guileversion
62 exit 0
de057fdc
TTN
63 ;;
64x--help)
7e1cd073
TTN
65 help
66 exit 0
de057fdc
TTN
67 ;;
68esac
7e1cd073
TTN
69
70if [ x"$1" = x--scriptsdir ] ; then
71 user_scriptsdir=$2
72 shift
73 shift
74elif [ x"$1" = x--guileversion ] ; then
75 user_scriptsdir=$pkgdatadir/$2/scripts
76 shift
77 shift
78fi
79
80scriptsdir=${user_scriptsdir-$default_scriptsdir}
81
82if [ ! -d $scriptsdir ] ; then
83 echo $0: no such directory: $scriptsdir
84 exit 1
85fi
86
de057fdc
TTN
87if [ x"$1" = x -o x"$1" = xlist ] ; then
88 ls $scriptsdir
89 exit 0
7e1cd073
TTN
90fi
91
92program=$scriptsdir/$1
93shift
94
95if [ -x $program ] ; then
96 exec $program "$@"
97else
98 echo $0: no such program: $program
99 exit 1
100fi
101
102# guile-tools ends here