MipsGasGenerator: added support for tail calls.
[voodoo-lang.git] / configure
blob7edf0b069e7d33c1dabf5c7d5093943be73a45f3
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 if [ -z "$DEFAULT_ARCHITECTURE" ]
62 then
63 # Try to automagically configure the native architecture
64 arch=`uname -m`
65 case "$arch" in
66 amd64|x86_64)
67 DEFAULT_ARCHITECTURE=amd64
70 DEFAULT_ARCHITECTURE=i386
71 esac
73 [ -n "$DEFAULT_FORMAT" ] || DEFAULT_FORMAT=elf
75 printf 'Testing for ruby...'
76 [ -n "$RUBY" ] || RUBY=`which ruby 2>/dev/null`
77 if [ $? -eq 0 ]
78 then
79 echo $RUBY
80 else
81 echo "not found"
82 cat <<EOT
83 WARNING: Ruby interpreter not found. You need a Ruby interpreter to
84 run the voodooc compiler.
86 EOT
89 printf 'Testing for nasm...'
90 [ -n "$NASM" ] || NASM=`which nasm 2>/dev/null` || NASM=`which yasm 2>/dev/null`
91 if [ $? -eq 0 ]
92 then
93 echo $NASM
94 else
95 echo "not found"
96 cat <<EOT
97 WARNING: NASM not found. You need NASM to create i386 object code.
99 EOT
102 printf 'Testing for rdoc...'
103 [ -n "$RDOC" ] || RDOC=`which rdoc 2>/dev/null`
104 if [ $? -eq 0 ]
105 then
106 echo $RDOC
107 else
108 echo "not found"
109 cat <<EOT
110 WARNING: rdoc not found. You need rdoc to generate API documentation
111 from the library files.
116 printf 'Testing for gem...'
117 [ -n "$GEM" ] || GEM=`which gem 2>/dev/null`
118 if [ $? -eq 0 ]
119 then
120 echo $GEM
121 else
122 echo "not found"
123 cat <<EOT
124 WARNING: RubyGems gem command not found. You need the gem command to
125 create gems.
130 printf 'Writing Makefile.cfg...'
131 cat <<EOF > Makefile.cfg
132 VERSION = $VERSION
134 DEFAULT_ARCHITECTURE = $DEFAULT_ARCHITECTURE
135 DEFAULT_FORMAT = $DEFAULT_FORMAT
137 PREFIX = $PREFIX
138 BINDIR = $BINDIR
139 DOCDIR = $DOCDIR
140 MANDIR = $MANDIR
141 RUBYLIBDIR = $RUBYLIBDIR
143 GEM = $GEM
144 NASM = $NASM
145 RDOC = $RDOC
146 RUBY = $RUBY
148 if [ $? -eq 0 ]
149 then
150 echo 'done'
151 echo ''
152 cat Makefile.cfg