Statistics
| Branch: | Revision:

root / configure @ 77755340

History | View | Annotate | Download (46.7 kB)

1 7d13299d bellard
#!/bin/sh
2 7d13299d bellard
#
3 3ef693a0 bellard
# qemu configure script (c) 2003 Fabrice Bellard
4 7d13299d bellard
#
5 7d13299d bellard
# set temporary file name
6 7d13299d bellard
if test ! -z "$TMPDIR" ; then
7 7d13299d bellard
    TMPDIR1="${TMPDIR}"
8 7d13299d bellard
elif test ! -z "$TEMPDIR" ; then
9 7d13299d bellard
    TMPDIR1="${TEMPDIR}"
10 7d13299d bellard
else
11 7d13299d bellard
    TMPDIR1="/tmp"
12 7d13299d bellard
fi
13 7d13299d bellard
14 3ef693a0 bellard
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 3ef693a0 bellard
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 3ef693a0 bellard
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 3ef693a0 bellard
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 9d56d2dc malc
TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 7d13299d bellard
20 7d13299d bellard
# default parameters
21 11d9f695 bellard
prefix=""
22 1e43adfc bellard
interp_prefix="/usr/gnemul/qemu-%M"
23 43ce4dfe bellard
static="no"
24 7d13299d bellard
cross_prefix=""
25 7d13299d bellard
cc="gcc"
26 328a4240 pbrook
gcc3_search="yes"
27 fe8f78e4 balrog
gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
28 0c58ac1c malc
audio_drv_list=""
29 0c58ac1c malc
audio_card_list=""
30 7d13299d bellard
host_cc="gcc"
31 7d13299d bellard
ar="ar"
32 7d13299d bellard
make="make"
33 6a882643 pbrook
install="install"
34 7d13299d bellard
strip="strip"
35 b29fe3ed malc
cpu=`test $(uname -s) = AIX && uname -p || uname -m`
36 5327cf48 bellard
target_list=""
37 7d13299d bellard
case "$cpu" in
38 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
39 97a847bc bellard
    cpu="i386"
40 7d13299d bellard
  ;;
41 aaa5fa14 aurel32
  x86_64|amd64)
42 aaa5fa14 aurel32
    cpu="x86_64"
43 aaa5fa14 aurel32
  ;;
44 aaa5fa14 aurel32
  alpha)
45 aaa5fa14 aurel32
    cpu="alpha"
46 aaa5fa14 aurel32
  ;;
47 ba68055e bellard
  armv*b)
48 808c4954 bellard
    cpu="armv4b"
49 808c4954 bellard
  ;;
50 ba68055e bellard
  armv*l)
51 7d13299d bellard
    cpu="armv4l"
52 7d13299d bellard
  ;;
53 aaa5fa14 aurel32
  cris)
54 aaa5fa14 aurel32
    cpu="cris"
55 7d13299d bellard
  ;;
56 f54b3f92 aurel32
  parisc|parisc64)
57 f54b3f92 aurel32
    cpu="hppa"
58 f54b3f92 aurel32
  ;;
59 aaa5fa14 aurel32
  ia64)
60 aaa5fa14 aurel32
    cpu="ia64"
61 aaa5fa14 aurel32
  ;;
62 aaa5fa14 aurel32
  m68k)
63 aaa5fa14 aurel32
    cpu="m68k"
64 7d13299d bellard
  ;;
65 7d13299d bellard
  mips)
66 7d13299d bellard
    cpu="mips"
67 7d13299d bellard
  ;;
68 fbe4f65b ths
  mips64)
69 fbe4f65b ths
    cpu="mips64"
70 fbe4f65b ths
  ;;
71 b29fe3ed malc
  "Power Macintosh"|ppc|ppc64|powerpc)
72 aaa5fa14 aurel32
    cpu="powerpc"
73 e7daa605 ths
  ;;
74 0e7b8a9f ths
  s390*)
75 fb3e5849 bellard
    cpu="s390"
76 fb3e5849 bellard
  ;;
77 3142255c blueswir1
  sparc|sun4[cdmuv])
78 ae228531 bellard
    cpu="sparc"
79 ae228531 bellard
  ;;
80 ae228531 bellard
  sparc64)
81 ae228531 bellard
    cpu="sparc64"
82 ae228531 bellard
  ;;
83 7d13299d bellard
  *)
84 7d13299d bellard
    cpu="unknown"
85 7d13299d bellard
  ;;
86 7d13299d bellard
esac
87 7d13299d bellard
gprof="no"
88 03b4fe7d aliguori
sparse="no"
89 7d13299d bellard
bigendian="no"
90 67b915a5 bellard
mingw32="no"
91 67b915a5 bellard
EXESUF=""
92 67b915a5 bellard
gdbstub="yes"
93 443f1376 bellard
slirp="yes"
94 e0e6c8c0 aliguori
vde="yes"
95 102a52e4 bellard
fmod_lib=""
96 102a52e4 bellard
fmod_inc=""
97 2f6a1ab0 blueswir1
oss_lib=""
98 8d5d2d4c ths
vnc_tls="yes"
99 b1a550a0 pbrook
bsd="no"
100 5327cf48 bellard
linux="no"
101 d2c7c9b8 blueswir1
solaris="no"
102 c9ec1fe4 bellard
kqemu="no"
103 05c2a3e7 bellard
profiler="no"
104 5b0753e0 bellard
cocoa="no"
105 97ccc689 bellard
check_gfx="yes"
106 1aff381f bellard
check_gcc="yes"
107 0a8e90f4 pbrook
softmmu="yes"
108 831b7825 ths
linux_user="no"
109 831b7825 ths
darwin_user="no"
110 84778508 blueswir1
bsd_user="no"
111 cc8ae6de pbrook
build_docs="no"
112 c5937220 pbrook
uname_release=""
113 4d3b6f6e balrog
curses="yes"
114 414f0dab blueswir1
aio="yes"
115 bd0c5661 pbrook
nptl="yes"
116 8ff9cbf7 malc
mixemu="no"
117 fb599c9a balrog
bluez="yes"
118 7ba1e619 aliguori
kvm="yes"
119 eac30262 aliguori
kerneldir=""
120 b29fe3ed malc
aix="no"
121 77755340 ths
blobs="yes"
122 7d13299d bellard
123 7d13299d bellard
# OS specific
124 7d13299d bellard
targetos=`uname -s`
125 7d13299d bellard
case $targetos in
126 c326e0af bellard
CYGWIN*)
127 c326e0af bellard
mingw32="yes"
128 6f30fa85 ths
OS_CFLAGS="-mno-cygwin"
129 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
130 db8d7dd1 ths
    kqemu="yes"
131 db8d7dd1 ths
fi
132 c2de5c91 malc
audio_possible_drivers="sdl"
133 c326e0af bellard
;;
134 67b915a5 bellard
MINGW32*)
135 67b915a5 bellard
mingw32="yes"
136 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
137 db8d7dd1 ths
    kqemu="yes"
138 db8d7dd1 ths
fi
139 c2de5c91 malc
audio_possible_drivers="dsound sdl fmod"
140 67b915a5 bellard
;;
141 5c40d2bd ths
GNU/kFreeBSD)
142 0c58ac1c malc
audio_drv_list="oss"
143 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
144 5c40d2bd ths
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
145 5c40d2bd ths
    kqemu="yes"
146 5c40d2bd ths
fi
147 5c40d2bd ths
;;
148 7d3505c5 bellard
FreeBSD)
149 7d3505c5 bellard
bsd="yes"
150 0c58ac1c malc
audio_drv_list="oss"
151 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
152 f4887919 blueswir1
aio_lib="-lpthread"
153 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
154 07f4ddbf bellard
    kqemu="yes"
155 07f4ddbf bellard
fi
156 7d3505c5 bellard
;;
157 7d3505c5 bellard
NetBSD)
158 7d3505c5 bellard
bsd="yes"
159 0c58ac1c malc
audio_drv_list="oss"
160 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
161 8ef92a88 blueswir1
oss_lib="-lossaudio"
162 8ef92a88 blueswir1
aio_lib="-lrt -lpthread"
163 7d3505c5 bellard
;;
164 7d3505c5 bellard
OpenBSD)
165 7d3505c5 bellard
bsd="yes"
166 128ab2ff blueswir1
openbsd="yes"
167 0c58ac1c malc
audio_drv_list="oss"
168 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
169 2f6a1ab0 blueswir1
oss_lib="-lossaudio"
170 8ef92a88 blueswir1
aio_lib="-lpthread"
171 7d3505c5 bellard
;;
172 83fb7adf bellard
Darwin)
173 83fb7adf bellard
bsd="yes"
174 83fb7adf bellard
darwin="yes"
175 831b7825 ths
darwin_user="yes"
176 fd677642 ths
cocoa="yes"
177 0c58ac1c malc
audio_drv_list="coreaudio"
178 c2de5c91 malc
audio_possible_drivers="coreaudio sdl fmod"
179 6f30fa85 ths
OS_CFLAGS="-mdynamic-no-pic"
180 c2c59c3e ths
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
181 8ef92a88 blueswir1
aio_lib="-lpthread"
182 83fb7adf bellard
;;
183 ec530c81 bellard
SunOS)
184 c2b84fab ths
    solaris="yes"
185 c2b84fab ths
    make="gmake"
186 c2b84fab ths
    install="ginstall"
187 0475a5ca ths
    needs_libsunmath="no"
188 c2b84fab ths
    solarisrev=`uname -r | cut -f2 -d.`
189 ef18c883 ths
    # have to select again, because `uname -m` returns i86pc
190 ef18c883 ths
    # even on an x86_64 box.
191 ef18c883 ths
    solariscpu=`isainfo -k`
192 ef18c883 ths
    if test "${solariscpu}" = "amd64" ; then
193 ef18c883 ths
        cpu="x86_64"
194 ef18c883 ths
    fi
195 c2b84fab ths
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
196 0475a5ca ths
        if test "$solarisrev" -le 9 ; then
197 0475a5ca ths
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
198 0475a5ca ths
                needs_libsunmath="yes"
199 0475a5ca ths
            else
200 0475a5ca ths
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
201 0475a5ca ths
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
202 0475a5ca ths
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
203 0475a5ca ths
                echo "Studio 11 can be downloaded from www.sun.com."
204 0475a5ca ths
                exit 1
205 0475a5ca ths
            fi
206 0475a5ca ths
        fi
207 0475a5ca ths
        if test "$solarisrev" -ge 9 ; then
208 c2b84fab ths
            kqemu="yes"
209 c2b84fab ths
        fi
210 86b2bd93 ths
    fi
211 6b4d2ba1 ths
    if test -f /usr/include/sys/soundcard.h ; then
212 0c58ac1c malc
        audio_drv_list="oss"
213 6b4d2ba1 ths
    fi
214 c2de5c91 malc
    audio_possible_drivers="oss sdl"
215 86b2bd93 ths
;;
216 b29fe3ed malc
AIX)
217 b29fe3ed malc
aix="yes"
218 b29fe3ed malc
make="gmake"
219 b29fe3ed malc
;;
220 1d14ffa9 bellard
*)
221 0c58ac1c malc
audio_drv_list="oss"
222 b8e59f18 malc
audio_possible_drivers="oss alsa sdl esd pa"
223 5327cf48 bellard
linux="yes"
224 831b7825 ths
linux_user="yes"
225 68063649 blueswir1
usb="linux"
226 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
227 c9ec1fe4 bellard
    kqemu="yes"
228 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
229 c9ec1fe4 bellard
fi
230 fb065187 bellard
;;
231 7d13299d bellard
esac
232 7d13299d bellard
233 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
234 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
235 83fb7adf bellard
    make="gmake"
236 68063649 blueswir1
    usb="bsd"
237 83fb7adf bellard
  fi
238 84778508 blueswir1
  bsd_user="yes"
239 7d3505c5 bellard
fi
240 7d3505c5 bellard
241 7d13299d bellard
# find source path
242 ad064840 pbrook
source_path=`dirname "$0"`
243 59faef3a balrog
source_path_used="no"
244 59faef3a balrog
workdir=`pwd`
245 ad064840 pbrook
if [ -z "$source_path" ]; then
246 59faef3a balrog
    source_path=$workdir
247 ad064840 pbrook
else
248 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
249 7d13299d bellard
fi
250 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
251 7d13299d bellard
252 85aa5189 bellard
werror="no"
253 0d1e2394 bellard
# generate compile errors on warnings for development builds
254 0d1e2394 bellard
#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
255 0d1e2394 bellard
#werror="yes";
256 0d1e2394 bellard
#fi
257 85aa5189 bellard
258 7d13299d bellard
for opt do
259 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
260 7d13299d bellard
  case "$opt" in
261 2efc3265 bellard
  --help|-h) show_help=yes
262 2efc3265 bellard
  ;;
263 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
264 7d13299d bellard
  ;;
265 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
266 32ce6337 bellard
  ;;
267 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
268 ad064840 pbrook
  source_path_used="yes"
269 7d13299d bellard
  ;;
270 b1a550a0 pbrook
  --cross-prefix=*) cross_prefix="$optarg"
271 7d13299d bellard
  ;;
272 b1a550a0 pbrook
  --cc=*) cc="$optarg"
273 328a4240 pbrook
  gcc3_search="no"
274 7d13299d bellard
  ;;
275 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
276 83469015 bellard
  ;;
277 b1a550a0 pbrook
  --make=*) make="$optarg"
278 7d13299d bellard
  ;;
279 6a882643 pbrook
  --install=*) install="$optarg"
280 6a882643 pbrook
  ;;
281 b1a550a0 pbrook
  --extra-cflags=*) CFLAGS="$optarg"
282 7d13299d bellard
  ;;
283 b1a550a0 pbrook
  --extra-ldflags=*) LDFLAGS="$optarg"
284 7d13299d bellard
  ;;
285 b1a550a0 pbrook
  --cpu=*) cpu="$optarg"
286 7d13299d bellard
  ;;
287 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
288 de83cd02 bellard
  ;;
289 7d13299d bellard
  --enable-gprof) gprof="yes"
290 7d13299d bellard
  ;;
291 43ce4dfe bellard
  --static) static="yes"
292 43ce4dfe bellard
  ;;
293 97a847bc bellard
  --disable-sdl) sdl="no"
294 97a847bc bellard
  ;;
295 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
296 1d14ffa9 bellard
  ;;
297 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
298 c2de5c91 malc
  ;;
299 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
300 2f6a1ab0 blueswir1
  ;;
301 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
302 102a52e4 bellard
  ;;
303 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
304 102a52e4 bellard
  ;;
305 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
306 03b4fe7d aliguori
  ;;
307 03b4fe7d aliguori
  --disable-sparse) sparse="no"
308 03b4fe7d aliguori
  ;;
309 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
310 8d5d2d4c ths
  ;;
311 443f1376 bellard
  --disable-slirp) slirp="no"
312 1d14ffa9 bellard
  ;;
313 e0e6c8c0 aliguori
  --disable-vde) vde="no"
314 8a16d273 ths
  ;;
315 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
316 1d14ffa9 bellard
  ;;
317 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
318 2e4d9fb1 aurel32
  ;;
319 fb599c9a balrog
  --disable-bluez) bluez="no"
320 fb599c9a balrog
  ;;
321 7ba1e619 aliguori
  --disable-kvm) kvm="no"
322 7ba1e619 aliguori
  ;;
323 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
324 05c2a3e7 bellard
  ;;
325 c2de5c91 malc
  --enable-cocoa)
326 c2de5c91 malc
      cocoa="yes" ;
327 c2de5c91 malc
      sdl="no" ;
328 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
329 1d14ffa9 bellard
  ;;
330 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
331 97ccc689 bellard
  ;;
332 1aff381f bellard
  --disable-gcc-check) check_gcc="no"
333 1aff381f bellard
  ;;
334 cad25d69 pbrook
  --disable-system) softmmu="no"
335 0a8e90f4 pbrook
  ;;
336 cad25d69 pbrook
  --enable-system) softmmu="yes"
337 0a8e90f4 pbrook
  ;;
338 831b7825 ths
  --disable-linux-user) linux_user="no"
339 0a8e90f4 pbrook
  ;;
340 831b7825 ths
  --enable-linux-user) linux_user="yes"
341 831b7825 ths
  ;;
342 831b7825 ths
  --disable-darwin-user) darwin_user="no"
343 831b7825 ths
  ;;
344 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
345 0a8e90f4 pbrook
  ;;
346 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
347 84778508 blueswir1
  ;;
348 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
349 84778508 blueswir1
  ;;
350 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
351 c5937220 pbrook
  ;;
352 3142255c blueswir1
  --sparc_cpu=*)
353 3142255c blueswir1
      sparc_cpu="$optarg"
354 3142255c blueswir1
      case $sparc_cpu in
355 3142255c blueswir1
        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
356 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
357 3142255c blueswir1
        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
358 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
359 3142255c blueswir1
        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
360 3142255c blueswir1
                 target_cpu="sparc64"; cpu="sparc64" ;;
361 3142255c blueswir1
        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
362 3142255c blueswir1
      esac
363 3142255c blueswir1
  ;;
364 85aa5189 bellard
  --enable-werror) werror="yes"
365 85aa5189 bellard
  ;;
366 85aa5189 bellard
  --disable-werror) werror="no"
367 85aa5189 bellard
  ;;
368 4d3b6f6e balrog
  --disable-curses) curses="no"
369 4d3b6f6e balrog
  ;;
370 bd0c5661 pbrook
  --disable-nptl) nptl="no"
371 bd0c5661 pbrook
  ;;
372 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
373 8ff9cbf7 malc
  ;;
374 414f0dab blueswir1
  --disable-aio) aio="no"
375 414f0dab blueswir1
  ;;
376 77755340 ths
  --disable-blobs) blobs="no"
377 77755340 ths
  ;;
378 eac30262 aliguori
  --kerneldir=*) kerneldir="$optarg"
379 eac30262 aliguori
  ;;
380 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
381 7f1559c6 balrog
  ;;
382 7d13299d bellard
  esac
383 7d13299d bellard
done
384 7d13299d bellard
385 6f30fa85 ths
# default flags for all hosts
386 ac41a620 blueswir1
CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
387 ac41a620 blueswir1
CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
388 6f30fa85 ths
LDFLAGS="$LDFLAGS -g"
389 85aa5189 bellard
if test "$werror" = "yes" ; then
390 85aa5189 bellard
CFLAGS="$CFLAGS -Werror"
391 85aa5189 bellard
fi
392 6f30fa85 ths
393 d2c7c9b8 blueswir1
if test "$solaris" = "no" ; then
394 d2c7c9b8 blueswir1
    if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
395 d2c7c9b8 blueswir1
        LDFLAGS="$LDFLAGS -Wl,--warn-common"
396 d2c7c9b8 blueswir1
    fi
397 49237acd blueswir1
fi
398 49237acd blueswir1
399 3142255c blueswir1
#
400 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
401 3142255c blueswir1
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
402 3142255c blueswir1
#
403 40293e58 bellard
case "$cpu" in
404 3142255c blueswir1
    sparc) if test -z "$sparc_cpu" ; then
405 3142255c blueswir1
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
406 3142255c blueswir1
               ARCH_LDFLAGS="-m32"
407 3142255c blueswir1
           else
408 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
409 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
410 3142255c blueswir1
           fi
411 3142255c blueswir1
           ;;
412 3142255c blueswir1
    sparc64) if test -z "$sparc_cpu" ; then
413 3142255c blueswir1
               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
414 3142255c blueswir1
               ARCH_LDFLAGS="-m64"
415 3142255c blueswir1
           else
416 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
417 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
418 3142255c blueswir1
           fi
419 3142255c blueswir1
           ;;
420 76d83bde ths
    s390)
421 76d83bde ths
           ARCH_CFLAGS="-march=z900"
422 76d83bde ths
           ;;
423 40293e58 bellard
    i386)
424 40293e58 bellard
           ARCH_CFLAGS="-m32"
425 40293e58 bellard
           ARCH_LDFLAGS="-m32"
426 40293e58 bellard
           ;;
427 40293e58 bellard
    x86_64)
428 40293e58 bellard
           ARCH_CFLAGS="-m64"
429 40293e58 bellard
           ARCH_LDFLAGS="-m64"
430 40293e58 bellard
           ;;
431 3142255c blueswir1
esac
432 3142255c blueswir1
433 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
434 af5db58e pbrook
cat << EOF
435 af5db58e pbrook
436 af5db58e pbrook
Usage: configure [options]
437 af5db58e pbrook
Options: [defaults in brackets after descriptions]
438 af5db58e pbrook
439 af5db58e pbrook
EOF
440 af5db58e pbrook
echo "Standard options:"
441 af5db58e pbrook
echo "  --help                   print this message"
442 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
443 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
444 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
445 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
446 af5db58e pbrook
echo ""
447 af5db58e pbrook
echo "kqemu kernel acceleration support:"
448 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
449 af5db58e pbrook
echo ""
450 af5db58e pbrook
echo "Advanced options (experts only):"
451 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
452 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
453 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
454 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
455 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
456 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
457 af5db58e pbrook
echo "  --static                 enable static build [$static]"
458 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
459 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
460 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
461 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
462 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
463 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
464 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
465 c2de5c91 malc
echo "  --audio-card-list=LIST   set list of additional emulated audio cards"
466 c2de5c91 malc
echo "                           Available cards: ac97 adlib cs4231a gus"
467 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
468 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
469 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
470 af896aaa pbrook
echo "  --disable-curses         disable curses output"
471 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
472 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
473 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
474 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
475 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
476 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
477 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
478 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
479 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
480 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
481 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
482 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
483 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
484 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
485 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
486 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
487 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
488 414f0dab blueswir1
echo "  --disable-aio            disable AIO support"
489 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
490 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
491 af5db58e pbrook
echo ""
492 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
493 af5db58e pbrook
exit 1
494 af5db58e pbrook
fi
495 af5db58e pbrook
496 7d13299d bellard
cc="${cross_prefix}${cc}"
497 7d13299d bellard
ar="${cross_prefix}${ar}"
498 7d13299d bellard
strip="${cross_prefix}${strip}"
499 7d13299d bellard
500 064aae13 pbrook
# check that the C compiler works.
501 064aae13 pbrook
cat > $TMPC <<EOF
502 064aae13 pbrook
int main(void) {}
503 064aae13 pbrook
EOF
504 064aae13 pbrook
505 db7287ed pbrook
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
506 064aae13 pbrook
  : C compiler works ok
507 064aae13 pbrook
else
508 064aae13 pbrook
    echo "ERROR: \"$cc\" either does not exist or does not work"
509 064aae13 pbrook
    exit 1
510 a7350fa1 bellard
fi
511 a7350fa1 bellard
512 cd01b4a3 aliguori
# check compiler to see if we're on mingw32
513 cd01b4a3 aliguori
cat > $TMPC <<EOF
514 cd01b4a3 aliguori
#include <windows.h>
515 cd01b4a3 aliguori
#ifndef _WIN32
516 cd01b4a3 aliguori
#error not windows
517 cd01b4a3 aliguori
#endif
518 cd01b4a3 aliguori
int main(void) {}
519 cd01b4a3 aliguori
EOF
520 cd01b4a3 aliguori
521 cd01b4a3 aliguori
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
522 cd01b4a3 aliguori
    mingw32="yes"
523 cd01b4a3 aliguori
fi
524 cd01b4a3 aliguori
525 67b915a5 bellard
if test "$mingw32" = "yes" ; then
526 5327cf48 bellard
    linux="no"
527 67b915a5 bellard
    EXESUF=".exe"
528 9f059eca bellard
    oss="no"
529 cd01b4a3 aliguori
    linux_user="no"
530 84778508 blueswir1
    bsd_user="no"
531 cd01b4a3 aliguori
fi
532 cd01b4a3 aliguori
533 997306fc aliguori
if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
534 cd01b4a3 aliguori
    AIOLIBS=
535 997306fc aliguori
elif [ "$bsd" = "yes" ]; then
536 8ef92a88 blueswir1
    AIOLIBS="$aio_lib"
537 cd01b4a3 aliguori
else
538 cd01b4a3 aliguori
    # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
539 cd01b4a3 aliguori
    AIOLIBS="-lrt -lpthread"
540 67b915a5 bellard
fi
541 67b915a5 bellard
542 5fafdf24 ths
# Check for gcc4, error if pre-gcc4
543 328a4240 pbrook
if test "$check_gcc" = "yes" ; then
544 328a4240 pbrook
    cat > $TMPC <<EOF
545 328a4240 pbrook
#if __GNUC__ < 4
546 328a4240 pbrook
#error gcc3
547 328a4240 pbrook
#endif
548 328a4240 pbrook
int main(){return 0;}
549 328a4240 pbrook
EOF
550 db7287ed pbrook
    if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
551 328a4240 pbrook
	echo "WARNING: \"$cc\" looks like gcc 4.x"
552 328a4240 pbrook
	found_compat_cc="no"
553 328a4240 pbrook
	if test "$gcc3_search" = "yes" ; then
554 328a4240 pbrook
	    echo "Looking for gcc 3.x"
555 328a4240 pbrook
	    for compat_cc in $gcc3_list ; do
556 d4af3de2 balrog
		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
557 328a4240 pbrook
		    echo "Found \"$compat_cc\""
558 1124426a pbrook
		    cc="$cross_prefix$compat_cc"
559 328a4240 pbrook
		    found_compat_cc="yes"
560 328a4240 pbrook
		    break
561 328a4240 pbrook
		fi
562 328a4240 pbrook
	    done
563 328a4240 pbrook
	    if test "$found_compat_cc" = "no" ; then
564 328a4240 pbrook
		echo "gcc 3.x not found!"
565 328a4240 pbrook
	    fi
566 328a4240 pbrook
	fi
567 328a4240 pbrook
	if test "$found_compat_cc" = "no" ; then
568 328a4240 pbrook
	    echo "QEMU is known to have problems when compiled with gcc 4.x"
569 328a4240 pbrook
	    echo "It is recommended that you use gcc 3.x to build QEMU"
570 328a4240 pbrook
	    echo "To use this compiler anyway, configure with --disable-gcc-check"
571 328a4240 pbrook
	    exit 1;
572 328a4240 pbrook
	fi
573 328a4240 pbrook
    fi
574 328a4240 pbrook
fi
575 328a4240 pbrook
576 03b4fe7d aliguori
if test ! -x "$(which cgcc 2>/dev/null)"; then
577 03b4fe7d aliguori
    sparse="no"
578 03b4fe7d aliguori
fi
579 03b4fe7d aliguori
580 ec530c81 bellard
#
581 ec530c81 bellard
# Solaris specific configure tool chain decisions
582 ec530c81 bellard
#
583 ec530c81 bellard
if test "$solaris" = "yes" ; then
584 ec530c81 bellard
  #
585 ec530c81 bellard
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
586 ec530c81 bellard
  # override the check with --disable-gcc-check
587 5fafdf24 ths
  #
588 ec530c81 bellard
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
589 ec530c81 bellard
    solgcc=`which $cc`
590 ec530c81 bellard
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
591 ec530c81 bellard
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
592 ec530c81 bellard
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
593 ec530c81 bellard
      echo "or get the latest patch from SunSolve for gcc"
594 ec530c81 bellard
      exit 1
595 ec530c81 bellard
    fi
596 ec530c81 bellard
  fi
597 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
598 ec530c81 bellard
  if test -z "$solinst" ; then
599 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
600 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
601 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
602 ec530c81 bellard
    exit 1
603 ec530c81 bellard
  fi
604 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
605 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
606 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
607 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
608 ec530c81 bellard
    exit 1
609 ec530c81 bellard
  fi
610 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
611 ec530c81 bellard
  if test -z "$sol_ar" ; then
612 ec530c81 bellard
    echo "Error: No path includes ar"
613 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
614 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
615 ec530c81 bellard
    fi
616 ec530c81 bellard
    exit 1
617 ec530c81 bellard
  fi
618 5fafdf24 ths
fi
619 ec530c81 bellard
620 ec530c81 bellard
621 5327cf48 bellard
if test -z "$target_list" ; then
622 5327cf48 bellard
# these targets are portable
623 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
624 2408a527 aurel32
        target_list="\
625 2408a527 aurel32
i386-softmmu \
626 2408a527 aurel32
x86_64-softmmu \
627 2408a527 aurel32
arm-softmmu \
628 2408a527 aurel32
cris-softmmu \
629 2408a527 aurel32
m68k-softmmu \
630 2408a527 aurel32
mips-softmmu \
631 2408a527 aurel32
mipsel-softmmu \
632 2408a527 aurel32
mips64-softmmu \
633 2408a527 aurel32
mips64el-softmmu \
634 2408a527 aurel32
ppc-softmmu \
635 2408a527 aurel32
ppcemb-softmmu \
636 2408a527 aurel32
ppc64-softmmu \
637 2408a527 aurel32
sh4-softmmu \
638 2408a527 aurel32
sh4eb-softmmu \
639 2408a527 aurel32
sparc-softmmu \
640 2408a527 aurel32
"
641 0a8e90f4 pbrook
    fi
642 5327cf48 bellard
# the following are Linux specific
643 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
644 2408a527 aurel32
        target_list="${target_list}\
645 2408a527 aurel32
i386-linux-user \
646 2408a527 aurel32
x86_64-linux-user \
647 2408a527 aurel32
alpha-linux-user \
648 2408a527 aurel32
arm-linux-user \
649 2408a527 aurel32
armeb-linux-user \
650 2408a527 aurel32
cris-linux-user \
651 2408a527 aurel32
m68k-linux-user \
652 2408a527 aurel32
mips-linux-user \
653 2408a527 aurel32
mipsel-linux-user \
654 2408a527 aurel32
ppc-linux-user \
655 2408a527 aurel32
ppc64-linux-user \
656 2408a527 aurel32
ppc64abi32-linux-user \
657 2408a527 aurel32
sh4-linux-user \
658 2408a527 aurel32
sh4eb-linux-user \
659 2408a527 aurel32
sparc-linux-user \
660 2408a527 aurel32
sparc64-linux-user \
661 2408a527 aurel32
sparc32plus-linux-user \
662 2408a527 aurel32
"
663 831b7825 ths
    fi
664 831b7825 ths
# the following are Darwin specific
665 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
666 2408a527 aurel32
        target_list="$target_list i386-darwin-user ppc-darwin-user"
667 5327cf48 bellard
    fi
668 84778508 blueswir1
# the following are BSD specific
669 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
670 84778508 blueswir1
        target_list="${target_list}\
671 84778508 blueswir1
sparc64-bsd-user \
672 84778508 blueswir1
"
673 84778508 blueswir1
    fi
674 6e20a45f bellard
else
675 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
676 5327cf48 bellard
fi
677 0a8e90f4 pbrook
if test -z "$target_list" ; then
678 0a8e90f4 pbrook
    echo "No targets enabled"
679 0a8e90f4 pbrook
    exit 1
680 0a8e90f4 pbrook
fi
681 5327cf48 bellard
682 7d13299d bellard
if test -z "$cross_prefix" ; then
683 7d13299d bellard
684 7d13299d bellard
# ---
685 7d13299d bellard
# big/little endian test
686 7d13299d bellard
cat > $TMPC << EOF
687 7d13299d bellard
#include <inttypes.h>
688 7d13299d bellard
int main(int argc, char ** argv){
689 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
690 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
691 7d13299d bellard
}
692 7d13299d bellard
EOF
693 7d13299d bellard
694 db7287ed pbrook
if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
695 7d13299d bellard
$TMPE && bigendian="yes"
696 7d13299d bellard
else
697 7d13299d bellard
echo big/little test failed
698 7d13299d bellard
fi
699 7d13299d bellard
700 7d13299d bellard
else
701 7d13299d bellard
702 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
703 0938cda5 aurel32
if test "$cpu" = "armv4b" \
704 f54b3f92 aurel32
     -o "$cpu" = "hppa" \
705 0938cda5 aurel32
     -o "$cpu" = "m68k" \
706 0938cda5 aurel32
     -o "$cpu" = "mips" \
707 0938cda5 aurel32
     -o "$cpu" = "mips64" \
708 0938cda5 aurel32
     -o "$cpu" = "powerpc" \
709 0938cda5 aurel32
     -o "$cpu" = "s390" \
710 0938cda5 aurel32
     -o "$cpu" = "sparc" \
711 0938cda5 aurel32
     -o "$cpu" = "sparc64"; then
712 7d13299d bellard
    bigendian="yes"
713 7d13299d bellard
fi
714 7d13299d bellard
715 7d13299d bellard
fi
716 7d13299d bellard
717 b6853697 bellard
# host long bits test
718 b6853697 bellard
hostlongbits="32"
719 0938cda5 aurel32
if test "$cpu" = "x86_64" \
720 0938cda5 aurel32
     -o "$cpu" = "alpha" \
721 0938cda5 aurel32
     -o "$cpu" = "ia64" \
722 0938cda5 aurel32
     -o "$cpu" = "sparc64"; then
723 b6853697 bellard
    hostlongbits="64"
724 b6853697 bellard
fi
725 b6853697 bellard
726 810260a8 malc
# ppc specific hostlongbits selection
727 810260a8 malc
if test "$cpu" = "powerpc" ; then
728 9d56d2dc malc
    if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
729 9d56d2dc malc
        grep -q __powerpc64__ $TMPI && hostlongbits=64
730 810260a8 malc
    else
731 810260a8 malc
        echo hostlongbits test failed
732 ba69a08a malc
        exit 1
733 810260a8 malc
    fi
734 810260a8 malc
fi
735 810260a8 malc
736 e8cd23de bellard
# check gcc options support
737 04369ff2 bellard
cat > $TMPC <<EOF
738 04369ff2 bellard
int main(void) {
739 04369ff2 bellard
}
740 04369ff2 bellard
EOF
741 04369ff2 bellard
742 bd0c5661 pbrook
# Check host NPTL support
743 bd0c5661 pbrook
cat > $TMPC <<EOF
744 bd0c5661 pbrook
#include <sched.h>
745 30813cea pbrook
#include <linux/futex.h>
746 bd0c5661 pbrook
void foo()
747 bd0c5661 pbrook
{
748 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
749 bd0c5661 pbrook
#error bork
750 bd0c5661 pbrook
#endif
751 bd0c5661 pbrook
}
752 bd0c5661 pbrook
EOF
753 bd0c5661 pbrook
754 bd0c5661 pbrook
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
755 bd0c5661 pbrook
  :
756 bd0c5661 pbrook
else
757 bd0c5661 pbrook
   nptl="no"
758 bd0c5661 pbrook
fi
759 bd0c5661 pbrook
760 11d9f695 bellard
##########################################
761 ac62922e balrog
# zlib check
762 ac62922e balrog
763 ac62922e balrog
cat > $TMPC << EOF
764 ac62922e balrog
#include <zlib.h>
765 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
766 ac62922e balrog
EOF
767 17e1592d balrog
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
768 ac62922e balrog
    :
769 ac62922e balrog
else
770 ac62922e balrog
    echo
771 ac62922e balrog
    echo "Error: zlib check failed"
772 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
773 ac62922e balrog
    echo
774 ac62922e balrog
    exit 1
775 ac62922e balrog
fi
776 ac62922e balrog
777 ac62922e balrog
##########################################
778 11d9f695 bellard
# SDL probe
779 11d9f695 bellard
780 11d9f695 bellard
sdl_too_old=no
781 11d9f695 bellard
782 11d9f695 bellard
if test -z "$sdl" ; then
783 069b0bda ths
    sdl_config="sdl-config"
784 069b0bda ths
    sdl=no
785 069b0bda ths
    sdl_static=no
786 069b0bda ths
787 11d9f695 bellard
cat > $TMPC << EOF
788 11d9f695 bellard
#include <SDL.h>
789 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
790 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
791 11d9f695 bellard
EOF
792 cd01b4a3 aliguori
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
793 cd01b4a3 aliguori
        _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
794 cd01b4a3 aliguori
        if test "$_sdlversion" -lt 121 ; then
795 cd01b4a3 aliguori
            sdl_too_old=yes
796 cd01b4a3 aliguori
        else
797 cd01b4a3 aliguori
            if test "$cocoa" = "no" ; then
798 cd01b4a3 aliguori
                sdl=yes
799 069b0bda ths
            fi
800 cd01b4a3 aliguori
        fi
801 11d9f695 bellard
802 cd01b4a3 aliguori
        # static link with sdl ?
803 cd01b4a3 aliguori
        if test "$sdl" = "yes" ; then
804 cd01b4a3 aliguori
            aa="no"
805 cd01b4a3 aliguori
            `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
806 cd01b4a3 aliguori
            sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
807 cd01b4a3 aliguori
            if [ "$aa" = "yes" ] ; then
808 cd01b4a3 aliguori
                sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
809 cd01b4a3 aliguori
            fi
810 cd01b4a3 aliguori
811 cd01b4a3 aliguori
            if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
812 cd01b4a3 aliguori
                sdl_static=yes
813 cd01b4a3 aliguori
            fi
814 cd01b4a3 aliguori
        fi # static link
815 cd01b4a3 aliguori
    fi # sdl compile test
816 fd677642 ths
else
817 069b0bda ths
    # Make sure to disable cocoa if sdl was set
818 069b0bda ths
    if test "$sdl" = "yes" ; then
819 069b0bda ths
       cocoa="no"
820 c2de5c91 malc
       audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
821 069b0bda ths
    fi
822 a6e022ad bellard
fi # -z $sdl
823 11d9f695 bellard
824 8f28f3fb ths
##########################################
825 8d5d2d4c ths
# VNC TLS detection
826 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
827 ae6b5e5a aliguori
cat > $TMPC <<EOF
828 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
829 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
830 ae6b5e5a aliguori
EOF
831 ae6b5e5a aliguori
    vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
832 ae6b5e5a aliguori
    vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
833 ae6b5e5a aliguori
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
834 ae6b5e5a aliguori
           $vnc_tls_libs 2> /dev/null ; then
835 ae6b5e5a aliguori
	:
836 ae6b5e5a aliguori
    else
837 ae6b5e5a aliguori
	vnc_tls="no"
838 ae6b5e5a aliguori
    fi
839 8d5d2d4c ths
fi
840 8d5d2d4c ths
841 8d5d2d4c ths
##########################################
842 8a16d273 ths
# vde libraries probe
843 8a16d273 ths
if test "$vde" = "yes" ; then
844 8a16d273 ths
  cat > $TMPC << EOF
845 8a16d273 ths
#include <libvdeplug.h>
846 4a7f0e06 pbrook
int main(void)
847 4a7f0e06 pbrook
{
848 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
849 4a7f0e06 pbrook
    vde_open("", "", &a);
850 4a7f0e06 pbrook
    return 0;
851 4a7f0e06 pbrook
}
852 8a16d273 ths
EOF
853 4a7f0e06 pbrook
    if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
854 8a16d273 ths
        :
855 8a16d273 ths
    else
856 e0e6c8c0 aliguori
        vde="no"
857 8a16d273 ths
    fi
858 8a16d273 ths
fi
859 8a16d273 ths
860 8a16d273 ths
##########################################
861 c2de5c91 malc
# Sound support libraries probe
862 8f28f3fb ths
863 c2de5c91 malc
audio_drv_probe()
864 c2de5c91 malc
{
865 c2de5c91 malc
    drv=$1
866 c2de5c91 malc
    hdr=$2
867 c2de5c91 malc
    lib=$3
868 c2de5c91 malc
    exp=$4
869 c2de5c91 malc
    cfl=$5
870 c2de5c91 malc
        cat > $TMPC << EOF
871 c2de5c91 malc
#include <$hdr>
872 c2de5c91 malc
int main(void) { $exp }
873 8f28f3fb ths
EOF
874 c2de5c91 malc
    if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
875 c2de5c91 malc
        :
876 c2de5c91 malc
    else
877 c2de5c91 malc
        echo
878 c2de5c91 malc
        echo "Error: $drv check failed"
879 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
880 c2de5c91 malc
        echo
881 c2de5c91 malc
        exit 1
882 c2de5c91 malc
    fi
883 c2de5c91 malc
}
884 c2de5c91 malc
885 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
886 c2de5c91 malc
for drv in $audio_drv_list; do
887 c2de5c91 malc
    case $drv in
888 c2de5c91 malc
    alsa)
889 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
890 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
891 c2de5c91 malc
    ;;
892 c2de5c91 malc
893 c2de5c91 malc
    fmod)
894 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
895 c2de5c91 malc
        echo
896 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
897 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
898 c2de5c91 malc
        echo
899 c2de5c91 malc
        exit 1
900 c2de5c91 malc
    fi
901 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
902 c2de5c91 malc
    ;;
903 c2de5c91 malc
904 c2de5c91 malc
    esd)
905 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
906 c2de5c91 malc
    ;;
907 b8e59f18 malc
908 b8e59f18 malc
    pa)
909 b8e59f18 malc
    audio_drv_probe $drv pulse/simple.h -lpulse-simple \
910 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
911 b8e59f18 malc
    ;;
912 b8e59f18 malc
913 2f6a1ab0 blueswir1
    oss|sdl|core|wav|dsound)
914 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
915 2f6a1ab0 blueswir1
    ;;
916 2f6a1ab0 blueswir1
917 e4c63a6a malc
    *)
918 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
919 e4c63a6a malc
        echo
920 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
921 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
922 e4c63a6a malc
        echo
923 e4c63a6a malc
        exit 1
924 e4c63a6a malc
    }
925 e4c63a6a malc
    ;;
926 c2de5c91 malc
    esac
927 c2de5c91 malc
done
928 8f28f3fb ths
929 4d3b6f6e balrog
##########################################
930 2e4d9fb1 aurel32
# BrlAPI probe
931 2e4d9fb1 aurel32
932 2e4d9fb1 aurel32
if test -z "$brlapi" ; then
933 2e4d9fb1 aurel32
    brlapi=no
934 2e4d9fb1 aurel32
cat > $TMPC << EOF
935 2e4d9fb1 aurel32
#include <brlapi.h>
936 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
937 2e4d9fb1 aurel32
EOF
938 a40e56d5 aurel32
    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
939 2e4d9fb1 aurel32
	    brlapi=yes
940 2e4d9fb1 aurel32
    fi # brlapi compile test
941 2e4d9fb1 aurel32
fi # -z $brlapi
942 2e4d9fb1 aurel32
943 2e4d9fb1 aurel32
##########################################
944 4d3b6f6e balrog
# curses probe
945 4d3b6f6e balrog
946 4d3b6f6e balrog
if test "$curses" = "yes" ; then
947 4d3b6f6e balrog
  curses=no
948 4d3b6f6e balrog
  cat > $TMPC << EOF
949 4d3b6f6e balrog
#include <curses.h>
950 4d3b6f6e balrog
int main(void) { return curses_version(); }
951 4d3b6f6e balrog
EOF
952 af896aaa pbrook
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
953 4d3b6f6e balrog
    curses=yes
954 4d3b6f6e balrog
  fi
955 4d3b6f6e balrog
fi # test "$curses"
956 4d3b6f6e balrog
957 414f0dab blueswir1
##########################################
958 fb599c9a balrog
# bluez support probe
959 fb599c9a balrog
if test "$bluez" = "yes" ; then
960 fb599c9a balrog
  `pkg-config bluez` || bluez="no"
961 fb599c9a balrog
fi
962 fb599c9a balrog
if test "$bluez" = "yes" ; then
963 e820e3f4 balrog
  cat > $TMPC << EOF
964 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
965 e820e3f4 balrog
int main(void) { return bt_error(0); }
966 e820e3f4 balrog
EOF
967 fb599c9a balrog
  bluez_cflags=`pkg-config --cflags bluez`
968 fb599c9a balrog
  bluez_libs=`pkg-config --libs bluez`
969 17e1592d balrog
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
970 e820e3f4 balrog
      $bluez_libs 2> /dev/null ; then
971 e820e3f4 balrog
    :
972 e820e3f4 balrog
  else
973 e820e3f4 balrog
    bluez="no"
974 e820e3f4 balrog
  fi
975 fb599c9a balrog
fi
976 fb599c9a balrog
977 fb599c9a balrog
##########################################
978 7ba1e619 aliguori
# kvm probe
979 7ba1e619 aliguori
if test "$kvm" = "yes" ; then
980 7ba1e619 aliguori
    cat > $TMPC <<EOF
981 7ba1e619 aliguori
#include <linux/kvm.h>
982 7ba1e619 aliguori
#if !defined(KVM_API_VERSION) || \
983 7ba1e619 aliguori
    KVM_API_VERSION < 12 || \
984 7ba1e619 aliguori
    KVM_API_VERSION > 12 || \
985 7ba1e619 aliguori
    !defined(KVM_CAP_USER_MEMORY) || \
986 7ba1e619 aliguori
    !defined(KVM_CAP_SET_TSS_ADDR)
987 7ba1e619 aliguori
#error Invalid KVM version
988 7ba1e619 aliguori
#endif
989 7ba1e619 aliguori
int main(void) { return 0; }
990 7ba1e619 aliguori
EOF
991 eac30262 aliguori
  if test "$kerneldir" != "" ; then
992 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
993 eac30262 aliguori
  else
994 eac30262 aliguori
      kvm_cflags=""
995 eac30262 aliguori
  fi
996 7ba1e619 aliguori
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
997 7ba1e619 aliguori
      2>/dev/null ; then
998 7ba1e619 aliguori
    :
999 7ba1e619 aliguori
  else
1000 7ba1e619 aliguori
    kvm="no"
1001 7ba1e619 aliguori
  fi
1002 7ba1e619 aliguori
fi
1003 7ba1e619 aliguori
1004 7ba1e619 aliguori
##########################################
1005 414f0dab blueswir1
# AIO probe
1006 414f0dab blueswir1
if test "$aio" = "yes" ; then
1007 414f0dab blueswir1
  aio=no
1008 414f0dab blueswir1
  cat > $TMPC << EOF
1009 414f0dab blueswir1
#include <aio.h>
1010 414f0dab blueswir1
int main(void) { return aio_write(NULL); }
1011 414f0dab blueswir1
EOF
1012 414f0dab blueswir1
  if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1013 414f0dab blueswir1
    aio=yes
1014 414f0dab blueswir1
  fi
1015 414f0dab blueswir1
fi
1016 414f0dab blueswir1
1017 cc8ae6de pbrook
# Check if tools are available to build documentation.
1018 6c591867 ths
if [ -x "`which texi2html 2>/dev/null`" ] && \
1019 6c591867 ths
   [ -x "`which pod2man 2>/dev/null`" ]; then
1020 cc8ae6de pbrook
  build_docs="yes"
1021 cc8ae6de pbrook
fi
1022 cc8ae6de pbrook
1023 11d9f695 bellard
if test "$mingw32" = "yes" ; then
1024 308c3593 pbrook
  if test -z "$prefix" ; then
1025 17e90973 aliguori
      prefix="c:\\\\Program Files\\\\Qemu"
1026 308c3593 pbrook
  fi
1027 308c3593 pbrook
  mansuffix=""
1028 308c3593 pbrook
  datasuffix=""
1029 308c3593 pbrook
  docsuffix=""
1030 308c3593 pbrook
  binsuffix=""
1031 11d9f695 bellard
else
1032 308c3593 pbrook
  if test -z "$prefix" ; then
1033 308c3593 pbrook
      prefix="/usr/local"
1034 308c3593 pbrook
  fi
1035 308c3593 pbrook
  mansuffix="/share/man"
1036 308c3593 pbrook
  datasuffix="/share/qemu"
1037 308c3593 pbrook
  docsuffix="/share/doc/qemu"
1038 308c3593 pbrook
  binsuffix="/bin"
1039 11d9f695 bellard
fi
1040 5a67135a bellard
1041 43ce4dfe bellard
echo "Install prefix    $prefix"
1042 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
1043 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
1044 11d9f695 bellard
if test "$mingw32" = "no" ; then
1045 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
1046 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
1047 11d9f695 bellard
fi
1048 5a67135a bellard
echo "Source path       $source_path"
1049 43ce4dfe bellard
echo "C compiler        $cc"
1050 83469015 bellard
echo "Host C compiler   $host_cc"
1051 db7287ed pbrook
echo "ARCH_CFLAGS       $ARCH_CFLAGS"
1052 43ce4dfe bellard
echo "make              $make"
1053 6a882643 pbrook
echo "install           $install"
1054 43ce4dfe bellard
echo "host CPU          $cpu"
1055 de83cd02 bellard
echo "host big endian   $bigendian"
1056 97a847bc bellard
echo "target list       $target_list"
1057 43ce4dfe bellard
echo "gprof enabled     $gprof"
1058 03b4fe7d aliguori
echo "sparse enabled    $sparse"
1059 05c2a3e7 bellard
echo "profiler          $profiler"
1060 43ce4dfe bellard
echo "static build      $static"
1061 85aa5189 bellard
echo "-Werror enabled   $werror"
1062 5b0753e0 bellard
if test "$darwin" = "yes" ; then
1063 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
1064 5b0753e0 bellard
fi
1065 97a847bc bellard
echo "SDL support       $sdl"
1066 e4afee97 bellard
if test "$sdl" != "no" ; then
1067 e4afee97 bellard
    echo "SDL static link   $sdl_static"
1068 e4afee97 bellard
fi
1069 4d3b6f6e balrog
echo "curses support    $curses"
1070 67b915a5 bellard
echo "mingw32 support   $mingw32"
1071 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
1072 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
1073 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
1074 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
1075 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1076 8d5d2d4c ths
    echo "    TLS CFLAGS    $vnc_tls_cflags"
1077 8d5d2d4c ths
    echo "    TLS LIBS      $vnc_tls_libs"
1078 8d5d2d4c ths
fi
1079 3142255c blueswir1
if test -n "$sparc_cpu"; then
1080 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
1081 3142255c blueswir1
fi
1082 07f4ddbf bellard
echo "kqemu support     $kqemu"
1083 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
1084 cc8ae6de pbrook
echo "Documentation     $build_docs"
1085 c5937220 pbrook
[ ! -z "$uname_release" ] && \
1086 c5937220 pbrook
echo "uname -r          $uname_release"
1087 bd0c5661 pbrook
echo "NPTL support      $nptl"
1088 8a16d273 ths
echo "vde support       $vde"
1089 414f0dab blueswir1
echo "AIO support       $aio"
1090 77755340 ths
echo "Install blobs     $blobs"
1091 7ba1e619 aliguori
echo "KVM support       $kvm"
1092 67b915a5 bellard
1093 97a847bc bellard
if test $sdl_too_old = "yes"; then
1094 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
1095 7c1f25b4 bellard
fi
1096 20b40c6a ths
if [ -s /tmp/qemu-$$-sdl-config.log ]; then
1097 20b40c6a ths
  echo "The error log from compiling the libSDL test is: "
1098 20b40c6a ths
  cat /tmp/qemu-$$-sdl-config.log
1099 20b40c6a ths
fi
1100 20b40c6a ths
rm -f /tmp/qemu-$$-sdl-config.log
1101 24b55b96 bellard
#if test "$sdl_static" = "no"; then
1102 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1103 24b55b96 bellard
#fi
1104 97a847bc bellard
config_mak="config-host.mak"
1105 97a847bc bellard
config_h="config-host.h"
1106 7d13299d bellard
1107 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
1108 7d13299d bellard
1109 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1110 15d9ca0f ths
1111 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1112 29517134 pbrook
echo "# Configured with: $0 $@" >> $config_mak
1113 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
1114 7d13299d bellard
1115 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
1116 308c3593 pbrook
echo "bindir=\${prefix}$binsuffix" >> $config_mak
1117 308c3593 pbrook
echo "mandir=\${prefix}$mansuffix" >> $config_mak
1118 308c3593 pbrook
echo "datadir=\${prefix}$datasuffix" >> $config_mak
1119 4ad5b06d ths
echo "docdir=\${prefix}$docsuffix" >> $config_mak
1120 308c3593 pbrook
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1121 97a847bc bellard
echo "MAKE=$make" >> $config_mak
1122 6a882643 pbrook
echo "INSTALL=$install" >> $config_mak
1123 97a847bc bellard
echo "CC=$cc" >> $config_mak
1124 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
1125 97a847bc bellard
echo "AR=$ar" >> $config_mak
1126 97a847bc bellard
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1127 40293e58 bellard
# XXX: only use CFLAGS and LDFLAGS ?  
1128 40293e58 bellard
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1129 40293e58 bellard
# compilation of dyngen tool (useful for win32 build on Linux host)
1130 6f30fa85 ths
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1131 3142255c blueswir1
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1132 3142255c blueswir1
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1133 3142255c blueswir1
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1134 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
1135 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
1136 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
1137 70956b77 ths
echo "AIOLIBS=$AIOLIBS" >> $config_mak
1138 2408a527 aurel32
case "$cpu" in
1139 2408a527 aurel32
  i386)
1140 2408a527 aurel32
    echo "ARCH=i386" >> $config_mak
1141 2408a527 aurel32
    echo "#define HOST_I386 1" >> $config_h
1142 2408a527 aurel32
  ;;
1143 2408a527 aurel32
  x86_64)
1144 2408a527 aurel32
    echo "ARCH=x86_64" >> $config_mak
1145 2408a527 aurel32
    echo "#define HOST_X86_64 1" >> $config_h
1146 2408a527 aurel32
  ;;
1147 2408a527 aurel32
  alpha)
1148 2408a527 aurel32
    echo "ARCH=alpha" >> $config_mak
1149 2408a527 aurel32
    echo "#define HOST_ALPHA 1" >> $config_h
1150 2408a527 aurel32
  ;;
1151 2408a527 aurel32
  armv4b)
1152 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
1153 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
1154 2408a527 aurel32
  ;;
1155 2408a527 aurel32
  armv4l)
1156 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
1157 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
1158 2408a527 aurel32
  ;;
1159 2408a527 aurel32
  cris)
1160 2408a527 aurel32
    echo "ARCH=cris" >> $config_mak
1161 2408a527 aurel32
    echo "#define HOST_CRIS 1" >> $config_h
1162 2408a527 aurel32
  ;;
1163 2408a527 aurel32
  hppa)
1164 2408a527 aurel32
    echo "ARCH=hppa" >> $config_mak
1165 2408a527 aurel32
    echo "#define HOST_HPPA 1" >> $config_h
1166 2408a527 aurel32
  ;;
1167 2408a527 aurel32
  ia64)
1168 2408a527 aurel32
    echo "ARCH=ia64" >> $config_mak
1169 2408a527 aurel32
    echo "#define HOST_IA64 1" >> $config_h
1170 2408a527 aurel32
  ;;
1171 2408a527 aurel32
  m68k)
1172 2408a527 aurel32
    echo "ARCH=m68k" >> $config_mak
1173 2408a527 aurel32
    echo "#define HOST_M68K 1" >> $config_h
1174 2408a527 aurel32
  ;;
1175 2408a527 aurel32
  mips)
1176 2408a527 aurel32
    echo "ARCH=mips" >> $config_mak
1177 2408a527 aurel32
    echo "#define HOST_MIPS 1" >> $config_h
1178 2408a527 aurel32
  ;;
1179 2408a527 aurel32
  mips64)
1180 2408a527 aurel32
    echo "ARCH=mips64" >> $config_mak
1181 2408a527 aurel32
    echo "#define HOST_MIPS64 1" >> $config_h
1182 2408a527 aurel32
  ;;
1183 2408a527 aurel32
  powerpc)
1184 810260a8 malc
  if test "$hostlongbits" = "32"; then
1185 810260a8 malc
      echo "ARCH=ppc" >> $config_mak
1186 810260a8 malc
      echo "#define HOST_PPC 1" >> $config_h
1187 810260a8 malc
  else
1188 810260a8 malc
      echo "ARCH=ppc64" >> $config_mak
1189 810260a8 malc
      echo "#define HOST_PPC64 1" >> $config_h
1190 810260a8 malc
  fi
1191 2408a527 aurel32
  ;;
1192 2408a527 aurel32
  s390)
1193 2408a527 aurel32
    echo "ARCH=s390" >> $config_mak
1194 2408a527 aurel32
    echo "#define HOST_S390 1" >> $config_h
1195 2408a527 aurel32
  ;;
1196 2408a527 aurel32
  sparc)
1197 2408a527 aurel32
    echo "ARCH=sparc" >> $config_mak
1198 2408a527 aurel32
    echo "#define HOST_SPARC 1" >> $config_h
1199 2408a527 aurel32
  ;;
1200 2408a527 aurel32
  sparc64)
1201 2408a527 aurel32
    echo "ARCH=sparc64" >> $config_mak
1202 2408a527 aurel32
    echo "#define HOST_SPARC64 1" >> $config_h
1203 2408a527 aurel32
  ;;
1204 2408a527 aurel32
  *)
1205 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1206 2408a527 aurel32
    exit 1
1207 2408a527 aurel32
  ;;
1208 2408a527 aurel32
esac
1209 03b4fe7d aliguori
if test "$sparse" = "yes" ; then
1210 03b4fe7d aliguori
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
1211 03b4fe7d aliguori
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
1212 03b4fe7d aliguori
  echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1213 03b4fe7d aliguori
fi
1214 7d13299d bellard
if test "$bigendian" = "yes" ; then
1215 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
1216 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
1217 97a847bc bellard
fi
1218 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1219 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1220 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
1221 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
1222 210fa556 pbrook
else
1223 210fa556 pbrook
  cat > $TMPC << EOF
1224 210fa556 pbrook
#include <byteswap.h>
1225 210fa556 pbrook
int main(void) { return bswap_32(0); }
1226 210fa556 pbrook
EOF
1227 db7287ed pbrook
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1228 210fa556 pbrook
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1229 210fa556 pbrook
  fi
1230 67b915a5 bellard
fi
1231 128ab2ff blueswir1
1232 128ab2ff blueswir1
if [ "$openbsd" = "yes" ] ; then
1233 128ab2ff blueswir1
  echo "#define ENOTSUP 4096" >> $config_h
1234 128ab2ff blueswir1
fi
1235 128ab2ff blueswir1
1236 83fb7adf bellard
if test "$darwin" = "yes" ; then
1237 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
1238 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
1239 83fb7adf bellard
fi
1240 b29fe3ed malc
1241 b29fe3ed malc
if test "$aix" = "yes" ; then
1242 b29fe3ed malc
  echo "CONFIG_AIX=yes" >> $config_mak
1243 b29fe3ed malc
  echo "#define CONFIG_AIX 1" >> $config_h
1244 b29fe3ed malc
fi
1245 b29fe3ed malc
1246 ec530c81 bellard
if test "$solaris" = "yes" ; then
1247 ec530c81 bellard
  echo "CONFIG_SOLARIS=yes" >> $config_mak
1248 38cfa06c bellard
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1249 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1250 0475a5ca ths
    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1251 0475a5ca ths
    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1252 0475a5ca ths
  fi
1253 ec530c81 bellard
fi
1254 3142255c blueswir1
if test -n "$sparc_cpu"; then
1255 3142255c blueswir1
  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1256 3142255c blueswir1
  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1257 3142255c blueswir1
fi
1258 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
1259 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
1260 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
1261 67b915a5 bellard
fi
1262 97a847bc bellard
if test "$gprof" = "yes" ; then
1263 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
1264 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
1265 97a847bc bellard
fi
1266 97a847bc bellard
if test "$static" = "yes" ; then
1267 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
1268 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
1269 7d13299d bellard
fi
1270 05c2a3e7 bellard
if test $profiler = "yes" ; then
1271 05c2a3e7 bellard
  echo "#define CONFIG_PROFILER 1" >> $config_h
1272 05c2a3e7 bellard
fi
1273 c20709aa bellard
if test "$slirp" = "yes" ; then
1274 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
1275 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
1276 c20709aa bellard
fi
1277 8a16d273 ths
if test "$vde" = "yes" ; then
1278 8a16d273 ths
  echo "CONFIG_VDE=yes" >> $config_mak
1279 8a16d273 ths
  echo "#define CONFIG_VDE 1" >> $config_h
1280 8a16d273 ths
  echo "VDE_LIBS=-lvdeplug" >> $config_mak
1281 8a16d273 ths
fi
1282 0c58ac1c malc
for card in $audio_card_list; do
1283 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1284 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1285 0c58ac1c malc
    echo "#define $def 1" >> $config_h
1286 0c58ac1c malc
done
1287 0c58ac1c malc
echo "#define AUDIO_DRIVERS \\" >> $config_h
1288 0c58ac1c malc
for drv in $audio_drv_list; do
1289 0c58ac1c malc
    echo "    &${drv}_audio_driver, \\" >>$config_h
1290 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1291 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1292 923e4521 malc
    if test "$drv" = "fmod"; then
1293 0c58ac1c malc
        echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1294 0c58ac1c malc
        echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1295 2f6a1ab0 blueswir1
    elif test "$drv" = "oss"; then
1296 2f6a1ab0 blueswir1
        echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1297 0c58ac1c malc
    fi
1298 0c58ac1c malc
done
1299 0c58ac1c malc
echo "" >>$config_h
1300 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1301 8ff9cbf7 malc
  echo "CONFIG_MIXEMU=yes" >> $config_mak
1302 8ff9cbf7 malc
  echo "#define CONFIG_MIXEMU 1" >> $config_h
1303 8ff9cbf7 malc
fi
1304 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1305 8d5d2d4c ths
  echo "CONFIG_VNC_TLS=yes" >> $config_mak
1306 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1307 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1308 8d5d2d4c ths
  echo "#define CONFIG_VNC_TLS 1" >> $config_h
1309 8d5d2d4c ths
fi
1310 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1311 b1a550a0 pbrook
echo "VERSION=$qemu_version" >>$config_mak
1312 d4b8f039 pbrook
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1313 97a847bc bellard
1314 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
1315 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1316 ad064840 pbrook
  echo "VPATH=$source_path" >> $config_mak
1317 ad064840 pbrook
fi
1318 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
1319 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
1320 cc8ae6de pbrook
  echo "BUILD_DOCS=yes" >> $config_mak
1321 cc8ae6de pbrook
fi
1322 49ecc3fa bellard
if test "$static" = "yes"; then
1323 49ecc3fa bellard
  sdl1=$sdl_static
1324 49ecc3fa bellard
else
1325 49ecc3fa bellard
  sdl1=$sdl
1326 49ecc3fa bellard
fi
1327 49ecc3fa bellard
if test "$sdl1" = "yes" ; then
1328 49ecc3fa bellard
  echo "#define CONFIG_SDL 1" >> $config_h
1329 49ecc3fa bellard
  echo "CONFIG_SDL=yes" >> $config_mak
1330 49ecc3fa bellard
  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1331 49ecc3fa bellard
    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1332 49ecc3fa bellard
  else
1333 49ecc3fa bellard
    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1334 49ecc3fa bellard
  fi
1335 49ecc3fa bellard
  if [ "${aa}" = "yes" ] ; then
1336 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1337 49ecc3fa bellard
  else
1338 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1339 49ecc3fa bellard
  fi
1340 49ecc3fa bellard
fi
1341 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
1342 4d3b6f6e balrog
  echo "#define CONFIG_COCOA 1" >> $config_h
1343 4d3b6f6e balrog
  echo "CONFIG_COCOA=yes" >> $config_mak
1344 4d3b6f6e balrog
fi
1345 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1346 4d3b6f6e balrog
  echo "#define CONFIG_CURSES 1" >> $config_h
1347 4d3b6f6e balrog
  echo "CONFIG_CURSES=yes" >> $config_mak
1348 4d3b6f6e balrog
  echo "CURSES_LIBS=-lcurses" >> $config_mak
1349 49ecc3fa bellard
fi
1350 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
1351 2e4d9fb1 aurel32
  echo "CONFIG_BRLAPI=yes" >> $config_mak
1352 2e4d9fb1 aurel32
  echo "#define CONFIG_BRLAPI 1" >> $config_h
1353 2e4d9fb1 aurel32
  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1354 2e4d9fb1 aurel32
fi
1355 fb599c9a balrog
if test "$bluez" = "yes" ; then
1356 fb599c9a balrog
  echo "CONFIG_BLUEZ=yes" >> $config_mak
1357 fb599c9a balrog
  echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1358 fb599c9a balrog
  echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1359 fb599c9a balrog
  echo "#define CONFIG_BLUEZ 1" >> $config_h
1360 fb599c9a balrog
fi
1361 414f0dab blueswir1
if test "$aio" = "yes" ; then
1362 414f0dab blueswir1
  echo "#define CONFIG_AIO 1" >> $config_h
1363 a3392f9b aliguori
  echo "CONFIG_AIO=yes" >> $config_mak
1364 414f0dab blueswir1
fi
1365 77755340 ths
if test "$blobs" = "yes" ; then
1366 77755340 ths
  echo "INSTALL_BLOBS=yes" >> $config_mak
1367 77755340 ths
fi
1368 97a847bc bellard
1369 83fb7adf bellard
# XXX: suppress that
1370 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
1371 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
1372 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1373 7d3505c5 bellard
  echo "#define _BSD 1" >> $config_h
1374 7d3505c5 bellard
fi
1375 7d3505c5 bellard
1376 c5937220 pbrook
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1377 c5937220 pbrook
1378 68063649 blueswir1
# USB host support
1379 68063649 blueswir1
case "$usb" in
1380 68063649 blueswir1
linux)
1381 68063649 blueswir1
  echo "HOST_USB=linux" >> $config_mak
1382 68063649 blueswir1
;;
1383 68063649 blueswir1
bsd)
1384 68063649 blueswir1
  echo "HOST_USB=bsd" >> $config_mak
1385 68063649 blueswir1
;;
1386 68063649 blueswir1
*)
1387 68063649 blueswir1
  echo "HOST_USB=stub" >> $config_mak
1388 68063649 blueswir1
;;
1389 68063649 blueswir1
esac
1390 68063649 blueswir1
1391 c39e3338 pbrook
tools=
1392 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1393 c39e3338 pbrook
  tools="qemu-img\$(EXESUF) $tools"
1394 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
1395 7a5ca864 bellard
      tools="qemu-nbd\$(EXESUF) $tools"
1396 7a5ca864 bellard
  fi
1397 c39e3338 pbrook
fi
1398 c39e3338 pbrook
echo "TOOLS=$tools" >> $config_mak
1399 c39e3338 pbrook
1400 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1401 15d9ca0f ths
1402 1d14ffa9 bellard
for target in $target_list; do
1403 97a847bc bellard
target_dir="$target"
1404 97a847bc bellard
config_mak=$target_dir/config.mak
1405 97a847bc bellard
config_h=$target_dir/config.h
1406 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
1407 97a847bc bellard
target_bigendian="no"
1408 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1409 0938cda5 aurel32
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1410 0938cda5 aurel32
[ "$target_cpu" = "mips" ] && target_bigendian=yes
1411 0938cda5 aurel32
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1412 0938cda5 aurel32
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
1413 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
1414 d4082e95 j_mayer
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1415 22f8a8b3 j_mayer
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1416 e85e7c6e j_mayer
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1417 908f52b0 pbrook
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1418 0938cda5 aurel32
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1419 0938cda5 aurel32
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1420 0938cda5 aurel32
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1421 97a847bc bellard
target_softmmu="no"
1422 997344f3 bellard
target_user_only="no"
1423 831b7825 ths
target_linux_user="no"
1424 831b7825 ths
target_darwin_user="no"
1425 84778508 blueswir1
target_bsd_user="no"
1426 9e407a85 pbrook
case "$target" in
1427 9e407a85 pbrook
  ${target_cpu}-softmmu)
1428 9e407a85 pbrook
    target_softmmu="yes"
1429 9e407a85 pbrook
    ;;
1430 9e407a85 pbrook
  ${target_cpu}-linux-user)
1431 9e407a85 pbrook
    target_user_only="yes"
1432 9e407a85 pbrook
    target_linux_user="yes"
1433 9e407a85 pbrook
    ;;
1434 9e407a85 pbrook
  ${target_cpu}-darwin-user)
1435 9e407a85 pbrook
    target_user_only="yes"
1436 9e407a85 pbrook
    target_darwin_user="yes"
1437 9e407a85 pbrook
    ;;
1438 84778508 blueswir1
  ${target_cpu}-bsd-user)
1439 84778508 blueswir1
    target_user_only="yes"
1440 84778508 blueswir1
    target_bsd_user="yes"
1441 84778508 blueswir1
    ;;
1442 9e407a85 pbrook
  *)
1443 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
1444 9e407a85 pbrook
    exit 1
1445 9e407a85 pbrook
    ;;
1446 9e407a85 pbrook
esac
1447 831b7825 ths
1448 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1449 1d14ffa9 bellard
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1450 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1451 9c038506 pbrook
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
1452 4d3b6f6e balrog
    echo "Note that this will disable all output from the virtual graphics card"
1453 4d3b6f6e balrog
    echo "except through VNC or curses."
1454 97ccc689 bellard
    exit 1;
1455 97ccc689 bellard
fi
1456 97ccc689 bellard
1457 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1458 97a847bc bellard
1459 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1460 15d9ca0f ths
1461 97a847bc bellard
mkdir -p $target_dir
1462 158142c2 bellard
mkdir -p $target_dir/fpu
1463 57fec1fe bellard
mkdir -p $target_dir/tcg
1464 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1465 69de927c bellard
  mkdir -p $target_dir/nwfpe
1466 69de927c bellard
fi
1467 69de927c bellard
1468 ec530c81 bellard
#
1469 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
1470 ec530c81 bellard
#
1471 ec530c81 bellard
rm -f $target_dir/Makefile
1472 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
1473 ec530c81 bellard
1474 97a847bc bellard
1475 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1476 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
1477 97a847bc bellard
1478 de83cd02 bellard
1479 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
1480 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
1481 1e43adfc bellard
1482 e5fe0c52 pbrook
bflt="no"
1483 cb33da57 blueswir1
elfload32="no"
1484 bd0c5661 pbrook
target_nptl="no"
1485 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1486 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1487 56aebc89 pbrook
gdb_xml_files=""
1488 97a847bc bellard
1489 5985ecee aliguori
# Make sure the target and host cpus are compatible
1490 5985ecee aliguori
if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1491 5985ecee aliguori
  \( "$target_cpu" = "x86_64" -a "$cpu" = "i386"   \) -o \
1492 5985ecee aliguori
  \( "$target_cpu" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
1493 7ba1e619 aliguori
  kvm="no"
1494 7ba1e619 aliguori
fi
1495 7ba1e619 aliguori
# Disable KVM for linux-user
1496 7ba1e619 aliguori
if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1497 7ba1e619 aliguori
  kvm="no"
1498 7ba1e619 aliguori
fi
1499 7ba1e619 aliguori
1500 2408a527 aurel32
case "$target_cpu" in
1501 2408a527 aurel32
  i386)
1502 2408a527 aurel32
    echo "TARGET_ARCH=i386" >> $config_mak
1503 2408a527 aurel32
    echo "#define TARGET_ARCH \"i386\"" >> $config_h
1504 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1505 da260249 bellard
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1506 2408a527 aurel32
    then
1507 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1508 2408a527 aurel32
    fi
1509 7ba1e619 aliguori
    if test "$kvm" = "yes" ; then
1510 7ba1e619 aliguori
      echo "CONFIG_KVM=yes" >> $config_mak
1511 7ba1e619 aliguori
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1512 5985ecee aliguori
      echo "#define CONFIG_KVM 1" >> $config_h
1513 7ba1e619 aliguori
    fi
1514 f2bf094e aurel32
    gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1515 11d1fdb0 pbrook
    if test -n "$gcc3minver" && test $gcc3minver -gt 3
1516 f2bf094e aurel32
    then
1517 f2bf094e aurel32
      echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1518 f2bf094e aurel32
    else
1519 f2bf094e aurel32
      echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1520 f2bf094e aurel32
    fi
1521 2408a527 aurel32
  ;;
1522 2408a527 aurel32
  x86_64)
1523 2408a527 aurel32
    echo "TARGET_ARCH=x86_64" >> $config_mak
1524 2408a527 aurel32
    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1525 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1526 2408a527 aurel32
    echo "#define TARGET_X86_64 1" >> $config_h
1527 2408a527 aurel32
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1528 2408a527 aurel32
    then
1529 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1530 2408a527 aurel32
    fi
1531 7ba1e619 aliguori
    if test "$kvm" = "yes" ; then
1532 7ba1e619 aliguori
      echo "CONFIG_KVM=yes" >> $config_mak
1533 7ba1e619 aliguori
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1534 7ba1e619 aliguori
      echo "#define CONFIG_KVM 1" >> $config_h
1535 7ba1e619 aliguori
    fi
1536 2408a527 aurel32
  ;;
1537 2408a527 aurel32
  alpha)
1538 2408a527 aurel32
    echo "TARGET_ARCH=alpha" >> $config_mak
1539 2408a527 aurel32
    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1540 2408a527 aurel32
    echo "#define TARGET_ALPHA 1" >> $config_h
1541 2408a527 aurel32
  ;;
1542 2408a527 aurel32
  arm|armeb)
1543 2408a527 aurel32
    echo "TARGET_ARCH=arm" >> $config_mak
1544 2408a527 aurel32
    echo "#define TARGET_ARCH \"arm\"" >> $config_h
1545 2408a527 aurel32
    echo "#define TARGET_ARM 1" >> $config_h
1546 2408a527 aurel32
    bflt="yes"
1547 bd0c5661 pbrook
    target_nptl="yes"
1548 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1549 2408a527 aurel32
  ;;
1550 2408a527 aurel32
  cris)
1551 2408a527 aurel32
    echo "TARGET_ARCH=cris" >> $config_mak
1552 2408a527 aurel32
    echo "#define TARGET_ARCH \"cris\"" >> $config_h
1553 2408a527 aurel32
    echo "#define TARGET_CRIS 1" >> $config_h
1554 2408a527 aurel32
  ;;
1555 2408a527 aurel32
  m68k)
1556 2408a527 aurel32
    echo "TARGET_ARCH=m68k" >> $config_mak
1557 2408a527 aurel32
    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1558 2408a527 aurel32
    echo "#define TARGET_M68K 1" >> $config_h
1559 2408a527 aurel32
    bflt="yes"
1560 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
1561 2408a527 aurel32
  ;;
1562 2408a527 aurel32
  mips|mipsel)
1563 2408a527 aurel32
    echo "TARGET_ARCH=mips" >> $config_mak
1564 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips\"" >> $config_h
1565 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1566 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1567 2408a527 aurel32
  ;;
1568 2408a527 aurel32
  mipsn32|mipsn32el)
1569 2408a527 aurel32
    echo "TARGET_ARCH=mipsn32" >> $config_mak
1570 2408a527 aurel32
    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1571 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1572 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1573 2408a527 aurel32
  ;;
1574 2408a527 aurel32
  mips64|mips64el)
1575 2408a527 aurel32
    echo "TARGET_ARCH=mips64" >> $config_mak
1576 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1577 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1578 2408a527 aurel32
    echo "#define TARGET_MIPS64 1" >> $config_h
1579 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1580 2408a527 aurel32
  ;;
1581 2408a527 aurel32
  ppc)
1582 2408a527 aurel32
    echo "TARGET_ARCH=ppc" >> $config_mak
1583 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1584 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1585 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1586 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1587 2408a527 aurel32
  ;;
1588 2408a527 aurel32
  ppcemb)
1589 2408a527 aurel32
    echo "TARGET_ARCH=ppcemb" >> $config_mak
1590 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1591 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1592 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1593 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1594 2408a527 aurel32
    echo "#define TARGET_PPCEMB 1" >> $config_h
1595 ec5b78cd blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1596 2408a527 aurel32
  ;;
1597 2408a527 aurel32
  ppc64)
1598 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1599 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1600 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1601 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1602 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1603 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1604 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1605 2408a527 aurel32
  ;;
1606 2408a527 aurel32
  ppc64abi32)
1607 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1608 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1609 2408a527 aurel32
    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1610 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1611 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1612 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1613 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1614 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1615 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1616 2408a527 aurel32
  ;;
1617 2408a527 aurel32
  sh4|sh4eb)
1618 2408a527 aurel32
    echo "TARGET_ARCH=sh4" >> $config_mak
1619 2408a527 aurel32
    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1620 2408a527 aurel32
    echo "#define TARGET_SH4 1" >> $config_h
1621 2408a527 aurel32
    bflt="yes"
1622 0b6d3ae0 aurel32
    target_nptl="yes"
1623 2408a527 aurel32
  ;;
1624 2408a527 aurel32
  sparc)
1625 2408a527 aurel32
    echo "TARGET_ARCH=sparc" >> $config_mak
1626 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1627 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1628 2408a527 aurel32
  ;;
1629 2408a527 aurel32
  sparc64)
1630 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1631 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1632 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1633 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1634 2408a527 aurel32
    elfload32="yes"
1635 2408a527 aurel32
  ;;
1636 2408a527 aurel32
  sparc32plus)
1637 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1638 2408a527 aurel32
    echo "TARGET_ABI_DIR=sparc" >> $config_mak
1639 2408a527 aurel32
    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1640 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1641 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1642 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1643 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1644 2408a527 aurel32
  ;;
1645 2408a527 aurel32
  *)
1646 2408a527 aurel32
    echo "Unsupported target CPU"
1647 2408a527 aurel32
    exit 1
1648 2408a527 aurel32
  ;;
1649 2408a527 aurel32
esac
1650 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
1651 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1652 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1653 de83cd02 bellard
fi
1654 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
1655 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
1656 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1657 43ce4dfe bellard
fi
1658 997344f3 bellard
if test "$target_user_only" = "yes" ; then
1659 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1660 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1661 997344f3 bellard
fi
1662 831b7825 ths
if test "$target_linux_user" = "yes" ; then
1663 831b7825 ths
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1664 831b7825 ths
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1665 831b7825 ths
fi
1666 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
1667 831b7825 ths
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1668 831b7825 ths
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1669 831b7825 ths
fi
1670 56aebc89 pbrook
list=""
1671 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
1672 56aebc89 pbrook
  for x in $gdb_xml_files; do
1673 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
1674 56aebc89 pbrook
  done
1675 56aebc89 pbrook
fi
1676 56aebc89 pbrook
echo "TARGET_XML_FILES=$list" >> $config_mak
1677 97a847bc bellard
1678 0938cda5 aurel32
if test "$target_cpu" = "arm" \
1679 0938cda5 aurel32
     -o "$target_cpu" = "armeb" \
1680 0938cda5 aurel32
     -o "$target_cpu" = "m68k" \
1681 0938cda5 aurel32
     -o "$target_cpu" = "mips" \
1682 0938cda5 aurel32
     -o "$target_cpu" = "mipsel" \
1683 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32" \
1684 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32el" \
1685 0938cda5 aurel32
     -o "$target_cpu" = "mips64" \
1686 0938cda5 aurel32
     -o "$target_cpu" = "mips64el" \
1687 0938cda5 aurel32
     -o "$target_cpu" = "sparc" \
1688 0938cda5 aurel32
     -o "$target_cpu" = "sparc64" \
1689 0938cda5 aurel32
     -o "$target_cpu" = "sparc32plus"; then
1690 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1691 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1692 158142c2 bellard
fi
1693 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1694 e5fe0c52 pbrook
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1695 e5fe0c52 pbrook
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1696 e5fe0c52 pbrook
fi
1697 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
1698 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1699 bd0c5661 pbrook
  echo "#define USE_NPTL 1" >> $config_h
1700 bd0c5661 pbrook
fi
1701 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
1702 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1703 cb33da57 blueswir1
  echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1704 cb33da57 blueswir1
  echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1705 cb33da57 blueswir1
fi
1706 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
1707 84778508 blueswir1
  echo "CONFIG_BSD_USER=yes" >> $config_mak
1708 84778508 blueswir1
  echo "#define CONFIG_BSD_USER 1" >> $config_h
1709 84778508 blueswir1
fi
1710 5b0753e0 bellard
1711 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1712 15d9ca0f ths
1713 97a847bc bellard
done # for target in $targets
1714 7d13299d bellard
1715 7d13299d bellard
# build tree in object directory if source path is different from current one
1716 7d13299d bellard
if test "$source_path_used" = "yes" ; then
1717 49ecc3fa bellard
    DIRS="tests tests/cris slirp audio"
1718 7d13299d bellard
    FILES="Makefile tests/Makefile"
1719 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1720 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
1721 7d13299d bellard
    for dir in $DIRS ; do
1722 7d13299d bellard
            mkdir -p $dir
1723 7d13299d bellard
    done
1724 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
1725 7d13299d bellard
    for f in $FILES ; do
1726 ec530c81 bellard
        rm -f $f
1727 ec530c81 bellard
        ln -s $source_path/$f $f
1728 7d13299d bellard
    done
1729 7d13299d bellard
fi
1730 7d13299d bellard
1731 9d56d2dc malc
rm -f $TMPO $TMPC $TMPE $TMPS $TMPI