blob: e9978276d3a6124a8fdfea70646135f2afd158c2 [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
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
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${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"
bellard7d132992003-03-06 23:23:54 +000018
19# default parameters
bellard11d9f692004-04-02 20:55:59 +000020prefix=""
bellard1e43adf2003-09-30 20:54:24 +000021interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000022static="no"
bellard7d132992003-03-06 23:23:54 +000023cross_prefix=""
24cc="gcc"
25host_cc="gcc"
26ar="ar"
27make="make"
28strip="strip"
29cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000030target_list=""
bellard7d132992003-03-06 23:23:54 +000031case "$cpu" in
32 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000033 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000034 ;;
bellard808c4952004-12-19 23:33:47 +000035 armv4b)
36 cpu="armv4b"
37 ;;
bellard7d132992003-03-06 23:23:54 +000038 armv4l)
39 cpu="armv4l"
40 ;;
41 alpha)
42 cpu="alpha"
43 ;;
bellard295defa2003-04-07 21:31:29 +000044 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000045 cpu="powerpc"
46 ;;
47 mips)
48 cpu="mips"
49 ;;
bellardfb3e5842003-03-29 17:32:36 +000050 s390)
51 cpu="s390"
52 ;;
bellardae228532003-05-13 18:59:59 +000053 sparc)
54 cpu="sparc"
55 ;;
56 sparc64)
57 cpu="sparc64"
58 ;;
bellarda8baa8c2003-04-29 20:53:31 +000059 ia64)
60 cpu="ia64"
61 ;;
bellard38e584a2003-08-10 22:14:22 +000062 m68k)
63 cpu="m68k"
64 ;;
bellardbc51c5c2004-03-17 23:46:04 +000065 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000066 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000067 ;;
bellard7d132992003-03-06 23:23:54 +000068 *)
69 cpu="unknown"
70 ;;
71esac
72gprof="no"
73bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000074mingw32="no"
75EXESUF=""
76gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000077slirp="yes"
bellardfb065182004-11-09 23:09:44 +000078adlib="no"
79oss="no"
bellard102a52e2004-11-14 19:57:29 +000080fmod="no"
81fmod_lib=""
82fmod_inc=""
bellard5327cf42005-01-10 23:18:50 +000083linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000084kqemu="no"
85kernel_path=""
bellard5b0753e2005-03-01 21:37:28 +000086cocoa="no"
bellard7d132992003-03-06 23:23:54 +000087
88# OS specific
89targetos=`uname -s`
90case $targetos in
bellard67b915a2004-03-31 23:37:16 +000091MINGW32*)
92mingw32="yes"
93;;
bellard7d3505c2004-05-12 19:32:15 +000094FreeBSD)
95bsd="yes"
bellardfb065182004-11-09 23:09:44 +000096oss="yes"
bellard7d3505c2004-05-12 19:32:15 +000097;;
98NetBSD)
99bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000100oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000101;;
102OpenBSD)
103bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000104oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000105;;
bellard83fb7ad2004-07-05 21:25:26 +0000106Darwin)
107bsd="yes"
108darwin="yes"
109;;
bellardfb065182004-11-09 23:09:44 +0000110*)
111oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000112linux="yes"
bellardc9ec1fe2005-02-10 21:55:30 +0000113if [ "$cpu" = "i386" ] ; then
114 kqemu="yes"
115fi
bellardfb065182004-11-09 23:09:44 +0000116;;
bellard7d132992003-03-06 23:23:54 +0000117esac
118
bellard7d3505c2004-05-12 19:32:15 +0000119if [ "$bsd" = "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000120 if [ ! "$darwin" = "yes" ] ; then
121 make="gmake"
122 fi
bellard7d3505c2004-05-12 19:32:15 +0000123fi
124
bellard7d132992003-03-06 23:23:54 +0000125# 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 ;;
bellard32ce6332003-04-11 00:16:16 +0000140 --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
141 ;;
bellard7d132992003-03-06 23:23:54 +0000142 --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 ;;
bellard97a847b2003-08-10 21:36:04 +0000158 --target-list=*) target_list=${opt#--target-list=}
bellardde83cd02003-06-15 20:25:43 +0000159 ;;
bellard7d132992003-03-06 23:23:54 +0000160 --enable-gprof) gprof="yes"
161 ;;
bellard43ce4df2003-06-09 19:53:12 +0000162 --static) static="yes"
163 ;;
bellard97a847b2003-08-10 21:36:04 +0000164 --disable-sdl) sdl="no"
165 ;;
bellard102a52e2004-11-14 19:57:29 +0000166 --enable-fmod) fmod="yes"
167 ;;
168 --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
169 ;;
170 --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
171 ;;
bellard67b915a2004-03-31 23:37:16 +0000172 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
173 ;;
bellard443f1372004-06-04 11:13:20 +0000174 --disable-slirp) slirp="no"
bellardc20709a2004-04-21 23:27:19 +0000175 ;;
bellardfb065182004-11-09 23:09:44 +0000176 --enable-adlib) adlib="yes"
177 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000178 --disable-kqemu) kqemu="no"
179 ;;
180 --kernel-path=*) kernel_path=${opt#--kernel-path=}
181 ;;
bellard5b0753e2005-03-01 21:37:28 +0000182 --enable-cocoa) cocoa="yes" ; sdl="no"
183 ;;
bellard7d132992003-03-06 23:23:54 +0000184 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
bellard67b915a2004-03-31 23:37:16 +0000196if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000197 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000198 EXESUF=".exe"
199 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000200 oss="no"
bellard824d5602005-02-12 18:58:00 +0000201 kqemu="no"
bellard67b915a2004-03-31 23:37:16 +0000202fi
203
bellard5327cf42005-01-10 23:18:50 +0000204if test -z "$target_list" ; then
205# these targets are portable
bellarda20b5522005-02-19 17:24:28 +0000206 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu"
bellard5327cf42005-01-10 23:18:50 +0000207# the following are Linux specific
208 if [ "$linux" = "yes" ] ; then
bellarda20b5522005-02-19 17:24:28 +0000209 target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000210 fi
211fi
212
bellard7d132992003-03-06 23:23:54 +0000213if 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
bellard808c4952004-12-19 23:33:47 +0000234if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
bellard7d132992003-03-06 23:23:54 +0000235 bigendian="yes"
236fi
237
238fi
239
bellarde8cd23d2003-06-25 16:08:13 +0000240# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000241cat > $TMPC <<EOF
242int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000243}
244EOF
245
bellarde8cd23d2003-06-25 16:08:13 +0000246have_gcc3_options="no"
247if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
248 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000249fi
bellardca735202003-03-18 20:41:34 +0000250
bellard11d9f692004-04-02 20:55:59 +0000251##########################################
252# SDL probe
253
254sdl_too_old=no
255
256if test -z "$sdl" ; then
257
bellarda6e022a2004-04-02 21:55:47 +0000258sdl_config="sdl-config"
259sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000260sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000261
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
bellard11d9f692004-04-02 20:55:59 +0000268cat > $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
bellarda6e022a2004-04-02 21:55:47 +0000274if $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'`
bellard11d9f692004-04-02 20:55:59 +0000276if test "$_sdlversion" -lt 121 ; then
277sdl_too_old=yes
278else
279sdl=yes
280fi
bellard7c1f25b2004-04-22 00:02:08 +0000281
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
bellardd8d8aa42004-04-29 20:14:07 +0000288 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000289fi
290
bellard7c1f25b2004-04-22 00:02:08 +0000291if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
292 sdl_static=yes
293fi
294
295fi # static link
296
297fi # sdl compile test
298
bellarda6e022a2004-04-02 21:55:47 +0000299fi # cross compilation
300fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000301
bellard7d132992003-03-06 23:23:54 +0000302if 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]"
bellard1e43adf2003-09-30 20:54:24 +0000312echo " --interp-prefix=PREFIX where to find shared libraries, etc."
313echo " use %M for cpu name [$interp_prefix]"
bellard97a847b2003-08-10 21:36:04 +0000314echo " --target-list=LIST set target list [$target_list]"
bellard7d132992003-03-06 23:23:54 +0000315echo ""
bellardc9ec1fe2005-02-10 21:55:30 +0000316echo "kqemu kernel acceleration support:"
317echo " --disable-kqemu disable kqemu build"
318echo " --kernel-path=PATH set the kernel path (configure probes it)"
319echo ""
bellard7d132992003-03-06 23:23:54 +0000320echo "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]"
bellard43ce4df2003-06-09 19:53:12 +0000325echo " --static enable static build [$static]"
bellard67b915a2004-03-31 23:37:16 +0000326echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
bellard102a52e2004-11-14 19:57:29 +0000327echo " --enable-fmod enable FMOD audio output driver"
328echo " --fmod-lib path to FMOD library"
329echo " --fmod-inc path to FMOD includes"
bellard7d132992003-03-06 23:23:54 +0000330echo ""
331echo "NOTE: The object files are build at the place where configure is launched"
332exit 1
333fi
334
bellard11d9f692004-04-02 20:55:59 +0000335if test "$mingw32" = "yes" ; then
336if test -z "$prefix" ; then
337 prefix="/c/Program Files/Qemu"
338fi
339mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000340datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000341docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000342bindir="$prefix"
343else
344if test -z "$prefix" ; then
345 prefix="/usr/local"
346fi
bellard5a671352003-10-01 00:13:48 +0000347mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000348datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000349docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000350bindir="$prefix/bin"
351fi
bellard5a671352003-10-01 00:13:48 +0000352
bellardc9ec1fe2005-02-10 21:55:30 +0000353# kernel module support
354if test $kqemu = "yes" ; then
bellard441c72b2005-02-12 14:45:23 +0000355 # test if the source code is installed
356 if test '!' -f "kqemu/Makefile" ; then
357 kqemu="no"
358 fi
359fi
360
361if test $kqemu = "yes" ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000362# 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
bellardf94daed2005-03-01 21:28:22 +0000379 echo "No Makefile file present in $kernel_path - kqemu cannot be built"
bellardc9ec1fe2005-02-10 21:55:30 +0000380 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
bellard43ce4df2003-06-09 19:53:12 +0000394echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000395echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000396echo "binary directory $bindir"
397if test "$mingw32" = "no" ; then
398echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000399echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000400fi
bellard5a671352003-10-01 00:13:48 +0000401echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000402echo "C compiler $cc"
403echo "make $make"
404echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000405echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000406echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000407echo "gprof enabled $gprof"
408echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000409if test "$darwin" = "yes" ; then
410 echo "Cocoa support $cocoa"
411fi
bellard97a847b2003-08-10 21:36:04 +0000412echo "SDL support $sdl"
bellard7c1f25b2004-04-22 00:02:08 +0000413echo "SDL static link $sdl_static"
bellard67b915a2004-03-31 23:37:16 +0000414echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000415echo "Adlib support $adlib"
bellard102a52e2004-11-14 19:57:29 +0000416echo -n "FMOD support $fmod"
417if test $fmod = "yes"; then
418 echo -n " (lib='$fmod_lib' include='$fmod_inc')"
419fi
420echo ""
bellardc9ec1fe2005-02-10 21:55:30 +0000421if 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
bellard67b915a2004-03-31 23:37:16 +0000432
bellard97a847b2003-08-10 21:36:04 +0000433if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000434echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000435fi
bellard24b55b92005-03-01 22:30:41 +0000436#if test "$sdl_static" = "no"; then
437# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
438#fi
bellard97a847b2003-08-10 21:36:04 +0000439
440config_mak="config-host.mak"
441config_h="config-host.h"
442
bellard7c1f25b2004-04-22 00:02:08 +0000443#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000444
445echo "# Automatically generated by configure - do not modify" > $config_mak
446echo "/* Automatically generated by configure - do not modify */" > $config_h
447
448echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000449echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000450echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000451echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000452echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000453echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000454echo "MAKE=$make" >> $config_mak
455echo "CC=$cc" >> $config_mak
456if test "$have_gcc3_options" = "yes" ; then
457 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
458fi
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
bellard67b915a2004-03-31 23:37:16 +0000464echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000465if test "$cpu" = "i386" ; then
466 echo "ARCH=i386" >> $config_mak
467 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000468elif test "$cpu" = "x86_64" ; then
469 echo "ARCH=x86_64" >> $config_mak
470 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000471elif test "$cpu" = "armv4b" ; then
472 echo "ARCH=arm" >> $config_mak
473 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000474elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000475 echo "ARCH=arm" >> $config_mak
476 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000477elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000478 echo "ARCH=ppc" >> $config_mak
479 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000480elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000481 echo "ARCH=mips" >> $config_mak
482 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000483elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000484 echo "ARCH=s390" >> $config_mak
485 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000486elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000487 echo "ARCH=alpha" >> $config_mak
488 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000489elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000490 echo "ARCH=sparc" >> $config_mak
491 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000492elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000493 echo "ARCH=sparc64" >> $config_mak
494 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000495elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000496 echo "ARCH=ia64" >> $config_mak
497 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000498elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000499 echo "ARCH=m68k" >> $config_mak
500 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000501else
502 echo "Unsupported CPU"
503 exit 1
504fi
505if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000506 echo "WORDS_BIGENDIAN=yes" >> $config_mak
507 echo "#define WORDS_BIGENDIAN 1" >> $config_h
508fi
bellard67b915a2004-03-31 23:37:16 +0000509if test "$mingw32" = "yes" ; then
510 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000511 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000512elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000513 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
514fi
bellard83fb7ad2004-07-05 21:25:26 +0000515if test "$darwin" = "yes" ; then
516 echo "CONFIG_DARWIN=yes" >> $config_mak
517 echo "#define CONFIG_DARWIN 1" >> $config_h
518fi
bellard67b915a2004-03-31 23:37:16 +0000519if test "$gdbstub" = "yes" ; then
520 echo "CONFIG_GDBSTUB=yes" >> $config_mak
521 echo "#define CONFIG_GDBSTUB 1" >> $config_h
522fi
bellard97a847b2003-08-10 21:36:04 +0000523if 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
bellard50863472003-10-28 23:04:01 +0000529 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000530fi
bellardc20709a2004-04-21 23:27:19 +0000531if test "$slirp" = "yes" ; then
532 echo "CONFIG_SLIRP=yes" >> $config_mak
533 echo "#define CONFIG_SLIRP 1" >> $config_h
534fi
bellardfb065182004-11-09 23:09:44 +0000535if 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
bellard102a52e2004-11-14 19:57:29 +0000543if 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
bellard97a847b2003-08-10 21:36:04 +0000549echo -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
bellardc9ec1fe2005-02-10 21:55:30 +0000556if 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
bellard97a847b2003-08-10 21:36:04 +0000563echo "SRC_PATH=$source_path" >> $config_mak
564echo "TARGET_DIRS=$target_list" >> $config_mak
565
bellard83fb7ad2004-07-05 21:25:26 +0000566# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000567if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000568 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000569 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000570 echo "#define _BSD 1" >> $config_h
571fi
572
bellard97a847b2003-08-10 21:36:04 +0000573for 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"
bellard808c4952004-12-19 23:33:47 +0000580[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000581[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000582[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000583[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000584target_softmmu="no"
585if expr $target : '.*-softmmu' > /dev/null ; then
586 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000587fi
bellard997344f2003-10-27 21:10:39 +0000588target_user_only="no"
589if expr $target : '.*-user' > /dev/null ; then
590 target_user_only="yes"
591fi
bellardde83cd02003-06-15 20:25:43 +0000592
bellard7c1f25b2004-04-22 00:02:08 +0000593#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000594
595mkdir -p $target_dir
bellard808c4952004-12-19 23:33:47 +0000596if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000597 mkdir -p $target_dir/nwfpe
598fi
bellarda7e61ed2004-04-22 21:46:47 +0000599if test "$target_user_only" = "no" ; then
600 mkdir -p $target_dir/slirp
601fi
bellard69de9272004-02-16 21:40:43 +0000602
bellard97a847b2003-08-10 21:36:04 +0000603ln -sf $source_path/Makefile.target $target_dir/Makefile
604
605echo "# Automatically generated by configure - do not modify" > $config_mak
606echo "/* Automatically generated by configure - do not modify */" > $config_h
607
608
609echo "include ../config-host.mak" >> $config_mak
610echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000611
612interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
613echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000614
615if test "$target_cpu" = "i386" ; then
616 echo "TARGET_ARCH=i386" >> $config_mak
617 echo "#define TARGET_ARCH \"i386\"" >> $config_h
618 echo "#define TARGET_I386 1" >> $config_h
bellard824d5602005-02-12 18:58:00 +0000619 if test $kqemu = "yes" -a "$target_softmmu" = "yes" ; then
620 echo "#define USE_KQEMU 1" >> $config_h
621 fi
bellard808c4952004-12-19 23:33:47 +0000622elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000623 echo "TARGET_ARCH=arm" >> $config_mak
624 echo "#define TARGET_ARCH \"arm\"" >> $config_h
625 echo "#define TARGET_ARM 1" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000626elif test "$target_cpu" = "sparc" ; then
627 echo "TARGET_ARCH=sparc" >> $config_mak
628 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
629 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000630elif test "$target_cpu" = "sparc64" ; then
631 echo "TARGET_ARCH=sparc64" >> $config_mak
632 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
633 echo "#define TARGET_SPARC 1" >> $config_h
634 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000635elif test "$target_cpu" = "ppc" ; then
636 echo "TARGET_ARCH=ppc" >> $config_mak
637 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
638 echo "#define TARGET_PPC 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000639elif test "$target_cpu" = "x86_64" ; then
640 echo "TARGET_ARCH=x86_64" >> $config_mak
641 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
642 echo "#define TARGET_I386 1" >> $config_h
643 echo "#define TARGET_X86_64 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000644else
645 echo "Unsupported target CPU"
646 exit 1
647fi
648if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000649 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
650 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
651fi
652if test "$target_softmmu" = "yes" ; then
653 echo "CONFIG_SOFTMMU=yes" >> $config_mak
654 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000655fi
bellard997344f2003-10-27 21:10:39 +0000656if test "$target_user_only" = "yes" ; then
657 echo "CONFIG_USER_ONLY=yes" >> $config_mak
658 echo "#define CONFIG_USER_ONLY 1" >> $config_h
659fi
bellardde83cd02003-06-15 20:25:43 +0000660
bellard7c1f25b2004-04-22 00:02:08 +0000661# sdl defines
662
663if test "$target_user_only" = "no"; then
664 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000665 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000666 else
bellarddbb2c922004-10-24 22:17:47 +0000667 sdl1=$sdl
668 fi
669 if test "$sdl1" = "yes" ; then
670 echo "#define CONFIG_SDL 1" >> $config_h
671 echo "CONFIG_SDL=yes" >> $config_mak
672 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
673 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
674 else
bellard7c1f25b2004-04-22 00:02:08 +0000675 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
676 fi
bellarddbb2c922004-10-24 22:17:47 +0000677 echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
678 if [ "${aa}" = "yes" ] ; then
679 echo -n " `aalib-config --cflags`" >> $config_mak ;
680 fi
681 echo "" >> $config_mak
bellard7c1f25b2004-04-22 00:02:08 +0000682 fi
bellard7c1f25b2004-04-22 00:02:08 +0000683fi
684
bellard5b0753e2005-03-01 21:37:28 +0000685if test "$cocoa" = "yes" ; then
686 echo "#define CONFIG_COCOA 1" >> $config_h
687 echo "CONFIG_COCOA=yes" >> $config_mak
688fi
689
bellard97a847b2003-08-10 21:36:04 +0000690done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000691
692# build tree in object directory if source path is different from current one
693if test "$source_path_used" = "yes" ; then
694 DIRS="tests"
695 FILES="Makefile tests/Makefile"
696 for dir in $DIRS ; do
697 mkdir -p $dir
698 done
699 for f in $FILES ; do
700 ln -sf $source_path/$f $f
701 done
702fi
bellard7d132992003-03-06 23:23:54 +0000703
bellard97a847b2003-08-10 21:36:04 +0000704rm -f $TMPO $TMPC $TMPE $TMPS