]> git.proxmox.com Git - qemu.git/blame - configure
new bochs BIOS - 16 bit APM support (initial patch by Struan Bartlett)
[qemu.git] / configure
CommitLineData
7d13299d
FB
1#!/bin/sh
2#
3ef693a0 3# qemu configure script (c) 2003 Fabrice Bellard
7d13299d
FB
4#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
3ef693a0
FB
14TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
7d13299d
FB
18
19# default parameters
11d9f695 20prefix=""
1e43adfc 21interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 22static="no"
7d13299d
FB
23cross_prefix=""
24cc="gcc"
25host_cc="gcc"
26ar="ar"
27make="make"
28strip="strip"
29cpu=`uname -m`
5327cf48 30target_list=""
7d13299d
FB
31case "$cpu" in
32 i386|i486|i586|i686|i86pc|BePC)
97a847bc 33 cpu="i386"
7d13299d 34 ;;
ba68055e 35 armv*b)
808c4954
FB
36 cpu="armv4b"
37 ;;
ba68055e 38 armv*l)
7d13299d
FB
39 cpu="armv4l"
40 ;;
41 alpha)
42 cpu="alpha"
43 ;;
295defa5 44 "Power Macintosh"|ppc|ppc64)
7d13299d
FB
45 cpu="powerpc"
46 ;;
47 mips)
48 cpu="mips"
49 ;;
fb3e5849
FB
50 s390)
51 cpu="s390"
52 ;;
ae228531
FB
53 sparc)
54 cpu="sparc"
55 ;;
56 sparc64)
57 cpu="sparc64"
58 ;;
a8baa8c5
FB
59 ia64)
60 cpu="ia64"
61 ;;
38e584a0
FB
62 m68k)
63 cpu="m68k"
64 ;;
bc51c5c9 65 x86_64|amd64)
0b0babc6 66 cpu="x86_64"
bc51c5c9 67 ;;
7d13299d
FB
68 *)
69 cpu="unknown"
70 ;;
71esac
72gprof="no"
73bigendian="no"
67b915a5
FB
74mingw32="no"
75EXESUF=""
76gdbstub="yes"
443f1376 77slirp="yes"
fb065187
FB
78adlib="no"
79oss="no"
102a52e4
FB
80fmod="no"
81fmod_lib=""
82fmod_inc=""
5327cf48 83linux="no"
c9ec1fe4
FB
84kqemu="no"
85kernel_path=""
5b0753e0 86cocoa="no"
7d13299d
FB
87
88# OS specific
89targetos=`uname -s`
90case $targetos in
67b915a5
FB
91MINGW32*)
92mingw32="yes"
93;;
7d3505c5
FB
94FreeBSD)
95bsd="yes"
fb065187 96oss="yes"
7d3505c5
FB
97;;
98NetBSD)
99bsd="yes"
fb065187 100oss="yes"
7d3505c5
FB
101;;
102OpenBSD)
103bsd="yes"
fb065187 104oss="yes"
7d3505c5 105;;
83fb7adf
FB
106Darwin)
107bsd="yes"
108darwin="yes"
109;;
fb065187
FB
110*)
111oss="yes"
5327cf48 112linux="yes"
c9ec1fe4
FB
113if [ "$cpu" = "i386" ] ; then
114 kqemu="yes"
115fi
fb065187 116;;
7d13299d
FB
117esac
118
7d3505c5 119if [ "$bsd" = "yes" ] ; then
83fb7adf
FB
120 if [ ! "$darwin" = "yes" ] ; then
121 make="gmake"
122 fi
7d3505c5
FB
123fi
124
7d13299d
FB
125# find source path
126# XXX: we assume an absolute path is given when launching configure,
127# except in './configure' case.
128source_path=${0%configure}
129source_path=${source_path%/}
130source_path_used="yes"
131if test -z "$source_path" -o "$source_path" = "." ; then
132 source_path=`pwd`
133 source_path_used="no"
134fi
135
136for opt do
137 case "$opt" in
138 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
139 ;;
32ce6337
FB
140 --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
141 ;;
7d13299d
FB
142 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
143 ;;
144 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
145 ;;
146 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
147 ;;
148 --make=*) make=`echo $opt | cut -d '=' -f 2`
149 ;;
150 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
151 ;;
152 --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
153 ;;
154 --extra-libs=*) extralibs=${opt#--extra-libs=}
155 ;;
156 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
157 ;;
97a847bc 158 --target-list=*) target_list=${opt#--target-list=}
de83cd02 159 ;;
7d13299d
FB
160 --enable-gprof) gprof="yes"
161 ;;
43ce4dfe
FB
162 --static) static="yes"
163 ;;
97a847bc
FB
164 --disable-sdl) sdl="no"
165 ;;
102a52e4
FB
166 --enable-fmod) fmod="yes"
167 ;;
168 --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
169 ;;
170 --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
171 ;;
67b915a5
FB
172 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
173 ;;
443f1376 174 --disable-slirp) slirp="no"
c20709aa 175 ;;
fb065187
FB
176 --enable-adlib) adlib="yes"
177 ;;
c9ec1fe4
FB
178 --disable-kqemu) kqemu="no"
179 ;;
180 --kernel-path=*) kernel_path=${opt#--kernel-path=}
181 ;;
5b0753e0
FB
182 --enable-cocoa) cocoa="yes" ; sdl="no"
183 ;;
7d13299d
FB
184 esac
185done
186
187# Checking for CFLAGS
188if test -z "$CFLAGS"; then
189 CFLAGS="-O2"
190fi
191
192cc="${cross_prefix}${cc}"
193ar="${cross_prefix}${ar}"
194strip="${cross_prefix}${strip}"
195
67b915a5 196if test "$mingw32" = "yes" ; then
5327cf48 197 linux="no"
67b915a5
FB
198 EXESUF=".exe"
199 gdbstub="no"
9f059eca 200 oss="no"
824d560f 201 kqemu="no"
67b915a5
FB
202fi
203
5327cf48
FB
204if test -z "$target_list" ; then
205# these targets are portable
a20b5524 206 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu"
5327cf48
FB
207# the following are Linux specific
208 if [ "$linux" = "yes" ] ; then
a20b5524 209 target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
5327cf48
FB
210 fi
211fi
212
7d13299d
FB
213if test -z "$cross_prefix" ; then
214
215# ---
216# big/little endian test
217cat > $TMPC << EOF
218#include <inttypes.h>
219int main(int argc, char ** argv){
220 volatile uint32_t i=0x01234567;
221 return (*((uint8_t*)(&i))) == 0x67;
222}
223EOF
224
225if $cc -o $TMPE $TMPC 2>/dev/null ; then
226$TMPE && bigendian="yes"
227else
228echo big/little test failed
229fi
230
231else
232
233# if cross compiling, cannot launch a program, so make a static guess
808c4954 234if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
7d13299d
FB
235 bigendian="yes"
236fi
237
238fi
239
e8cd23de 240# check gcc options support
04369ff2
FB
241cat > $TMPC <<EOF
242int main(void) {
04369ff2
FB
243}
244EOF
245
e8cd23de
FB
246have_gcc3_options="no"
247if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
248 have_gcc3_options="yes"
04369ff2 249fi
ca735206 250
11d9f695
FB
251##########################################
252# SDL probe
253
254sdl_too_old=no
255
256if test -z "$sdl" ; then
257
a6e022ad
FB
258sdl_config="sdl-config"
259sdl=no
7c1f25b4 260sdl_static=no
a6e022ad
FB
261
262if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
263# win32 cross compilation case
264 sdl_config="i386-mingw32msvc-sdl-config"
265 sdl=yes
266else
267# normal SDL probe
11d9f695
FB
268cat > $TMPC << EOF
269#include <SDL.h>
270#undef main /* We don't want SDL to override our main() */
271int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
272EOF
273
a6e022ad
FB
274if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
275_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
11d9f695
FB
276if test "$_sdlversion" -lt 121 ; then
277sdl_too_old=yes
278else
279sdl=yes
280fi
7c1f25b4
FB
281
282# static link with sdl ?
283if test "$sdl" = "yes" ; then
284aa="no"
285`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
286sdl_static_libs=`$sdl_config --static-libs`
287if [ "$aa" = "yes" ] ; then
d8d8aa4e 288 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
7c1f25b4
FB
289fi
290
291if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
292 sdl_static=yes
11d9f695
FB
293fi
294
7c1f25b4
FB
295fi # static link
296
297fi # sdl compile test
298
a6e022ad
FB
299fi # cross compilation
300fi # -z $sdl
11d9f695 301
7d13299d
FB
302if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
303cat << EOF
304
305Usage: configure [options]
306Options: [defaults in brackets after descriptions]
307
308EOF
309echo "Standard options:"
310echo " --help print this message"
311echo " --prefix=PREFIX install in PREFIX [$prefix]"
1e43adfc
FB
312echo " --interp-prefix=PREFIX where to find shared libraries, etc."
313echo " use %M for cpu name [$interp_prefix]"
97a847bc 314echo " --target-list=LIST set target list [$target_list]"
7d13299d 315echo ""
c9ec1fe4
FB
316echo "kqemu kernel acceleration support:"
317echo " --disable-kqemu disable kqemu build"
318echo " --kernel-path=PATH set the kernel path (configure probes it)"
319echo ""
7d13299d
FB
320echo "Advanced options (experts only):"
321echo " --source-path=PATH path of source code [$source_path]"
322echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
323echo " --cc=CC use C compiler CC [$cc]"
324echo " --make=MAKE use specified make [$make]"
43ce4dfe 325echo " --static enable static build [$static]"
67b915a5 326echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
102a52e4
FB
327echo " --enable-fmod enable FMOD audio output driver"
328echo " --fmod-lib path to FMOD library"
329echo " --fmod-inc path to FMOD includes"
7d13299d
FB
330echo ""
331echo "NOTE: The object files are build at the place where configure is launched"
332exit 1
333fi
334
11d9f695
FB
335if test "$mingw32" = "yes" ; then
336if test -z "$prefix" ; then
337 prefix="/c/Program Files/Qemu"
338fi
339mandir="$prefix"
7efa4387 340datadir="$prefix"
1f50f8d1 341docdir="$prefix"
11d9f695
FB
342bindir="$prefix"
343else
344if test -z "$prefix" ; then
345 prefix="/usr/local"
346fi
5a67135a 347mandir="$prefix/share/man"
7efa4387 348datadir="$prefix/share/qemu"
1f50f8d1 349docdir="$prefix/share/doc/qemu"
11d9f695
FB
350bindir="$prefix/bin"
351fi
5a67135a 352
c9ec1fe4 353# kernel module support
441c72ba
FB
354if test $kqemu = "yes" ; then
355 # test if the source code is installed
356 if test '!' -f "kqemu/Makefile" ; then
357 kqemu="no"
358 fi
359fi
360
c9ec1fe4
FB
361if test $kqemu = "yes" ; then
362# find the kernel path
363if test -z "$kernel_path" ; then
364kernel_version=`uname -r`
365kernel_path="/lib/modules/$kernel_version/build"
366if test '!' -d "$kernel_path/include" ; then
367 kernel_path="/usr/src/linux"
368 if test '!' -d "$kernel_path/include" ; then
369 echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module"
370 kqemu="no"
371 fi
372fi
373fi
374
375if test $kqemu = "yes" ; then
376
377# test that the kernel config is present
378if test '!' -f "$kernel_path/Makefile" ; then
f94daedd 379 echo "No Makefile file present in $kernel_path - kqemu cannot be built"
c9ec1fe4
FB
380 kqemu="no"
381fi
382
383# find build system (2.6 or legacy)
384kbuild26="yes"
385if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
386kbuild26="no"
387fi
388
389fi # kqemu
390
391fi # kqemu
392
393
43ce4dfe 394echo "Install prefix $prefix"
7efa4387 395echo "BIOS directory $datadir"
11d9f695
FB
396echo "binary directory $bindir"
397if test "$mingw32" = "no" ; then
398echo "Manual directory $mandir"
43ce4dfe 399echo "ELF interp prefix $interp_prefix"
11d9f695 400fi
5a67135a 401echo "Source path $source_path"
43ce4dfe
FB
402echo "C compiler $cc"
403echo "make $make"
404echo "host CPU $cpu"
de83cd02 405echo "host big endian $bigendian"
97a847bc 406echo "target list $target_list"
43ce4dfe
FB
407echo "gprof enabled $gprof"
408echo "static build $static"
5b0753e0
FB
409if test "$darwin" = "yes" ; then
410 echo "Cocoa support $cocoa"
411fi
97a847bc 412echo "SDL support $sdl"
7c1f25b4 413echo "SDL static link $sdl_static"
67b915a5 414echo "mingw32 support $mingw32"
fb065187 415echo "Adlib support $adlib"
102a52e4
FB
416echo -n "FMOD support $fmod"
417if test $fmod = "yes"; then
418 echo -n " (lib='$fmod_lib' include='$fmod_inc')"
419fi
420echo ""
c9ec1fe4
FB
421if test $kqemu = "yes" ; then
422echo ""
423echo "KQEMU module configuration:"
424echo "kernel sources $kernel_path"
425echo -n "kbuild type "
426if test $kbuild26 = "yes"; then
427echo "2.6"
428else
429echo "2.4"
430fi
431fi
67b915a5 432
97a847bc 433if test $sdl_too_old = "yes"; then
24b55b96 434echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 435fi
24b55b96
FB
436#if test "$sdl_static" = "no"; then
437# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
438#fi
97a847bc
FB
439
440config_mak="config-host.mak"
441config_h="config-host.h"
7d13299d 442
7c1f25b4 443#echo "Creating $config_mak and $config_h"
7d13299d 444
97a847bc
FB
445echo "# Automatically generated by configure - do not modify" > $config_mak
446echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 447
97a847bc 448echo "prefix=$prefix" >> $config_mak
11d9f695 449echo "bindir=$bindir" >> $config_mak
5a67135a 450echo "mandir=$mandir" >> $config_mak
7efa4387 451echo "datadir=$datadir" >> $config_mak
1f50f8d1 452echo "docdir=$docdir" >> $config_mak
7efa4387 453echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
97a847bc
FB
454echo "MAKE=$make" >> $config_mak
455echo "CC=$cc" >> $config_mak
e8cd23de 456if test "$have_gcc3_options" = "yes" ; then
97a847bc 457 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
e8cd23de 458fi
97a847bc
FB
459echo "HOST_CC=$host_cc" >> $config_mak
460echo "AR=$ar" >> $config_mak
461echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
462echo "CFLAGS=$CFLAGS" >> $config_mak
463echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 464echo "EXESUF=$EXESUF" >> $config_mak
97a847bc
FB
465if test "$cpu" = "i386" ; then
466 echo "ARCH=i386" >> $config_mak
467 echo "#define HOST_I386 1" >> $config_h
0b0babc6
FB
468elif test "$cpu" = "x86_64" ; then
469 echo "ARCH=x86_64" >> $config_mak
470 echo "#define HOST_X86_64 1" >> $config_h
808c4954
FB
471elif test "$cpu" = "armv4b" ; then
472 echo "ARCH=arm" >> $config_mak
473 echo "#define HOST_ARM 1" >> $config_h
7d13299d 474elif test "$cpu" = "armv4l" ; then
97a847bc
FB
475 echo "ARCH=arm" >> $config_mak
476 echo "#define HOST_ARM 1" >> $config_h
7d13299d 477elif test "$cpu" = "powerpc" ; then
97a847bc
FB
478 echo "ARCH=ppc" >> $config_mak
479 echo "#define HOST_PPC 1" >> $config_h
7d13299d 480elif test "$cpu" = "mips" ; then
97a847bc
FB
481 echo "ARCH=mips" >> $config_mak
482 echo "#define HOST_MIPS 1" >> $config_h
fb3e5849 483elif test "$cpu" = "s390" ; then
97a847bc
FB
484 echo "ARCH=s390" >> $config_mak
485 echo "#define HOST_S390 1" >> $config_h
295defa5 486elif test "$cpu" = "alpha" ; then
97a847bc
FB
487 echo "ARCH=alpha" >> $config_mak
488 echo "#define HOST_ALPHA 1" >> $config_h
ae228531 489elif test "$cpu" = "sparc" ; then
97a847bc
FB
490 echo "ARCH=sparc" >> $config_mak
491 echo "#define HOST_SPARC 1" >> $config_h
ae228531 492elif test "$cpu" = "sparc64" ; then
97a847bc
FB
493 echo "ARCH=sparc64" >> $config_mak
494 echo "#define HOST_SPARC64 1" >> $config_h
a8baa8c5 495elif test "$cpu" = "ia64" ; then
97a847bc
FB
496 echo "ARCH=ia64" >> $config_mak
497 echo "#define HOST_IA64 1" >> $config_h
38e584a0 498elif test "$cpu" = "m68k" ; then
38ca2abc
FB
499 echo "ARCH=m68k" >> $config_mak
500 echo "#define HOST_M68K 1" >> $config_h
7d13299d
FB
501else
502 echo "Unsupported CPU"
503 exit 1
504fi
505if test "$bigendian" = "yes" ; then
97a847bc
FB
506 echo "WORDS_BIGENDIAN=yes" >> $config_mak
507 echo "#define WORDS_BIGENDIAN 1" >> $config_h
508fi
67b915a5
FB
509if test "$mingw32" = "yes" ; then
510 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 511 echo "#define CONFIG_WIN32 1" >> $config_h
7d3505c5 512elif test -f "/usr/include/byteswap.h" ; then
67b915a5
FB
513 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
514fi
83fb7adf
FB
515if test "$darwin" = "yes" ; then
516 echo "CONFIG_DARWIN=yes" >> $config_mak
517 echo "#define CONFIG_DARWIN 1" >> $config_h
518fi
67b915a5
FB
519if test "$gdbstub" = "yes" ; then
520 echo "CONFIG_GDBSTUB=yes" >> $config_mak
521 echo "#define CONFIG_GDBSTUB 1" >> $config_h
522fi
97a847bc
FB
523if test "$gprof" = "yes" ; then
524 echo "TARGET_GPROF=yes" >> $config_mak
525 echo "#define HAVE_GPROF 1" >> $config_h
526fi
527if test "$static" = "yes" ; then
528 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 529 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 530fi
c20709aa
FB
531if test "$slirp" = "yes" ; then
532 echo "CONFIG_SLIRP=yes" >> $config_mak
533 echo "#define CONFIG_SLIRP 1" >> $config_h
534fi
fb065187
FB
535if test "$adlib" = "yes" ; then
536 echo "CONFIG_ADLIB=yes" >> $config_mak
537 echo "#define CONFIG_ADLIB 1" >> $config_h
538fi
539if test "$oss" = "yes" ; then
540 echo "CONFIG_OSS=yes" >> $config_mak
541 echo "#define CONFIG_OSS 1" >> $config_h
542fi
102a52e4
FB
543if test "$fmod" = "yes" ; then
544 echo "CONFIG_FMOD=yes" >> $config_mak
545 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
546 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
547 echo "#define CONFIG_FMOD 1" >> $config_h
548fi
97a847bc
FB
549echo -n "VERSION=" >>$config_mak
550head $source_path/VERSION >>$config_mak
551echo "" >>$config_mak
552echo -n "#define QEMU_VERSION \"" >> $config_h
553head $source_path/VERSION >> $config_h
554echo "\"" >> $config_h
555
c9ec1fe4
FB
556if test $kqemu = "yes" ; then
557 echo "CONFIG_KQEMU=yes" >> $config_mak
558 echo "KERNEL_PATH=$kernel_path" >> $config_mak
559 if test $kbuild26 = "yes" ; then
560 echo "CONFIG_KBUILD26=yes" >> $config_mak
561 fi
562fi
97a847bc
FB
563echo "SRC_PATH=$source_path" >> $config_mak
564echo "TARGET_DIRS=$target_list" >> $config_mak
565
83fb7adf 566# XXX: suppress that
7d3505c5 567if [ "$bsd" = "yes" ] ; then
43003046 568 echo "#define O_LARGEFILE 0" >> $config_h
43003046 569 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
7d3505c5
FB
570 echo "#define _BSD 1" >> $config_h
571fi
572
97a847bc
FB
573for target in $target_list; do
574
575target_dir="$target"
576config_mak=$target_dir/config.mak
577config_h=$target_dir/config.h
578target_cpu=`echo $target | cut -d '-' -f 1`
579target_bigendian="no"
808c4954 580[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1e43adfc 581[ "$target_cpu" = "sparc" ] && target_bigendian=yes
64b3ab24 582[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
67867308 583[ "$target_cpu" = "ppc" ] && target_bigendian=yes
97a847bc
FB
584target_softmmu="no"
585if expr $target : '.*-softmmu' > /dev/null ; then
586 target_softmmu="yes"
587fi
997344f3
FB
588target_user_only="no"
589if expr $target : '.*-user' > /dev/null ; then
590 target_user_only="yes"
591fi
97a847bc 592
7c1f25b4 593#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc
FB
594
595mkdir -p $target_dir
158142c2 596mkdir -p $target_dir/fpu
808c4954 597if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
69de927c
FB
598 mkdir -p $target_dir/nwfpe
599fi
a7e61ed4
FB
600if test "$target_user_only" = "no" ; then
601 mkdir -p $target_dir/slirp
602fi
69de927c 603
97a847bc
FB
604ln -sf $source_path/Makefile.target $target_dir/Makefile
605
606echo "# Automatically generated by configure - do not modify" > $config_mak
607echo "/* Automatically generated by configure - do not modify */" > $config_h
608
de83cd02 609
97a847bc
FB
610echo "include ../config-host.mak" >> $config_mak
611echo "#include \"../config-host.h\"" >> $config_h
1e43adfc
FB
612
613interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
614echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
97a847bc
FB
615
616if test "$target_cpu" = "i386" ; then
617 echo "TARGET_ARCH=i386" >> $config_mak
618 echo "#define TARGET_ARCH \"i386\"" >> $config_h
619 echo "#define TARGET_I386 1" >> $config_h
824d560f
FB
620 if test $kqemu = "yes" -a "$target_softmmu" = "yes" ; then
621 echo "#define USE_KQEMU 1" >> $config_h
622 fi
808c4954 623elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
97a847bc
FB
624 echo "TARGET_ARCH=arm" >> $config_mak
625 echo "#define TARGET_ARCH \"arm\"" >> $config_h
626 echo "#define TARGET_ARM 1" >> $config_h
1e43adfc
FB
627elif test "$target_cpu" = "sparc" ; then
628 echo "TARGET_ARCH=sparc" >> $config_mak
629 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
630 echo "#define TARGET_SPARC 1" >> $config_h
64b3ab24
FB
631elif test "$target_cpu" = "sparc64" ; then
632 echo "TARGET_ARCH=sparc64" >> $config_mak
633 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
634 echo "#define TARGET_SPARC 1" >> $config_h
635 echo "#define TARGET_SPARC64 1" >> $config_h
67867308
FB
636elif test "$target_cpu" = "ppc" ; then
637 echo "TARGET_ARCH=ppc" >> $config_mak
638 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
639 echo "#define TARGET_PPC 1" >> $config_h
0b0babc6
FB
640elif test "$target_cpu" = "x86_64" ; then
641 echo "TARGET_ARCH=x86_64" >> $config_mak
642 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
643 echo "#define TARGET_I386 1" >> $config_h
644 echo "#define TARGET_X86_64 1" >> $config_h
de83cd02
FB
645else
646 echo "Unsupported target CPU"
647 exit 1
648fi
649if test "$target_bigendian" = "yes" ; then
97a847bc
FB
650 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
651 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 652fi
97a847bc
FB
653if test "$target_softmmu" = "yes" ; then
654 echo "CONFIG_SOFTMMU=yes" >> $config_mak
655 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 656fi
997344f3
FB
657if test "$target_user_only" = "yes" ; then
658 echo "CONFIG_USER_ONLY=yes" >> $config_mak
659 echo "#define CONFIG_USER_ONLY 1" >> $config_h
660fi
97a847bc 661
158142c2
FB
662if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
663 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
664 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
665fi
7c1f25b4
FB
666# sdl defines
667
668if test "$target_user_only" = "no"; then
669 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
dbb2c921 670 sdl1=$sdl_static
7c1f25b4 671 else
dbb2c921
FB
672 sdl1=$sdl
673 fi
674 if test "$sdl1" = "yes" ; then
675 echo "#define CONFIG_SDL 1" >> $config_h
676 echo "CONFIG_SDL=yes" >> $config_mak
677 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
678 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
679 else
7c1f25b4
FB
680 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
681 fi
dbb2c921
FB
682 echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
683 if [ "${aa}" = "yes" ] ; then
684 echo -n " `aalib-config --cflags`" >> $config_mak ;
685 fi
686 echo "" >> $config_mak
7c1f25b4 687 fi
7c1f25b4
FB
688fi
689
5b0753e0
FB
690if test "$cocoa" = "yes" ; then
691 echo "#define CONFIG_COCOA 1" >> $config_h
692 echo "CONFIG_COCOA=yes" >> $config_mak
693fi
694
97a847bc 695done # for target in $targets
7d13299d
FB
696
697# build tree in object directory if source path is different from current one
698if test "$source_path_used" = "yes" ; then
699 DIRS="tests"
700 FILES="Makefile tests/Makefile"
701 for dir in $DIRS ; do
702 mkdir -p $dir
703 done
704 for f in $FILES ; do
705 ln -sf $source_path/$f $f
706 done
707fi
7d13299d 708
97a847bc 709rm -f $TMPO $TMPC $TMPE $TMPS