Statistics
| Branch: | Revision:

root / configure @ d76d1650

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