root / configure @ 3e11db9a
History | View | Annotate | Download (14.1 kB)
1 | 7d13299d | bellard | #!/bin/sh |
---|---|---|---|
2 | 7d13299d | bellard | # |
3 | 3ef693a0 | bellard | # qemu configure script (c) 2003 Fabrice Bellard |
4 | 7d13299d | bellard | # |
5 | 7d13299d | bellard | # set temporary file name |
6 | 7d13299d | bellard | if test ! -z "$TMPDIR" ; then |
7 | 7d13299d | bellard | TMPDIR1="${TMPDIR}" |
8 | 7d13299d | bellard | elif test ! -z "$TEMPDIR" ; then |
9 | 7d13299d | bellard | TMPDIR1="${TEMPDIR}" |
10 | 7d13299d | bellard | else |
11 | 7d13299d | bellard | TMPDIR1="/tmp" |
12 | 7d13299d | bellard | fi |
13 | 7d13299d | bellard | |
14 | 3ef693a0 | bellard | TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" |
15 | 3ef693a0 | bellard | TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" |
16 | 3ef693a0 | bellard | TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}" |
17 | 3ef693a0 | bellard | TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S" |
18 | 7d13299d | bellard | |
19 | 7d13299d | bellard | # default parameters |
20 | 11d9f695 | bellard | prefix="" |
21 | 1e43adfc | bellard | interp_prefix="/usr/gnemul/qemu-%M" |
22 | 43ce4dfe | bellard | static="no" |
23 | 7d13299d | bellard | cross_prefix="" |
24 | 7d13299d | bellard | cc="gcc" |
25 | 7d13299d | bellard | host_cc="gcc" |
26 | 7d13299d | bellard | ar="ar" |
27 | 7d13299d | bellard | make="make" |
28 | 7d13299d | bellard | strip="strip" |
29 | 7d13299d | bellard | cpu=`uname -m` |
30 | a541f297 | bellard | target_list="i386-user i386 i386-softmmu arm-user sparc-user ppc-user ppc-softmmu" |
31 | 7d13299d | bellard | case "$cpu" in |
32 | 7d13299d | bellard | i386|i486|i586|i686|i86pc|BePC) |
33 | 97a847bc | bellard | cpu="i386" |
34 | 7d13299d | bellard | ;; |
35 | 7d13299d | bellard | armv4l) |
36 | 7d13299d | bellard | cpu="armv4l" |
37 | 7d13299d | bellard | ;; |
38 | 7d13299d | bellard | alpha) |
39 | 7d13299d | bellard | cpu="alpha" |
40 | 7d13299d | bellard | ;; |
41 | 295defa5 | bellard | "Power Macintosh"|ppc|ppc64) |
42 | 7d13299d | bellard | cpu="powerpc" |
43 | 7d13299d | bellard | ;; |
44 | 7d13299d | bellard | mips) |
45 | 7d13299d | bellard | cpu="mips" |
46 | 7d13299d | bellard | ;; |
47 | fb3e5849 | bellard | s390) |
48 | fb3e5849 | bellard | cpu="s390" |
49 | fb3e5849 | bellard | ;; |
50 | ae228531 | bellard | sparc) |
51 | ae228531 | bellard | cpu="sparc" |
52 | ae228531 | bellard | ;; |
53 | ae228531 | bellard | sparc64) |
54 | ae228531 | bellard | cpu="sparc64" |
55 | ae228531 | bellard | ;; |
56 | a8baa8c5 | bellard | ia64) |
57 | a8baa8c5 | bellard | cpu="ia64" |
58 | a8baa8c5 | bellard | ;; |
59 | 38e584a0 | bellard | m68k) |
60 | 38e584a0 | bellard | cpu="m68k" |
61 | 38e584a0 | bellard | ;; |
62 | bc51c5c9 | bellard | x86_64|amd64) |
63 | bc51c5c9 | bellard | cpu="amd64" |
64 | bc51c5c9 | bellard | ;; |
65 | 7d13299d | bellard | *) |
66 | 7d13299d | bellard | cpu="unknown" |
67 | 7d13299d | bellard | ;; |
68 | 7d13299d | bellard | esac |
69 | 7d13299d | bellard | gprof="no" |
70 | 7d13299d | bellard | bigendian="no" |
71 | 67b915a5 | bellard | mingw32="no" |
72 | 67b915a5 | bellard | EXESUF="" |
73 | 67b915a5 | bellard | gdbstub="yes" |
74 | 443f1376 | bellard | slirp="yes" |
75 | 7d13299d | bellard | |
76 | 7d13299d | bellard | # OS specific |
77 | 7d13299d | bellard | targetos=`uname -s` |
78 | 7d13299d | bellard | case $targetos in |
79 | 67b915a5 | bellard | MINGW32*) |
80 | 67b915a5 | bellard | mingw32="yes" |
81 | 67b915a5 | bellard | ;; |
82 | 7d3505c5 | bellard | FreeBSD) |
83 | 7d3505c5 | bellard | bsd="yes" |
84 | 7d3505c5 | bellard | ;; |
85 | 7d3505c5 | bellard | NetBSD) |
86 | 7d3505c5 | bellard | bsd="yes" |
87 | 7d3505c5 | bellard | ;; |
88 | 7d3505c5 | bellard | OpenBSD) |
89 | 7d3505c5 | bellard | bsd="yes" |
90 | 7d3505c5 | bellard | ;; |
91 | 83fb7adf | bellard | Darwin) |
92 | 83fb7adf | bellard | bsd="yes" |
93 | 83fb7adf | bellard | darwin="yes" |
94 | 83fb7adf | bellard | ;; |
95 | 7d13299d | bellard | *) ;; |
96 | 7d13299d | bellard | esac |
97 | 7d13299d | bellard | |
98 | 7d3505c5 | bellard | if [ "$bsd" = "yes" ] ; then |
99 | 83fb7adf | bellard | if [ ! "$darwin" = "yes" ] ; then |
100 | 83fb7adf | bellard | make="gmake" |
101 | 83fb7adf | bellard | fi |
102 | 83fb7adf | bellard | target_list="i386-softmmu ppc-softmmu" |
103 | 7d3505c5 | bellard | fi |
104 | 7d3505c5 | bellard | |
105 | 7d13299d | bellard | # find source path |
106 | 7d13299d | bellard | # XXX: we assume an absolute path is given when launching configure, |
107 | 7d13299d | bellard | # except in './configure' case. |
108 | 7d13299d | bellard | source_path=${0%configure} |
109 | 7d13299d | bellard | source_path=${source_path%/} |
110 | 7d13299d | bellard | source_path_used="yes" |
111 | 7d13299d | bellard | if test -z "$source_path" -o "$source_path" = "." ; then |
112 | 7d13299d | bellard | source_path=`pwd` |
113 | 7d13299d | bellard | source_path_used="no" |
114 | 7d13299d | bellard | fi |
115 | 7d13299d | bellard | |
116 | 7d13299d | bellard | for opt do |
117 | 7d13299d | bellard | case "$opt" in |
118 | 7d13299d | bellard | --prefix=*) prefix=`echo $opt | cut -d '=' -f 2` |
119 | 7d13299d | bellard | ;; |
120 | 32ce6337 | bellard | --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2` |
121 | 32ce6337 | bellard | ;; |
122 | 7d13299d | bellard | --source-path=*) source_path=`echo $opt | cut -d '=' -f 2` |
123 | 7d13299d | bellard | ;; |
124 | 7d13299d | bellard | --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2` |
125 | 7d13299d | bellard | ;; |
126 | 7d13299d | bellard | --cc=*) cc=`echo $opt | cut -d '=' -f 2` |
127 | 7d13299d | bellard | ;; |
128 | 7d13299d | bellard | --make=*) make=`echo $opt | cut -d '=' -f 2` |
129 | 7d13299d | bellard | ;; |
130 | 7d13299d | bellard | --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}" |
131 | 7d13299d | bellard | ;; |
132 | 7d13299d | bellard | --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}" |
133 | 7d13299d | bellard | ;; |
134 | 7d13299d | bellard | --extra-libs=*) extralibs=${opt#--extra-libs=} |
135 | 7d13299d | bellard | ;; |
136 | 7d13299d | bellard | --cpu=*) cpu=`echo $opt | cut -d '=' -f 2` |
137 | 7d13299d | bellard | ;; |
138 | 97a847bc | bellard | --target-list=*) target_list=${opt#--target-list=} |
139 | de83cd02 | bellard | ;; |
140 | 7d13299d | bellard | --enable-gprof) gprof="yes" |
141 | 7d13299d | bellard | ;; |
142 | 43ce4dfe | bellard | --static) static="yes" |
143 | 43ce4dfe | bellard | ;; |
144 | 97a847bc | bellard | --disable-sdl) sdl="no" |
145 | 97a847bc | bellard | ;; |
146 | 67b915a5 | bellard | --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" |
147 | 67b915a5 | bellard | ;; |
148 | 443f1376 | bellard | --disable-slirp) slirp="no" |
149 | c20709aa | bellard | ;; |
150 | 7d13299d | bellard | esac |
151 | 7d13299d | bellard | done |
152 | 7d13299d | bellard | |
153 | 7d13299d | bellard | # Checking for CFLAGS |
154 | 7d13299d | bellard | if test -z "$CFLAGS"; then |
155 | 7d13299d | bellard | CFLAGS="-O2" |
156 | 7d13299d | bellard | fi |
157 | 7d13299d | bellard | |
158 | 7d13299d | bellard | cc="${cross_prefix}${cc}" |
159 | 7d13299d | bellard | ar="${cross_prefix}${ar}" |
160 | 7d13299d | bellard | strip="${cross_prefix}${strip}" |
161 | 7d13299d | bellard | |
162 | 67b915a5 | bellard | if test "$mingw32" = "yes" ; then |
163 | 43003046 | bellard | target_list="i386-softmmu ppc-softmmu" |
164 | 67b915a5 | bellard | EXESUF=".exe" |
165 | 67b915a5 | bellard | gdbstub="no" |
166 | 67b915a5 | bellard | fi |
167 | 67b915a5 | bellard | |
168 | 7d13299d | bellard | if test -z "$cross_prefix" ; then |
169 | 7d13299d | bellard | |
170 | 7d13299d | bellard | # --- |
171 | 7d13299d | bellard | # big/little endian test |
172 | 7d13299d | bellard | cat > $TMPC << EOF |
173 | 7d13299d | bellard | #include <inttypes.h> |
174 | 7d13299d | bellard | int main(int argc, char ** argv){ |
175 | 7d13299d | bellard | volatile uint32_t i=0x01234567; |
176 | 7d13299d | bellard | return (*((uint8_t*)(&i))) == 0x67; |
177 | 7d13299d | bellard | } |
178 | 7d13299d | bellard | EOF |
179 | 7d13299d | bellard | |
180 | 7d13299d | bellard | if $cc -o $TMPE $TMPC 2>/dev/null ; then |
181 | 7d13299d | bellard | $TMPE && bigendian="yes" |
182 | 7d13299d | bellard | else |
183 | 7d13299d | bellard | echo big/little test failed |
184 | 7d13299d | bellard | fi |
185 | 7d13299d | bellard | |
186 | 7d13299d | bellard | else |
187 | 7d13299d | bellard | |
188 | 7d13299d | bellard | # if cross compiling, cannot launch a program, so make a static guess |
189 | 38e584a0 | bellard | if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k"; then |
190 | 7d13299d | bellard | bigendian="yes" |
191 | 7d13299d | bellard | fi |
192 | 7d13299d | bellard | |
193 | 7d13299d | bellard | fi |
194 | 7d13299d | bellard | |
195 | e8cd23de | bellard | # check gcc options support |
196 | 04369ff2 | bellard | cat > $TMPC <<EOF |
197 | 04369ff2 | bellard | int main(void) { |
198 | 04369ff2 | bellard | } |
199 | 04369ff2 | bellard | EOF |
200 | 04369ff2 | bellard | |
201 | e8cd23de | bellard | have_gcc3_options="no" |
202 | e8cd23de | bellard | if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then |
203 | e8cd23de | bellard | have_gcc3_options="yes" |
204 | 04369ff2 | bellard | fi |
205 | ca735206 | bellard | |
206 | 11d9f695 | bellard | ########################################## |
207 | 11d9f695 | bellard | # SDL probe |
208 | 11d9f695 | bellard | |
209 | 11d9f695 | bellard | sdl_too_old=no |
210 | 11d9f695 | bellard | |
211 | 11d9f695 | bellard | if test -z "$sdl" ; then |
212 | 11d9f695 | bellard | |
213 | a6e022ad | bellard | sdl_config="sdl-config" |
214 | a6e022ad | bellard | sdl=no |
215 | 7c1f25b4 | bellard | sdl_static=no |
216 | a6e022ad | bellard | |
217 | a6e022ad | bellard | if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then |
218 | a6e022ad | bellard | # win32 cross compilation case |
219 | a6e022ad | bellard | sdl_config="i386-mingw32msvc-sdl-config" |
220 | a6e022ad | bellard | sdl=yes |
221 | a6e022ad | bellard | else |
222 | a6e022ad | bellard | # normal SDL probe |
223 | 11d9f695 | bellard | cat > $TMPC << EOF |
224 | 11d9f695 | bellard | #include <SDL.h> |
225 | 11d9f695 | bellard | #undef main /* We don't want SDL to override our main() */ |
226 | 11d9f695 | bellard | int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } |
227 | 11d9f695 | bellard | EOF |
228 | 11d9f695 | bellard | |
229 | a6e022ad | bellard | if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then |
230 | a6e022ad | bellard | _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` |
231 | 11d9f695 | bellard | if test "$_sdlversion" -lt 121 ; then |
232 | 11d9f695 | bellard | sdl_too_old=yes |
233 | 11d9f695 | bellard | else |
234 | 11d9f695 | bellard | sdl=yes |
235 | 11d9f695 | bellard | fi |
236 | 7c1f25b4 | bellard | |
237 | 7c1f25b4 | bellard | # static link with sdl ? |
238 | 7c1f25b4 | bellard | if test "$sdl" = "yes" ; then |
239 | 7c1f25b4 | bellard | aa="no" |
240 | 7c1f25b4 | bellard | `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes" |
241 | 7c1f25b4 | bellard | sdl_static_libs=`$sdl_config --static-libs` |
242 | 7c1f25b4 | bellard | if [ "$aa" = "yes" ] ; then |
243 | d8d8aa4e | bellard | sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" |
244 | 7c1f25b4 | bellard | fi |
245 | 7c1f25b4 | bellard | |
246 | 7c1f25b4 | bellard | if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then |
247 | 7c1f25b4 | bellard | sdl_static=yes |
248 | 11d9f695 | bellard | fi |
249 | 11d9f695 | bellard | |
250 | 7c1f25b4 | bellard | fi # static link |
251 | 7c1f25b4 | bellard | |
252 | 7c1f25b4 | bellard | fi # sdl compile test |
253 | 7c1f25b4 | bellard | |
254 | a6e022ad | bellard | fi # cross compilation |
255 | a6e022ad | bellard | fi # -z $sdl |
256 | 11d9f695 | bellard | |
257 | 7d13299d | bellard | if test x"$1" = x"-h" -o x"$1" = x"--help" ; then |
258 | 7d13299d | bellard | cat << EOF |
259 | 7d13299d | bellard | |
260 | 7d13299d | bellard | Usage: configure [options] |
261 | 7d13299d | bellard | Options: [defaults in brackets after descriptions] |
262 | 7d13299d | bellard | |
263 | 7d13299d | bellard | EOF |
264 | 7d13299d | bellard | echo "Standard options:" |
265 | 7d13299d | bellard | echo " --help print this message" |
266 | 7d13299d | bellard | echo " --prefix=PREFIX install in PREFIX [$prefix]" |
267 | 1e43adfc | bellard | echo " --interp-prefix=PREFIX where to find shared libraries, etc." |
268 | 1e43adfc | bellard | echo " use %M for cpu name [$interp_prefix]" |
269 | 97a847bc | bellard | echo " --target-list=LIST set target list [$target_list]" |
270 | 7d13299d | bellard | echo "" |
271 | 7d13299d | bellard | echo "Advanced options (experts only):" |
272 | 7d13299d | bellard | echo " --source-path=PATH path of source code [$source_path]" |
273 | 7d13299d | bellard | echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]" |
274 | 7d13299d | bellard | echo " --cc=CC use C compiler CC [$cc]" |
275 | 7d13299d | bellard | echo " --make=MAKE use specified make [$make]" |
276 | 43ce4dfe | bellard | echo " --static enable static build [$static]" |
277 | 67b915a5 | bellard | echo " --enable-mingw32 enable Win32 cross compilation with mingw32" |
278 | 7d13299d | bellard | echo "" |
279 | 7d13299d | bellard | echo "NOTE: The object files are build at the place where configure is launched" |
280 | 7d13299d | bellard | exit 1 |
281 | 7d13299d | bellard | fi |
282 | 7d13299d | bellard | |
283 | 11d9f695 | bellard | if test "$mingw32" = "yes" ; then |
284 | 11d9f695 | bellard | if test -z "$prefix" ; then |
285 | 11d9f695 | bellard | prefix="/c/Program Files/Qemu" |
286 | 11d9f695 | bellard | fi |
287 | 11d9f695 | bellard | mandir="$prefix" |
288 | 7efa4387 | bellard | datadir="$prefix" |
289 | 1f50f8d1 | bellard | docdir="$prefix" |
290 | 11d9f695 | bellard | bindir="$prefix" |
291 | 11d9f695 | bellard | else |
292 | 11d9f695 | bellard | if test -z "$prefix" ; then |
293 | 11d9f695 | bellard | prefix="/usr/local" |
294 | 11d9f695 | bellard | fi |
295 | 5a67135a | bellard | mandir="$prefix/share/man" |
296 | 7efa4387 | bellard | datadir="$prefix/share/qemu" |
297 | 1f50f8d1 | bellard | docdir="$prefix/share/doc/qemu" |
298 | 11d9f695 | bellard | bindir="$prefix/bin" |
299 | 11d9f695 | bellard | fi |
300 | 5a67135a | bellard | |
301 | 43ce4dfe | bellard | echo "Install prefix $prefix" |
302 | 7efa4387 | bellard | echo "BIOS directory $datadir" |
303 | 11d9f695 | bellard | echo "binary directory $bindir" |
304 | 11d9f695 | bellard | if test "$mingw32" = "no" ; then |
305 | 11d9f695 | bellard | echo "Manual directory $mandir" |
306 | 43ce4dfe | bellard | echo "ELF interp prefix $interp_prefix" |
307 | 11d9f695 | bellard | fi |
308 | 5a67135a | bellard | echo "Source path $source_path" |
309 | 43ce4dfe | bellard | echo "C compiler $cc" |
310 | 43ce4dfe | bellard | echo "make $make" |
311 | 43ce4dfe | bellard | echo "host CPU $cpu" |
312 | de83cd02 | bellard | echo "host big endian $bigendian" |
313 | 97a847bc | bellard | echo "target list $target_list" |
314 | 43ce4dfe | bellard | echo "gprof enabled $gprof" |
315 | 43ce4dfe | bellard | echo "static build $static" |
316 | 97a847bc | bellard | echo "SDL support $sdl" |
317 | 7c1f25b4 | bellard | echo "SDL static link $sdl_static" |
318 | 67b915a5 | bellard | echo "mingw32 support $mingw32" |
319 | 67b915a5 | bellard | |
320 | 97a847bc | bellard | if test $sdl_too_old = "yes"; then |
321 | 97a847bc | bellard | echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support" |
322 | 97a847bc | bellard | fi |
323 | 7c1f25b4 | bellard | if test "$sdl_static" = "no"; then |
324 | 7c1f25b4 | bellard | echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output" |
325 | 7c1f25b4 | bellard | fi |
326 | 97a847bc | bellard | |
327 | 97a847bc | bellard | config_mak="config-host.mak" |
328 | 97a847bc | bellard | config_h="config-host.h" |
329 | 7d13299d | bellard | |
330 | 7c1f25b4 | bellard | #echo "Creating $config_mak and $config_h" |
331 | 7d13299d | bellard | |
332 | 97a847bc | bellard | echo "# Automatically generated by configure - do not modify" > $config_mak |
333 | 97a847bc | bellard | echo "/* Automatically generated by configure - do not modify */" > $config_h |
334 | 7d13299d | bellard | |
335 | 97a847bc | bellard | echo "prefix=$prefix" >> $config_mak |
336 | 11d9f695 | bellard | echo "bindir=$bindir" >> $config_mak |
337 | 5a67135a | bellard | echo "mandir=$mandir" >> $config_mak |
338 | 7efa4387 | bellard | echo "datadir=$datadir" >> $config_mak |
339 | 1f50f8d1 | bellard | echo "docdir=$docdir" >> $config_mak |
340 | 7efa4387 | bellard | echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h |
341 | 97a847bc | bellard | echo "MAKE=$make" >> $config_mak |
342 | 97a847bc | bellard | echo "CC=$cc" >> $config_mak |
343 | e8cd23de | bellard | if test "$have_gcc3_options" = "yes" ; then |
344 | 97a847bc | bellard | echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak |
345 | e8cd23de | bellard | fi |
346 | 97a847bc | bellard | echo "HOST_CC=$host_cc" >> $config_mak |
347 | 97a847bc | bellard | echo "AR=$ar" >> $config_mak |
348 | 97a847bc | bellard | echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak |
349 | 97a847bc | bellard | echo "CFLAGS=$CFLAGS" >> $config_mak |
350 | 97a847bc | bellard | echo "LDFLAGS=$LDFLAGS" >> $config_mak |
351 | 67b915a5 | bellard | echo "EXESUF=$EXESUF" >> $config_mak |
352 | 97a847bc | bellard | if test "$cpu" = "i386" ; then |
353 | 97a847bc | bellard | echo "ARCH=i386" >> $config_mak |
354 | 97a847bc | bellard | echo "#define HOST_I386 1" >> $config_h |
355 | bc51c5c9 | bellard | elif test "$cpu" = "amd64" ; then |
356 | bc51c5c9 | bellard | echo "ARCH=amd64" >> $config_mak |
357 | bc51c5c9 | bellard | echo "#define HOST_AMD64 1" >> $config_h |
358 | 7d13299d | bellard | elif test "$cpu" = "armv4l" ; then |
359 | 97a847bc | bellard | echo "ARCH=arm" >> $config_mak |
360 | 97a847bc | bellard | echo "#define HOST_ARM 1" >> $config_h |
361 | 7d13299d | bellard | elif test "$cpu" = "powerpc" ; then |
362 | 97a847bc | bellard | echo "ARCH=ppc" >> $config_mak |
363 | 97a847bc | bellard | echo "#define HOST_PPC 1" >> $config_h |
364 | 7d13299d | bellard | elif test "$cpu" = "mips" ; then |
365 | 97a847bc | bellard | echo "ARCH=mips" >> $config_mak |
366 | 97a847bc | bellard | echo "#define HOST_MIPS 1" >> $config_h |
367 | fb3e5849 | bellard | elif test "$cpu" = "s390" ; then |
368 | 97a847bc | bellard | echo "ARCH=s390" >> $config_mak |
369 | 97a847bc | bellard | echo "#define HOST_S390 1" >> $config_h |
370 | 295defa5 | bellard | elif test "$cpu" = "alpha" ; then |
371 | 97a847bc | bellard | echo "ARCH=alpha" >> $config_mak |
372 | 97a847bc | bellard | echo "#define HOST_ALPHA 1" >> $config_h |
373 | ae228531 | bellard | elif test "$cpu" = "sparc" ; then |
374 | 97a847bc | bellard | echo "ARCH=sparc" >> $config_mak |
375 | 97a847bc | bellard | echo "#define HOST_SPARC 1" >> $config_h |
376 | ae228531 | bellard | elif test "$cpu" = "sparc64" ; then |
377 | 97a847bc | bellard | echo "ARCH=sparc64" >> $config_mak |
378 | 97a847bc | bellard | echo "#define HOST_SPARC64 1" >> $config_h |
379 | a8baa8c5 | bellard | elif test "$cpu" = "ia64" ; then |
380 | 97a847bc | bellard | echo "ARCH=ia64" >> $config_mak |
381 | 97a847bc | bellard | echo "#define HOST_IA64 1" >> $config_h |
382 | 38e584a0 | bellard | elif test "$cpu" = "m68k" ; then |
383 | 38ca2abc | bellard | echo "ARCH=m68k" >> $config_mak |
384 | 38ca2abc | bellard | echo "#define HOST_M68K 1" >> $config_h |
385 | 7d13299d | bellard | else |
386 | 7d13299d | bellard | echo "Unsupported CPU" |
387 | 7d13299d | bellard | exit 1 |
388 | 7d13299d | bellard | fi |
389 | 7d13299d | bellard | if test "$bigendian" = "yes" ; then |
390 | 97a847bc | bellard | echo "WORDS_BIGENDIAN=yes" >> $config_mak |
391 | 97a847bc | bellard | echo "#define WORDS_BIGENDIAN 1" >> $config_h |
392 | 97a847bc | bellard | fi |
393 | 67b915a5 | bellard | if test "$mingw32" = "yes" ; then |
394 | 67b915a5 | bellard | echo "CONFIG_WIN32=yes" >> $config_mak |
395 | 11d9f695 | bellard | echo "#define CONFIG_WIN32 1" >> $config_h |
396 | 7d3505c5 | bellard | elif test -f "/usr/include/byteswap.h" ; then |
397 | 67b915a5 | bellard | echo "#define HAVE_BYTESWAP_H 1" >> $config_h |
398 | 67b915a5 | bellard | fi |
399 | 83fb7adf | bellard | if test "$darwin" = "yes" ; then |
400 | 83fb7adf | bellard | echo "CONFIG_DARWIN=yes" >> $config_mak |
401 | 83fb7adf | bellard | echo "#define CONFIG_DARWIN 1" >> $config_h |
402 | 83fb7adf | bellard | fi |
403 | 67b915a5 | bellard | if test "$gdbstub" = "yes" ; then |
404 | 67b915a5 | bellard | echo "CONFIG_GDBSTUB=yes" >> $config_mak |
405 | 67b915a5 | bellard | echo "#define CONFIG_GDBSTUB 1" >> $config_h |
406 | 67b915a5 | bellard | fi |
407 | 97a847bc | bellard | if test "$gprof" = "yes" ; then |
408 | 97a847bc | bellard | echo "TARGET_GPROF=yes" >> $config_mak |
409 | 97a847bc | bellard | echo "#define HAVE_GPROF 1" >> $config_h |
410 | 97a847bc | bellard | fi |
411 | 97a847bc | bellard | if test "$static" = "yes" ; then |
412 | 97a847bc | bellard | echo "CONFIG_STATIC=yes" >> $config_mak |
413 | 50863472 | bellard | echo "#define CONFIG_STATIC 1" >> $config_h |
414 | 7d13299d | bellard | fi |
415 | c20709aa | bellard | if test "$slirp" = "yes" ; then |
416 | c20709aa | bellard | echo "CONFIG_SLIRP=yes" >> $config_mak |
417 | c20709aa | bellard | echo "#define CONFIG_SLIRP 1" >> $config_h |
418 | c20709aa | bellard | fi |
419 | 97a847bc | bellard | echo -n "VERSION=" >>$config_mak |
420 | 97a847bc | bellard | head $source_path/VERSION >>$config_mak |
421 | 97a847bc | bellard | echo "" >>$config_mak |
422 | 97a847bc | bellard | echo -n "#define QEMU_VERSION \"" >> $config_h |
423 | 97a847bc | bellard | head $source_path/VERSION >> $config_h |
424 | 97a847bc | bellard | echo "\"" >> $config_h |
425 | 97a847bc | bellard | |
426 | 97a847bc | bellard | echo "SRC_PATH=$source_path" >> $config_mak |
427 | 97a847bc | bellard | echo "TARGET_DIRS=$target_list" >> $config_mak |
428 | 97a847bc | bellard | |
429 | 83fb7adf | bellard | # XXX: suppress that |
430 | 7d3505c5 | bellard | if [ "$bsd" = "yes" ] ; then |
431 | 43003046 | bellard | echo "#define O_LARGEFILE 0" >> $config_h |
432 | 43003046 | bellard | echo "#define lseek64 lseek" >> $config_h |
433 | 83fb7adf | bellard | echo "#define mkstemp64 mkstemp" >> $config_h |
434 | 43003046 | bellard | echo "#define ftruncate64 ftruncate" >> $config_h |
435 | 83fb7adf | bellard | echo "#define off64_t off_t" >> $config_h |
436 | 43003046 | bellard | echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h |
437 | 7d3505c5 | bellard | echo "#define _BSD 1" >> $config_h |
438 | 7d3505c5 | bellard | fi |
439 | 7d3505c5 | bellard | |
440 | 97a847bc | bellard | for target in $target_list; do |
441 | 97a847bc | bellard | |
442 | 97a847bc | bellard | target_dir="$target" |
443 | 97a847bc | bellard | config_mak=$target_dir/config.mak |
444 | 97a847bc | bellard | config_h=$target_dir/config.h |
445 | 97a847bc | bellard | target_cpu=`echo $target | cut -d '-' -f 1` |
446 | 97a847bc | bellard | target_bigendian="no" |
447 | 1e43adfc | bellard | [ "$target_cpu" = "sparc" ] && target_bigendian=yes |
448 | 67867308 | bellard | [ "$target_cpu" = "ppc" ] && target_bigendian=yes |
449 | 97a847bc | bellard | target_softmmu="no" |
450 | 97a847bc | bellard | if expr $target : '.*-softmmu' > /dev/null ; then |
451 | 97a847bc | bellard | target_softmmu="yes" |
452 | 97a847bc | bellard | fi |
453 | 997344f3 | bellard | target_user_only="no" |
454 | 997344f3 | bellard | if expr $target : '.*-user' > /dev/null ; then |
455 | 997344f3 | bellard | target_user_only="yes" |
456 | 997344f3 | bellard | fi |
457 | 97a847bc | bellard | |
458 | 7c1f25b4 | bellard | #echo "Creating $config_mak, $config_h and $target_dir/Makefile" |
459 | 97a847bc | bellard | |
460 | 97a847bc | bellard | mkdir -p $target_dir |
461 | 69de927c | bellard | if test "$target" = "arm-user" ; then |
462 | 69de927c | bellard | mkdir -p $target_dir/nwfpe |
463 | 69de927c | bellard | fi |
464 | a7e61ed4 | bellard | if test "$target_user_only" = "no" ; then |
465 | a7e61ed4 | bellard | mkdir -p $target_dir/slirp |
466 | a7e61ed4 | bellard | fi |
467 | 69de927c | bellard | |
468 | 97a847bc | bellard | ln -sf $source_path/Makefile.target $target_dir/Makefile |
469 | 97a847bc | bellard | |
470 | 97a847bc | bellard | echo "# Automatically generated by configure - do not modify" > $config_mak |
471 | 97a847bc | bellard | echo "/* Automatically generated by configure - do not modify */" > $config_h |
472 | 97a847bc | bellard | |
473 | de83cd02 | bellard | |
474 | 97a847bc | bellard | echo "include ../config-host.mak" >> $config_mak |
475 | 97a847bc | bellard | echo "#include \"../config-host.h\"" >> $config_h |
476 | 1e43adfc | bellard | |
477 | 1e43adfc | bellard | interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"` |
478 | 1e43adfc | bellard | echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h |
479 | 97a847bc | bellard | |
480 | 97a847bc | bellard | if test "$target_cpu" = "i386" ; then |
481 | 97a847bc | bellard | echo "TARGET_ARCH=i386" >> $config_mak |
482 | 97a847bc | bellard | echo "#define TARGET_ARCH \"i386\"" >> $config_h |
483 | 97a847bc | bellard | echo "#define TARGET_I386 1" >> $config_h |
484 | de83cd02 | bellard | elif test "$target_cpu" = "arm" ; then |
485 | 97a847bc | bellard | echo "TARGET_ARCH=arm" >> $config_mak |
486 | 97a847bc | bellard | echo "#define TARGET_ARCH \"arm\"" >> $config_h |
487 | 97a847bc | bellard | echo "#define TARGET_ARM 1" >> $config_h |
488 | 1e43adfc | bellard | elif test "$target_cpu" = "sparc" ; then |
489 | 1e43adfc | bellard | echo "TARGET_ARCH=sparc" >> $config_mak |
490 | 1e43adfc | bellard | echo "#define TARGET_ARCH \"sparc\"" >> $config_h |
491 | 1e43adfc | bellard | echo "#define TARGET_SPARC 1" >> $config_h |
492 | 67867308 | bellard | elif test "$target_cpu" = "ppc" ; then |
493 | 67867308 | bellard | echo "TARGET_ARCH=ppc" >> $config_mak |
494 | 67867308 | bellard | echo "#define TARGET_ARCH \"ppc\"" >> $config_h |
495 | 67867308 | bellard | echo "#define TARGET_PPC 1" >> $config_h |
496 | de83cd02 | bellard | else |
497 | de83cd02 | bellard | echo "Unsupported target CPU" |
498 | de83cd02 | bellard | exit 1 |
499 | de83cd02 | bellard | fi |
500 | de83cd02 | bellard | if test "$target_bigendian" = "yes" ; then |
501 | 97a847bc | bellard | echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak |
502 | 97a847bc | bellard | echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h |
503 | de83cd02 | bellard | fi |
504 | 97a847bc | bellard | if test "$target_softmmu" = "yes" ; then |
505 | 97a847bc | bellard | echo "CONFIG_SOFTMMU=yes" >> $config_mak |
506 | 97a847bc | bellard | echo "#define CONFIG_SOFTMMU 1" >> $config_h |
507 | 43ce4dfe | bellard | fi |
508 | 997344f3 | bellard | if test "$target_user_only" = "yes" ; then |
509 | 997344f3 | bellard | echo "CONFIG_USER_ONLY=yes" >> $config_mak |
510 | 997344f3 | bellard | echo "#define CONFIG_USER_ONLY 1" >> $config_h |
511 | 997344f3 | bellard | fi |
512 | 97a847bc | bellard | |
513 | 7c1f25b4 | bellard | # sdl defines |
514 | 7c1f25b4 | bellard | |
515 | 7c1f25b4 | bellard | if test "$target_user_only" = "no"; then |
516 | 7c1f25b4 | bellard | if test "$target_softmmu" = "no" -o "$static" = "yes"; then |
517 | 7c1f25b4 | bellard | if test "$sdl_static" = "yes" ; then |
518 | 7c1f25b4 | bellard | echo "#define CONFIG_SDL 1" >> $config_h |
519 | 7c1f25b4 | bellard | echo "CONFIG_SDL=yes" >> $config_mak |
520 | 7c1f25b4 | bellard | echo "SDL_LIBS=$sdl_static_libs" >> $config_mak |
521 | 7c1f25b4 | bellard | fi |
522 | 7c1f25b4 | bellard | else |
523 | 7c1f25b4 | bellard | if test "$sdl" = "yes" ; then |
524 | 7c1f25b4 | bellard | echo "#define CONFIG_SDL 1" >> $config_h |
525 | 7c1f25b4 | bellard | echo "CONFIG_SDL=yes" >> $config_mak |
526 | 7c1f25b4 | bellard | echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak |
527 | 7c1f25b4 | bellard | fi |
528 | 7c1f25b4 | bellard | fi |
529 | 7c1f25b4 | bellard | echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak |
530 | 7c1f25b4 | bellard | if [ "${aa}" = "yes" ] ; then |
531 | 7c1f25b4 | bellard | echo -n " `aalib-config --cflags`" >> $config_mak ; |
532 | 7c1f25b4 | bellard | fi |
533 | 7c1f25b4 | bellard | echo "" >> $config_mak |
534 | 7c1f25b4 | bellard | fi |
535 | 7c1f25b4 | bellard | |
536 | 97a847bc | bellard | done # for target in $targets |
537 | 7d13299d | bellard | |
538 | 7d13299d | bellard | # build tree in object directory if source path is different from current one |
539 | 7d13299d | bellard | if test "$source_path_used" = "yes" ; then |
540 | 7d13299d | bellard | DIRS="tests" |
541 | 7d13299d | bellard | FILES="Makefile tests/Makefile" |
542 | 7d13299d | bellard | for dir in $DIRS ; do |
543 | 7d13299d | bellard | mkdir -p $dir |
544 | 7d13299d | bellard | done |
545 | 7d13299d | bellard | for f in $FILES ; do |
546 | 7d13299d | bellard | ln -sf $source_path/$f $f |
547 | 7d13299d | bellard | done |
548 | 7d13299d | bellard | fi |
549 | 7d13299d | bellard | |
550 | 97a847bc | bellard | rm -f $TMPO $TMPC $TMPE $TMPS |