blob: a7761ca2813c2af8771bdbd2a94a8d2a0f633665 [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"
pbrook328a4242006-12-19 03:31:34 +000025gcc3_search="yes"
26gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
bellard7d132992003-03-06 23:23:54 +000027host_cc="gcc"
28ar="ar"
29make="make"
pbrook6a882642006-04-17 13:57:12 +000030install="install"
bellard7d132992003-03-06 23:23:54 +000031strip="strip"
32cpu=`uname -m`
bellard5327cf42005-01-10 23:18:50 +000033target_list=""
bellard7d132992003-03-06 23:23:54 +000034case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +000036 cpu="i386"
bellard7d132992003-03-06 23:23:54 +000037 ;;
bellardba680552005-03-13 09:49:52 +000038 armv*b)
bellard808c4952004-12-19 23:33:47 +000039 cpu="armv4b"
40 ;;
bellardba680552005-03-13 09:49:52 +000041 armv*l)
bellard7d132992003-03-06 23:23:54 +000042 cpu="armv4l"
43 ;;
44 alpha)
45 cpu="alpha"
46 ;;
bellard295defa2003-04-07 21:31:29 +000047 "Power Macintosh"|ppc|ppc64)
bellard7d132992003-03-06 23:23:54 +000048 cpu="powerpc"
49 ;;
50 mips)
51 cpu="mips"
52 ;;
thsfbe4f652007-04-01 11:16:48 +000053 mips64)
54 cpu="mips64"
55 ;;
bellardfb3e5842003-03-29 17:32:36 +000056 s390)
57 cpu="s390"
58 ;;
pbrook94ac5152006-04-26 16:07:35 +000059 sparc|sun4[muv])
bellardae228532003-05-13 18:59:59 +000060 cpu="sparc"
61 ;;
62 sparc64)
63 cpu="sparc64"
64 ;;
bellarda8baa8c2003-04-29 20:53:31 +000065 ia64)
66 cpu="ia64"
67 ;;
bellard38e584a2003-08-10 22:14:22 +000068 m68k)
69 cpu="m68k"
70 ;;
bellardbc51c5c2004-03-17 23:46:04 +000071 x86_64|amd64)
bellard0b0babc2005-01-03 23:38:40 +000072 cpu="x86_64"
bellardbc51c5c2004-03-17 23:46:04 +000073 ;;
bellard7d132992003-03-06 23:23:54 +000074 *)
75 cpu="unknown"
76 ;;
77esac
78gprof="no"
79bigendian="no"
bellard67b915a2004-03-31 23:37:16 +000080mingw32="no"
81EXESUF=""
82gdbstub="yes"
bellard443f1372004-06-04 11:13:20 +000083slirp="yes"
bellardfb065182004-11-09 23:09:44 +000084adlib="no"
85oss="no"
bellard1d14ffa2005-10-30 18:58:22 +000086dsound="no"
87coreaudio="no"
88alsa="no"
bellard102a52e2004-11-14 19:57:29 +000089fmod="no"
90fmod_lib=""
91fmod_inc=""
pbrookb1a550a2006-04-16 13:28:56 +000092bsd="no"
bellard5327cf42005-01-10 23:18:50 +000093linux="no"
bellardc9ec1fe2005-02-10 21:55:30 +000094kqemu="no"
bellard05c2a3e2006-02-08 22:39:17 +000095profiler="no"
bellard5b0753e2005-03-01 21:37:28 +000096cocoa="no"
bellard97ccc682005-07-02 13:32:17 +000097check_gfx="yes"
bellard1aff3812005-11-02 22:30:45 +000098check_gcc="yes"
pbrook0a8e90f2006-03-19 14:54:16 +000099softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000100linux_user="no"
101darwin_user="no"
pbrookcc8ae6d2006-04-23 17:57:59 +0000102build_docs="no"
pbrookc5937222006-05-14 11:30:38 +0000103uname_release=""
bellard7d132992003-03-06 23:23:54 +0000104
105# OS specific
106targetos=`uname -s`
107case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000108CYGWIN*)
109mingw32="yes"
ths6f30fa82007-01-05 01:00:47 +0000110OS_CFLAGS="-mno-cygwin"
bellardc326e0a2005-04-23 18:30:28 +0000111;;
bellard67b915a2004-03-31 23:37:16 +0000112MINGW32*)
113mingw32="yes"
114;;
bellard7d3505c2004-05-12 19:32:15 +0000115FreeBSD)
116bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000117oss="yes"
bellarde99f9062005-07-28 21:45:38 +0000118if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellard07f4ddb2005-04-23 17:44:28 +0000119 kqemu="yes"
120fi
bellard7d3505c2004-05-12 19:32:15 +0000121;;
122NetBSD)
123bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000124oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000125;;
126OpenBSD)
127bsd="yes"
bellardfb065182004-11-09 23:09:44 +0000128oss="yes"
bellard7d3505c2004-05-12 19:32:15 +0000129;;
bellard83fb7ad2004-07-05 21:25:26 +0000130Darwin)
131bsd="yes"
132darwin="yes"
ths831b7822007-01-18 20:06:33 +0000133darwin_user="yes"
thsfd677642007-01-31 12:10:07 +0000134cocoa="yes"
135coreaudio="yes"
ths6f30fa82007-01-05 01:00:47 +0000136OS_CFLAGS="-mdynamic-no-pic"
bellard83fb7ad2004-07-05 21:25:26 +0000137;;
bellardec530c82006-04-25 22:36:06 +0000138SunOS)
thsc2b84fa2007-02-10 23:21:21 +0000139 solaris="yes"
140 make="gmake"
141 install="ginstall"
ths0475a5c2007-04-01 18:54:44 +0000142 needs_libsunmath="no"
thsc2b84fa2007-02-10 23:21:21 +0000143 solarisrev=`uname -r | cut -f2 -d.`
144 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
ths0475a5c2007-04-01 18:54:44 +0000145 if test "$solarisrev" -le 9 ; then
146 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
147 needs_libsunmath="yes"
148 else
149 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
150 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
151 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
152 echo "Studio 11 can be downloaded from www.sun.com."
153 exit 1
154 fi
155 fi
156 if test "$solarisrev" -ge 9 ; then
thsc2b84fa2007-02-10 23:21:21 +0000157 kqemu="yes"
158 fi
ths86b2bd92007-02-11 00:31:33 +0000159 fi
160;;
bellard1d14ffa2005-10-30 18:58:22 +0000161*)
bellardfb065182004-11-09 23:09:44 +0000162oss="yes"
bellard5327cf42005-01-10 23:18:50 +0000163linux="yes"
ths831b7822007-01-18 20:06:33 +0000164linux_user="yes"
bellard07f4ddb2005-04-23 17:44:28 +0000165if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
bellardc9ec1fe2005-02-10 21:55:30 +0000166 kqemu="yes"
167fi
bellardfb065182004-11-09 23:09:44 +0000168;;
bellard7d132992003-03-06 23:23:54 +0000169esac
170
bellard7d3505c2004-05-12 19:32:15 +0000171if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000172 if [ "$darwin" != "yes" ] ; then
bellard83fb7ad2004-07-05 21:25:26 +0000173 make="gmake"
174 fi
bellard7d3505c2004-05-12 19:32:15 +0000175fi
176
bellard7d132992003-03-06 23:23:54 +0000177# find source path
pbrookad064842006-04-16 12:41:07 +0000178source_path=`dirname "$0"`
179if [ -z "$source_path" ]; then
bellard7d132992003-03-06 23:23:54 +0000180 source_path=`pwd`
pbrookad064842006-04-16 12:41:07 +0000181else
182 source_path=`cd "$source_path"; pwd`
183fi
184if test "$source_path" = `pwd` ; then
bellard7d132992003-03-06 23:23:54 +0000185 source_path_used="no"
pbrookad064842006-04-16 12:41:07 +0000186else
187 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000188fi
189
190for opt do
pbrooka46e4032006-04-29 23:05:22 +0000191 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000192 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000193 --help|-h) show_help=yes
194 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000195 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000196 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000197 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000198 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000199 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000200 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000201 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000202 --cross-prefix=*) cross_prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000203 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000204 --cc=*) cc="$optarg"
pbrook328a4242006-12-19 03:31:34 +0000205 gcc3_search="no"
bellard7d132992003-03-06 23:23:54 +0000206 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000207 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000208 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000209 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000210 ;;
pbrook6a882642006-04-17 13:57:12 +0000211 --install=*) install="$optarg"
212 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000213 --extra-cflags=*) CFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000214 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000215 --extra-ldflags=*) LDFLAGS="$optarg"
bellard7d132992003-03-06 23:23:54 +0000216 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000217 --cpu=*) cpu="$optarg"
bellard7d132992003-03-06 23:23:54 +0000218 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000219 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000220 ;;
bellard7d132992003-03-06 23:23:54 +0000221 --enable-gprof) gprof="yes"
222 ;;
bellard43ce4df2003-06-09 19:53:12 +0000223 --static) static="yes"
224 ;;
bellard97a847b2003-08-10 21:36:04 +0000225 --disable-sdl) sdl="no"
226 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000227 --enable-coreaudio) coreaudio="yes"
228 ;;
229 --enable-alsa) alsa="yes"
230 ;;
231 --enable-dsound) dsound="yes"
232 ;;
bellard102a52e2004-11-14 19:57:29 +0000233 --enable-fmod) fmod="yes"
234 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000235 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000236 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000237 --fmod-inc=*) fmod_inc="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000238 ;;
bellardb93aebe2007-02-15 22:58:18 +0000239 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
bellard1d14ffa2005-10-30 18:58:22 +0000240 ;;
bellard443f1372004-06-04 11:13:20 +0000241 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000242 ;;
bellardfb065182004-11-09 23:09:44 +0000243 --enable-adlib) adlib="yes"
bellard1d14ffa2005-10-30 18:58:22 +0000244 ;;
bellardc9ec1fe2005-02-10 21:55:30 +0000245 --disable-kqemu) kqemu="no"
bellard1d14ffa2005-10-30 18:58:22 +0000246 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000247 --enable-profiler) profiler="yes"
248 ;;
bellard1d14ffa2005-10-30 18:58:22 +0000249 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
250 ;;
bellard97ccc682005-07-02 13:32:17 +0000251 --disable-gfx-check) check_gfx="no"
252 ;;
bellard1aff3812005-11-02 22:30:45 +0000253 --disable-gcc-check) check_gcc="no"
254 ;;
pbrookcad25d62006-03-19 16:31:11 +0000255 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000256 ;;
pbrookcad25d62006-03-19 16:31:11 +0000257 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000258 ;;
ths831b7822007-01-18 20:06:33 +0000259 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000260 ;;
ths831b7822007-01-18 20:06:33 +0000261 --enable-linux-user) linux_user="yes"
262 ;;
263 --disable-darwin-user) darwin_user="no"
264 ;;
265 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000266 ;;
pbrookc5937222006-05-14 11:30:38 +0000267 --enable-uname-release=*) uname_release="$optarg"
268 ;;
bellard7d132992003-03-06 23:23:54 +0000269 esac
270done
271
ths209afb92007-03-25 20:55:00 +0000272if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
273 AIOLIBS=
274else
275 AIOLIBS="-lrt"
276fi
277
ths6f30fa82007-01-05 01:00:47 +0000278# default flags for all hosts
279CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
280LDFLAGS="$LDFLAGS -g"
281
pbrookaf5db582006-04-08 14:26:41 +0000282if test x"$show_help" = x"yes" ; then
283cat << EOF
284
285Usage: configure [options]
286Options: [defaults in brackets after descriptions]
287
288EOF
289echo "Standard options:"
290echo " --help print this message"
291echo " --prefix=PREFIX install in PREFIX [$prefix]"
292echo " --interp-prefix=PREFIX where to find shared libraries, etc."
293echo " use %M for cpu name [$interp_prefix]"
294echo " --target-list=LIST set target list [$target_list]"
295echo ""
296echo "kqemu kernel acceleration support:"
297echo " --disable-kqemu disable kqemu support"
pbrookaf5db582006-04-08 14:26:41 +0000298echo ""
299echo "Advanced options (experts only):"
300echo " --source-path=PATH path of source code [$source_path]"
301echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
302echo " --cc=CC use C compiler CC [$cc]"
303echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
304echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000305echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000306echo " --static enable static build [$static]"
307echo " --enable-cocoa enable COCOA (Mac OS X only)"
308echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
309echo " --enable-adlib enable Adlib emulation"
310echo " --enable-coreaudio enable Coreaudio audio driver"
311echo " --enable-alsa enable ALSA audio driver"
312echo " --enable-fmod enable FMOD audio driver"
thsed5065e2007-03-25 16:15:21 +0000313echo " --enable-dsound enable DirectSound audio driver"
pbrookaf5db582006-04-08 14:26:41 +0000314echo " --enable-system enable all system emulation targets"
315echo " --disable-system disable all system emulation targets"
ths831b7822007-01-18 20:06:33 +0000316echo " --enable-linux-user enable all linux usermode emulation targets"
317echo " --disable-linux-user disable all linux usermode emulation targets"
318echo " --enable-darwin-user enable all darwin usermode emulation targets"
319echo " --disable-darwin-user disable all darwin usermode emulation targets"
pbrookaf5db582006-04-08 14:26:41 +0000320echo " --fmod-lib path to FMOD library"
321echo " --fmod-inc path to FMOD includes"
pbrookc5937222006-05-14 11:30:38 +0000322echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
pbrookaf5db582006-04-08 14:26:41 +0000323echo ""
ths5bf08932006-12-23 00:33:26 +0000324echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000325exit 1
326fi
327
bellard7d132992003-03-06 23:23:54 +0000328cc="${cross_prefix}${cc}"
329ar="${cross_prefix}${ar}"
330strip="${cross_prefix}${strip}"
331
pbrook064aae12006-05-08 00:51:44 +0000332# check that the C compiler works.
333cat > $TMPC <<EOF
334int main(void) {}
335EOF
336
thscf257232007-02-11 15:02:17 +0000337if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
pbrook064aae12006-05-08 00:51:44 +0000338 : C compiler works ok
339else
340 echo "ERROR: \"$cc\" either does not exist or does not work"
341 exit 1
bellarda7350fa2006-04-23 14:35:23 +0000342fi
343
bellard67b915a2004-03-31 23:37:16 +0000344if test "$mingw32" = "yes" ; then
bellard5327cf42005-01-10 23:18:50 +0000345 linux="no"
bellard67b915a2004-03-31 23:37:16 +0000346 EXESUF=".exe"
bellard9f059ec2004-11-14 18:59:52 +0000347 oss="no"
bellard07f4ddb2005-04-23 17:44:28 +0000348 if [ "$cpu" = "i386" ] ; then
349 kqemu="yes"
350 fi
bellard67b915a2004-03-31 23:37:16 +0000351fi
352
pbrook328a4242006-12-19 03:31:34 +0000353# Check for gcc4, error if pre-gcc4
354if test "$check_gcc" = "yes" ; then
355 cat > $TMPC <<EOF
356#if __GNUC__ < 4
357#error gcc3
358#endif
359int main(){return 0;}
360EOF
361 check_cc() {
thscf257232007-02-11 15:02:17 +0000362 which "$1" 2> /dev/null
pbrook328a4242006-12-19 03:31:34 +0000363 return $?
364 }
365
thscf257232007-02-11 15:02:17 +0000366 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
pbrook328a4242006-12-19 03:31:34 +0000367 echo "WARNING: \"$cc\" looks like gcc 4.x"
368 found_compat_cc="no"
369 if test "$gcc3_search" = "yes" ; then
370 echo "Looking for gcc 3.x"
371 for compat_cc in $gcc3_list ; do
pbrook11244262007-02-27 01:03:41 +0000372 if check_cc "$cross_prefix$compat_cc" ; then
pbrook328a4242006-12-19 03:31:34 +0000373 echo "Found \"$compat_cc\""
pbrook11244262007-02-27 01:03:41 +0000374 cc="$cross_prefix$compat_cc"
pbrook328a4242006-12-19 03:31:34 +0000375 found_compat_cc="yes"
376 break
377 fi
378 done
379 if test "$found_compat_cc" = "no" ; then
380 echo "gcc 3.x not found!"
381 fi
382 fi
383 if test "$found_compat_cc" = "no" ; then
384 echo "QEMU is known to have problems when compiled with gcc 4.x"
385 echo "It is recommended that you use gcc 3.x to build QEMU"
386 echo "To use this compiler anyway, configure with --disable-gcc-check"
387 exit 1;
388 fi
389 fi
390fi
391
bellardec530c82006-04-25 22:36:06 +0000392#
393# Solaris specific configure tool chain decisions
394#
395if test "$solaris" = "yes" ; then
396 #
397 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
398 # override the check with --disable-gcc-check
399 #
400 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
401 solgcc=`which $cc`
402 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
403 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
404 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
405 echo "or get the latest patch from SunSolve for gcc"
406 exit 1
407 fi
408 fi
409 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
410 if test -z "$solinst" ; then
411 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
412 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
413 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
414 exit 1
415 fi
416 if test "$solinst" = "/usr/sbin/install" ; then
417 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
418 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
419 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
420 exit 1
421 fi
bellardec530c82006-04-25 22:36:06 +0000422 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
423 if test -z "$sol_ar" ; then
424 echo "Error: No path includes ar"
425 if test -f /usr/ccs/bin/ar ; then
426 echo "Add /usr/ccs/bin to your path and rerun configure"
427 fi
428 exit 1
429 fi
430fi
431
432
bellard5327cf42005-01-10 23:18:50 +0000433if test -z "$target_list" ; then
434# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000435 if [ "$softmmu" = "yes" ] ; then
thsfbe4f652007-04-01 11:16:48 +0000436 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc64-softmmu"
pbrook0a8e90f2006-03-19 14:54:16 +0000437 fi
bellard5327cf42005-01-10 23:18:50 +0000438# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000439 if [ "$linux_user" = "yes" ] ; then
440 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user $target_list"
441 fi
442# the following are Darwin specific
443 if [ "$darwin_user" = "yes" ] ; then
444 target_list="i386-darwin-user ppc-darwin-user $target_list"
bellard5327cf42005-01-10 23:18:50 +0000445 fi
bellard6e20a452005-06-05 15:56:02 +0000446else
pbrookb1a550a2006-04-16 13:28:56 +0000447 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +0000448fi
pbrook0a8e90f2006-03-19 14:54:16 +0000449if test -z "$target_list" ; then
450 echo "No targets enabled"
451 exit 1
452fi
bellard5327cf42005-01-10 23:18:50 +0000453
bellard7d132992003-03-06 23:23:54 +0000454if test -z "$cross_prefix" ; then
455
456# ---
457# big/little endian test
458cat > $TMPC << EOF
459#include <inttypes.h>
460int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +0000461 volatile uint32_t i=0x01234567;
462 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +0000463}
464EOF
465
thscf257232007-02-11 15:02:17 +0000466if $cc -o $TMPE $TMPC 2> /dev/null ; then
bellard7d132992003-03-06 23:23:54 +0000467$TMPE && bigendian="yes"
468else
469echo big/little test failed
470fi
471
472else
473
474# if cross compiling, cannot launch a program, so make a static guess
thsfbe4f652007-04-01 11:16:48 +0000475if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
bellard7d132992003-03-06 23:23:54 +0000476 bigendian="yes"
477fi
478
479fi
480
bellardb6853692005-06-05 17:10:39 +0000481# host long bits test
482hostlongbits="32"
483if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
484 hostlongbits="64"
485fi
486
bellarde8cd23d2003-06-25 16:08:13 +0000487# check gcc options support
bellard04369ff2003-03-20 22:33:23 +0000488cat > $TMPC <<EOF
489int main(void) {
bellard04369ff2003-03-20 22:33:23 +0000490}
491EOF
492
bellard11d9f692004-04-02 20:55:59 +0000493##########################################
494# SDL probe
495
496sdl_too_old=no
497
498if test -z "$sdl" ; then
499
bellarda6e022a2004-04-02 21:55:47 +0000500sdl_config="sdl-config"
501sdl=no
bellard7c1f25b2004-04-22 00:02:08 +0000502sdl_static=no
bellarda6e022a2004-04-02 21:55:47 +0000503
504if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
505# win32 cross compilation case
506 sdl_config="i386-mingw32msvc-sdl-config"
507 sdl=yes
508else
509# normal SDL probe
bellard11d9f692004-04-02 20:55:59 +0000510cat > $TMPC << EOF
511#include <SDL.h>
512#undef main /* We don't want SDL to override our main() */
513int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
514EOF
515
bellarda6e022a2004-04-02 21:55:47 +0000516if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
517_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
bellard11d9f692004-04-02 20:55:59 +0000518if test "$_sdlversion" -lt 121 ; then
519sdl_too_old=yes
520else
thsfd677642007-01-31 12:10:07 +0000521 if test "$cocoa" = "no" ; then
522 sdl=yes
523 fi
bellard11d9f692004-04-02 20:55:59 +0000524fi
bellard7c1f25b2004-04-22 00:02:08 +0000525
526# static link with sdl ?
527if test "$sdl" = "yes" ; then
528aa="no"
529`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
530sdl_static_libs=`$sdl_config --static-libs`
531if [ "$aa" = "yes" ] ; then
bellardd8d8aa42004-04-29 20:14:07 +0000532 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
bellard11d9f692004-04-02 20:55:59 +0000533fi
534
bellard7c1f25b2004-04-22 00:02:08 +0000535if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
536 sdl_static=yes
537fi
538
539fi # static link
540
541fi # sdl compile test
542
bellarda6e022a2004-04-02 21:55:47 +0000543fi # cross compilation
thsfd677642007-01-31 12:10:07 +0000544
545else
546 # Make sure to disable cocoa if sdl was set
547 if test "$sdl" = "yes" ; then
548 cocoa="no"
549 coreaudio="no"
550 fi
bellarda6e022a2004-04-02 21:55:47 +0000551fi # -z $sdl
bellard11d9f692004-04-02 20:55:59 +0000552
ths8f28f3f2007-01-05 21:25:54 +0000553##########################################
554# alsa sound support libraries
555
556if test "$alsa" = "yes" ; then
557 cat > $TMPC << EOF
558#include <alsa/asoundlib.h>
559int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
560EOF
561 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
562 :
563 else
564 echo
565 echo "Error: Could not find alsa"
566 echo "Make sure to have the alsa libs and headers installed."
567 echo
568 exit 1
569 fi
570fi
571
pbrookcc8ae6d2006-04-23 17:57:59 +0000572# Check if tools are available to build documentation.
pbrook94ac5152006-04-26 16:07:35 +0000573if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
pbrookcc8ae6d2006-04-23 17:57:59 +0000574 build_docs="yes"
575fi
576
bellard11d9f692004-04-02 20:55:59 +0000577if test "$mingw32" = "yes" ; then
pbrook308c3592007-02-27 00:52:01 +0000578 if test -z "$prefix" ; then
579 prefix="/c/Program Files/Qemu"
580 fi
581 mansuffix=""
582 datasuffix=""
583 docsuffix=""
584 binsuffix=""
bellard11d9f692004-04-02 20:55:59 +0000585else
pbrook308c3592007-02-27 00:52:01 +0000586 if test -z "$prefix" ; then
587 prefix="/usr/local"
588 fi
589 mansuffix="/share/man"
590 datasuffix="/share/qemu"
591 docsuffix="/share/doc/qemu"
592 binsuffix="/bin"
bellard11d9f692004-04-02 20:55:59 +0000593fi
bellard5a671352003-10-01 00:13:48 +0000594
bellard43ce4df2003-06-09 19:53:12 +0000595echo "Install prefix $prefix"
pbrook308c3592007-02-27 00:52:01 +0000596echo "BIOS directory $prefix$datasuffix"
597echo "binary directory $prefix$binsuffix"
bellard11d9f692004-04-02 20:55:59 +0000598if test "$mingw32" = "no" ; then
pbrook308c3592007-02-27 00:52:01 +0000599echo "Manual directory $prefix$mansuffix"
bellard43ce4df2003-06-09 19:53:12 +0000600echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +0000601fi
bellard5a671352003-10-01 00:13:48 +0000602echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +0000603echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +0000604echo "Host C compiler $host_cc"
bellard43ce4df2003-06-09 19:53:12 +0000605echo "make $make"
pbrook6a882642006-04-17 13:57:12 +0000606echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +0000607echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +0000608echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +0000609echo "target list $target_list"
bellard43ce4df2003-06-09 19:53:12 +0000610echo "gprof enabled $gprof"
bellard05c2a3e2006-02-08 22:39:17 +0000611echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +0000612echo "static build $static"
bellard5b0753e2005-03-01 21:37:28 +0000613if test "$darwin" = "yes" ; then
614 echo "Cocoa support $cocoa"
615fi
bellard97a847b2003-08-10 21:36:04 +0000616echo "SDL support $sdl"
bellarde4afee92005-04-26 20:46:24 +0000617if test "$sdl" != "no" ; then
618 echo "SDL static link $sdl_static"
619fi
bellard67b915a2004-03-31 23:37:16 +0000620echo "mingw32 support $mingw32"
bellardfb065182004-11-09 23:09:44 +0000621echo "Adlib support $adlib"
bellard1d14ffa2005-10-30 18:58:22 +0000622echo "CoreAudio support $coreaudio"
623echo "ALSA support $alsa"
624echo "DSound support $dsound"
bellard1d14ffa2005-10-30 18:58:22 +0000625if test "$fmod" = "yes"; then
626 if test -z $fmod_lib || test -z $fmod_inc; then
627 echo
628 echo "Error: You must specify path to FMOD library and headers"
629 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
630 echo
631 exit 1
632 fi
pbrookb1a550a2006-04-16 13:28:56 +0000633 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
634else
635 fmod_support=""
bellard102a52e2004-11-14 19:57:29 +0000636fi
pbrookb1a550a2006-04-16 13:28:56 +0000637echo "FMOD support $fmod $fmod_support"
bellard07f4ddb2005-04-23 17:44:28 +0000638echo "kqemu support $kqemu"
pbrookcc8ae6d2006-04-23 17:57:59 +0000639echo "Documentation $build_docs"
pbrookc5937222006-05-14 11:30:38 +0000640[ ! -z "$uname_release" ] && \
641echo "uname -r $uname_release"
bellard67b915a2004-03-31 23:37:16 +0000642
bellard97a847b2003-08-10 21:36:04 +0000643if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +0000644echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +0000645fi
bellard24b55b92005-03-01 22:30:41 +0000646#if test "$sdl_static" = "no"; then
647# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
648#fi
bellard97a847b2003-08-10 21:36:04 +0000649config_mak="config-host.mak"
650config_h="config-host.h"
651
bellard7c1f25b2004-04-22 00:02:08 +0000652#echo "Creating $config_mak and $config_h"
bellard97a847b2003-08-10 21:36:04 +0000653
654echo "# Automatically generated by configure - do not modify" > $config_mak
pbrook29517132006-02-09 17:58:47 +0000655echo "# Configured with: $0 $@" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000656echo "/* Automatically generated by configure - do not modify */" > $config_h
657
658echo "prefix=$prefix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000659echo "bindir=\${prefix}$binsuffix" >> $config_mak
660echo "mandir=\${prefix}$mansuffix" >> $config_mak
661echo "datadir=\${prefix}$datasuffix" >> $config_mak
ths4ad5b062007-03-03 21:47:02 +0000662echo "docdir=\${prefix}$docsuffix" >> $config_mak
pbrook308c3592007-02-27 00:52:01 +0000663echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000664echo "MAKE=$make" >> $config_mak
pbrook6a882642006-04-17 13:57:12 +0000665echo "INSTALL=$install" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000666echo "CC=$cc" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000667echo "HOST_CC=$host_cc" >> $config_mak
668echo "AR=$ar" >> $config_mak
669echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
ths6f30fa82007-01-05 01:00:47 +0000670echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000671echo "CFLAGS=$CFLAGS" >> $config_mak
672echo "LDFLAGS=$LDFLAGS" >> $config_mak
bellard67b915a2004-03-31 23:37:16 +0000673echo "EXESUF=$EXESUF" >> $config_mak
ths70956b72007-03-17 15:00:37 +0000674echo "AIOLIBS=$AIOLIBS" >> $config_mak
bellard97a847b2003-08-10 21:36:04 +0000675if test "$cpu" = "i386" ; then
676 echo "ARCH=i386" >> $config_mak
677 echo "#define HOST_I386 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000678elif test "$cpu" = "x86_64" ; then
679 echo "ARCH=x86_64" >> $config_mak
680 echo "#define HOST_X86_64 1" >> $config_h
bellard808c4952004-12-19 23:33:47 +0000681elif test "$cpu" = "armv4b" ; then
682 echo "ARCH=arm" >> $config_mak
683 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000684elif test "$cpu" = "armv4l" ; then
bellard97a847b2003-08-10 21:36:04 +0000685 echo "ARCH=arm" >> $config_mak
686 echo "#define HOST_ARM 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000687elif test "$cpu" = "powerpc" ; then
bellard97a847b2003-08-10 21:36:04 +0000688 echo "ARCH=ppc" >> $config_mak
689 echo "#define HOST_PPC 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000690elif test "$cpu" = "mips" ; then
bellard97a847b2003-08-10 21:36:04 +0000691 echo "ARCH=mips" >> $config_mak
692 echo "#define HOST_MIPS 1" >> $config_h
thsfbe4f652007-04-01 11:16:48 +0000693elif test "$cpu" = "mips64" ; then
694 echo "ARCH=mips64" >> $config_mak
695 echo "#define HOST_MIPS64 1" >> $config_h
bellardfb3e5842003-03-29 17:32:36 +0000696elif test "$cpu" = "s390" ; then
bellard97a847b2003-08-10 21:36:04 +0000697 echo "ARCH=s390" >> $config_mak
698 echo "#define HOST_S390 1" >> $config_h
bellard295defa2003-04-07 21:31:29 +0000699elif test "$cpu" = "alpha" ; then
bellard97a847b2003-08-10 21:36:04 +0000700 echo "ARCH=alpha" >> $config_mak
701 echo "#define HOST_ALPHA 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000702elif test "$cpu" = "sparc" ; then
bellard97a847b2003-08-10 21:36:04 +0000703 echo "ARCH=sparc" >> $config_mak
704 echo "#define HOST_SPARC 1" >> $config_h
bellardae228532003-05-13 18:59:59 +0000705elif test "$cpu" = "sparc64" ; then
bellard97a847b2003-08-10 21:36:04 +0000706 echo "ARCH=sparc64" >> $config_mak
707 echo "#define HOST_SPARC64 1" >> $config_h
bellarda8baa8c2003-04-29 20:53:31 +0000708elif test "$cpu" = "ia64" ; then
bellard97a847b2003-08-10 21:36:04 +0000709 echo "ARCH=ia64" >> $config_mak
710 echo "#define HOST_IA64 1" >> $config_h
bellard38e584a2003-08-10 22:14:22 +0000711elif test "$cpu" = "m68k" ; then
bellard38ca2ab2004-03-13 18:32:13 +0000712 echo "ARCH=m68k" >> $config_mak
713 echo "#define HOST_M68K 1" >> $config_h
bellard7d132992003-03-06 23:23:54 +0000714else
715 echo "Unsupported CPU"
716 exit 1
717fi
718if test "$bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000719 echo "WORDS_BIGENDIAN=yes" >> $config_mak
720 echo "#define WORDS_BIGENDIAN 1" >> $config_h
721fi
bellardb6853692005-06-05 17:10:39 +0000722echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
bellard67b915a2004-03-31 23:37:16 +0000723if test "$mingw32" = "yes" ; then
724 echo "CONFIG_WIN32=yes" >> $config_mak
bellard11d9f692004-04-02 20:55:59 +0000725 echo "#define CONFIG_WIN32 1" >> $config_h
pbrook210fa552007-02-27 21:04:49 +0000726else
727 cat > $TMPC << EOF
728#include <byteswap.h>
729int main(void) { return bswap_32(0); }
730EOF
731 if $cc -o $TMPE $TMPC 2> /dev/null ; then
732 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
733 fi
bellard67b915a2004-03-31 23:37:16 +0000734fi
bellard83fb7ad2004-07-05 21:25:26 +0000735if test "$darwin" = "yes" ; then
736 echo "CONFIG_DARWIN=yes" >> $config_mak
737 echo "#define CONFIG_DARWIN 1" >> $config_h
738fi
bellardec530c82006-04-25 22:36:06 +0000739if test "$solaris" = "yes" ; then
740 echo "CONFIG_SOLARIS=yes" >> $config_mak
bellard38cfa062006-05-01 13:58:07 +0000741 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
ths0475a5c2007-04-01 18:54:44 +0000742 if test "$needs_libsunmath" = "yes" ; then
743 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
744 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
745 fi
bellardec530c82006-04-25 22:36:06 +0000746fi
bellard67b915a2004-03-31 23:37:16 +0000747if test "$gdbstub" = "yes" ; then
748 echo "CONFIG_GDBSTUB=yes" >> $config_mak
749 echo "#define CONFIG_GDBSTUB 1" >> $config_h
750fi
bellard97a847b2003-08-10 21:36:04 +0000751if test "$gprof" = "yes" ; then
752 echo "TARGET_GPROF=yes" >> $config_mak
753 echo "#define HAVE_GPROF 1" >> $config_h
754fi
755if test "$static" = "yes" ; then
756 echo "CONFIG_STATIC=yes" >> $config_mak
bellard50863472003-10-28 23:04:01 +0000757 echo "#define CONFIG_STATIC 1" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000758fi
bellard05c2a3e2006-02-08 22:39:17 +0000759if test $profiler = "yes" ; then
760 echo "#define CONFIG_PROFILER 1" >> $config_h
761fi
bellardc20709a2004-04-21 23:27:19 +0000762if test "$slirp" = "yes" ; then
763 echo "CONFIG_SLIRP=yes" >> $config_mak
764 echo "#define CONFIG_SLIRP 1" >> $config_h
765fi
bellardfb065182004-11-09 23:09:44 +0000766if test "$adlib" = "yes" ; then
767 echo "CONFIG_ADLIB=yes" >> $config_mak
768 echo "#define CONFIG_ADLIB 1" >> $config_h
769fi
770if test "$oss" = "yes" ; then
771 echo "CONFIG_OSS=yes" >> $config_mak
772 echo "#define CONFIG_OSS 1" >> $config_h
773fi
bellard1d14ffa2005-10-30 18:58:22 +0000774if test "$coreaudio" = "yes" ; then
775 echo "CONFIG_COREAUDIO=yes" >> $config_mak
776 echo "#define CONFIG_COREAUDIO 1" >> $config_h
777fi
778if test "$alsa" = "yes" ; then
779 echo "CONFIG_ALSA=yes" >> $config_mak
780 echo "#define CONFIG_ALSA 1" >> $config_h
781fi
782if test "$dsound" = "yes" ; then
783 echo "CONFIG_DSOUND=yes" >> $config_mak
784 echo "#define CONFIG_DSOUND 1" >> $config_h
785fi
bellard102a52e2004-11-14 19:57:29 +0000786if test "$fmod" = "yes" ; then
787 echo "CONFIG_FMOD=yes" >> $config_mak
788 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
789 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
790 echo "#define CONFIG_FMOD 1" >> $config_h
791fi
pbrookb1a550a2006-04-16 13:28:56 +0000792qemu_version=`head $source_path/VERSION`
793echo "VERSION=$qemu_version" >>$config_mak
pbrookd4b8f032006-04-16 13:49:23 +0000794echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000795
796echo "SRC_PATH=$source_path" >> $config_mak
pbrookad064842006-04-16 12:41:07 +0000797if [ "$source_path_used" = "yes" ]; then
798 echo "VPATH=$source_path" >> $config_mak
799fi
bellard97a847b2003-08-10 21:36:04 +0000800echo "TARGET_DIRS=$target_list" >> $config_mak
pbrookcc8ae6d2006-04-23 17:57:59 +0000801if [ "$build_docs" = "yes" ] ; then
802 echo "BUILD_DOCS=yes" >> $config_mak
803fi
bellard97a847b2003-08-10 21:36:04 +0000804
bellard83fb7ad2004-07-05 21:25:26 +0000805# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +0000806if [ "$bsd" = "yes" ] ; then
bellard43003042004-05-20 13:23:39 +0000807 echo "#define O_LARGEFILE 0" >> $config_h
bellard43003042004-05-20 13:23:39 +0000808 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
bellard7d3505c2004-05-12 19:32:15 +0000809 echo "#define _BSD 1" >> $config_h
810fi
811
pbrookc5937222006-05-14 11:30:38 +0000812echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
813
bellard1d14ffa2005-10-30 18:58:22 +0000814for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +0000815target_dir="$target"
816config_mak=$target_dir/config.mak
817config_h=$target_dir/config.h
818target_cpu=`echo $target | cut -d '-' -f 1`
819target_bigendian="no"
bellard808c4952004-12-19 23:33:47 +0000820[ "$target_cpu" = "armeb" ] && target_bigendian=yes
bellard1e43adf2003-09-30 20:54:24 +0000821[ "$target_cpu" = "sparc" ] && target_bigendian=yes
bellard64b3ab22005-01-30 22:43:42 +0000822[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
bellard67867302003-11-23 17:05:30 +0000823[ "$target_cpu" = "ppc" ] && target_bigendian=yes
bellarda2458622005-07-23 22:39:53 +0000824[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
bellardd3258562005-07-02 15:37:12 +0000825[ "$target_cpu" = "mips" ] && target_bigendian=yes
thsfbe4f652007-04-01 11:16:48 +0000826[ "$target_cpu" = "mips64" ] && target_bigendian=yes
pbrook908f52b2006-06-18 19:16:53 +0000827[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
pbrooke6e59062006-10-22 00:18:54 +0000828[ "$target_cpu" = "m68k" ] && target_bigendian=yes
bellard97a847b2003-08-10 21:36:04 +0000829target_softmmu="no"
830if expr $target : '.*-softmmu' > /dev/null ; then
831 target_softmmu="yes"
bellard7d132992003-03-06 23:23:54 +0000832fi
bellard997344f2003-10-27 21:10:39 +0000833target_user_only="no"
834if expr $target : '.*-user' > /dev/null ; then
835 target_user_only="yes"
836fi
bellardde83cd02003-06-15 20:25:43 +0000837
ths831b7822007-01-18 20:06:33 +0000838target_linux_user="no"
839if expr $target : '.*-linux-user' > /dev/null ; then
840 target_linux_user="yes"
841fi
842
843target_darwin_user="no"
844if expr $target : '.*-darwin-user' > /dev/null ; then
845 target_darwin_user="yes"
846fi
847
bellard97ccc682005-07-02 13:32:17 +0000848if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
bellard1d14ffa2005-10-30 18:58:22 +0000849 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
bellard97ccc682005-07-02 13:32:17 +0000850 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
pbrook9c038502006-04-16 15:19:15 +0000851 echo "To build QEMU without graphical output configure with --disable-gfx-check"
bellard97ccc682005-07-02 13:32:17 +0000852 echo "Note that this will disable all output from the virtual graphics card."
853 exit 1;
854fi
855
bellard7c1f25b2004-04-22 00:02:08 +0000856#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
bellard97a847b2003-08-10 21:36:04 +0000857
858mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +0000859mkdir -p $target_dir/fpu
ths831b7822007-01-18 20:06:33 +0000860if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
bellard69de9272004-02-16 21:40:43 +0000861 mkdir -p $target_dir/nwfpe
862fi
bellarda7e61ed2004-04-22 21:46:47 +0000863if test "$target_user_only" = "no" ; then
864 mkdir -p $target_dir/slirp
865fi
bellard69de9272004-02-16 21:40:43 +0000866
bellardec530c82006-04-25 22:36:06 +0000867#
868# don't use ln -sf as not all "ln -sf" over write the file/link
869#
870rm -f $target_dir/Makefile
871ln -s $source_path/Makefile.target $target_dir/Makefile
872
bellard97a847b2003-08-10 21:36:04 +0000873
874echo "# Automatically generated by configure - do not modify" > $config_mak
875echo "/* Automatically generated by configure - do not modify */" > $config_h
876
877
878echo "include ../config-host.mak" >> $config_mak
879echo "#include \"../config-host.h\"" >> $config_h
bellard1e43adf2003-09-30 20:54:24 +0000880
pbrooke5fe0c52006-06-11 13:32:59 +0000881bflt="no"
bellard1e43adf2003-09-30 20:54:24 +0000882interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
883echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
bellard97a847b2003-08-10 21:36:04 +0000884
885if test "$target_cpu" = "i386" ; then
886 echo "TARGET_ARCH=i386" >> $config_mak
887 echo "#define TARGET_ARCH \"i386\"" >> $config_h
888 echo "#define TARGET_I386 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000889 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
bellard824d5602005-02-12 18:58:00 +0000890 echo "#define USE_KQEMU 1" >> $config_h
891 fi
bellard808c4952004-12-19 23:33:47 +0000892elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
bellard97a847b2003-08-10 21:36:04 +0000893 echo "TARGET_ARCH=arm" >> $config_mak
894 echo "#define TARGET_ARCH \"arm\"" >> $config_h
895 echo "#define TARGET_ARM 1" >> $config_h
pbrooke5fe0c52006-06-11 13:32:59 +0000896 bflt="yes"
bellard1e43adf2003-09-30 20:54:24 +0000897elif test "$target_cpu" = "sparc" ; then
898 echo "TARGET_ARCH=sparc" >> $config_mak
899 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
900 echo "#define TARGET_SPARC 1" >> $config_h
bellard64b3ab22005-01-30 22:43:42 +0000901elif test "$target_cpu" = "sparc64" ; then
902 echo "TARGET_ARCH=sparc64" >> $config_mak
903 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
904 echo "#define TARGET_SPARC 1" >> $config_h
905 echo "#define TARGET_SPARC64 1" >> $config_h
bellard67867302003-11-23 17:05:30 +0000906elif test "$target_cpu" = "ppc" ; then
907 echo "TARGET_ARCH=ppc" >> $config_mak
908 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
909 echo "#define TARGET_PPC 1" >> $config_h
bellarda2458622005-07-23 22:39:53 +0000910elif test "$target_cpu" = "ppc64" ; then
911 echo "TARGET_ARCH=ppc64" >> $config_mak
912 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
913 echo "#define TARGET_PPC 1" >> $config_h
914 echo "#define TARGET_PPC64 1" >> $config_h
bellard0b0babc2005-01-03 23:38:40 +0000915elif test "$target_cpu" = "x86_64" ; then
916 echo "TARGET_ARCH=x86_64" >> $config_mak
917 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
918 echo "#define TARGET_I386 1" >> $config_h
919 echo "#define TARGET_X86_64 1" >> $config_h
bellard07f4ddb2005-04-23 17:44:28 +0000920 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
921 echo "#define USE_KQEMU 1" >> $config_h
922 fi
bellardc20eb472005-12-06 21:42:55 +0000923elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
bellardd3258562005-07-02 15:37:12 +0000924 echo "TARGET_ARCH=mips" >> $config_mak
925 echo "#define TARGET_ARCH \"mips\"" >> $config_h
926 echo "#define TARGET_MIPS 1" >> $config_h
bellard6ea83fe2006-06-14 12:56:19 +0000927 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
928 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
thsfbe4f652007-04-01 11:16:48 +0000929elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
930 echo "TARGET_ARCH=mips64" >> $config_mak
931 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
932 echo "#define TARGET_MIPS 1" >> $config_h
933 echo "#define TARGET_MIPS64 1" >> $config_h
934 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
935 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
pbrook908f52b2006-06-18 19:16:53 +0000936elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
bellardfdf9b3e2006-04-27 21:07:38 +0000937 echo "TARGET_ARCH=sh4" >> $config_mak
938 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
939 echo "#define TARGET_SH4 1" >> $config_h
pbrook4dbed892006-06-17 20:01:14 +0000940 bflt="yes"
pbrooke6e59062006-10-22 00:18:54 +0000941elif test "$target_cpu" = "m68k" ; then
942 echo "TARGET_ARCH=m68k" >> $config_mak
943 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
944 echo "#define TARGET_M68K 1" >> $config_h
945 bflt="yes"
bellardde83cd02003-06-15 20:25:43 +0000946else
947 echo "Unsupported target CPU"
948 exit 1
949fi
950if test "$target_bigendian" = "yes" ; then
bellard97a847b2003-08-10 21:36:04 +0000951 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
952 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
953fi
954if test "$target_softmmu" = "yes" ; then
955 echo "CONFIG_SOFTMMU=yes" >> $config_mak
956 echo "#define CONFIG_SOFTMMU 1" >> $config_h
bellardde83cd02003-06-15 20:25:43 +0000957fi
bellard997344f2003-10-27 21:10:39 +0000958if test "$target_user_only" = "yes" ; then
959 echo "CONFIG_USER_ONLY=yes" >> $config_mak
960 echo "#define CONFIG_USER_ONLY 1" >> $config_h
961fi
ths831b7822007-01-18 20:06:33 +0000962if test "$target_linux_user" = "yes" ; then
963 echo "CONFIG_LINUX_USER=yes" >> $config_mak
964 echo "#define CONFIG_LINUX_USER 1" >> $config_h
965fi
966if test "$target_darwin_user" = "yes" ; then
967 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
968 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
969fi
bellardde83cd02003-06-15 20:25:43 +0000970
pbrooke6e59062006-10-22 00:18:54 +0000971if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
bellard158142c2005-03-13 16:54:06 +0000972 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
973 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
974fi
pbrooke5fe0c52006-06-11 13:32:59 +0000975if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
976 echo "TARGET_HAS_BFLT=yes" >> $config_mak
977 echo "#define TARGET_HAS_BFLT 1" >> $config_h
978fi
bellard7c1f25b2004-04-22 00:02:08 +0000979# sdl defines
980
981if test "$target_user_only" = "no"; then
982 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
bellarddbb2c922004-10-24 22:17:47 +0000983 sdl1=$sdl_static
bellard7c1f25b2004-04-22 00:02:08 +0000984 else
bellarddbb2c922004-10-24 22:17:47 +0000985 sdl1=$sdl
986 fi
987 if test "$sdl1" = "yes" ; then
988 echo "#define CONFIG_SDL 1" >> $config_h
989 echo "CONFIG_SDL=yes" >> $config_mak
990 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
991 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
992 else
bellard7c1f25b2004-04-22 00:02:08 +0000993 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
994 fi
bellarddbb2c922004-10-24 22:17:47 +0000995 if [ "${aa}" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000996 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
997 else
998 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
bellarddbb2c922004-10-24 22:17:47 +0000999 fi
bellard7c1f25b2004-04-22 00:02:08 +00001000 fi
bellard7c1f25b2004-04-22 00:02:08 +00001001fi
1002
bellard5b0753e2005-03-01 21:37:28 +00001003if test "$cocoa" = "yes" ; then
1004 echo "#define CONFIG_COCOA 1" >> $config_h
1005 echo "CONFIG_COCOA=yes" >> $config_mak
1006fi
1007
bellard97a847b2003-08-10 21:36:04 +00001008done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00001009
1010# build tree in object directory if source path is different from current one
1011if test "$source_path_used" = "yes" ; then
1012 DIRS="tests"
1013 FILES="Makefile tests/Makefile"
1014 for dir in $DIRS ; do
1015 mkdir -p $dir
1016 done
bellardec530c82006-04-25 22:36:06 +00001017 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00001018 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00001019 rm -f $f
1020 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00001021 done
1022fi
bellard7d132992003-03-06 23:23:54 +00001023
bellard97a847b2003-08-10 21:36:04 +00001024rm -f $TMPO $TMPC $TMPE $TMPS