blob: ed4c4f745b0dee5dde5906f512651f1304ec5e49 [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 ;;
bellardba680552005-03-13 09:49:52 +000035 armv*b)
bellard808c4952004-12-19 23:33:47 +000036 cpu="armv4b"
37 ;;
bellardba680552005-03-13 09:49:52 +000038 armv*l)
bellard7d132992003-03-06 23:23:54 +000039 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
bellardc326e0a2005-04-23 18:30:28 +000091CYGWIN*)
92mingw32="yes"
93CFLAGS="-O2 -mno-cygwin"
94;;
bellard67b915a2004-03-31 23:37:16 +000095MINGW32*)
96mingw32="yes"
97;;
bellard7d3505c2004-05-12 19:32:15 +000098FreeBSD)
99bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000100oss="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000101if [ "$cpu" = "i386" ] ; then
102 kqemu="yes"
103fi
bellard7d3505c2004-05-12 19:32:15 +0000104;;
105NetBSD)
106bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000107oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000108;;
109OpenBSD)
110bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000111oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000112;;
bellard83fb7ad2004-07-05 21:25:26 +0000113Darwin)
114bsd="yes"
115darwin="yes"
116;;
bellardfb065182004-11-09 23:09:44 +0000117*)
118oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000119linux="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000120if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000121 kqemu="yes"
122fi
bellardfb065182004-11-09 23:09:44 +0000123;;
bellard7d132992003-03-06 23:23:54 +0000124esac
125
bellard7d3505c2004-05-12 19:32:15 +0000126if [ "$bsd" = "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000127 if [ ! "$darwin" = "yes" ] ; then
128 make="gmake"
129 fi
bellard7d3505c2004-05-12 19:32:15 +0000130fi
131
bellard7d132992003-03-06 23:23:54 +0000132# 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 ;;
bellard32ce6332003-04-11 00:16:16 +0000147 --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
148 ;;
bellard7d132992003-03-06 23:23:54 +0000149 --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 ;;
bellard7d132992003-03-06 23:23:54 +0000161 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
162 ;;
bellard97a847b2003-08-10 21:36:04 +0000163 --target-list=*) target_list=${opt#--target-list=}
bellardde83cd02003-06-15 20:25:43 +0000164 ;;
bellard7d132992003-03-06 23:23:54 +0000165 --enable-gprof) gprof="yes"
166 ;;
bellard43ce4df2003-06-09 19:53:12 +0000167 --static) static="yes"
168 ;;
bellard97a847b2003-08-10 21:36:04 +0000169 --disable-sdl) sdl="no"
170 ;;
bellard102a52e2004-11-14 19:57:29 +0000171 --enable-fmod) fmod="yes"
172 ;;
173 --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
174 ;;
175 --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
176 ;;
bellard67b915a2004-03-31 23:37:16 +0000177 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
178 ;;
bellard443f1372004-06-04 11:13:20 +0000179 --disable-slirp) slirp="no"
bellardc20709a2004-04-21 23:27:19 +0000180 ;;
bellardfb065182004-11-09 23:09:44 +0000181 --enable-adlib) adlib="yes"
182 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000183 --disable-kqemu) kqemu="no"
184 ;;
185 --kernel-path=*) kernel_path=${opt#--kernel-path=}
186 ;;
bellard5b0753e2005-03-01 21:37:28 +0000187 --enable-cocoa) cocoa="yes" ; sdl="no"
188 ;;
bellard7d132992003-03-06 23:23:54 +0000189 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
bellard67b915a2004-03-31 23:37:16 +0000201if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000202 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000203 EXESUF=".exe"
204 gdbstub="no"
bellard9f059ec2004-11-14 18:59:52 +0000205 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000206 if [ "$cpu" = "i386" ] ; then
207 kqemu="yes"
208 fi
bellard67b915a2004-03-31 23:37:16 +0000209fi
210
bellard5327cf42005-01-10 23:18:50 +0000211if test -z "$target_list" ; then
212# these targets are portable
bellarda20b5522005-02-19 17:24:28 +0000213 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu"
bellard5327cf42005-01-10 23:18:50 +0000214# the following are Linux specific
215 if [ "$linux" = "yes" ] ; then
bellarda20b5522005-02-19 17:24:28 +0000216 target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000217 fi
bellard6e20a452005-06-05 15:56:02 +0000218else
219 target_list=$(echo "$target_list" | sed -e 's/,/ /g')
bellard5327cf42005-01-10 23:18:50 +0000220fi
221
bellard7d132992003-03-06 23:23:54 +0000222if 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
bellard808c4952004-12-19 23:33:47 +0000243if 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 +0000244 bigendian="yes"
245fi
246
247fi
248
bellarde8cd23d2003-06-25 16:08:13 +0000249# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000250cat > $TMPC <<EOF
251int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000252}
253EOF
254
bellarde8cd23d2003-06-25 16:08:13 +0000255have_gcc3_options="no"
256if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
257 have_gcc3_options="yes"
bellard04369ff2003-03-20 22:33:23 +0000258fi
bellardca735202003-03-18 20:41:34 +0000259
bellard11d9f692004-04-02 20:55:59 +0000260##########################################
261# SDL probe
262
263sdl_too_old=no
264
265if test -z "$sdl" ; then
266
bellarda6e022a2004-04-02 21:55:47 +0000267sdl_config="sdl-config"
268sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000269sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000270
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
bellard11d9f692004-04-02 20:55:59 +0000277cat > $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
bellarda6e022a2004-04-02 21:55:47 +0000283if $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'`
bellard11d9f692004-04-02 20:55:59 +0000285if test "$_sdlversion" -lt 121 ; then
286sdl_too_old=yes
287else
288sdl=yes
289fi
bellard7c1f25b2004-04-22 00:02:08 +0000290
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
bellardd8d8aa42004-04-29 20:14:07 +0000297 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000298fi
299
bellard7c1f25b2004-04-22 00:02:08 +0000300if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
301 sdl_static=yes
302fi
303
304fi # static link
305
306fi # sdl compile test
307
bellarda6e022a2004-04-02 21:55:47 +0000308fi # cross compilation
309fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000310
bellard7d132992003-03-06 23:23:54 +0000311if 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]"
bellard1e43adf2003-09-30 20:54:24 +0000321echo " --interp-prefix=PREFIX where to find shared libraries, etc."
322echo " use %M for cpu name [$interp_prefix]"
bellard97a847b2003-08-10 21:36:04 +0000323echo " --target-list=LIST set target list [$target_list]"
bellard7d132992003-03-06 23:23:54 +0000324echo ""
bellardc9ec1fe2005-02-10 21:55:30 +0000325echo "kqemu kernel acceleration support:"
326echo " --disable-kqemu disable kqemu build"
327echo " --kernel-path=PATH set the kernel path (configure probes it)"
328echo ""
bellard7d132992003-03-06 23:23:54 +0000329echo "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]"
bellard43ce4df2003-06-09 19:53:12 +0000334echo " --static enable static build [$static]"
bellard67b915a2004-03-31 23:37:16 +0000335echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
bellardd37282a2005-04-28 20:41:53 +0000336echo " --enable-adlib enable Adlib emulation"
bellard102a52e2004-11-14 19:57:29 +0000337echo " --enable-fmod enable FMOD audio output driver"
338echo " --fmod-lib path to FMOD library"
339echo " --fmod-inc path to FMOD includes"
bellard7d132992003-03-06 23:23:54 +0000340echo ""
341echo "NOTE: The object files are build at the place where configure is launched"
342exit 1
343fi
344
bellard11d9f692004-04-02 20:55:59 +0000345if test "$mingw32" = "yes" ; then
346if test -z "$prefix" ; then
347 prefix="/c/Program Files/Qemu"
348fi
349mandir="$prefix"
bellard7efa4382004-05-12 18:54:06 +0000350datadir="$prefix"
bellard1f50f8d2004-05-08 14:44:43 +0000351docdir="$prefix"
bellard11d9f692004-04-02 20:55:59 +0000352bindir="$prefix"
353else
354if test -z "$prefix" ; then
355 prefix="/usr/local"
356fi
bellard5a671352003-10-01 00:13:48 +0000357mandir="$prefix/share/man"
bellard7efa4382004-05-12 18:54:06 +0000358datadir="$prefix/share/qemu"
bellard1f50f8d2004-05-08 14:44:43 +0000359docdir="$prefix/share/doc/qemu"
bellard11d9f692004-04-02 20:55:59 +0000360bindir="$prefix/bin"
361fi
bellard5a671352003-10-01 00:13:48 +0000362
bellard07f4ddb2005-04-23 17:44:28 +0000363# kqemu support
bellardc9ec1fe2005-02-10 21:55:30 +0000364if test $kqemu = "yes" ; then
bellard441c72b2005-02-12 14:45:23 +0000365 # test if the source code is installed
366 if test '!' -f "kqemu/Makefile" ; then
367 kqemu="no"
368 fi
369fi
370
bellard07f4ddb2005-04-23 17:44:28 +0000371# Linux specific kqemu configuration
372if test $kqemu = "yes" -a $linux = "yes" ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000373# 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
bellardf94daed2005-03-01 21:28:22 +0000390 echo "No Makefile file present in $kernel_path - kqemu cannot be built"
bellardc9ec1fe2005-02-10 21:55:30 +0000391 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
bellard07f4ddb2005-04-23 17:44:28 +0000402fi # kqemu and linux
bellardc9ec1fe2005-02-10 21:55:30 +0000403
404
bellard43ce4df2003-06-09 19:53:12 +0000405echo "Install prefix $prefix"
bellard7efa4382004-05-12 18:54:06 +0000406echo "BIOS directory $datadir"
bellard11d9f692004-04-02 20:55:59 +0000407echo "binary directory $bindir"
408if test "$mingw32" = "no" ; then
409echo "Manual directory $mandir"
bellard43ce4df2003-06-09 19:53:12 +0000410echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000411fi
bellard5a671352003-10-01 00:13:48 +0000412echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000413echo "C compiler $cc"
414echo "make $make"
415echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000416echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000417echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000418echo "gprof enabled $gprof"
419echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000420if test "$darwin" = "yes" ; then
421 echo "Cocoa support $cocoa"
422fi
bellard97a847b2003-08-10 21:36:04 +0000423echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000424if test "$sdl" != "no" ; then
425 echo "SDL static link $sdl_static"
426fi
bellard67b915a2004-03-31 23:37:16 +0000427echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000428echo "Adlib support $adlib"
bellard102a52e2004-11-14 19:57:29 +0000429echo -n "FMOD support $fmod"
430if test $fmod = "yes"; then
431 echo -n " (lib='$fmod_lib' include='$fmod_inc')"
432fi
433echo ""
bellard07f4ddb2005-04-23 17:44:28 +0000434echo "kqemu support $kqemu"
435if test $kqemu = "yes" -a $linux = "yes" ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000436echo ""
bellard07f4ddb2005-04-23 17:44:28 +0000437echo "KQEMU Linux module configuration:"
bellardc9ec1fe2005-02-10 21:55:30 +0000438echo "kernel sources $kernel_path"
439echo -n "kbuild type "
440if test $kbuild26 = "yes"; then
441echo "2.6"
442else
443echo "2.4"
444fi
445fi
bellard67b915a2004-03-31 23:37:16 +0000446
bellard97a847b2003-08-10 21:36:04 +0000447if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000448echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000449fi
bellard24b55b92005-03-01 22:30:41 +0000450#if test "$sdl_static" = "no"; then
451# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
452#fi
bellard97a847b2003-08-10 21:36:04 +0000453
454config_mak="config-host.mak"
455config_h="config-host.h"
456
bellard7c1f25b2004-04-22 00:02:08 +0000457#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000458
459echo "# Automatically generated by configure - do not modify" > $config_mak
460echo "/* Automatically generated by configure - do not modify */" > $config_h
461
462echo "prefix=$prefix" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000463echo "bindir=$bindir" >> $config_mak
bellard5a671352003-10-01 00:13:48 +0000464echo "mandir=$mandir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000465echo "datadir=$datadir" >> $config_mak
bellard1f50f8d2004-05-08 14:44:43 +0000466echo "docdir=$docdir" >> $config_mak
bellard7efa4382004-05-12 18:54:06 +0000467echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000468echo "MAKE=$make" >> $config_mak
469echo "CC=$cc" >> $config_mak
470if test "$have_gcc3_options" = "yes" ; then
471 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
472fi
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
bellard67b915a2004-03-31 23:37:16 +0000478echo "EXESUF=$EXESUF" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000479if test "$cpu" = "i386" ; then
480 echo "ARCH=i386" >> $config_mak
481 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000482elif test "$cpu" = "x86_64" ; then
483 echo "ARCH=x86_64" >> $config_mak
484 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000485elif test "$cpu" = "armv4b" ; then
486 echo "ARCH=arm" >> $config_mak
487 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000488elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000489 echo "ARCH=arm" >> $config_mak
490 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000491elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000492 echo "ARCH=ppc" >> $config_mak
493 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000494elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000495 echo "ARCH=mips" >> $config_mak
496 echo "#define HOST_MIPS 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000497elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000498 echo "ARCH=s390" >> $config_mak
499 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000500elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000501 echo "ARCH=alpha" >> $config_mak
502 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000503elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000504 echo "ARCH=sparc" >> $config_mak
505 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000506elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000507 echo "ARCH=sparc64" >> $config_mak
508 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000509elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000510 echo "ARCH=ia64" >> $config_mak
511 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000512elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000513 echo "ARCH=m68k" >> $config_mak
514 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000515else
516 echo "Unsupported CPU"
517 exit 1
518fi
519if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000520 echo "WORDS_BIGENDIAN=yes" >> $config_mak
521 echo "#define WORDS_BIGENDIAN 1" >> $config_h
522fi
bellard67b915a2004-03-31 23:37:16 +0000523if test "$mingw32" = "yes" ; then
524 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000525 echo "#define CONFIG_WIN32 1" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000526elif test -f "/usr/include/byteswap.h" ; then
bellard67b915a2004-03-31 23:37:16 +0000527 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
528fi
bellard83fb7ad2004-07-05 21:25:26 +0000529if test "$darwin" = "yes" ; then
530 echo "CONFIG_DARWIN=yes" >> $config_mak
531 echo "#define CONFIG_DARWIN 1" >> $config_h
532fi
bellard67b915a2004-03-31 23:37:16 +0000533if test "$gdbstub" = "yes" ; then
534 echo "CONFIG_GDBSTUB=yes" >> $config_mak
535 echo "#define CONFIG_GDBSTUB 1" >> $config_h
536fi
bellard97a847b2003-08-10 21:36:04 +0000537if 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
bellard50863472003-10-28 23:04:01 +0000543 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000544fi
bellardc20709a2004-04-21 23:27:19 +0000545if test "$slirp" = "yes" ; then
546 echo "CONFIG_SLIRP=yes" >> $config_mak
547 echo "#define CONFIG_SLIRP 1" >> $config_h
548fi
bellardfb065182004-11-09 23:09:44 +0000549if 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
bellard102a52e2004-11-14 19:57:29 +0000557if 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
bellard97a847b2003-08-10 21:36:04 +0000563echo -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
bellardc9ec1fe2005-02-10 21:55:30 +0000570if test $kqemu = "yes" ; then
571 echo "CONFIG_KQEMU=yes" >> $config_mak
bellard1026f132005-04-26 20:34:45 +0000572 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
bellardc9ec1fe2005-02-10 21:55:30 +0000577 fi
578fi
bellard97a847b2003-08-10 21:36:04 +0000579echo "SRC_PATH=$source_path" >> $config_mak
580echo "TARGET_DIRS=$target_list" >> $config_mak
581
bellard83fb7ad2004-07-05 21:25:26 +0000582# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000583if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000584 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000585 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000586 echo "#define _BSD 1" >> $config_h
587fi
588
bellard97a847b2003-08-10 21:36:04 +0000589for 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"
bellard808c4952004-12-19 23:33:47 +0000596[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000597[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000598[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000599[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000600target_softmmu="no"
601if expr $target : '.*-softmmu' > /dev/null ; then
602 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000603fi
bellard997344f2003-10-27 21:10:39 +0000604target_user_only="no"
605if expr $target : '.*-user' > /dev/null ; then
606 target_user_only="yes"
607fi
bellardde83cd02003-06-15 20:25:43 +0000608
bellard7c1f25b2004-04-22 00:02:08 +0000609#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000610
611mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000612mkdir -p $target_dir/fpu
bellard808c4952004-12-19 23:33:47 +0000613if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
bellard69de9272004-02-16 21:40:43 +0000614 mkdir -p $target_dir/nwfpe
615fi
bellarda7e61ed2004-04-22 21:46:47 +0000616if test "$target_user_only" = "no" ; then
617 mkdir -p $target_dir/slirp
618fi
bellard69de9272004-02-16 21:40:43 +0000619
bellard97a847b2003-08-10 21:36:04 +0000620ln -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
625
626echo "include ../config-host.mak" >> $config_mak
627echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000628
629interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
630echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000631
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
bellard07f4ddb2005-04-23 17:44:28 +0000636 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000637 echo "#define USE_KQEMU 1" >> $config_h
638 fi
bellard808c4952004-12-19 23:33:47 +0000639elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000640 echo "TARGET_ARCH=arm" >> $config_mak
641 echo "#define TARGET_ARCH \"arm\"" >> $config_h
642 echo "#define TARGET_ARM 1" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000643elif 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
bellard64b3ab22005-01-30 22:43:42 +0000647elif 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
bellard67867302003-11-23 17:05:30 +0000652elif 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
bellard0b0babc2005-01-03 23:38:40 +0000656elif 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
bellard07f4ddb2005-04-23 17:44:28 +0000661 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
662 echo "#define USE_KQEMU 1" >> $config_h
663 fi
bellardde83cd02003-06-15 20:25:43 +0000664else
665 echo "Unsupported target CPU"
666 exit 1
667fi
668if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000669 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
670 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
671fi
672if test "$target_softmmu" = "yes" ; then
673 echo "CONFIG_SOFTMMU=yes" >> $config_mak
674 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000675fi
bellard997344f2003-10-27 21:10:39 +0000676if test "$target_user_only" = "yes" ; then
677 echo "CONFIG_USER_ONLY=yes" >> $config_mak
678 echo "#define CONFIG_USER_ONLY 1" >> $config_h
679fi
bellardde83cd02003-06-15 20:25:43 +0000680
bellard158142c2005-03-13 16:54:06 +0000681if 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
bellard7c1f25b2004-04-22 00:02:08 +0000685# sdl defines
686
687if test "$target_user_only" = "no"; then
688 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000689 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000690 else
bellarddbb2c922004-10-24 22:17:47 +0000691 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
bellard7c1f25b2004-04-22 00:02:08 +0000699 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
700 fi
bellarddbb2c922004-10-24 22:17:47 +0000701 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
bellard7c1f25b2004-04-22 00:02:08 +0000706 fi
bellard7c1f25b2004-04-22 00:02:08 +0000707fi
708
bellard5b0753e2005-03-01 21:37:28 +0000709if test "$cocoa" = "yes" ; then
710 echo "#define CONFIG_COCOA 1" >> $config_h
711 echo "CONFIG_COCOA=yes" >> $config_mak
712fi
713
bellard97a847b2003-08-10 21:36:04 +0000714done # for target in $targets
bellard7d132992003-03-06 23:23:54 +0000715
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
bellard7d132992003-03-06 23:23:54 +0000727
bellard97a847b2003-08-10 21:36:04 +0000728rm -f $TMPO $TMPC $TMPE $TMPS