3 # Copyright (C) 2001, 2003, 2006, 2008 Free Software Foundation, Inc.
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.
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.
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., 51 Franklin Street, Fifth Floor,
18 # Boston, MA 02110-1301 USA
20 # Usage: See `help' func below.
23 # - handle pre-install invocation
24 # - "full" option processing (but see comment below)
26 # Author: Thien-Thi Nguyen
31 Usage: guile-tools --version
33 guile-tools [OPTION] PROGRAM [ARGS]
35 If PROGRAM is "list" or omitted, display contents of scripts dir, otherwise
36 PROGRAM 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 --source -- Display PROGRAM source (ignore ARGS) to stdout
41 Default scripts dir: $default_scriptsdir
46 datarootdir
="@datarootdir@"
47 pkgdatadir
="@datadir@/@PACKAGE@"
48 guileversion
="@GUILE_EFFECTIVE_VERSION@"
49 default_scriptsdir
=$pkgdatadir/$guileversion/scripts
51 top_srcdir
="@top_srcdir_absolute@"
52 top_builddir
="@top_builddir_absolute@"
54 # pre-install invocation frob
55 mydir
=$
(cd $
(dirname $0) && pwd)
56 if [ "$mydir" = "$top_builddir" ] ; then
57 default_scriptsdir
=$top_srcdir/scripts
60 # option processing -- basically, you can override either the script dir
61 # completely, or just the guile version. we choose implementation simplicity
75 if [ x
"$1" = x--scriptsdir
] ; then
79 elif [ x
"$1" = x--guileversion
] ; then
80 user_scriptsdir
=$pkgdatadir/$2/scripts
85 scriptsdir
=${user_scriptsdir-$default_scriptsdir}
87 if [ ! -d $scriptsdir ] ; then
88 echo $0: no such directory
: $scriptsdir
92 if [ x
"$1" = x
-o x
"$1" = xlist
] ; then
97 if [ x
"$1" = x--source
] ; then
98 if [ x
"$2" = x
] ; then echo $0: need to specify program
; exit 1 ; fi
99 if [ -x $scriptsdir/$2 ] ; then
103 echo $0: no such program
: $2
108 program
=$scriptsdir/$1
111 if [ -x $program ] ; then
114 echo $0: no such program
: $program
118 # guile-tools ends here