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