Minor fix for compatibility with Ruby versions that don't understand
[mailvisa.git] / configure
bloba2e7527f32273db19f706bcb83c5380a5584489b
1 #! /bin/sh
3 usage=`cat` <<EOT
4 USAGE: $0 [options]
6 Valid options are:
8 --prefix <path>
9 Set the installation prefix to <path>.
10 --bindir <path>
11 Set the installation directory for binaries to <path>.
12 --datadir <path>
13 Set the installation directory for data to <path>.
14 --mandir <path>
15 Set the installation directory for manpages to <path>.
16 --ruby <path>
17 Use the ruby interpreter specified by <path>
18 EOT
20 ## Process command line
21 while [ $# -gt 0 ]
23 arg="$1"
24 case "$arg" in
25 --prefix)
26 shift
27 PREFIX="$1"
29 --bindir)
30 shift
31 bindir="$1"
33 --datadir)
34 shift
35 datadir="$1"
37 --mandir)
38 shift
39 mandir="$1"
41 --ruby)
42 shift
43 RUBY="$1"
45 --help)
46 echo "$usage"
47 exit
50 echo "Invalid option: $arg" >&2
51 echo "$usage" >&2
52 exit 128
54 esac
55 shift
56 done
58 ## Defaults
59 [ -n "$PREFIX" ] || PREFIX=/usr/local
60 [ -n "$bindir" ] || bindir='${PREFIX}/bin'
61 [ -n "$datadir" ] || datadir='${PREFIX}/share'
62 [ -n "$mandir" ] || mandir='${PREFIX}/man'
63 [ -n "$RUBY" ] || RUBY=`which ruby` || RUBY=${bindir}/ruby
65 ## Test that a ruby interpreter has been found
66 if [ \! -x "$RUBY" ]
67 then
68 cat <<EOT >&2
69 No Ruby interpreter found. You may need to install ruby, or specify
70 the path to ruby with the --ruby command line option.
71 EOT
72 exit 1
75 ## Display summary
76 cat <<EOT
77 Installation prefix: $PREFIX
78 Install binaries to: $bindir
79 Install data files to: $datadir
80 Install manpages to: $mandir
81 Use Ruby interpreter: $RUBY
82 EOT
84 ## Write Makefile.cfg
85 cat <<EOT > Makefile.cfg
86 RUBY ?= $RUBY
88 PREFIX ?= $PREFIX
89 bindir ?= $bindir
90 datadir ?= $datadir
91 mandir ?= $mandir
93 TRUEPREFIX ?= $PREFIX
94 truebindir ?= $bindir
95 truedatadir ?= $datadir
96 truemandir ?= $mandir
97 EOT
99 ## All done
100 echo
101 echo "Run make to build Mailvisa"