MIPSELFGenerator: added -KPIC to inform the assembler that we are
[voodoo-lang.git] / configure
blob2ef763edb5b5694dcc3657473c2afb116b1202fc
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 GNU assembler...'
103 if [ -z "$GAS" ]
104 then
105 for x in gas as
107 GAS=`which "$x"` 2>/dev/null
108 if [ $? -eq 0 ]
109 then
110 # Found an executable that has the right name;
111 # test if it is really the GNU assembler
112 output=`$GAS --version < /dev/null 2>&1`
113 if echo "$output" | grep -q '^GNU assembler'
114 then
115 # Yes, it is the GNU assembler
116 true
117 else
118 # Not the GNU assembler, continue the search
119 unset GAS
122 [ -z "$GAS" ] || break
123 done
126 if [ -n "$GAS" ]
127 then
128 echo $GAS
129 else
130 echo "not found"
131 cat <<EOT
132 WARNING: GNU assembler not found. You need the GNU assembler to create
133 mips or mipsel object code.
138 printf 'Testing for rdoc...'
139 [ -n "$RDOC" ] || RDOC=`which rdoc 2>/dev/null`
140 if [ $? -eq 0 ]
141 then
142 echo $RDOC
143 else
144 echo "not found"
145 cat <<EOT
146 WARNING: rdoc not found. You need rdoc to generate API documentation
147 from the library files.
152 printf 'Testing for gem...'
153 [ -n "$GEM" ] || GEM=`which gem 2>/dev/null`
154 if [ $? -eq 0 ]
155 then
156 echo $GEM
157 else
158 echo "not found"
159 cat <<EOT
160 WARNING: RubyGems gem command not found. You need the gem command to
161 create gems.
166 printf 'Writing Makefile.cfg...'
167 cat <<EOF > Makefile.cfg
168 VERSION = $VERSION
170 DEFAULT_ARCHITECTURE = $DEFAULT_ARCHITECTURE
171 DEFAULT_FORMAT = $DEFAULT_FORMAT
173 PREFIX = $PREFIX
174 BINDIR = $BINDIR
175 DOCDIR = $DOCDIR
176 MANDIR = $MANDIR
177 RUBYLIBDIR = $RUBYLIBDIR
179 GAS = $GAS
180 GEM = $GEM
181 NASM = $NASM
182 RDOC = $RDOC
183 RUBY = $RUBY
185 if [ $? -eq 0 ]
186 then
187 echo 'done'
188 echo ''
189 cat Makefile.cfg