added more thorough testing of expressions
[voodoo-lang.git] / configure
blob823158b24b33ffbe859bbf133509fa1a43477870
1 #! /bin/sh
3 usage="USAGE: configure [--prefix <path>]"
4 help="Valid options are:
6 --default-architecture <architecture>
7 Set the default architecture (default: autodetected)
9 --default-format <format>
10 Set the default output format (default: elf)
12 --prefix <path>
13 Install to <path> (default: /usr/local)
16 VERSION=`cat VERSION`
19 # Process command line
21 while [ $# -gt 0 ]
23 case "$1" in
24 --help)
25 echo "$usage"
26 echo "$help"
27 exit
29 --default-architecture)
30 shift
31 DEFAULT_ARCHITECTURE="$1"
33 --default-format)
34 shift
35 DEFAULT_FORMAT="$1"
37 --prefix)
38 shift
39 PREFIX="$1"
41 -*)
42 echo "Invalid option: $1" >&2
43 exit 128
46 echo "Invalid argument: $1" >&2
47 exit 128
48 esac
49 shift
50 done
53 # Defaults
55 [ -n "$PREFIX" ] || PREFIX=/usr/local
56 [ -n "$BINDIR" ] || BINDIR="\$(PREFIX)/bin"
57 [ -n "$DOCDIR" ] || DOCDIR="\$(PREFIX)/share/doc"
58 [ -n "$MANDIR" ] || MANDIR="\$(PREFIX)/share/man"
59 [ -n "$RUBYLIBDIR" ] || RUBYLIBDIR="\$(PREFIX)/lib/site_ruby"
61 [ -n "$DEFAULT_ARCHITECTURE" ] || DEFAULT_ARCHITECTURE=auto
62 [ -n "$DEFAULT_FORMAT" ] || DEFAULT_FORMAT=elf
64 printf 'Testing for ruby...'
65 [ -n "$RUBY" ] || RUBY=`which ruby 2>/dev/null`
66 if [ $? -eq 0 ]
67 then
68 echo $RUBY
69 else
70 echo "not found"
71 cat <<EOT
72 WARNING: Ruby interpreter not found. You need a Ruby interpreter to
73 run the voodooc compiler.
75 EOT
78 printf 'Testing for nasm...'
79 [ -n "$NASM" ] || NASM=`which nasm 2>/dev/null` || NASM=`which yasm 2>/dev/null`
80 if [ $? -eq 0 ]
81 then
82 echo $NASM
83 else
84 echo "not found"
85 cat <<EOT
86 WARNING: NASM not found. You need NASM to create i386 object code.
88 EOT
91 printf 'Testing for GNU assembler...'
92 if [ -z "$GAS" ]
93 then
94 for x in gas as
96 GAS=`which "$x"` 2>/dev/null
97 if [ $? -eq 0 ]
98 then
99 # Found an executable that has the right name;
100 # test if it is really the GNU assembler
101 output=`$GAS --version < /dev/null 2>&1`
102 if echo "$output" | grep -q '^GNU assembler'
103 then
104 # Yes, it is the GNU assembler
105 true
106 else
107 # Not the GNU assembler, continue the search
108 unset GAS
111 [ -z "$GAS" ] || break
112 done
115 if [ -n "$GAS" ]
116 then
117 echo $GAS
118 else
119 echo "not found"
120 cat <<EOT
121 WARNING: GNU assembler not found. You need the GNU assembler to create
122 mips or mipsel object code.
127 printf 'Testing for rdoc...'
128 [ -n "$RDOC" ] || RDOC=`which rdoc 2>/dev/null`
129 if [ $? -eq 0 ]
130 then
131 echo $RDOC
132 else
133 echo "not found"
134 cat <<EOT
135 WARNING: rdoc not found. You need rdoc to generate API documentation
136 from the library files.
141 printf 'Testing for gem...'
142 [ -n "$GEM" ] || GEM=`which gem 2>/dev/null`
143 if [ $? -eq 0 ]
144 then
145 echo $GEM
146 else
147 echo "not found"
148 cat <<EOT
149 WARNING: RubyGems gem command not found. You need the gem command to
150 create gems.
155 printf 'Writing Makefile.cfg...'
156 cat <<EOF > Makefile.cfg
157 VERSION = $VERSION
159 DEFAULT_ARCHITECTURE = $DEFAULT_ARCHITECTURE
160 DEFAULT_FORMAT = $DEFAULT_FORMAT
162 PREFIX = $PREFIX
163 BINDIR = $BINDIR
164 DOCDIR = $DOCDIR
165 MANDIR = $MANDIR
166 RUBYLIBDIR = $RUBYLIBDIR
168 GAS = $GAS
169 GEM = $GEM
170 NASM = $NASM
171 RDOC = $RDOC
172 RUBY = $RUBY
174 if [ $? -eq 0 ]
175 then
176 echo 'done'
177 echo ''
178 cat Makefile.cfg