Statistics
| Branch: | Revision:

root / configure @ 9f8df9c1

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